X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=blobdiff_plain;f=src%2Fcreature%2Fcreature.cpp;h=74d5751bce5f9f413a9f111cbdd17e8a42862807;hp=57c1f53f720ca6804647fdf42fa4a1bea4423602;hb=27cbcf62c4608f9d3a408e903863f3f5e7e47ff0;hpb=b03c2f42ba325ab909b159a4bc8e7568defdc4c5 diff --git a/src/creature/creature.cpp b/src/creature/creature.cpp index 57c1f53..74d5751 100644 --- a/src/creature/creature.cpp +++ b/src/creature/creature.cpp @@ -5,6 +5,7 @@ #include "Situation.hpp" #include "Steering.hpp" +#include "BlobBackgroundTask.hpp" #include "Goal.hpp" #include "IdleGoal.hpp" #include "InhaleNeed.hpp" @@ -44,6 +45,7 @@ Creature::Creature(world::Simulation &sim) , on_death() , removable(false) , memory(*this) +, bg_task() , needs() , goals() , situation() @@ -127,7 +129,11 @@ double Creature::AgeLerp(double from, double to) const noexcept { } double Creature::Fertility() const noexcept { - return AgeLerp(CurProps().fertility, NextProps().fertility) / 3600.0; + return AgeLerp(CurProps().fertility, NextProps().fertility) * (1.0 / 3600.0); +} + +double Creature::Mutability() const noexcept { + return GetProperties().mutability * (1.0 / 3600.0); } void Creature::AddGoal(std::unique_ptr &&g) { @@ -175,6 +181,8 @@ void Creature::Tick(double dt) { situation.SetState(state); } + bg_task->Tick(dt); + bg_task->Action(); memory.Tick(dt); for (auto &need : needs) { need->Tick(dt); @@ -485,6 +493,7 @@ void Genome::Configure(Creature &c) const { c.Density(mass / volume); c.GetSteering().MaxAcceleration(1.4 * std::atan(c.GetProperties().strength)); c.GetSteering().MaxSpeed(4.4 * std::atan(c.GetProperties().dexerty)); + c.SetBackgroundTask(std::unique_ptr(new BlobBackgroundTask(c))); c.AddGoal(std::unique_ptr(new IdleGoal(c))); }