4 static override array<typename> Requires(IEntityComponentSource src)
16 protected ResourceName m_EntityPrefab;
19 protected SCR_EditableWorldEntityComponent m_Delegate;
20 protected IEntity m_TraceEntity;
21 protected bool m_bHasDelegate;
22 protected vector m_vLocalOffset;
28 void PerformFirstAction(IEntity owner)
30 RplComponent rplComponent = RplComponent.Cast(owner.FindComponent(RplComponent));
31 RplId rplId = rplComponent.Id();
33 Rpc(PerformFirstActionServer, rplId);
35 [
RplRpc(RplChannel.Reliable, RplRcver.Server)]
36 protected void PerformFirstActionServer(RplId rplId)
38 PerformFirstActionBroadcast(rplId);
39 Rpc(PerformFirstActionBroadcast, rplId);
41 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
42 protected void PerformFirstActionBroadcast(RplId rplId)
44 RplComponent rplComponent = RplComponent.Cast(Replication.FindItem(rplId));
45 IEntity owner = rplComponent.GetEntity();
46 BaseActionsManagerComponent actionsManager = BaseActionsManagerComponent.Cast(owner.FindComponent(BaseActionsManagerComponent));
48 action.PerformAction(owner,
GetOwner());
51 override protected void EOnFrame(IEntity owner,
float timeSlice)
53 IEntity traceEntity = m_MenuLayout.GetTraceEntity();
58 m_bHasDelegate =
false;
64 BaseActionsManagerComponent actionsManager = BaseActionsManagerComponent.Cast(traceEntity.FindComponent(BaseActionsManagerComponent));
65 if (actionsManager && actionsManager.GetActionsCount() == 1)
68 m_bHasDelegate = action && action.CanBePerformed(GetManager());
73 array<UserActionContext> contexts = {};
74 actionsManager.GetContextList(contexts);
76 contexts[0].GetTransformationModel(transform);
77 m_vLocalOffset = transform[3];
107 hoverFilter.SetEntityUnderCursor(
m_Delegate,
true);
111 override protected void EOnEditorActivate()
113 IEntity delegateEntity =
GetGame().SpawnEntityPrefab(Resource.Load(m_EntityPrefab));
117 Print(
string.Format(
"Cannot create world entity delegate from prefab @\"%1\", it doesn't have SCR_EditableWorldEntityComponent!"), LogLevel.WARNING);
118 RplComponent.DeleteRplEntity(delegateEntity,
false);
122 SetEventMask(
GetOwner(), EntityEvent.FRAME);
125 override protected void EOnEditorDeactivate()
129 ClearEventMask(
GetOwner(), EntityEvent.FRAME);