From 7952d38957968a396e5cad8fc87ee78175b67fb1 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Sat, 10 Jan 2026 13:15:07 +0000 Subject: [PATCH 1/9] renamed all instances, please rename when you've finished checking everything --- Scripts/DehydratedInfo.cs | 3 +- Thrive.csproj | 5 +- src/auto-evo/AutoEvoExploringTool.Export.cs | 4 +- src/auto-evo/AutoEvoExploringTool.cs | 12 ++-- .../mutation_strategy/AddOrganelleAnywhere.cs | 2 +- .../mutation_strategy/ModifyOrganelleBase.cs | 6 +- .../mutation_strategy/MoveOrganelleBack.cs | 4 +- .../mutation_strategy/RemoveOrganelle.cs | 10 ++-- .../mutations/CommonMutationFunctions.cs | 12 ++-- .../mutations/MutationLogicFunctions.cs | 4 +- .../CompoundConversionEfficiencyPressure.cs | 2 +- .../ReproductionCompoundPressure.cs | 2 +- src/auto-evo/simulation/SimulationCache.cs | 30 +++++----- src/general/GameProperties.cs | 20 +++---- src/general/GameWorld.cs | 6 +- src/general/base_stage/CreatureStageBase.cs | 2 +- .../world_effects/MarineSnowDensityEffect.cs | 2 +- src/macroscopic_stage/MacroscopicSpecies.cs | 2 +- src/microbe_stage/CellHexesPhotoBuilder.cs | 4 +- src/microbe_stage/ICellDefinition.cs | 2 +- ...crobeEnvironmentalToleranceCalculations.cs | 2 +- .../MicrobeInternalCalculations.cs | 2 +- src/microbe_stage/MicrobeSpecies.cs | 59 ++++++++++--------- src/microbe_stage/MicrobeStage.cs | 2 +- src/microbe_stage/PatchManager.cs | 2 +- .../components/OrganelleContainer.cs | 2 +- .../editor/CellEditorComponent.cs | 18 +++--- src/microbe_stage/editor/PatchMapDrawer.cs | 2 +- .../WorldBasedUnlockCondition.cs | 2 +- src/microbe_stage/systems/MicrobeAISystem.cs | 4 +- src/microbe_stage/systems/ProcessSystem.cs | 6 +- .../CellBodyPlanInternalCalculations.cs | 10 ++-- src/multicellular_stage/CellLayout.cs | 4 +- src/multicellular_stage/CellTemplate.cs | 2 +- src/multicellular_stage/CellType.cs | 30 +++++----- .../MulticellularSpecies.cs | 10 ++-- .../editor/CellBodyPlanEditorComponent.GUI.cs | 2 +- .../editor/CellBodyPlanEditorComponent.cs | 20 +++---- test/MetaballTest.cs | 2 +- test/PhysicsTest.cs | 2 +- .../MicrobeSpeciesTests.cs | 12 ++-- 41 files changed, 166 insertions(+), 163 deletions(-) diff --git a/Scripts/DehydratedInfo.cs b/Scripts/DehydratedInfo.cs index a0ffeb719c8..79e97ad43ca 100644 --- a/Scripts/DehydratedInfo.cs +++ b/Scripts/DehydratedInfo.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; +using Microsoft.Diagnostics.Tracing.Parsers.ClrPrivate; public class DehydratedInfo { @@ -15,7 +16,7 @@ public DehydratedInfo(ISet dehydratedObjects, string branch, string vers BuildZipHash = buildZipHash; ArchiveFile = archiveFile; } - + public ISet DehydratedObjects { get; } public string Branch { get; } diff --git a/Thrive.csproj b/Thrive.csproj index 46a25d1bce6..369db73deb8 100644 --- a/Thrive.csproj +++ b/Thrive.csproj @@ -1,5 +1,5 @@ - + false net10.0 @@ -103,8 +103,7 @@ - + diff --git a/src/auto-evo/AutoEvoExploringTool.Export.cs b/src/auto-evo/AutoEvoExploringTool.Export.cs index 3ca5d075a57..3f107de9acb 100644 --- a/src/auto-evo/AutoEvoExploringTool.Export.cs +++ b/src/auto-evo/AutoEvoExploringTool.Export.cs @@ -100,11 +100,11 @@ private void ExportCurrentWorldSpeciesHistory(string basePath) microbeSpecies.BaseRotationSpeed.ToString(CultureInfo.InvariantCulture), microbeSpecies.StorageCapacities.Nominal.ToString(CultureInfo.InvariantCulture), microbeSpecies.IsBacteria.ToString(), - microbeSpecies.Organelles.Count.ToString(), + microbeSpecies.ReadonlyOrganelles.Count.ToString(), }); data.AddRange(allOrganelles - .Select(d => microbeSpecies.Organelles.Count(t => t.Definition == d).ToString())); + .Select(d => microbeSpecies.ReadonlyOrganelles.Count(t => t.Definition == d).ToString())); } else { diff --git a/src/auto-evo/AutoEvoExploringTool.cs b/src/auto-evo/AutoEvoExploringTool.cs index b06d8ee5f8a..6e689e7f854 100644 --- a/src/auto-evo/AutoEvoExploringTool.cs +++ b/src/auto-evo/AutoEvoExploringTool.cs @@ -1169,8 +1169,8 @@ public void UpdateWorldStatistics() foreach (var organelle in SimulationParameters.Instance.GetAllOrganelles()) { MicrobeSpeciesOrganelleStatistics[organelle] = ( - microbeSpecies.Average(s => s.Organelles.Any(o => o.Definition == organelle) ? 1 : 0), - microbeSpecies.Average(s => s.Organelles.Count(o => o.Definition == organelle))); + microbeSpecies.Average(s => s.t_ModifiableOrganelles.Any(o => o.Definition == organelle) ? 1 : 0), + microbeSpecies.Average(s => s.t_ModifiableOrganelles.Count(o => o.Definition == organelle))); } foreach (var upgradeName in MicrobeSpeciesUpgradesStatistics.Keys) @@ -1178,9 +1178,9 @@ public void UpdateWorldStatistics() MicrobeSpeciesUpgradesStatistics[upgradeName] = ( MicrobeSpeciesUpgradesStatistics[upgradeName].Name, microbeSpecies.Average(s => - s.Organelles.Any(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false) ? 1 : 0), + s.t_ModifiableOrganelles.Any(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false) ? 1 : 0), microbeSpecies.Average(s => - s.Organelles.Count(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false))); + s.t_ModifiableOrganelles.Count(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false))); } foreach (var membrane in SimulationParameters.Instance.GetAllMembranes()) @@ -1192,11 +1192,11 @@ public void UpdateWorldStatistics() foreach (var enzyme in MicrobeSpeciesEnzymesStatistics.Keys) { MicrobeSpeciesEnzymesStatistics[enzyme] = ( - microbeSpecies.Average(s => s.Organelles.Any(o => + microbeSpecies.Average(s => s.t_ModifiableOrganelles.Any(o => o.Definition.Enzymes.TryGetValue(enzyme, out var value) && value > 0) ? 1 : 0), - microbeSpecies.Average(s => s.Organelles.Count(o => + microbeSpecies.Average(s => s.t_ModifiableOrganelles.Count(o => o.Definition.Enzymes.TryGetValue(enzyme, out var value) && value > 0))); } } diff --git a/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs b/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs index c5ec93d87eb..fa6a2a11d7b 100644 --- a/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs +++ b/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs @@ -113,7 +113,7 @@ public static AddOrganelleAnywhere ThatConvertBetweenCompounds(Compound fromComp continue; // Don't add duplicate unique organelles - if (organelle.Unique && baseSpecies.Organelles.Select(x => x.Definition).Contains(organelle)) + if (organelle.Unique && baseSpecies.t_ModifiableOrganelles.Select(x => x.Definition).Contains(organelle)) continue; var newSpecies = (MicrobeSpecies)baseSpecies.Clone(); diff --git a/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs b/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs index eaa70372f88..d0d07202a11 100644 --- a/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs +++ b/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs @@ -42,7 +42,7 @@ public ModifyOrganelleBase(Func criteria, bool should List? organelleIndexesToMutate = null; // Manual looping to avoid one enumerator allocation per call - var organelleList = baseSpecies.Organelles.Organelles; + var organelleList = baseSpecies.t_ModifiableOrganelles.Organelles; var organelleCount = organelleList.Count; for (var i = 0; i < organelleCount; ++i) { @@ -98,14 +98,14 @@ public ModifyOrganelleBase(Func criteria, bool should // We did not change the position at all, so we can safely put down the organelle as upgrades // cannot affect the shape - newSpecies.Organelles.AddAutoEvoAttemptOrganelle(upgradedOrganelle); + newSpecies.t_ModifiableOrganelles.AddAutoEvoAttemptOrganelle(upgradedOrganelle); mutatedOrganelle = true; } else { // TODO: switch away from cloning again once ensured that auto-evo does not modify original // organelles - newSpecies.Organelles.AddAutoEvoAttemptOrganelle(organelleList[j].Clone()); + newSpecies.t_ModifiableOrganelles.AddAutoEvoAttemptOrganelle(organelleList[j].Clone()); // newSpecies.Organelles.AddAutoEvoAttemptOrganelle(organelleList[j]); } diff --git a/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs b/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs index 40cd4342563..f66f045ba94 100644 --- a/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs +++ b/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs @@ -28,11 +28,11 @@ public MoveOrganelleBack(Func criteria) var workMemory2 = new List(); var workMemory3 = new HashSet(); - foreach (OrganelleTemplate organelle in baseSpecies.Organelles.Where(x => allOrganelles.Contains(x.Definition))) + foreach (OrganelleTemplate organelle in baseSpecies.t_ModifiableOrganelles.Where(x => allOrganelles.Contains(x.Definition))) { MicrobeSpecies newSpecies = (MicrobeSpecies)baseSpecies.Clone(); - newSpecies.Organelles.Remove(organelle); + newSpecies.t_ModifiableOrganelles.Remove(organelle); if (CommonMutationFunctions.AddOrganelle(organelle.Definition, CommonMutationFunctions.Direction.Rear, newSpecies, workMemory1, workMemory2, workMemory3, random)) diff --git a/src/auto-evo/mutation_strategy/RemoveOrganelle.cs b/src/auto-evo/mutation_strategy/RemoveOrganelle.cs index b36aef11d8c..97b6b1b7fe9 100644 --- a/src/auto-evo/mutation_strategy/RemoveOrganelle.cs +++ b/src/auto-evo/mutation_strategy/RemoveOrganelle.cs @@ -52,7 +52,7 @@ public static RemoveOrganelle ThatCreateCompound(Compound compound) if (mp < Constants.ORGANELLE_REMOVE_COST) return null; - var organelles = baseSpecies.Organelles.Where(x => Criteria(x.Definition)) + var organelles = baseSpecies.t_ModifiableOrganelles.Where(x => Criteria(x.Definition)) .OrderBy(_ => random.Next()).Take(Constants.AUTO_EVO_ORGANELLE_REMOVE_ATTEMPTS); List>? mutated = null; @@ -73,8 +73,8 @@ public static RemoveOrganelle ThatCreateCompound(Compound compound) // Is this the best way to do this? Probably not, but this is how mutations.cs does is // and the other way outright did not work // This is now slightly improved - hhyyrylainen - var baseOrganelles = baseSpecies.Organelles.Organelles; - var count = baseSpecies.Organelles.Count; + var baseOrganelles = baseSpecies.ReadonlyOrganelles.Organelles; + var count = baseSpecies.ReadonlyOrganelles.Count; for (var i = 0; i < count; ++i) { @@ -85,10 +85,10 @@ public static RemoveOrganelle ThatCreateCompound(Compound compound) // Copy the organelle var newOrganelle = parentOrganelle.Clone(); - newSpecies.Organelles.AddIfPossible(newOrganelle, workMemory.WorkingMemory1, workMemory.WorkingMemory2); + newSpecies.t_ModifiableOrganelles.AddIfPossible(newOrganelle, workMemory.WorkingMemory1, workMemory.WorkingMemory2); } - CommonMutationFunctions.AttachIslandHexes(newSpecies.Organelles, workMemory); + CommonMutationFunctions.AttachIslandHexes(newSpecies.t_ModifiableOrganelles, workMemory); mutated ??= new List>(); mutated.Add(Tuple.Create(newSpecies, mp - Constants.ORGANELLE_REMOVE_COST)); diff --git a/src/auto-evo/mutations/CommonMutationFunctions.cs b/src/auto-evo/mutations/CommonMutationFunctions.cs index 559d2990d49..9b2a5e183e5 100644 --- a/src/auto-evo/mutations/CommonMutationFunctions.cs +++ b/src/auto-evo/mutations/CommonMutationFunctions.cs @@ -90,7 +90,7 @@ public static MicrobeSpecies GenerateRandomSpecies(MicrobeSpecies mutated, Patch MutationLogicFunctions.ColourNewMicrobeSpecies(random, mutated); } - mutated.ModifiableTolerances.CopyFrom(forPatch.GenerateTolerancesForMicrobe(mutated.Organelles)); + mutated.ModifiableTolerances.CopyFrom(forPatch.GenerateTolerancesForMicrobe(mutated.ReadonlyOrganelles)); // Override the default species starting name to have more variability in the names var nameGenerator = SimulationParameters.Instance.NameGenerator; @@ -119,17 +119,17 @@ public static bool AddOrganelleWithStrategy(OrganelleAddStrategy strategy, Organ switch (strategy) { case OrganelleAddStrategy.Realistic: - position = GetRealisticPosition(organelle, newSpecies.Organelles, direction, workMemory1, workMemory3, + position = GetRealisticPosition(organelle, newSpecies.t_ModifiableOrganelles, direction, workMemory1, workMemory3, random); break; case OrganelleAddStrategy.Spiral: - position = GetSpiralPosition(organelle, newSpecies.Organelles, workMemory1, workMemory3); + position = GetSpiralPosition(organelle, newSpecies.t_ModifiableOrganelles, workMemory1, workMemory3); break; case OrganelleAddStrategy.Front: - position = GetFrontPosition(organelle, newSpecies.Organelles, workMemory1, workMemory3); + position = GetFrontPosition(organelle, newSpecies.t_ModifiableOrganelles, workMemory1, workMemory3); break; case OrganelleAddStrategy.Back: - position = GetBackPosition(organelle, newSpecies.Organelles, workMemory1, workMemory3); + position = GetBackPosition(organelle, newSpecies.t_ModifiableOrganelles, workMemory1, workMemory3); break; default: throw new ArgumentOutOfRangeException(nameof(strategy), strategy, null); @@ -139,7 +139,7 @@ public static bool AddOrganelleWithStrategy(OrganelleAddStrategy strategy, Organ if (position == null) return false; - newSpecies.Organelles.AddFast(position, workMemory1, workMemory2); + newSpecies.t_ModifiableOrganelles.AddFast(position, workMemory1, workMemory2); // If the new species is eukaryotic, mark this as such. if (organelle == Nucleus) diff --git a/src/auto-evo/mutations/MutationLogicFunctions.cs b/src/auto-evo/mutations/MutationLogicFunctions.cs index a651c6aecff..d99a6fdfba8 100644 --- a/src/auto-evo/mutations/MutationLogicFunctions.cs +++ b/src/auto-evo/mutations/MutationLogicFunctions.cs @@ -68,8 +68,8 @@ public static void ColourNewMicrobeSpecies(Random random, MicrobeSpecies newSpec private static bool MicrobeSpeciesIsNewGenus(MicrobeSpecies species1, MicrobeSpecies species2) { - var species1UniqueOrganelles = species1.Organelles.Select(o => o.Definition).ToHashSet(); - var species2UniqueOrganelles = species2.Organelles.Select(o => o.Definition).ToHashSet(); + var species1UniqueOrganelles = species1.ReadonlyOrganelles.Select(o => o.Definition).ToHashSet(); + var species2UniqueOrganelles = species2.ReadonlyOrganelles.Select(o => o.Definition).ToHashSet(); return species1UniqueOrganelles.Union(species2UniqueOrganelles).Count() - species1UniqueOrganelles.Intersect(species2UniqueOrganelles).Count() diff --git a/src/auto-evo/selection_pressure/CompoundConversionEfficiencyPressure.cs b/src/auto-evo/selection_pressure/CompoundConversionEfficiencyPressure.cs index 459cc92760c..af66aab4281 100644 --- a/src/auto-evo/selection_pressure/CompoundConversionEfficiencyPressure.cs +++ b/src/auto-evo/selection_pressure/CompoundConversionEfficiencyPressure.cs @@ -71,7 +71,7 @@ public override float Score(Species species, Patch patch, SimulationCache cache) // being in a colony no longer reduces osmoregulation cost. var bindingModifier = 1.0f; - MicrobeInternalCalculations.GetBindingAndSignalling(microbeSpecies.Organelles.Organelles, + MicrobeInternalCalculations.GetBindingAndSignalling(microbeSpecies.ReadonlyOrganelles.Organelles, out var hasBindingAgent, out var hasSignallingAgent); if (hasBindingAgent) diff --git a/src/auto-evo/selection_pressure/ReproductionCompoundPressure.cs b/src/auto-evo/selection_pressure/ReproductionCompoundPressure.cs index 8c5e1a7491a..20776c4c086 100644 --- a/src/auto-evo/selection_pressure/ReproductionCompoundPressure.cs +++ b/src/auto-evo/selection_pressure/ReproductionCompoundPressure.cs @@ -161,7 +161,7 @@ public override float Score(Species species, Patch patch, SimulationCache cache) // being in a colony no longer reduces osmoregulation cost. var bindingModifier = 1.0f; - MicrobeInternalCalculations.GetBindingAndSignalling(microbeSpecies.Organelles.Organelles, + MicrobeInternalCalculations.GetBindingAndSignalling(microbeSpecies.ReadonlyOrganelles.Organelles, out var hasBindingAgent, out var hasSignallingAgent); if (hasBindingAgent) diff --git a/src/auto-evo/simulation/SimulationCache.cs b/src/auto-evo/simulation/SimulationCache.cs index 6579e730725..38dced7cb5a 100644 --- a/src/auto-evo/simulation/SimulationCache.cs +++ b/src/auto-evo/simulation/SimulationCache.cs @@ -101,13 +101,13 @@ public EnergyBalanceInfoSimple GetEnergyBalanceForSpecies(MicrobeSpecies species return cached; } - var maximumMovementDirection = MicrobeInternalCalculations.MaximumSpeedDirection(species.Organelles); + var maximumMovementDirection = MicrobeInternalCalculations.MaximumSpeedDirection(species.ReadonlyOrganelles); // TODO: check if caching instances of these objects would be better than always recreating cached = new EnergyBalanceInfoSimple(); // Auto-evo uses the average values of compound during the course of a simulated day - ProcessSystem.ComputeEnergyBalanceSimple(species.Organelles, biomeConditions, + ProcessSystem.ComputeEnergyBalanceSimple(species.ReadonlyOrganelles, biomeConditions, GetEnvironmentalTolerances(species, biomeConditions), species.MembraneType, maximumMovementDirection, true, species.PlayerSpecies, worldSettings, CompoundAmountType.Average, this, cached); @@ -124,7 +124,7 @@ public float GetSpeedForSpecies(MicrobeSpecies species) return cached; } - cached = MicrobeInternalCalculations.CalculateSpeed(species.Organelles.Organelles, species.MembraneType, + cached = MicrobeInternalCalculations.CalculateSpeed(species.ReadonlyOrganelles.Organelles, species.MembraneType, species.MembraneRigidity, species.IsBacteria, true); cachedBaseSpeeds.Add(species, cached); @@ -151,7 +151,7 @@ public float GetRotationSpeedForSpecies(MicrobeSpecies species) return cached; } - cached = MicrobeInternalCalculations.CalculateRotationSpeed(species.Organelles.Organelles); + cached = MicrobeInternalCalculations.CalculateRotationSpeed(species.ReadonlyOrganelles.Organelles); cachedBaseRotationSpeeds.Add(species, cached); return cached; @@ -358,7 +358,7 @@ public float GetPredationScore(Species predatorSpecies, Species preySpecies, Bio var hasSignallingAgent = false; var hasBindingAgent = false; - var organelles = predator.Organelles.Organelles; + var organelles = predator.ReadonlyOrganelles.Organelles; int count = organelles.Count; for (int i = 0; i < count; ++i) { @@ -375,7 +375,7 @@ public float GetPredationScore(Species predatorSpecies, Species preySpecies, Bio // TODO: switch to a manual loop to avoid an allocation var preyOxygenUsingOrganellesCount = 0; - foreach (var organelle in prey.Organelles.Organelles) + foreach (var organelle in prey.ReadonlyOrganelles.Organelles) { if (organelle.Definition.IsOxygenMetabolism) preyOxygenUsingOrganellesCount += 1; @@ -626,7 +626,7 @@ public bool GetUsesVaryingCompoundsForSpecies(MicrobeSpecies species, BiomeCondi return cached; } - cached = MicrobeInternalCalculations.UsesDayVaryingCompounds(species.Organelles, biomeConditions, null); + cached = MicrobeInternalCalculations.UsesDayVaryingCompounds(species.ReadonlyOrganelles, biomeConditions, null); cachedUsesVaryingCompounds.Add(key, cached); return cached; @@ -644,7 +644,7 @@ public float GetChemoreceptorCloudScore(MicrobeSpecies species, CompoundDefiniti cached = 0.0f; var hasChemoreceptor = false; - foreach (var organelle in species.Organelles.Organelles) + foreach (var organelle in species.ReadonlyOrganelles.Organelles) { var organelleTargetCompound = organelle.GetActiveTargetCompound(); if (organelleTargetCompound == Compound.Invalid) @@ -682,7 +682,7 @@ public float GetChemoreceptorChunkScore(MicrobeSpecies species, ChunkConfigurati // Need to have chemoreceptor to be able to "smell" chunks cached = 0.0f; var hasChemoreceptor = false; - foreach (var organelle in species.Organelles.Organelles) + foreach (var organelle in species.ReadonlyOrganelles.Organelles) { var organelleTargetCompound = organelle.GetActiveTargetCompound(); if (organelleTargetCompound == Compound.Invalid) @@ -762,7 +762,7 @@ public List GetActiveProcessList(MicrobeSpecies microbeSpecies) return cached; } - ProcessSystem.ComputeActiveProcessList(microbeSpecies.Organelles, ref cached); + ProcessSystem.ComputeActiveProcessList(microbeSpecies.t_ModifiableOrganelles, ref cached); cachedProcessLists.Add(microbeSpecies, cached); return cached; @@ -788,7 +788,7 @@ public PredationToolsRawScores GetPredationToolsRawScores(MicrobeSpecies microbe var mucocystsScore = Constants.AUTO_EVO_MUCOCYST_SCORE; var pullingCiliaModifier = 1.0f; - var organelles = microbeSpecies.Organelles.Organelles; + var organelles = microbeSpecies.t_ModifiableOrganelles.Organelles; var organelleCount = organelles.Count; var totalToxinOrganellesCount = 0; var totalToxinTypesCount = 0; @@ -968,7 +968,7 @@ public float GetEnzymesScore(MicrobeSpecies predator, string dissolverEnzyme) if (cachedEnzymeScores.TryGetValue(key, out var cached)) return cached; - var organelles = predator.Organelles.Organelles; + var organelles = predator.ReadonlyOrganelles.Organelles; var isMembraneDigestible = dissolverEnzyme == Constants.LIPASE_ENZYME; var enzymesScore = 0.0f; @@ -1035,11 +1035,11 @@ private float CalculateStorageScore(MicrobeSpecies species, BiomeConditions biom float daySeconds = worldSettings.DayLength * worldSettings.DaytimeFraction; var cachedCapacities = - MicrobeInternalCalculations.GetTotalSpecificCapacity(species.Organelles, out var cachedCapacity); + MicrobeInternalCalculations.GetTotalSpecificCapacity(species.ReadonlyOrganelles, out var cachedCapacity); Dictionary? dayCompoundBalances = null; var (canSurvive, requiredAmounts) = MicrobeInternalCalculations.CalculateNightStorageRequirements( - species.Organelles, species.MembraneType, moving, species.PlayerSpecies, biomeConditions, + species.ReadonlyOrganelles, species.MembraneType, moving, species.PlayerSpecies, biomeConditions, GetEnvironmentalTolerances(species, biomeConditions), worldSettings, ref dayCompoundBalances); @@ -1047,7 +1047,7 @@ private float CalculateStorageScore(MicrobeSpecies species, BiomeConditions biom throw new Exception("Day compound balance should have been calculated"); var resultCompounds = - MicrobeInternalCalculations.GetCompoundsProducedByProcessesTakingIn(compound, species.Organelles); + MicrobeInternalCalculations.GetCompoundsProducedByProcessesTakingIn(compound, species.ReadonlyOrganelles); float cacheScore = 0; int scoreCount = 0; diff --git a/src/general/GameProperties.cs b/src/general/GameProperties.cs index dde14f1d95e..697cc6d6d07 100644 --- a/src/general/GameProperties.cs +++ b/src/general/GameProperties.cs @@ -178,10 +178,10 @@ public static GameProperties StartNewAwareStageGame(WorldGenerationSettings sett var template = new OrganelleTemplate(axon, new Hex(0, r), 0); // Add no longer allows replacing cytoplasm by default - if (!brainType.ModifiableOrganelles.CanPlaceAndIsTouching(template, false, workMemory1, workMemory2, false)) + if (!brainType.ReadonlyOrganelles.CanPlaceAndIsTouching(template, false, workMemory1, workMemory2, false)) continue; - brainType.ModifiableOrganelles.AddFast(template, workMemory1, workMemory2); + brainType.ReadonlyOrganelles.AddFast(template, workMemory1, workMemory2); brainType.RepositionToOrigin(); break; } @@ -416,33 +416,33 @@ private static MicrobeSpecies MakePlayerOrganellesMakeSenseForMulticellular(Game var workMemory1 = new List(); var workMemory2 = new List(); - playerSpecies.Organelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("nucleus"), + playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("nucleus"), new Hex(0, -3), 0), workMemory1, workMemory2); playerSpecies.IsBacteria = false; var mitochondrion = simulationParameters.GetOrganelleType("mitochondrion"); // Remove the original cytoplasm in the species and replace with hydrogenosome for a more efficient layout - playerSpecies.Organelles.RemoveHexAt(new Hex(0, 0), workMemory1); + playerSpecies.t_ModifiableOrganelles.RemoveHexAt(new Hex(0, 0), workMemory1); - playerSpecies.Organelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("bindingAgent"), + playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("bindingAgent"), new Hex(0, 2), 0), workMemory1, workMemory2); - playerSpecies.Organelles.AddFast(new OrganelleTemplate(mitochondrion, + playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, new Hex(-1, 2), 0), workMemory1, workMemory2); - playerSpecies.Organelles.AddFast(new OrganelleTemplate(mitochondrion, + playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, new Hex(1, 1), 0), workMemory1, workMemory2); - playerSpecies.Organelles.AddFast(new OrganelleTemplate(mitochondrion, + playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, new Hex(0, 1), 0), workMemory1, workMemory2); var cytoplasm = simulationParameters.GetOrganelleType("cytoplasm"); - playerSpecies.Organelles.AddFast(new OrganelleTemplate(cytoplasm, + playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(cytoplasm, new Hex(1, -1), 0), workMemory1, workMemory2); - playerSpecies.Organelles.AddFast(new OrganelleTemplate(cytoplasm, + playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(cytoplasm, new Hex(-1, 0), 0), workMemory1, workMemory2); playerSpecies.OnEdited(); diff --git a/src/general/GameWorld.cs b/src/general/GameWorld.cs index 272839ec2e9..591232a1fcd 100644 --- a/src/general/GameWorld.cs +++ b/src/general/GameWorld.cs @@ -153,12 +153,12 @@ public GameWorld(WorldGenerationSettings settings, Species? startingSpecies = nu if (PlayerSpecies is MicrobeSpecies microbeSpecies) { PlayerSpecies.ModifiableTolerances.CopyFrom( - patch.GenerateTolerancesForMicrobe(microbeSpecies.Organelles)); + patch.GenerateTolerancesForMicrobe(microbeSpecies.ReadonlyOrganelles)); } else if (PlayerSpecies is MulticellularSpecies multicellularSpecies) { PlayerSpecies.ModifiableTolerances.CopyFrom(patch.GenerateTolerancesForMicrobe(multicellularSpecies - .ModifiableGameplayCells[0].ModifiableOrganelles)); + .ModifiableGameplayCells[0].ReadonlyOrganelles)); } else { @@ -265,7 +265,7 @@ public static void SetInitialSpeciesProperties(MicrobeSpecies species, List species.MembraneType = SimulationParameters.Instance.GetMembrane("single"); - species.Organelles.AddFast(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + species.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0), workMemory1, workMemory2); species.OnEdited(); diff --git a/src/general/base_stage/CreatureStageBase.cs b/src/general/base_stage/CreatureStageBase.cs index 36bda8438b8..0350ccad763 100644 --- a/src/general/base_stage/CreatureStageBase.cs +++ b/src/general/base_stage/CreatureStageBase.cs @@ -579,7 +579,7 @@ private void CheckPerformanceEnoughForSimulationSpeed() private void AdjustTolerancesToWorkInPatch(MicrobeSpecies species, Patch currentPatch) { - var optimal = currentPatch.GenerateTolerancesForMicrobe(species.Organelles); + var optimal = currentPatch.GenerateTolerancesForMicrobe(species.ReadonlyOrganelles); var current = MicrobeEnvironmentalToleranceCalculations.CalculateTolerances(species, currentPatch.Biome); diff --git a/src/general/world_effects/MarineSnowDensityEffect.cs b/src/general/world_effects/MarineSnowDensityEffect.cs index 1e65107c86a..972164ceecf 100644 --- a/src/general/world_effects/MarineSnowDensityEffect.cs +++ b/src/general/world_effects/MarineSnowDensityEffect.cs @@ -137,7 +137,7 @@ private long GetPopulationFromPatch(Patch patch, long totalPopulation) // For now, only microbe species affect what organelles are available if (tuple.Key is MicrobeSpecies microbeSpecies) { - foreach (var organelle in microbeSpecies.Organelles) + foreach (var organelle in microbeSpecies.ReadonlyOrganelles) { availableOrganelles.Add(organelle.Definition); } diff --git a/src/macroscopic_stage/MacroscopicSpecies.cs b/src/macroscopic_stage/MacroscopicSpecies.cs index 41b8b6e3fb3..de69711cab5 100644 --- a/src/macroscopic_stage/MacroscopicSpecies.cs +++ b/src/macroscopic_stage/MacroscopicSpecies.cs @@ -46,7 +46,7 @@ public MacroscopicSpecies(uint id, string genus, string epithet) : base(id, genu /// public IEnumerable Organelles => ((MetaballLayout)ModifiableBodyLayout).Select(m => m.ModifiableCellType).Distinct() - .SelectMany(c => c.ModifiableOrganelles); + .SelectMany(c => c.ReadonlyOrganelles); public override ushort CurrentArchiveVersion => SERIALIZATION_VERSION; diff --git a/src/microbe_stage/CellHexesPhotoBuilder.cs b/src/microbe_stage/CellHexesPhotoBuilder.cs index e9be59ea0a9..31a8ab5018e 100644 --- a/src/microbe_stage/CellHexesPhotoBuilder.cs +++ b/src/microbe_stage/CellHexesPhotoBuilder.cs @@ -73,7 +73,7 @@ private void BuildHexStruct() // TODO: The code below is partly duplicate to CellEditorComponent and HexEditorComponentBase. // If that code is changed this needs changes too. - var organelleLayout = Species.Organelles.Organelles; + var organelleLayout = Species.ReadonlyOrganelles.Organelles; foreach (var organelle in organelleLayout) { var position = organelle.Position; @@ -114,7 +114,7 @@ private void CalculateRadius() float farthest = 0; - foreach (var organelle in species.Organelles) + foreach (var organelle in species.ReadonlyOrganelles) { var position = organelle.Position; foreach (var hex in organelle.RotatedHexes) diff --git a/src/microbe_stage/ICellDefinition.cs b/src/microbe_stage/ICellDefinition.cs index ec3eb92359b..eb0db58a7da 100644 --- a/src/microbe_stage/ICellDefinition.cs +++ b/src/microbe_stage/ICellDefinition.cs @@ -13,7 +13,7 @@ /// public interface ICellDefinition : IReadOnlyCellDefinition, ISimulationPhotographable { - public OrganelleLayout ModifiableOrganelles { get; } + public OrganelleLayout ReadonlyOrganelles { get; } public new MembraneType MembraneType { get; set; } public new float MembraneRigidity { get; set; } public new Color Colour { get; set; } diff --git a/src/microbe_stage/MicrobeEnvironmentalToleranceCalculations.cs b/src/microbe_stage/MicrobeEnvironmentalToleranceCalculations.cs index f479d1e0d21..49d4cff515b 100644 --- a/src/microbe_stage/MicrobeEnvironmentalToleranceCalculations.cs +++ b/src/microbe_stage/MicrobeEnvironmentalToleranceCalculations.cs @@ -27,7 +27,7 @@ public static double CalculateTotalToleranceScore(MicrobeSpecies species, BiomeC public static ToleranceResult CalculateTolerances(MicrobeSpecies species, BiomeConditions environment) { - return CalculateTolerances(species.Tolerances, species.Organelles, environment); + return CalculateTolerances(species.Tolerances, species.ReadonlyOrganelles, environment); } public static ToleranceResult CalculateTolerances(IReadOnlyEnvironmentalTolerances speciesTolerances, diff --git a/src/microbe_stage/MicrobeInternalCalculations.cs b/src/microbe_stage/MicrobeInternalCalculations.cs index f5fbbc257fa..aae4cd50196 100644 --- a/src/microbe_stage/MicrobeInternalCalculations.cs +++ b/src/microbe_stage/MicrobeInternalCalculations.cs @@ -696,7 +696,7 @@ public static HashSet GetCompoundsProducedByProcessesTakingIn(Compound public static void CalculatePossibleEndosymbiontsFromSpecies(MicrobeSpecies species, List<(OrganelleDefinition Organelle, int Cost)> result, bool lawk) { - var organelles = species.Organelles.Organelles; + var organelles = species.ReadonlyOrganelles.Organelles; int organelleCount = organelles.Count; for (int i = 0; i < organelleCount; ++i) diff --git a/src/microbe_stage/MicrobeSpecies.cs b/src/microbe_stage/MicrobeSpecies.cs index f133a3ac55e..991e47315c7 100644 --- a/src/microbe_stage/MicrobeSpecies.cs +++ b/src/microbe_stage/MicrobeSpecies.cs @@ -19,7 +19,7 @@ public class MicrobeSpecies : Species, IReadOnlyMicrobeSpecies, ICellDefinition public MicrobeSpecies(uint id, string genus, string epithet) : base(id, genus, epithet) { - Organelles = new OrganelleLayout(); + t_ModifiableOrganelles = new OrganelleLayout(); } /// @@ -36,9 +36,9 @@ public MicrobeSpecies(Species cloneOf, ICellDefinition withCellDefinition, List< { cloneOf.ClonePropertiesTo(this); - foreach (var organelle in withCellDefinition.ModifiableOrganelles) + foreach (var organelle in withCellDefinition.ReadonlyOrganelles) { - Organelles.AddFast(organelle, workMemory1, workMemory2); + t_ModifiableOrganelles.AddFast(organelle, workMemory1, workMemory2); } MembraneType = withCellDefinition.MembraneType; @@ -66,9 +66,11 @@ public MicrobeSpecies(Species cloneOf, ICellDefinition withCellDefinition, List< /// Do not change this once the object is in use as the readonly adapter will not have been updated. /// /// - public OrganelleLayout Organelles { get; private set; } + /// + //TODO! reminder to remove the T as its just temporary while i move everything over + public OrganelleLayout t_ModifiableOrganelles { get; private set; } - public OrganelleLayout ModifiableOrganelles => Organelles; + public OrganelleLayout ReadonlyOrganelles => t_ModifiableOrganelles; public Color Colour { @@ -80,7 +82,7 @@ public Color Colour // Base refers here to the fact that these are the values when a cell is freshly spawned and has no // reproduction progress. public float BaseSpeed => - MicrobeInternalCalculations.CalculateSpeed(Organelles.Organelles, MembraneType, MembraneRigidity, IsBacteria); + MicrobeInternalCalculations.CalculateSpeed(ReadonlyOrganelles.Organelles, MembraneType, MembraneRigidity, IsBacteria); public float BaseRotationSpeed { get; set; } @@ -97,7 +99,8 @@ public float BaseHexSize var raw = 0.0f; // Need to do the calculation this way to avoid extra memory allocations - var organelles = Organelles.Organelles; + // keeping it with modifiable since the above comment seems to reccomend it ~Psyke + var organelles = t_ModifiableOrganelles.Organelles; int count = organelles.Count; for (int i = 0; i < count; ++i) { @@ -118,7 +121,7 @@ public float BaseHexSize { get { - var specific = MicrobeInternalCalculations.GetTotalSpecificCapacity(Organelles, out var nominal); + var specific = MicrobeInternalCalculations.GetTotalSpecificCapacity(ReadonlyOrganelles, out var nominal); return (nominal, specific); } } @@ -142,7 +145,7 @@ public float BaseHexSize // here IReadOnlyOrganelleLayout IReadOnlyCellDefinition.Organelles => readonlyLayout ??= - new ReadonlyOrganelleLayoutAdapter(Organelles); + new ReadonlyOrganelleLayoutAdapter(ReadonlyOrganelles); public static bool StateHasStabilizedImpl(IWorldSimulation worldSimulation) { @@ -167,7 +170,7 @@ public static MicrobeSpecies ReadFromArchive(ISArchiveReader reader, ushort vers instance.IsBacteria = reader.ReadBool(); instance.MembraneType = reader.ReadObject(); instance.MembraneRigidity = reader.ReadFloat(); - instance.Organelles = reader.ReadObject>(); + instance.t_ModifiableOrganelles = reader.ReadObject>(); instance.BaseRotationSpeed = reader.ReadFloat(); return instance; @@ -181,7 +184,7 @@ public override void WriteToArchive(ISArchiveWriter writer) writer.WriteObject(MembraneType); writer.Write(MembraneRigidity); - writer.WriteObject(Organelles); + writer.WriteObject(t_ModifiableOrganelles); writer.Write(BaseRotationSpeed); } @@ -189,7 +192,7 @@ public void UpdateIsBacteria() { var nucleus = SimulationParameters.Instance.GetOrganelleType("nucleus"); IsBacteria = true; - var organelles = Organelles.Organelles; + var organelles = t_ModifiableOrganelles.Organelles; var count = organelles.Count; for (int i = 0; i < count; ++i) @@ -212,10 +215,10 @@ public override void OnEdited() UpdateIsBacteria(); // Reset endosymbiont status so that they aren't free to move / delete in the next editor cycle - var count = Organelles.Organelles.Count; + var count = t_ModifiableOrganelles.Organelles.Count; for (var i = 0; i < count; ++i) { - ModifiableOrganelles.Organelles[i].IsEndosymbiont = false; + ReadonlyOrganelles.Organelles[i].IsEndosymbiont = false; } cachedFillTimes.Clear(); @@ -223,7 +226,7 @@ public override void OnEdited() public override bool RepositionToOrigin() { - var changes = Organelles.RepositionToOrigin(); + var changes = t_ModifiableOrganelles.RepositionToOrigin(); CalculateRotationSpeed(); return changes; } @@ -251,10 +254,10 @@ public override void UpdateInitialCompounds() }; // False is passed here until we can make the initial compounds patch specific - ProcessSystem.ComputeCompoundBalance(Organelles, biomeConditions, environmentalTolerances, + ProcessSystem.ComputeCompoundBalance(t_ModifiableOrganelles, biomeConditions, environmentalTolerances, CompoundAmountType.Biome, false, compoundBalances); - bool giveBonusGlucose = Organelles.Count <= Constants.FULL_INITIAL_GLUCOSE_SMALL_SIZE_LIMIT && IsBacteria; + bool giveBonusGlucose = t_ModifiableOrganelles.Count <= Constants.FULL_INITIAL_GLUCOSE_SMALL_SIZE_LIMIT && IsBacteria; var cachedCapacities = StorageCapacities; @@ -314,7 +317,7 @@ public override void HandleNightSpawnCompounds(CompoundBag targetStorage, ISpawn if (!cachedFillTimes.TryGetValue(biome, out compoundTimes)) { // TODO: should moving be false in some cases? - compoundTimes = MicrobeInternalCalculations.CalculateDayVaryingCompoundsFillTimes(Organelles, + compoundTimes = MicrobeInternalCalculations.CalculateDayVaryingCompoundsFillTimes(t_ModifiableOrganelles, MembraneType, true, PlayerSpecies, biome, resolvedTolerances, spawnEnvironment.WorldSettings); cachedFillTimes[biome] = compoundTimes; } @@ -330,14 +333,14 @@ public override void ApplyMutation(Species mutation) var casted = (MicrobeSpecies)mutation; - Organelles.Clear(); + t_ModifiableOrganelles.Clear(); var workMemory1 = new List(); var workMemory2 = new List(); - foreach (var organelle in casted.Organelles) + foreach (var organelle in casted.t_ModifiableOrganelles) { - Organelles.AddFast(organelle.Clone(), workMemory1, workMemory2); + t_ModifiableOrganelles.AddFast(organelle.Clone(), workMemory1, workMemory2); } IsBacteria = casted.IsBacteria; @@ -349,7 +352,7 @@ public override void ApplyMutation(Species mutation) public override float GetPredationTargetSizeFactor() { - return Organelles.Count; + return t_ModifiableOrganelles.Count; } public Vector3 CalculatePhotographDistance(IWorldSimulation worldSimulation) @@ -384,7 +387,7 @@ public MicrobeSpecies Clone(bool cloneOrganelles) if (cloneOrganelles) { - result.Organelles = Organelles.Clone(); + result.t_ModifiableOrganelles = t_ModifiableOrganelles.Clone(); } return result; @@ -395,14 +398,14 @@ public override ulong GetVisualHashCode() var hash = base.GetVisualHashCode(); // This code also exists in CellType visual calculation - var count = Organelles.Count; + var count = t_ModifiableOrganelles.Count; hash ^= PersistentStringHash.GetHash(MembraneType.InternalName) * 5743; hash ^= (ulong)MembraneRigidity.GetHashCode() * 5749; hash ^= (IsBacteria ? 1UL : 0UL) * 5779UL; hash ^= (ulong)count * 131; - var list = Organelles.Organelles; + var list = t_ModifiableOrganelles.Organelles; for (int i = 0; i < count; ++i) { @@ -437,11 +440,11 @@ protected override Dictionary CalculateTotalReproductionCost() { var result = base.CalculateTotalReproductionCost(); - int organelleCount = Organelles.Organelles.Count; + int organelleCount = t_ModifiableOrganelles.Organelles.Count; for (int i = 0; i < organelleCount; ++i) { - result.Merge(Organelles.Organelles[i].Definition.InitialComposition); + result.Merge(t_ModifiableOrganelles.Organelles[i].Definition.InitialComposition); } return result; @@ -449,6 +452,6 @@ protected override Dictionary CalculateTotalReproductionCost() private void CalculateRotationSpeed() { - BaseRotationSpeed = MicrobeInternalCalculations.CalculateRotationSpeed(Organelles.Organelles); + BaseRotationSpeed = MicrobeInternalCalculations.CalculateRotationSpeed(t_ModifiableOrganelles.Organelles); } } diff --git a/src/microbe_stage/MicrobeStage.cs b/src/microbe_stage/MicrobeStage.cs index 723d5ea6e75..6fbb2c8643f 100644 --- a/src/microbe_stage/MicrobeStage.cs +++ b/src/microbe_stage/MicrobeStage.cs @@ -913,7 +913,7 @@ public override void OnReturnFromEditor() species.Species, species.Species, WorldSimulation, workData1, workData2); - foreach (var organelle in species.Species.Organelles) + foreach (var organelle in species.Species.ReadonlyOrganelles) { if (organelle.Definition.HasHeatCollection) { diff --git a/src/microbe_stage/PatchManager.cs b/src/microbe_stage/PatchManager.cs index f0583943cb3..75b3a49e8b3 100644 --- a/src/microbe_stage/PatchManager.cs +++ b/src/microbe_stage/PatchManager.cs @@ -254,7 +254,7 @@ private void HandleCellSpawns(Patch patch, IMicrobeSpawnEnvironment spawnEnviron if (entry.Key is MicrobeSpecies microbeSpecies) { - hasBinding = microbeSpecies.Organelles.Any(o => o.Definition.HasBindingFeature); + hasBinding = microbeSpecies.ReadonlyOrganelles.Any(o => o.Definition.HasBindingFeature); } if (hasBinding) diff --git a/src/microbe_stage/components/OrganelleContainer.cs b/src/microbe_stage/components/OrganelleContainer.cs index 73f5d189d19..00ebbf2f093 100644 --- a/src/microbe_stage/components/OrganelleContainer.cs +++ b/src/microbe_stage/components/OrganelleContainer.cs @@ -325,7 +325,7 @@ public static void CreateOrganelleLayout(this ref OrganelleContainer container, container.Organelles ??= new OrganelleLayout(); - foreach (var organelleTemplate in cellDefinition.ModifiableOrganelles) + foreach (var organelleTemplate in cellDefinition.ReadonlyOrganelles) { container.Organelles.AddFast(new PlacedOrganelle(organelleTemplate.Definition, organelleTemplate.Position, diff --git a/src/microbe_stage/editor/CellEditorComponent.cs b/src/microbe_stage/editor/CellEditorComponent.cs index 1de75f634a6..6ac24b859c8 100644 --- a/src/microbe_stage/editor/CellEditorComponent.cs +++ b/src/microbe_stage/editor/CellEditorComponent.cs @@ -981,7 +981,7 @@ public override void OnEditorSpeciesSetup(Species species) } // Get the species organelles to be edited. This also updates the placeholder hexes - foreach (var organelle in properties.ModifiableOrganelles.Organelles) + foreach (var organelle in properties.ReadonlyOrganelles.Organelles) { editedMicrobeOrganelles.AddFast(organelle.Clone(), hexTemporaryMemory, hexTemporaryMemory2); } @@ -990,7 +990,7 @@ public override void OnEditorSpeciesSetup(Species species) // This needs to be calculated here, otherwise ATP-related unlock conditions would // get null as the ATP balance - CalculateEnergyAndCompoundBalance(properties.ModifiableOrganelles.Organelles, properties.MembraneType, + CalculateEnergyAndCompoundBalance(properties.ReadonlyOrganelles.Organelles, properties.MembraneType, Editor.CurrentPatch.Biome); UpdateOrganelleUnlockTooltips(true); @@ -1028,13 +1028,13 @@ public void OnFinishEditing(bool shouldUpdatePosition) // Apply changes to the species organelles // It is easiest to just replace all // Note that if this code is changed, then also CellType.CopyFrom needs changes - editedProperties.ModifiableOrganelles.Clear(); + editedProperties.ReadonlyOrganelles.Clear(); // Even in a multicellular context, it should always be safe to apply the organelle growth order foreach (var organelle in growthOrderGUI.ApplyOrderingToItems(editedMicrobeOrganelles.Organelles)) { var organelleToAdd = organelle.Clone(); - editedProperties.ModifiableOrganelles.AddFast(organelleToAdd, hexTemporaryMemory, hexTemporaryMemory2); + editedProperties.ReadonlyOrganelles.AddFast(organelleToAdd, hexTemporaryMemory, hexTemporaryMemory2); } if (shouldUpdatePosition) @@ -2838,7 +2838,7 @@ private void CopyEditedPropertiesToSpecies(MicrobeSpecies target) target.MembraneRigidity = Rigidity; target.IsBacteria = true; - target.Organelles.Clear(); + target.t_ModifiableOrganelles.Clear(); // TODO: if this is too slow to copy each organelle like this, we'll need to find a faster way to get the data // in, perhaps by sharing the entire Organelles object @@ -2847,7 +2847,7 @@ private void CopyEditedPropertiesToSpecies(MicrobeSpecies target) if (entry.Definition == nucleus) target.IsBacteria = false; - target.Organelles.AddFast(entry, hexTemporaryMemory, hexTemporaryMemory2); + target.t_ModifiableOrganelles.AddFast(entry, hexTemporaryMemory, hexTemporaryMemory2); } // Copy behaviour if it is known @@ -3465,11 +3465,11 @@ private void CopyPristineToCalculation() if (pristineSpeciesCopy.PlayerSpecies) calculationSpecies.BecomePlayerSpecies(); - calculationSpecies.Organelles.Clear(); + calculationSpecies.t_ModifiableOrganelles.Clear(); - foreach (var entry in pristineSpeciesCopy.Organelles) + foreach (var entry in pristineSpeciesCopy.ReadonlyOrganelles) { - calculationSpecies.Organelles.AddFast(entry, workMemory1, workMemory2); + calculationSpecies.t_ModifiableOrganelles.AddFast(entry, workMemory1, workMemory2); } // The pristine copy is not modified, so it is safe to not clone here diff --git a/src/microbe_stage/editor/PatchMapDrawer.cs b/src/microbe_stage/editor/PatchMapDrawer.cs index e700e4514cf..aa8400d7407 100644 --- a/src/microbe_stage/editor/PatchMapDrawer.cs +++ b/src/microbe_stage/editor/PatchMapDrawer.cs @@ -1121,7 +1121,7 @@ private void AddPatchNode(Patch patch, Vector2 position) if (playerSpecies is MicrobeSpecies microbeSpecies) { - speciesSizeModifier = Math.Sqrt(microbeSpecies.Organelles.Organelles.Count); + speciesSizeModifier = Math.Sqrt(microbeSpecies.ReadonlyOrganelles.Organelles.Count); } else if (playerSpecies is MulticellularSpecies) { diff --git a/src/microbe_stage/organelle_unlocks/WorldBasedUnlockCondition.cs b/src/microbe_stage/organelle_unlocks/WorldBasedUnlockCondition.cs index b6c7f9e484a..f9306e4514a 100644 --- a/src/microbe_stage/organelle_unlocks/WorldBasedUnlockCondition.cs +++ b/src/microbe_stage/organelle_unlocks/WorldBasedUnlockCondition.cs @@ -105,7 +105,7 @@ public override void GenerateTooltip(LocalizedStringBuilder builder, IUnlockStat private float GetPlayerSpeed(ICellDefinition playerData) { - var rawSpeed = MicrobeInternalCalculations.CalculateSpeed(playerData.ModifiableOrganelles.Organelles, + var rawSpeed = MicrobeInternalCalculations.CalculateSpeed(playerData.ReadonlyOrganelles.Organelles, playerData.MembraneType, playerData.MembraneRigidity, playerData.IsBacteria); // This needs to be user-readable as it is shown by the tooltip diff --git a/src/microbe_stage/systems/MicrobeAISystem.cs b/src/microbe_stage/systems/MicrobeAISystem.cs index 2b395de7a94..708b16f1172 100644 --- a/src/microbe_stage/systems/MicrobeAISystem.cs +++ b/src/microbe_stage/systems/MicrobeAISystem.cs @@ -1417,7 +1417,7 @@ private bool GetIsSpeciesUsingVaryingCompounds(Species species) if (species is MicrobeSpecies microbeSpecies) { // TODO: thread local storage for this cache - result = MicrobeInternalCalculations.UsesDayVaryingCompounds(microbeSpecies.Organelles, patch.Biome, + result = MicrobeInternalCalculations.UsesDayVaryingCompounds(microbeSpecies.t_ModifiableOrganelles, patch.Biome, varyingCompoundsTemporary); } else if (species is MulticellularSpecies multicellularSpecies) @@ -1426,7 +1426,7 @@ private bool GetIsSpeciesUsingVaryingCompounds(Species species) // accurate. // TODO: thread local storage for this cache result = MicrobeInternalCalculations.UsesDayVaryingCompounds( - multicellularSpecies.ModifiableGameplayCells[0].ModifiableOrganelles, patch.Biome, + multicellularSpecies.ModifiableGameplayCells[0].ReadonlyOrganelles, patch.Biome, varyingCompoundsTemporary); } else diff --git a/src/microbe_stage/systems/ProcessSystem.cs b/src/microbe_stage/systems/ProcessSystem.cs index 249e833d3da..3d93e384f02 100644 --- a/src/microbe_stage/systems/ProcessSystem.cs +++ b/src/microbe_stage/systems/ProcessSystem.cs @@ -709,9 +709,9 @@ public static float CalculateSpeciesActiveProcessListForEffect(Species species, return 0; var balance = new EnergyBalanceInfoSimple(); - var maximumMovementDirection = MicrobeInternalCalculations.MaximumSpeedDirection(microbeSpecies.Organelles); + var maximumMovementDirection = MicrobeInternalCalculations.MaximumSpeedDirection(microbeSpecies.ReadonlyOrganelles); - ComputeEnergyBalanceSimple(microbeSpecies.Organelles, conditions, environmentTolerances, + ComputeEnergyBalanceSimple(microbeSpecies.ReadonlyOrganelles, conditions, environmentTolerances, microbeSpecies.MembraneType, maximumMovementDirection, false, false, worldGenerationSettings, CompoundAmountType.Average, cache, balance); @@ -726,7 +726,7 @@ public static float CalculateSpeciesActiveProcessListForEffect(Species species, // called time would be wasted on trying to match up processes between different species which is unlikely to // work) processesResult.Clear(); - ComputeActiveProcessList(microbeSpecies.Organelles, ref processesResult); + ComputeActiveProcessList(microbeSpecies.ReadonlyOrganelles, ref processesResult); return balanceModifier; } diff --git a/src/multicellular_stage/CellBodyPlanInternalCalculations.cs b/src/multicellular_stage/CellBodyPlanInternalCalculations.cs index 6492401d0d2..f9b985685fb 100644 --- a/src/multicellular_stage/CellBodyPlanInternalCalculations.cs +++ b/src/multicellular_stage/CellBodyPlanInternalCalculations.cs @@ -15,10 +15,10 @@ public static Dictionary GetTotalSpecificCapacity(IEnumerable> cell { var leader = cells[0].Data!; - var speed = MicrobeInternalCalculations.CalculateSpeed(leader.ModifiableOrganelles, leader.MembraneType, + var speed = MicrobeInternalCalculations.CalculateSpeed(leader.ReadonlyOrganelles, leader.MembraneType, leader.MembraneRigidity, leader.IsBacteria); if (cells.Count == 1) @@ -124,7 +124,7 @@ public static float CalculateRotationSpeed(IReadOnlyList result) { result.Clear(); - var organellesInternal = hex.ModifiableOrganelles.Organelles; + var organellesInternal = hex.ReadonlyOrganelles.Organelles; int organelleCount = organellesInternal.Count; for (int i = 0; i < organelleCount; ++i) diff --git a/src/multicellular_stage/CellTemplate.cs b/src/multicellular_stage/CellTemplate.cs index ae687019d64..777535d96eb 100644 --- a/src/multicellular_stage/CellTemplate.cs +++ b/src/multicellular_stage/CellTemplate.cs @@ -72,7 +72,7 @@ public float BaseRotationSpeed public string FormattedName => ModifiableCellType.CellTypeName; public IReadOnlyOrganelleLayout Organelles => ModifiableCellType.Organelles; - public OrganelleLayout ModifiableOrganelles => ModifiableCellType.ModifiableOrganelles; + public OrganelleLayout ReadonlyOrganelles => ModifiableCellType.ReadonlyOrganelles; public ISimulationPhotographable.SimulationType SimulationToPhotograph => ISimulationPhotographable.SimulationType.MicrobeGraphics; diff --git a/src/multicellular_stage/CellType.cs b/src/multicellular_stage/CellType.cs index 6247ad447e2..cf6b9a13c57 100644 --- a/src/multicellular_stage/CellType.cs +++ b/src/multicellular_stage/CellType.cs @@ -14,7 +14,7 @@ public class CellType : ICellDefinition, IReadOnlyCellTypeDefinition, ICloneable public CellType(OrganelleLayout organelles, MembraneType membraneType) { - ModifiableOrganelles = organelles; + ReadonlyOrganelles = organelles; MembraneType = membraneType; CanEngulf = membraneType.CanEngulf; } @@ -22,7 +22,7 @@ public CellType(OrganelleLayout organelles, MembraneType memb public CellType(MembraneType membraneType) { MembraneType = membraneType; - ModifiableOrganelles = new OrganelleLayout(); + ReadonlyOrganelles = new OrganelleLayout(); CanEngulf = membraneType.CanEngulf; } @@ -35,9 +35,9 @@ public CellType(MembraneType membraneType) public CellType(MicrobeSpecies microbeSpecies, List workMemory1, List workMemory2) : this(microbeSpecies.MembraneType) { - foreach (var organelle in microbeSpecies.Organelles) + foreach (var organelle in microbeSpecies.ReadonlyOrganelles) { - ModifiableOrganelles.AddFast(organelle.Clone(), workMemory1, workMemory2); + ReadonlyOrganelles.AddFast(organelle.Clone(), workMemory1, workMemory2); } MembraneRigidity = microbeSpecies.MembraneRigidity; @@ -49,9 +49,9 @@ public CellType(MicrobeSpecies microbeSpecies, List workMemory1, List // TODO: avoid this adapter object allocation public IReadOnlyOrganelleLayout Organelles => readonlyLayout ??= - new ReadonlyOrganelleLayoutAdapter(ModifiableOrganelles); + new ReadonlyOrganelleLayoutAdapter(ReadonlyOrganelles); - public OrganelleLayout ModifiableOrganelles { get; } + public OrganelleLayout ReadonlyOrganelles { get; } public string CellTypeName { get; set; } = "error"; public int MPCost { get; set; } = 15; @@ -98,7 +98,7 @@ public static CellType ReadFromArchive(ISArchiveReader reader, ushort version, i public void WriteToArchive(ISArchiveWriter writer) { - writer.WriteObject(ModifiableOrganelles); + writer.WriteObject(ReadonlyOrganelles); writer.WriteObject(MembraneType); writer.Write(CellTypeName); @@ -111,7 +111,7 @@ public void WriteToArchive(ISArchiveWriter writer) public bool RepositionToOrigin() { - var changes = ModifiableOrganelles.RepositionToOrigin(); + var changes = ReadonlyOrganelles.RepositionToOrigin(); CalculateRotationSpeed(); return changes; } @@ -183,13 +183,13 @@ public void CopyFrom(CellType otherType, List hexTemporaryMemory, List bool shouldUpdatePosition = false) { // Code very similar to what CellEditorComponent does on applying changes - ModifiableOrganelles.Clear(); + ReadonlyOrganelles.Clear(); // Even in a multicellular context, it should always be safe to apply the organelle growth order - foreach (var organelle in otherType.ModifiableOrganelles) + foreach (var organelle in otherType.ReadonlyOrganelles) { var organelleToAdd = organelle.Clone(); - ModifiableOrganelles.AddFast(organelleToAdd, hexTemporaryMemory, hexTemporaryMemory2); + ReadonlyOrganelles.AddFast(organelleToAdd, hexTemporaryMemory, hexTemporaryMemory2); } if (shouldUpdatePosition) @@ -222,7 +222,7 @@ public object Clone() foreach (var organelle in Organelles) { - result.ModifiableOrganelles.AddFast(organelle.Clone(), workMemory1, workMemory2); + result.ReadonlyOrganelles.AddFast(organelle.Clone(), workMemory1, workMemory2); } return result; @@ -242,7 +242,7 @@ public ulong GetVisualHashCode() // is applied by MicrobeSpecies' base class. hash ^= Colour.GetVisualHashCode(); - var list = ModifiableOrganelles.Organelles; + var list = ReadonlyOrganelles.Organelles; for (int i = 0; i < count; ++i) { @@ -264,7 +264,7 @@ public override int GetHashCode() int hash = CellTypeName.GetHashCode() ^ MembraneType.InternalName.GetHashCode() * 5743 ^ MembraneRigidity.GetHashCode() * 5749 ^ (IsBacteria ? 1 : 0) * 5779 ^ count * 131; - var list = ModifiableOrganelles.Organelles; + var list = ReadonlyOrganelles.Organelles; for (int i = 0; i < count; ++i) { @@ -282,6 +282,6 @@ public override string ToString() private void CalculateRotationSpeed() { // TODO: switch this to use a read only interface - BaseRotationSpeed = MicrobeInternalCalculations.CalculateRotationSpeed(ModifiableOrganelles.Organelles); + BaseRotationSpeed = MicrobeInternalCalculations.CalculateRotationSpeed(ReadonlyOrganelles.Organelles); } } diff --git a/src/multicellular_stage/MulticellularSpecies.cs b/src/multicellular_stage/MulticellularSpecies.cs index 17c7e780fdb..cf6a36d53ca 100644 --- a/src/multicellular_stage/MulticellularSpecies.cs +++ b/src/multicellular_stage/MulticellularSpecies.cs @@ -149,10 +149,10 @@ public override void OnEdited() } // Reset endosymbiont status so that they aren't free to move / delete in the next editor cycle - var count = cellType.ModifiableOrganelles.Count; + var count = cellType.ReadonlyOrganelles.Count; for (var i = 0; i < count; ++i) { - cellType.ModifiableOrganelles.Organelles[i].IsEndosymbiont = false; + cellType.ReadonlyOrganelles.Organelles[i].IsEndosymbiont = false; } } @@ -214,10 +214,10 @@ public override void UpdateInitialCompounds() ProcessSpeedModifier = 1, }; - ProcessSystem.ComputeCompoundBalance(ModifiableGameplayCells[0].ModifiableOrganelles, + ProcessSystem.ComputeCompoundBalance(ModifiableGameplayCells[0].ReadonlyOrganelles, biomeConditions, environmentalTolerances, CompoundAmountType.Biome, false, compoundBalances); var storageCapacity = - MicrobeInternalCalculations.CalculateCapacity(ModifiableGameplayCells[0].ModifiableOrganelles); + MicrobeInternalCalculations.CalculateCapacity(ModifiableGameplayCells[0].ReadonlyOrganelles); InitialCompounds.Clear(); @@ -261,7 +261,7 @@ public override void HandleNightSpawnCompounds(CompoundBag targetStorage, ISpawn // TODO: CACHING IS MISSING from here (but microbe has it) // TODO: should moving be false in some cases? var compoundTimes = MicrobeInternalCalculations.CalculateDayVaryingCompoundsFillTimes( - cellType.ModifiableOrganelles, cellType.MembraneType, true, PlayerSpecies, + cellType.ReadonlyOrganelles, cellType.MembraneType, true, PlayerSpecies, microbeSpawnEnvironment.CurrentBiome, environmentalTolerances, microbeSpawnEnvironment.WorldSettings); diff --git a/src/multicellular_stage/editor/CellBodyPlanEditorComponent.GUI.cs b/src/multicellular_stage/editor/CellBodyPlanEditorComponent.GUI.cs index 9bf6f4eb479..9c4050caacf 100644 --- a/src/multicellular_stage/editor/CellBodyPlanEditorComponent.GUI.cs +++ b/src/multicellular_stage/editor/CellBodyPlanEditorComponent.GUI.cs @@ -49,7 +49,7 @@ private void HandleProcessList(EnergyBalanceInfoFull energyBalance, IBiomeCondit { newProcesses.Clear(); - ProcessSystem.ComputeActiveProcessList(cellType.Key.ModifiableOrganelles, ref newProcesses); + ProcessSystem.ComputeActiveProcessList(cellType.Key.ReadonlyOrganelles, ref newProcesses); for (int i = 0; i < newProcesses.Count; ++i) { diff --git a/src/multicellular_stage/editor/CellBodyPlanEditorComponent.cs b/src/multicellular_stage/editor/CellBodyPlanEditorComponent.cs index cb1f6c33bfb..5bfc1751621 100644 --- a/src/multicellular_stage/editor/CellBodyPlanEditorComponent.cs +++ b/src/multicellular_stage/editor/CellBodyPlanEditorComponent.cs @@ -1099,15 +1099,15 @@ private void UpdateCellTypeTooltipAndWarning(CellTypeTooltip tooltip, CellTypeSe bool moving = organismStatisticsPanel.CalculateBalancesWhenMoving; var maximumMovementDirection = - MicrobeInternalCalculations.MaximumSpeedDirection(cellType.ModifiableOrganelles); + MicrobeInternalCalculations.MaximumSpeedDirection(cellType.ReadonlyOrganelles); - ProcessSystem.ComputeEnergyBalanceFull(cellType.ModifiableOrganelles, Editor.CurrentPatch.Biome, + ProcessSystem.ComputeEnergyBalanceFull(cellType.ReadonlyOrganelles, Editor.CurrentPatch.Biome, environmentalTolerances, cellType.MembraneType, maximumMovementDirection, moving, true, Editor.CurrentGame.GameWorld.WorldSettings, organismStatisticsPanel.CompoundAmountType, null, energyBalance); - AddCellTypeCompoundBalance(balances, cellType.ModifiableOrganelles, organismStatisticsPanel.BalanceDisplayType, + AddCellTypeCompoundBalance(balances, cellType.ReadonlyOrganelles, organismStatisticsPanel.BalanceDisplayType, organismStatisticsPanel.CompoundAmountType, Editor.CurrentPatch.Biome, energyBalance, environmentalTolerances); @@ -1120,17 +1120,17 @@ private void UpdateCellTypeTooltipAndWarning(CellTypeTooltip tooltip, CellTypeSe cellType.MembraneType, cellType.MembraneRigidity)); tooltip.UpdateStorageIndicator( - MicrobeInternalCalculations.GetTotalNominalCapacity(cellType.ModifiableOrganelles)); + MicrobeInternalCalculations.GetTotalNominalCapacity(cellType.ReadonlyOrganelles)); - tooltip.UpdateSpeedIndicator(MicrobeInternalCalculations.CalculateSpeed(cellType.ModifiableOrganelles, + tooltip.UpdateSpeedIndicator(MicrobeInternalCalculations.CalculateSpeed(cellType.ReadonlyOrganelles, cellType.MembraneType, cellType.MembraneRigidity, cellType.IsBacteria, false)); tooltip.UpdateRotationSpeedIndicator( - MicrobeInternalCalculations.CalculateRotationSpeed(cellType.ModifiableOrganelles)); + MicrobeInternalCalculations.CalculateRotationSpeed(cellType.ReadonlyOrganelles)); tooltip.UpdateSizeIndicator(cellType.Organelles.Sum(o => o.Definition.HexCount)); tooltip.UpdateDigestionSpeedIndicator( - MicrobeInternalCalculations.CalculateTotalDigestionSpeed(cellType.ModifiableOrganelles)); + MicrobeInternalCalculations.CalculateTotalDigestionSpeed(cellType.ReadonlyOrganelles)); button.ShowInsufficientATPWarning = energyBalance.TotalProduction < energyBalance.TotalConsumption; @@ -1261,7 +1261,7 @@ private void CalculateEnergyAndCompoundBalance(IReadOnlyList CalculateCompoundBalanceWithMethod foreach (var cell in cells) { AddCellTypeCompoundBalance(compoundBalanceData, - GetEditedCellDataIfEdited(cell.Data!.ModifiableCellType).ModifiableOrganelles, calculationType, + GetEditedCellDataIfEdited(cell.Data!.ModifiableCellType).ReadonlyOrganelles, calculationType, amountType, biome, energyBalance, environmentalTolerances); } diff --git a/test/MetaballTest.cs b/test/MetaballTest.cs index 409862d4c25..86607f6fd27 100644 --- a/test/MetaballTest.cs +++ b/test/MetaballTest.cs @@ -113,7 +113,7 @@ private CellType CreateDummyCellType(Color colour) return new CellType(simulationParameters.GetMembrane("single")) { Colour = colour, - ModifiableOrganelles = + ReadonlyOrganelles = { new OrganelleTemplate(simulationParameters.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0) }, }; } diff --git a/test/PhysicsTest.cs b/test/PhysicsTest.cs index 493b28534b3..69473f7e114 100644 --- a/test/PhysicsTest.cs +++ b/test/PhysicsTest.cs @@ -596,7 +596,7 @@ private void SetupMicrobeTest() random); testMicrobeOrganellePositions = - microbeSpecies.Organelles.Select(o => new JVecF3(Hex.AxialToCartesian(o.Position))).ToArray(); + microbeSpecies.t_ModifiableOrganelles.Select(o => new JVecF3(Hex.AxialToCartesian(o.Position))).ToArray(); int created = 0; diff --git a/test/microbe_stage.tests/MicrobeSpeciesTests.cs b/test/microbe_stage.tests/MicrobeSpeciesTests.cs index e6d7884d3c6..d8f00f2de69 100644 --- a/test/microbe_stage.tests/MicrobeSpeciesTests.cs +++ b/test/microbe_stage.tests/MicrobeSpeciesTests.cs @@ -29,16 +29,16 @@ public MicrobeSpeciesTests() }; testSpecies1.BecomePlayerSpecies(); - testSpecies1.Organelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0)); - testSpecies1.Organelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("rusticyanin"), + testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("rusticyanin"), new Hex(1, 0), 0)); - testSpecies1.Organelles.Add(new OrganelleTemplate( + testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate( SimulationParameters.Instance.GetOrganelleType("chromatophore"), new Hex(1, 1), 0)); - testSpecies1.Organelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("nitrogenase"), + testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("nitrogenase"), new Hex(0, 1), 0)); - testSpecies1.Organelles.Add( + testSpecies1.t_ModifiableOrganelles.Add( new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(2, 1), 3) { ModifiableUpgrades = new OrganelleUpgrades @@ -58,7 +58,7 @@ public MicrobeSpeciesTests() }; testSpecies2.BecomePlayerSpecies(); - testSpecies2.Organelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + testSpecies2.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0)); testSpecies2.OnEdited(); } From 5da17af34098424c17025a3017d8174f58688d20 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Sat, 10 Jan 2026 13:30:35 +0000 Subject: [PATCH 2/9] renamed var, removed unesssercary usages of ModifiableOrganelles and replaced with ReadonlyOrganelles --- src/auto-evo/AutoEvoExploringTool.cs | 12 ++--- .../mutation_strategy/AddOrganelleAnywhere.cs | 2 +- .../mutation_strategy/ModifyOrganelleBase.cs | 6 +-- .../mutation_strategy/MoveOrganelleBack.cs | 4 +- .../mutation_strategy/RemoveOrganelle.cs | 6 +-- .../mutations/CommonMutationFunctions.cs | 10 ++-- src/auto-evo/simulation/SimulationCache.cs | 4 +- src/general/GameProperties.cs | 16 +++---- src/general/GameWorld.cs | 2 +- src/microbe_stage/MicrobeSpecies.cs | 46 +++++++++---------- .../editor/CellEditorComponent.cs | 8 ++-- src/microbe_stage/systems/MicrobeAISystem.cs | 2 +- test/PhysicsTest.cs | 2 +- .../MicrobeSpeciesTests.cs | 12 ++--- 14 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/auto-evo/AutoEvoExploringTool.cs b/src/auto-evo/AutoEvoExploringTool.cs index 6e689e7f854..d2f82531abf 100644 --- a/src/auto-evo/AutoEvoExploringTool.cs +++ b/src/auto-evo/AutoEvoExploringTool.cs @@ -1169,8 +1169,8 @@ public void UpdateWorldStatistics() foreach (var organelle in SimulationParameters.Instance.GetAllOrganelles()) { MicrobeSpeciesOrganelleStatistics[organelle] = ( - microbeSpecies.Average(s => s.t_ModifiableOrganelles.Any(o => o.Definition == organelle) ? 1 : 0), - microbeSpecies.Average(s => s.t_ModifiableOrganelles.Count(o => o.Definition == organelle))); + microbeSpecies.Average(s => s.ReadonlyOrganelles.Any(o => o.Definition == organelle) ? 1 : 0), + microbeSpecies.Average(s => s.ReadonlyOrganelles.Count(o => o.Definition == organelle))); } foreach (var upgradeName in MicrobeSpeciesUpgradesStatistics.Keys) @@ -1178,9 +1178,9 @@ public void UpdateWorldStatistics() MicrobeSpeciesUpgradesStatistics[upgradeName] = ( MicrobeSpeciesUpgradesStatistics[upgradeName].Name, microbeSpecies.Average(s => - s.t_ModifiableOrganelles.Any(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false) ? 1 : 0), + s.ReadonlyOrganelles.Any(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false) ? 1 : 0), microbeSpecies.Average(s => - s.t_ModifiableOrganelles.Count(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false))); + s.ReadonlyOrganelles.Count(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false))); } foreach (var membrane in SimulationParameters.Instance.GetAllMembranes()) @@ -1192,11 +1192,11 @@ public void UpdateWorldStatistics() foreach (var enzyme in MicrobeSpeciesEnzymesStatistics.Keys) { MicrobeSpeciesEnzymesStatistics[enzyme] = ( - microbeSpecies.Average(s => s.t_ModifiableOrganelles.Any(o => + microbeSpecies.Average(s => s.ReadonlyOrganelles.Any(o => o.Definition.Enzymes.TryGetValue(enzyme, out var value) && value > 0) ? 1 : 0), - microbeSpecies.Average(s => s.t_ModifiableOrganelles.Count(o => + microbeSpecies.Average(s => s.ReadonlyOrganelles.Count(o => o.Definition.Enzymes.TryGetValue(enzyme, out var value) && value > 0))); } } diff --git a/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs b/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs index fa6a2a11d7b..3371e3fe672 100644 --- a/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs +++ b/src/auto-evo/mutation_strategy/AddOrganelleAnywhere.cs @@ -113,7 +113,7 @@ public static AddOrganelleAnywhere ThatConvertBetweenCompounds(Compound fromComp continue; // Don't add duplicate unique organelles - if (organelle.Unique && baseSpecies.t_ModifiableOrganelles.Select(x => x.Definition).Contains(organelle)) + if (organelle.Unique && baseSpecies.ModifiableOrganelles.Select(x => x.Definition).Contains(organelle)) continue; var newSpecies = (MicrobeSpecies)baseSpecies.Clone(); diff --git a/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs b/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs index d0d07202a11..f7ddb80f06f 100644 --- a/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs +++ b/src/auto-evo/mutation_strategy/ModifyOrganelleBase.cs @@ -42,7 +42,7 @@ public ModifyOrganelleBase(Func criteria, bool should List? organelleIndexesToMutate = null; // Manual looping to avoid one enumerator allocation per call - var organelleList = baseSpecies.t_ModifiableOrganelles.Organelles; + var organelleList = baseSpecies.ModifiableOrganelles.Organelles; var organelleCount = organelleList.Count; for (var i = 0; i < organelleCount; ++i) { @@ -98,14 +98,14 @@ public ModifyOrganelleBase(Func criteria, bool should // We did not change the position at all, so we can safely put down the organelle as upgrades // cannot affect the shape - newSpecies.t_ModifiableOrganelles.AddAutoEvoAttemptOrganelle(upgradedOrganelle); + newSpecies.ModifiableOrganelles.AddAutoEvoAttemptOrganelle(upgradedOrganelle); mutatedOrganelle = true; } else { // TODO: switch away from cloning again once ensured that auto-evo does not modify original // organelles - newSpecies.t_ModifiableOrganelles.AddAutoEvoAttemptOrganelle(organelleList[j].Clone()); + newSpecies.ModifiableOrganelles.AddAutoEvoAttemptOrganelle(organelleList[j].Clone()); // newSpecies.Organelles.AddAutoEvoAttemptOrganelle(organelleList[j]); } diff --git a/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs b/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs index f66f045ba94..435840227e8 100644 --- a/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs +++ b/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs @@ -28,11 +28,11 @@ public MoveOrganelleBack(Func criteria) var workMemory2 = new List(); var workMemory3 = new HashSet(); - foreach (OrganelleTemplate organelle in baseSpecies.t_ModifiableOrganelles.Where(x => allOrganelles.Contains(x.Definition))) + foreach (OrganelleTemplate organelle in baseSpecies.ModifiableOrganelles.Where(x => allOrganelles.Contains(x.Definition))) { MicrobeSpecies newSpecies = (MicrobeSpecies)baseSpecies.Clone(); - newSpecies.t_ModifiableOrganelles.Remove(organelle); + newSpecies.ModifiableOrganelles.Remove(organelle); if (CommonMutationFunctions.AddOrganelle(organelle.Definition, CommonMutationFunctions.Direction.Rear, newSpecies, workMemory1, workMemory2, workMemory3, random)) diff --git a/src/auto-evo/mutation_strategy/RemoveOrganelle.cs b/src/auto-evo/mutation_strategy/RemoveOrganelle.cs index 97b6b1b7fe9..dab95678392 100644 --- a/src/auto-evo/mutation_strategy/RemoveOrganelle.cs +++ b/src/auto-evo/mutation_strategy/RemoveOrganelle.cs @@ -52,7 +52,7 @@ public static RemoveOrganelle ThatCreateCompound(Compound compound) if (mp < Constants.ORGANELLE_REMOVE_COST) return null; - var organelles = baseSpecies.t_ModifiableOrganelles.Where(x => Criteria(x.Definition)) + var organelles = baseSpecies.ModifiableOrganelles.Where(x => Criteria(x.Definition)) .OrderBy(_ => random.Next()).Take(Constants.AUTO_EVO_ORGANELLE_REMOVE_ATTEMPTS); List>? mutated = null; @@ -85,10 +85,10 @@ public static RemoveOrganelle ThatCreateCompound(Compound compound) // Copy the organelle var newOrganelle = parentOrganelle.Clone(); - newSpecies.t_ModifiableOrganelles.AddIfPossible(newOrganelle, workMemory.WorkingMemory1, workMemory.WorkingMemory2); + newSpecies.ModifiableOrganelles.AddIfPossible(newOrganelle, workMemory.WorkingMemory1, workMemory.WorkingMemory2); } - CommonMutationFunctions.AttachIslandHexes(newSpecies.t_ModifiableOrganelles, workMemory); + CommonMutationFunctions.AttachIslandHexes(newSpecies.ModifiableOrganelles, workMemory); mutated ??= new List>(); mutated.Add(Tuple.Create(newSpecies, mp - Constants.ORGANELLE_REMOVE_COST)); diff --git a/src/auto-evo/mutations/CommonMutationFunctions.cs b/src/auto-evo/mutations/CommonMutationFunctions.cs index 9b2a5e183e5..6136d9fc3d6 100644 --- a/src/auto-evo/mutations/CommonMutationFunctions.cs +++ b/src/auto-evo/mutations/CommonMutationFunctions.cs @@ -119,17 +119,17 @@ public static bool AddOrganelleWithStrategy(OrganelleAddStrategy strategy, Organ switch (strategy) { case OrganelleAddStrategy.Realistic: - position = GetRealisticPosition(organelle, newSpecies.t_ModifiableOrganelles, direction, workMemory1, workMemory3, + position = GetRealisticPosition(organelle, newSpecies.ModifiableOrganelles, direction, workMemory1, workMemory3, random); break; case OrganelleAddStrategy.Spiral: - position = GetSpiralPosition(organelle, newSpecies.t_ModifiableOrganelles, workMemory1, workMemory3); + position = GetSpiralPosition(organelle, newSpecies.ModifiableOrganelles, workMemory1, workMemory3); break; case OrganelleAddStrategy.Front: - position = GetFrontPosition(organelle, newSpecies.t_ModifiableOrganelles, workMemory1, workMemory3); + position = GetFrontPosition(organelle, newSpecies.ModifiableOrganelles, workMemory1, workMemory3); break; case OrganelleAddStrategy.Back: - position = GetBackPosition(organelle, newSpecies.t_ModifiableOrganelles, workMemory1, workMemory3); + position = GetBackPosition(organelle, newSpecies.ModifiableOrganelles, workMemory1, workMemory3); break; default: throw new ArgumentOutOfRangeException(nameof(strategy), strategy, null); @@ -139,7 +139,7 @@ public static bool AddOrganelleWithStrategy(OrganelleAddStrategy strategy, Organ if (position == null) return false; - newSpecies.t_ModifiableOrganelles.AddFast(position, workMemory1, workMemory2); + newSpecies.ModifiableOrganelles.AddFast(position, workMemory1, workMemory2); // If the new species is eukaryotic, mark this as such. if (organelle == Nucleus) diff --git a/src/auto-evo/simulation/SimulationCache.cs b/src/auto-evo/simulation/SimulationCache.cs index 38dced7cb5a..7c36899fd2c 100644 --- a/src/auto-evo/simulation/SimulationCache.cs +++ b/src/auto-evo/simulation/SimulationCache.cs @@ -762,7 +762,7 @@ public List GetActiveProcessList(MicrobeSpecies microbeSpecies) return cached; } - ProcessSystem.ComputeActiveProcessList(microbeSpecies.t_ModifiableOrganelles, ref cached); + ProcessSystem.ComputeActiveProcessList(microbeSpecies.ModifiableOrganelles, ref cached); cachedProcessLists.Add(microbeSpecies, cached); return cached; @@ -788,7 +788,7 @@ public PredationToolsRawScores GetPredationToolsRawScores(MicrobeSpecies microbe var mucocystsScore = Constants.AUTO_EVO_MUCOCYST_SCORE; var pullingCiliaModifier = 1.0f; - var organelles = microbeSpecies.t_ModifiableOrganelles.Organelles; + var organelles = microbeSpecies.ModifiableOrganelles.Organelles; var organelleCount = organelles.Count; var totalToxinOrganellesCount = 0; var totalToxinTypesCount = 0; diff --git a/src/general/GameProperties.cs b/src/general/GameProperties.cs index 697cc6d6d07..9d5c3d0f23e 100644 --- a/src/general/GameProperties.cs +++ b/src/general/GameProperties.cs @@ -416,33 +416,33 @@ private static MicrobeSpecies MakePlayerOrganellesMakeSenseForMulticellular(Game var workMemory1 = new List(); var workMemory2 = new List(); - playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("nucleus"), + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("nucleus"), new Hex(0, -3), 0), workMemory1, workMemory2); playerSpecies.IsBacteria = false; var mitochondrion = simulationParameters.GetOrganelleType("mitochondrion"); // Remove the original cytoplasm in the species and replace with hydrogenosome for a more efficient layout - playerSpecies.t_ModifiableOrganelles.RemoveHexAt(new Hex(0, 0), workMemory1); + playerSpecies.ModifiableOrganelles.RemoveHexAt(new Hex(0, 0), workMemory1); - playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("bindingAgent"), + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("bindingAgent"), new Hex(0, 2), 0), workMemory1, workMemory2); - playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, new Hex(-1, 2), 0), workMemory1, workMemory2); - playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, new Hex(1, 1), 0), workMemory1, workMemory2); - playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, new Hex(0, 1), 0), workMemory1, workMemory2); var cytoplasm = simulationParameters.GetOrganelleType("cytoplasm"); - playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(cytoplasm, + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(cytoplasm, new Hex(1, -1), 0), workMemory1, workMemory2); - playerSpecies.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(cytoplasm, + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(cytoplasm, new Hex(-1, 0), 0), workMemory1, workMemory2); playerSpecies.OnEdited(); diff --git a/src/general/GameWorld.cs b/src/general/GameWorld.cs index 591232a1fcd..815a4fa23d5 100644 --- a/src/general/GameWorld.cs +++ b/src/general/GameWorld.cs @@ -265,7 +265,7 @@ public static void SetInitialSpeciesProperties(MicrobeSpecies species, List species.MembraneType = SimulationParameters.Instance.GetMembrane("single"); - species.t_ModifiableOrganelles.AddFast(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + species.ModifiableOrganelles.AddFast(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0), workMemory1, workMemory2); species.OnEdited(); diff --git a/src/microbe_stage/MicrobeSpecies.cs b/src/microbe_stage/MicrobeSpecies.cs index 991e47315c7..304898d3ce5 100644 --- a/src/microbe_stage/MicrobeSpecies.cs +++ b/src/microbe_stage/MicrobeSpecies.cs @@ -19,7 +19,7 @@ public class MicrobeSpecies : Species, IReadOnlyMicrobeSpecies, ICellDefinition public MicrobeSpecies(uint id, string genus, string epithet) : base(id, genus, epithet) { - t_ModifiableOrganelles = new OrganelleLayout(); + ModifiableOrganelles = new OrganelleLayout(); } /// @@ -38,7 +38,7 @@ public MicrobeSpecies(Species cloneOf, ICellDefinition withCellDefinition, List< foreach (var organelle in withCellDefinition.ReadonlyOrganelles) { - t_ModifiableOrganelles.AddFast(organelle, workMemory1, workMemory2); + ModifiableOrganelles.AddFast(organelle, workMemory1, workMemory2); } MembraneType = withCellDefinition.MembraneType; @@ -68,9 +68,9 @@ public MicrobeSpecies(Species cloneOf, ICellDefinition withCellDefinition, List< /// /// //TODO! reminder to remove the T as its just temporary while i move everything over - public OrganelleLayout t_ModifiableOrganelles { get; private set; } + public OrganelleLayout ModifiableOrganelles { get; private set; } - public OrganelleLayout ReadonlyOrganelles => t_ModifiableOrganelles; + public OrganelleLayout ReadonlyOrganelles => ModifiableOrganelles; public Color Colour { @@ -100,7 +100,7 @@ public float BaseHexSize // Need to do the calculation this way to avoid extra memory allocations // keeping it with modifiable since the above comment seems to reccomend it ~Psyke - var organelles = t_ModifiableOrganelles.Organelles; + var organelles = ModifiableOrganelles.Organelles; int count = organelles.Count; for (int i = 0; i < count; ++i) { @@ -170,7 +170,7 @@ public static MicrobeSpecies ReadFromArchive(ISArchiveReader reader, ushort vers instance.IsBacteria = reader.ReadBool(); instance.MembraneType = reader.ReadObject(); instance.MembraneRigidity = reader.ReadFloat(); - instance.t_ModifiableOrganelles = reader.ReadObject>(); + instance.ModifiableOrganelles = reader.ReadObject>(); instance.BaseRotationSpeed = reader.ReadFloat(); return instance; @@ -184,7 +184,7 @@ public override void WriteToArchive(ISArchiveWriter writer) writer.WriteObject(MembraneType); writer.Write(MembraneRigidity); - writer.WriteObject(t_ModifiableOrganelles); + writer.WriteObject(ModifiableOrganelles); writer.Write(BaseRotationSpeed); } @@ -192,7 +192,7 @@ public void UpdateIsBacteria() { var nucleus = SimulationParameters.Instance.GetOrganelleType("nucleus"); IsBacteria = true; - var organelles = t_ModifiableOrganelles.Organelles; + var organelles = ReadonlyOrganelles.Organelles; var count = organelles.Count; for (int i = 0; i < count; ++i) @@ -215,7 +215,7 @@ public override void OnEdited() UpdateIsBacteria(); // Reset endosymbiont status so that they aren't free to move / delete in the next editor cycle - var count = t_ModifiableOrganelles.Organelles.Count; + var count = ReadonlyOrganelles.Organelles.Count; for (var i = 0; i < count; ++i) { ReadonlyOrganelles.Organelles[i].IsEndosymbiont = false; @@ -226,7 +226,7 @@ public override void OnEdited() public override bool RepositionToOrigin() { - var changes = t_ModifiableOrganelles.RepositionToOrigin(); + var changes = ModifiableOrganelles.RepositionToOrigin(); CalculateRotationSpeed(); return changes; } @@ -254,10 +254,10 @@ public override void UpdateInitialCompounds() }; // False is passed here until we can make the initial compounds patch specific - ProcessSystem.ComputeCompoundBalance(t_ModifiableOrganelles, biomeConditions, environmentalTolerances, + ProcessSystem.ComputeCompoundBalance(ReadonlyOrganelles, biomeConditions, environmentalTolerances, CompoundAmountType.Biome, false, compoundBalances); - bool giveBonusGlucose = t_ModifiableOrganelles.Count <= Constants.FULL_INITIAL_GLUCOSE_SMALL_SIZE_LIMIT && IsBacteria; + bool giveBonusGlucose = ReadonlyOrganelles.Count <= Constants.FULL_INITIAL_GLUCOSE_SMALL_SIZE_LIMIT && IsBacteria; var cachedCapacities = StorageCapacities; @@ -317,7 +317,7 @@ public override void HandleNightSpawnCompounds(CompoundBag targetStorage, ISpawn if (!cachedFillTimes.TryGetValue(biome, out compoundTimes)) { // TODO: should moving be false in some cases? - compoundTimes = MicrobeInternalCalculations.CalculateDayVaryingCompoundsFillTimes(t_ModifiableOrganelles, + compoundTimes = MicrobeInternalCalculations.CalculateDayVaryingCompoundsFillTimes(ReadonlyOrganelles, MembraneType, true, PlayerSpecies, biome, resolvedTolerances, spawnEnvironment.WorldSettings); cachedFillTimes[biome] = compoundTimes; } @@ -333,14 +333,14 @@ public override void ApplyMutation(Species mutation) var casted = (MicrobeSpecies)mutation; - t_ModifiableOrganelles.Clear(); + ModifiableOrganelles.Clear(); var workMemory1 = new List(); var workMemory2 = new List(); - foreach (var organelle in casted.t_ModifiableOrganelles) + foreach (var organelle in casted.ModifiableOrganelles) { - t_ModifiableOrganelles.AddFast(organelle.Clone(), workMemory1, workMemory2); + ModifiableOrganelles.AddFast(organelle.Clone(), workMemory1, workMemory2); } IsBacteria = casted.IsBacteria; @@ -352,7 +352,7 @@ public override void ApplyMutation(Species mutation) public override float GetPredationTargetSizeFactor() { - return t_ModifiableOrganelles.Count; + return ReadonlyOrganelles.Count; } public Vector3 CalculatePhotographDistance(IWorldSimulation worldSimulation) @@ -387,7 +387,7 @@ public MicrobeSpecies Clone(bool cloneOrganelles) if (cloneOrganelles) { - result.t_ModifiableOrganelles = t_ModifiableOrganelles.Clone(); + result.ModifiableOrganelles = ModifiableOrganelles.Clone(); } return result; @@ -398,14 +398,14 @@ public override ulong GetVisualHashCode() var hash = base.GetVisualHashCode(); // This code also exists in CellType visual calculation - var count = t_ModifiableOrganelles.Count; + var count = ReadonlyOrganelles.Count; hash ^= PersistentStringHash.GetHash(MembraneType.InternalName) * 5743; hash ^= (ulong)MembraneRigidity.GetHashCode() * 5749; hash ^= (IsBacteria ? 1UL : 0UL) * 5779UL; hash ^= (ulong)count * 131; - var list = t_ModifiableOrganelles.Organelles; + var list = ReadonlyOrganelles.Organelles; for (int i = 0; i < count; ++i) { @@ -440,11 +440,11 @@ protected override Dictionary CalculateTotalReproductionCost() { var result = base.CalculateTotalReproductionCost(); - int organelleCount = t_ModifiableOrganelles.Organelles.Count; + int organelleCount = ReadonlyOrganelles.Organelles.Count; for (int i = 0; i < organelleCount; ++i) { - result.Merge(t_ModifiableOrganelles.Organelles[i].Definition.InitialComposition); + result.Merge(ModifiableOrganelles.Organelles[i].Definition.InitialComposition); } return result; @@ -452,6 +452,6 @@ protected override Dictionary CalculateTotalReproductionCost() private void CalculateRotationSpeed() { - BaseRotationSpeed = MicrobeInternalCalculations.CalculateRotationSpeed(t_ModifiableOrganelles.Organelles); + BaseRotationSpeed = MicrobeInternalCalculations.CalculateRotationSpeed(ModifiableOrganelles.Organelles); } } diff --git a/src/microbe_stage/editor/CellEditorComponent.cs b/src/microbe_stage/editor/CellEditorComponent.cs index 6ac24b859c8..d965cbb3ac7 100644 --- a/src/microbe_stage/editor/CellEditorComponent.cs +++ b/src/microbe_stage/editor/CellEditorComponent.cs @@ -2838,7 +2838,7 @@ private void CopyEditedPropertiesToSpecies(MicrobeSpecies target) target.MembraneRigidity = Rigidity; target.IsBacteria = true; - target.t_ModifiableOrganelles.Clear(); + target.ModifiableOrganelles.Clear(); // TODO: if this is too slow to copy each organelle like this, we'll need to find a faster way to get the data // in, perhaps by sharing the entire Organelles object @@ -2847,7 +2847,7 @@ private void CopyEditedPropertiesToSpecies(MicrobeSpecies target) if (entry.Definition == nucleus) target.IsBacteria = false; - target.t_ModifiableOrganelles.AddFast(entry, hexTemporaryMemory, hexTemporaryMemory2); + target.ModifiableOrganelles.AddFast(entry, hexTemporaryMemory, hexTemporaryMemory2); } // Copy behaviour if it is known @@ -3465,11 +3465,11 @@ private void CopyPristineToCalculation() if (pristineSpeciesCopy.PlayerSpecies) calculationSpecies.BecomePlayerSpecies(); - calculationSpecies.t_ModifiableOrganelles.Clear(); + calculationSpecies.ModifiableOrganelles.Clear(); foreach (var entry in pristineSpeciesCopy.ReadonlyOrganelles) { - calculationSpecies.t_ModifiableOrganelles.AddFast(entry, workMemory1, workMemory2); + calculationSpecies.ModifiableOrganelles.AddFast(entry, workMemory1, workMemory2); } // The pristine copy is not modified, so it is safe to not clone here diff --git a/src/microbe_stage/systems/MicrobeAISystem.cs b/src/microbe_stage/systems/MicrobeAISystem.cs index 708b16f1172..1fb4ea63699 100644 --- a/src/microbe_stage/systems/MicrobeAISystem.cs +++ b/src/microbe_stage/systems/MicrobeAISystem.cs @@ -1417,7 +1417,7 @@ private bool GetIsSpeciesUsingVaryingCompounds(Species species) if (species is MicrobeSpecies microbeSpecies) { // TODO: thread local storage for this cache - result = MicrobeInternalCalculations.UsesDayVaryingCompounds(microbeSpecies.t_ModifiableOrganelles, patch.Biome, + result = MicrobeInternalCalculations.UsesDayVaryingCompounds(microbeSpecies.ModifiableOrganelles, patch.Biome, varyingCompoundsTemporary); } else if (species is MulticellularSpecies multicellularSpecies) diff --git a/test/PhysicsTest.cs b/test/PhysicsTest.cs index 69473f7e114..fbf1b793bcf 100644 --- a/test/PhysicsTest.cs +++ b/test/PhysicsTest.cs @@ -596,7 +596,7 @@ private void SetupMicrobeTest() random); testMicrobeOrganellePositions = - microbeSpecies.t_ModifiableOrganelles.Select(o => new JVecF3(Hex.AxialToCartesian(o.Position))).ToArray(); + microbeSpecies.ModifiableOrganelles.Select(o => new JVecF3(Hex.AxialToCartesian(o.Position))).ToArray(); int created = 0; diff --git a/test/microbe_stage.tests/MicrobeSpeciesTests.cs b/test/microbe_stage.tests/MicrobeSpeciesTests.cs index d8f00f2de69..d1ff9fa4c04 100644 --- a/test/microbe_stage.tests/MicrobeSpeciesTests.cs +++ b/test/microbe_stage.tests/MicrobeSpeciesTests.cs @@ -29,16 +29,16 @@ public MicrobeSpeciesTests() }; testSpecies1.BecomePlayerSpecies(); - testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0)); - testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("rusticyanin"), + testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("rusticyanin"), new Hex(1, 0), 0)); - testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate( + testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate( SimulationParameters.Instance.GetOrganelleType("chromatophore"), new Hex(1, 1), 0)); - testSpecies1.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("nitrogenase"), + testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("nitrogenase"), new Hex(0, 1), 0)); - testSpecies1.t_ModifiableOrganelles.Add( + testSpecies1.ModifiableOrganelles.Add( new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(2, 1), 3) { ModifiableUpgrades = new OrganelleUpgrades @@ -58,7 +58,7 @@ public MicrobeSpeciesTests() }; testSpecies2.BecomePlayerSpecies(); - testSpecies2.t_ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + testSpecies2.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0)); testSpecies2.OnEdited(); } From 126a1ad4b5348d1e391c124b3541b877519922a6 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Sun, 11 Jan 2026 11:31:43 +0000 Subject: [PATCH 3/9] fixed ThriveTests sln since i overlooked it previously, sorry --- .../code_tests/MicrobeStage.Tests/EditorMPTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/code_tests/MicrobeStage.Tests/EditorMPTests.cs b/test/code_tests/MicrobeStage.Tests/EditorMPTests.cs index e07f5064e62..a5fbd3c8219 100644 --- a/test/code_tests/MicrobeStage.Tests/EditorMPTests.cs +++ b/test/code_tests/MicrobeStage.Tests/EditorMPTests.cs @@ -399,7 +399,7 @@ public void EditorMPTests_MultipleIndependentUpgrades() var editsFacade = new MicrobeEditsFacade(originalSpecies, dummyNucleus); var history = new EditorActionHistory(); - var template = originalSpecies.Organelles.GetElementAt(new Hex(0, 0), new List()) ?? + var template = originalSpecies.ReadonlyOrganelles.GetElementAt(new Hex(0, 0), new List()) ?? throw new Exception("Couldn't find organelle"); var upgrades1 = new OrganelleUpgrades @@ -430,7 +430,7 @@ public void EditorMPTests_MultipleUpgradesCombine() var editsFacade = new MicrobeEditsFacade(originalSpecies, dummyNucleus); var history = new EditorActionHistory(); - var template = originalSpecies.Organelles.GetElementAt(new Hex(0, 0), new List()) ?? + var template = originalSpecies.ReadonlyOrganelles.GetElementAt(new Hex(0, 0), new List()) ?? throw new Exception("Couldn't find organelle"); var upgrades1 = new OrganelleUpgrades @@ -461,7 +461,7 @@ public void EditorMPTests_MultipleUpgradesCombine3Step() var editsFacade = new MicrobeEditsFacade(originalSpecies, dummyNucleus); var history = new EditorActionHistory(); - var template = originalSpecies.Organelles.GetElementAt(new Hex(0, 0), new List()) ?? + var template = originalSpecies.ReadonlyOrganelles.GetElementAt(new Hex(0, 0), new List()) ?? throw new Exception("Couldn't find organelle"); var upgrades1 = new OrganelleUpgrades @@ -578,7 +578,7 @@ public void EditorMPTests_DeleteBetweenUpgradesWorksCorrectly() var editsFacade = new MicrobeEditsFacade(originalSpecies, dummyNucleus); var history = new EditorActionHistory(); - var template = originalSpecies.Organelles.GetElementAt(new Hex(0, 0), new List()) ?? + var template = originalSpecies.ReadonlyOrganelles.GetElementAt(new Hex(0, 0), new List()) ?? throw new Exception("Couldn't find organelle"); var upgrades1 = new OrganelleUpgrades @@ -691,7 +691,7 @@ public void EditorMPTests_ReplacingMovedCytoplasmWithoutPlacingIt() var editsFacade = new MicrobeEditsFacade(originalSpecies, dummyNucleus); var history = new EditorActionHistory(); - var template1 = originalSpecies.Organelles.GetElementAt(new Hex(2, 1), new List()) ?? + var template1 = originalSpecies.ReadonlyOrganelles.GetElementAt(new Hex(2, 1), new List()) ?? throw new Exception("Couldn't find organelle"); var moveData = new OrganelleMoveActionData(template1, new Hex(2, 1), new Hex(1, 0), 0, 0); @@ -1150,7 +1150,7 @@ public void EditorMPTests_FullRefundIsNotGivenAfterPlacingMultipleOrganelles() var editsFacade = new MicrobeEditsFacade(originalSpecies, dummyNucleus); var history = new EditorActionHistory(); - var originalToRemove = originalSpecies.Organelles.GetElementAt(new Hex(0, 0), new List()) ?? + var originalToRemove = originalSpecies.ReadonlyOrganelles.GetElementAt(new Hex(0, 0), new List()) ?? throw new Exception("Couldn't find organelle"); var template2 = new OrganelleTemplate(cheapOrganelle, new Hex(1, 0), 0); @@ -1180,7 +1180,7 @@ public void EditorMPTests_RotatingOrganelleIsFree() var editsFacade = new MicrobeEditsFacade(originalSpecies, dummyNucleus); var history = new EditorActionHistory(); - var originalToMove = originalSpecies.Organelles.GetElementAt(new Hex(0, 0), new List()) ?? + var originalToMove = originalSpecies.ReadonlyOrganelles.GetElementAt(new Hex(0, 0), new List()) ?? throw new Exception("Couldn't find organelle"); var moveData = new OrganelleMoveActionData(originalToMove, new Hex(0, 0), new Hex(1, 0), 0, 2); From 4857d600736d671fff677dd65bd9793084d419e2 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Mon, 12 Jan 2026 10:42:33 +0000 Subject: [PATCH 4/9] fixed dev centre warnings --- Thrive.csproj | 2 +- Thrive.csproj.old.1 | 119 ++++++++++++++++++++++++++++ src/microbe_stage/MicrobeSpecies.cs | 5 +- 3 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 Thrive.csproj.old.1 diff --git a/Thrive.csproj b/Thrive.csproj index 369db73deb8..1f793bfb206 100644 --- a/Thrive.csproj +++ b/Thrive.csproj @@ -1,5 +1,5 @@ - + false net10.0 diff --git a/Thrive.csproj.old.1 b/Thrive.csproj.old.1 new file mode 100644 index 00000000000..369db73deb8 --- /dev/null +++ b/Thrive.csproj.old.1 @@ -0,0 +1,119 @@ + + + + false + net10.0 + net9.0 + net8.0 + true + 14 + enable + Revolutionary Games Studio + 1.0.0.0 + + true + + + + + $(DefaultItemExcludes);Scripts\**\*;ThriveScriptsShared\**\*;test\code_tests\**\*;test\code_benchmarks\**\*;RevolutionaryGamesCommon\**\*;third_party\**\* + + + + + + $(DefaultItemExcludes);test/**/*;addons\gdUnit4\**\* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(MSBuildThisFileDirectory)RevolutionaryGamesCommon/StyleCop.ruleset + + + + + diff --git a/src/microbe_stage/MicrobeSpecies.cs b/src/microbe_stage/MicrobeSpecies.cs index 304898d3ce5..e3e7ff6a64b 100644 --- a/src/microbe_stage/MicrobeSpecies.cs +++ b/src/microbe_stage/MicrobeSpecies.cs @@ -8,7 +8,7 @@ /// /// Represents a microbial species with microbe stage specific species things. /// -public class MicrobeSpecies : Species, IReadOnlyMicrobeSpecies, ICellDefinition +public sealed class MicrobeSpecies : Species, IReadOnlyMicrobeSpecies, ICellDefinition { public const ushort SERIALIZATION_VERSION = 1; @@ -66,8 +66,6 @@ public MicrobeSpecies(Species cloneOf, ICellDefinition withCellDefinition, List< /// Do not change this once the object is in use as the readonly adapter will not have been updated. /// /// - /// - //TODO! reminder to remove the T as its just temporary while i move everything over public OrganelleLayout ModifiableOrganelles { get; private set; } public OrganelleLayout ReadonlyOrganelles => ModifiableOrganelles; @@ -146,7 +144,6 @@ public float BaseHexSize IReadOnlyOrganelleLayout IReadOnlyCellDefinition.Organelles => readonlyLayout ??= new ReadonlyOrganelleLayoutAdapter(ReadonlyOrganelles); - public static bool StateHasStabilizedImpl(IWorldSimulation worldSimulation) { // This is stabilised as long as the default no background operations check passes. From 2f8fb8e39114d2b69cead0473f4add97988c9189 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Mon, 12 Jan 2026 10:48:55 +0000 Subject: [PATCH 5/9] fixed devcentre warnings --- RevolutionaryGamesCommon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RevolutionaryGamesCommon b/RevolutionaryGamesCommon index ba0cdac34bd..bdeebb8e876 160000 --- a/RevolutionaryGamesCommon +++ b/RevolutionaryGamesCommon @@ -1 +1 @@ -Subproject commit ba0cdac34bdbef2702ec1b896adfb0bb5d5a2c84 +Subproject commit bdeebb8e876d3fcbf2019dff0513f36891bcee2e From f2c995ee65cd79fb7fb5a24b7481e80a9b042b35 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Tue, 13 Jan 2026 11:36:18 +0000 Subject: [PATCH 6/9] fixed the dydrationinfo.cs whitespace and using jetbrains warning, hopefully this fixes everything --- Scripts/DehydratedInfo.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Scripts/DehydratedInfo.cs b/Scripts/DehydratedInfo.cs index 79e97ad43ca..ec2db6ddd0b 100644 --- a/Scripts/DehydratedInfo.cs +++ b/Scripts/DehydratedInfo.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using Microsoft.Diagnostics.Tracing.Parsers.ClrPrivate; public class DehydratedInfo { @@ -16,7 +15,6 @@ public DehydratedInfo(ISet dehydratedObjects, string branch, string vers BuildZipHash = buildZipHash; ArchiveFile = archiveFile; } - public ISet DehydratedObjects { get; } public string Branch { get; } From 927f66c1cb40be0e3487dbadf0212cf013eff74b Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Tue, 13 Jan 2026 11:44:12 +0000 Subject: [PATCH 7/9] fixed formatting --- src/auto-evo/AutoEvoExploringTool.cs | 4 +++- src/auto-evo/mutation_strategy/MoveOrganelleBack.cs | 3 ++- src/auto-evo/mutation_strategy/RemoveOrganelle.cs | 3 ++- src/auto-evo/mutations/CommonMutationFunctions.cs | 3 ++- src/general/GameProperties.cs | 6 ++++-- src/general/GameWorld.cs | 3 ++- src/microbe_stage/MicrobeSpecies.cs | 6 ++++-- src/microbe_stage/systems/ProcessSystem.cs | 3 ++- test/microbe_stage.tests/MicrobeSpeciesTests.cs | 12 ++++++++---- 9 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/auto-evo/AutoEvoExploringTool.cs b/src/auto-evo/AutoEvoExploringTool.cs index d2f82531abf..3866be6a8d9 100644 --- a/src/auto-evo/AutoEvoExploringTool.cs +++ b/src/auto-evo/AutoEvoExploringTool.cs @@ -1178,7 +1178,9 @@ public void UpdateWorldStatistics() MicrobeSpeciesUpgradesStatistics[upgradeName] = ( MicrobeSpeciesUpgradesStatistics[upgradeName].Name, microbeSpecies.Average(s => - s.ReadonlyOrganelles.Any(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false) ? 1 : 0), + s.ReadonlyOrganelles.Any(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false) ? + 1 : + 0), microbeSpecies.Average(s => s.ReadonlyOrganelles.Count(o => o.Upgrades?.UnlockedFeatures.Contains(upgradeName) ?? false))); } diff --git a/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs b/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs index 435840227e8..ca66cb51cf2 100644 --- a/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs +++ b/src/auto-evo/mutation_strategy/MoveOrganelleBack.cs @@ -28,7 +28,8 @@ public MoveOrganelleBack(Func criteria) var workMemory2 = new List(); var workMemory3 = new HashSet(); - foreach (OrganelleTemplate organelle in baseSpecies.ModifiableOrganelles.Where(x => allOrganelles.Contains(x.Definition))) + foreach (OrganelleTemplate organelle in baseSpecies.ModifiableOrganelles.Where(x => + allOrganelles.Contains(x.Definition))) { MicrobeSpecies newSpecies = (MicrobeSpecies)baseSpecies.Clone(); diff --git a/src/auto-evo/mutation_strategy/RemoveOrganelle.cs b/src/auto-evo/mutation_strategy/RemoveOrganelle.cs index dab95678392..0cd969742fb 100644 --- a/src/auto-evo/mutation_strategy/RemoveOrganelle.cs +++ b/src/auto-evo/mutation_strategy/RemoveOrganelle.cs @@ -85,7 +85,8 @@ public static RemoveOrganelle ThatCreateCompound(Compound compound) // Copy the organelle var newOrganelle = parentOrganelle.Clone(); - newSpecies.ModifiableOrganelles.AddIfPossible(newOrganelle, workMemory.WorkingMemory1, workMemory.WorkingMemory2); + newSpecies.ModifiableOrganelles.AddIfPossible(newOrganelle, workMemory.WorkingMemory1, + workMemory.WorkingMemory2); } CommonMutationFunctions.AttachIslandHexes(newSpecies.ModifiableOrganelles, workMemory); diff --git a/src/auto-evo/mutations/CommonMutationFunctions.cs b/src/auto-evo/mutations/CommonMutationFunctions.cs index 6136d9fc3d6..49a3e9f6a5b 100644 --- a/src/auto-evo/mutations/CommonMutationFunctions.cs +++ b/src/auto-evo/mutations/CommonMutationFunctions.cs @@ -119,7 +119,8 @@ public static bool AddOrganelleWithStrategy(OrganelleAddStrategy strategy, Organ switch (strategy) { case OrganelleAddStrategy.Realistic: - position = GetRealisticPosition(organelle, newSpecies.ModifiableOrganelles, direction, workMemory1, workMemory3, + position = GetRealisticPosition(organelle, newSpecies.ModifiableOrganelles, direction, workMemory1, + workMemory3, random); break; case OrganelleAddStrategy.Spiral: diff --git a/src/general/GameProperties.cs b/src/general/GameProperties.cs index 9d5c3d0f23e..f0196162a95 100644 --- a/src/general/GameProperties.cs +++ b/src/general/GameProperties.cs @@ -416,7 +416,8 @@ private static MicrobeSpecies MakePlayerOrganellesMakeSenseForMulticellular(Game var workMemory1 = new List(); var workMemory2 = new List(); - playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("nucleus"), + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate( + simulationParameters.GetOrganelleType("nucleus"), new Hex(0, -3), 0), workMemory1, workMemory2); playerSpecies.IsBacteria = false; @@ -425,7 +426,8 @@ private static MicrobeSpecies MakePlayerOrganellesMakeSenseForMulticellular(Game // Remove the original cytoplasm in the species and replace with hydrogenosome for a more efficient layout playerSpecies.ModifiableOrganelles.RemoveHexAt(new Hex(0, 0), workMemory1); - playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(simulationParameters.GetOrganelleType("bindingAgent"), + playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate( + simulationParameters.GetOrganelleType("bindingAgent"), new Hex(0, 2), 0), workMemory1, workMemory2); playerSpecies.ModifiableOrganelles.AddFast(new OrganelleTemplate(mitochondrion, diff --git a/src/general/GameWorld.cs b/src/general/GameWorld.cs index 815a4fa23d5..4dbdec7f8df 100644 --- a/src/general/GameWorld.cs +++ b/src/general/GameWorld.cs @@ -265,7 +265,8 @@ public static void SetInitialSpeciesProperties(MicrobeSpecies species, List species.MembraneType = SimulationParameters.Instance.GetMembrane("single"); - species.ModifiableOrganelles.AddFast(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + species.ModifiableOrganelles.AddFast(new OrganelleTemplate( + SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0), workMemory1, workMemory2); species.OnEdited(); diff --git a/src/microbe_stage/MicrobeSpecies.cs b/src/microbe_stage/MicrobeSpecies.cs index e3e7ff6a64b..154a2f05f90 100644 --- a/src/microbe_stage/MicrobeSpecies.cs +++ b/src/microbe_stage/MicrobeSpecies.cs @@ -80,7 +80,8 @@ public Color Colour // Base refers here to the fact that these are the values when a cell is freshly spawned and has no // reproduction progress. public float BaseSpeed => - MicrobeInternalCalculations.CalculateSpeed(ReadonlyOrganelles.Organelles, MembraneType, MembraneRigidity, IsBacteria); + MicrobeInternalCalculations.CalculateSpeed(ReadonlyOrganelles.Organelles, MembraneType, MembraneRigidity, + IsBacteria); public float BaseRotationSpeed { get; set; } @@ -254,7 +255,8 @@ public override void UpdateInitialCompounds() ProcessSystem.ComputeCompoundBalance(ReadonlyOrganelles, biomeConditions, environmentalTolerances, CompoundAmountType.Biome, false, compoundBalances); - bool giveBonusGlucose = ReadonlyOrganelles.Count <= Constants.FULL_INITIAL_GLUCOSE_SMALL_SIZE_LIMIT && IsBacteria; + bool giveBonusGlucose = + ReadonlyOrganelles.Count <= Constants.FULL_INITIAL_GLUCOSE_SMALL_SIZE_LIMIT && IsBacteria; var cachedCapacities = StorageCapacities; diff --git a/src/microbe_stage/systems/ProcessSystem.cs b/src/microbe_stage/systems/ProcessSystem.cs index 1c9281d69c6..6c1c2f38b17 100644 --- a/src/microbe_stage/systems/ProcessSystem.cs +++ b/src/microbe_stage/systems/ProcessSystem.cs @@ -709,7 +709,8 @@ public static float CalculateSpeciesActiveProcessListForEffect(Species species, return 0; var balance = new EnergyBalanceInfoSimple(); - var maximumMovementDirection = MicrobeInternalCalculations.MaximumSpeedDirection(microbeSpecies.ReadonlyOrganelles); + var maximumMovementDirection = + MicrobeInternalCalculations.MaximumSpeedDirection(microbeSpecies.ReadonlyOrganelles); ComputeEnergyBalanceSimple(microbeSpecies.ReadonlyOrganelles, conditions, environmentTolerances, microbeSpecies.MembraneType, maximumMovementDirection, false, false, worldGenerationSettings, diff --git a/test/microbe_stage.tests/MicrobeSpeciesTests.cs b/test/microbe_stage.tests/MicrobeSpeciesTests.cs index d1ff9fa4c04..e4de064b95f 100644 --- a/test/microbe_stage.tests/MicrobeSpeciesTests.cs +++ b/test/microbe_stage.tests/MicrobeSpeciesTests.cs @@ -29,14 +29,17 @@ public MicrobeSpeciesTests() }; testSpecies1.BecomePlayerSpecies(); - testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate( + SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0)); - testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("rusticyanin"), + testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate( + SimulationParameters.Instance.GetOrganelleType("rusticyanin"), new Hex(1, 0), 0)); testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate( SimulationParameters.Instance.GetOrganelleType("chromatophore"), new Hex(1, 1), 0)); - testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("nitrogenase"), + testSpecies1.ModifiableOrganelles.Add(new OrganelleTemplate( + SimulationParameters.Instance.GetOrganelleType("nitrogenase"), new Hex(0, 1), 0)); testSpecies1.ModifiableOrganelles.Add( new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(2, 1), 3) @@ -58,7 +61,8 @@ public MicrobeSpeciesTests() }; testSpecies2.BecomePlayerSpecies(); - testSpecies2.ModifiableOrganelles.Add(new OrganelleTemplate(SimulationParameters.Instance.GetOrganelleType("cytoplasm"), + testSpecies2.ModifiableOrganelles.Add(new OrganelleTemplate( + SimulationParameters.Instance.GetOrganelleType("cytoplasm"), new Hex(0, 0), 0)); testSpecies2.OnEdited(); } From 17d61a6d03fefdf724965ca444ce6f41113c4c18 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Tue, 13 Jan 2026 11:47:31 +0000 Subject: [PATCH 8/9] i really need to get some sort of format checker working on here --- src/microbe_stage/systems/MicrobeAISystem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/microbe_stage/systems/MicrobeAISystem.cs b/src/microbe_stage/systems/MicrobeAISystem.cs index 1fb4ea63699..de279b7e053 100644 --- a/src/microbe_stage/systems/MicrobeAISystem.cs +++ b/src/microbe_stage/systems/MicrobeAISystem.cs @@ -1417,7 +1417,8 @@ private bool GetIsSpeciesUsingVaryingCompounds(Species species) if (species is MicrobeSpecies microbeSpecies) { // TODO: thread local storage for this cache - result = MicrobeInternalCalculations.UsesDayVaryingCompounds(microbeSpecies.ModifiableOrganelles, patch.Biome, + result = MicrobeInternalCalculations.UsesDayVaryingCompounds(microbeSpecies.ModifiableOrganelles, + patch.Biome, varyingCompoundsTemporary); } else if (species is MulticellularSpecies multicellularSpecies) From 3e2d8a575d49477ba7cebaf911ad8847cfee7358 Mon Sep 17 00:00:00 2001 From: PsykeDoesStuff Date: Tue, 13 Jan 2026 14:43:51 +0000 Subject: [PATCH 9/9] fixed whitespace issue* --- Scripts/DehydratedInfo.cs | 1 + src/microbe_stage/MicrobeSpecies.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Scripts/DehydratedInfo.cs b/Scripts/DehydratedInfo.cs index ec2db6ddd0b..a0ffeb719c8 100644 --- a/Scripts/DehydratedInfo.cs +++ b/Scripts/DehydratedInfo.cs @@ -15,6 +15,7 @@ public DehydratedInfo(ISet dehydratedObjects, string branch, string vers BuildZipHash = buildZipHash; ArchiveFile = archiveFile; } + public ISet DehydratedObjects { get; } public string Branch { get; } diff --git a/src/microbe_stage/MicrobeSpecies.cs b/src/microbe_stage/MicrobeSpecies.cs index 154a2f05f90..dce38f5499b 100644 --- a/src/microbe_stage/MicrobeSpecies.cs +++ b/src/microbe_stage/MicrobeSpecies.cs @@ -145,6 +145,7 @@ public float BaseHexSize IReadOnlyOrganelleLayout IReadOnlyCellDefinition.Organelles => readonlyLayout ??= new ReadonlyOrganelleLayoutAdapter(ReadonlyOrganelles); + public static bool StateHasStabilizedImpl(IWorldSimulation worldSimulation) { // This is stabilised as long as the default no background operations check passes.