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++)
400 return ActionCondition(action_data.m_Player,action_data.m_Target,action_data.m_MainItem);
428 int componentIndex = -1;
429 int proxyBoneIdx = -1;
434 Object targetObject = null;
435 Object targetParent = null;
439 ctx.
Write(action_data.m_MainItem);
445 targetObject = action_data.m_Target.GetObject();
446 ctx.
Write(targetObject);
447 targetParent = action_data.m_Target.GetParent();
448 ctx.
Write(targetParent);
449 componentIndex = action_data.m_Target.GetComponentIndex();
450 ctx.
Write(componentIndex);
451 cursorHitPos = action_data.m_Target.GetCursorHitPos();
452 ctx.
Write(cursorHitPos);
458 Entity entParent =
Entity.Cast(action_data.m_Target.GetParent());
461 action_data.m_Target.GetObject().GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selectionNames);
462 for (
int s = 0; s < selectionNames.Count(); s++)
464 proxyBoneIdx = entParent.GetBoneIndex(selectionNames[s]);
465 if( proxyBoneIdx > -1 )
472 ctx.
Write(proxyBoneIdx);
473 targetParent = action_data.m_Target.GetParent();
474 ctx.
Write(targetParent);
475 componentIndex = action_data.m_Target.GetComponentIndex();
476 ctx.
Write(componentIndex);
477 cursorHitPos = action_data.m_Target.GetCursorHitPos();
478 ctx.
Write(cursorHitPos);
484 if ( !action_recive_data )
486 action_recive_data =
new ActionReciveData;
488 Object actionTargetObject = null;
489 Object actionTargetParent = null;
490 int componentIndex = -1;
491 int proxyBoneIdx = -1;
499 if ( !ctx.
Read(mainItem) )
505 if ( !ctx.
Read(actionTargetObject) )
508 if ( !ctx.
Read(actionTargetParent))
511 if ( !ctx.
Read(componentIndex) )
514 if ( !ctx.
Read(cursorHitPos) )
517 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
519 action_recive_data.m_Target = target;
523 if ( !ctx.
Read(proxyBoneIdx) )
526 if ( !ctx.
Read(actionTargetParent))
529 if ( !ctx.
Read(componentIndex) )
532 if ( !ctx.
Read(cursorHitPos) )
536 if ( proxyBoneIdx > -1 )
542 actionTargetObject = entParent.GetBoneObject(proxyBoneIdx);
550 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
552 action_recive_data.m_Target = target;
555 action_recive_data.m_MainItem = mainItem;
561 action_data.m_MainItem = action_recive_data.m_MainItem;
565 if (action_recive_data.m_Target)
567 action_data.m_Target = action_recive_data.m_Target;
571 Error(
"Action target not created.");
731 Debug.
ActionLog(
"Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"OnStart", action_data.m_Player.ToString() );
742 action_data.m_Player.SetSoundCategoryHash(soundCat.
Hash());
754 if ( action_data.m_Player )
767 action_data.m_Player.GetActionManager().OnActionEnd();
781 action_data.m_ReciveEndInput =
true;
800 result = !target_player.IsJumpInProgress();
801 result = result && !(target_player.GetCommand_Ladder() || (target_player.GetCommand_Vehicle() && !
CanTargetBeInVehicle()) || target_player.GetCommand_Swim());
810 if ( player.GetCommand_Vehicle() )
815 if ( player.GetCommand_Ladder() )
820 if ( player.IsRestrained() )
825 if ( player.GetCommand_Swim() )
830 if ( player.IsRaised() )
835 if ( player.GetCommand_Move() && player.GetCommand_Move().IsOnBack() )
840 if ( player.GetThrowing().IsThrowingModeEnabled())
845 if (player.IsLeaning())
850 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
855 if (player.GetInputController() && player.GetInputController().CameraIsFreeLook())
871 if (entity && !target.GetObject().IsMan())
873 Man man = entity.GetHierarchyRootPlayer();
874 if (man && man != player)
892 int stanceIdx =
DayZPlayerUtils.ConvertStanceMaskToStanceIdx(nextStance);
893 if (stanceIdx != -1 && !
DayZPlayerUtils.PlayerCanChangeStance(player, stanceIdx ))
904 return Can( player, target, item, condition_mask);
958 return m_VariantManager;
981 if (
ItemBase.CastTo(targetItem,action_data.m_Target.GetObject()) )
984 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
985 if ( action_data.m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
997 handInventoryLocation.
SetHands(action_data.m_Player,action_data.m_Player.GetItemInHands());
999 if (action_data.m_Player.GetInventory().HasInventoryReservation( action_data.m_Player.GetItemInHands(), handInventoryLocation))
1003 action_data.m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
1015 if (targetInventoryLocation)
1016 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
1018 if (handInventoryLocation)
1019 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
1027 if (action_data.m_ReservedInventoryLocations)
1030 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1032 il = action_data.m_ReservedInventoryLocations.Get(i);
1033 action_data.m_Player.GetInventory().ClearInventoryReservationEx( il.
GetItem() , il );
1036 action_data.m_ReservedInventoryLocations.Clear();
1042 if (action_data.m_ReservedInventoryLocations)
1045 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1047 il = action_data.m_ReservedInventoryLocations.Get(i);
1049 action_data.m_Player.GetInventory().ExtendInventoryReservationEx(il.
GetItem() , il, 10000);
1056 bool accepted =
true;
1060 if (
EntityAI.CastTo(targetEntity,action_data.m_Target.GetObject()))
1065 targetEntity.GetInventory().GetCurrentInventoryLocation(targetIl);
1068 if (!
GetGame().AddInventoryJunctureEx(action_data.m_Player, targetEntity, targetIl,
true, 10000))
1074 action_data.m_ReservedInventoryLocations.Insert(targetIl);
1087 if (action_data.m_ReservedInventoryLocations)
1090 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1092 il = action_data.m_ReservedInventoryLocations.Get(i);
1100 action_data.m_ReservedInventoryLocations.Clear();
1107 if (action_data.m_ReservedInventoryLocations)
1110 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
1112 il = action_data.m_ReservedInventoryLocations.Get(i);
1145 return target.GetObject() && target.GetObject().IsDamageDestroyed();
1150 return target.GetObject() && target.GetObject().IsBuilding();
1155 return target.GetObject() && target.GetObject().IsTransport();
1160 Object obj = target.GetObject();
1164 float distanceRoot, distanceHead;
1165 vector modelPos, worldPos, playerHeadPos;
1168 maxDistance = maxDistance * maxDistance;
1171 MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
1174 obj.GetActionComponentNameList(target.GetComponentIndex(), componentNames);
1175 foreach (
string componentName : componentNames)
1177 if (componentName.Contains(
"doorstwin"))
1180 modelPos = obj.GetSelectionPositionMS(componentName);
1181 worldPos = obj.ModelToWorld(modelPos);
1189 return distanceRoot <= maxDistance || distanceHead <= maxDistance;
1198 if (
GetGame().IsServer() && player )
1230 if ( !
GetGame().IsDedicatedServer() )
1232 if (action_data.m_RefreshReservationTimer > 0)
1234 action_data.m_RefreshReservationTimer--;
1246 if (action_data.m_RefreshJunctureTimer > 0)
1248 action_data.m_RefreshJunctureTimer--;
1259 if (action_data.m_Player != NULL && action_data.m_Player.IsPlacingLocal() && !
IsDeploymentAction())
1260 action_data.m_Player.PlacingCancelLocal();
1298 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 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 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)
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)
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