From 2cf679e86f6446a920dddf3dcbe1d7b6f9995ec7 Mon Sep 17 00:00:00 2001 From: Untrustedlife Date: Tue, 26 Feb 2019 17:51:00 -0600 Subject: [PATCH] Oxytoxy is now removed from the compound bag when it is ejected diuring death so it doesn't get in the chunks,. ai and engulfable chunks now use the cached hex size when determining, whether to prey on things/whether things should be engulfed --- scripts/microbe_stage/microbe_ai.as | 18 +++++++++--------- scripts/microbe_stage/microbe_operations.as | 2 ++ scripts/microbe_stage/setup.as | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/microbe_stage/microbe_ai.as b/scripts/microbe_stage/microbe_ai.as index 74056c947de..0c0498ac7b8 100644 --- a/scripts/microbe_stage/microbe_ai.as +++ b/scripts/microbe_stage/microbe_ai.as @@ -246,7 +246,7 @@ class MicrobeAISystem : ScriptSystem{ Float3 testPosition = world.GetComponent_Position(predator)._Position; MicrobeComponent@ secondMicrobeComponent = cast( world.GetScriptComponentHolder("MicrobeComponent").Find(predator)); - if ((position._Position - testPosition).LengthSquared() <= (2000+(secondMicrobeComponent.organelles.length()*8.0f)*2)){ + if ((position._Position - testPosition).LengthSquared() <= (2000+(secondMicrobeComponent.totalHexCountCache*8.0f)*2)){ if (aiComponent.lifeState != FLEEING_STATE) { // Reset target position for faster fleeing @@ -287,8 +287,8 @@ class MicrobeAISystem : ScriptSystem{ // At max aggression add them all if (allMicrobes[i] != microbeEntity && (secondMicrobeComponent.speciesName != microbeComponent.speciesName) && !secondMicrobeComponent.dead){ if ((aiComponent.speciesAggression==MAX_SPECIES_AGRESSION) or - ((((numberOfAgentVacuoles+microbeComponent.organelles.length())*1.0f)*(aiComponent.speciesAggression/AGRESSION_DIVISOR)) > - (secondMicrobeComponent.organelles.length()*1.0f))){ + ((((numberOfAgentVacuoles+microbeComponent.totalHexCountCache)*1.0f)*(aiComponent.speciesAggression/AGRESSION_DIVISOR)) > + (secondMicrobeComponent.organelles.totalHexCountCache*1.0f))){ //You are non-threatening to me aiComponent.preyMicrobes.insertLast(allMicrobes[i]); } @@ -342,8 +342,8 @@ class MicrobeAISystem : ScriptSystem{ // At max fear add them all if (allMicrobes[i] != microbeEntity && (secondMicrobeComponent.speciesName != microbeComponent.speciesName) && !secondMicrobeComponent.dead){ if ((aiComponent.speciesFear==MAX_SPECIES_FEAR) or - ((((numberOfAgentVacuoles+secondMicrobeComponent.organelles.length())*1.0f)*(aiComponent.speciesFear/FEAR_DIVISOR)) > - (microbeComponent.organelles.length()*1.0f))){ + ((((numberOfAgentVacuoles+secondMicrobeComponent.totalHexCountCache)*1.0f)*(aiComponent.speciesFear/FEAR_DIVISOR)) > + (microbeComponent.totalHexCountCache*1.0f))){ //You are bigger then me and i am afraid of that aiComponent.predatoryMicrobes.insertLast(allMicrobes[i]); //LOG_INFO("Added predator " + allMicrobes[i] ); @@ -435,15 +435,15 @@ class MicrobeAISystem : ScriptSystem{ else { // Turn on engulfmode if close - if (((position._Position - aiComponent.targetPosition).LengthSquared() <= 300+(microbeComponent.organelles.length()*3.0f)) + if (((position._Position - aiComponent.targetPosition).LengthSquared() <= 300+(microbeComponent.totalHexCountCache*3.0f)) && (MicrobeOperations::getCompoundAmount(world,microbeEntity,atpID) >= 1.0f) && !microbeComponent.engulfMode && - (float(microbeComponent.organelles.length()) > ( - ENGULF_HP_RATIO_REQ*secondMicrobeComponent.organelles.length()))){ + (float(microbeComponent.totalHexCountCache) > ( + ENGULF_HP_RATIO_REQ*secondMicrobeComponent.totalHexCountCache))){ MicrobeOperations::toggleEngulfMode(world, microbeEntity); aiComponent.ticksSinceLastToggle=0; } - else if (((position._Position - aiComponent.targetPosition).LengthSquared() >= 500+(microbeComponent.organelles.length()*3.0f)) + else if (((position._Position - aiComponent.targetPosition).LengthSquared() >= 500+(microbeComponent.totalHexCountCache*3.0f)) && (microbeComponent.engulfMode && aiComponent.ticksSinceLastToggle >= AI_ENGULF_INTERVAL)){ MicrobeOperations::toggleEngulfMode(world, microbeEntity); aiComponent.ticksSinceLastToggle=0; diff --git a/scripts/microbe_stage/microbe_operations.as b/scripts/microbe_stage/microbe_operations.as index fa9626feedc..450d0b5255f 100644 --- a/scripts/microbe_stage/microbe_operations.as +++ b/scripts/microbe_stage/microbe_operations.as @@ -1137,6 +1137,8 @@ void kill(CellStageWorld@ world, ObjectID microbeEntity) createAgentCloud(world, compoundId, position._Position, direction, ejectedAmount, 2000, microbeComponent.speciesName, NULL_OBJECT); + //take oxytoxy + takeCompound(world,microbeEntity,compoundId,ejectedAmount); ++createdAgents; if(createdAgents >= maxAgentsToShoot) diff --git a/scripts/microbe_stage/setup.as b/scripts/microbe_stage/setup.as index 60044881167..673a419c40a 100644 --- a/scripts/microbe_stage/setup.as +++ b/scripts/microbe_stage/setup.as @@ -333,7 +333,7 @@ void cellHitIron(GameWorld@ world, ObjectID firstEntity, ObjectID secondEntity) if (microbeComponent !is null && engulfableComponent !is null && compoundBagComponent !is null && floatBag !is null) { - if (microbeComponent.engulfMode && microbeComponent.organelles.length() >= + if (microbeComponent.engulfMode && microbeComponent.totalHexCountCache >= engulfableComponent.getSize()*ENGULF_HP_RATIO_REQ) { uint64 compoundCount = SimulationParameters::compoundRegistry().getSize();