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++)
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;
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.");
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());
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);
994 return m_VariantManager;
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);
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);
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);
1228 return distanceRoot <= maxDistance || distanceHead <= maxDistance;
1237 if (
GetGame().IsServer() && player )
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
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
class BaitData m_MainItem
void DayZPlayerUtils()
cannot be instantiated
class GP5GasMask extends MaskBase ItemBase
enum EObjectTemperatureState m_State
proto static native void End()
Finalizes the testing process.
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)
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
bool ClearJunctureEx(Man player, notnull EntityAI item)
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native bool ExtendActionJuncture(Man player, notnull EntityAI item, int timeout_ms)
Super root of all classes in Enforce script.
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
const int c_InventoryReservationTimeoutMS
reservations
script counterpart to engine's class Inventory
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
static string DumpToStringNullSafe(InventoryLocation loc)
proto native EntityAI GetItem()
returns item of current inventory location
static bool IsActionLogEnable()
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
proto bool Write(void value_out)
proto bool Read(void value_in)
bool includeWater
Include water in the surface detection, will return the water if it is higher than the surface.
SurfaceDetectionType type
Type of surface to detect.
RoadSurfaceDetection rsd
See RoadSurfaceDetection, SurfaceTraceType.Roadway only.
vector position
3D position to trace the surface from
UseObjectsMode syncMode
See UseObjectsMode, SurfaceTraceType.Roadway only.
SurfaceInfo surface
Returned SurfaceInfo, plain pointer.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
proto native int Hash()
Returns hash of string.
static const string Empty