ConGroups are gone. Long live admin flags in content.

This commit is contained in:
Pieter-Jan Briers
2020-10-30 16:06:48 +01:00
parent f04818437d
commit ad58a056d7
62 changed files with 2673 additions and 289 deletions

View File

@@ -1,6 +1,8 @@
#nullable enable
using System;
using System.Linq;
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.Damage;
using Content.Shared.GameObjects.Components.Body;
using Content.Shared.GameObjects.Components.Body.Part;
@@ -16,6 +18,7 @@ using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Body
{
[AdminCommand(AdminFlags.Fun)]
class AddHandCommand : IClientCommand
{
public const string DefaultHandPrototype = "LeftHandHuman";
@@ -149,6 +152,7 @@ namespace Content.Server.GameObjects.Components.Body
}
}
[AdminCommand(AdminFlags.Fun)]
class RemoveHandCommand : IClientCommand
{
public string Command => "removehand";
@@ -190,6 +194,7 @@ namespace Content.Server.GameObjects.Components.Body
}
}
[AdminCommand(AdminFlags.Fun)]
class DestroyMechanismCommand : IClientCommand
{
public string Command => "destroymechanism";
@@ -242,6 +247,7 @@ namespace Content.Server.GameObjects.Components.Body
}
}
[AdminCommand(AdminFlags.Fun)]
class HurtCommand : IClientCommand
{
public string Command => "hurt";

View File

@@ -1,7 +1,9 @@
#nullable enable
using System;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Administration;
using Content.Server.GameObjects.Components.Atmos;
using Content.Shared.Administration;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
@@ -115,6 +117,7 @@ namespace Content.Server.GameObjects.Components.Damage
}
}
[AdminCommand(AdminFlags.Fun)]
public class AddDamageFlagCommand : DamageFlagCommand
{
public override string Command => "adddamageflag";
@@ -133,6 +136,7 @@ namespace Content.Server.GameObjects.Components.Damage
}
}
[AdminCommand(AdminFlags.Fun)]
public class RemoveDamageFlagCommand : DamageFlagCommand
{
public override string Command => "removedamageflag";
@@ -151,6 +155,7 @@ namespace Content.Server.GameObjects.Components.Damage
}
}
[AdminCommand(AdminFlags.Admin)]
public class GodModeCommand : IClientCommand
{
public string Command => "godmode";

View File

@@ -1,4 +1,6 @@
#nullable enable
using Content.Server.Administration;
using Content.Shared.Administration;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
@@ -8,6 +10,7 @@ using Robust.Shared.Localization;
namespace Content.Server.GameObjects.Components.Disposal
{
[AdminCommand(AdminFlags.Debug)]
public class TubeConnectionsCommand : IClientCommand
{
public string Command => "tubeconnections";

View File

@@ -1,5 +1,7 @@
#nullable enable
using System.Linq;
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Server.Interfaces.Console;
@@ -14,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Interactable
/// <summary>
/// <see cref="TilePryingComponent.TryPryTile"/>
/// </summary>
[UsedImplicitly]
[AdminCommand(AdminFlags.Debug)]
class TilePryCommand : IClientCommand
{
public string Command => "tilepry";
@@ -69,7 +71,7 @@ namespace Content.Server.GameObjects.Components.Interactable
}
}
[UsedImplicitly]
[AdminCommand(AdminFlags.Debug)]
class AnchorCommand : IClientCommand
{
public string Command => "anchor";
@@ -114,7 +116,7 @@ namespace Content.Server.GameObjects.Components.Interactable
}
}
[UsedImplicitly]
[AdminCommand(AdminFlags.Debug)]
class UnAnchorCommand : IClientCommand
{
public string Command => "unanchor";

View File

@@ -1,5 +1,7 @@
using System;
using System.Linq;
using Content.Server.Administration;
using Content.Shared.Administration;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Interfaces.GameObjects;
@@ -17,6 +19,7 @@ namespace Content.Server.GameObjects.Components.Mobs.Speech
public string Accentuate(string message);
}
[AdminCommand(AdminFlags.Fun)]
public class AddAccent : IClientCommand
{
public string Command => "addaccent";
@@ -38,12 +41,12 @@ namespace Content.Server.GameObjects.Components.Mobs.Speech
shell.SendText(player, "You don't have a player!");
return;
}
var compFactory = IoCManager.Resolve<IComponentFactory>();
if (args[0] == "?")
{
// Get all components that implement the ISpeechComponent except
// Get all components that implement the ISpeechComponent except
var speeches = compFactory.GetAllRefTypes()
.Where(c => typeof(IAccentComponent).IsAssignableFrom(c) && c.IsClass);
var msg = "";

View File

@@ -102,7 +102,7 @@ namespace Content.Server.GameObjects.Components.Observer
{
if (player.AttachedEntity != null && warp.PlayerTarget == player.AttachedEntity.Uid)
{
session?.AttachedEntity!.Transform.Coordinates =
session!.AttachedEntity!.Transform.Coordinates =
player.AttachedEntity.Transform.Coordinates;
}
}
@@ -113,7 +113,7 @@ namespace Content.Server.GameObjects.Components.Observer
{
if (warp.WarpName == warpPoint.Location)
{
session?.AttachedEntity!.Transform.Coordinates = warpPoint.Owner.Transform.Coordinates ;
session!.AttachedEntity!.Transform.Coordinates = warpPoint.Owner.Transform.Coordinates ;
}
}
}

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using Content.Server.Administration;
using Content.Server.GameObjects.Components.AI;
using Content.Shared.Administration;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects.Systems;
@@ -19,12 +21,12 @@ namespace Content.Server.GameObjects.EntitySystems.AI
* Currently factions are implicitly friendly if they are not hostile.
* This may change where specified friendly factions are listed. (e.g. to get number of friendlies in area).
*/
public Faction GetHostileFactions(Faction faction) => _hostileFactions.TryGetValue(faction, out var hostiles) ? hostiles : Faction.None;
private Dictionary<Faction, Faction> _hostileFactions = new Dictionary<Faction, Faction>
{
{Faction.NanoTransen,
{Faction.NanoTransen,
Faction.SimpleHostile | Faction.Syndicate | Faction.Xeno},
{Faction.SimpleHostile,
Faction.NanoTransen | Faction.Syndicate
@@ -35,11 +37,11 @@ namespace Content.Server.GameObjects.EntitySystems.AI
},
{Faction.Syndicate,
Faction.NanoTransen | Faction.SimpleHostile | Faction.Xeno},
{Faction.Xeno,
{Faction.Xeno,
Faction.NanoTransen | Faction.Syndicate},
};
public Faction GetFactions(IEntity entity) =>
public Faction GetFactions(IEntity entity) =>
entity.TryGetComponent(out AiFactionTagComponent factionTags)
? factionTags.Factions
: Faction.None;
@@ -76,7 +78,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
hostileFactions &= ~target;
_hostileFactions[source] = hostileFactions;
}
public void MakeHostile(Faction source, Faction target)
{
if (!_hostileFactions.TryGetValue(source, out var hostileFactions))
@@ -89,12 +91,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI
_hostileFactions[source] = hostileFactions;
}
}
[AdminCommand(AdminFlags.Fun)]
public sealed class FactionCommand : IClientCommand
{
public string Command => "factions";
public string Description => "Update / list factional relationships for NPCs.";
public string Help => "faction <source> <friendly/hostile> target\n" +
public string Help => "faction <source> <friendly/hostile> target\n" +
"faction <source> list: hostile factions";
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
@@ -108,11 +111,11 @@ namespace Content.Server.GameObjects.EntitySystems.AI
continue;
result.Append(value + "\n");
}
shell.SendText(player, result.ToString());
return;
}
if (args.Length < 2)
{
shell.SendText(player, Loc.GetString("Need more args"));
@@ -141,7 +144,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
shell.SendText(player, Loc.GetString("Invalid target faction"));
return;
}
EntitySystem.Get<AiFactionTagSystem>().MakeFriendly(faction, targetFaction);
shell.SendText(player, Loc.GetString("Command successful"));
break;
@@ -157,7 +160,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
shell.SendText(player, Loc.GetString("Invalid target faction"));
return;
}
EntitySystem.Get<AiFactionTagSystem>().MakeHostile(faction, targetFaction);
shell.SendText(player, Loc.GetString("Command successful"));
break;
@@ -172,4 +175,4 @@ namespace Content.Server.GameObjects.EntitySystems.AI
return;
}
}
}
}

