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

refine changeling flavour text #947

Merged
merged 9 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -8,7 +8,6 @@
using Content.Shared.Store.Components;
using Content.Shared.Popups;
using Content.Shared.Damage;
using Robust.Shared.Prototypes;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Atmos.Rotting;
using Content.Server.Objectives.Components;
Expand All @@ -20,12 +19,16 @@
using Content.Shared.Stealth.Components;
using Content.Shared.Damage.Components;
using Content.Server.Radio.Components;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Server.Changeling;

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

public void SubscribeAbilities()
{
Expand Down Expand Up @@ -82,30 +85,36 @@ private void OnAbsorb(EntityUid uid, ChangelingComponent comp, ref AbsorbDNAEven

if (!IsIncapacitated(target))
{
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-incapacitated"), uid, uid);
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-incapacitated", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return;
}
if (HasComp<AbsorbedComponent>(target))
{
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-absorbed"), uid, uid);
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-absorbed", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return;
}
if (!HasComp<AbsorbableComponent>(target) || (TryComp<AbsorbableComponent>(target, out var absorbComp) && absorbComp.Disabled))
{
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-unabsorbable"), uid, uid);
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-unabsorbable", ("target", Identity.Entity(target, EntityManager))), 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);
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-extremely-bloated", ("target", Identity.Entity(target, EntityManager))), 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(popupOthers, uid, PopupType.LargeCaution);
var popupSelf = Loc.GetString("changeling-absorb-start-self", ("target", Identity.Entity(target, EntityManager)));
var popupTarget = Loc.GetString("changeling-absorb-start-target");
var popupOthers = Loc.GetString("changeling-absorb-start-others", ("user", Identity.Entity(uid, EntityManager)), ("target", Identity.Entity(target, EntityManager)));

_popup.PopupEntity(popupSelf, uid, uid);
_popup.PopupEntity(popupTarget, uid, target, PopupType.MediumCaution);
_popup.PopupEntity(popupOthers, uid, Filter.Pvs(uid).RemovePlayersByAttachedEntity([uid, target]), true, PopupType.MediumCaution);

PlayMeatySound(uid, comp);
var dargs = new DoAfterArgs(EntityManager, uid, TimeSpan.FromSeconds(15), new AbsorbDNADoAfterEvent(), uid, target)
{
Expand Down Expand Up @@ -148,29 +157,36 @@ private void OnAbsorbDoAfter(EntityUid uid, ChangelingComponent comp, ref Absorb

EnsureComp<AbsorbedComponent>(target);

var popup = Loc.GetString("changeling-absorb-end-self-ling");
var popupSelf = Loc.GetString("changeling-absorb-end-self", ("target", Identity.Entity(target, EntityManager)));
var popupTarget = Loc.GetString("changeling-absorb-end-target");
var popupOthers = Loc.GetString("changeling-absorb-end-others", ("user", Identity.Entity(uid, EntityManager)), ("target", Identity.Entity(target, EntityManager)));

var bonusChemicals = 0f;
var bonusEvolutionPoints = 0f;

if (TryComp<ChangelingComponent>(target, out var targetComp))
{
popupSelf = Loc.GetString("changeling-absorb-end-self-ling", ("target", Identity.Entity(target, EntityManager)));
bonusChemicals += targetComp.MaxChemicals / 2;
bonusEvolutionPoints += 10;
comp.MaxBiomass += targetComp.MaxBiomass / 2;
}
else
{
popup = Loc.GetString("changeling-absorb-end-self");
bonusChemicals += 10;

if (!reducedBiomass)
bonusEvolutionPoints += 2;
else
popup = Loc.GetString("changeling-absorb-end-self-reduced-biomass");
popupSelf = Loc.GetString("changeling-absorb-end-self-reduced-biomass");
}

_popup.PopupEntity(popupSelf, uid, uid);
_popup.PopupEntity(popupTarget, uid, target, PopupType.LargeCaution);
_popup.PopupEntity(popupOthers, uid, Filter.Pvs(uid).RemovePlayersByAttachedEntity([uid, target]), true, PopupType.LargeCaution);

TryStealDNA(uid, target, comp, true);
comp.TotalAbsorbedEntities++;

_popup.PopupEntity(popup, args.User, args.User);
comp.MaxChemicals += bonusChemicals;

if (TryComp<StoreComponent>(args.User, out var store))
Expand All @@ -191,12 +207,12 @@ private void OnStingExtractDNA(EntityUid uid, ChangelingComponent comp, ref Stin

var target = args.Target;
if (!TryStealDNA(uid, target, comp, true))
{
_popup.PopupEntity(Loc.GetString("changeling-sting-extract-fail"), uid, uid);
// royal cashback
comp.Chemicals += Comp<ChangelingActionComponent>(args.Action).ChemicalCost;
else
{
_popup.PopupEntity(Loc.GetString("changeling-sting-self", ("target", Identity.Entity(target, EntityManager))), uid, uid);
// _popup.PopupEntity(Loc.GetString("changeling-sting-target"), target, target);
}
else _popup.PopupEntity(Loc.GetString("changeling-sting", ("target", Identity.Entity(target, EntityManager))), uid, uid);
}

private void OnTransformCycle(EntityUid uid, ChangelingComponent comp, ref ChangelingTransformCycleEvent args)
Expand Down Expand Up @@ -463,17 +479,17 @@ public void OnLayEgg(EntityUid uid, ChangelingComponent comp, ref StingLayEggsEv

if (!_mobState.IsDead(target))
{
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-incapacitated"), uid, uid);
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-incapacitated", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return;
}
if (HasComp<AbsorbedComponent>(target))
{
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-absorbed"), uid, uid);
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-absorbed", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return;
}
if (!HasComp<AbsorbableComponent>(target))
{
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-unabsorbable"), uid, uid);
_popup.PopupEntity(Loc.GetString("changeling-absorb-fail-unabsorbable", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return;
}

Expand Down Expand Up @@ -662,9 +678,20 @@ public void OnLesserForm(EntityUid uid, ChangelingComponent comp, ref ActionLess
return;
}

PlayMeatySound((EntityUid) newUid, comp);
var loc = Loc.GetString("changeling-transform-others", ("user", Identity.Entity((EntityUid) newUid, EntityManager)));
_popup.PopupEntity(loc, (EntityUid) newUid, PopupType.LargeCaution);
var targetUid = (EntityUid)newUid;

var popupSelf = Loc.GetString("changeling-transform-self", ("target", targetUid));
var popupTarget = Loc.GetString("changeling-transform-target", ("target", targetUid));
var popupOthers = Loc.GetString("changeling-transform-others", ("user", Identity.Entity(uid, EntityManager)), ("target", targetUid));

if (HasComp<ChangelingComponent>(uid))
_popup.PopupEntity(popupSelf, targetUid, targetUid);
else
_popup.PopupEntity(popupTarget, targetUid, targetUid, PopupType.MediumCaution);

_popup.PopupEntity(popupOthers, targetUid, Filter.Pvs(targetUid).RemovePlayerByAttachedEntity(targetUid), true, PopupType.MediumCaution);

PlayMeatySound((EntityUid)newUid, comp);
}
public void OnSpacesuit(EntityUid uid, ChangelingComponent comp, ref ActionSpacesuitEvent args)
{
Expand Down
43 changes: 33 additions & 10 deletions Content.Server/_Goobstation/Changeling/ChangelingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public bool TrySting(EntityUid uid, ChangelingComponent comp, EntityTargetAction
// can't get his dna if he doesn't have it!
if (!HasComp<AbsorbableComponent>(target) || HasComp<AbsorbedComponent>(target))
{
_popup.PopupEntity(Loc.GetString("changeling-sting-extract-fail"), uid, uid);
_popup.PopupEntity(Loc.GetString("changeling-sting-extract-fail", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return false;
}

Expand All @@ -347,8 +347,13 @@ public bool TrySting(EntityUid uid, ChangelingComponent comp, EntityTargetAction
_popup.PopupEntity(Loc.GetString("changeling-sting-fail-ling"), target, target);
return false;
}

if (!overrideMessage)
_popup.PopupEntity(Loc.GetString("changeling-sting", ("target", Identity.Entity(target, EntityManager))), uid, uid);
{
_popup.PopupEntity(Loc.GetString("changeling-sting-self", ("target", Identity.Entity(target, EntityManager))), uid, uid);
// _popup.PopupEntity(Loc.GetString("changeling-sting-target"), target, target);
}

return true;
}
public bool TryInjectReagents(EntityUid uid, List<(string, FixedPoint2)> reagents)
Expand Down Expand Up @@ -439,12 +444,18 @@ public bool TryStealDNA(EntityUid uid, EntityUid target, ChangelingComponent com
|| !TryComp<MetaDataComponent>(target, out var metadata)
|| !TryComp<DnaComponent>(target, out var dna)
|| !TryComp<FingerprintComponent>(target, out var fingerprint))
{
_popup.PopupEntity(Loc.GetString("changeling-sting-extract-fail", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return false;
}

foreach (var storedDNA in comp.AbsorbedDNA)
{
if (storedDNA.DNA != null && storedDNA.DNA == dna.DNA)
{
_popup.PopupEntity(Loc.GetString("changeling-sting-extract-fail", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return false;
}
}

var data = new TransformData
Expand All @@ -458,8 +469,12 @@ public bool TryStealDNA(EntityUid uid, EntityUid target, ChangelingComponent com
data.Fingerprint = fingerprint.Fingerprint;

if (comp.AbsorbedDNA.Count >= comp.MaxAbsorbedDNA)
_popup.PopupEntity(Loc.GetString("changeling-sting-extract-max"), uid, uid);
else comp.AbsorbedDNA.Add(data);
{
_popup.PopupEntity(Loc.GetString("changeling-sting-extract-max", ("target", Identity.Entity(target, EntityManager))), uid, uid);
return false;
}
else
comp.AbsorbedDNA.Add(data);

if (countObjective
&& _mind.TryGetMind(uid, out var mindId, out var mind)
Expand Down Expand Up @@ -539,8 +554,6 @@ public bool TryStealDNA(EntityUid uid, EntityUid target, ChangelingComponent com
Comp<DnaComponent>(newEnt).DNA = data.DNA;
_humanoid.CloneAppearance(data.Appearance.Owner, newEnt);
_metaData.SetEntityName(newEnt, data.Name);
var message = Loc.GetString("changeling-transform-finish", ("target", data.Name));
_popup.PopupEntity(message, newEnt, newEnt);
}

RemCompDeferred<PolymorphedEntityComponent>(newEnt);
Expand Down Expand Up @@ -593,7 +606,6 @@ public bool TryTransform(EntityUid target, ChangelingComponent comp, bool sting
return false;
}

var locName = Identity.Entity(target, EntityManager);
EntityUid? newUid = null;
if (sting)
newUid = TransformEntity(target, data: data, persistentDna: persistentDna);
Expand All @@ -605,9 +617,20 @@ public bool TryTransform(EntityUid target, ChangelingComponent comp, bool sting

if (newUid != null)
{
PlayMeatySound((EntityUid) newUid, comp);
var loc = Loc.GetString("changeling-transform-others", ("user", locName));
_popup.PopupEntity(loc, (EntityUid) newUid, PopupType.LargeCaution);
var targetUid = (EntityUid)newUid;

var popupSelf = Loc.GetString("changeling-transform-self", ("target", targetUid));
var popupTarget = Loc.GetString("changeling-transform-target", ("target", targetUid));
var popupOthers = Loc.GetString("changeling-transform-others", ("user", Identity.Entity(target, EntityManager)), ("target", targetUid));

if (HasComp<ChangelingComponent>(target))
_popup.PopupEntity(popupSelf, targetUid, targetUid);
else
_popup.PopupEntity(popupTarget, targetUid, targetUid, PopupType.MediumCaution);

_popup.PopupEntity(popupOthers, targetUid, Filter.Pvs(targetUid).RemovePlayerByAttachedEntity(targetUid), true, PopupType.MediumCaution);

PlayMeatySound(targetUid, comp);
}

return true;
Expand Down
3 changes: 2 additions & 1 deletion Content.Shared/_Goobstation/Changeling/AbsorbedSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Mobs;

namespace Content.Shared.Changeling;
Expand All @@ -15,7 +16,7 @@ public override void Initialize()

private void OnExamine(Entity<AbsorbedComponent> ent, ref ExaminedEvent args)
{
args.PushMarkup(Loc.GetString("changeling-absorb-onexamine"));
args.PushMarkup(Loc.GetString("changeling-absorb-onexamine", ("target", Identity.Entity(ent, EntityManager))));
}

private void OnMobStateChange(Entity<AbsorbedComponent> ent, ref MobStateChangedEvent args)
Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/en-US/_Goobstation/alerts/alerts.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
alerts-changeling-chemicals-name = Chemicals
alerts-changeling-chemicals-desc = Spend chemicals to use your abilities. Slowly regenerates.
alerts-changeling-chemicals-desc = Spend chemicals to use our abilities. Slowly regenerates.

alerts-changeling-biomass-name = Biomass
alerts-changeling-biomass-desc =
This is your health. If it reaches 0 - it's [color=red]game over[/color]. Absorb humanoids to recover some of it.
This is our health. If it reaches 0 - it's [color=red]game over[/color]. Feed on organics to recover it.
Darkmajia marked this conversation as resolved.
Show resolved Hide resolved
Loading