Files
wwdpublic/Content.Server/GameTicking/Commands/DynamicRuleCommand.cs
Kai5 e097ac1750 Dynamic real (#825)
* Add support for contextual information in EntityTables (#37737)

* Add context support for entityTables

* fix build fail

* comments

* Update Content.Shared/EntityTable/EntityTableSystem.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

(cherry picked from commit e92b6b6a7e2ed2e5f7473321e391394f28b9ee4a)

* Multiantag Gamemode (#37783)

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: Southbridge <7013162+southbridge-fur@users.noreply.github.com>
Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>

(cherry picked from commit f23e8c286153b5742de258a4e722803a1a4fba78)

* Гейммоды

* Ребаланс цен

* Фикс линтера

* Баланс бюджета + фикс повторения

---------

Co-authored-by: Nemanja <98561806+emogarbage404@users.noreply.github.com>
2025-09-03 08:49:15 +03:00

104 lines
3.2 KiB
C#

using System.Linq;
using Content.Server.Administration;
using Content.Server.GameTicking.Rules;
using Content.Shared.Administration;
using Robust.Shared.Prototypes;
using Robust.Shared.Toolshed;
namespace Content.Server.GameTicking.Commands;
[ToolshedCommand, AdminCommand(AdminFlags.Round)]
public sealed class DynamicRuleCommand : ToolshedCommand
{
private DynamicRuleSystem? _dynamicRuleSystem;
[CommandImplementation("list")]
public IEnumerable<EntityUid> List()
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.GetDynamicRules();
}
[CommandImplementation("get")]
public EntityUid Get()
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.GetDynamicRules().FirstOrDefault();
}
[CommandImplementation("budget")]
public IEnumerable<float?> Budget([PipedArgument] IEnumerable<EntityUid> input)
=> input.Select(Budget);
[CommandImplementation("budget")]
public float? Budget([PipedArgument] EntityUid input)
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.GetRuleBudget(input);
}
[CommandImplementation("adjust")]
public IEnumerable<float?> Adjust([PipedArgument] IEnumerable<EntityUid> input, float value)
=> input.Select(i => Adjust(i,value));
[CommandImplementation("adjust")]
public float? Adjust([PipedArgument] EntityUid input, float value)
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.AdjustBudget(input, value);
}
[CommandImplementation("set")]
public IEnumerable<float?> Set([PipedArgument] IEnumerable<EntityUid> input, float value)
=> input.Select(i => Set(i,value));
[CommandImplementation("set")]
public float? Set([PipedArgument] EntityUid input, float value)
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.SetBudget(input, value);
}
[CommandImplementation("dryrun")]
public IEnumerable<IEnumerable<EntProtoId>> DryRun([PipedArgument] IEnumerable<EntityUid> input)
=> input.Select(DryRun);
[CommandImplementation("dryrun")]
public IEnumerable<EntProtoId> DryRun([PipedArgument] EntityUid input)
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.DryRun(input);
}
[CommandImplementation("executenow")]
public IEnumerable<IEnumerable<EntityUid>> ExecuteNow([PipedArgument] IEnumerable<EntityUid> input)
=> input.Select(ExecuteNow);
[CommandImplementation("executenow")]
public IEnumerable<EntityUid> ExecuteNow([PipedArgument] EntityUid input)
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.ExecuteNow(input);
}
[CommandImplementation("rules")]
public IEnumerable<IEnumerable<EntityUid>> Rules([PipedArgument] IEnumerable<EntityUid> input)
=> input.Select(Rules);
[CommandImplementation("rules")]
public IEnumerable<EntityUid> Rules([PipedArgument] EntityUid input)
{
_dynamicRuleSystem ??= GetSys<DynamicRuleSystem>();
return _dynamicRuleSystem.Rules(input);
}
}