Don't Starve Together

Don't Starve Together

Stamina System [Leaf Mods]
amoryleaf  [developer] 1 Jun, 2021 @ 3:14pm
Aggro System Bug
The player can get into a state where they are permanently in combat therefore disabling stamina until the server is restarted.

I've experienced this twice: 1) after killing hounds in the first hound wave; 2) and when going through a wormhole while in combat.
< >
Showing 1-10 of 10 comments
amoryleaf  [developer] 1 Jun, 2021 @ 3:23pm 
Each enemy that targets the player is added to a list. They are removed from the list if the enemy drops the player as a target, if they're dead, or if they're removed from the world.
For 1) Not sure what caused it, haven't been able to reproduce.
For 2) DropTarget isn't called when I expect it to be. It makes sense that if player goes through a wormhole that the enemies would drop their target but... Apparently not!
amoryleaf  [developer] 1 Jun, 2021 @ 3:26pm 
For now I'm going to add a workaround. If the player wants to sprint but is in combat, make sure they're actually in combat.
amoryleaf  [developer] 1 Jun, 2021 @ 8:03pm 
ok 2) happens when the entity is "asleep". I expected the entity would be in limbo or removed from the scene but guess not.
amoryleaf  [developer] 3 Jun, 2021 @ 5:56pm 
Released version 1.1 which refactors the aggro system (to separate into its own component) to handle when enemies go to "sleep" which is when the player is a certain distance away from them. When the player is in in range, the enemy "wakes up" and may or may not drop the player as a target.
amoryleaf  [developer] 25 Jun, 2021 @ 7:33pm 
bat issue(bug?):
Sometimes when the bat dies, it doesn't get removed therefore perma-disabling stamina. The only way I can detect this is by making sure all active enemies are valid entities.

bees issue(?):
When bees are caught entity should be asleep, and it does for a moment before waking up while in the player inventory... what?! Have to add a tag check for INLIMBO to believe if entity is really awake.

Released version 1.1.5 that removes aggro from bees when they are caught and also adds the above solutions for bat/bee issues
Last edited by amoryleaf; 25 Jun, 2021 @ 7:39pm
amoryleaf  [developer] 1 Jan, 2022 @ 8:22pm 
These damn bats ya'll.

Adding hack in version 1.1.8 to clear enemy list when the player teleports.

I also added the following (which didn't fix all the issues, god knows why):
1. Check if enemy is in sleeping state, if so, add to asleep list.
2. Fixed bug with removing an invalid entity (now it actually gets removed)
3. Added two more listen events, "onwakeup" and "gotosleep". Sometimes while bat was sleeping it would call "onwakeup"...

I tried this, but removed it since it didn't work:
Instead of adding each bat as an enemy, add the teamleader which orders each bat when to attack. This fails when player attacks sleeping bat.

Note: Noticed that bats and penguins are the only prefabs with the "teamattacker" component. So I'm assuming I'd have these same issues with penguins.
Last edited by amoryleaf; 2 Jan, 2022 @ 6:43am
Ker Blam 27 Apr, 2022 @ 4:33pm 
doubt mod compatibility is too high on your priority list but it might be worth mentioning. I'm using this mod with island adventures and this bug happens extremely frequently, can usually only go about an hour max without encountering *something* that causes it (source inconsistent)

not a very elegant solution but maybe if a player is in combat for a long period of time check if there's non-passive creatures (or just any creatures, if that's not possible) anywhere nearby, and if there's not, end the combat? unsure how the mod actually works, just spitballing
Last edited by Ker Blam; 27 Apr, 2022 @ 4:34pm
amoryleaf  [developer] 29 Apr, 2022 @ 4:35pm 
Hi there, thanks for taking a look through this thread before commenting about it! I appreciate that! I'm sorry you're going through that ugh thats frustrating I knew this would come back.I'll look into this and update when I can.
amoryleaf  [developer] 29 Apr, 2022 @ 8:01pm 
@Ker Blam This bug is not easy to reproduce and I don't have a lot of data (or motivation) to debug it further. Similar to your idea, I added in a timer to track how long the player's stamina has been disabled. If it's been more than 60 seconds it gets re-enabled even if you're still in combat unless a NEW enemy is encountered. I figured if its gonna bug out, rather have stamina enabled at the wrong time sometimes, rather than disabled forever!

I hope this fixes the issues you're seeing. Please let me know how it goes and thank you very much for trying out my mod and participating in this discussion! :steamhappy:
amoryleaf  [developer] 7 May, 2023 @ 11:52am 
The latest version v1.2 should prevent any more issues with perma-disabled. It is only disabled if the enemy is within 10m of the player.:steamthumbsup:
< >
Showing 1-10 of 10 comments
Per page: 1530 50