From f290a5988f4ce12ebbbf45d9bd599ffc49294668 Mon Sep 17 00:00:00 2001 From: Timfa Date: Thu, 6 Feb 2025 00:21:44 +0100 Subject: [PATCH] Gladiabot Tweaks (#1717) Signed-off-by: stellar-novas (cherry picked from commit b3c27808a6cb00dec49d42e24f6a23b1da37d7c9) --- .../NpcFactionSpriteStateSetterSystem.cs | 6 ++- .../EmagReplaceFactionsComponent.cs | 6 +++ .../Systems/EmagReplaceFactionsSystem.cs | 4 +- .../Entities/Mobs/NPCs/gladiabot.yml | 4 ++ Resources/Prototypes/ai_factions.yml | 41 +++++++++++++++++++ 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/Content.Client/NPC/Systems/NpcFactionSpriteStateSetterSystem.cs b/Content.Client/NPC/Systems/NpcFactionSpriteStateSetterSystem.cs index 1e57d917be..9e0c462dff 100644 --- a/Content.Client/NPC/Systems/NpcFactionSpriteStateSetterSystem.cs +++ b/Content.Client/NPC/Systems/NpcFactionSpriteStateSetterSystem.cs @@ -23,6 +23,10 @@ public sealed partial class NpcFactionSpriteStateSetterSystem : EntitySystem return; SpriteComponent spriteComponent = _entityManager.GetComponent(entity); - spriteComponent.LayerSetState(0, new Robust.Client.Graphics.RSI.StateId(args.FactionID)); + + var rsi = spriteComponent.LayerGetActualRSI(0); + + if(rsi != null && rsi.TryGetState(args.FactionID, out _)) + spriteComponent.LayerSetState(0, new Robust.Client.Graphics.RSI.StateId(args.FactionID)); } } diff --git a/Content.Shared/Silicon/Components/EmagReplaceFactionsComponent.cs b/Content.Shared/Silicon/Components/EmagReplaceFactionsComponent.cs index 41ec2fbb68..f7c157dc0b 100644 --- a/Content.Shared/Silicon/Components/EmagReplaceFactionsComponent.cs +++ b/Content.Shared/Silicon/Components/EmagReplaceFactionsComponent.cs @@ -17,6 +17,12 @@ public sealed partial class EmagReplaceFactionsComponent : Component [DataField(required: false)] public int StunSeconds = 5; + /// + /// Should the component add factions to the existing list of factions instead of replacing them? + /// + [DataField(required:false)] + public bool Additive = false; + /// /// Factions to replace from the original set. /// diff --git a/Content.Shared/Silicon/Systems/EmagReplaceFactionsSystem.cs b/Content.Shared/Silicon/Systems/EmagReplaceFactionsSystem.cs index 82d2c53680..87a7b51e64 100644 --- a/Content.Shared/Silicon/Systems/EmagReplaceFactionsSystem.cs +++ b/Content.Shared/Silicon/Systems/EmagReplaceFactionsSystem.cs @@ -40,7 +40,9 @@ public sealed class EmagReplaceFactionsSystem : EntitySystem newFactions.Add(comp.Factions[i]); } - _npcFactionSystem.ClearFactions(uid, false); + if(!comp.Additive) + _npcFactionSystem.ClearFactions(uid, false); + _npcFactionSystem.AddFactions(uid, newFactions); if(comp.StunSeconds > 0) diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/gladiabot.yml b/Resources/Prototypes/Entities/Mobs/NPCs/gladiabot.yml index 78faa6f6cb..c910e28b58 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/gladiabot.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/gladiabot.yml @@ -33,6 +33,10 @@ - GladiabotBlue - GladiabotGreen - GladiabotYellow + - type: EmagReplaceFactions + additive: true + factions: + - Syndicate - type: NpcFactionSpriteStateSetter - type: CombatMode - type: MeleeWeapon diff --git a/Resources/Prototypes/ai_factions.yml b/Resources/Prototypes/ai_factions.yml index 09ced01cc6..f6e16b4343 100644 --- a/Resources/Prototypes/ai_factions.yml +++ b/Resources/Prototypes/ai_factions.yml @@ -7,6 +7,11 @@ - PetsNT - Zombie - Revolutionary + - GladiabotFFA + - GladiabotRed + - GladiabotGreen + - GladiabotBlue + - GladiabotYellow - type: npcFaction id: NanoTrasen @@ -16,6 +21,7 @@ - Xeno - Zombie - Revolutionary + - Dragon - type: npcFaction id: Mouse @@ -45,6 +51,11 @@ - Zombie - Revolutionary - GeometerOfBlood + - GladiabotFFA + - GladiabotRed + - GladiabotGreen + - GladiabotBlue + - GladiabotYellow - type: npcFaction id: SimpleNeutral @@ -67,6 +78,11 @@ - PetsNT - Zombie - Revolutionary + - GladiabotFFA + - GladiabotRed + - GladiabotGreen + - GladiabotBlue + - GladiabotYellow - type: npcFaction id: Zombie @@ -78,6 +94,11 @@ - Passive - PetsNT - Revolutionary + - GladiabotFFA + - GladiabotRed + - GladiabotGreen + - GladiabotBlue + - GladiabotYellow - type: npcFaction id: Revolutionary @@ -119,6 +140,10 @@ - GladiabotGreen - GladiabotBlue - GladiabotYellow + - SimpleHostile + - Xeno + - Zombie + - Dragon - type: npcFaction id: GladiabotRed @@ -127,6 +152,10 @@ - GladiabotGreen - GladiabotBlue - GladiabotYellow + - SimpleHostile + - Xeno + - Zombie + - Dragon - type: npcFaction id: GladiabotGreen @@ -135,6 +164,10 @@ - GladiabotRed - GladiabotBlue - GladiabotYellow + - SimpleHostile + - Xeno + - Zombie + - Dragon - type: npcFaction id: GladiabotBlue @@ -143,6 +176,10 @@ - GladiabotRed - GladiabotGreen - GladiabotYellow + - SimpleHostile + - Xeno + - Zombie + - Dragon - type: npcFaction id: GladiabotYellow @@ -151,3 +188,7 @@ - GladiabotRed - GladiabotGreen - GladiabotBlue + - SimpleHostile + - Xeno + - Zombie + - Dragon