add tile pry and place logs (#17461)
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Content.Server.Fluids.Components;
|
using Content.Server.Fluids.Components;
|
||||||
using Content.Server.Tools.Components;
|
using Content.Server.Tools.Components;
|
||||||
|
using Content.Shared.Administration.Logs;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Fluids.Components;
|
using Content.Shared.Fluids.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
@@ -44,6 +46,17 @@ public sealed partial class ToolSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tile = grid.GetTileRef(args.Coordinates);
|
var tile = grid.GetTileRef(args.Coordinates);
|
||||||
|
if (args.Used != null)
|
||||||
|
{
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||||
|
$"{ToPrettyString(args.User):actor} used {ToPrettyString(args.Used.Value):tool} to pry {_tileDefinitionManager[tile.Tile.TypeId].Name} at {ToPrettyString(tile.GridUid):grid} {tile.GridPosition()}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||||
|
$"{ToPrettyString(args.User):actor} pried {_tileDefinitionManager[tile.Tile.TypeId].Name} at {ToPrettyString(tile.GridUid):grid} {tile.GridPosition()}");
|
||||||
|
}
|
||||||
|
|
||||||
_tile.PryTile(tile);
|
_tile.PryTile(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
@@ -24,6 +26,7 @@ public sealed class FloorTileSystem : EntitySystem
|
|||||||
[Dependency] private readonly INetManager _netManager = default!;
|
[Dependency] private readonly INetManager _netManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
@@ -91,10 +94,11 @@ public sealed class FloorTileSystem : EntitySystem
|
|||||||
|
|
||||||
if (mapGrid != null)
|
if (mapGrid != null)
|
||||||
{
|
{
|
||||||
|
var gridUid = mapGrid.Owner;
|
||||||
var ev = new FloorTileAttemptEvent();
|
var ev = new FloorTileAttemptEvent();
|
||||||
RaiseLocalEvent(mapGrid);
|
RaiseLocalEvent(mapGrid);
|
||||||
|
|
||||||
if (HasComp<ProtectedGridComponent>(mapGrid.Owner) || ev.Cancelled)
|
if (HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled)
|
||||||
{
|
{
|
||||||
if (_netManager.IsClient && _timing.IsFirstTimePredicted)
|
if (_netManager.IsClient && _timing.IsFirstTimePredicted)
|
||||||
_popup.PopupEntity(Loc.GetString("invalid-floor-placement"), args.User);
|
_popup.PopupEntity(Loc.GetString("invalid-floor-placement"), args.User);
|
||||||
@@ -110,7 +114,7 @@ public sealed class FloorTileSystem : EntitySystem
|
|||||||
if (!_stackSystem.Use(uid, 1, stack))
|
if (!_stackSystem.Use(uid, 1, stack))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PlaceAt(args.User, mapGrid, location, currentTileDefinition.TileId, component.PlaceTileSound);
|
PlaceAt(args.User, gridUid, mapGrid, location, currentTileDefinition.TileId, component.PlaceTileSound);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -125,10 +129,11 @@ public sealed class FloorTileSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mapGrid = _mapManager.CreateGrid(locationMap.MapId);
|
mapGrid = _mapManager.CreateGrid(locationMap.MapId);
|
||||||
var gridXform = Transform(mapGrid.Owner);
|
var gridUid = mapGrid.Owner;
|
||||||
|
var gridXform = Transform(gridUid);
|
||||||
_transform.SetWorldPosition(gridXform, locationMap.Position);
|
_transform.SetWorldPosition(gridXform, locationMap.Position);
|
||||||
location = new EntityCoordinates(mapGrid.Owner, Vector2.Zero);
|
location = new EntityCoordinates(gridUid, Vector2.Zero);
|
||||||
PlaceAt(args.User, mapGrid, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, mapGrid.TileSize / 2f);
|
PlaceAt(args.User, gridUid, mapGrid, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, mapGrid.TileSize / 2f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,8 +144,11 @@ public sealed class FloorTileSystem : EntitySystem
|
|||||||
return tileDef.BaseTurf == baseTurf;
|
return tileDef.BaseTurf == baseTurf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlaceAt(EntityUid user, MapGridComponent mapGrid, EntityCoordinates location, ushort tileId, SoundSpecifier placeSound, float offset = 0)
|
private void PlaceAt(EntityUid user, EntityUid gridUid, MapGridComponent mapGrid, EntityCoordinates location,
|
||||||
|
ushort tileId, SoundSpecifier placeSound, float offset = 0)
|
||||||
{
|
{
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(user):actor} placed tile {_tileDefinitionManager[tileId].Name} at {ToPrettyString(gridUid)} {location}");
|
||||||
|
|
||||||
var variant = _random.Pick(((ContentTileDefinition) _tileDefinitionManager[tileId]).PlacementVariants);
|
var variant = _random.Pick(((ContentTileDefinition) _tileDefinitionManager[tileId]).PlacementVariants);
|
||||||
mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant));
|
mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user