mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
TemporaryBlindness StatusEffect (#43705)
* TemporaryBlindnessStatusEffect * review
This commit is contained in:
parent
3674be8343
commit
3279840bf0
14 changed files with 75 additions and 65 deletions
|
|
@ -3,9 +3,7 @@ using Robust.Shared.GameStates;
|
|||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Component used for the blind status effect.
|
||||
/// Prevents the target from seeing while active.
|
||||
/// </summary>
|
||||
[NetworkedComponent, RegisterComponent]
|
||||
public sealed partial class TemporaryBlindnessComponent : Component
|
||||
{
|
||||
}
|
||||
public sealed partial class BlindnessStatusEffectComponent : Component;
|
||||
47
Content.Shared/Eye/Blinding/Systems/BlindnessSystem.cs
Normal file
47
Content.Shared/Eye/Blinding/Systems/BlindnessSystem.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using Content.Shared.Eye.Blinding.Components;
|
||||
using Content.Shared.Flash;
|
||||
using Content.Shared.StatusEffectNew;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Systems;
|
||||
|
||||
public sealed class BlindnessSystem : EntitySystem
|
||||
{
|
||||
public static readonly EntProtoId BlindingStatusEffect = "StatusEffectBlindness";
|
||||
|
||||
[Dependency] private readonly BlindableSystem _blindableSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<BlindnessStatusEffectComponent, StatusEffectAppliedEvent>(OnApplied);
|
||||
SubscribeLocalEvent<BlindnessStatusEffectComponent, StatusEffectRemovedEvent>(OnRemoved);
|
||||
SubscribeLocalEvent<BlindnessStatusEffectComponent, StatusEffectRelayedEvent<CanSeeAttemptEvent>>(OnBlindTrySee);
|
||||
SubscribeLocalEvent<BlindnessStatusEffectComponent, StatusEffectRelayedEvent<FlashAttemptEvent>>(OnFlashAttempt);
|
||||
}
|
||||
|
||||
private void OnApplied(Entity<BlindnessStatusEffectComponent> ent, ref StatusEffectAppliedEvent args)
|
||||
{
|
||||
_blindableSystem.UpdateIsBlind(args.Target);
|
||||
}
|
||||
|
||||
private void OnRemoved(Entity<BlindnessStatusEffectComponent> ent, ref StatusEffectRemovedEvent args)
|
||||
{
|
||||
_blindableSystem.UpdateIsBlind(args.Target);
|
||||
}
|
||||
|
||||
private void OnBlindTrySee(Entity<BlindnessStatusEffectComponent> ent, ref StatusEffectRelayedEvent<CanSeeAttemptEvent> args)
|
||||
{
|
||||
var ev = args.Args;
|
||||
ev.Cancel();
|
||||
args.Args = ev;
|
||||
}
|
||||
|
||||
private void OnFlashAttempt(Entity<BlindnessStatusEffectComponent> ent, ref StatusEffectRelayedEvent<FlashAttemptEvent> args)
|
||||
{
|
||||
var ev = args.Args;
|
||||
ev.Cancelled = true;
|
||||
args.Args = ev;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.StatusEffectNew;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Eye.Blinding.Components;
|
||||
using Content.Shared.Tools.Components;
|
||||
|
|
@ -55,9 +55,9 @@ namespace Content.Shared.Eye.Blinding.Systems
|
|||
// how much damage they already accumulated.
|
||||
_blindingSystem.AdjustEyeDamage((args.User, blindable), 1);
|
||||
var statusTimeSpan = TimeSpan.FromSeconds(time * MathF.Sqrt(blindable.EyeDamage));
|
||||
_statusEffectsSystem.TryAddStatusEffect(args.User, TemporaryBlindnessSystem.BlindingStatusEffect,
|
||||
statusTimeSpan, false, TemporaryBlindnessSystem.BlindingStatusEffect);
|
||||
_statusEffectsSystem.TryAddStatusEffectDuration(args.User, BlindnessSystem.BlindingStatusEffect, statusTimeSpan);
|
||||
}
|
||||
|
||||
private void OnWelderToggled(EntityUid uid, RequiresEyeProtectionComponent component, ItemToggledEvent args)
|
||||
{
|
||||
component.Toggled = args.Activated;
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
using Content.Shared.Eye.Blinding.Components;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Systems;
|
||||
|
||||
public sealed class TemporaryBlindnessSystem : EntitySystem
|
||||
{
|
||||
public static readonly ProtoId<StatusEffectPrototype> BlindingStatusEffect = "TemporaryBlindness";
|
||||
|
||||
[Dependency] private readonly BlindableSystem _blindableSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<TemporaryBlindnessComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<TemporaryBlindnessComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<TemporaryBlindnessComponent, CanSeeAttemptEvent>(OnBlindTrySee);
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, TemporaryBlindnessComponent component, ComponentStartup args)
|
||||
{
|
||||
_blindableSystem.UpdateIsBlind(uid);
|
||||
}
|
||||
|
||||
private void OnShutdown(EntityUid uid, TemporaryBlindnessComponent component, ComponentShutdown args)
|
||||
{
|
||||
_blindableSystem.UpdateIsBlind(uid);
|
||||
}
|
||||
|
||||
private void OnBlindTrySee(EntityUid uid, TemporaryBlindnessComponent component, CanSeeAttemptEvent args)
|
||||
{
|
||||
if (component.LifeStage <= ComponentLifeStage.Running)
|
||||
args.Cancel();
|
||||
}
|
||||
}
|
||||
|
|
@ -61,7 +61,6 @@ public abstract class SharedFlashSystem : EntitySystem
|
|||
SubscribeLocalEvent<FlashComponent, BeforeRangedInteractEvent>(OnRangedInteract);
|
||||
SubscribeLocalEvent<FlashComponent, LightToggleEvent>(OnLightToggle);
|
||||
SubscribeLocalEvent<PermanentBlindnessComponent, FlashAttemptEvent>(OnPermanentBlindnessFlashAttempt);
|
||||
SubscribeLocalEvent<TemporaryBlindnessComponent, FlashAttemptEvent>(OnTemporaryBlindnessFlashAttempt);
|
||||
Subs.SubscribeWithRelay<FlashImmunityComponent, FlashAttemptEvent>(OnFlashImmunityFlashAttempt, held: false);
|
||||
SubscribeLocalEvent<FlashImmunityComponent, ExaminedEvent>(OnExamine);
|
||||
}
|
||||
|
|
@ -273,11 +272,6 @@ public abstract class SharedFlashSystem : EntitySystem
|
|||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnTemporaryBlindnessFlashAttempt(Entity<TemporaryBlindnessComponent> ent, ref FlashAttemptEvent args)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnFlashImmunityFlashAttempt(Entity<FlashImmunityComponent> ent, ref FlashAttemptEvent args)
|
||||
{
|
||||
if (TryComp<MaskComponent>(ent, out var mask) && mask.IsToggled)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using Content.Shared.Body.Events;
|
||||
using Content.Shared.Damage.Events;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.Eye.Blinding.Systems;
|
||||
using Content.Shared.Flash;
|
||||
using Content.Shared.Mobs.Events;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Movement.Systems;
|
||||
|
|
@ -29,6 +31,8 @@ public sealed partial class StatusEffectsSystem
|
|||
SubscribeLocalEvent<StatusEffectContainerComponent, StandUpAttemptEvent>(RefRelayStatusEffectEvent);
|
||||
SubscribeLocalEvent<StatusEffectContainerComponent, StunEndAttemptEvent>(RefRelayStatusEffectEvent);
|
||||
SubscribeLocalEvent<StatusEffectContainerComponent, RefreshStaminaCritThresholdEvent>(RefRelayStatusEffectEvent);
|
||||
SubscribeLocalEvent<StatusEffectContainerComponent, CanSeeAttemptEvent>(RelayStatusEffectEvent);
|
||||
SubscribeLocalEvent<StatusEffectContainerComponent, FlashAttemptEvent>(RefRelayStatusEffectEvent);
|
||||
|
||||
SubscribeLocalEvent<StatusEffectContainerComponent, BeforeForceSayEvent>(RelayStatusEffectEvent);
|
||||
SubscribeLocalEvent<StatusEffectContainerComponent, BeforeAlertSeverityCheckEvent>(RelayStatusEffectEvent);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
entity-effect-status-effect-Stun = stunning
|
||||
entity-effect-status-effect-KnockedDown = knockdown
|
||||
entity-effect-status-effect-Jitter = jittering
|
||||
entity-effect-status-effect-TemporaryBlindness = blindness
|
||||
entity-effect-status-effect-SeeingRainbows = hallucinations
|
||||
entity-effect-status-effect-Muted = inability to speak
|
||||
entity-effect-status-effect-Stutter = stuttering
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@
|
|||
- RatvarianLanguage
|
||||
- PressureImmunity
|
||||
- Muted
|
||||
- TemporaryBlindness
|
||||
- Pacified
|
||||
- Flashed
|
||||
- Adrenaline
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
- type: StatusEffects
|
||||
allowed:
|
||||
- Electrocution
|
||||
- TemporaryBlindness
|
||||
- Adrenaline
|
||||
- type: StandingState
|
||||
- type: Tag
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
- type: StatusEffects
|
||||
allowed:
|
||||
- Electrocution
|
||||
- TemporaryBlindness
|
||||
- Pacified
|
||||
- Flashed
|
||||
- Adrenaline
|
||||
|
|
@ -91,7 +90,6 @@
|
|||
- type: StatusEffects
|
||||
allowed:
|
||||
- Electrocution
|
||||
- TemporaryBlindness
|
||||
- Pacified
|
||||
- Flashed
|
||||
- Adrenaline
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@
|
|||
- type: StatusEffects # Overwriting basesimplemob to remove flash, getting flashed as dragon just feelsbad
|
||||
allowed:
|
||||
- Electrocution
|
||||
- TemporaryBlindness
|
||||
- Pacified
|
||||
- Adrenaline
|
||||
- type: Temperature
|
||||
|
|
|
|||
|
|
@ -92,3 +92,16 @@
|
|||
parent: [ StatusEffectWoozy, StatusEffectSlurred ]
|
||||
id: StatusEffectDrunk
|
||||
name: drunk
|
||||
|
||||
# Prevents the target from seeing
|
||||
- type: entity
|
||||
parent: MobStatusEffectDebuff
|
||||
id: StatusEffectBlindness
|
||||
name: temporary blindness
|
||||
components:
|
||||
- type: StatusEffect
|
||||
whitelist:
|
||||
components:
|
||||
- MobState
|
||||
- Blindable
|
||||
- type: BlindnessStatusEffect
|
||||
|
|
|
|||
|
|
@ -388,9 +388,9 @@
|
|||
min: 20
|
||||
probability: 0.03
|
||||
#If anyone wants to add a light dimming or grayscale effect when under 20u, be my guest
|
||||
- !type:GenericStatusEffect
|
||||
key: TemporaryBlindness
|
||||
component: TemporaryBlindness
|
||||
- !type:ModifyStatusEffect
|
||||
effectProto: StatusEffectBlindness
|
||||
type: Add
|
||||
conditions:
|
||||
- !type:ReagentCondition
|
||||
reagent: NorepinephricAcid
|
||||
|
|
@ -441,9 +441,9 @@
|
|||
- !type:Emote
|
||||
emote: Cough
|
||||
probability: 0.08
|
||||
- !type:GenericStatusEffect
|
||||
key: TemporaryBlindness
|
||||
component: TemporaryBlindness
|
||||
- !type:ModifyStatusEffect
|
||||
effectProto: StatusEffectBlindness
|
||||
type: Add
|
||||
conditions:
|
||||
- !type:ReagentCondition
|
||||
reagent: TearGas
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@
|
|||
id: Corporeal
|
||||
alert: Corporeal
|
||||
|
||||
- type: statusEffect
|
||||
id: TemporaryBlindness
|
||||
|
||||
- type: statusEffect
|
||||
id: Pacified #cannot attack
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue