Revert "Не должно ебануть (#170)"

This reverts commit aabdcec60c.
This commit is contained in:
BIGZi0348
2024-11-12 20:48:25 +03:00
parent aabdcec60c
commit 55fe86dde4
70 changed files with 186 additions and 1097 deletions

View File

@@ -14,26 +14,9 @@ public sealed class MobStateActionsSystem : EntitySystem
public override void Initialize()
{
SubscribeLocalEvent<MobStateActionsComponent, MobStateChangedEvent>(OnMobStateChanged);
SubscribeLocalEvent<MobStateComponent, ComponentInit>(OnMobStateComponentInit); // WD ahead of wizden
}
private void OnMobStateChanged(EntityUid uid, MobStateActionsComponent component, MobStateChangedEvent args)
{
ComposeActions(uid, component, args.NewMobState); // WD ahead of wizden
}
private void OnMobStateComponentInit(EntityUid uid, MobStateComponent component, ComponentInit args) // WD ahead of wizden
{
if (!TryComp<MobStateActionsComponent>(uid, out var mobStateActionsComp))
return;
ComposeActions(uid, mobStateActionsComp, component.CurrentState);
}
/// <summary>
/// Adds or removes actions from a mob based on mobstate.
/// </summary>
private void ComposeActions(EntityUid uid, MobStateActionsComponent component, MobState newMobState) // WD ahead of wizden
{
if (!TryComp<ActionsComponent>(uid, out var action))
return;
@@ -44,7 +27,7 @@ public sealed class MobStateActionsSystem : EntitySystem
}
component.GrantedActions.Clear();
if (!component.Actions.TryGetValue(newMobState, out var toGrant))
if (!component.Actions.TryGetValue(args.NewMobState, out var toGrant))
return;
foreach (var id in toGrant)