21 lines
785 B
C#
21 lines
785 B
C#
using System.Collections.Generic;
|
|
using Game.Features.Console.Contracts;
|
|
using Game.Features.Players.Contracts;
|
|
|
|
namespace Game.Features.Console.Application.Commands;
|
|
|
|
public sealed class NoclipCommand(IMovementModeSwitcher movementModeSwitcher) : ICommand
|
|
{
|
|
public string Name => "noclip";
|
|
public string Description => "Toggles noclip movement mode.";
|
|
public IReadOnlyList<CommandArgSpec> Args { get; } = [];
|
|
|
|
public CommandResult Execute(CommandArgValues args)
|
|
{
|
|
MovementMode next = movementModeSwitcher.ActiveMovementMode == MovementMode.Noclip ? MovementMode.Ground : MovementMode.Noclip;
|
|
movementModeSwitcher.SetMovementMode(next);
|
|
|
|
return CommandResult.Ok(next == MovementMode.Noclip ? "Noclip enabled." : "Noclip disabled.");
|
|
}
|
|
}
|