Merge remote-tracking branch 'refs/remotes/upstream/master' into ed-13-05-2024-upstream
# Conflicts: # Content.Shared/Lock/LockSystem.cs # Resources/Prototypes/Maps/oasis.yml
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
using Content.Server.Access.Systems;
|
||||
|
||||
namespace Content.Server.Access.Components;
|
||||
|
||||
[RegisterComponent, Access(typeof(IdExaminableSystem))]
|
||||
public sealed partial class IdExaminableComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -28,7 +28,6 @@ public sealed class AccessOverriderSystem : SharedAccessOverriderSystem
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
using Content.Server.Access.Components;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Access.Systems;
|
||||
|
||||
public sealed class IdExaminableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<IdExaminableComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
|
||||
}
|
||||
|
||||
private void OnGetExamineVerbs(EntityUid uid, IdExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
|
||||
{
|
||||
var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);
|
||||
var info = GetInfo(uid) ?? Loc.GetString("id-examinable-component-verb-no-id");
|
||||
|
||||
var verb = new ExamineVerb()
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
var markup = FormattedMessage.FromMarkup(info);
|
||||
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
|
||||
},
|
||||
Text = Loc.GetString("id-examinable-component-verb-text"),
|
||||
Category = VerbCategory.Examine,
|
||||
Disabled = !detailsRange,
|
||||
Message = detailsRange ? null : Loc.GetString("id-examinable-component-verb-disabled"),
|
||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/character.svg.192dpi.png"))
|
||||
};
|
||||
|
||||
args.Verbs.Add(verb);
|
||||
}
|
||||
|
||||
private string? GetInfo(EntityUid uid)
|
||||
{
|
||||
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid))
|
||||
{
|
||||
// PDA
|
||||
if (EntityManager.TryGetComponent(idUid, out PdaComponent? pda) &&
|
||||
TryComp<IdCardComponent>(pda.ContainedId, out var id))
|
||||
{
|
||||
return GetNameAndJob(id);
|
||||
}
|
||||
// ID Card
|
||||
if (EntityManager.TryGetComponent(idUid, out id))
|
||||
{
|
||||
return GetNameAndJob(id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetNameAndJob(IdCardComponent id)
|
||||
{
|
||||
var jobSuffix = string.IsNullOrWhiteSpace(id.JobTitle) ? string.Empty : $" ({id.JobTitle})";
|
||||
|
||||
var val = string.IsNullOrWhiteSpace(id.FullName)
|
||||
? Loc.GetString("access-id-card-component-owner-name-job-title-text",
|
||||
("jobSuffix", jobSuffix))
|
||||
: Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
|
||||
("fullName", id.FullName),
|
||||
("jobSuffix", jobSuffix));
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Random;
|
||||
@@ -38,16 +39,27 @@ public sealed class ActionOnInteractSystem : EntitySystem
|
||||
|
||||
private void OnActivate(EntityUid uid, ActionOnInteractComponent component, ActivateInWorldEvent args)
|
||||
{
|
||||
if (args.Handled || component.ActionEntities == null)
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
var options = GetValidActions<InstantActionComponent>(component.ActionEntities);
|
||||
if (component.ActionEntities is not {} actionEnts)
|
||||
{
|
||||
if (!TryComp<ActionsContainerComponent>(uid, out var actionsContainerComponent))
|
||||
return;
|
||||
|
||||
actionEnts = actionsContainerComponent.Container.ContainedEntities.ToList();
|
||||
}
|
||||
|
||||
var options = GetValidActions<InstantActionComponent>(actionEnts);
|
||||
if (options.Count == 0)
|
||||
return;
|
||||
|
||||
var (actId, act) = _random.Pick(options);
|
||||
if (act.Event != null)
|
||||
{
|
||||
act.Event.Performer = args.User;
|
||||
act.Event.Action = actId;
|
||||
}
|
||||
|
||||
_actions.PerformAction(args.User, null, actId, act, act.Event, _timing.CurTime, false);
|
||||
args.Handled = true;
|
||||
@@ -55,13 +67,21 @@ public sealed class ActionOnInteractSystem : EntitySystem
|
||||
|
||||
private void OnAfterInteract(EntityUid uid, ActionOnInteractComponent component, AfterInteractEvent args)
|
||||
{
|
||||
if (args.Handled || component.ActionEntities == null)
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (component.ActionEntities is not {} actionEnts)
|
||||
{
|
||||
if (!TryComp<ActionsContainerComponent>(uid, out var actionsContainerComponent))
|
||||
return;
|
||||
|
||||
actionEnts = actionsContainerComponent.Container.ContainedEntities.ToList();
|
||||
}
|
||||
|
||||
// First, try entity target actions
|
||||
if (args.Target != null)
|
||||
{
|
||||
var entOptions = GetValidActions<EntityTargetActionComponent>(component.ActionEntities, args.CanReach);
|
||||
var entOptions = GetValidActions<EntityTargetActionComponent>(actionEnts, args.CanReach);
|
||||
for (var i = entOptions.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var action = entOptions[i];
|
||||
@@ -75,6 +95,7 @@ public sealed class ActionOnInteractSystem : EntitySystem
|
||||
if (entAct.Event != null)
|
||||
{
|
||||
entAct.Event.Performer = args.User;
|
||||
entAct.Event.Action = entActId;
|
||||
entAct.Event.Target = args.Target.Value;
|
||||
}
|
||||
|
||||
@@ -100,6 +121,7 @@ public sealed class ActionOnInteractSystem : EntitySystem
|
||||
if (act.Event != null)
|
||||
{
|
||||
act.Event.Performer = args.User;
|
||||
act.Event.Action = actId;
|
||||
act.Event.Target = args.ClickLocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
sealed class DSay : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "dsay";
|
||||
|
||||
public string Description => Loc.GetString("dsay-command-description");
|
||||
@@ -32,7 +34,7 @@ namespace Content.Server.Administration.Commands
|
||||
if (string.IsNullOrEmpty(message))
|
||||
return;
|
||||
|
||||
var chat = EntitySystem.Get<ChatSystem>();
|
||||
var chat = _e.System<ChatSystem>();
|
||||
chat.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
@@ -105,7 +106,7 @@ public sealed class ExplosionCommand : IConsoleCommand
|
||||
if (args.Length > 4)
|
||||
coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
|
||||
else
|
||||
coords = xform.MapPosition;
|
||||
coords = entMan.System<TransformSystem>().GetMapCoordinates(shell.Player.AttachedEntity.Value, xform: xform);
|
||||
}
|
||||
|
||||
ExplosionPrototype? type;
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
public sealed class ReadyAll : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "readyall";
|
||||
public string Description => "Readies up all players in the lobby, except for observers.";
|
||||
public string Help => $"{Command} | ̣{Command} <ready>";
|
||||
@@ -20,7 +22,7 @@ namespace Content.Server.Administration.Commands
|
||||
ready = bool.Parse(args[0]);
|
||||
}
|
||||
|
||||
var gameTicker = EntitySystem.Get<GameTicker>();
|
||||
var gameTicker = _e.System<GameTicker>();
|
||||
|
||||
|
||||
if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
public sealed class CallShuttleCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "callshuttle";
|
||||
public string Description => Loc.GetString("call-shuttle-command-description");
|
||||
public string Help => Loc.GetString("call-shuttle-command-help-text", ("command",Command));
|
||||
@@ -19,7 +21,7 @@ namespace Content.Server.Administration.Commands
|
||||
// ReSharper disable once ConvertIfStatementToSwitchStatement
|
||||
if (args.Length == 1 && TimeSpan.TryParseExact(args[0], ContentLocalizationManager.TimeSpanMinutesFormats, loc.DefaultCulture, out var timeSpan))
|
||||
{
|
||||
EntitySystem.Get<RoundEndSystem>().RequestRoundEnd(timeSpan, shell.Player?.AttachedEntity, false);
|
||||
_e.System<RoundEndSystem>().RequestRoundEnd(timeSpan, shell.Player?.AttachedEntity, false);
|
||||
}
|
||||
else if (args.Length == 1)
|
||||
{
|
||||
@@ -27,7 +29,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
EntitySystem.Get<RoundEndSystem>().RequestRoundEnd(shell.Player?.AttachedEntity, false);
|
||||
_e.System<RoundEndSystem>().RequestRoundEnd(shell.Player?.AttachedEntity, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,13 +37,15 @@ namespace Content.Server.Administration.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
public sealed class RecallShuttleCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "recallshuttle";
|
||||
public string Description => Loc.GetString("recall-shuttle-command-description");
|
||||
public string Help => Loc.GetString("recall-shuttle-command-help-text", ("command",Command));
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
EntitySystem.Get<RoundEndSystem>().CancelRoundEndCountdown(shell.Player?.AttachedEntity, false);
|
||||
_e.System<RoundEndSystem>().CancelRoundEndCountdown(shell.Player?.AttachedEntity, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands;
|
||||
[AdminCommand(AdminFlags.VarEdit)]
|
||||
public sealed class ThrowScoreboardCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "throwscoreboard";
|
||||
|
||||
public string Description => Loc.GetString("throw-scoreboard-command-description");
|
||||
@@ -20,6 +22,6 @@ public sealed class ThrowScoreboardCommand : IConsoleCommand
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
EntitySystem.Get<GameTicker>().ShowRoundEndScoreboard();
|
||||
_e.System<GameTicker>().ShowRoundEndScoreboard();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public sealed class AdminLogsEui : BaseEui
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
[Dependency] private readonly ILogManager _logManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configuration = default!;
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
private readonly ISawmill _sawmill;
|
||||
|
||||
@@ -51,7 +52,7 @@ public sealed class AdminLogsEui : BaseEui
|
||||
};
|
||||
}
|
||||
|
||||
private int CurrentRoundId => EntitySystem.Get<GameTicker>().RoundId;
|
||||
private int CurrentRoundId => _e.System<GameTicker>().RoundId;
|
||||
|
||||
public override async void Opened()
|
||||
{
|
||||
|
||||
16
Content.Server/Administration/Systems/AdminFrozenSystem.cs
Normal file
16
Content.Server/Administration/Systems/AdminFrozenSystem.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Content.Shared.Administration;
|
||||
|
||||
namespace Content.Server.Administration.Systems;
|
||||
|
||||
public sealed class AdminFrozenSystem : SharedAdminFrozenSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Freezes and mutes the given entity.
|
||||
/// </summary>
|
||||
public void FreezeAndMute(EntityUid uid)
|
||||
{
|
||||
var comp = EnsureComp<AdminFrozenComponent>(uid);
|
||||
comp.Muted = true;
|
||||
Dirty(uid, comp);
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Slippery;
|
||||
using Content.Shared.Tabletop.Components;
|
||||
using Content.Shared.Tools.Systems;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -77,6 +78,7 @@ public sealed partial class AdminVerbSystem
|
||||
[Dependency] private readonly SharedContentEyeSystem _eyeSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly SuperBonkSystem _superBonkSystem = default!;
|
||||
[Dependency] private readonly SlipperySystem _slipperySystem = default!;
|
||||
|
||||
// All smite verbs have names so invokeverb works.
|
||||
private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
|
||||
@@ -95,12 +97,12 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb explode = new()
|
||||
{
|
||||
Text = "Explode",
|
||||
Text = "admin-smite-explode-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
{
|
||||
var coords = Transform(args.Target).MapPosition;
|
||||
var coords = _transformSystem.GetMapCoordinates(args.Target);
|
||||
Timer.Spawn(_gameTiming.TickPeriod,
|
||||
() => _explosionSystem.QueueExplosion(coords, ExplosionSystem.DefaultExplosionPrototypeId,
|
||||
4, 1, 2, maxTileBreak: 0), // it gibs, damage doesn't need to be high.
|
||||
@@ -115,7 +117,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb chess = new()
|
||||
{
|
||||
Text = "Chess Dimension",
|
||||
Text = "admin-smite-chess-dimension-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Fun/Tabletop/chessboard.rsi"), "chessboard"),
|
||||
Act = () =>
|
||||
@@ -143,7 +145,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
Verb flames = new()
|
||||
{
|
||||
Text = "Set Alight",
|
||||
Text = "admin-smite-set-alight-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/Alerts/Fire/fire.png")),
|
||||
Act = () =>
|
||||
@@ -165,7 +167,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb monkey = new()
|
||||
{
|
||||
Text = "Monkeyify",
|
||||
Text = "admin-smite-monkeyify-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Mobs/Animals/monkey.rsi"), "monkey"),
|
||||
Act = () =>
|
||||
@@ -179,7 +181,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb disposalBin = new()
|
||||
{
|
||||
Text = "Garbage Can",
|
||||
Text = "admin-smite-electrocute-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Structures/Piping/disposal.rsi"), "disposal"),
|
||||
Act = () =>
|
||||
@@ -196,7 +198,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
Verb hardElectrocute = new()
|
||||
{
|
||||
Text = "Electrocute",
|
||||
Text = "admin-smite-creampie-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Clothing/Hands/Gloves/Color/yellow.rsi"), "icon"),
|
||||
Act = () =>
|
||||
@@ -241,7 +243,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
Verb creamPie = new()
|
||||
{
|
||||
Text = "Creampie",
|
||||
Text = "admin-smite-remove-blood-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Consumable/Food/Baked/pie.rsi"), "plain-slice"),
|
||||
Act = () =>
|
||||
@@ -258,7 +260,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
Verb bloodRemoval = new()
|
||||
{
|
||||
Text = "Remove blood",
|
||||
Text = "admin-smite-vomit-organs-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Fluids/tomato_splat.rsi"), "puddle-1"),
|
||||
Act = () =>
|
||||
@@ -281,7 +283,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
Verb vomitOrgans = new()
|
||||
{
|
||||
Text = "Vomit organs",
|
||||
Text = "admin-smite-remove-hands-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Fluids/vomit_toxin.rsi"), "vomit_toxin-1"),
|
||||
Act = () =>
|
||||
@@ -309,7 +311,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb handsRemoval = new()
|
||||
{
|
||||
Text = "Remove hands",
|
||||
Text = "admin-smite-remove-hand-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/remove-hands.png")),
|
||||
Act = () =>
|
||||
@@ -331,7 +333,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb handRemoval = new()
|
||||
{
|
||||
Text = "Remove hand",
|
||||
Text = "admin-smite-pinball-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/remove-hand.png")),
|
||||
Act = () =>
|
||||
@@ -354,7 +356,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb stomachRemoval = new()
|
||||
{
|
||||
Text = "Stomach Removal",
|
||||
Text = "admin-smite-yeet-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Mobs/Species/Human/organs.rsi"), "stomach"),
|
||||
Act = () =>
|
||||
@@ -374,7 +376,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb lungRemoval = new()
|
||||
{
|
||||
Text = "Lungs Removal",
|
||||
Text = "admin-smite-become-bread-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Mobs/Species/Human/organs.rsi"), "lung-r"),
|
||||
Act = () =>
|
||||
@@ -397,7 +399,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
Verb pinball = new()
|
||||
{
|
||||
Text = "Pinball",
|
||||
Text = "admin-smite-ghostkick-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Fun/toys.rsi"), "basketball"),
|
||||
Act = () =>
|
||||
@@ -431,7 +433,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb yeet = new()
|
||||
{
|
||||
Text = "Yeet",
|
||||
Text = "admin-smite-nyanify-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/eject.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
@@ -462,7 +464,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb bread = new()
|
||||
{
|
||||
Text = "Become Bread",
|
||||
Text = "admin-smite-kill-sign-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Consumable/Food/Baked/bread.rsi"), "plain"),
|
||||
Act = () =>
|
||||
@@ -476,7 +478,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb mouse = new()
|
||||
{
|
||||
Text = "Become Mouse",
|
||||
Text = "admin-smite-cluwne-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Mobs/Animals/mouse.rsi"), "icon-0"),
|
||||
Act = () =>
|
||||
@@ -492,7 +494,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
Verb ghostKick = new()
|
||||
{
|
||||
Text = "Ghostkick",
|
||||
Text = "admin-smite-anger-pointing-arrows-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/gavel.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
@@ -508,7 +510,7 @@ public sealed partial class AdminVerbSystem
|
||||
if (TryComp<InventoryComponent>(args.Target, out var inventory)) {
|
||||
Verb nyanify = new()
|
||||
{
|
||||
Text = "Nyanify",
|
||||
Text = "admin-smite-dust-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Clothing/Head/Hats/catears.rsi"), "icon"),
|
||||
Act = () =>
|
||||
@@ -525,7 +527,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb killSign = new()
|
||||
{
|
||||
Text = "Kill sign",
|
||||
Text = "admin-smite-buffering-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Misc/killsign.rsi"), "icon"),
|
||||
Act = () =>
|
||||
@@ -539,7 +541,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb cluwne = new()
|
||||
{
|
||||
Text = "Cluwne",
|
||||
Text = "admin-smite-become-instrument-name",
|
||||
Category = VerbCategory.Smite,
|
||||
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Clothing/Mask/cluwne.rsi"), "icon"),
|
||||
@@ -555,7 +557,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb maiden = new()
|
||||
{
|
||||
Text = "Maid",
|
||||
Text = "admin-smite-remove-gravity-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Clothing/Uniforms/Jumpskirt/janimaid.rsi"), "icon"),
|
||||
Act = () =>
|
||||
@@ -575,7 +577,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb angerPointingArrows = new()
|
||||
{
|
||||
Text = "Anger Pointing Arrows",
|
||||
Text = "admin-smite-reptilian-species-swap-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Interface/Misc/pointing.rsi"), "pointing"),
|
||||
Act = () =>
|
||||
@@ -589,7 +591,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb dust = new()
|
||||
{
|
||||
Text = "Dust",
|
||||
Text = "admin-smite-locker-stuff-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Materials/materials.rsi"), "ash"),
|
||||
Act = () =>
|
||||
@@ -605,7 +607,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb youtubeVideoSimulation = new()
|
||||
{
|
||||
Text = "Buffering",
|
||||
Text = "admin-smite-headstand-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/Misc/buffering_smite_icon.png")),
|
||||
Act = () =>
|
||||
@@ -619,7 +621,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb instrumentation = new()
|
||||
{
|
||||
Text = "Become Instrument",
|
||||
Text = "admin-smite-become-mouse-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Fun/Instruments/h_synthesizer.rsi"), "icon"),
|
||||
Act = () =>
|
||||
@@ -633,7 +635,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb noGravity = new()
|
||||
{
|
||||
Text = "Remove gravity",
|
||||
Text = "admin-smite-maid-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Structures/Machines/gravity_generator.rsi"), "off"),
|
||||
Act = () =>
|
||||
@@ -650,7 +652,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb reptilian = new()
|
||||
{
|
||||
Text = "Reptilian Species Swap",
|
||||
Text = "admin-smite-zoom-in-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Fun/toys.rsi"), "plushie_lizard"),
|
||||
Act = () =>
|
||||
@@ -664,7 +666,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb locker = new()
|
||||
{
|
||||
Text = "Locker stuff",
|
||||
Text = "admin-smite-flip-eye-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Structures/Storage/closet.rsi"), "generic"),
|
||||
Act = () =>
|
||||
@@ -686,7 +688,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb headstand = new()
|
||||
{
|
||||
Text = "Headstand",
|
||||
Text = "admin-smite-run-walk-swap-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/refresh.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
@@ -700,7 +702,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb zoomIn = new()
|
||||
{
|
||||
Text = "Zoom in",
|
||||
Text = "admin-smite-super-speed-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/zoom.png")),
|
||||
Act = () =>
|
||||
@@ -715,7 +717,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb flipEye = new()
|
||||
{
|
||||
Text = "Flip eye",
|
||||
Text = "admin-smite-stomach-removal-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/flip.png")),
|
||||
Act = () =>
|
||||
@@ -730,7 +732,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb runWalkSwap = new()
|
||||
{
|
||||
Text = "Run Walk Swap",
|
||||
Text = "admin-smite-speak-backwards-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/run-walk-swap.png")),
|
||||
Act = () =>
|
||||
@@ -750,7 +752,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb backwardsAccent = new()
|
||||
{
|
||||
Text = "Speak Backwards",
|
||||
Text = "admin-smite-lung-removal-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/help-backwards.png")),
|
||||
Act = () =>
|
||||
@@ -764,7 +766,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb disarmProne = new()
|
||||
{
|
||||
Text = "Disarm Prone",
|
||||
Text = "admin-smite-disarm-prone-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/Actions/disarm.png")),
|
||||
Act = () =>
|
||||
@@ -778,7 +780,7 @@ public sealed partial class AdminVerbSystem
|
||||
|
||||
Verb superSpeed = new()
|
||||
{
|
||||
Text = "Super speed",
|
||||
Text = "admin-smite-garbage-can-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/super_speed.png")),
|
||||
Act = () =>
|
||||
@@ -797,7 +799,7 @@ public sealed partial class AdminVerbSystem
|
||||
//Bonk
|
||||
Verb superBonkLite = new()
|
||||
{
|
||||
Text = "Super Bonk Lite",
|
||||
Text = "admin-smite-super-bonk-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new("Structures/Furniture/Tables/glass.rsi"), "full"),
|
||||
Act = () =>
|
||||
@@ -810,7 +812,7 @@ public sealed partial class AdminVerbSystem
|
||||
args.Verbs.Add(superBonkLite);
|
||||
Verb superBonk= new()
|
||||
{
|
||||
Text = "Super Bonk",
|
||||
Text = "admin-smite-super-bonk-lite-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new("Structures/Furniture/Tables/generic.rsi"), "full"),
|
||||
Act = () =>
|
||||
@@ -821,5 +823,31 @@ public sealed partial class AdminVerbSystem
|
||||
Impact = LogImpact.Extreme,
|
||||
};
|
||||
args.Verbs.Add(superBonk);
|
||||
|
||||
Verb superslip = new()
|
||||
{
|
||||
Text = "admin-smite-super-slip-name",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new("Objects/Specific/Janitorial/soap.rsi"), "omega-4"),
|
||||
Act = () =>
|
||||
{
|
||||
var hadSlipComponent = EnsureComp(args.Target, out SlipperyComponent slipComponent);
|
||||
if (!hadSlipComponent)
|
||||
{
|
||||
slipComponent.SuperSlippery = true;
|
||||
slipComponent.ParalyzeTime = 5;
|
||||
slipComponent.LaunchForwardsMultiplier = 20;
|
||||
}
|
||||
|
||||
_slipperySystem.TrySlip(args.Target, slipComponent, args.Target, requiresContact: false);
|
||||
if (!hadSlipComponent)
|
||||
{
|
||||
RemComp(args.Target, slipComponent);
|
||||
}
|
||||
},
|
||||
Impact = LogImpact.Extreme,
|
||||
Message = Loc.GetString("admin-smite-super-slip-description")
|
||||
};
|
||||
args.Verbs.Add(superslip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace Content.Server.Administration.Systems
|
||||
[Dependency] private readonly StationSystem _stations = default!;
|
||||
[Dependency] private readonly StationSpawningSystem _spawning = default!;
|
||||
[Dependency] private readonly ExamineSystemShared _examine = default!;
|
||||
[Dependency] private readonly AdminFrozenSystem _freeze = default!;
|
||||
|
||||
private readonly Dictionary<ICommonSession, List<EditSolutionsEui>> _openSolutionUis = new();
|
||||
|
||||
@@ -131,24 +132,57 @@ namespace Content.Server.Administration.Systems
|
||||
args.Verbs.Add(prayerVerb);
|
||||
|
||||
// Freeze
|
||||
var frozen = HasComp<AdminFrozenComponent>(args.Target);
|
||||
args.Verbs.Add(new Verb
|
||||
var frozen = TryComp<AdminFrozenComponent>(args.Target, out var frozenComp);
|
||||
var frozenAndMuted = frozenComp?.Muted ?? false;
|
||||
|
||||
if (!frozen)
|
||||
{
|
||||
Priority = -1, // This is just so it doesn't change position in the menu between freeze/unfreeze.
|
||||
Text = frozen
|
||||
? Loc.GetString("admin-verbs-unfreeze")
|
||||
: Loc.GetString("admin-verbs-freeze"),
|
||||
Category = VerbCategory.Admin,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/snow.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
args.Verbs.Add(new Verb
|
||||
{
|
||||
if (frozen)
|
||||
RemComp<AdminFrozenComponent>(args.Target);
|
||||
else
|
||||
Priority = -1, // This is just so it doesn't change position in the menu between freeze/unfreeze.
|
||||
Text = Loc.GetString("admin-verbs-freeze"),
|
||||
Category = VerbCategory.Admin,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/snow.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
{
|
||||
EnsureComp<AdminFrozenComponent>(args.Target);
|
||||
},
|
||||
Impact = LogImpact.Medium,
|
||||
});
|
||||
},
|
||||
Impact = LogImpact.Medium,
|
||||
});
|
||||
}
|
||||
|
||||
if (!frozenAndMuted)
|
||||
{
|
||||
// allow you to additionally mute someone when they are already frozen
|
||||
args.Verbs.Add(new Verb
|
||||
{
|
||||
Priority = -1, // This is just so it doesn't change position in the menu between freeze/unfreeze.
|
||||
Text = Loc.GetString("admin-verbs-freeze-and-mute"),
|
||||
Category = VerbCategory.Admin,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/snow.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
{
|
||||
_freeze.FreezeAndMute(args.Target);
|
||||
},
|
||||
Impact = LogImpact.Medium,
|
||||
});
|
||||
}
|
||||
|
||||
if (frozen)
|
||||
{
|
||||
args.Verbs.Add(new Verb
|
||||
{
|
||||
Priority = -1, // This is just so it doesn't change position in the menu between freeze/unfreeze.
|
||||
Text = Loc.GetString("admin-verbs-unfreeze"),
|
||||
Category = VerbCategory.Admin,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/snow.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
{
|
||||
RemComp<AdminFrozenComponent>(args.Target);
|
||||
},
|
||||
Impact = LogImpact.Medium,
|
||||
});
|
||||
}
|
||||
|
||||
// Erase
|
||||
args.Verbs.Add(new Verb
|
||||
|
||||
@@ -25,7 +25,7 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Server.Administration.Systems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class BwoinkSystem : SharedBwoinkSystem
|
||||
public sealed partial class BwoinkSystem : SharedBwoinkSystem
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
@@ -36,6 +36,9 @@ namespace Content.Server.Administration.Systems
|
||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||
[Dependency] private readonly IAfkManager _afkManager = default!;
|
||||
|
||||
[GeneratedRegex(@"^https://discord\.com/api/webhooks/(\d+)/((?!.*/).*)$")]
|
||||
private static partial Regex DiscordRegex();
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
private readonly HttpClient _httpClient = new();
|
||||
private string _webhookUrl = string.Empty;
|
||||
@@ -157,7 +160,7 @@ namespace Content.Server.Administration.Systems
|
||||
return;
|
||||
|
||||
// Basic sanity check and capturing webhook ID and token
|
||||
var match = Regex.Match(url, @"^https://discord\.com/api/webhooks/(\d+)/((?!.*/).*)$");
|
||||
var match = DiscordRegex().Match(url);
|
||||
|
||||
if (!match.Success)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public sealed class SpawnExplosionEui : BaseEui
|
||||
if (request.TotalIntensity <= 0 || request.IntensitySlope <= 0)
|
||||
return;
|
||||
|
||||
var explosion = EntitySystem.Get<ExplosionSystem>().GenerateExplosionPreview(request);
|
||||
var explosion = _explosionSystem.GenerateExplosionPreview(request);
|
||||
|
||||
if (explosion == null)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace Content.Server.Alert.Commands
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ClearAlert : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "clearalert";
|
||||
public string Description => "Clears an alert for a player, defaulting to current player";
|
||||
public string Help => "clearalert <alertType> <name or userID, omit for current player>";
|
||||
@@ -30,14 +32,14 @@ namespace Content.Server.Alert.Commands
|
||||
if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
|
||||
if (!_e.TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
}
|
||||
|
||||
var alertType = args[0];
|
||||
var alertsSystem = EntitySystem.Get<AlertsSystem>();
|
||||
var alertsSystem = _e.System<AlertsSystem>();
|
||||
if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
|
||||
{
|
||||
shell.WriteLine("unrecognized alertType " + alertType);
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace Content.Server.Alert.Commands
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ShowAlert : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "showalert";
|
||||
public string Description => "Shows an alert for a player, defaulting to current player";
|
||||
public string Help => "showalert <alertType> <severity, -1 if no severity> <name or userID, omit for current player>";
|
||||
@@ -30,7 +32,7 @@ namespace Content.Server.Alert.Commands
|
||||
if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
|
||||
if (!_e.TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
@@ -38,7 +40,7 @@ namespace Content.Server.Alert.Commands
|
||||
|
||||
var alertType = args[0];
|
||||
var severity = args[1];
|
||||
var alertsSystem = EntitySystem.Get<AlertsSystem>();
|
||||
var alertsSystem = _e.System<AlertsSystem>();
|
||||
if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
|
||||
{
|
||||
shell.WriteLine("unrecognized alertType " + alertType);
|
||||
|
||||
@@ -42,9 +42,6 @@ public sealed partial class AnomalySystem : SharedAnomalySystem
|
||||
[Dependency] private readonly RadiationSystem _radiation = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
||||
[Dependency] private readonly ISerializationManager _serialization = default!;
|
||||
[Dependency] private readonly IEntityManager _entity = default!;
|
||||
|
||||
public const float MinParticleVariation = 0.8f;
|
||||
public const float MaxParticleVariation = 1.2f;
|
||||
|
||||
@@ -61,7 +61,7 @@ public sealed class ElectricityAnomalySystem : EntitySystem
|
||||
var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
|
||||
var duration = elec.MaxElectrocuteDuration * anom.Severity;
|
||||
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(xform.MapPosition, range))
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(_transform.GetMapCoordinates(uid, xform), range))
|
||||
{
|
||||
_electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using System.Linq;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Anomaly.Effects;
|
||||
/// <summary>
|
||||
@@ -16,6 +17,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
private EntityQuery<InjectableSolutionComponent> _injectableQuery;
|
||||
|
||||
@@ -45,7 +47,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
||||
//We get all the entity in the radius into which the reagent will be injected.
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var xform = xformQuery.GetComponent(entity);
|
||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
|
||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(_transform.GetMapCoordinates(entity, xform: xform), injectRadius)
|
||||
.Select(x => x.Owner).ToList();
|
||||
|
||||
//for each matching entity found
|
||||
|
||||
@@ -8,13 +8,15 @@ namespace Content.Server.Atmos.Commands
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ListGasesCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "listgases";
|
||||
public string Description => "Prints a list of gases and their indices.";
|
||||
public string Help => "listgases";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
var atmosSystem = _e.System<AtmosphereSystem>();
|
||||
|
||||
foreach (var gasPrototype in atmosSystem.Gases)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Content.Server.Atmos.Commands
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ShowAtmos : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "showatmos";
|
||||
public string Description => "Toggles seeing atmos debug overlay.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
@@ -21,7 +23,7 @@ namespace Content.Server.Atmos.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var atmosDebug = EntitySystem.Get<AtmosDebugOverlaySystem>();
|
||||
var atmosDebug = _e.System<AtmosDebugOverlaySystem>();
|
||||
var enabled = atmosDebug.ToggleObserver(player);
|
||||
|
||||
shell.WriteLine(enabled
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Server.Atmos.Components
|
||||
set
|
||||
{
|
||||
Type = value;
|
||||
EntitySystem.Get<AtmosPlaqueSystem>().UpdateSign(Owner, this);
|
||||
IoCManager.Resolve<IEntityManager>().System<AtmosPlaqueSystem>().UpdateSign(Owner, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Content.Server.Atmos.EntitySystems;
|
||||
public sealed class AirFilterSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.Atmos.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Projectiles;
|
||||
@@ -42,12 +43,14 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
||||
[Dependency] private readonly FixtureSystem _fixture = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
private EntityQuery<InventoryComponent> _inventoryQuery;
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
|
||||
// This should probably be moved to the component, requires a rewrite, all fires tick at the same time
|
||||
@@ -61,6 +64,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
UpdatesAfter.Add(typeof(AtmosphereSystem));
|
||||
|
||||
_inventoryQuery = GetEntityQuery<InventoryComponent>();
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
|
||||
SubscribeLocalEvent<FlammableComponent, MapInitEvent>(OnMapInit);
|
||||
@@ -444,13 +448,20 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
continue;
|
||||
}
|
||||
|
||||
EnsureComp<IgnitionSourceComponent>(uid);
|
||||
_ignitionSourceSystem.SetIgnited(uid);
|
||||
var source = EnsureComp<IgnitionSourceComponent>(uid);
|
||||
_ignitionSourceSystem.SetIgnited((uid, source));
|
||||
|
||||
if (TryComp(uid, out TemperatureComponent? temp))
|
||||
_temperatureSystem.ChangeHeat(uid, 12500 * flammable.FireStacks, false, temp);
|
||||
|
||||
_damageableSystem.TryChangeDamage(uid, flammable.Damage * flammable.FireStacks, interruptsDoAfters: false);
|
||||
var ev = new GetFireProtectionEvent();
|
||||
// let the thing on fire handle it
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
// and whatever it's wearing
|
||||
if (_inventoryQuery.TryComp(uid, out var inv))
|
||||
_inventory.RelayEvent((uid, inv), ref ev);
|
||||
|
||||
_damageableSystem.TryChangeDamage(uid, flammable.Damage * flammable.FireStacks * ev.Multiplier, interruptsDoAfters: false);
|
||||
|
||||
AdjustFireStacks(uid, flammable.FirestackFade * (flammable.Resisting ? 10f : 1f), flammable);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
|
||||
// PVS was turned off, ensure data gets sent to all clients.
|
||||
var query = EntityQueryEnumerator<GasTileOverlayComponent, MetaDataComponent>();
|
||||
var query = AllEntityQuery<GasTileOverlayComponent, MetaDataComponent>();
|
||||
while (query.MoveNext(out var uid, out var grid, out var meta))
|
||||
{
|
||||
grid.ForceTick = _gameTiming.CurTick;
|
||||
@@ -269,7 +269,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
private void UpdateOverlayData()
|
||||
{
|
||||
// TODO parallelize?
|
||||
var query = EntityQueryEnumerator<GasTileOverlayComponent, GridAtmosphereComponent, MetaDataComponent>();
|
||||
var query = AllEntityQuery<GasTileOverlayComponent, GridAtmosphereComponent, MetaDataComponent>();
|
||||
while (query.MoveNext(out var uid, out var overlay, out var gam, out var meta))
|
||||
{
|
||||
var changed = false;
|
||||
|
||||
@@ -90,8 +90,8 @@ public abstract class AirAlarmModeExecutor : IAirAlarmMode
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
DeviceNetworkSystem = EntitySystem.Get<DeviceNetworkSystem>();
|
||||
AirAlarmSystem = EntitySystem.Get<AirAlarmSystem>();
|
||||
DeviceNetworkSystem = EntityManager.System<DeviceNetworkSystem>();
|
||||
AirAlarmSystem = EntityManager.System<AirAlarmSystem>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Server.Atmos.Piping.Components
|
||||
public Color ColorVV
|
||||
{
|
||||
get => Color;
|
||||
set => EntitySystem.Get<AtmosPipeColorSystem>().SetColor(Owner, this, value);
|
||||
set => IoCManager.Resolve<IEntityManager>().System<AtmosPipeColorSystem>().SetColor(Owner, this, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Beam.Components;
|
||||
using Content.Shared.Beam;
|
||||
using Content.Shared.Beam.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
@@ -16,6 +17,7 @@ namespace Content.Server.Beam;
|
||||
public sealed class BeamSystem : SharedBeamSystem
|
||||
{
|
||||
[Dependency] private readonly FixtureSystem _fixture = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
@@ -144,8 +146,8 @@ public sealed class BeamSystem : SharedBeamSystem
|
||||
if (Deleted(user) || Deleted(target))
|
||||
return;
|
||||
|
||||
var userMapPos = Transform(user).MapPosition;
|
||||
var targetMapPos = Transform(target).MapPosition;
|
||||
var userMapPos = _transform.GetMapCoordinates(user);
|
||||
var targetMapPos = _transform.GetMapCoordinates(target);
|
||||
|
||||
//The distance between the target and the user.
|
||||
var calculatedDistance = targetMapPos.Position - userMapPos.Position;
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Server.Chemistry.ReactionEffects;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Forensics;
|
||||
using Content.Server.HealthExaminable;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
@@ -13,6 +12,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Drunk;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.HealthExaminable;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Rejuvenate;
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Content.Server.Chat.Commands
|
||||
[AnyCommand]
|
||||
internal sealed class LOOCCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "looc";
|
||||
public string Description => "Send Local Out Of Character chat messages.";
|
||||
public string Help => "looc <text>";
|
||||
@@ -33,7 +35,7 @@ namespace Content.Server.Chat.Commands
|
||||
if (string.IsNullOrEmpty(message))
|
||||
return;
|
||||
|
||||
EntitySystem.Get<ChatSystem>().TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Looc, false, shell, player);
|
||||
_e.System<ChatSystem>().TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Looc, false, shell, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Shared.Console;
|
||||
@@ -9,6 +10,8 @@ namespace Content.Server.Chat.Commands
|
||||
[AnyCommand]
|
||||
internal sealed class SuicideCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "suicide";
|
||||
|
||||
public string Description => Loc.GetString("suicide-command-description");
|
||||
@@ -26,17 +29,29 @@ namespace Content.Server.Chat.Commands
|
||||
if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
|
||||
return;
|
||||
|
||||
var minds = IoCManager.Resolve<IEntityManager>().System<SharedMindSystem>();
|
||||
var minds = _e.System<SharedMindSystem>();
|
||||
|
||||
// This check also proves mind not-null for at the end when the mob is ghosted.
|
||||
if (!minds.TryGetMind(player, out var mindId, out var mind) ||
|
||||
mind.OwnedEntity is not { Valid: true } victim)
|
||||
{
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
shell.WriteLine(Loc.GetString("suicide-command-no-mind"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var gameTicker = _e.System<GameTicker>();
|
||||
var suicideSystem = _e.System<SuicideSystem>();
|
||||
|
||||
if (_e.HasComponent<AdminFrozenComponent>(victim))
|
||||
{
|
||||
var deniedMessage = Loc.GetString("suicide-command-denied");
|
||||
shell.WriteLine(deniedMessage);
|
||||
_e.System<PopupSystem>()
|
||||
.PopupEntity(deniedMessage, victim, victim);
|
||||
return;
|
||||
}
|
||||
|
||||
var gameTicker = EntitySystem.Get<GameTicker>();
|
||||
var suicideSystem = EntitySystem.Get<SuicideSystem>();
|
||||
if (suicideSystem.Suicide(victim))
|
||||
{
|
||||
// Prevent the player from returning to the body.
|
||||
@@ -48,7 +63,7 @@ namespace Content.Server.Chat.Commands
|
||||
if (gameTicker.OnGhostAttempt(mindId, true, mind: mind))
|
||||
return;
|
||||
|
||||
shell.WriteLine("You can't ghost right now.");
|
||||
shell.WriteLine(Loc.GetString("ghost-command-denied"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ public sealed class HypospraySystem : SharedHypospraySystem
|
||||
{
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly InteractionSystem _interaction = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -81,9 +81,9 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<KeyValuePair<string, KeyValuePair<string, string>>> GetInventory(Entity<ReagentDispenserComponent> reagentDispenser)
|
||||
private List<ReagentInventoryItem> GetInventory(Entity<ReagentDispenserComponent> reagentDispenser)
|
||||
{
|
||||
var inventory = new List<KeyValuePair<string, KeyValuePair<string, string>>>();
|
||||
var inventory = new List<ReagentInventoryItem>();
|
||||
|
||||
for (var i = 0; i < reagentDispenser.Comp.NumSlots; i++)
|
||||
{
|
||||
@@ -99,15 +99,17 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
else
|
||||
continue;
|
||||
|
||||
// Add volume remaining label
|
||||
// Get volume remaining and color of solution
|
||||
FixedPoint2 quantity = 0f;
|
||||
var reagentColor = Color.White;
|
||||
if (storedContainer != null && _solutionContainerSystem.TryGetDrainableSolution(storedContainer.Value, out _, out var sol))
|
||||
{
|
||||
quantity = sol.Volume;
|
||||
reagentColor = sol.GetColor(_prototypeManager);
|
||||
}
|
||||
var storedAmount = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", quantity));
|
||||
|
||||
inventory.Add(new KeyValuePair<string, KeyValuePair<string, string>>(storageSlotId, new KeyValuePair<string, string>(reagentLabel, storedAmount)));
|
||||
inventory.Add(new ReagentInventoryItem(storageSlotId, reagentLabel, storedAmount, reagentColor));
|
||||
}
|
||||
|
||||
return inventory;
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
var reagent = _protoManager.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype);
|
||||
|
||||
var reaction =
|
||||
reagent.ReactionTile(tile, (reagentQuantity.Quantity / vapor.TransferAmount) * 0.25f);
|
||||
reagent.ReactionTile(tile, (reagentQuantity.Quantity / vapor.TransferAmount) * 0.25f, EntityManager);
|
||||
|
||||
if (reaction > reagentQuantity.Quantity)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
@@ -58,15 +59,18 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
var splitSolution = args.Source.SplitSolution(args.Source.Volume);
|
||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var mapSys = args.EntityManager.System<MapSystem>();
|
||||
var sys = args.EntityManager.System<TransformSystem>();
|
||||
var mapCoords = sys.GetMapCoordinates(args.SolutionEntity, xform: transform);
|
||||
|
||||
if (!mapManager.TryFindGridAt(transform.MapPosition, out _, out var grid) ||
|
||||
!grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
|
||||
if (!mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid) ||
|
||||
!mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef) ||
|
||||
tileRef.Tile.IsSpace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var coords = grid.MapToGrid(transform.MapPosition);
|
||||
var coords = mapSys.MapToGrid(gridUid, mapCoords);
|
||||
var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
|
||||
|
||||
var smoke = args.EntityManager.System<SmokeSystem>();
|
||||
|
||||
@@ -34,7 +34,7 @@ public sealed partial class CreateEntityReactionEffect : ReagentEffect
|
||||
|
||||
for (var i = 0; i < quantity; i++)
|
||||
{
|
||||
var uid = args.EntityManager.SpawnEntity(Entity, transform.MapPosition);
|
||||
var uid = args.EntityManager.SpawnEntity(Entity, transformSystem.GetMapCoordinates(args.SolutionEntity, xform: transform));
|
||||
transformSystem.AttachToGridOrMap(uid);
|
||||
|
||||
// TODO figure out how to properly spawn inside of containers
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Emp;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Chemistry.ReactionEffects;
|
||||
@@ -37,11 +38,12 @@ public sealed partial class EmpReactionEffect : ReagentEffect
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
var tSys = args.EntityManager.System<TransformSystem>();
|
||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||
var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange);
|
||||
|
||||
args.EntityManager.System<EmpSystem>().EmpPulse(
|
||||
transform.MapPosition,
|
||||
args.EntityManager.System<EmpSystem>()
|
||||
.EmpPulse(tSys.GetMapCoordinates(args.SolutionEntity, xform: transform),
|
||||
range,
|
||||
EnergyConsumption,
|
||||
DisableDuration);
|
||||
|
||||
@@ -61,7 +61,8 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
{
|
||||
var intensity = MathF.Min((float) args.Quantity * IntensityPerUnit, MaxTotalIntensity);
|
||||
|
||||
EntitySystem.Get<ExplosionSystem>().QueueExplosion(
|
||||
args.EntityManager.System<ExplosionSystem>()
|
||||
.QueueExplosion(
|
||||
args.SolutionEntity,
|
||||
ExplosionType,
|
||||
intensity,
|
||||
|
||||
@@ -18,7 +18,7 @@ public sealed partial class HasTag : ReagentEffectCondition
|
||||
public override bool Condition(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent<TagComponent>(args.SolutionEntity, out var tag))
|
||||
return EntitySystem.Get<TagSystem>().HasTag(tag, Tag) ^ Invert;
|
||||
return args.EntityManager.System<TagSystem>().HasTag(tag, Tag) ^ Invert;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
|
||||
cleanseRate *= args.Scale;
|
||||
|
||||
var bloodstreamSys = EntitySystem.Get<BloodstreamSystem>();
|
||||
var bloodstreamSys = args.EntityManager.System<BloodstreamSystem>();
|
||||
bloodstreamSys.FlushChemicals(args.SolutionEntity, args.Reagent.ID, cleanseRate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffects
|
||||
{
|
||||
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return;
|
||||
|
||||
var flammableSystem = EntitySystem.Get<FlammableSystem>();
|
||||
var flammableSystem = args.EntityManager.System<FlammableSystem>();
|
||||
flammableSystem.Extinguish(args.SolutionEntity, flammable);
|
||||
flammableSystem.AdjustFireStacks(args.SolutionEntity, -1.5f * (float) args.Quantity, flammable);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public sealed partial class Ignite : ReagentEffect
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
var flamSys = EntitySystem.Get<FlammableSystem>();
|
||||
var flamSys = args.EntityManager.System<FlammableSystem>();
|
||||
flamSys.Ignite(args.SolutionEntity, args.OrganEntity ?? args.SolutionEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public sealed partial class ModifyBleedAmount : ReagentEffect
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent<BloodstreamComponent>(args.SolutionEntity, out var blood))
|
||||
{
|
||||
var sys = EntitySystem.Get<BloodstreamSystem>();
|
||||
var sys = args.EntityManager.System<BloodstreamSystem>();
|
||||
var amt = Scaled ? Amount * args.Quantity.Float() : Amount;
|
||||
amt *= args.Scale;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public sealed partial class ModifyBloodLevel : ReagentEffect
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent<BloodstreamComponent>(args.SolutionEntity, out var blood))
|
||||
{
|
||||
var sys = EntitySystem.Get<BloodstreamSystem>();
|
||||
var sys = args.EntityManager.System<BloodstreamSystem>();
|
||||
var amt = Scaled ? Amount * args.Quantity : Amount;
|
||||
amt *= args.Scale;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Content.Server.Chemistry.ReagentEffects
|
||||
IncreaseTimer(status, statusLifetime);
|
||||
|
||||
if (modified)
|
||||
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(args.SolutionEntity);
|
||||
args.EntityManager.System<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(args.SolutionEntity);
|
||||
|
||||
}
|
||||
public void IncreaseTimer(MovespeedModifierMetabolismComponent status, float time)
|
||||
|
||||
@@ -18,7 +18,7 @@ public sealed partial class Oxygenate : ReagentEffect
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent<RespiratorComponent>(args.SolutionEntity, out var resp))
|
||||
{
|
||||
var respSys = EntitySystem.Get<RespiratorSystem>();
|
||||
var respSys = args.EntityManager.System<RespiratorSystem>();
|
||||
respSys.UpdateSaturation(args.SolutionEntity, args.Quantity.Float() * Factor, resp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public sealed partial class Paralyze : ReagentEffect
|
||||
var paralyzeTime = ParalyzeTime;
|
||||
paralyzeTime *= args.Scale;
|
||||
|
||||
EntitySystem.Get<StunSystem>().TryParalyze(args.SolutionEntity, TimeSpan.FromSeconds(paralyzeTime), Refresh);
|
||||
args.EntityManager.System<StunSystem>().TryParalyze(args.SolutionEntity, TimeSpan.FromSeconds(paralyzeTime), Refresh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Server.Chemistry.ReagentEffects
|
||||
{
|
||||
var uid = args.SolutionEntity;
|
||||
if (args.EntityManager.TryGetComponent(uid, out ThirstComponent? thirst))
|
||||
EntitySystem.Get<ThirstSystem>().ModifyThirst(uid, thirst, HydrationFactor);
|
||||
args.EntityManager.System<ThirstSystem>().ModifyThirst(uid, thirst, HydrationFactor);
|
||||
}
|
||||
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffects
|
||||
{
|
||||
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out CreamPiedComponent? creamPied)) return;
|
||||
|
||||
EntitySystem.Get<CreamPieSystem>().SetCreamPied(args.SolutionEntity, creamPied, false);
|
||||
args.EntityManager.System<CreamPieSystem>().SetCreamPied(args.SolutionEntity, creamPied, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,20 @@ public sealed partial class CleanDecalsReaction : ITileReaction
|
||||
[DataField]
|
||||
public FixedPoint2 CleanCost { get; private set; } = FixedPoint2.New(0.25f);
|
||||
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (reactVolume <= CleanCost ||
|
||||
!entMan.TryGetComponent<MapGridComponent>(tile.GridUid, out var grid) ||
|
||||
!entMan.TryGetComponent<DecalGridComponent>(tile.GridUid, out var decalGrid))
|
||||
!entityManager.TryGetComponent<MapGridComponent>(tile.GridUid, out var grid) ||
|
||||
!entityManager.TryGetComponent<DecalGridComponent>(tile.GridUid, out var decalGrid))
|
||||
{
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
|
||||
var lookupSystem = entMan.System<EntityLookupSystem>();
|
||||
var decalSystem = entMan.System<DecalSystem>();
|
||||
var lookupSystem = entityManager.System<EntityLookupSystem>();
|
||||
var decalSystem = entityManager.System<DecalSystem>();
|
||||
// Very generous hitbox.
|
||||
var decals = decalSystem
|
||||
.GetDecalsIntersecting(tile.GridUid, lookupSystem.GetLocalBounds(tile, grid.TileSize).Enlarged(0.5f).Translated(new Vector2(-0.5f, -0.5f)));
|
||||
|
||||
@@ -31,12 +31,14 @@ public sealed partial class CleanTileReaction : ITileReaction
|
||||
[DataField("reagent", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>))]
|
||||
public string ReplacementReagent = "Water";
|
||||
|
||||
FixedPoint2 ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
FixedPoint2 ITileReaction.TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var entities = entMan.System<EntityLookupSystem>().GetLocalEntitiesIntersecting(tile, 0f).ToArray();
|
||||
var puddleQuery = entMan.GetEntityQuery<PuddleComponent>();
|
||||
var solutionContainerSystem = entMan.System<SolutionContainerSystem>();
|
||||
var entities = entityManager.System<EntityLookupSystem>().GetLocalEntitiesIntersecting(tile, 0f).ToArray();
|
||||
var puddleQuery = entityManager.GetEntityQuery<PuddleComponent>();
|
||||
var solutionContainerSystem = entityManager.System<SolutionContainerSystem>();
|
||||
// Multiply as the amount we can actually purge is higher than the react amount.
|
||||
var purgeAmount = reactVolume / CleanAmountMultiplier;
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
|
||||
[DataField]
|
||||
public float RandomOffsetMax = 0.0f;
|
||||
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
if (reactVolume >= Usage)
|
||||
{
|
||||
// TODO probably pass this in args like reagenteffects do.
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (Whitelist != null)
|
||||
{
|
||||
int acc = 0;
|
||||
@@ -59,9 +59,9 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
|
||||
var xoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax);
|
||||
var yoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax);
|
||||
|
||||
var center = entMan.System<TurfSystem>().GetTileCenter(tile);
|
||||
var center = entityManager.System<TurfSystem>().GetTileCenter(tile);
|
||||
var pos = center.Offset(new Vector2(xoffs, yoffs));
|
||||
entMan.SpawnEntity(Entity, pos);
|
||||
entityManager.SpawnEntity(Entity, pos);
|
||||
|
||||
return Usage;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,15 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[DataField("coolingTemperature")] private float _coolingTemperature = 2f;
|
||||
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
var atmosphereSystem = entityManager.System<AtmosphereSystem>();
|
||||
|
||||
var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true);
|
||||
|
||||
|
||||
@@ -13,12 +13,15 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[DataField("temperatureMultiplier")] private float _temperatureMultiplier = 1.15f;
|
||||
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
var atmosphereSystem = entityManager.System<AtmosphereSystem>();
|
||||
|
||||
var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true);
|
||||
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridUid, tile.GridIndices))
|
||||
|
||||
@@ -12,9 +12,12 @@ namespace Content.Server.Chemistry.TileReactions;
|
||||
[DataDefinition]
|
||||
public sealed partial class PryTileReaction : ITileReaction
|
||||
{
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
var sys = IoCManager.Resolve<IEntityManager>().System<TileSystem>();
|
||||
var sys = entityManager.System<TileSystem>();
|
||||
sys.PryTile(tile);
|
||||
return reactVolume;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,12 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
[DataDefinition]
|
||||
public sealed partial class SpillIfPuddlePresentTileReaction : ITileReaction
|
||||
{
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
var spillSystem = EntitySystem.Get<PuddleSystem>();
|
||||
var spillSystem = entityManager.System<PuddleSystem>();
|
||||
if (reactVolume < 5 || !spillSystem.TryGetPuddle(tile, out _))
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
|
||||
@@ -26,13 +26,14 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
/// </summary>
|
||||
[DataField("superSlippery")] private bool _superSlippery;
|
||||
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile,
|
||||
ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume,
|
||||
IEntityManager entityManager)
|
||||
{
|
||||
if (reactVolume < 5)
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (entityManager.EntitySysManager.GetEntitySystem<PuddleSystem>()
|
||||
.TrySpillAt(tile, new Solution(reagent.ID, reactVolume), out var puddleUid, false, false))
|
||||
{
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Content.Server.Cloning
|
||||
}
|
||||
// end of genetic damage checks
|
||||
|
||||
var mob = Spawn(speciesPrototype.Prototype, Transform(uid).MapPosition);
|
||||
var mob = Spawn(speciesPrototype.Prototype, _transformSystem.GetMapCoordinates(uid));
|
||||
_humanoidSystem.CloneAppearance(bodyToClone, mob);
|
||||
|
||||
var ev = new CloningEvent(bodyToClone, mob);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Content.Server.Construction
|
||||
}
|
||||
}
|
||||
|
||||
var pos = Transform(user).MapPosition;
|
||||
var pos = _transformSystem.GetMapCoordinates(user);
|
||||
|
||||
foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.CriminalRecords;
|
||||
using Content.Shared.CriminalRecords.Components;
|
||||
using Content.Shared.CriminalRecords.Systems;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Security;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.CriminalRecords.Systems;
|
||||
|
||||
public sealed class CriminalRecordsHackerSystem : SharedCriminalRecordsHackerSystem
|
||||
{
|
||||
[Dependency] private readonly ChatSystem _chat = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
[Dependency] private readonly StationRecordsSystem _records = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CriminalRecordsHackerComponent, CriminalRecordsHackDoAfterEvent>(OnDoAfter);
|
||||
}
|
||||
|
||||
private void OnDoAfter(Entity<CriminalRecordsHackerComponent> ent, ref CriminalRecordsHackDoAfterEvent args)
|
||||
{
|
||||
if (args.Cancelled || args.Handled || args.Target == null)
|
||||
return;
|
||||
|
||||
if (_station.GetOwningStation(ent) is not {} station)
|
||||
return;
|
||||
|
||||
var reasons = _proto.Index<DatasetPrototype>(ent.Comp.Reasons);
|
||||
foreach (var (key, record) in _records.GetRecordsOfType<CriminalRecord>(station))
|
||||
{
|
||||
var reason = _random.Pick(reasons.Values);
|
||||
record.Status = SecurityStatus.Wanted;
|
||||
record.Reason = reason;
|
||||
// no radio message since spam
|
||||
// no history since lazy and its easy to remove anyway
|
||||
// main damage with this is existing arrest warrants are lost and to anger beepsky
|
||||
}
|
||||
|
||||
_chat.DispatchGlobalAnnouncement(Loc.GetString(ent.Comp.Announcement), playSound: true, colorOverride: Color.Red);
|
||||
|
||||
// once is enough
|
||||
RemComp<CriminalRecordsHackerComponent>(ent);
|
||||
|
||||
var ev = new CriminalRecordsHackedEvent(ent, args.Target.Value);
|
||||
RaiseLocalEvent(args.User, ref ev);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised on the user after hacking a criminal records console.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public record struct CriminalRecordsHackedEvent(EntityUid User, EntityUid Target);
|
||||
@@ -14,7 +14,6 @@ using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Preferences.Loadouts;
|
||||
using Content.Shared.Preferences.Loadouts.Effects;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Network;
|
||||
@@ -253,8 +252,8 @@ namespace Content.Server.Database
|
||||
spawnPriority,
|
||||
jobs,
|
||||
(PreferenceUnavailableMode) profile.PreferenceUnavailable,
|
||||
antags.ToList(),
|
||||
traits.ToList(),
|
||||
antags.ToHashSet(),
|
||||
traits.ToHashSet(),
|
||||
loadouts
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Content.Server.Decals
|
||||
playerData.Clear();
|
||||
}
|
||||
|
||||
var query = EntityQueryEnumerator<DecalGridComponent, MetaDataComponent>();
|
||||
var query = AllEntityQuery<DecalGridComponent, MetaDataComponent>();
|
||||
while (query.MoveNext(out var uid, out var grid, out var meta))
|
||||
{
|
||||
grid.ForceTick = _timing.CurTick;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
!system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform))
|
||||
return;
|
||||
|
||||
var vendingMachineSystem = EntitySystem.Get<VendingMachineSystem>();
|
||||
var vendingMachineSystem = system.EntityManager.System<VendingMachineSystem>();
|
||||
var inventory = vendingMachineSystem.GetAvailableInventory(owner, vendingcomp);
|
||||
if (inventory.Count <= 0)
|
||||
return;
|
||||
|
||||
@@ -11,7 +11,7 @@ public sealed partial class OpenBehavior : IThresholdBehavior
|
||||
{
|
||||
public void Execute(EntityUid uid, DestructibleSystem system, EntityUid? cause = null)
|
||||
{
|
||||
var openable = EntitySystem.Get<OpenableSystem>();
|
||||
var openable = system.EntityManager.System<OpenableSystem>();
|
||||
openable.TryOpen(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Forensics;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
@@ -30,7 +31,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
|
||||
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
||||
{
|
||||
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
|
||||
var tSys = system.EntityManager.System<TransformSystem>();
|
||||
var position = tSys.GetMapCoordinates(owner);
|
||||
|
||||
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
|
||||
|
||||
@@ -48,7 +50,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
? minMax.Min
|
||||
: system.Random.Next(minMax.Min, minMax.Max + 1);
|
||||
|
||||
if (count == 0) continue;
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
/// <param name="cause"></param>
|
||||
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
||||
{
|
||||
var solutionContainerSystem = EntitySystem.Get<SolutionContainerSystem>();
|
||||
var spillableSystem = EntitySystem.Get<PuddleSystem>();
|
||||
var solutionContainerSystem = system.EntityManager.System<SolutionContainerSystem>();
|
||||
var spillableSystem = system.EntityManager.System<PuddleSystem>();
|
||||
|
||||
var coordinates = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Content.Server.Disposal.Tube
|
||||
[Dependency] private readonly DisposableSystem _disposableSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -422,7 +423,7 @@ namespace Content.Server.Disposal.Tube
|
||||
return false;
|
||||
|
||||
var xform = Transform(uid);
|
||||
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, xform.MapPosition);
|
||||
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, _transform.GetMapCoordinates(uid, xform: xform));
|
||||
var holderComponent = Comp<DisposalHolderComponent>(holder);
|
||||
|
||||
foreach (var entity in from.Container.ContainedEntities.ToArray())
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace Content.Server.Disposal.Unit.EntitySystems;
|
||||
public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
||||
{
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
|
||||
@@ -210,10 +209,11 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
var query = EntityQueryEnumerator<DisposalUnitComponent, MetaDataComponent>();
|
||||
var query = AllEntityQuery<DisposalUnitComponent, MetaDataComponent>();
|
||||
while (query.MoveNext(out var uid, out var unit, out var metadata))
|
||||
{
|
||||
Update(uid, unit, metadata, frameTime);
|
||||
if (!metadata.EntityPaused)
|
||||
Update(uid, unit, metadata, frameTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ public sealed partial class DragonSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
|
||||
var carpUid = Spawn(component.RiftPrototype, _transform.GetMapCoordinates(uid, xform: xform));
|
||||
component.Rifts.Add(carpUid);
|
||||
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Radio;
|
||||
using Content.Server.SurveillanceCamera;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Emp;
|
||||
@@ -11,6 +12,7 @@ namespace Content.Server.Emp;
|
||||
public sealed class EmpSystem : SharedEmpSystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public const string EmpPulseEffectPrototype = "EffectEmpPulse";
|
||||
|
||||
@@ -102,7 +104,7 @@ public sealed class EmpSystem : SharedEmpSystem
|
||||
|
||||
private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
|
||||
{
|
||||
EmpPulse(Transform(uid).MapPosition, comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
||||
EmpPulse(_transform.GetMapCoordinates(uid), comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Coordinates.Helpers;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
@@ -15,6 +16,7 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapMan = default!;
|
||||
[Dependency] private readonly SmokeSystem _smoke = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -26,14 +28,15 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
||||
private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args)
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
if (!_mapMan.TryFindGridAt(xform.MapPosition, out _, out var grid) ||
|
||||
var mapCoords = _transform.GetMapCoordinates(uid, xform);
|
||||
if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) ||
|
||||
!grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
|
||||
tileRef.Tile.IsSpace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var coords = grid.MapToGrid(xform.MapPosition);
|
||||
var coords = grid.MapToGrid(mapCoords);
|
||||
var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
|
||||
if (!TryComp<SmokeComponent>(ent, out var smoke))
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.Fluids.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -31,6 +32,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -161,7 +163,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
|
||||
puddles.Clear();
|
||||
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, drain.Range))
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(_transform.GetMapCoordinates(uid, xform), drain.Range))
|
||||
{
|
||||
// No InRangeUnobstructed because there's no collision group that fits right now
|
||||
// and these are placed by mappers and not buildable/movable so shouldnt really be a problem...
|
||||
|
||||
@@ -712,7 +712,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
|
||||
{
|
||||
var (reagent, quantity) = solution.Contents[i];
|
||||
var proto = _prototypeManager.Index<ReagentPrototype>(reagent.Prototype);
|
||||
var removed = proto.ReactionTile(tileRef, quantity);
|
||||
var removed = proto.ReactionTile(tileRef, quantity, EntityManager);
|
||||
if (removed <= FixedPoint2.Zero)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ public sealed class SmokeSystem : EntitySystem
|
||||
continue;
|
||||
|
||||
var reagent = _prototype.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype);
|
||||
reagent.ReactionTile(tile, reagentQuantity.Quantity);
|
||||
reagent.ReactionTile(tile, reagentQuantity.Quantity, EntityManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
sealed class DelayStartCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "delaystart";
|
||||
public string Description => "Delays the round start.";
|
||||
public string Help => $"Usage: {Command} <seconds>\nPauses/Resumes the countdown if no argument is provided.";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
|
||||
@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
sealed class EndRoundCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "endround";
|
||||
public string Description => "Ends the round and moves the server to PostRound.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
|
||||
if (ticker.RunLevel != GameRunLevel.InRound)
|
||||
{
|
||||
|
||||
@@ -10,13 +10,15 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
sealed class ForcePresetCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "forcepreset";
|
||||
public string Description => "Forces a specific game preset to start for the current lobby.";
|
||||
public string Help => $"Usage: {Command} <preset>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
public sealed class GoLobbyCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "golobby";
|
||||
public string Description => "Enables the lobby and restarts the round.";
|
||||
public string Help => $"Usage: {Command} / {Command} <preset>";
|
||||
@@ -18,7 +20,7 @@ namespace Content.Server.GameTicking.Commands
|
||||
GamePresetPrototype? preset = null;
|
||||
var presetName = string.Join(" ", args);
|
||||
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
|
||||
if (args.Length > 0)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AnyCommand]
|
||||
sealed class ObserveCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "observe";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
@@ -18,7 +20,7 @@ namespace Content.Server.GameTicking.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
|
||||
if (ticker.RunLevel == GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
|
||||
@@ -8,13 +8,15 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
public sealed class RestartRoundCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "restartround";
|
||||
public string Description => "Ends the current round and starts the countdown for the next lobby.";
|
||||
public string Help => string.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
|
||||
if (ticker.RunLevel != GameRunLevel.InRound)
|
||||
{
|
||||
@@ -22,20 +24,22 @@ namespace Content.Server.GameTicking.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<RoundEndSystem>().EndRound();
|
||||
_e.System<RoundEndSystem>().EndRound();
|
||||
}
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
public sealed class RestartRoundNowCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "restartroundnow";
|
||||
public string Description => "Moves the server from PostRound to a new PreRoundLobby.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
EntitySystem.Get<GameTicker>().RestartRound();
|
||||
_e.System<GameTicker>().RestartRound();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
sealed class StartRoundCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "startround";
|
||||
public string Description => "Ends PreRoundLobby state and starts the round.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Content.Server.GameTicking.Commands
|
||||
[AnyCommand]
|
||||
sealed class ToggleReadyCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "toggleready";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
@@ -23,7 +25,7 @@ namespace Content.Server.GameTicking.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var ticker = EntitySystem.Get<GameTicker>();
|
||||
var ticker = _e.System<GameTicker>();
|
||||
ticker.ToggleReady(player, bool.Parse(args[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,35 +274,13 @@ namespace Content.Server.GameTicking
|
||||
}
|
||||
}
|
||||
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var coords = _transform.GetMoverCoordinates(position, xformQuery);
|
||||
|
||||
var ghost = Spawn(ObserverPrototypeName, coords);
|
||||
|
||||
// Try setting the ghost entity name to either the character name or the player name.
|
||||
// If all else fails, it'll default to the default entity prototype name, "observer".
|
||||
// However, that should rarely happen.
|
||||
if (!string.IsNullOrWhiteSpace(mind.CharacterName))
|
||||
_metaData.SetEntityName(ghost, mind.CharacterName);
|
||||
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
|
||||
_metaData.SetEntityName(ghost, mind.Session.Name);
|
||||
|
||||
var ghostComponent = Comp<GhostComponent>(ghost);
|
||||
|
||||
if (mind.TimeOfDeath.HasValue)
|
||||
{
|
||||
_ghost.SetTimeOfDeath(ghost, mind.TimeOfDeath!.Value, ghostComponent);
|
||||
}
|
||||
var ghost = _ghost.SpawnGhost((mindId, mind), position, canReturn);
|
||||
if (ghost == null)
|
||||
return false;
|
||||
|
||||
if (playerEntity != null)
|
||||
_adminLogger.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} ghosted{(!canReturn ? " (non-returnable)" : "")}");
|
||||
|
||||
_ghost.SetCanReturnToBody(ghostComponent, canReturn);
|
||||
|
||||
if (canReturn)
|
||||
_mind.Visit(mindId, ghost, mind);
|
||||
else
|
||||
_mind.TransferTo(mindId, ghost, mind: mind);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Server.Speech.Components;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
@@ -96,8 +97,7 @@ namespace Content.Server.GameTicking
|
||||
if (job == null)
|
||||
{
|
||||
var playerSession = _playerManager.GetSessionById(netUser);
|
||||
_chatManager.DispatchServerMessage(playerSession,
|
||||
Loc.GetString("job-not-available-wait-in-lobby"));
|
||||
_chatManager.DispatchServerMessage(playerSession, Loc.GetString("job-not-available-wait-in-lobby"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -316,10 +316,7 @@ namespace Content.Server.GameTicking
|
||||
/// <param name="station">The station they're spawning on</param>
|
||||
/// <param name="jobId">An optional job for them to spawn as</param>
|
||||
/// <param name="silent">Whether or not the player should be greeted upon joining</param>
|
||||
public void MakeJoinGame(ICommonSession player,
|
||||
EntityUid station,
|
||||
string? jobId = null,
|
||||
bool silent = false)
|
||||
public void MakeJoinGame(ICommonSession player, EntityUid station, string? jobId = null, bool silent = false)
|
||||
{
|
||||
if (!_playerGameStatuses.ContainsKey(player.UserId))
|
||||
return;
|
||||
@@ -352,42 +349,29 @@ namespace Content.Server.GameTicking
|
||||
if (DummyTicker)
|
||||
return;
|
||||
|
||||
var mind = player.GetMind();
|
||||
Entity<MindComponent?>? mind = player.GetMind();
|
||||
if (mind == null)
|
||||
{
|
||||
mind = _mind.CreateMind(player.UserId);
|
||||
var name = GetPlayerProfile(player).Name;
|
||||
var (mindId, mindComp) = _mind.CreateMind(player.UserId, name);
|
||||
mind = (mindId, mindComp);
|
||||
_mind.SetUserId(mind.Value, player.UserId);
|
||||
_roles.MindAddRole(mind.Value, new ObserverRoleComponent());
|
||||
}
|
||||
|
||||
var name = GetPlayerProfile(player).Name;
|
||||
var ghost = SpawnObserverMob();
|
||||
_metaData.SetEntityName(ghost, name);
|
||||
_ghost.SetCanReturnToBody(ghost, false);
|
||||
_mind.TransferTo(mind.Value, ghost);
|
||||
var ghost = _ghost.SpawnGhost(mind.Value);
|
||||
_adminLogger.Add(LogType.LateJoin,
|
||||
LogImpact.Low,
|
||||
$"{player.Name} late joined the round as an Observer with {ToPrettyString(ghost):entity}.");
|
||||
}
|
||||
|
||||
#region Mob Spawning Helpers
|
||||
|
||||
private EntityUid SpawnObserverMob()
|
||||
{
|
||||
var coordinates = GetObserverSpawnPoint();
|
||||
return EntityManager.SpawnEntity(ObserverPrototypeName, coordinates);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Spawn Points
|
||||
|
||||
public EntityCoordinates GetObserverSpawnPoint()
|
||||
{
|
||||
_possiblePositions.Clear();
|
||||
|
||||
foreach (var (point, transform) in EntityManager
|
||||
.EntityQuery<SpawnPointComponent, TransformComponent>(true))
|
||||
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, TransformComponent>(true))
|
||||
{
|
||||
if (point.SpawnType != SpawnPointType.Observer)
|
||||
continue;
|
||||
@@ -403,7 +387,7 @@ namespace Content.Server.GameTicking
|
||||
var query = AllEntityQuery<MapGridComponent>();
|
||||
while (query.MoveNext(out var uid, out var grid))
|
||||
{
|
||||
if (!metaQuery.TryGetComponent(uid, out var meta) || meta.EntityPaused)
|
||||
if (!metaQuery.TryGetComponent(uid, out var meta) || meta.EntityPaused || TerminatingOrDeleted(uid))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -440,7 +424,9 @@ namespace Content.Server.GameTicking
|
||||
{
|
||||
var mapUid = _mapManager.GetMapEntityId(map);
|
||||
|
||||
if (!metaQuery.TryGetComponent(mapUid, out var meta) || meta.EntityPaused)
|
||||
if (!metaQuery.TryGetComponent(mapUid, out var meta)
|
||||
|| meta.EntityPaused
|
||||
|| TerminatingOrDeleted(mapUid))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Content.Server.Maps;
|
||||
using Content.Shared.GridPreloader.Prototypes;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -16,11 +18,14 @@ public sealed partial class LoadMapRuleComponent : Component
|
||||
public MapId? Map;
|
||||
|
||||
[DataField]
|
||||
public ProtoId<GameMapPrototype>? GameMap ;
|
||||
public ProtoId<GameMapPrototype>? GameMap;
|
||||
|
||||
[DataField]
|
||||
public ResPath? MapPath;
|
||||
|
||||
[DataField]
|
||||
public ProtoId<PreloadedGridPrototype>? PreloadedGrid;
|
||||
|
||||
[DataField]
|
||||
public List<EntityUid> MapGrids = new();
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ public sealed partial class TraitorRuleComponent : Component
|
||||
[DataField]
|
||||
public ProtoId<DatasetPrototype> CodewordVerbs = "verbs";
|
||||
|
||||
[DataField]
|
||||
public ProtoId<DatasetPrototype> ObjectiveIssuers = "TraitorCorporations";
|
||||
|
||||
public int TotalTraitors => TraitorMinds.Count;
|
||||
public string[] Codewords = new string[3];
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Server.RoundEnd;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Points;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -25,6 +26,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
||||
[Dependency] private readonly RespawnRuleSystem _respawn = default!;
|
||||
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
||||
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -97,7 +99,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
||||
_point.AdjustPointValue(assist.PlayerId, 1, uid, point);
|
||||
|
||||
var spawns = EntitySpawnCollection.GetSpawns(dm.RewardSpawns).Cast<string?>().ToList();
|
||||
EntityManager.SpawnEntities(Transform(ev.Entity).MapPosition, spawns);
|
||||
EntityManager.SpawnEntities(_transform.GetMapCoordinates(ev.Entity), spawns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Content.Server.Antag;
|
||||
using Content.Server.GameTicking.Components;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.GridPreloader;
|
||||
using Content.Server.Spawners.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules;
|
||||
@@ -11,9 +13,12 @@ namespace Content.Server.GameTicking.Rules;
|
||||
public sealed class LoadMapRuleSystem : GameRuleSystem<LoadMapRuleComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly MapSystem _map = default!;
|
||||
[Dependency] private readonly MapLoaderSystem _mapLoader = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly GridPreloaderSystem _gridPreloader = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -41,7 +46,9 @@ public sealed class LoadMapRuleSystem : GameRuleSystem<LoadMapRuleComponent>
|
||||
if (comp.Map != null)
|
||||
return;
|
||||
|
||||
_map.CreateMap(out var mapId);
|
||||
// grid preloading needs map to init after moving it
|
||||
var mapUid = comp.PreloadedGrid != null ? _map.CreateMap(out var mapId, false) : _map.CreateMap(out mapId);
|
||||
_metaData.SetEntityName(mapUid, $"LoadMapRule destination for rule {ToPrettyString(uid)}");
|
||||
comp.Map = mapId;
|
||||
|
||||
if (comp.GameMap != null)
|
||||
@@ -51,8 +58,29 @@ public sealed class LoadMapRuleSystem : GameRuleSystem<LoadMapRuleComponent>
|
||||
}
|
||||
else if (comp.MapPath != null)
|
||||
{
|
||||
if (_mapLoader.TryLoad(comp.Map.Value, comp.MapPath.Value.ToString(), out var roots, new MapLoadOptions { LoadMap = true }))
|
||||
comp.MapGrids.AddRange(roots);
|
||||
if (!_mapLoader.TryLoad(comp.Map.Value,
|
||||
comp.MapPath.Value.ToString(),
|
||||
out var roots,
|
||||
new MapLoadOptions { LoadMap = true }))
|
||||
{
|
||||
_mapManager.DeleteMap(mapId);
|
||||
return;
|
||||
}
|
||||
|
||||
comp.MapGrids.AddRange(roots);
|
||||
}
|
||||
else if (comp.PreloadedGrid != null)
|
||||
{
|
||||
// TODO: If there are no preloaded grids left, any rule announcements will still go off!
|
||||
if (!_gridPreloader.TryGetPreloadedGrid(comp.PreloadedGrid.Value, out var loadedShuttle))
|
||||
{
|
||||
_mapManager.DeleteMap(mapId);
|
||||
return;
|
||||
}
|
||||
|
||||
_transform.SetParent(loadedShuttle.Value, mapUid);
|
||||
comp.MapGrids.Add(loadedShuttle.Value);
|
||||
_map.InitializeMap(mapId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ using Content.Shared.Zombies;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Server.GameTicking.Components;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules;
|
||||
|
||||
@@ -179,7 +180,7 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
||||
commandList.Add(id);
|
||||
}
|
||||
|
||||
return IsGroupDead(commandList, true);
|
||||
return IsGroupDetainedOrDead(commandList, true, true);
|
||||
}
|
||||
|
||||
private void OnHeadRevMobStateChanged(EntityUid uid, HeadRevolutionaryComponent comp, MobStateChangedEvent ev)
|
||||
@@ -203,7 +204,8 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
||||
}
|
||||
|
||||
// If no Head Revs are alive all normal Revs will lose their Rev status and rejoin Nanotrasen
|
||||
if (IsGroupDead(headRevList, false))
|
||||
// Cuffing Head Revs is not enough - they must be killed.
|
||||
if (IsGroupDetainedOrDead(headRevList, false, false))
|
||||
{
|
||||
var rev = AllEntityQuery<RevolutionaryComponent, MindContainerComponent>();
|
||||
while (rev.MoveNext(out var uid, out _, out var mc))
|
||||
@@ -235,35 +237,43 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will take a group of entities and check if they are all alive or dead
|
||||
/// Will take a group of entities and check if these entities are alive, dead or cuffed.
|
||||
/// </summary>
|
||||
/// <param name="list">The list of the entities</param>
|
||||
/// <param name="checkOffStation">Bool for if you want to check if someone is in space and consider them dead. (Won't check when emergency shuttle arrives just in case)</param>
|
||||
/// <param name="checkOffStation">Bool for if you want to check if someone is in space and consider them missing in action. (Won't check when emergency shuttle arrives just in case)</param>
|
||||
/// <param name="countCuffed">Bool for if you don't want to count cuffed entities.</param>
|
||||
/// <returns></returns>
|
||||
private bool IsGroupDead(List<EntityUid> list, bool checkOffStation)
|
||||
private bool IsGroupDetainedOrDead(List<EntityUid> list, bool checkOffStation, bool countCuffed)
|
||||
{
|
||||
var dead = 0;
|
||||
var gone = 0;
|
||||
foreach (var entity in list)
|
||||
{
|
||||
if (TryComp<MobStateComponent>(entity, out var state))
|
||||
if (TryComp<CuffableComponent>(entity, out var cuffed) && cuffed.CuffedHandCount > 0 && countCuffed)
|
||||
{
|
||||
if (state.CurrentState == MobState.Dead || state.CurrentState == MobState.Invalid)
|
||||
{
|
||||
dead++;
|
||||
}
|
||||
else if (checkOffStation && _stationSystem.GetOwningStation(entity) == null && !_emergencyShuttle.EmergencyShuttleArrived)
|
||||
{
|
||||
dead++;
|
||||
}
|
||||
gone++;
|
||||
}
|
||||
//If they don't have the MobStateComponent they might as well be dead.
|
||||
else
|
||||
{
|
||||
dead++;
|
||||
if (TryComp<MobStateComponent>(entity, out var state))
|
||||
{
|
||||
if (state.CurrentState == MobState.Dead || state.CurrentState == MobState.Invalid)
|
||||
{
|
||||
gone++;
|
||||
}
|
||||
else if (checkOffStation && _stationSystem.GetOwningStation(entity) == null && !_emergencyShuttle.EmergencyShuttleArrived)
|
||||
{
|
||||
gone++;
|
||||
}
|
||||
}
|
||||
//If they don't have the MobStateComponent they might as well be dead.
|
||||
else
|
||||
{
|
||||
gone++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dead == list.Count || list.Count == 0;
|
||||
return gone == list.Count || list.Count == 0;
|
||||
}
|
||||
|
||||
private static readonly string[] Outcomes =
|
||||
|
||||
@@ -74,6 +74,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
return false;
|
||||
|
||||
var briefing = Loc.GetString("traitor-role-codewords-short", ("codewords", string.Join(", ", component.Codewords)));
|
||||
var issuer = _random.Pick(_prototypeManager.Index(component.ObjectiveIssuers).Values);
|
||||
|
||||
Note[]? code = null;
|
||||
if (giveUplink)
|
||||
@@ -97,7 +98,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
Loc.GetString("traitor-role-uplink-code-short", ("code", string.Join("-", code).Replace("sharp", "#"))));
|
||||
}
|
||||
|
||||
_antag.SendBriefing(traitor, GenerateBriefing(component.Codewords, code), null, component.GreetSoundNotification);
|
||||
_antag.SendBriefing(traitor, GenerateBriefing(component.Codewords, code, issuer), null, component.GreetSoundNotification);
|
||||
|
||||
component.TraitorMinds.Add(mindId);
|
||||
|
||||
@@ -142,10 +143,10 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
args.Text += "\n" + Loc.GetString("traitor-round-end-codewords", ("codewords", string.Join(", ", comp.Codewords)));
|
||||
}
|
||||
|
||||
private string GenerateBriefing(string[] codewords, Note[]? uplinkCode)
|
||||
private string GenerateBriefing(string[] codewords, Note[]? uplinkCode, string? objectiveIssuer = null)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine(Loc.GetString("traitor-role-greeting"));
|
||||
sb.AppendLine(Loc.GetString("traitor-role-greeting", ("corporation", objectiveIssuer ?? Loc.GetString("objective-issuer-unknown"))));
|
||||
sb.AppendLine(Loc.GetString("traitor-role-codewords-short", ("codewords", string.Join(", ", codewords))));
|
||||
if (uplinkCode != null)
|
||||
sb.AppendLine(Loc.GetString("traitor-role-uplink-code-short", ("code", string.Join("-", uplinkCode).Replace("sharp", "#"))));
|
||||
|
||||
@@ -35,7 +35,7 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PendingZombieComponent, ZombifySelfActionEvent>(OnZombifySelf);
|
||||
SubscribeLocalEvent<IncurableZombieComponent, ZombifySelfActionEvent>(OnZombifySelf);
|
||||
}
|
||||
|
||||
protected override void AppendRoundEndText(EntityUid uid, ZombieRuleComponent component, GameRuleComponent gameRule,
|
||||
@@ -128,7 +128,7 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
component.NextRoundEndCheck = _timing.CurTime + component.EndCheckDelay;
|
||||
}
|
||||
|
||||
private void OnZombifySelf(EntityUid uid, PendingZombieComponent component, ZombifySelfActionEvent args)
|
||||
private void OnZombifySelf(EntityUid uid, IncurableZombieComponent component, ZombifySelfActionEvent args)
|
||||
{
|
||||
_zombie.ZombifyEntity(uid);
|
||||
if (component.Action != null)
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.EntityList;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -18,6 +19,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
||||
[Dependency] private readonly DestructibleSystem _destructible = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -61,7 +63,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
||||
if (component.MappedLoot == null)
|
||||
return;
|
||||
|
||||
var pos = Transform(gatheredUid).MapPosition;
|
||||
var pos = _transform.GetMapCoordinates(gatheredUid);
|
||||
|
||||
foreach (var (tag, table) in component.MappedLoot)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Content.Server.Geras;
|
||||
public sealed class GerasSystem : SharedGerasSystem
|
||||
{
|
||||
[Dependency] private readonly PolymorphSystem _polymorphSystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaDataSystem = default!;
|
||||
[Dependency] private readonly ActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Shared.Console;
|
||||
@@ -11,15 +12,25 @@ namespace Content.Server.Ghost
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
|
||||
public string Command => "ghost";
|
||||
public string Description => "Give up on life and become a ghost.";
|
||||
public string Help => "ghost";
|
||||
public string Description => Loc.GetString("ghost-command-description");
|
||||
public string Help => Loc.GetString("ghost-command-help-text");
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("You have no session, you can't ghost.");
|
||||
shell.WriteLine(Loc.GetString("ghost-command-no-session"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity is { Valid: true } frozen &&
|
||||
_entities.HasComponent<AdminFrozenComponent>(frozen))
|
||||
{
|
||||
var deniedMessage = Loc.GetString("ghost-command-denied");
|
||||
shell.WriteLine(deniedMessage);
|
||||
_entities.System<PopupSystem>()
|
||||
.PopupEntity(deniedMessage, frozen, frozen);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,9 +41,9 @@ namespace Content.Server.Ghost
|
||||
mind = _entities.GetComponent<MindComponent>(mindId);
|
||||
}
|
||||
|
||||
if (!EntitySystem.Get<GameTicker>().OnGhostAttempt(mindId, true, true, mind))
|
||||
if (!_entities.System<GameTicker>().OnGhostAttempt(mindId, true, true, mind))
|
||||
{
|
||||
shell.WriteLine("You can't ghost right now.");
|
||||
shell.WriteLine(Loc.GetString("ghost-command-denied"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Player;
|
||||
@@ -42,6 +43,7 @@ namespace Content.Server.Ghost
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
|
||||
private EntityQuery<GhostComponent> _ghostQuery;
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
@@ -75,6 +77,7 @@ namespace Content.Server.Ghost
|
||||
SubscribeLocalEvent<GhostComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt);
|
||||
|
||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => MakeVisible(true));
|
||||
SubscribeLocalEvent<ToggleGhostVisibilityToAllEvent>(OnToggleGhostVisibilityToAll);
|
||||
}
|
||||
|
||||
private void OnGhostHearingAction(EntityUid uid, GhostComponent component, ToggleGhostHearingActionEvent args)
|
||||
@@ -360,6 +363,15 @@ namespace Content.Server.Ghost
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnToggleGhostVisibilityToAll(ToggleGhostVisibilityToAllEvent ev)
|
||||
{
|
||||
if (ev.Handled)
|
||||
return;
|
||||
|
||||
ev.Handled = true;
|
||||
MakeVisible(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the round ends, make all players able to see ghosts.
|
||||
/// </summary>
|
||||
@@ -389,5 +401,59 @@ namespace Content.Server.Ghost
|
||||
|
||||
return ghostBoo.Handled;
|
||||
}
|
||||
|
||||
public EntityUid? SpawnGhost(Entity<MindComponent?> mind, EntityUid targetEntity,
|
||||
bool canReturn = false)
|
||||
{
|
||||
_transformSystem.TryGetMapOrGridCoordinates(targetEntity, out var spawnPosition);
|
||||
return SpawnGhost(mind, spawnPosition, canReturn);
|
||||
}
|
||||
|
||||
public EntityUid? SpawnGhost(Entity<MindComponent?> mind, EntityCoordinates? spawnPosition = null,
|
||||
bool canReturn = false)
|
||||
{
|
||||
if (!Resolve(mind, ref mind.Comp))
|
||||
return null;
|
||||
|
||||
// Test if the map is being deleted
|
||||
var mapUid = spawnPosition?.GetMapUid(EntityManager);
|
||||
if (mapUid == null || TerminatingOrDeleted(mapUid.Value))
|
||||
spawnPosition = null;
|
||||
|
||||
spawnPosition ??= _ticker.GetObserverSpawnPoint();
|
||||
|
||||
if (!spawnPosition.Value.IsValid(EntityManager))
|
||||
{
|
||||
Log.Warning($"No spawn valid ghost spawn position found for {mind.Comp.CharacterName}"
|
||||
+ " \"{ToPrettyString(mind)}\"");
|
||||
_minds.TransferTo(mind.Owner, null, createGhost: false, mind: mind.Comp);
|
||||
return null;
|
||||
}
|
||||
|
||||
var ghost = SpawnAtPosition(GameTicker.ObserverPrototypeName, spawnPosition.Value);
|
||||
var ghostComponent = Comp<GhostComponent>(ghost);
|
||||
|
||||
// Try setting the ghost entity name to either the character name or the player name.
|
||||
// If all else fails, it'll default to the default entity prototype name, "observer".
|
||||
// However, that should rarely happen.
|
||||
if (!string.IsNullOrWhiteSpace(mind.Comp.CharacterName))
|
||||
_metaData.SetEntityName(ghost, mind.Comp.CharacterName);
|
||||
else if (!string.IsNullOrWhiteSpace(mind.Comp.Session?.Name))
|
||||
_metaData.SetEntityName(ghost, mind.Comp.Session.Name);
|
||||
|
||||
if (mind.Comp.TimeOfDeath.HasValue)
|
||||
{
|
||||
SetTimeOfDeath(ghost, mind.Comp.TimeOfDeath!.Value, ghostComponent);
|
||||
}
|
||||
|
||||
SetCanReturnToBody(ghostComponent, canReturn);
|
||||
|
||||
if (canReturn)
|
||||
_minds.Visit(mind.Owner, ghost, mind.Comp);
|
||||
else
|
||||
_minds.TransferTo(mind.Owner, ghost, mind: mind.Comp);
|
||||
Log.Debug($"Spawned ghost \"{ToPrettyString(ghost)}\" for {mind.Comp.CharacterName}.");
|
||||
return ghost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
set
|
||||
{
|
||||
_roleName = value;
|
||||
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
||||
IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
set
|
||||
{
|
||||
_roleDescription = value;
|
||||
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
||||
IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
set
|
||||
{
|
||||
_roleRules = value;
|
||||
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
||||
IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Collections;
|
||||
|
||||
namespace Content.Server.Ghost.Roles
|
||||
@@ -792,13 +791,15 @@ namespace Content.Server.Ghost.Roles
|
||||
[AnyCommand]
|
||||
public sealed class GhostRoles : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
||||
public string Command => "ghostroles";
|
||||
public string Description => "Opens the ghost role request window.";
|
||||
public string Help => $"{Command}";
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player != null)
|
||||
EntitySystem.Get<GhostRoleSystem>().OpenEui(shell.Player);
|
||||
_e.System<GhostRoleSystem>().OpenEui(shell.Player);
|
||||
else
|
||||
shell.WriteLine("You can only open the ghost roles UI on a client.");
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Server.Ghost.Roles.UI
|
||||
{
|
||||
public sealed class GhostRolesEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly GhostRoleSystem _ghostRoleSystem;
|
||||
private readonly GhostRoleSystem _ghostRoleSystem;
|
||||
|
||||
public GhostRolesEui()
|
||||
{
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.Ghost.Roles.UI
|
||||
{
|
||||
base.Closed();
|
||||
|
||||
EntitySystem.Get<GhostRoleSystem>().CloseEui(Player);
|
||||
_ghostRoleSystem.CloseEui(Player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
Content.Server/GridPreloader/GridPreloaderComponent.cs
Normal file
16
Content.Server/GridPreloader/GridPreloaderComponent.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Content.Shared.GridPreloader.Prototypes;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GridPreloader;
|
||||
|
||||
/// <summary>
|
||||
/// Component storing data about preloaded grids and their location
|
||||
/// Goes on the map entity
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(GridPreloaderSystem))]
|
||||
public sealed partial class GridPreloaderComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public Dictionary<ProtoId<PreloadedGridPrototype>, List<EntityUid>> PreloadedGrids = new();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user