Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -12,6 +12,10 @@ namespace Content.Server.Decals.Commands
[AdminCommand(AdminFlags.Mapping)]
public sealed class AddDecalCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
public string Command => "adddecal";
public string Description => "Creates a decal on the map";
public string Help => $"{Command} <id> <x position> <y position> <gridId> [angle=<angle> zIndex=<zIndex> color=<color>]";
@@ -23,7 +27,7 @@ namespace Content.Server.Decals.Commands
return;
}
if (!IoCManager.Resolve<IPrototypeManager>().HasIndex<DecalPrototype>(args[0]))
if (!_protoManager.HasIndex<DecalPrototype>(args[0]))
{
shell.WriteError($"Cannot find decalprototype '{args[0]}'.");
}
@@ -40,8 +44,9 @@ namespace Content.Server.Decals.Commands
return;
}
var mapManager = IoCManager.Resolve<IMapManager>();
if (!EntityUid.TryParse(args[3], out var gridIdRaw) || !mapManager.TryGetGrid(gridIdRaw, out var grid))
if (!NetEntity.TryParse(args[3], out var gridIdNet) ||
!_entManager.TryGetEntity(gridIdNet, out var gridIdRaw) ||
!_mapManager.TryGetGrid(gridIdRaw, out var grid))
{
shell.WriteError($"Failed parsing gridId '{args[3]}'.");
return;
@@ -101,7 +106,7 @@ namespace Content.Server.Decals.Commands
}
}
if(EntitySystem.Get<DecalSystem>().TryAddDecal(args[0], coordinates, out var uid, color, rotation, zIndex))
if (_entManager.System<DecalSystem>().TryAddDecal(args[0], coordinates, out var uid, color, rotation, zIndex))
{
shell.WriteLine($"Successfully created decal {uid}.");
}