Merge remote-tracking branch 'upstream/master' into ups

This commit is contained in:
Jabak
2024-07-20 18:45:46 +03:00
186 changed files with 1524 additions and 331 deletions

View File

@@ -10,4 +10,5 @@ public sealed partial class FlashOnTriggerComponent : Component
[DataField] public float Range = 1.0f;
[DataField] public float Duration = 8.0f;
[DataField] public float Probability = 1.0f;
[DataField] public bool ForceStun; // WD
}

View File

@@ -1,3 +1,4 @@
using Content.Shared._White.BuffedFlashGrenade;
using Content.Shared._White.Events;
using Content.Shared._White.StaminaProtection;
using Content.Shared.Changeling;
@@ -34,6 +35,7 @@ public partial class InventorySystem
SubscribeLocalEvent<InventoryComponent, ChemRegenModifyEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, ChangelingRefundEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, EnergyDomeClothesTurnOffEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, GetFlashbangedEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, GetDefaultRadioChannelEvent>(RelayInventoryEvent);
// by-ref events

View File

@@ -134,7 +134,7 @@ public sealed class PryingSystem : EntitySystem
RaiseLocalEvent(target, ref modEv);
var time = TimeSpan.FromSeconds(!TryComp<AirlockComponent>(target, out var airlock) || !airlock.Powered ? 0 : modEv.BaseTime * modEv.PryTimeModifier * toolModifier); // WD EDIT
var time = TimeSpan.FromSeconds(modEv.BaseTime * modEv.PryTimeModifier * (toolModifier - (!TryComp<AirlockComponent>(target, out var airlock) || !airlock.Powered ? 1 : 0))); // WD EDIT
var doAfterArgs = new DoAfterArgs(EntityManager, user, time, new DoorPryDoAfterEvent(), target, target, tool)
{

View File

@@ -48,7 +48,11 @@ public abstract class SharedNightVisionSystem : EntitySystem
return;
component.IsActive = !component.IsActive;
_audio.PlayPredicted(component.ToggleSound, uid, uid);
if (component.IsActive && component.ActivateSound != null)
_audio.PlayPredicted(component.ActivateSound, uid, uid);
else if (component.DeactivateSound != null)
_audio.PlayPredicted(component.DeactivateSound, uid, uid);
args.Handled = true;

View File

@@ -0,0 +1,64 @@
using Content.Shared._White.Overlays;
using Content.Shared.Actions;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Timing;
namespace Content.Shared._Miracle.Systems;
public abstract class SharedThermalVisionSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ThermalVisionComponent, ToggleThermalVisionEvent>(OnToggle);
SubscribeLocalEvent<ThermalVisionComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<ThermalVisionComponent, ComponentRemove>(OnRemove);
}
private void OnRemove(EntityUid uid, ThermalVisionComponent component, ComponentRemove args)
{
_actions.RemoveAction(uid, component.ToggleActionEntity);
if (HasComp<TemporaryThermalVisionComponent>(uid))
return;
UpdateThermalVision(uid, false);
}
private void OnInit(EntityUid uid, ThermalVisionComponent component, ComponentInit args)
{
_actions.AddAction(uid, ref component.ToggleActionEntity, component.ToggleAction);
if (!component.IsActive && HasComp<TemporaryThermalVisionComponent>(uid))
return;
UpdateThermalVision(uid, component.IsActive);
}
protected virtual void UpdateThermalVision(EntityUid uid, bool active) { }
private void OnToggle(EntityUid uid, ThermalVisionComponent component, ToggleThermalVisionEvent args)
{
if (!_timing.IsFirstTimePredicted)
return;
component.IsActive = !component.IsActive;
if (component.IsActive && component.ActivateSound != null)
_audio.PlayPredicted(component.ActivateSound, uid, uid);
else if (component.DeactivateSound != null)
_audio.PlayPredicted(component.DeactivateSound, uid, uid);
args.Handled = true;
if (!component.IsActive && HasComp<TemporaryThermalVisionComponent>(uid))
return;
UpdateThermalVision(uid, component.IsActive);
}
}

View File

@@ -0,0 +1,9 @@
using Robust.Shared.GameStates;
namespace Content.Shared._White.BuffedFlashGrenade;
[RegisterComponent, NetworkedComponent]
public sealed partial class FlashSoundSuppressionComponent : Component
{
}

View File

@@ -0,0 +1,43 @@
using Content.Shared.Inventory;
using Content.Shared.Stunnable;
namespace Content.Shared._White.BuffedFlashGrenade;
public sealed class FlashSoundSuppressionSystem : EntitySystem
{
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FlashSoundSuppressionComponent, InventoryRelayedEvent<GetFlashbangedEvent>>(
OnGetFlashbanged);
}
private void OnGetFlashbanged(Entity<FlashSoundSuppressionComponent> ent,
ref InventoryRelayedEvent<GetFlashbangedEvent> args)
{
args.Args.Protected = true;
}
public void Stun(EntityUid target, float duration)
{
if (HasComp<FlashSoundSuppressionComponent>(target))
return;
var ev = new GetFlashbangedEvent();
RaiseLocalEvent(target, ev);
if (ev.Protected)
return;
_stunSystem.TryParalyze(target, TimeSpan.FromSeconds(duration / 1000f), true);
}
}
public sealed class GetFlashbangedEvent : EntityEventArgs, IInventoryRelayEvent
{
public bool Protected;
public SlotFlags TargetSlots => SlotFlags.EARS | SlotFlags.HEAD;
}

