Add firelock warnings popup when opening on access allowed (#28420)

This commit is contained in:
ShadowCommander
2024-05-31 07:56:20 -07:00
committed by GitHub
parent 3c00eef877
commit 42de8df519

View File

@@ -56,25 +56,36 @@ public abstract class SharedFirelockSystem : EntitySystem
if (!component.Powered || (!overrideAccess && component.IsLocked))
args.Cancel();
else if (args.User != null)
WarnPlayer((uid, component), args.User.Value);
}
private void OnDoorGetPryTimeModifier(EntityUid uid, FirelockComponent component, ref GetPryTimeModifierEvent args)
{
if (component.Temperature)
{
_popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-fire-message"),
uid, args.User, PopupType.MediumCaution);
}
else if (component.Pressure)
{
_popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-pressure-message"),
uid, args.User, PopupType.MediumCaution);
}
WarnPlayer((uid, component), args.User);
if (component.IsLocked)
args.PryTimeModifier *= component.LockedPryTimeModifier;
}
private void WarnPlayer(Entity<FirelockComponent> ent, EntityUid user)
{
if (ent.Comp.Temperature)
{
_popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-fire-message"),
ent.Owner,
user,
PopupType.MediumCaution);
}
else if (ent.Comp.Pressure)
{
_popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-pressure-message"),
ent.Owner,
user,
PopupType.MediumCaution);
}
}
private void OnAfterPried(EntityUid uid, FirelockComponent component, ref PriedEvent args)
{
component.EmergencyCloseCooldown = _gameTiming.CurTime + component.EmergencyCloseCooldownDuration;