mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> Ports https://github.com/space-wizards/space-station-14/pull/32294 Ports https://github.com/ss14-harmony/ss14-harmony/pull/310 (and everything needed for it to function) Early-merges https://github.com/space-wizards/space-station-14/pull/34302 Adds the ability for multiple central command maps that get randomly selected. Tested and works. --- # Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 Several contributors - add: Added a new central command map that is randomly picked alongside the old one (thank you to Spanky from Harmony) - add: Added Advanced SMES for mappers. - add: Added the atmospheric network monitor for seeing what the temperature, moles, and pressure is on every pipe everywhere through a computer. - add: Nukie med bundle now contains a compact defibrillator. - add: Ported a better mapping editor. - add: Added the throngler plushie. - remove: Removed the Throngler as a possible loot spawn for gamble crates. --------- Signed-off-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com> (cherry picked from commit 9272f65b64392f66a7cd4fd7c84bb152dc93b65a)
82 lines
3.1 KiB
C#
82 lines
3.1 KiB
C#
using Content.Server.Administration.Logs;
|
|
using Content.Server.Electrocution;
|
|
using Content.Server.Power.Components;
|
|
using Content.Server.Stack;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.DoAfter;
|
|
using Content.Shared.Interaction;
|
|
using Robust.Shared.Map;
|
|
using CableCuttingFinishedEvent = Content.Shared.Tools.Systems.CableCuttingFinishedEvent;
|
|
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
|
|
|
|
namespace Content.Server.Power.EntitySystems;
|
|
|
|
public sealed partial class CableSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ITileDefinitionManager _tileManager = default!;
|
|
[Dependency] private readonly SharedToolSystem _toolSystem = default!;
|
|
[Dependency] private readonly StackSystem _stack = default!;
|
|
[Dependency] private readonly ElectrocutionSystem _electrocutionSystem = default!;
|
|
[Dependency] private readonly IAdminLogManager _adminLogs = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
InitializeCablePlacer();
|
|
|
|
SubscribeLocalEvent<CableComponent, InteractUsingEvent>(OnInteractUsing);
|
|
SubscribeLocalEvent<CableComponent, CableCuttingFinishedEvent>(OnCableCut);
|
|
// Shouldn't need re-anchoring.
|
|
SubscribeLocalEvent<CableComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
|
}
|
|
|
|
private void OnInteractUsing(EntityUid uid, CableComponent cable, InteractUsingEvent args)
|
|
{
|
|
if (args.Handled)
|
|
return;
|
|
|
|
if (cable.CuttingQuality != null)
|
|
{
|
|
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, cable.CuttingDelay, cable.CuttingQuality, new CableCuttingFinishedEvent());
|
|
}
|
|
}
|
|
|
|
private void OnCableCut(EntityUid uid, CableComponent cable, DoAfterEvent args)
|
|
{
|
|
if (args.Cancelled)
|
|
return;
|
|
|
|
var xform = Transform(uid);
|
|
var ev = new CableAnchorStateChangedEvent(xform);
|
|
RaiseLocalEvent(uid, ref ev);
|
|
|
|
if (_electrocutionSystem.TryDoElectrifiedAct(uid, args.User))
|
|
return;
|
|
|
|
_adminLogs.Add(LogType.CableCut, LogImpact.Medium, $"The {ToPrettyString(uid)} at {xform.Coordinates} was cut by {ToPrettyString(args.User)}.");
|
|
|
|
Spawn(cable.CableDroppedOnCutPrototype, xform.Coordinates);
|
|
QueueDel(uid);
|
|
}
|
|
|
|
private void OnAnchorChanged(EntityUid uid, CableComponent cable, ref AnchorStateChangedEvent args)
|
|
{
|
|
var ev = new CableAnchorStateChangedEvent(args.Transform, args.Detaching);
|
|
RaiseLocalEvent(uid, ref ev);
|
|
|
|
if (args.Anchored)
|
|
return; // huh? it wasn't anchored?
|
|
|
|
// anchor state can change as a result of deletion (detach to null).
|
|
// We don't want to spawn an entity when deleted.
|
|
if (!TryLifeStage(uid, out var life) || life >= EntityLifeStage.Terminating)
|
|
return;
|
|
|
|
// This entity should not be un-anchorable. But this can happen if the grid-tile is deleted (RCD, explosion,
|
|
// etc). In that case: behave as if the cable had been cut.
|
|
Spawn(cable.CableDroppedOnCutPrototype, Transform(uid).Coordinates);
|
|
QueueDel(uid);
|
|
}
|
|
}
|