Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Added debug command
Browse files Browse the repository at this point in the history
  • Loading branch information
FireNameFN committed Apr 30, 2024
1 parent 612b74c commit cfd8d2d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
using Content.Shared.Interaction.Events;

namespace Content.Server.Corvax.Debug;

public sealed class ArtifactActivatingDebugSystem : EntitySystem
{
public override void Initialize()
{
SubscribeLocalEvent<ThrowArtifactComponent, UseInHandEvent>(OnUseInHand);
}

private void OnUseInHand(EntityUid entity, ThrowArtifactComponent component, UseInHandEvent e)
{
RaiseLocalEvent<ArtifactActivatedEvent>(entity, new());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Server.Administration;
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Content.Shared.Players;
using Robust.Shared.Console;
using Robust.Shared.Map;

namespace Content.Server.Corvax.Debug;

[AdminCommand(AdminFlags.Debug)]
public sealed class SpawnThrowArtifactItemCommand : IConsoleCommand
{
[Dependency] private readonly EntityManager _manager = default!;

public string Command => "spawnthrowartifactitem";

public string Description => "Spawns item that can emit ThrowArtifact.";

public string Help => $"Usage: {Command}";

public void Execute(IConsoleShell console, string arg, string[] args)
{
if (console.Player is null || !_manager.TryGetComponent<MindComponent>(console.Player.GetMind(), out var mind) || mind.CurrentEntity is null)
return;

var entity = _manager.SpawnEntity("ToyNuke", new EntityCoordinates(mind.CurrentEntity.Value, new()));

_manager.AddComponent<ThrowArtifactComponent>(entity);
}
}

0 comments on commit cfd8d2d

Please sign in to comment.