94 m_Text =
"default action text";
165 action_data.m_Action =
this;
166 action_data.m_Player = player;
167 action_data.m_Target = target;
168 action_data.m_MainItem = item;
172 action_data.m_WasExecuted =
false;
173 action_data.m_WasActionStarted =
false;
174 action_data.m_ReciveEndInput =
false;
176 ActionReciveData action_recive_data = player.GetActionManager().GetReciveData();
177 if ( action_recive_data )
183 if ( player.GetItemInHands() != action_data.m_MainItem )
203 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
412 return ActionCondition(action_data.m_Player,action_data.m_Target,action_data.m_MainItem);
440 int componentIndex = -1;
441 int proxyBoneIdx = -1;
446 Object targetObject = null;
447 Object targetParent = null;
451 ctx.
Write(action_data.m_MainItem);
457 targetObject = action_data.m_Target.GetObject();
458 ctx.
Write(targetObject);
459 targetParent = action_data.m_Target.GetParent();
460 ctx.
Write(targetParent);
461 componentIndex = action_data.m_Target.GetComponentIndex();
462 ctx.
Write(componentIndex);
463 cursorHitPos = action_data.m_Target.GetCursorHitPos();
464 ctx.
Write(cursorHitPos);
470 Entity entParent =
Entity.Cast(action_data.m_Target.GetParent());
473 action_data.m_Target.GetObject().GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selectionNames);
474 for (
int s = 0; s < selectionNames.Count(); s++)
476 proxyBoneIdx = entParent.GetBoneIndex(selectionNames[s]);
477 if( proxyBoneIdx > -1 )
484 ctx.
Write(proxyBoneIdx);
485 targetParent = action_data.m_Target.GetParent();
486 ctx.
Write(targetParent);
487 componentIndex = action_data.m_Target.GetComponentIndex();
488 ctx.
Write(componentIndex);
489 cursorHitPos = action_data.m_Target.GetCursorHitPos();
490 ctx.
Write(cursorHitPos);
496 if ( !action_recive_data )
498 action_recive_data =
new ActionReciveData;
500 Object actionTargetObject = null;
501 Object actionTargetParent = null;
502 int componentIndex = -1;
503 int proxyBoneIdx = -1;
511 if ( !ctx.
Read(mainItem) )
517 if ( !ctx.
Read(actionTargetObject) )
520 if ( !ctx.
Read(actionTargetParent))
523 if ( !ctx.
Read(componentIndex) )
526 if ( !ctx.
Read(cursorHitPos) )
529 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
531 action_recive_data.m_Target = target;
535 if ( !ctx.
Read(proxyBoneIdx) )
538 if ( !ctx.
Read(actionTargetParent))
541 if ( !ctx.
Read(componentIndex) )
544 if ( !ctx.
Read(cursorHitPos) )
548 if ( proxyBoneIdx > -1 )
554 actionTargetObject = entParent.GetBoneObject(proxyBoneIdx);
562 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
564 action_recive_data.m_Target = target;
567 action_recive_data.m_MainItem = mainItem;
573 action_data.m_MainItem = action_recive_data.m_MainItem;
577 if (action_recive_data.m_Target)
579 action_data.m_Target = action_recive_data.m_Target;
583 Error(
"Action target not created.");
743 Debug.
ActionLog(
"Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"OnStart", action_data.m_Player.ToString() );
754 action_data.m_Player.SetSoundCategoryHash(soundCat.
Hash());
766 if ( action_data.m_Player )
779 action_data.m_Player.GetActionManager().OnActionEnd();
793 action_data.m_ReciveEndInput =
true;
812 result = !target_player.IsJumpInProgress();
813 result = result && !(target_player.GetCommand_Ladder() || (target_player.GetCommand_Vehicle() && !
CanTargetBeInVehicle()) || target_player.GetCommand_Swim());
822 if ( player.GetCommand_Vehicle() )
827 if ( player.GetCommand_Ladder() )
832 if ( player.IsRestrained() )
837 if ( player.GetCommand_Swim() )
842 if ( player.IsRaised() )
847 if ( player.GetCommand_Move() && player.GetCommand_Move().IsOnBack() )
852 if ( player.GetThrowing().IsThrowingModeEnabled())
857 if (player.IsLeaning())
862 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
867 if (player.GetInputController() && player.GetInputController().CameraIsFreeLook())
883 if (entity && !target.GetObject().IsMan())
885 Man man = entity.GetHierarchyRootPlayer();
886 if (man && man != player)
904 int stanceIdx =
DayZPlayerUtils.ConvertStanceMaskToStanceIdx(nextStance);
905 if (stanceIdx != -1 && !
DayZPlayerUtils.PlayerCanChangeStance(player, stanceIdx ))
916 return Can( player, target, item, condition_mask);
970 return m_VariantManager;
981 if (
g_Game.IsDedicatedServer())
996 if (
ItemBase.CastTo(targetItem,action_data.m_Target.GetObject()) )
999 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
1000 if ( action_data.m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
1012 handInventoryLocation.
SetHands(action_data.m_Player,action_data.m_Player.GetItemInHands());
1014 if (action_data.m_Player.GetInventory().HasInventoryReservation( action_data.m_Player.GetItemInHands(), handInventoryLocation))
1018 action_data.m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
1030 if (targetInventoryLocation)
1031 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
1033 if (handInventoryLocation)
1034 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
1044 if (action_data.m_ReservedInventoryLocations)
1047 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1049 il = action_data.m_ReservedInventoryLocations.Get(i);
1050 action_data.m_Player.GetInventory().ClearInventoryReservationEx( il.
GetItem() , il );
1053 action_data.m_ReservedInventoryLocations.Clear();
1062 if (action_data.m_ReservedInventoryLocations)
1065 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1067 il = action_data.m_ReservedInventoryLocations.Get(i);
1069 action_data.m_Player.GetInventory().ExtendInventoryReservationEx(il.
GetItem() , il, 10000);
1077 bool accepted =
true;
1083 if (
EntityAI.CastTo(targetEntity, action_data.m_Target.GetObject()))
1086 targetEntity.GetInventory().GetCurrentInventoryLocation(targetIl);
1089 if (!
g_Game.AddInventoryJunctureEx(action_data.m_Player, targetEntity, targetIl,
true, 10000, action_data))
1095 action_data.m_ReservedInventoryLocations.Insert(targetIl);
1108 if (action_data.m_ReservedInventoryLocations)
1111 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1113 il = action_data.m_ReservedInventoryLocations.Get(i);
1117 g_Game.ClearJunctureEx(action_data.m_Player, entity);
1121 action_data.m_ReservedInventoryLocations.Clear();
1126 [
Obsolete(
"Handled by 'ActionData.OnJunctureTimedOut' now")]
1130 if (action_data.m_ReservedInventoryLocations)
1133 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1135 il = action_data.m_ReservedInventoryLocations.Get(i);
1139 g_Game.ExtendActionJuncture(action_data.m_Player, entity, 10000);
1168 return target.GetObject() && target.GetObject().IsDamageDestroyed();
1173 return target.GetObject() && target.GetObject().IsBuilding();
1178 return target.GetObject() && target.GetObject().IsTransport();
1183 Object obj = target.GetObject();
1187 float distanceRoot, distanceHead;
1188 vector modelPos, worldPos, playerHeadPos;
1191 maxDistance = maxDistance * maxDistance;
1194 MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
1197 obj.GetActionComponentNameList(target.GetComponentIndex(), componentNames);
1198 foreach (
string componentName : componentNames)
1200 if (componentName.Contains(
"doorstwin"))
1203 modelPos = obj.GetSelectionPositionMS(componentName);
1204 worldPos = obj.ModelToWorld(modelPos);
1212 return distanceRoot <= maxDistance || distanceHead <= maxDistance;
1221 if (
g_Game.IsServer() && player )
1225 return g_Game.CreateSoundOnObject(player,
m_Sound, 6,
false);
1230 return g_Game.CreateSoundOnObject(player,
m_Sounds.Get(rand_num), 6,
false);
1253 if ( !
g_Game.IsDedicatedServer() )
1255 if (action_data.m_RefreshReservationTimer > 0)
1257 action_data.m_RefreshReservationTimer--;
1273 if (action_data.m_Player != NULL && action_data.m_Player.IsPlacingLocal() && !
IsDeploymentAction())
1274 action_data.m_Player.PlacingCancelLocal();
1312 return action_data.m_State;
const int AC_UNCATEGORIZED
event float OnJunctureTimedOut()
int m_RefreshReservationTimer
int m_DelayedAnimationEventID
ref array< ref InventoryLocation > m_ReservedInventoryLocations
int m_RefreshJunctureTimer
ref CABase m_ActionComponent
ref ActionTarget m_Target
class ActionTargets ActionTarget
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)
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)
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)
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
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
void Obsolete(string msg="")
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