Action stuff (#31305)

* Action stuff

- Cleanup some event stuff
- Avoid dirtying entity unnecessarily
- Add ActionGrant as an easy way to apply / remove actions via compregistry.

* Fix merge
This commit is contained in:
metalgearsloth
2024-08-25 22:43:31 +10:00
committed by GitHub
parent f96dddd9fb
commit 2e029a7d5b
10 changed files with 168 additions and 40 deletions

View File

@@ -55,12 +55,6 @@ public sealed class ActionOnInteractSystem : EntitySystem
return;
var (actId, act) = _random.Pick(options);
if (act.Event != null)
{
act.Event.Performer = args.User;
act.Event.Action = actId;
}
_actions.PerformAction(args.User, null, actId, act, act.Event, _timing.CurTime, false);
args.Handled = true;
}
@@ -94,8 +88,6 @@ public sealed class ActionOnInteractSystem : EntitySystem
var (entActId, entAct) = _random.Pick(entOptions);
if (entAct.Event != null)
{
entAct.Event.Performer = args.User;
entAct.Event.Action = entActId;
entAct.Event.Target = args.Target.Value;
}
@@ -119,8 +111,6 @@ public sealed class ActionOnInteractSystem : EntitySystem
var (entActId, entAct) = _random.Pick(entWorldOptions);
if (entAct.Event != null)
{
entAct.Event.Performer = args.User;
entAct.Event.Action = entActId;
entAct.Event.Entity = args.Target;
entAct.Event.Coords = args.ClickLocation;
}
@@ -145,8 +135,6 @@ public sealed class ActionOnInteractSystem : EntitySystem
var (actId, act) = _random.Pick(options);
if (act.Event != null)
{
act.Event.Performer = args.User;
act.Event.Action = actId;
act.Event.Target = args.ClickLocation;
}