23 int m_CommandUID = -1;
24 int m_CommandUIDProne = -1;
25 int m_StanceMask = -1;
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++)
205 Debug.ActionLog(
InventoryLocation.DumpToStringNullSafe( action_data.m_ReservedInventoryLocations[i] ), action_data.m_Action.ToString() ,
"n/a",
"LockInventoryList", action_data.m_Player.ToString() );
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;
507 ref ActionTarget target;
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.");
584 action_data.m_Target =
new ActionTarget(NULL, NULL, -1,
vector.Zero, 0);
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);
1209 distanceRoot =
vector.DistanceSq(worldPos, player.GetPosition());
1210 distanceHead =
vector.DistanceSq(worldPos, playerHeadPos);
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 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)
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.
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...
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
void End()
called on surrender end request end
Serializer ParamsReadContext
Serializer ParamsWriteContext
class GP5GasMask extends MaskBase ItemBase
void Error(string err)
Messagebox with error message.
array< string > TStringArray
void Obsolete(string msg="")
enum EObjectTemperatureState m_State