ВНИМАНИЕ!!! ОБНАРУЖЕНЫ УЛИТКИ!!! (#774)
This commit is contained in:
@@ -14,9 +14,26 @@ 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;
|
||||
@@ -27,7 +44,7 @@ public sealed class MobStateActionsSystem : EntitySystem
|
||||
}
|
||||
component.GrantedActions.Clear();
|
||||
|
||||
if (!component.Actions.TryGetValue(args.NewMobState, out var toGrant))
|
||||
if (!component.Actions.TryGetValue(newMobState, out var toGrant))
|
||||
return;
|
||||
|
||||
foreach (var id in toGrant)
|
||||
|
||||
Reference in New Issue
Block a user