23 int m_CommandUID = -1;
24 int m_CommandUIDProne = -1;
25 int m_StanceMask = -1;
88 m_Text =
"default action text";
159 action_data.m_Action =
this;
160 action_data.m_Player = player;
161 action_data.m_Target = target;
162 action_data.m_MainItem = item;
166 action_data.m_WasExecuted =
false;
167 action_data.m_WasActionStarted =
false;
168 action_data.m_ReciveEndInput =
false;
170 ActionReciveData action_recive_data = player.GetActionManager().GetReciveData();
171 if ( action_recive_data )
177 if ( player.GetItemInHands() != action_data.m_MainItem )
197 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
199 Debug.ActionLog(
InventoryLocation.DumpToStringNullSafe( action_data.m_ReservedInventoryLocations[i] ), action_data.m_Action.ToString() ,
"n/a",
"LockInventoryList", action_data.m_Player.ToString() );
406 return ActionCondition(action_data.m_Player,action_data.m_Target,action_data.m_MainItem);
434 int componentIndex = -1;
435 int proxyBoneIdx = -1;
440 Object targetObject = null;
441 Object targetParent = null;
446 ctx.Write(action_data.m_MainItem);
452 targetObject = action_data.m_Target.GetObject();
453 ctx.Write(targetObject);
454 targetParent = action_data.m_Target.GetParent();
455 ctx.Write(targetParent);
456 componentIndex = action_data.m_Target.GetComponentIndex();
457 ctx.Write(componentIndex);
458 cursorHitPos = action_data.m_Target.GetCursorHitPos();
459 ctx.Write(cursorHitPos);
460 surfaceName = action_data.m_Target.GetSurfaceName();
461 ctx.Write(surfaceName);
467 Entity entParent =
Entity.Cast(action_data.m_Target.GetParent());
470 action_data.m_Target.GetObject().GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selectionNames);
471 for (
int s = 0; s < selectionNames.Count(); s++)
473 proxyBoneIdx = entParent.GetBoneIndex(selectionNames[s]);
474 if( proxyBoneIdx > -1 )
481 ctx.Write(proxyBoneIdx);
482 targetParent = action_data.m_Target.GetParent();
483 ctx.Write(targetParent);
484 componentIndex = action_data.m_Target.GetComponentIndex();
485 ctx.Write(componentIndex);
486 cursorHitPos = action_data.m_Target.GetCursorHitPos();
487 ctx.Write(cursorHitPos);
488 surfaceName = action_data.m_Target.GetSurfaceName();
489 ctx.Write(surfaceName);
495 if (!action_recive_data)
496 action_recive_data =
new ActionReciveData;
498 Object actionTargetObject = null;
499 Object actionTargetParent = null;
500 int componentIndex = -1;
501 int proxyBoneIdx = -1;
510 if (!ctx.Read(mainItem))
516 if (!ctx.Read(actionTargetObject))
519 if (!ctx.Read(actionTargetParent))
522 if (!ctx.Read(componentIndex))
525 if (!ctx.Read(cursorHitPos))
528 if (!ctx.Read(surfaceName))
531 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0, surfaceName);
533 action_recive_data.m_Target = target;
537 if (!ctx.Read(proxyBoneIdx))
540 if (!ctx.Read(actionTargetParent))
543 if (!ctx.Read(componentIndex))
546 if (!ctx.Read(cursorHitPos))
549 if (!ctx.Read(surfaceName))
553 if (proxyBoneIdx > -1)
559 actionTargetObject = entParent.GetBoneObject(proxyBoneIdx);
567 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0, surfaceName);
569 action_recive_data.m_Target = target;
572 action_recive_data.m_MainItem = mainItem;
581 surfaceParams.position = cursorHitPos;
582 surfaceParams.includeWater =
true;
584 surfaceParams.rsd = RoadSurfaceDetection.ABOVE;
587 if (
g_Game.GetSurface(surfaceParams, surfaceResult) && surfaceResult.surface)
589 surfaceInfo = surfaceResult.surface;
597 action_data.m_MainItem = action_recive_data.m_MainItem;
601 if (action_recive_data.m_Target)
603 action_data.m_Target = action_recive_data.m_Target;
607 Error(
"Action target not created.");
608 action_data.m_Target =
new ActionTarget(NULL, NULL, -1,
vector.Zero, 0);
761 void Start( ActionData action_data )
767 Debug.ActionLog(
"Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"OnStart", action_data.m_Player.ToString() );
778 action_data.m_Player.SetSoundCategoryHash(soundCat.Hash());
788 void End( ActionData action_data )
790 if ( action_data.m_Player )
803 action_data.m_Player.GetActionManager().OnActionEnd();
817 action_data.m_ReciveEndInput =
true;
836 result = !target_player.IsJumpInProgress();
837 result = result && !(target_player.GetCommand_Ladder() || (target_player.GetCommand_Vehicle() && !
CanTargetBeInVehicle()) || target_player.GetCommand_Swim());
846 if ( player.GetCommand_Vehicle() )
851 if ( player.GetCommand_Ladder() )
856 if ( player.IsRestrained() )
861 if ( player.GetCommand_Swim() )
866 if ( player.IsRaised() )
871 if ( player.GetCommand_Move() && player.GetCommand_Move().IsOnBack() )
876 if ( player.GetThrowing().IsThrowingModeEnabled())
881 if (player.IsLeaning())
886 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
891 if (player.GetInputController() && player.GetInputController().CameraIsFreeLook())
907 if (entity && !target.GetObject().IsMan())
909 Man man = entity.GetHierarchyRootPlayer();
910 if (man && man != player)
928 int stanceIdx = DayZPlayerUtils.ConvertStanceMaskToStanceIdx(nextStance);
929 if (stanceIdx != -1 && !DayZPlayerUtils.PlayerCanChangeStance(player, stanceIdx ))
940 return Can( player, target, item, condition_mask);
1009 bool success =
true;
1017 if (
ItemBase.CastTo(targetItem,action_data.m_Target.GetObject()) )
1020 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
1021 if ( action_data.m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
1033 handInventoryLocation.SetHands(action_data.m_Player,action_data.m_Player.GetItemInHands());
1035 if (action_data.m_Player.GetInventory().HasInventoryReservation( action_data.m_Player.GetItemInHands(), handInventoryLocation))
1039 action_data.m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
1051 if (targetInventoryLocation)
1052 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
1054 if (handInventoryLocation)
1055 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
1065 if (action_data.m_ReservedInventoryLocations)
1068 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1070 il = action_data.m_ReservedInventoryLocations.Get(i);
1071 action_data.m_Player.GetInventory().ClearInventoryReservationEx( il.GetItem() , il );
1074 action_data.m_ReservedInventoryLocations.Clear();
1081 if (action_data.m_ReservedInventoryLocations)
1084 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1086 il = action_data.m_ReservedInventoryLocations.Get(i);
1088 action_data.m_Player.GetInventory().ExtendInventoryReservationEx(il.GetItem() , il, 10000);
1095 bool accepted =
true;
1101 if (
EntityAI.CastTo(targetEntity, action_data.m_Target.GetObject()))
1104 targetEntity.GetInventory().GetCurrentInventoryLocation(targetIl);
1107 if (!
GetGame().AddInventoryJunctureEx(action_data.m_Player, targetEntity, targetIl,
true, 10000))
1113 action_data.m_ReservedInventoryLocations.Insert(targetIl);
1126 if (action_data.m_ReservedInventoryLocations)
1129 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1131 il = action_data.m_ReservedInventoryLocations.Get(i);
1135 GetGame().ClearJunctureEx(action_data.m_Player, entity);
1139 action_data.m_ReservedInventoryLocations.Clear();
1146 if (action_data.m_ReservedInventoryLocations)
1149 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1151 il = action_data.m_ReservedInventoryLocations.Get(i);
1155 GetGame().ExtendActionJuncture(action_data.m_Player, entity, 10000);
1184 return target.GetObject() && target.GetObject().IsDamageDestroyed();
1189 return target.GetObject() && target.GetObject().IsBuilding();
1194 return target.GetObject() && target.GetObject().IsTransport();
1199 Object obj = target.GetObject();
1203 float distanceRoot, distanceHead;
1204 vector modelPos, worldPos, playerHeadPos;
1207 maxDistance = maxDistance * maxDistance;
1210 MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
1213 obj.GetActionComponentNameList(target.GetComponentIndex(), componentNames);
1214 foreach (
string componentName : componentNames)
1216 if (componentName.Contains(
"doorstwin"))
1219 modelPos = obj.GetSelectionPositionMS(componentName);
1220 worldPos = obj.ModelToWorld(modelPos);
1225 distanceRoot =
vector.DistanceSq(worldPos, player.GetPosition());
1226 distanceHead =
vector.DistanceSq(worldPos, playerHeadPos);
1228 return distanceRoot <= maxDistance || distanceHead <= maxDistance;
1237 if (
GetGame().IsServer() && player )
1246 return GetGame().CreateSoundOnObject(player,
m_Sounds.Get(rand_num), 6,
false);
1269 if ( !
GetGame().IsDedicatedServer() )
1271 if (action_data.m_RefreshReservationTimer > 0)
1273 action_data.m_RefreshReservationTimer--;
1285 if (action_data.m_RefreshJunctureTimer > 0)
1287 action_data.m_RefreshJunctureTimer--;
1298 if (action_data.m_Player != NULL && action_data.m_Player.IsPlacingLocal() && !
IsDeploymentAction())
1299 action_data.m_Player.PlacingCancelLocal();
1337 return action_data.m_State;
const int AC_UNCATEGORIZED
int m_RefreshReservationTimer
int m_DelayedAnimationEventID
ref array< ref InventoryLocation > m_ReservedInventoryLocations
int m_RefreshJunctureTimer
ref CABase m_ActionComponent
ref ActionTarget m_Target
class BaitData m_MainItem
float GetProgressWidgetMultiplier(ActionData action_data)
void OnEndClient(ActionData action_data)
bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void SendMessageToClient(Object reciever, string message)
int GetVariants(out array< ref ActionBase > variants)
ActionData CreateActionData()
void ClearActionJuncture(ActionData action_data)
void RefreshActionJuncture(ActionData action_data)
bool CanTargetBeInVehicle()
int m_RefreshReservationTimerValue
void ApplyModifiers(ActionData action_data)
bool DisplayTargetInActionText()
Object GetDisplayInteractObject(PlayerBase player, ActionTarget target)
int GetClosestPossibleStance(PlayerBase player, ActionTarget target, ItemBase item)
bool HasProgress()
For UI: hiding of progress bar.
void End(ActionData action_data)
void OnEndRequest(ActionData action_data)
bool RemoveForceTargetAfterUse()
string GetAdminLogMessage(ActionData action_data)
int GetState(ActionData action_data)
void OnEnd(ActionData action_data)
bool IsDamageDestroyed(ActionTarget target)
bool CanBeUsedInVehicle()
ref ActionVariantManager m_VariantManager
void UpdateVariants(Object item, Object target, int componet_index)
bool CanBePerformedWhileChangingStance()
Condition used in PlayerBase::CanChangeStance to check if stance can be changed while action is perfo...
bool CanBePerformedFromInventory()
int GetStanceMaskEx(PlayerBase player, ActionTarget target, ItemBase item)
void OnUpdateServer(ActionData action_data)
bool InventoryReservation(ActionData action_data)
void OnItemLocationChanged(ItemBase item)
void Start(ActionData action_data)
string GetSoundCategory(ActionData action_data)
void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
bool CanBePerformedFromQuickbar()
void EndInput(ActionData action_data)
void OnUpdateClient(ActionData action_data)
bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
bool CanBeUsedInRestrain()
string GetTargetName(PlayerBase player, ActionTarget target)
int GetRefreshReservationTimerValue()
bool CanBeUsedInFreelook()
bool IsTransport(ActionTarget target)
bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
ref CCIBase m_ConditionItem
ref TStringArray m_Sounds
int GetStanceMask(PlayerBase player)
bool Can(PlayerBase player, ActionTarget target, ItemBase item)
void OnUpdate(ActionData action_data)
bool AddActionJuncture(ActionData action_data)
void RefreshReservations(ActionData action_data)
void ActionCleanup(ActionData action_data)
float GetProgress(ActionData action_data)
bool IsBuilding(ActionTarget target)
SurfaceInfo GetTargetSurfaceInfo(vector cursorHitPos)
bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
bool IsFullBodyEx(PlayerBase player, ActionTarget target, ItemBase item)
void OnStartClient(ActionData action_data)
void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
void OnStartServer(ActionData action_data)
ActionVariantManager GetVariantManager()
bool Post_SetupAction(ActionData action_data)
bool IsDeploymentAction()
Is an action directly related to deployment/advanced placing.
bool ActionConditionContinue(ActionData action_data)
void EndRequest(ActionData action_data)
void ClearInventoryReservationEx(ActionData action_data)
bool CanBeSetFromInventory()
SoundOnVehicle PlayActionSound(PlayerBase player)
void InformPlayers(PlayerBase player, ActionTarget target, int state)
DEPRECATED delivers message ids to clients based on given context.
void OnStart(ActionData action_data)
bool IsUsingProxies()
not using plane object - it's using multiple proxies
void SetInput(ActionInput ai)
bool CanReceiveAction(ActionTarget target)
void OnEndInput(ActionData action_data)
void CreateConditionComponents()
float GetSpecialtyWeight()
void Interrupt(ActionData action_data)
void SetVariantID(int ID)
void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
bool IsFullBody(PlayerBase player)
bool MainItemAlwaysInHands()
ref CCTBase m_ConditionTarget
ref Param1< string > m_MessageParam
bool CanContinue(ActionData action_data)
bool CanBeUsedWithBrokenLegs()
void OnEndServer(ActionData action_data)
static int ComputeConditionMask(PlayerBase player, ActionTarget target, ItemBase item)
void UpdateVariants(Object item, Object target, int componet_index)
int GetActions(out array< ref ActionBase > variants_action)
Super root of all classes in Enforce script.
script counterpart to engine's class Inventory
const int c_InventoryReservationTimeoutMS
reservations
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Serialization general interface. Serializer API works with:
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
array< string > TStringArray
enum EObjectTemperatureState m_State