From f8e40132aa1654165510a093d2de88bf567e65b5 Mon Sep 17 00:00:00 2001 From: Untrustedlife Date: Wed, 9 Jan 2019 12:25:36 -0600 Subject: [PATCH] math now makes more sense (eg if a process needs more c02, it shoud obviously be less productive when there is less c02) fixed bug with environmental compounds respiration now has more realistic process numbers, but also is balanced (and weaker then it used to be) ran clang exposed getDissolved to the scripts for UI. --- .../MicrobeStage/BioProcesses.json | 4 ++-- src/microbe_stage/process_system.cpp | 13 ++++++++----- src/microbe_stage/process_system.h | 4 +--- src/scripting/script_initializer.cpp | 6 ++++++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/scripts/SimulationParameters/MicrobeStage/BioProcesses.json b/scripts/SimulationParameters/MicrobeStage/BioProcesses.json index 42de82ea05c..98d60c0515c 100644 --- a/scripts/SimulationParameters/MicrobeStage/BioProcesses.json +++ b/scripts/SimulationParameters/MicrobeStage/BioProcesses.json @@ -8,7 +8,7 @@ }, "outputs": { - "atp": 14.0 + "atp": 38.0 } }, @@ -95,7 +95,7 @@ }, "outputs": { - "atp": 14.0 + "atp": 38.0 } }, diff --git a/src/microbe_stage/process_system.cpp b/src/microbe_stage/process_system.cpp index 7aa6c6a966b..dd293f4bc71 100644 --- a/src/microbe_stage/process_system.cpp +++ b/src/microbe_stage/process_system.cpp @@ -225,17 +225,20 @@ void // do environmental modifier here, and save it for later if(compoundData.isEnvironmental) { - environmentModifier = environmentModifier * - getDissolved(inputId) * input.second; + environmentModifier = + environmentModifier * + (getDissolved(inputId) / input.second); inputRemoved = inputRemoved * environmentModifier; } // If not enough compound we can't do the process // If the compound is environmental the cell doesnt actually // contain it right now and theres no where to take it from - if(bag.compounds[inputId].amount < inputRemoved || - environmentModifier == 0.0f) { - canDoProcess = false; + if(!compoundData.isEnvironmental) { + if(bag.compounds[inputId].amount < inputRemoved || + environmentModifier == 0.0f) { + canDoProcess = false; + } } } diff --git a/src/microbe_stage/process_system.h b/src/microbe_stage/process_system.h index 4dee5f4c7b5..bb80cc9bd9c 100644 --- a/src/microbe_stage/process_system.h +++ b/src/microbe_stage/process_system.h @@ -142,12 +142,10 @@ class ProcessSystem void setProcessBiome(int biomeId); - -protected: double getDissolved(CompoundId compoundData); - +protected: private: int curBiomeId = 0; static constexpr double TIME_SCALING_FACTOR = 1000; diff --git a/src/scripting/script_initializer.cpp b/src/scripting/script_initializer.cpp index 708e6ca161b..3cba9c41b3e 100644 --- a/src/scripting/script_initializer.cpp +++ b/src/scripting/script_initializer.cpp @@ -1148,6 +1148,12 @@ bool asMETHOD(ProcessSystem, setProcessBiome), asCALL_THISCALL) < 0) { ANGELSCRIPT_REGISTERFAIL; } + + if(engine->RegisterObjectMethod("ProcessSystem", + "void getDissolved(CompoundId compoundData)", + asMETHOD(ProcessSystem, getDissolved), asCALL_THISCALL) < 0) { + ANGELSCRIPT_REGISTERFAIL; + } // ------------------------------------ // // CompoundCloudSystem if(engine->RegisterObjectType(