Skip to content

Commit

Permalink
Merged with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Truoizys committed Aug 15, 2024
2 parents 365a5a3 + 84f9dd0 commit 604d127
Show file tree
Hide file tree
Showing 37 changed files with 574 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void SetWhitelisted(bool? whitelisted)
else
{
Whitelisted.Text = Loc.GetString("player-panel-whitelisted");
WhitelistToggle.Text = whitelisted.Value.ToString();
WhitelistToggle.Text = whitelisted.Value ? Loc.GetString("player-panel-true") : Loc.GetString("player-panel-false");
WhitelistToggle.Visible = true;
_isWhitelisted = whitelisted.Value;
}
Expand Down
10 changes: 10 additions & 0 deletions Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace Content.Client.Atmos.UI
[GenerateTypedNameReferences]
public sealed partial class GasAnalyzerWindow : DefaultWindow
{
private NetEntity _currentEntity = NetEntity.Invalid;

public GasAnalyzerWindow()
{
RobustXamlLoader.Load(this);
Expand Down Expand Up @@ -55,6 +57,13 @@ public void Populate(GasAnalyzerUserMessage msg)
// Device Tab
if (msg.NodeGasMixes.Length > 1)
{
if (_currentEntity != msg.DeviceUid)
{
// when we get new device data switch to the device tab
CTabContainer.CurrentTab = 0;
_currentEntity = msg.DeviceUid;
}

CTabContainer.SetTabVisible(0, true);
CTabContainer.SetTabTitle(0, Loc.GetString("gas-analyzer-window-tab-title-capitalized", ("title", msg.DeviceName)));
// Set up Grid
Expand Down Expand Up @@ -143,6 +152,7 @@ public void Populate(GasAnalyzerUserMessage msg)
CTabContainer.SetTabVisible(0, false);
CTabContainer.CurrentTab = 1;
minSize = new Vector2(CEnvironmentMix.DesiredSize.X + 40, MinSize.Y);
_currentEntity = NetEntity.Invalid;
}

MinSize = minSize;
Expand Down
411 changes: 201 additions & 210 deletions Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions Content.Server/Explosion/Components/ShockOnTriggerComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Content.Server.Explosion.EntitySystems;

namespace Content.Server.Explosion.Components;

/// <summary>
/// A component that electrocutes an entity having this component when a trigger is triggered.
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
[Access(typeof(TriggerSystem))]
public sealed partial class ShockOnTriggerComponent : Component
{
/// <summary>
/// The force of an electric shock when the trigger is triggered.
/// </summary>
[DataField]
public int Damage = 5;

/// <summary>
/// Duration of electric shock when the trigger is triggered.
/// </summary>
[DataField]
public TimeSpan Duration = TimeSpan.FromSeconds(2);

/// <summary>
/// The minimum delay between repeating triggers.
/// </summary>
[DataField]
public TimeSpan Cooldown = TimeSpan.FromSeconds(4);

/// <summary>
/// When can the trigger run again?
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextTrigger = TimeSpan.Zero;
}
22 changes: 22 additions & 0 deletions Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Explosion.Components;
using Content.Server.Flash;
using Content.Server.Electrocution;
using Content.Server.Pinpointer;
using Content.Shared.Flash.Components;
using Content.Server.Radio.EntitySystems;
Expand Down Expand Up @@ -33,6 +34,7 @@
using Robust.Shared.Player;
using Content.Shared.Coordinates;
using Robust.Shared.Utility;
using Robust.Shared.Timing;

namespace Content.Server.Explosion.EntitySystems
{
Expand Down Expand Up @@ -75,6 +77,7 @@ public sealed partial class TriggerSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly ElectrocutionSystem _electrocution = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -104,6 +107,7 @@ public override void Initialize()

SubscribeLocalEvent<AnchorOnTriggerComponent, TriggerEvent>(OnAnchorTrigger);
SubscribeLocalEvent<SoundOnTriggerComponent, TriggerEvent>(OnSoundTrigger);
SubscribeLocalEvent<ShockOnTriggerComponent, TriggerEvent>(HandleShockTrigger);
SubscribeLocalEvent<RattleComponent, TriggerEvent>(HandleRattleTrigger);
}

Expand All @@ -120,6 +124,24 @@ private void OnSoundTrigger(EntityUid uid, SoundOnTriggerComponent component, Tr
}
}

private void HandleShockTrigger(Entity<ShockOnTriggerComponent> shockOnTrigger, ref TriggerEvent args)
{
if (!_container.TryGetContainingContainer(shockOnTrigger, out var container))
return;

var containerEnt = container.Owner;
var curTime = _timing.CurTime;

if (curTime < shockOnTrigger.Comp.NextTrigger)
{
// The trigger's on cooldown.
return;
}

_electrocution.TryDoElectrocution(containerEnt, null, shockOnTrigger.Comp.Damage, shockOnTrigger.Comp.Duration, true);
shockOnTrigger.Comp.NextTrigger = curTime + shockOnTrigger.Comp.Cooldown;
}

private void OnAnchorTrigger(EntityUid uid, AnchorOnTriggerComponent component, TriggerEvent args)
{
var xform = Transform(uid);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Components;
using Content.Server.Popups;
using Content.Server.Power.Components;
Expand Down
8 changes: 4 additions & 4 deletions Content.Server/Strip/StrippableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void StartStripInsertInventory(
return;
}

var (time, stealth) = GetStripTimeModifiers(user, target, slotDef.StripTime);
var (time, stealth) = GetStripTimeModifiers(user, target, held, slotDef.StripTime);

if (!stealth)
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", Identity.Entity(user, EntityManager)), ("item", user.Comp.ActiveHandEntity!.Value)), target, target, PopupType.Large);
Expand Down Expand Up @@ -306,7 +306,7 @@ private void StartStripRemoveInventory(
return;
}

var (time, stealth) = GetStripTimeModifiers(user, target, slotDef.StripTime);
var (time, stealth) = GetStripTimeModifiers(user, target, item, slotDef.StripTime);

if (!stealth)
{
Expand Down Expand Up @@ -411,7 +411,7 @@ private void StartStripInsertHand(
if (!CanStripInsertHand(user, target, held, handName))
return;

var (time, stealth) = GetStripTimeModifiers(user, target, targetStrippable.HandStripDelay);
var (time, stealth) = GetStripTimeModifiers(user, target, null, targetStrippable.HandStripDelay);

if (!stealth)
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert-hand", ("user", Identity.Entity(user, EntityManager)), ("item", user.Comp.ActiveHandEntity!.Value)), target, target, PopupType.Large);
Expand Down Expand Up @@ -510,7 +510,7 @@ private void StartStripRemoveHand(
if (!CanStripRemoveHand(user, target, item, handName))
return;

var (time, stealth) = GetStripTimeModifiers(user, target, targetStrippable.HandStripDelay);
var (time, stealth) = GetStripTimeModifiers(user, target, null, targetStrippable.HandStripDelay);

if (!stealth)
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", Identity.Entity(user, EntityManager)), ("item", item)), target, target);
Expand Down
3 changes: 0 additions & 3 deletions Content.Shared/Atmos/Components/GasAnalyzerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public sealed partial class GasAnalyzerComponent : Component
[ViewVariables]
public EntityUid User;

[ViewVariables(VVAccess.ReadWrite)]
public EntityCoordinates? LastPosition;

[DataField("enabled"), ViewVariables(VVAccess.ReadWrite)]
public bool Enabled;

Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/Clothing/Components/ClothingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ public sealed partial class ClothingComponent : Component

[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan UnequipDelay = TimeSpan.Zero;

/// <summary>
/// Offset for the strip time for an entity with this component.
/// Only applied when it is being equipped or removed by another player.
/// </summary>
[DataField]
public TimeSpan StripDelay = TimeSpan.Zero;
}

[Serializable, NetSerializable]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Content.Shared.Clothing.EntitySystems;
using Robust.Shared.GameStates;

namespace Content.Shared.Clothing.Components;

/// <summary>
/// The component prohibits the player from taking off clothes on them that have this component.
/// </summary>
/// <remarks>
/// See also ClothingComponent.EquipDelay if you want the clothes that the player cannot take off by himself to be put on by the player with a delay.
///</remarks>
[NetworkedComponent]
[RegisterComponent]
[Access(typeof(SelfUnremovableClothingSystem))]
public sealed partial class SelfUnremovableClothingComponent : Component
{

}
8 changes: 8 additions & 0 deletions Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Shared.Strip.Components;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;

Expand All @@ -32,6 +33,8 @@ public override void Initialize()

SubscribeLocalEvent<ClothingComponent, ClothingEquipDoAfterEvent>(OnEquipDoAfter);
SubscribeLocalEvent<ClothingComponent, ClothingUnequipDoAfterEvent>(OnUnequipDoAfter);

SubscribeLocalEvent<ClothingComponent, BeforeItemStrippedEvent>(OnItemStripped);
}

private void OnUseInHand(Entity<ClothingComponent> ent, ref UseInHandEvent args)
Expand Down Expand Up @@ -192,6 +195,11 @@ private void OnUnequipDoAfter(Entity<ClothingComponent> ent, ref ClothingUnequip
_handsSystem.TryPickup(args.User, ent);
}

private void OnItemStripped(Entity<ClothingComponent> ent, ref BeforeItemStrippedEvent args)
{
args.Additive += ent.Comp.StripDelay;
}

private void CheckEquipmentForLayerHide(EntityUid equipment, EntityUid equipee)
{
if (TryComp(equipment, out HideLayerClothingComponent? clothesComp) && TryComp(equipee, out HumanoidAppearanceComponent? appearanceComp))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Content.Shared.Clothing.Components;
using Content.Shared.Examine;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;

namespace Content.Shared.Clothing.EntitySystems;

/// <summary>
/// A system for the operation of a component that prohibits the player from taking off his own clothes that have this component.
/// </summary>
public sealed class SelfUnremovableClothingSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SelfUnremovableClothingComponent, BeingUnequippedAttemptEvent>(OnUnequip);
SubscribeLocalEvent<SelfUnremovableClothingComponent, ExaminedEvent>(OnUnequipMarkup);
}

private void OnUnequip(Entity<SelfUnremovableClothingComponent> selfUnremovableClothing, ref BeingUnequippedAttemptEvent args)
{
if (TryComp<ClothingComponent>(selfUnremovableClothing, out var clothing) && (clothing.Slots & args.SlotFlags) == SlotFlags.NONE)
return;

if (args.UnEquipTarget == args.Unequipee)
{
args.Cancel();
}
}

private void OnUnequipMarkup(Entity<SelfUnremovableClothingComponent> selfUnremovableClothing, ref ExaminedEvent args)
{
args.PushMarkup(Loc.GetString("comp-self-unremovable-clothing"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void StartDoAfter(EntityUid user, EntityUid item, EntityUid wearer, Togg
if (component.StripDelay == null)
return;

var (time, stealth) = _strippable.GetStripTimeModifiers(user, wearer, component.StripDelay.Value);
var (time, stealth) = _strippable.GetStripTimeModifiers(user, wearer, item, component.StripDelay.Value);

var args = new DoAfterArgs(EntityManager, user, time, new ToggleClothingDoAfterEvent(), item, wearer, item)
{
Expand Down
9 changes: 9 additions & 0 deletions Content.Shared/Strip/Components/StrippableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public abstract class BaseBeforeStripEvent(TimeSpan initialTime, bool stealth =
public SlotFlags TargetSlots { get; } = SlotFlags.GLOVES;
}

/// <summary>
/// Used to modify strip times. Raised directed at the item being stripped.
/// </summary>
/// <remarks>
/// This is also used by some stripping related interactions, i.e., interactions with items that are currently equipped by another player.
/// </remarks>
[ByRefEvent]
public sealed class BeforeItemStrippedEvent(TimeSpan initialTime, bool stealth = false) : BaseBeforeStripEvent(initialTime, stealth);

/// <summary>
/// Used to modify strip times. Raised directed at the user.
/// </summary>
Expand Down
16 changes: 11 additions & 5 deletions Content.Shared/Strip/SharedStrippableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ private void OnActivateInWorld(EntityUid uid, StrippableComponent component, Act
args.Handled = true;
}

public (TimeSpan Time, bool Stealth) GetStripTimeModifiers(EntityUid user, EntityUid target, TimeSpan initialTime)
/// <summary>
/// Modify the strip time via events. Raised directed at the item being stripped, the player stripping someone and the player being stripped.
/// </summary>
public (TimeSpan Time, bool Stealth) GetStripTimeModifiers(EntityUid user, EntityUid targetPlayer, EntityUid? targetItem, TimeSpan initialTime)
{
var userEv = new BeforeStripEvent(initialTime);
var itemEv = new BeforeItemStrippedEvent(initialTime, false);
if (targetItem != null)
RaiseLocalEvent(targetItem.Value, ref itemEv);
var userEv = new BeforeStripEvent(itemEv.Time, itemEv.Stealth);
RaiseLocalEvent(user, ref userEv);
var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
RaiseLocalEvent(target, ref ev);
return (ev.Time, ev.Stealth);
var targetEv = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
RaiseLocalEvent(targetPlayer, ref targetEv);
return (targetEv.Time, targetEv.Stealth);
}

private void OnDragDrop(EntityUid uid, StrippableComponent component, ref DragDropDraggedEvent args)
Expand Down
47 changes: 33 additions & 14 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
Entries:
- author: ElectroJr
changes:
- message: Ghosts can once again open paper & other UIs
type: Fix
id: 6614
time: '2024-05-24T05:03:03.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/27999
- author: nikthechampiongr
changes:
- message: Firelocks will no longer randomly pulse closing lights.
type: Fix
id: 6615
time: '2024-05-24T14:44:42.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/28227
- author: ElectroJr
changes:
- message: Fixed modular grenade visuals getting stuck in an incorrect state.
Expand Down Expand Up @@ -3811,3 +3797,36 @@
id: 7113
time: '2024-08-15T12:34:41.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/30865
- author: to4no_fix
changes:
- message: Added a new electropack that shocks when a trigger is triggered
type: Add
- message: Added a new shock collar that shocks when a trigger is triggered
type: Add
- message: Two shock collars and two remote signallers added to the warden's locker
type: Add
- message: Shock collar added as a new target for the thief
type: Add
- message: A new Special Means technology has been added to the Arsenal research
branch at the 1st research level. Its research opens up the possibility of producing
electropacks at security techfab. The cost of technology research is 5000
type: Add
id: 7114
time: '2024-08-15T14:30:39.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/30529
- author: Mervill
changes:
- message: The Gas Analyzer won't spuriously shut down for seemly no reason.
type: Tweak
- message: The Gas Analyzer will always switch to the device tab when a new object
is scanned.
type: Tweak
- message: The Gas Analyzer's interaction range is now equal to the standard interaction
range
type: Fix
- message: Clicking the Gas Analyzer when it's in your hand has proper enable/disable
behavior.
type: Fix
id: 7115
time: '2024-08-15T14:45:13.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/30763
1 change: 1 addition & 0 deletions Resources/Locale/en-US/administration/ui/player-panel.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ player-panel-logs = Logs
player-panel-delete = Delete
player-panel-rejuvenate = Rejuvenate
player-panel-false = False
player-panel-true = True
Loading

0 comments on commit 604d127

Please sign in to comment.