Fixed Alerts in CosmicCult files. Converted params to upstream conventions.

This commit is contained in:
Vanessa 2025-12-10 12:32:25 -06:00
parent e948958e08
commit 706abdaa06
3 changed files with 69 additions and 67 deletions

View File

@ -43,22 +43,22 @@ public sealed class CosmicSiphonSystem : EntitySystem
SubscribeLocalEvent<CosmicCultComponent, EventCosmicSiphonDoAfter>(OnCosmicSiphonDoAfter);
}
private void OnCosmicSiphon(Entity<CosmicCultComponent> uid, ref EventCosmicSiphon args)
private void OnCosmicSiphon(Entity<CosmicCultComponent> ent, ref EventCosmicSiphon args)
{
if (uid.Comp.EntropyStored >= uid.Comp.EntropyStoredCap)
if (ent.Comp.EntropyStored >= ent.Comp.EntropyStoredCap)
{
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-full"), uid, uid);
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-full"), ent, ent);
return;
}
if (HasComp<ActiveNPCComponent>(args.Target) || _mobState.IsDead(args.Target))
{
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-fail", ("target", Identity.Entity(args.Target, EntityManager))), uid, uid);
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-fail", ("target", Identity.Entity(args.Target, EntityManager))), ent, ent);
return;
}
if (args.Handled)
return;
var doargs = new DoAfterArgs(EntityManager, uid, uid.Comp.CosmicSiphonDelay, new EventCosmicSiphonDoAfter(), uid, args.Target)
var doargs = new DoAfterArgs(EntityManager, ent, ent.Comp.CosmicSiphonDelay, new EventCosmicSiphonDoAfter(), ent, args.Target)
{
DistanceThreshold = 2f,
Hidden = true,
@ -72,7 +72,7 @@ public sealed class CosmicSiphonSystem : EntitySystem
_doAfter.TryStartDoAfter(doargs);
}
private void OnCosmicSiphonDoAfter(Entity<CosmicCultComponent> uid, ref EventCosmicSiphonDoAfter args)
private void OnCosmicSiphonDoAfter(Entity<CosmicCultComponent> ent, ref EventCosmicSiphonDoAfter args)
{
if (args.Args.Target is not { } target)
return;
@ -80,40 +80,40 @@ public sealed class CosmicSiphonSystem : EntitySystem
return;
args.Handled = true;
if (TryComp<ActorComponent>(uid, out var actor))
if (TryComp<ActorComponent>(ent, out var actor))
RaiseNetworkEvent(new CosmicSiphonIndicatorEvent(GetNetEntity(target)), actor.PlayerSession);
var siphonQuantity = uid.Comp.CosmicSiphonQuantity;
var siphonQuantity = ent.Comp.CosmicSiphonQuantity;
if (_mobState.IsCritical(target)) // If the target is in crit, we get much more entropy from them, but kill them in the process.
{
siphonQuantity = HasComp<MindShieldComponent>(target) ? uid.Comp.SiphonQuantityCritMindshield : uid.Comp.SiphonQuantityCrit;
siphonQuantity = HasComp<MindShieldComponent>(target) ? ent.Comp.SiphonQuantityCritMindshield : ent.Comp.SiphonQuantityCrit;
_damageable.TryChangeDamage(target, uid.Comp.SiphonCritDamage);
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-crit", ("user", Identity.Entity(uid, EntityManager)), ("target", Identity.Entity(target, EntityManager))), uid, PopupType.MediumCaution);
_damageable.TryChangeDamage(target, ent.Comp.SiphonCritDamage);
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-crit", ("user", Identity.Entity(ent, EntityManager)), ("target", Identity.Entity(target, EntityManager))), ent, PopupType.MediumCaution);
}
if (siphonQuantity + uid.Comp.EntropyStored > uid.Comp.EntropyStoredCap)
siphonQuantity = uid.Comp.EntropyStoredCap - uid.Comp.EntropyStored;
if (siphonQuantity + ent.Comp.EntropyStored > ent.Comp.EntropyStoredCap)
siphonQuantity = ent.Comp.EntropyStoredCap - ent.Comp.EntropyStored;
uid.Comp.EntropyStored += siphonQuantity;
uid.Comp.EntropyBudget += siphonQuantity;
Dirty(uid, uid.Comp);
ent.Comp.EntropyStored += siphonQuantity;
ent.Comp.EntropyBudget += siphonQuantity;
Dirty(ent, ent.Comp);
if (_cosmicCult.EntityIsCultist(target))
{
_statusEffects.TryAddStatusEffect<CosmicEntropyDebuffComponent>(target, "EntropicDegen", TimeSpan.FromSeconds(_random.Next(21) + 40), true); //40-60 seconds, 4-6 cold damage per siphon
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-cultist-success", ("target", Identity.Entity(target, EntityManager))), uid, uid);
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-cultist-success", ("target", Identity.Entity(target, EntityManager))), ent, ent);
}
else
{
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-success", ("target", Identity.Entity(target, EntityManager))), uid, uid);
_alerts.ShowAlert(uid, uid.Comp.EntropyAlert);
_cultRule.IncrementCultObjectiveEntropy(uid);
_popup.PopupEntity(Loc.GetString("cosmicability-siphon-success", ("target", Identity.Entity(target, EntityManager))), ent, ent);
_alerts.ShowAlert(ent.Owner, ent.Comp.EntropyAlert);
_cultRule.IncrementCultObjectiveEntropy(ent);
}
if (uid.Comp.CosmicEmpowered) // if you're empowered there's a 50% chance to flicker lights on siphon
if (ent.Comp.CosmicEmpowered) // if you're empowered there's a 50% chance to flicker lights on siphon
{
_lights.Clear();
_lookup.GetEntitiesInRange<PoweredLightComponent>(Transform(uid).Coordinates, 5, _lights, LookupFlags.StaticSundries);
_lookup.GetEntitiesInRange<PoweredLightComponent>(Transform(ent).Coordinates, 5, _lights, LookupFlags.StaticSundries);
foreach (var light in _lights) // static range of 5. because.
{
if (!_random.Prob(0.5f))

View File

@ -776,35 +776,35 @@ public sealed class CosmicCultRuleSystem : GameRuleSystem<CosmicCultRuleComponen
UpdateCultData(cult.Comp.MonumentInGame);
}
private void OnComponentShutdown(Entity<CosmicCultComponent> uid, ref ComponentShutdown args)
private void OnComponentShutdown(Entity<CosmicCultComponent> ent, ref ComponentShutdown args)
{
if (AssociatedGamerule(uid) is not { } cult)
if (AssociatedGamerule(ent) is not { } cult)
return;
if (TerminatingOrDeleted(uid))
if (TerminatingOrDeleted(ent))
return;
var cosmicGamerule = cult.Comp;
if(TryComp<CrawlerComponent>(uid, out var crawlerComp))
_stun.TryCrawling((uid, crawlerComp), TimeSpan.FromSeconds(2), refresh: true);
if(TryComp<CrawlerComponent>(ent, out var crawlerComp))
_stun.TryCrawling((ent, crawlerComp), TimeSpan.FromSeconds(2), refresh: true);
foreach (var actionEnt in uid.Comp.ActionEntities) _actions.RemoveAction(actionEnt);
foreach (var actionEnt in ent.Comp.ActionEntities) _actions.RemoveAction(actionEnt);
if (TryComp<IntrinsicRadioTransmitterComponent>(uid, out var transmitter))
if (TryComp<IntrinsicRadioTransmitterComponent>(ent, out var transmitter))
transmitter.Channels.Remove("CosmicRadio");
if (TryComp<ActiveRadioComponent>(uid, out var radio))
if (TryComp<ActiveRadioComponent>(ent, out var radio))
radio.Channels.Remove("CosmicRadio");
RemComp<CosmicCultLeadComponent>(uid);
RemComp<InfluenceVitalityComponent>(uid);
RemComp<InfluenceStrideComponent>(uid);
RemComp<PressureImmunityComponent>(uid);
RemComp<TemperatureImmunityComponent>(uid);
RemComp<CosmicStarMarkComponent>(uid);
RemComp<CosmicSubtleMarkComponent>(uid);
RemComp<CosmicCultLeadComponent>(ent);
RemComp<InfluenceVitalityComponent>(ent);
RemComp<InfluenceStrideComponent>(ent);
RemComp<PressureImmunityComponent>(ent);
RemComp<TemperatureImmunityComponent>(ent);
RemComp<CosmicStarMarkComponent>(ent);
RemComp<CosmicSubtleMarkComponent>(ent);
_antag.SendBriefing(uid, Loc.GetString("cosmiccult-role-deconverted-fluff"), Color.FromHex("#4cabb3"), _deconvertSound);
_antag.SendBriefing(uid, Loc.GetString("cosmiccult-role-deconverted-briefing"), Color.FromHex("#cae8e8"), null);
_antag.SendBriefing(ent, Loc.GetString("cosmiccult-role-deconverted-fluff"), Color.FromHex("#4cabb3"), _deconvertSound);
_antag.SendBriefing(ent, Loc.GetString("cosmiccult-role-deconverted-briefing"), Color.FromHex("#cae8e8"), null);
if (!_mind.TryGetMind(uid, out var mindId, out var mind))
if (!_mind.TryGetMind(ent, out var mindId, out var mind))
return;
_mind.ClearObjectives(mindId, mind);
@ -814,13 +814,14 @@ public sealed class CosmicCultRuleSystem : GameRuleSystem<CosmicCultRuleComponen
{
_euiMan.OpenEui(new CosmicDeconvertedEui(), session);
}
_eye.SetVisibilityMask(uid, 1);
_alerts.ClearAlert(uid, uid.Comp.EntropyAlert);
_eye.SetVisibilityMask(ent, 1);
_alerts.ClearAlert(ent.Owner, ent.Comp.EntropyAlert);
cosmicGamerule.TotalCult--;
cosmicGamerule.Cultists.Remove(uid);
cosmicGamerule.Cultists.Remove(ent);
AdjustCultObjectiveConversion(-1);
UpdateCultData(cosmicGamerule.MonumentInGame);
_movementSpeed.RefreshMovementSpeedModifiers(uid);
_movementSpeed.RefreshMovementSpeedModifiers(ent);
}
#endregion
}

View File

@ -133,39 +133,40 @@ public sealed partial class CosmicCultSystem : SharedCosmicCultSystem
/// <summary>
/// Add the starting powers to the cultist.
/// </summary>
private void OnStartCultist(Entity<CosmicCultComponent> uid, ref ComponentInit args)
private void OnStartCultist(Entity<CosmicCultComponent> ent, ref ComponentInit args)
{
_eye.RefreshVisibilityMask(uid.Owner);
_alerts.ShowAlert(uid, uid.Comp.EntropyAlert);
if (!HasComp<HumanoidAppearanceComponent>(uid)) return; // Non-humanoids don't get abilities
foreach (var actionId in uid.Comp.CosmicCultActions)
_eye.RefreshVisibilityMask(ent.Owner);
_alerts.ShowAlert(ent.Owner, ent.Comp.EntropyAlert);
if (!HasComp<HumanoidAppearanceComponent>(ent)) return; // Non-humanoids don't get abilities
foreach (var actionId in ent.Comp.CosmicCultActions)
{
var actionEnt = _actions.AddAction(uid, actionId);
uid.Comp.ActionEntities.Add(actionEnt);
var actionEnt = _actions.AddAction(ent, actionId);
ent.Comp.ActionEntities.Add(actionEnt);
}
}
/// <summary>
/// Add the Monument summon action to the cult lead.
/// </summary>
private void OnStartCultLead(Entity<CosmicCultLeadComponent> uid, ref ComponentInit args)
private void OnStartCultLead(Entity<CosmicCultLeadComponent> ent, ref ComponentInit args)
{
if (_cultRule.AssociatedGamerule(uid) is not { } cult)
if (_cultRule.AssociatedGamerule(ent) is not { } cult)
return;
if (!HasComp<HumanoidAppearanceComponent>(uid)) return; // Non-humanoids don't get abilities
if (!HasComp<HumanoidAppearanceComponent>(ent)) return; // Non-humanoids don't get abilities
if (!cult.Comp.MonumentPlaced) // There's no monument, grant them an action to place one
_actions.AddAction(uid, ref uid.Comp.CosmicMonumentPlaceActionEntity, uid.Comp.CosmicMonumentPlaceAction, uid);
_actions.AddAction(ent, ref ent.Comp.CosmicMonumentPlaceActionEntity, ent.Comp.CosmicMonumentPlaceAction, ent);
if (cult.Comp.MonumentMoved) return; // If the monument was already moved, don't let them do it again.
var objectiveQuery = EntityQueryEnumerator<CosmicTierConditionComponent>();
while (objectiveQuery.MoveNext(out _, out var objectiveComp))
{
if (objectiveComp.Tier == 2) // If it's stage 2, give them the move action
_actions.AddAction(uid, ref uid.Comp.CosmicMonumentMoveActionEntity, uid.Comp.CosmicMonumentMoveAction, uid);
_actions.AddAction(ent, ref ent.Comp.CosmicMonumentMoveActionEntity, ent.Comp.CosmicMonumentMoveAction, ent);
}
}
private void OnGetVisMask(Entity<CosmicCultComponent> uid, ref GetVisMaskEvent args)
private void OnGetVisMask(Entity<CosmicCultComponent> ent, ref GetVisMaskEvent args)
{
args.VisibilityMask |= (int)VisibilityFlags.CosmicCultMonument;
}
@ -222,28 +223,28 @@ public sealed partial class CosmicCultSystem : SharedCosmicCultSystem
#endregion
#region Movespeed
private void OnStartInfluenceStride(Entity<InfluenceStrideComponent> uid, ref ComponentInit args) // i wish movespeed was easier to work with
private void OnStartInfluenceStride(Entity<InfluenceStrideComponent> ent, ref ComponentInit args) // i wish movespeed was easier to work with
{
_movementSpeed.RefreshMovementSpeedModifiers(uid);
_movementSpeed.RefreshMovementSpeedModifiers(ent);
}
private void OnEndInfluenceStride(Entity<InfluenceStrideComponent> uid, ref ComponentRemove args) // that movespeed applies more-or-less correctly
private void OnEndInfluenceStride(Entity<InfluenceStrideComponent> ent, ref ComponentRemove args) // that movespeed applies more-or-less correctly
{
_movementSpeed.RefreshMovementSpeedModifiers(uid);
_movementSpeed.RefreshMovementSpeedModifiers(ent);
}
private void OnStartImposition(Entity<CosmicImposingComponent> uid, ref ComponentInit args) // these functions just make sure
private void OnStartImposition(Entity<CosmicImposingComponent> ent, ref ComponentInit args) // these functions just make sure
{
_movementSpeed.RefreshMovementSpeedModifiers(uid);
_movementSpeed.RefreshMovementSpeedModifiers(ent);
}
private void OnEndImposition(Entity<CosmicImposingComponent> uid, ref ComponentRemove args) // as various cosmic cult effects get added and removed
private void OnEndImposition(Entity<CosmicImposingComponent> ent, ref ComponentRemove args) // as various cosmic cult effects get added and removed
{
_movementSpeed.RefreshMovementSpeedModifiers(uid);
_movementSpeed.RefreshMovementSpeedModifiers(ent);
}
private void OnRefreshMoveSpeed(EntityUid uid, InfluenceStrideComponent comp, RefreshMovementSpeedModifiersEvent args)
private void OnRefreshMoveSpeed(EntityUid ent, InfluenceStrideComponent comp, RefreshMovementSpeedModifiersEvent args)
{
args.ModifySpeed(1.15f, 1.15f);
}
private void OnImpositionMoveSpeed(EntityUid uid, CosmicImposingComponent comp, RefreshMovementSpeedModifiersEvent args)
private void OnImpositionMoveSpeed(EntityUid ent, CosmicImposingComponent comp, RefreshMovementSpeedModifiersEvent args)
{
args.ModifySpeed(0.8f, 0.8f);
}