Skip to content

Fix animals stuck in panic state #514#519

Merged
void2012 merged 1 commit intosmartcmd:mainfrom
ModMaker101:fix/animals-stuck-in-panic-514
Mar 5, 2026
Merged

Fix animals stuck in panic state #514#519
void2012 merged 1 commit intosmartcmd:mainfrom
ModMaker101:fix/animals-stuck-in-panic-514

Conversation

@ModMaker101
Copy link
Contributor

Description

Fixes an issue where animals would remain in the panic state forever after being hit. The panic behavior now expires after 3-5 seconds.

Changes

Previous Behavior

After an animal with the panic goal was hit once, it would enter the state and continue running forever until killed.

Root Cause

The goal didn't have a timeout mechanism that would expire after getting hit like in the base game(s).

New Behavior

Animals now only remain in the panic state for a randomized about of 60-100 ticks, after which they return back to regular behavior.

Fix Implementation

  • Added logic to check the timestamp of the last damage evnet.
  • Introduced a random panic duration.
  • The panic goal will now stop activating if the time since the last damage goes past the duration.
  • Updated null pointer checks to use nullptr.

Related Issues

@ModMaker101
Copy link
Contributor Author

Ready to merge.

@void2012 void2012 merged commit 91e50aa into smartcmd:main Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Animals stuck in panic state permenently after being hit.

2 participants