action refactor proper ecs edition (#27422)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Actions.Events;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -22,13 +23,13 @@ public sealed class ActionUpgradeSystem : EntitySystem
|
||||
private void OnActionUpgradeEvent(EntityUid uid, ActionUpgradeComponent component, ActionUpgradeEvent args)
|
||||
{
|
||||
if (!CanUpgrade(args.NewLevel, component.EffectedLevels, out var newActionProto)
|
||||
|| !_actions.TryGetActionData(uid, out var actionComp))
|
||||
|| _actions.GetAction(uid) is not {} action)
|
||||
return;
|
||||
|
||||
var originalContainer = actionComp.Container;
|
||||
var originalAttachedEntity = actionComp.AttachedEntity;
|
||||
var originalContainer = action.Comp.Container;
|
||||
var originalAttachedEntity = action.Comp.AttachedEntity;
|
||||
|
||||
_actionContainer.RemoveAction(uid, actionComp);
|
||||
_actionContainer.RemoveAction((action, action));
|
||||
|
||||
EntityUid? upgradedActionId = null;
|
||||
if (originalContainer != null
|
||||
@@ -150,16 +151,16 @@ public sealed class ActionUpgradeSystem : EntitySystem
|
||||
// RaiseActionUpgradeEvent(newLevel, actionId.Value);
|
||||
|
||||
if (!CanUpgrade(newLevel, actionUpgradeComponent.EffectedLevels, out var newActionPrototype)
|
||||
|| !_actions.TryGetActionData(actionId, out var actionComp))
|
||||
|| _actions.GetAction(actionId) is not {} action)
|
||||
return null;
|
||||
|
||||
newActionProto ??= newActionPrototype;
|
||||
DebugTools.AssertNotNull(newActionProto);
|
||||
|
||||
var originalContainer = actionComp.Container;
|
||||
var originalAttachedEntity = actionComp.AttachedEntity;
|
||||
var originalContainer = action.Comp.Container;
|
||||
var originalAttachedEntity = action.Comp.AttachedEntity;
|
||||
|
||||
_actionContainer.RemoveAction(actionId.Value, actionComp);
|
||||
_actionContainer.RemoveAction((action, action.Comp));
|
||||
|
||||
EntityUid? upgradedActionId = null;
|
||||
if (originalContainer != null
|
||||
|
||||
Reference in New Issue
Block a user