From 78b692342e342ec68c230f8d0f60618d760097d9 Mon Sep 17 00:00:00 2001 From: AsnDen Date: Sun, 22 Sep 2024 00:55:20 +0300 Subject: [PATCH] ActionGrant to pAI --- Content.Client/PAI/PAISystem.cs | 8 ---- .../PAI/PAIComponent.cs | 18 +-------- Content.Server/PAI/PAISystem.cs | 3 +- Content.Shared/PAI/SharedPAISystem.cs | 39 ------------------- .../Prototypes/Entities/Objects/Fun/pai.yml | 4 ++ 5 files changed, 7 insertions(+), 65 deletions(-) delete mode 100644 Content.Client/PAI/PAISystem.cs rename {Content.Shared => Content.Server}/PAI/PAIComponent.cs (72%) delete mode 100644 Content.Shared/PAI/SharedPAISystem.cs diff --git a/Content.Client/PAI/PAISystem.cs b/Content.Client/PAI/PAISystem.cs deleted file mode 100644 index a28cf6a07703b3..00000000000000 --- a/Content.Client/PAI/PAISystem.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Content.Shared.PAI; - -namespace Content.Client.PAI -{ - public sealed class PAISystem : SharedPAISystem - { - } -} diff --git a/Content.Shared/PAI/PAIComponent.cs b/Content.Server/PAI/PAIComponent.cs similarity index 72% rename from Content.Shared/PAI/PAIComponent.cs rename to Content.Server/PAI/PAIComponent.cs index 9d5be302758833..0e6d018a4dd2e4 100644 --- a/Content.Shared/PAI/PAIComponent.cs +++ b/Content.Server/PAI/PAIComponent.cs @@ -1,8 +1,6 @@ using Robust.Shared.GameStates; -using Robust.Shared.Prototypes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; -namespace Content.Shared.PAI; +namespace Content.Server.PAI; /// /// pAIs, or Personal AIs, are essentially portable ghost role generators. @@ -14,7 +12,7 @@ namespace Content.Shared.PAI; /// and there's not always enough players and ghost roles to justify it. /// All logic in PAISystem. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent] public sealed partial class PAIComponent : Component { /// @@ -24,18 +22,6 @@ public sealed partial class PAIComponent : Component [DataField, ViewVariables(VVAccess.ReadWrite)] public EntityUid? LastUser; - [DataField(serverOnly: true)] - public EntProtoId? MidiActionId = "ActionPAIPlayMidi"; - - [DataField(serverOnly: true)] // server only, as it uses a server-BUI event !type - public EntityUid? MidiAction; - - [DataField] - public EntProtoId MapActionId = "ActionPAIOpenMap"; - - [DataField, AutoNetworkedField] - public EntityUid? MapAction; - /// /// When microwaved there is this chance to brick the pai, kicking out its player and preventing it from being used again. /// diff --git a/Content.Server/PAI/PAISystem.cs b/Content.Server/PAI/PAISystem.cs index 0cdb0bc29a2dff..ff93037086af6a 100644 --- a/Content.Server/PAI/PAISystem.cs +++ b/Content.Server/PAI/PAISystem.cs @@ -4,7 +4,6 @@ using Content.Server.Kitchen.Components; using Content.Shared.Interaction.Events; using Content.Shared.Mind.Components; -using Content.Shared.PAI; using Content.Shared.Popups; using Robust.Shared.Random; using System.Text; @@ -12,7 +11,7 @@ namespace Content.Server.PAI; -public sealed class PAISystem : SharedPAISystem +public sealed class PAISystem : EntitySystem { [Dependency] private readonly InstrumentSystem _instrumentSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; diff --git a/Content.Shared/PAI/SharedPAISystem.cs b/Content.Shared/PAI/SharedPAISystem.cs deleted file mode 100644 index d66365eb8555c9..00000000000000 --- a/Content.Shared/PAI/SharedPAISystem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Content.Shared.Actions; - -namespace Content.Shared.PAI -{ - /// - /// pAIs, or Personal AIs, are essentially portable ghost role generators. - /// In their current implementation, they create a ghost role anyone can access, - /// and that a player can also "wipe" (reset/kick out player). - /// Theoretically speaking pAIs are supposed to use a dedicated "offer and select" system, - /// with the player holding the pAI being able to choose one of the ghosts in the round. - /// This seems too complicated for an initial implementation, though, - /// and there's not always enough players and ghost roles to justify it. - /// - public abstract class SharedPAISystem : EntitySystem - { - [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; - - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(OnShutdown); - } - - private void OnMapInit(EntityUid uid, PAIComponent component, MapInitEvent args) - { - _actionsSystem.AddAction(uid, ref component.MidiAction, component.MidiActionId); - _actionsSystem.AddAction(uid, ref component.MapAction, component.MapActionId); - } - - private void OnShutdown(EntityUid uid, PAIComponent component, ComponentShutdown args) - { - _actionsSystem.RemoveAction(uid, component.MidiAction); - _actionsSystem.RemoveAction(uid, component.MapAction); - } - } -} - diff --git a/Resources/Prototypes/Entities/Objects/Fun/pai.yml b/Resources/Prototypes/Entities/Objects/Fun/pai.yml index 4695f1c125d258..b5a1ff1c4b8d56 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/pai.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/pai.yml @@ -73,6 +73,10 @@ Searching: { state: pai-searching-overlay } On: { state: pai-on-overlay } - type: StationMap + - type: ActionGrant + actions: + - ActionPAIPlayMidi + - ActionPAIOpenMap - type: entity parent: [ PersonalAI, BaseSyndicateContraband]