X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcreature%2FCreature.hpp;h=3cff2e04cd5264aefab4510679d4abf80bca5f59;hb=27cbcf62c4608f9d3a408e903863f3f5e7e47ff0;hp=f443e48940d2caa20da318c706f196f939a667fd;hpb=838022c799cecd0e93826565e537a0667bded024;p=blobs.git diff --git a/src/creature/Creature.hpp b/src/creature/Creature.hpp index f443e48..3cff2e0 100644 --- a/src/creature/Creature.hpp +++ b/src/creature/Creature.hpp @@ -57,17 +57,30 @@ public: Genome::Properties &GetProperties() noexcept { return properties; } const Genome::Properties &GetProperties() const noexcept { return properties; } + const Genome::PropertySet &CurProps() const noexcept { return properties.props[cur_prop]; } + const Genome::PropertySet &NextProps() const noexcept { return properties.props[std::min(5, cur_prop + 1)]; } + + void BaseColor(const glm::dvec3 &c) noexcept { base_color = c; } + const glm::dvec3 &BaseColor() const noexcept { return base_color; } + + void HighlightColor(const glm::dvec3 &c) noexcept { highlight_color = c; } + glm::dvec4 HighlightColor() const noexcept; + void Mass(double m) noexcept { mass = m; size = std::cbrt(mass / density); } double Mass() const noexcept { return mass; } - void Grow(double amount) noexcept; + void Ingest(int res, double amount) noexcept; void Density(double d) noexcept { density = d; size = std::cbrt(mass / density); } double Density() const noexcept { return density; } double Size() const noexcept; double Age() const noexcept; - // change of giving birth per tick + std::string AgeName() const; + double AgeLerp(double from, double to) const noexcept; + // chance of giving birth per tick double Fertility() const noexcept; + // chance of random genetic mutation per tick + double Mutability() const noexcept; void Health(double h) noexcept { health = h; } double Health() const noexcept { return health; } @@ -80,6 +93,10 @@ public: Memory &GetMemory() noexcept { return memory; } const Memory &GetMemory() const noexcept { return memory; } + /// constantly active goal. every creature in the simulation is required to have one + void SetBackgroundTask(std::unique_ptr &&g) { bg_task = std::move(g); } + Goal &BackgroundTask() { return *bg_task; } + void AddNeed(std::unique_ptr &&n) { needs.emplace_back(std::move(n)); } const std::vector> &Needs() const noexcept { return needs; } @@ -110,6 +127,9 @@ private: Genome::Properties properties; int cur_prop; + glm::dvec3 base_color; + glm::dvec3 highlight_color; + double mass; double density; double size; @@ -121,6 +141,7 @@ private: Memory memory; + std::unique_ptr bg_task; std::vector> needs; std::vector> goals;