Jump to content

Suggestion: Update moonbeastspawner.lua to prevent moonbase event from targeting player characters and crashing game.


ItsDieter
  • Pending

Hi Klei team,

I’m developing a custom character mod for Don't Starve Together that includes a wereform transformation, which shares behavioral similarities with werepigs and moonbeasts (e.g., tags like pig and werepig). However, I ran into a bug during the Moonstorm/Moonbase event where it attempted to transform my character into a moonpig.  This causes a crash due to missing NPC components like "named".

After investigating, I found that the moonbeastspawner.lua component targets entities with the moonbeast tag during the event, but doesn’t check whether those entities are players. This can inadvertently affect custom characters that use that tag for unrelated purposes.  Most of the code is local, so postinit and overwrite attempts don't address the issue.

Potential Fixes:
In scripts like moonbeastspawner.lua, please consider:
- Adding "player" to the list of SPAWN_CANT_TAGS (line 61)
- Filtering out "player" entities in IF statements (line 79)
- Providing a method to opt in or out explicitly

Any option would make the system more mod-friendly and prevent event-related crashes due to incompatible assumptions about nearby prefabs.

Current workaround:
From line 79 I searched to see where the other filter tags were being used (ex:  moonbeast, clay, gargoyle) and the moonbeast one only seems to relate to this event.  Normally I'd only add it during were-phase, but my character may transform at a different moonphase than the event, so placing AddTag("moonbeast") in my main function and opting not to toggle it on/off, seemed okay.

Thanks for all the support you’ve given to modders — DST’s design and flexibility is a huge part of its long-term appeal.


Steps to Reproduce

Player mod has "werepig" tag, but not one of {"INLIMBO","moonbeast","gargoyle","clay"} when moonbeastspawner is called.




User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...