View File

@@ -28,9 +28,11 @@ public sealed class ClothingGrantingSystem : EntitySystem
if (_timing.ApplyingState)
return;
if (!TryComp<ClothingComponent>(uid, out var clothing)) return;
if (!TryComp<ClothingComponent>(uid, out var clothing))
return;
if (!clothing.Slots.HasFlag(args.SlotFlags)) return;
if (!clothing.Slots.HasFlag(args.SlotFlags))
return;
if (component.Components.Count > 8)
{
@@ -53,7 +55,7 @@ public sealed class ClothingGrantingSystem : EntitySystem
}
component.IsActive = true;
Dirty(component);
Dirty(uid, component);
}
private void OnCompUnequip(EntityUid uid, ClothingGrantComponentComponent component, GotUnequippedEvent args)
@@ -68,7 +70,7 @@ public sealed class ClothingGrantingSystem : EntitySystem
}
component.IsActive = false;
Dirty(component);
Dirty(uid, component);
}
private void OnTagEquip(EntityUid uid, ClothingGrantTagComponent component, GotEquippedEvent args)
@@ -81,7 +83,7 @@ public sealed class ClothingGrantingSystem : EntitySystem
_tagSystem.AddTag(args.Equipee, component.Tag);
component.IsActive = true;
Dirty(component);
Dirty(uid, component);
}
private void OnTagUnequip(EntityUid uid, ClothingGrantTagComponent component, GotUnequippedEvent args)
@@ -91,6 +93,6 @@ public sealed class ClothingGrantingSystem : EntitySystem
_tagSystem.RemoveTag(args.Equipee, component.Tag);
component.IsActive = false;
Dirty(component);
Dirty(uid, component);
}
}

View File

@@ -0,0 +1,12 @@
using Robust.Shared.GameStates;
namespace Content.Shared._White.Nuke;
/// <summary>
/// Used for tracking the nuke bomb - isn't a tag for pinpointer purposes.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class NuclearBombSyndicateComponent : Component
{
}

View File

@@ -0,0 +1,19 @@
using Robust.Shared.GameStates;
namespace Content.Shared._White.Overlays;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public abstract partial class BaseNvOverlayComponent : Component
{
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public virtual Vector3 Tint { get; set; } = new(0.3f, 0.3f, 0.3f);
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public virtual float Strength { get; set; } = 2f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public virtual float Noise { get; set; } = 0.5f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public virtual Color Color { get; set; } = Color.FromHex("#98FB98");
}

View File

@@ -6,25 +6,19 @@ using Robust.Shared.Prototypes;
namespace Content.Shared._White.Overlays;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class NightVisionComponent : Component
public sealed partial class NightVisionComponent : BaseNvOverlayComponent
{
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public Vector3 Tint = new(0.3f, 0.3f, 0.3f);
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public float Strength = 2f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public float Noise = 0.5f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public Color Color = Color.FromHex("#98FB98");
public override Color Color { get; set; } = Color.FromHex("#98FB98");
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public bool IsActive = true;
[DataField]
public SoundSpecifier? ToggleSound = new SoundPathSpecifier("/Audio/Items/flashlight_pda.ogg");
public SoundSpecifier? ActivateSound = new SoundPathSpecifier("/Audio/White/Items/Goggles/activate.ogg");
[DataField]
public SoundSpecifier? DeactivateSound = new SoundPathSpecifier("/Audio/White/Items/Goggles/deactivate.ogg");
[DataField]
public EntProtoId? ToggleAction = "ToggleNightVision";

View File

@@ -3,17 +3,8 @@ using Robust.Shared.GameStates;
namespace Content.Shared._White.Overlays;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TemporaryNightVisionComponent : Component
public sealed partial class TemporaryNightVisionComponent : BaseNvOverlayComponent
{
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public Vector3 Tint = new(0.3f, 0.3f, 0.3f);
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public float Strength = 2f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public float Noise = 0.5f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public Color Color = Color.FromHex("#FB9898");
public override Color Color { get; set; } = Color.FromHex("#FB9898");
}

View File

@@ -0,0 +1,10 @@
using Robust.Shared.GameStates;
namespace Content.Shared._White.Overlays;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TemporaryThermalVisionComponent : BaseNvOverlayComponent
{
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public override Color Color { get; set; } = Color.FromHex("#FB9898");
}

View File

@@ -0,0 +1,32 @@
using Content.Shared.Actions;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared._White.Overlays;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ThermalVisionComponent : BaseNvOverlayComponent
{
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public override Color Color { get; set; } = Color.FromHex("#F84742");
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public bool IsActive = true;
[DataField]
public SoundSpecifier? ActivateSound = new SoundPathSpecifier("/Audio/White/Items/Goggles/activate.ogg");
[DataField]
public SoundSpecifier? DeactivateSound = new SoundPathSpecifier("/Audio/White/Items/Goggles/deactivate.ogg");
[DataField]
public EntProtoId? ToggleAction = "ToggleThermalVision";
[ViewVariables]
public EntityUid? ToggleActionEntity;
}
public sealed partial class ToggleThermalVisionEvent : InstantActionEvent
{
}

View File

@@ -0,0 +1,13 @@
using Robust.Shared.GameStates;
namespace Content.Shared._White.Pinpointer;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class MultiplePinpointerComponent : Component
{
[DataField(required: true)]
public string[] Modes = Array.Empty<string>();
[ViewVariables, AutoNetworkedField]
public uint CurrentEntry = 0;
}