View File

@@ -2,7 +2,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Administration;
using Content.Server.GameObjects.Components.Movement;
using Content.Shared.Administration;
using Content.Shared.GameObjects.Components.Movement;
using JetBrains.Annotations;
using Robust.Server.AI;
@@ -75,7 +77,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
break;
case false:
_awakeAi.Add(message.Processor);
if (_awakeAi.Count > cvarMaxUpdates)
{
Logger.Warning($"AI limit exceeded: {_awakeAi.Count} / {cvarMaxUpdates}");
@@ -101,7 +103,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
toRemove.Add(processor);
continue;
}
processor.Update(frameTime);
count++;
}
@@ -145,6 +147,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
public bool ProcessorTypeExists(string name) => _processorTypes.ContainsKey(name);
[AdminCommand(AdminFlags.Fun)]
private class AddAiCommand : IClientCommand
{
public string Command => "addai";

View File

@@ -1,5 +1,7 @@
using System.Collections.Generic;
using Content.Server.Administration;
using Content.Server.GameObjects.Components.MachineLinking;
using Content.Shared.Administration;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
@@ -96,6 +98,7 @@ namespace Content.Server.GameObjects.EntitySystems
}
[AdminCommand(AdminFlags.Debug)]
public class SignalLinkerCommand : IClientCommand
{
public string Command => "signallink";