From 57043ad8008b3ce311a5f3c66b9d70653c7c4741 Mon Sep 17 00:00:00 2001 From: turoni Date: Thu, 14 Mar 2019 22:25:03 +0100 Subject: [PATCH] 729 engulf 2 (#750) * Get species of microbe and reduce hexCount by 50% if bacteria * Added caching of isBacteria * Update the isBacteria cache on restoreOrganelleLayout * Ran formatting --- scripts/microbe_stage/microbe.as | 2 ++ scripts/microbe_stage/setup.as | 14 ++++++++++++++ scripts/microbe_stage/species_system.as | 3 +++ 3 files changed, 19 insertions(+) diff --git a/scripts/microbe_stage/microbe.as b/scripts/microbe_stage/microbe.as index 6f76d29de95..afe7d2ec3c2 100644 --- a/scripts/microbe_stage/microbe.as +++ b/scripts/microbe_stage/microbe.as @@ -48,6 +48,7 @@ class MicrobeComponent : ScriptComponent{ this.speciesName = species.name; } this.isPlayerMicrobe = isPlayerMicrobe; + this.isBacteria = species.isBacteria; this.engulfMode = false; this.isBeingEngulfed = false; this.hostileEngulfer = NULL_OBJECT; @@ -165,6 +166,7 @@ class MicrobeComponent : ScriptComponent{ double stored = 0; bool initialized = false; bool isPlayerMicrobe = false; + bool isBacteria = false; float maxBandwidth = 10.0 * BANDWIDTH_PER_ORGANELLE; // wtf is a bandwidth anyway? float remainingBandwidth = 0.0; uint compoundCollectionTimer = EXCESS_COMPOUND_COLLECTION_INTERVAL; diff --git a/scripts/microbe_stage/setup.as b/scripts/microbe_stage/setup.as index 735835f4ac6..0be067ba685 100644 --- a/scripts/microbe_stage/setup.as +++ b/scripts/microbe_stage/setup.as @@ -377,6 +377,13 @@ void cellOnCellActualContact(GameWorld@ world, ObjectID firstEntity, ObjectID se // Get microbe sizes here int firstMicrobeComponentHexCount = firstMicrobeComponent.totalHexCountCache; int secondMicrobeComponentHexCount = secondMicrobeComponent.totalHexCountCache; + + if(firstMicrobeComponent.isBacteria) + firstMicrobeComponentHexCount /= 2; + + if(secondMicrobeComponent.isBacteria) + secondMicrobeComponentHexCount /= 2; + if (firstMicrobeComponent.engulfMode) { if(firstMicrobeComponentHexCount > @@ -427,6 +434,13 @@ bool beingEngulfed(GameWorld@ world, ObjectID firstEntity, ObjectID secondEntity // Get microbe sizes here int firstMicrobeComponentHexCount = firstMicrobeComponent.totalHexCountCache; int secondMicrobeComponentHexCount = secondMicrobeComponent.totalHexCountCache; + + if(firstMicrobeComponent.isBacteria) + firstMicrobeComponentHexCount /= 2; + + if(secondMicrobeComponent.isBacteria) + secondMicrobeComponentHexCount /= 2; + // If either cell is engulfing we need to do things //return false; //LOG_INFO(""+firstMicrobeComponent.engulfMode); diff --git a/scripts/microbe_stage/species_system.as b/scripts/microbe_stage/species_system.as index 7ad22f3f436..1feb5a73d12 100644 --- a/scripts/microbe_stage/species_system.as +++ b/scripts/microbe_stage/species_system.as @@ -1334,6 +1334,9 @@ void restoreOrganelleLayout(CellStageWorld@ world, ObjectID microbeEntity, MicrobeOperations::addOrganelle(world, microbeEntity, organelle, editShape); } + + // cache isBacteria from species + microbeComponent.isBacteria = species.isBacteria; } void initProcessorComponent(CellStageWorld@ world, ObjectID entity,