mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 09:53:38 +02:00
Dead bodies have (slowly decaying) energy
This commit is contained in:
parent
80712598e0
commit
de7a604e52
2 changed files with 9 additions and 1 deletions
7
agent.cc
7
agent.cc
|
@ -34,6 +34,7 @@ void
|
|||
agent::die(void)
|
||||
{
|
||||
dead = true;
|
||||
energy = world::dead_body_energy;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -50,9 +51,13 @@ agent::on_tick(void)
|
|||
{
|
||||
if (!dead) {
|
||||
energy += world::sun_energy;
|
||||
|
||||
if (energy <= 0)
|
||||
die();
|
||||
|
||||
} else {
|
||||
energy += world::dead_decay;
|
||||
if (energy < 0)
|
||||
energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue