From f41093d7929548e5a1b100f888370eefd4bff4cd Mon Sep 17 00:00:00 2001
From: Dvir <39403717+dvir001@users.noreply.github.com>
Date: Mon, 29 Jan 2024 19:06:27 +0200
Subject: [PATCH] Guardians code tweaks (#927)
* Restore code.
* AI? No, ghost.
* Update GuardianComponent.cs
---
Content.Server/Guardian/GuardianComponent.cs | 5 ++
Content.Server/Guardian/GuardianSystem.cs | 11 ++++
.../Entities/Mobs/Player/guardian.yml | 27 +++++----
.../Syndicate_Gadgets/guardian_activators.yml | 5 ++
.../_NF/Entities/Mobs/Player/guardian.yml | 37 ++++++++++++
.../Syndicate_Gadgets/guardian_activators.yml | 60 +++++++++++++++++++
6 files changed, 133 insertions(+), 12 deletions(-)
create mode 100644 Resources/Prototypes/_NF/Entities/Mobs/Player/guardian.yml
create mode 100644 Resources/Prototypes/_NF/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml
diff --git a/Content.Server/Guardian/GuardianComponent.cs b/Content.Server/Guardian/GuardianComponent.cs
index dcb9a8c0540..aad9d0e76ed 100644
--- a/Content.Server/Guardian/GuardianComponent.cs
+++ b/Content.Server/Guardian/GuardianComponent.cs
@@ -28,5 +28,10 @@ public sealed partial class GuardianComponent : Component
///
public bool GuardianLoose = false;
+ ///
+ /// If the guardian can be AI based
+ ///
+ [DataField("ai")]
+ public bool Ai;
}
}
diff --git a/Content.Server/Guardian/GuardianSystem.cs b/Content.Server/Guardian/GuardianSystem.cs
index b6121a7fbda..cebad0b8c04 100644
--- a/Content.Server/Guardian/GuardianSystem.cs
+++ b/Content.Server/Guardian/GuardianSystem.cs
@@ -301,6 +301,11 @@ private void CheckGuardianMove(
RetractGuardian(hostUid, hostComponent, guardianUid, guardianComponent);
}
+ private bool CanRelease(EntityUid guardian)
+ {
+ return HasComp(guardian);
+ }
+
private void ReleaseGuardian(EntityUid host, GuardianHostComponent hostComponent, EntityUid guardian, GuardianComponent guardianComponent)
{
if (guardianComponent.GuardianLoose)
@@ -309,6 +314,12 @@ private void ReleaseGuardian(EntityUid host, GuardianHostComponent hostComponent
return;
}
+ if (!guardianComponent.Ai && !CanRelease(guardian))
+ {
+ _popupSystem.PopupEntity(Loc.GetString("guardian-no-soul"), host, host);
+ return;
+ }
+
DebugTools.Assert(hostComponent.GuardianContainer.Contains(guardian));
hostComponent.GuardianContainer.Remove(guardian);
DebugTools.Assert(!hostComponent.GuardianContainer.Contains(guardian));
diff --git a/Resources/Prototypes/Entities/Mobs/Player/guardian.yml b/Resources/Prototypes/Entities/Mobs/Player/guardian.yml
index 1e863aa80f8..0d9081e9f57 100644
--- a/Resources/Prototypes/Entities/Mobs/Player/guardian.yml
+++ b/Resources/Prototypes/Entities/Mobs/Player/guardian.yml
@@ -106,6 +106,7 @@
# From the uplink injector
- type: entity
name: Holoparasite
+ suffix: Ghost # Frontier
id: MobHoloparasiteGuardian
parent: MobGuardianBase
description: A mesmerising whirl of hard-light patterns weaves a marvelous, yet oddly familiar visage. It stands proud, tuning into its owner's life to sustain itself.
@@ -129,16 +130,17 @@
map: [ "enum.DamageStateVisualLayers.BaseUnshaded" ]
color: "#40a7d7"
shader: unshaded
- - type: NpcFactionMember
- factions:
- - Syndicate
- - type: HTN
- rootTask:
- task: SimpleHumanoidHostileCompound
+ # - type: NpcFactionMember
+ # factions:
+ # - Syndicate
+ # - type: HTN # Frontier
+ # rootTask:
+ # task: SimpleHumanoidHostileCompound
# From Wizard deck of cards
- type: entity
name: Ifrit
+ suffix: Ghost # Frontier
parent: MobGuardianBase
id: MobIfritGuardian
description: A corrupted jinn, ripped from fitra to serve the wizard's petty needs. It stands wicked, tuning into it's owner's life to sustain itself.
@@ -165,6 +167,7 @@
- type: entity
name: HoloClown
+ suffix: Ghost # Frontier
id: MobHoloClownGuardian
parent: MobGuardianBase
description: A mesmerising whirl of hard-light patterns weaves a blue colored clown of dubious origin.
@@ -236,12 +239,12 @@
- type: RandomMetadata
nameSegments:
- names_clown
- - type: NpcFactionMember
- factions:
- - Syndicate
- - type: HTN
- rootTask:
- task: SimpleHumanoidHostileCompound
+ # - type: NpcFactionMember
+ # factions:
+ # - Syndicate
+ # - type: HTN # Frontier
+ # rootTask:
+ # task: SimpleHumanoidHostileCompound
- type: entity
id: ActionToggleGuardian
diff --git a/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml b/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml
index d05ecfdc6c7..488895c9203 100644
--- a/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml
+++ b/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml
@@ -1,5 +1,6 @@
- type: entity
name: holoparasite injector
+ suffix: Ghost # Frontier
id: HoloparasiteInjector
parent: BaseItem
description: A complex artwork of handheld machinery allowing the user to host a holoparasite guardian.
@@ -13,6 +14,7 @@
- type: entity
name: holoclown injector
parent: HoloparasiteInjector
+ suffix: Ghost # Frontier
id: HoloClownInjector
description: A complex artwork of handheld machinery allowing the user to host a holoclown guardian.
components:
@@ -22,6 +24,7 @@
- type: entity
name: magical lamp
id: MagicalLamp
+ suffix: Ghost # Frontier
parent: BaseItem
description: The wizard federation had to cut costs after the jinn merchandise scandal somehow.
components:
@@ -34,6 +37,7 @@
- type: entity
name: holoparasite box
+ suffix: Ghost # Frontier
parent: BoxCardboard
id: BoxHoloparasite
description: A box containing a holoparasite injector
@@ -52,6 +56,7 @@
- type: entity
name: holoclown box
+ suffix: Ghost # Frontier
parent: BoxCardboard
id: BoxHoloclown
description: A box containing a holoclown injector
diff --git a/Resources/Prototypes/_NF/Entities/Mobs/Player/guardian.yml b/Resources/Prototypes/_NF/Entities/Mobs/Player/guardian.yml
new file mode 100644
index 00000000000..d90b161938f
--- /dev/null
+++ b/Resources/Prototypes/_NF/Entities/Mobs/Player/guardian.yml
@@ -0,0 +1,37 @@
+# From the uplink injector
+- type: entity
+ id: MobHoloparasiteGuardianAI
+ parent: MobHoloparasiteGuardian
+ suffix: Ghost, AI
+ components:
+ - type: Guardian
+ ai: true
+ - type: NpcFactionMember
+ factions:
+ - Syndicate
+ - type: HTN
+ rootTask:
+ task: SimpleHumanoidHostileCompound
+
+# From Wizard deck of cards
+- type: entity
+ id: MobIfritGuardianAI
+ parent: MobIfritGuardian
+ suffix: Ghost, AI
+ components:
+ - type: Guardian
+ ai: true
+
+- type: entity
+ id: MobHoloClownGuardianAI
+ parent: MobHoloClownGuardian
+ suffix: Ghost, AI
+ components:
+ - type: Guardian
+ ai: true
+ - type: NpcFactionMember
+ factions:
+ - Syndicate
+ - type: HTN
+ rootTask:
+ task: SimpleHumanoidHostileCompound
diff --git a/Resources/Prototypes/_NF/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml b/Resources/Prototypes/_NF/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml
new file mode 100644
index 00000000000..c6f819668b2
--- /dev/null
+++ b/Resources/Prototypes/_NF/Entities/Objects/Devices/Syndicate_Gadgets/guardian_activators.yml
@@ -0,0 +1,60 @@
+- type: entity
+ id: HoloparasiteInjectorAI
+ parent: HoloparasiteInjector
+ suffix: Ghost, AI
+ components:
+ - type: GuardianCreator
+ guardianProto: MobHoloparasiteGuardianAI
+
+- type: entity
+ parent: HoloClownInjector
+ id: HoloClownInjectorAI
+ suffix: Ghost, AI
+ components:
+ - type: GuardianCreator
+ guardianProto: MobHoloClownGuardianAI
+
+- type: entity
+ id: MagicalLampAI
+ parent: MagicalLamp
+ suffix: Ghost, AI
+ components:
+ - type: GuardianCreator
+ guardianProto: MobIfritGuardianAI
+
+- type: entity
+ parent: BoxHoloparasite
+ id: BoxHoloparasiteAI
+ suffix: Ghost, AI
+ components:
+ - type: StorageFill
+ contents:
+ - id: HoloparasiteInjectorAI
+ - id: HoloparasiteInfo
+ - id: ClothingHeadHatBizarreSoft
+ - type: Sprite
+ layers:
+ - state: box
+ - state: holo
+ - type: StaticPrice
+ price: 1500
+
+- type: entity
+ parent: BoxHoloclown
+ id: BoxHoloclownAI
+ suffix: Ghost, AI
+ components:
+ - type: StorageFill
+ contents:
+ - id: HoloClownInjectorAI
+ - id: ToyFigurineHoloClown
+ - id: ToyHammer
+ - type: Sprite
+ layers:
+ - state: box_hug
+ - state: holo
+ - type: Tag
+ tags:
+ - BoxHug
+ - type: StaticPrice
+ price: 1500