Refactor actions to be entities with components (#19900)

This commit is contained in:
DrSmugleaf
2023-09-08 18:16:05 -07:00
committed by GitHub
parent e18f731b91
commit c71f97e3a2
210 changed files with 10693 additions and 11714 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Actions.ActionTypes;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Movement.Components;
@@ -9,8 +10,10 @@ public sealed partial class JetpackComponent : Component
[ViewVariables(VVAccess.ReadWrite), DataField("moleUsage")]
public float MoleUsage = 0.012f;
[DataField("toggleAction", required: true)]
public InstantAction ToggleAction = new();
[DataField("toggleAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? ToggleAction = "ActionToggleJetpack";
[DataField("toggleActionEntity")] public EntityUid? ToggleActionEntity;
[ViewVariables(VVAccess.ReadWrite), DataField("acceleration")]
public float Acceleration = 1f;

View File

@@ -132,7 +132,7 @@ public abstract class SharedJetpackSystem : EntitySystem
private void OnJetpackGetAction(EntityUid uid, JetpackComponent component, GetItemActionsEvent args)
{
args.Actions.Add(component.ToggleAction);
args.AddAction(ref component.ToggleActionEntity, component.ToggleAction);
}
private bool IsEnabled(EntityUid uid)
@@ -182,7 +182,7 @@ public abstract class SharedJetpackSystem : EntitySystem
}
Appearance.SetData(uid, JetpackVisuals.Enabled, enabled);
Dirty(component);
Dirty(uid, component);
}
public bool IsUserFlying(EntityUid uid)