From 452be0a6322911da60f4115b353c5da81a4d1246 Mon Sep 17 00:00:00 2001 From: Untrustedlife Date: Thu, 14 Feb 2019 16:28:57 -0600 Subject: [PATCH] Venter now only vents compounds the compound bag component has and takes compounds from the bag. If not, it skips them. Iron chunks' compound bag components now have an appropriate amount of iron ions for the venters, that takes about 1000 seconds to run out, and they do. ran formatter script plastid actually only costs 50, so fixed typo in editor. --- scripts/gui/thrive_gui.html | 2 +- scripts/microbe_stage/configs.as | 5 +++++ scripts/microbe_stage/setup.as | 6 +++++- src/microbe_stage/compound_venter_system.cpp | 15 +++++++++++---- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/scripts/gui/thrive_gui.html b/scripts/gui/thrive_gui.html index 131fb9f3f58..f13a47d4351 100644 --- a/scripts/gui/thrive_gui.html +++ b/scripts/gui/thrive_gui.html @@ -465,7 +465,7 @@
Chemoplast
45 MP - Nitrogen Fixing Plastid

Cost: 80 mutation points

+ Nitrogen Fixing Plastid

Cost: 50 mutation points

Performs Process: Nitrogen Fixation
(1 Oxygen + 5 ATP -> 0.5 Ammonia)/Second (Depending On Environmental Oxygen)

Allows for synthesis of ammonia from atmospheric nitrogen and oxygen. For easier cell growth.
diff --git a/scripts/microbe_stage/configs.as b/scripts/microbe_stage/configs.as index 1e2be0268ce..f7779579876 100644 --- a/scripts/microbe_stage/configs.as +++ b/scripts/microbe_stage/configs.as @@ -160,6 +160,11 @@ const float OXY_TOXY_DAMAGE = 10.0f; // Cooldown between agent emissions, in milliseconds. const uint AGENT_EMISSION_COOLDOWN = 2000; +// Iron amounts per chunk. +// big iron ejects ten per 20 clicks , so about 30 per second, so ill give it enough for 1000 seconds) +const double IRON_PER_BIG_CHUNK = 30000.0f; +// small iron ejects 3 per 20 clicks , so about 9 per second, so ill give it enough for 1000 seconds aswell +const double IRON_PER_SMALL_CHUNK = 9000.0f; //Auto Evo Values const int CREATURE_DEATH_POPULATION_LOSS = -60; const int CREATURE_KILL_POPULATION_GAIN = 50; diff --git a/scripts/microbe_stage/setup.as b/scripts/microbe_stage/setup.as index a4f41525385..4993e4b910a 100644 --- a/scripts/microbe_stage/setup.as +++ b/scripts/microbe_stage/setup.as @@ -634,6 +634,7 @@ ObjectID createIron(CellStageWorld@ world, Float3 pos) int ironSize = 1; // 5 is the default float ironAmount = 3.0f; + double ironBagAmount= IRON_PER_SMALL_CHUNK; // There are four kinds switch (GetEngine().GetRandom().GetNumber(0, 4)) { @@ -653,6 +654,7 @@ ObjectID createIron(CellStageWorld@ world, Float3 pos) mesh="iron_05.mesh"; ironSize=10; ironAmount=10.0f; + ironBagAmount=IRON_PER_BIG_CHUNK; break; } @@ -660,7 +662,9 @@ ObjectID createIron(CellStageWorld@ world, Float3 pos) auto venter = world.Create_CompoundVenterComponent(ironEntity); // So that larger iron chunks give out more compounds venter.setVentAmount(ironAmount); - world.Create_CompoundBagComponent(ironEntity); + auto bag = world.Create_CompoundBagComponent(ironEntity); + + bag.setCompound(SimulationParameters::compoundRegistry().getTypeId("iron"),ironBagAmount); auto model = world.Create_Model(ironEntity, renderNode.Node, mesh); // Need to set the tint model.GraphicalObject.setCustomParameter(1, Ogre::Vector4(1, 1, 1, 1)); diff --git a/src/microbe_stage/compound_venter_system.cpp b/src/microbe_stage/compound_venter_system.cpp index 2864bee9495..77bd1e9207a 100644 --- a/src/microbe_stage/compound_venter_system.cpp +++ b/src/microbe_stage/compound_venter_system.cpp @@ -36,10 +36,17 @@ void for(auto& value : CachedComponents.GetIndex()) { CompoundBagComponent& bag = std::get<0>(*value.second); CompoundVenterComponent& venter = std::get<1>(*value.second); - Leviathan::Position& position = std::get<2>(*value.second); - venter.ventCompound(position, - SimulationParameters::compoundRegistry.getTypeId("iron"), - venter.ventAmount, world); + // Loop through all the compounds in the storage bag and eject them + for(const auto& compound : bag.compounds) { + double compoundAmount = compound.second.amount; + CompoundId compoundId = compound.first; + if(venter.ventAmount <= compoundAmount) { + Leviathan::Position& position = std::get<2>(*value.second); + venter.ventCompound( + position, compoundId, venter.ventAmount, world); + bag.takeCompound(compoundId, venter.ventAmount); + } + } } } }