Merge branch '20-10-30-admins' into 20-11-13-merges
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.AI;
|
||||
@@ -145,6 +146,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";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.MachineLinking;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -98,6 +100,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SignalLinkerCommand : IClientCommand
|
||||
{
|
||||
public string Command => "signallink";
|
||||
|
||||
Reference in New Issue
Block a user