Refactor actions to be entities with components (#19900)
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Server.Ghost.Roles.Events;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Bible;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -179,8 +180,9 @@ namespace Content.Server.Bible
|
||||
if (component.AlreadySummoned)
|
||||
return;
|
||||
|
||||
args.Actions.Add(component.SummonAction);
|
||||
args.AddAction(ref component.SummonActionEntity, component.SummonAction);
|
||||
}
|
||||
|
||||
private void OnSummon(EntityUid uid, SummonableComponent component, SummonActionEvent args)
|
||||
{
|
||||
AttemptSummon(component, args.Performer, Transform(args.Performer));
|
||||
@@ -238,12 +240,7 @@ namespace Content.Server.Bible
|
||||
Transform(familiar).AttachParent(component.Owner);
|
||||
}
|
||||
component.AlreadySummoned = true;
|
||||
_actionsSystem.RemoveAction(user, component.SummonAction);
|
||||
_actionsSystem.RemoveAction(user, component.SummonActionEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed partial class SummonActionEvent : InstantActionEvent
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Bible.Components
|
||||
{
|
||||
@@ -18,7 +16,7 @@ namespace Content.Server.Bible.Components
|
||||
public string? SpecialItemPrototype = null;
|
||||
public bool AlreadySummoned = false;
|
||||
|
||||
[DataField("requriesBibleUser")]
|
||||
[DataField("requiresBibleUser")]
|
||||
public bool RequiresBibleUser = true;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,14 +25,11 @@ namespace Content.Server.Bible.Components
|
||||
[ViewVariables]
|
||||
public EntityUid? Summon = null;
|
||||
|
||||
[DataField("summonAction")]
|
||||
public InstantAction SummonAction = new()
|
||||
{
|
||||
Icon = new SpriteSpecifier.Texture(new ("Clothing/Head/Hats/witch.rsi/icon.png")),
|
||||
DisplayName = "bible-summon-verb",
|
||||
Description = "bible-summon-verb-desc",
|
||||
Event = new SummonActionEvent(),
|
||||
};
|
||||
[DataField("summonAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string SummonAction = "ActionBibleSummon";
|
||||
|
||||
[DataField("summonActionEntity")]
|
||||
public EntityUid? SummonActionEntity;
|
||||
|
||||
/// Used for respawning
|
||||
[DataField("accumulator")]
|
||||
|
||||
Reference in New Issue
Block a user