Better Crew (Diet-version)

If you liked this item, please rate it up on Steam Workshop page.

Author: Vix

Last revision: 6 Dec, 2023 at 05:54 UTC (1)

File size: 166.91 KB

On Steam Workshop

Description:
Important Information

Better crew has evolved! The newest version makes heavier modifications to the lua files.
As it might break compatibility with some mods, the last diet version will stay available here if you need to keep using it. This version is final and won’t receive any more udpate, just patches.

The newer full version is there!

DO NOT use both versions at once.

Summary

You recruit twelve NPCs to become your ship’s crew, and then what happens onboard? They all mob the teleporter and ignore the rest of your ship.

NPC behaviors in Starbound are quite simplistic, and this becomes most obvious in crew behavior onboard the player’s ship.

Better Crew upgrades your Crew from brainless beefcakes to the average chihuahua.

Originally posted by Vix:

I’m solely the uploader.Actually now we’re on my fork, since some stuff needed patching in the base mod.
rl_starbound
is the original author of rl_bettercrew[github.com] .
Since it wasn’t on the Steam workshop and the license allows it, I took on myself to summarize slightly the description (character limits) and I’m trying to provide basic support from my understanding and usage experience of the mod.
Very important patches:

How work:
The ADHD issue

The idea behind this mod is based on the mod "Smart Crew" by metamorphexx. In that mod, each crew type has a hard-coded list of objects that attracts that crew type, and on each behavior tick, each crew member searches the player’s ship for each object on their type’s list and moves to one such object, if found.

Issue with that is that this search would happen on each behavior tick, for each crew member, for each object in the crew type’s list.

In Better Crew, as each object placed into the ship world that contains crew anchors registers itself and its location with the ship’s TechStation (S.A.I.L. panel). Be sure to have the patches mentioned above for modded races/ships/furniture!

The need to rest instead of loitering

Normally, no NPC will attempt to sleep in a bed further than 50 blocks or sit in a chair further than 80 blocks from their spawn location, which on the ship is the teleporter.

In Better Crew, the search radius for beds and chairs is 250 blocks for crew members onboard player ships, which should sufficiently cover all vanilla ship classes.

Shipboard Duty Stations and Patrols

While onboard the player’s ship, each of the twelve crew types will now be attracted to certain objects, if present. These objects will pull the crew away from their spawn location (i.e., the teleporter). If you have done a good job designing your ship’s spaces, this should result in the crew spreading out throughout the ship and moving around in a way that feels natural.
In general, crew are attracted to objects that are related to their occupations.
In Better Crew, it patches over 100 vanilla objects with crew anchor tags.

The bug of having too much determination

Starbound’s simplistic behavior logic also hides a significant bug, which is why on some other mods and vanilla, your crew seem to lack brain functions and just derp out for half an hour or more.

Basically, an NPC behavior fires moveToPosition with some coordinates, and the NPC plans a route to those coordinates (via a call to Starbound’s C++ API) and moves there. If the game cannot plan a route from the NPC’s to its destination (e.g., if the location is behind a locked door), the NPC just stands there and waits, presumably in case a route opens up in the future. There is no built-in timeout functionality in moveToPosition. An NPC stuck waiting will continue to wait indefinitely, or until a higher priority behavior is triggered (e.g., combat, or the player interacting with them). Some uses of moveToPosition were wrapped inside of a timeout behavior, but the majority were not.

Resulting in NPC Freezing.
In Better Crew, this has been fixed.

Doors.

Issue is that, you might like your racial ship doors. But moving around your ship, manually opening and closing doors is annoying, so you wire proximity sensors on either side of each door.
Which to the game’s path finding, counts as a closed&locked door., because something is wired to the input node, even with a proximity sensor. So NPCs would only go through doors if they happened to wander close enough to open then, then the game would see the door as an opened locked door, and consider pathfinding through it, and stop doing so as soon as the door closes again.

In Better Crew, the solution chosen was to make all racial ship doors to open automatically. You should be mindful of this issue for all non-automatically opening doors still though. Note that the game’s path-finding logic is in its C++ code, so modders cannot fix this directly, and have to hack around it.

Compatibility Notes

Note to other mod authors:A full list of which objects attract which crew types can be found by reading this mod’s source code, particularly by looking in all of the *.object.patch files for the key crewAnchorTags. In general, crew are attracted to objects that are related to their occupations, and this mod patches 100+ base game objects with crew anchor tags.
(You may add the field crewAnchorTags to your own objects, if you wish to use this mod in combination with your own. The value is a JSON list of strings, with each string being one of the crewmember NPC types that should be attracted to the object.)

Modified Lua

This mod modifies behavior files and Lua scripts, and there is no truly safe way to modify those. If this mod is combined with any other mod that modifies the same behavior files, the result is likely to be broken NPC behaviors. If this mod is combined with any other mod that modifies any of the following Lua functions, then conflicts will happen:

  • /npcs/bmain.lua: setNpcItemSlot
  • /scripts/actions/npc.lua: swapItemSlots
  • /scripts/actions/query.lua: findLoungable
  • /scripts/actions/reaction.lua: playBehaviorReaction

As a general rule of thumb, you should assume that this mod is not compatible with any other mod that significantly alters NPC behavior.

This mod might not be compatible with BYOS, or any other mod that adds similar functionality, such as Frackin Universe.

Miscellaneous Bug Fixes and Tweaks

Running out of space, check Change Notes!

Download
Revisions:

Old revisions of this mod are available below. Click the link to download.