Back to NxLabs

NxLabs / Vintage Story

Catch and Release LIB

MBy MortalityGames

Shared library for Catch and Release mods.

Description

Shared library for <span style="color: #3598db; --darkreader-inline-color: var(--darkreader-text-3598db, #46a1de);" data-darkreader-inline-color="">Catch and Release: Butterflies</span> and <span style="color: #3598db; --darkreader-inline-color: var(--darkreader-text-3598db, #46a1de);" data-darkreader-inline-color="">Catch and Release: Fish</span>.

Contains common code for "cages" and storing creatures within those cages.

image&nbsp; &nbsp;

&nbsp;

&nbsp;


<span style="color: #e03e2d;" data-darkreader-inline-color="">Below is for modders who want to extend the mod or create their own caged creatures</span>

&nbsp;

TODO: Documentation on API. If anyone is interested in using this for further mods, come and discuss in Catch and Release post in the VS Discord.

Example how to setup new cages:

  1. Create shape + animations for caged creature entities
  2. Entity definition for caged creature(s). Including:
Caged creature behaviour snipped
behaviors: [
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; code: "taskai",
&nbsp; &nbsp; &nbsp; &nbsp; aitasks: [{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; code: "crlib.CreatureCaged",
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; priority: 0,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; movespeed: 0.6,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;- How fast caged creature moves
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; turnspeed: 2.5,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;- How fast caged creature turns to target position
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveAnim: "fly", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;- Name of animation for when moving
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; restAnim: "feed",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;- Name of animation for when sleeping
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; restTime: "Day",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;- Creature sleeps during "Day" "Night" or "None" (to not rest)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; restDaylightLevel: 0.7,&nbsp; &nbsp;&lt;- Daylight amount to trigger sleeping (basically, time of day)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; groundOnRest: true&nbsp; &nbsp; &nbsp; &nbsp;&lt;- When resting, does the creature find the ground first
&nbsp; &nbsp; &nbsp; &nbsp; }]
&nbsp; &nbsp; }
]
  1. Shape for your cage(s) (plus textures if needed)
  2. Custom cage block(s). Including:
Cage config attribute
attributes: {
&nbsp; &nbsp; cageConfig: {
&nbsp; &nbsp; &nbsp; &nbsp; cageName: "crbutterfly:cage_name",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;- Just some display test when refering to this type of cage
&nbsp; &nbsp; &nbsp; &nbsp; fits: 4,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;- How many creatures fit in the cage
&nbsp; &nbsp; &nbsp; &nbsp; radius: 0.3,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;- Size of the cage (for the purpose of determining creatures walking around)
&nbsp; &nbsp; &nbsp; &nbsp; height: 0.5,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;- Height of the cage (for the purpose of flying creatures - 0 for walking creatures)
&nbsp; &nbsp; &nbsp; &nbsp; bottom: 0.05,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;- Offset the 'floor' of the cage
&nbsp; &nbsp; &nbsp; &nbsp; validItems: "game:creature-butterfly-*",&nbsp; &nbsp; &nbsp; &nbsp;&lt;- What creature items can be placed in the cage
&nbsp; &nbsp; &nbsp; &nbsp; dropsEntity: "game:butterfly-",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;- What creature items fall out of a broken cage
&nbsp; &nbsp; &nbsp; &nbsp; spawnEntity: "crbutterfly:cagedbutterfly-",&nbsp; &nbsp;&lt;- What creature entities 'wander' in the cage
&nbsp; &nbsp; &nbsp; &nbsp; displays: 1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;- How many items to display in a cage
&nbsp; &nbsp; },
}
  1. Recipe(s) for cage(s)

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.