mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-03 18:33:39 +02:00
Transform decayed agent to a herb
This commit is contained in:
parent
2a8da64385
commit
fb3a8b64b2
1 changed files with 7 additions and 2 deletions
9
agent.cc
9
agent.cc
|
@ -8,6 +8,8 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
|
static void spawn_herb(class tile &t);
|
||||||
|
|
||||||
void
|
void
|
||||||
agent::spawn(void)
|
agent::spawn(void)
|
||||||
{
|
{
|
||||||
|
@ -125,8 +127,11 @@ agent::on_tick(void)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
energy += world::dead_decay;
|
energy += world::dead_decay;
|
||||||
if (energy < 0)
|
if (energy < 0) {
|
||||||
energy = 0;
|
tile->on_agent_leave(*this);
|
||||||
|
spawn_herb(*tile);
|
||||||
|
tile = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue