-
Notifications
You must be signed in to change notification settings - Fork 48
Replace damage system with health-based damage system #4593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: daveey-activation-cleanup
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74aef1a484
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Check if health resource has reached 0 | ||
| InventoryQuantity health = this->inventory.amount(health_config.health_resource); | ||
| if (health > 0) { | ||
| return false; // Still has health | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against repeated on_damage triggers at 0 HP
Because check_and_apply_health_damage only tests the current health value and doesn’t track a transition to zero, any agent that stays at 0 HP will re-run every on_damage mutation on every tick. That means configs that don’t explicitly restore health (e.g., only clear inventory or transfer resources) will keep applying those effects indefinitely, which is likely unintended for a “trigger when health reaches 0” event. Consider tracking a previous-HP state or marking that the death-trigger has fired until health rises above 0 again.
Useful? React with 👍 / 👎.
This comment has been minimized.
This comment has been minimized.
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
aca44ae to
a45fd31
Compare
0f0c196 to
4f8ee02
Compare
4f8ee02 to
c7fc591
Compare

Replace Agent Damage System with Health System
TL;DR
Replaces the previous damage system with a more flexible health-based system that triggers mutations when health reaches zero.
What changed?
DamageConfigwithHealthConfigthat uses a dedicated health resourcecheck_and_apply_damagetocheck_and_apply_health_damagewhich triggers when health reaches 0How to test?
test_damage.py(renamed from damage to health tests)Why make this change?
The previous damage system was limited to randomly destroying resources when thresholds were met. The new health system is more intuitive and flexible, allowing for any type of mutation to be triggered when health reaches zero. This enables more complex game mechanics like dropping items, applying status effects, or respawning with different properties.