mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 09:53:38 +02:00
Make herbs smell
This slightly changes herb growth patterns in forests as well, in order to keep energy balance
This commit is contained in:
parent
29fddde51c
commit
2041242142
3 changed files with 18 additions and 1 deletions
14
agent.cc
14
agent.cc
|
@ -191,6 +191,15 @@ spawn_herb(class tile &t)
|
|||
h->spawn_at(t);
|
||||
}
|
||||
|
||||
void
|
||||
herb::smell_herb(class tile &t)
|
||||
{
|
||||
/* Herb pheromone ("smell") #32768. */
|
||||
class pheromone p(32768, world::herb_phintensity);
|
||||
t.pheromones.secrete(p);
|
||||
chenergy(p.val * world::pheromone_cost);
|
||||
}
|
||||
|
||||
void
|
||||
herb::on_tick(void)
|
||||
{
|
||||
|
@ -204,5 +213,10 @@ herb::on_tick(void)
|
|||
spawn_herb(tile->tile_in_dir(0, -1));
|
||||
tile->on_agent_leave(*this);
|
||||
tile = NULL;
|
||||
} else {
|
||||
smell_herb(tile->tile_in_dir(1, 0));
|
||||
smell_herb(tile->tile_in_dir(0, 1));
|
||||
smell_herb(tile->tile_in_dir(-1, 0));
|
||||
smell_herb(tile->tile_in_dir(0, -1));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue