Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changeling biomass adjustments for rotting corpses + salvage corpse adjustments #860

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Content.Shared.Damage;
using Robust.Shared.Prototypes;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Atmos.Rotting;
using Content.Server.Objectives.Components;
using Content.Server.Light.Components;
using Content.Shared.Eye.Blinding.Systems;
Expand All @@ -24,6 +25,8 @@ namespace Content.Server.Changeling;

public sealed partial class ChangelingSystem : EntitySystem
{
[Dependency] private readonly SharedRottingSystem _rotting = default!;

public void SubscribeAbilities()
{
SubscribeLocalEvent<ChangelingComponent, OpenEvolutionMenuEvent>(OnOpenEvolutionMenu);
Expand Down Expand Up @@ -92,11 +95,17 @@ private void OnAbsorb(EntityUid uid, ChangelingComponent comp, ref AbsorbDNAEven
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-unabsorbable"), uid, uid);
return;
}
if (TryComp<RottingComponent>(target, out var rotComp) && _rotting.RotStage(target, rotComp) >= 2)
{
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-extremely-bloated"), uid, uid);
return;
}

if (!TryUseAbility(uid, comp, args))
return;

var popupOthers = Loc.GetString("changeling-absorb-start", ("user", Identity.Entity(uid, EntityManager)), ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(Loc.GetString("changeling-absorb-rotting"), uid, uid);
_popup.PopupEntity(popupOthers, uid, PopupType.LargeCaution);
PlayMeatySound(uid, comp);
var dargs = new DoAfterArgs(EntityManager, uid, TimeSpan.FromSeconds(15), new AbsorbDNADoAfterEvent(), uid, target)
Expand All @@ -123,7 +132,11 @@ private void OnAbsorbDoAfter(EntityUid uid, ChangelingComponent comp, ref Absorb

PlayMeatySound(args.User, comp);

UpdateBiomass(uid, comp, comp.MaxBiomass - comp.TotalAbsorbedEntities);
float biomassModifier = 1f;
if (HasComp<RottingComponent>(target))
biomassModifier = 0.5f;

UpdateBiomass(uid, comp, (comp.MaxBiomass * biomassModifier) - comp.TotalAbsorbedEntities);

var dmg = new DamageSpecifier(_proto.Index(AbsorbedDamageGroup), 200);
_damage.TryChangeDamage(target, dmg, false, false);
Expand All @@ -145,7 +158,9 @@ private void OnAbsorbDoAfter(EntityUid uid, ChangelingComponent comp, ref Absorb
{
popup = Loc.GetString("changeling-absorb-end-self");
bonusChemicals += 10;
bonusEvolutionPoints += 2;

if (!HasComp<RottingComponent>(target))
bonusEvolutionPoints += 2;
}
TryStealDNA(uid, target, comp, true);
comp.TotalAbsorbedEntities++;
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Atmos/Rotting/RottingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed partial class RottingComponent : Component
/// <summary>
/// How long has this thing been rotting?
/// </summary>
[DataField]
[DataField("totalRotTime")]
public TimeSpan TotalRotTime = TimeSpan.Zero;

/// <summary>
Expand Down
14 changes: 13 additions & 1 deletion Content.Shared/Atmos/Rotting/SharedRottingSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Examine;
using Content.Shared.Changeling;
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
Expand Down Expand Up @@ -96,6 +97,17 @@ private void OnExamined(EntityUid uid, RottingComponent component, ExaminedEvent
description += "-nonmob";

args.PushMarkup(Loc.GetString(description, ("target", Identity.Entity(uid, EntityManager))));

if (HasComp<ChangelingComponent>(args.Examiner) && !HasComp<AbsorbedComponent>(uid))
{
var changelingDescription = stage switch
{
>= 2 => "changeling-examine-extremely-bloated",
_ => "changeling-examine-rotting"
};

args.PushMarkup(Loc.GetString(changelingDescription, ("target", Identity.Entity(uid, EntityManager))));
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ changeling-chemicals-deficit = Not enough chemicals!
changeling-action-fail-lesserform = Can't use it while in lesser form!
changeling-action-fail-absorbed = Need to absorb {$number} more organics to use it!

changeling-absorb-start = {CAPITALIZE(THE($user))} starts absorbing {CAPITALIZE(THE($target))}'s!
changeling-examine-rotting = [color=yellow]{ CAPITALIZE(POSS-ADJ($target)) } corpse has low biomass and will offer no evolutionary potential.[/color]
changeling-examine-extremely-bloated = [color=red]{ CAPITALIZE(POSS-ADJ($target)) } corpse is inedible.[/color]

changeling-absorb-start = {CAPITALIZE(THE($user))} starts absorbing {CAPITALIZE(THE($target))}!
changeling-absorb-fail-incapacitated = You can't absorb it until it's not incapacitated.
changeling-absorb-fail-absorbed = You've already absorbed it.
changeling-absorb-fail-unabsorbable = The target is not absorbable.
changeling-absorb-fail-extremely-bloated = The target is too rotted to absorb.
changeling-absorb-end-self = Another organic absorbed. You are evolving.
changeling-absorb-end-self-ling = Another changeling absorbed. You are evolving more rapidly.
changeling-absorb-onexamine = [color=red]The body feels hollow.[/color]
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/human.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
Blunt: 19
- type: Inventory
templateId: corpse
- type: Rotting
totalRotTime: 1200 # 20 minutes

- type: entity
parent: MobHuman
Expand Down
Loading