Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -240,7 +240,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
_actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
}
else
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, coords));
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetCoordinates(coords)));
if (!action.Repeat)
StopTargeting();
@@ -253,7 +253,9 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
if (_actionsSystem == null)
return false;
if (!_actionsSystem.ValidateEntityTarget(user, args.EntityUid, action))
var entity = args.EntityUid;
if (!_actionsSystem.ValidateEntityTarget(user, entity, action))
{
if (action.DeselectOnMiss)
StopTargeting();
@@ -265,14 +267,14 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
{
if (action.Event != null)
{
action.Event.Target = args.EntityUid;
action.Event.Target = entity;
action.Event.Performer = user;
}
_actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
}
else
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, args.EntityUid));
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetEntity(args.EntityUid)));
if (!action.Repeat)
StopTargeting();
@@ -741,9 +743,11 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
{
if (_actionsSystem != null && _actionsSystem.TryGetActionData(_menuDragHelper.Dragged?.ActionId, out var action))
{
if (action.EntityIcon != null)
var entIcon = action.EntityIcon;
if (entIcon != null)
{
_dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(action.EntityIcon.Value).Icon?
_dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(entIcon.Value).Icon?
.GetFrame(RSI.State.Direction.South, 0);
}
else if (action.Icon != null)
@@ -958,11 +962,13 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
SelectingTargetFor = actionId;
// override "held-item" overlay
var provider = action.Provider;
if (action.TargetingIndicator && _overlays.TryGetOverlay<ShowHandItemOverlay>(out var handOverlay))
{
if (action.ItemIconStyle == ItemActionIconStyle.BigItem && action.Provider != null)
{
handOverlay.EntityOverride = action.Provider;
handOverlay.EntityOverride = provider;
}
else if (action.Toggled && action.IconOn != null)
handOverlay.IconOverride = _spriteSystem.Frame0(action.IconOn);
@@ -979,9 +985,10 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
return;
Func<EntityUid, bool>? predicate = null;
var attachedEnt = entityAction.AttachedEntity;
if (!entityAction.CanTargetSelf)
predicate = e => e != entityAction.AttachedEntity;
predicate = e => e != attachedEnt;
var range = entityAction.CheckCanAccess ? action.Range : -1;