Conversation
|
Okay, testing it I need to make sure, so that after leaving the editor and the compounds are filled up, h2s is filled only to the tolerable amount. Also probably will do the same for the infinite compounds cheat |
| } | ||
| } | ||
|
|
||
| public void UpdateHydrogenSulfideBarBar(float sulfide, float warningThreshold) |
… and infinity cheat fill h2s to tolerable level
|
I made it so that when cell doesnt have full immunity the top up setting and infinity cheat will fill h2s to the level that is tolerable. Also made it so when the cell consists of at least 25% organelles that give sulfide protection the protection is full |
| using System; | ||
| using System.Linq; | ||
| using System.Runtime.CompilerServices; | ||
| using AngleSharp.Common; |
There was a problem hiding this comment.
You've accidentally used AngleSharp in gameplay code (it is an HTML parser...).
| } | ||
| } | ||
|
|
||
| public void UpdateHydrogenSulfideProtection(float tolerance, float capacity) |
There was a problem hiding this comment.
Where is this called from? As far as I can see this is the only occurrence of this word on this diff page...
| } | ||
|
|
||
| // Reduce initial hydrogen sulfide level to the tolerable amount, so that the species don't take damage | ||
| if (InitialCompounds.ContainsKey(Compound.Hydrogensulfide)) |
There was a problem hiding this comment.
I think this should be some kind of common helper method as multicellular species need the same thing.
| float hydrogenSulfideOrganellesNumber = 0; | ||
| float organellesCount = 0; | ||
|
|
||
| foreach (var organelle in organelles) |
There was a problem hiding this comment.
I'm pretty sure this allocates an enumerator so you should rather use the pattern of getting a IReadOnlyCollection and looping it with a for loop (like done elsewhere in this file).
|
|
||
| foreach (var organelle in organelles) | ||
| { | ||
| hydrogenSulfideProtection += organelle.Definition.HydrogenSulfideProtection; |
There was a problem hiding this comment.
This addition could be inside the if on line 435 so we don't add a bunch of 0 values when we anyway took the if-branching cost.
| var baseCapacity = organelle.Definition.Components.Storage.Capacity; | ||
| var specificCapacity = GetAdditionalCapacityForOrganelle(organelle.Definition, organelle.Upgrades); | ||
|
|
||
| if (specificCapacity.Compound != Compound.Hydrogensulfide) |
There was a problem hiding this comment.
Isn't this incorrect? Because if there is a specialization the organelle provides no normal storage.
| Constants.HYDROGEN_SULFIDE_ORGANELLE_PROTECTION_CAP_FRACTION | ||
| || hydrogenSulfideProtection > hydrogenSulfideStorage) | ||
| { | ||
| hydrogenSulfideProtection = hydrogenSulfideStorage; |
There was a problem hiding this comment.
This is incorrect because cells when preparing to divide will get up to double the normal storage, and in fact the emergency venting is 2.5 times the storage. So I believe this value needs to be multiplier by 2.5 to ensure protection in all situations.
hhyyrylainen
left a comment
There was a problem hiding this comment.
I think I noticed a few bugs along with some code style stuff. Also it seems like the infinite compounds cheat was not updated?
Brief Description of What This PR Does
Rework the hydrogen sulfide damage. Now the sulfide metabolizing organelles give only some protection, so if there is not enough of them and the cell's sulfide threshold is reached, the cell takes damage.
Progress Checklist
Note: before starting this checklist the PR should be marked as non-draft.
break existing features:
https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
(this is important as to not waste the time of Thrive team
members reviewing this PR)
styleguide.
Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author. Merging must follow our
styleguide.