From 76685eaf1c2b101a21cd2bc864b0dc5126afa35f Mon Sep 17 00:00:00 2001 From: Aviu00 Date: Wed, 17 Jan 2024 10:25:01 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B5=D0=B1=D0=B0=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=B2=D0=B0=D1=88=D0=B8=20=D1=84=D0=BB=D0=B0=D1=84=D1=84=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pets/PetSummonComponent.cs | 27 +++++++------------ .../Pets/PetSummonSystem.cs | 17 +++--------- .../White/Events/PetSummonEvents.cs | 11 ++++++++ .../Prototypes/White/Actions/petsummon.yml | 21 +++++++++++++++ 4 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 Content.Shared/White/Events/PetSummonEvents.cs create mode 100644 Resources/Prototypes/White/Actions/petsummon.yml diff --git a/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonComponent.cs b/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonComponent.cs index 65d8bc0a97..d37dbb0b85 100644 --- a/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonComponent.cs +++ b/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonComponent.cs @@ -1,26 +1,19 @@ -using Content.Shared.Actions.ActionTypes; -using Robust.Shared.Utility; +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.White.Other.CustomFluffSystems.Pets; [RegisterComponent] -public sealed class PetSummonComponent : Component +public sealed partial class PetSummonComponent : Component { - public InstantAction PetSummonAction = new() - { - Icon = new SpriteSpecifier.Texture(new ResPath("Objects/Misc/books.rsi/summon_book.png")), - DisplayName = "Призыв", - Description = "Призыв питомца БЕЗ возможности вселения призрака", - Event = new PetSummonActionEvent() - }; + [DataField("petSummonAction", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string PetSummonAction = "PetSummonAction"; - public InstantAction PetGhostSummonAction = new() - { - Icon = new SpriteSpecifier.Texture(new ResPath("Mobs/Ghosts/ghost_human.rsi/icon.png")), - DisplayName = "Призрачный призыв", - Description = "Призыв питомца С возможностью вселения призрака", - Event = new PetGhostSummonActionEvent() - }; + [DataField("petGhostSummonAction", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string PetGhostSummonAction = "PetGhostSummonAction"; + + [DataField("petSummonActionEntity")] public EntityUid? PetSummonActionEntity; + [DataField("petGhostSummonActionEntity")] public EntityUid? PetGhostSummonActionEntity; public int UsesLeft = 10; diff --git a/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonSystem.cs b/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonSystem.cs index 1382e9439e..5c9ea00d6e 100644 --- a/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonSystem.cs +++ b/Content.Server/White/Other/CustomFluffSystems/Pets/PetSummonSystem.cs @@ -2,12 +2,12 @@ using Content.Shared.ActionBlocker; using Content.Shared.Actions; using Content.Shared.Examine; -using Content.Shared.Item; using Content.Shared.Mobs; using Content.Shared.Mobs.Components; using Content.Shared.Popups; using Content.Shared.Verbs; -using Robust.Server.GameObjects; +using Content.Shared.White.Events; +using Robust.Shared.Player; namespace Content.Server.White.Other.CustomFluffSystems.Pets; @@ -16,7 +16,6 @@ public sealed class PetSummonSystem : EntitySystem [Dependency] private readonly ActionBlockerSystem _blocker = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly SharedActionsSystem _actions = default!; private IReadOnlyDictionary MobMap = new Dictionary() { @@ -158,15 +157,7 @@ public sealed class PetSummonSystem : EntitySystem private void GetSummonAction(EntityUid uid, PetSummonComponent component, GetItemActionsEvent args) { - args.Actions.Add(component.PetSummonAction); - args.Actions.Add(component.PetGhostSummonAction); + args.AddAction(ref component.PetSummonActionEntity, component.PetSummonAction); + args.AddAction(ref component.PetGhostSummonActionEntity, component.PetGhostSummonAction); } } - -public sealed class PetSummonActionEvent : InstantActionEvent -{ -} - -public sealed class PetGhostSummonActionEvent : InstantActionEvent -{ -} diff --git a/Content.Shared/White/Events/PetSummonEvents.cs b/Content.Shared/White/Events/PetSummonEvents.cs new file mode 100644 index 0000000000..0796a77a4d --- /dev/null +++ b/Content.Shared/White/Events/PetSummonEvents.cs @@ -0,0 +1,11 @@ +using Content.Shared.Actions; + +namespace Content.Shared.White.Events; + +public sealed partial class PetSummonActionEvent : InstantActionEvent +{ +} + +public sealed partial class PetGhostSummonActionEvent : InstantActionEvent +{ +} diff --git a/Resources/Prototypes/White/Actions/petsummon.yml b/Resources/Prototypes/White/Actions/petsummon.yml new file mode 100644 index 0000000000..0a5aecbe2c --- /dev/null +++ b/Resources/Prototypes/White/Actions/petsummon.yml @@ -0,0 +1,21 @@ +- type: entity + id: PetSummonAction + name: Призыв + description: Призыв питомца БЕЗ возможности вселения призрака + noSpawn: true + components: + - type: InstantAction + icon: { sprite: Objects/Misc/books.rsi, state: summon_book } + event: !type:PetSummonActionEvent {} + useDelay: 1 + +- type: entity + id: PetGhostSummonAction + name: Призрачный призыв + description: Призыв питомца С возможностью вселения призрака + noSpawn: true + components: + - type: InstantAction + icon: { sprite: Mobs/Ghosts/ghost_human.rsi, state: icon } + event: !type:PetGhostSummonActionEvent {} + useDelay: 1