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,13 +1,11 @@
using Content.Server.Actions;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Nutrition.Components;
using Content.Server.Popups;
using Content.Shared.Actions;
using Content.Shared.Atmos;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.RatKing;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
namespace Content.Server.RatKing
{
@@ -23,16 +21,16 @@ namespace Content.Server.RatKing
{
base.Initialize();
SubscribeLocalEvent<RatKingComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<RatKingComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<RatKingComponent, RatKingRaiseArmyActionEvent>(OnRaiseArmy);
SubscribeLocalEvent<RatKingComponent, RatKingDomainActionEvent>(OnDomain);
}
private void OnStartup(EntityUid uid, RatKingComponent component, ComponentStartup args)
private void OnMapInit(EntityUid uid, RatKingComponent component, MapInitEvent args)
{
_action.AddAction(uid, component.ActionRaiseArmy, null);
_action.AddAction(uid, component.ActionDomain, null);
_action.AddAction(uid, ref component.ActionRaiseArmyEntity, component.ActionRaiseArmy);
_action.AddAction(uid, ref component.ActionDomainEntity, component.ActionDomain);
}
/// <summary>
@@ -86,14 +84,4 @@ namespace Content.Server.RatKing
tileMix?.AdjustMoles(Gas.Miasma, component.MolesMiasmaPerDomain);
}
}
public sealed partial class RatKingRaiseArmyActionEvent : InstantActionEvent
{
}
public sealed partial class RatKingDomainActionEvent : InstantActionEvent
{
}
};
}