Skip to content

Sulfide damage rework#6802

Open
Patryk26g wants to merge 7 commits intomasterfrom
sulfide-damage-rework
Open

Sulfide damage rework#6802
Patryk26g wants to merge 7 commits intomasterfrom
sulfide-damage-rework

Conversation

@Patryk26g
Copy link
Contributor

@Patryk26g Patryk26g commented Mar 13, 2026

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.

  • PR author has checked that this PR works as intended and doesn't
    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)
  • Initial code review passed (this and further items should not be checked by the PR author)
  • Functionality is confirmed working by another person (see above checklist link)
  • Final code review is passed and code conforms to the
    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.

@Patryk26g Patryk26g marked this pull request as ready for review March 13, 2026 18:22
@Patryk26g
Copy link
Contributor Author

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

@hhyyrylainen hhyyrylainen added this to the Release 1.1.0 milestone Mar 16, 2026
}
}

public void UpdateHydrogenSulfideBarBar(float sulfide, float warningThreshold)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the method name?

@Patryk26g
Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've accidentally used AngleSharp in gameplay code (it is an HTML parser...).

}
}

public void UpdateHydrogenSulfideProtection(float tolerance, float capacity)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@hhyyrylainen hhyyrylainen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I noticed a few bugs along with some code style stuff. Also it seems like the infinite compounds cheat was not updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants