Skip to content

Commit

Permalink
Update RCDSystem.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 committed Nov 4, 2023
1 parent 40b1e3a commit 4aae811
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions Content.Shared/RCD/Systems/RCDSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args)
var gridUid = mapGrid.Owner;
var ev = new FloorTileAttemptEvent();

if (HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled) // Frontier - Remove all RCD use on outpost.
return;

switch (comp.Mode)
{
//Floor mode just needs the tile to be a space tile (subFloor)
Expand All @@ -179,19 +182,16 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args)
break;
//We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check.
case RcdMode.Deconstruct:
if (!(HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled))
if (!IsTileBlocked(tile)) // Delete the turf
{
if (!IsTileBlocked(tile)) // Delete the turf
{
mapGrid.SetTile(snapPos, Tile.Empty);
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridUid} tile: {snapPos} to space");
}
else // Delete the targeted thing
{
var target = args.Target!.Value;
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}");
QueueDel(target);
}
mapGrid.SetTile(snapPos, Tile.Empty);
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridUid} tile: {snapPos} to space");
}
else // Delete the targeted thing
{
var target = args.Target!.Value;
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}");
QueueDel(target);
}
break;
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile,
Expand Down Expand Up @@ -219,11 +219,9 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args)
return; //I don't know why this would happen, but sure I guess. Get out of here invalid state!
}

if (!(HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled))
{
_audio.PlayPredicted(comp.SuccessSound, uid, user);
_charges.UseCharge(uid);
}
_audio.PlayPredicted(comp.SuccessSound, uid, user);
_charges.UseCharge(uid);

args.Handled = true;
}

Expand Down

0 comments on commit 4aae811

Please sign in to comment.