Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions Content.Server/_Scp/ComplexElevator/ComplexElevatorComponent.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
using System.Collections.Generic;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;

namespace Content.Server._Scp.ComplexElevator;
namespace Content.Shared._Scp.ComplexElevator;

[RegisterComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ComplexElevatorComponent : Component
{
[DataField]
public string ElevatorId = string.Empty;

[DataField]
[DataField, AutoNetworkedField]
public string CurrentFloor = "IntermediateFloor";

[DataField]
[DataField, AutoNetworkedField]
public List<string> Floors = new();

[DataField]
public string IntermediateFloorId = "IntermediateFloor";

[DataField]
public bool UseIntermediateFloor = true;

[DataField]
public TimeSpan SendDelay = TimeSpan.FromSeconds(1);

Expand All @@ -41,5 +43,15 @@ public sealed partial class ComplexElevatorComponent : Component
[DataField]
public float DoorBlockCheckRange = 0.6f;

public bool IsMoving = false;
}
[DataField]
public bool TeleportBuckled = true;

[DataField]
public bool TeleportPulled = true;

[DataField]
public bool CrushEntitiesOnArrival = true;

[DataField]
public float CrushDamage = 2000f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using Content.Server.Administration.Managers;
using Content.Shared._Scp.ComplexElevator;
using Content.Shared.Database;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Player;

namespace Content.Server._Scp.ComplexElevator;

public sealed partial class ComplexElevatorSystem
{
[Dependency] private readonly IAdminManager _adminManager = default!;

private void InitializeDebug()
{
SubscribeLocalEvent<ComplexElevatorComponent, GetVerbsEvent<Verb>>(AddAdminElevatorVerbs);
SubscribeLocalEvent<ElevatorPointComponent, GetVerbsEvent<Verb>>(AddAdminPointVerbs);
}
Comment thread
arthu241243 marked this conversation as resolved.

private void AddAdminElevatorVerbs(EntityUid uid, ComplexElevatorComponent comp, GetVerbsEvent<Verb> args)
{
if (!TryComp(args.User, out ActorComponent? actor) || !_adminManager.IsAdmin(actor.PlayerSession))
return;

foreach (var floor in comp.Floors)
{
var targetFloor = floor;
args.Verbs.Add(new Verb
{
Text = $"Send to: {targetFloor}",
Category = VerbCategory.Debug,
Act = () => MoveToFloor((uid, comp), targetFloor),
Impact = LogImpact.Medium
});
}
}

private void AddAdminPointVerbs(EntityUid uid, ElevatorPointComponent comp, GetVerbsEvent<Verb> args)
{
if (!TryComp(args.User, out ActorComponent? actor) || !_adminManager.IsAdmin(actor.PlayerSession))
return;

foreach (var (elevatorUid, elevatorComp) in _elevatorIndex)
{
if (!TryComp<ComplexElevatorComponent>(elevatorComp, out var elevator))
continue;

if (!elevator.Floors.Contains(comp.FloorId))
continue;

var elUid = elevatorComp;
var floorId = comp.FloorId;

args.Verbs.Add(new Verb
{
Text = $"[Elevator: {elevator.ElevatorId}] Send here",
Category = VerbCategory.Debug,
Act = () => MoveToFloor((elUid, elevator), floorId),
Impact = LogImpact.Medium
});

args.Verbs.Add(new Verb
{
Text = $"[Elevator: {elevator.ElevatorId}] Teleport here instantly",
Category = VerbCategory.Debug,
Act = () =>
{
ClearGasInTargetArea(elUid, floorId);
KillEntitiesInTargetArea((elUid, elevator), floorId);
elevator.CurrentFloor = floorId;
Dirty(elUid, elevator);
TeleportToFloor(elUid, floorId, elevator);
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Impact = LogImpact.High
});
}
}
}
Loading
Loading