Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGrimbeeper committed Dec 11, 2024
2 parents 1ee599f + 6ae0896 commit 785045f
Show file tree
Hide file tree
Showing 78 changed files with 380,271 additions and 244,086 deletions.
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 @@ -21,6 +20,9 @@
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;

Expand Down Expand Up @@ -84,30 +86,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, target, 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 @@ -150,29 +158,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", ("target", Identity.Entity(target, EntityManager)));
}

_popup.PopupEntity(popupSelf, uid, uid);
_popup.PopupEntity(popupTarget, target, 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 @@ -193,12 +208,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 @@ -405,8 +420,7 @@ private void OnStingCryo(EntityUid uid, ChangelingComponent comp, ref StingCryoE
{
var reagents = new List<(string, FixedPoint2)>()
{
("Fresium", 20f),
("ChloralHydrate", 10f)
("Fresium", 20f)
};

if (!TryReagentSting(uid, comp, args, reagents))
Expand All @@ -416,8 +430,7 @@ private void OnStingLethargic(EntityUid uid, ChangelingComponent comp, ref Sting
{
var reagents = new List<(string, FixedPoint2)>()
{
("Impedrezene", 10f),
("MuteToxin", 5f)
("ChloralHydrate", 15f)
};

if (!TryReagentSting(uid, comp, args, reagents))
Expand All @@ -427,7 +440,7 @@ private void OnStingMute(EntityUid uid, ChangelingComponent comp, ref StingMuteE
{
var reagents = new List<(string, FixedPoint2)>()
{
("MuteToxin", 15f)
("MuteToxin", 9f)
};

if (!TryReagentSting(uid, comp, args, reagents))
Expand Down Expand Up @@ -465,17 +478,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 @@ -668,9 +681,15 @@ 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-lesser-self");
var popupOthers = Loc.GetString("changeling-transform-lesser-others", ("user", Identity.Entity(uid, EntityManager)));

_popup.PopupEntity(popupSelf, targetUid, targetUid);
_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
48 changes: 32 additions & 16 deletions Content.Server/_Goobstation/Changeling/ChangelingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,21 +334,19 @@ public bool TrySting(EntityUid uid, ChangelingComponent comp, EntityTargetAction

var target = action.Target;

// 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);
return false;
}

if (HasComp<ChangelingComponent>(target))
{
_popup.PopupEntity(Loc.GetString("changeling-sting-fail-self", ("target", Identity.Entity(target, EntityManager))), uid, uid);
_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 +437,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 +462,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 +547,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 +599,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 +610,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
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ public sealed partial class SiliconLawProviderComponent : Component
[DataField]
public bool Subverted = false;

/// <summary>
/// Whether this silicon can be subverted by an emag. Imp special
/// </summary>
[DataField]
public bool CanBeSubverted = true;
}
7 changes: 7 additions & 0 deletions Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public override void Initialize()
InitializeUpdater();
SubscribeLocalEvent<EmagSiliconLawComponent, GotEmaggedEvent>(OnGotEmagged);
SubscribeLocalEvent<EmagSiliconLawComponent, OnAttemptEmagEvent>(OnAttemptEmag);
SubscribeLocalEvent<SiliconLawProviderComponent, OnAttemptEmagEvent>(OnAttemptEmag);
}

protected virtual void OnAttemptEmag(EntityUid uid, EmagSiliconLawComponent component, ref OnAttemptEmagEvent args)
Expand Down Expand Up @@ -45,4 +46,10 @@ protected virtual void OnGotEmagged(EntityUid uid, EmagSiliconLawComponent compo
component.OwnerName = Name(args.UserUid);
args.Handled = true;
}

protected virtual void OnAttemptEmag(EntityUid uid, SiliconLawProviderComponent component, ref OnAttemptEmagEvent args) ///imp special
{
if (component.CanBeSubverted == false)
args.Handled = true;
}
}
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
Loading

0 comments on commit 785045f

Please sign in to comment.