88 m_Text =
"default action text";
98 if (!
GetGame().IsDedicatedServer())
168 Debug.
ActionLog(
"STS = " + player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"SetupAction", player.ToString() );
172 action_data.m_Action =
this;
173 action_data.m_Player = player;
174 action_data.m_Target = target;
175 action_data.m_MainItem = item;
179 action_data.m_WasExecuted =
false;
180 action_data.m_WasActionStarted =
false;
181 action_data.m_ReciveEndInput =
false;
183 ActionReciveData action_recive_data = player.GetActionManager().GetReciveData();
184 if ( action_recive_data )
190 if ( player.GetItemInHands() != action_data.m_MainItem )
211 for (
int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
469 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"WriteToContext", action_data.
m_Player.ToString() );
472 int componentIndex = -1;
473 int proxyBoneIdx = -1;
478 Object targetObject = null;
479 Object targetParent = null;
489 targetObject = action_data.
m_Target.GetObject();
490 ctx.
Write(targetObject);
491 targetParent = action_data.
m_Target.GetParent();
492 ctx.
Write(targetParent);
493 componentIndex = action_data.
m_Target.GetComponentIndex();
494 ctx.
Write(componentIndex);
495 cursorHitPos = action_data.
m_Target.GetCursorHitPos();
496 ctx.
Write(cursorHitPos);
505 action_data.
m_Target.GetObject().GetActionComponentNameList(action_data.
m_Target.GetComponentIndex(), selectionNames);
506 for (
int s = 0; s < selectionNames.Count(); s++)
508 proxyBoneIdx = entParent.GetBoneIndex(selectionNames[s]);
509 if( proxyBoneIdx > -1 )
516 ctx.
Write(proxyBoneIdx);
517 targetParent = action_data.
m_Target.GetParent();
518 ctx.
Write(targetParent);
519 componentIndex = action_data.
m_Target.GetComponentIndex();
520 ctx.
Write(componentIndex);
521 cursorHitPos = action_data.
m_Target.GetCursorHitPos();
522 ctx.
Write(cursorHitPos);
528 if ( !action_recive_data )
530 action_recive_data =
new ActionReciveData;
532 Object actionTargetObject = null;
533 Object actionTargetParent = null;
534 int componentIndex = -1;
535 int proxyBoneIdx = -1;
543 if ( !ctx.
Read(mainItem) )
549 if ( !ctx.
Read(actionTargetObject) )
552 if ( !ctx.
Read(actionTargetParent))
555 if ( !ctx.
Read(componentIndex) )
558 if ( !ctx.
Read(cursorHitPos) )
561 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
563 action_recive_data.m_Target = target;
567 if ( !ctx.
Read(proxyBoneIdx) )
570 if ( !ctx.
Read(actionTargetParent))
573 if ( !ctx.
Read(componentIndex) )
576 if ( !ctx.
Read(cursorHitPos) )
580 if ( proxyBoneIdx > -1 )
586 actionTargetObject = entParent.GetBoneObject(proxyBoneIdx);
594 target =
new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
596 action_recive_data.m_Target = target;
599 action_recive_data.m_MainItem = mainItem;
608 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"HandleReciveData", action_data.
m_Player.ToString() );
611 action_data.
m_MainItem = action_recive_data.m_MainItem;
615 if (action_recive_data.m_Target)
617 action_data.
m_Target = action_recive_data.m_Target;
621 Error(
"Action target not created.");
792 action_data.
m_Player.SetSoundCategoryHash(soundCat.
Hash());
817 action_data.
m_Player.GetActionManager().OnActionEnd();
826 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"Interrupt", action_data.
m_Player.ToString() );
855 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"EndRequest", action_data.
m_Player.ToString() );
868 result = !target_player.IsJumpInProgress();
869 result = result && !(target_player.GetCommand_Ladder() || (target_player.GetCommand_Vehicle() && !
CanTargetBeInVehicle()) || target_player.GetCommand_Swim());
878 if ( player.GetCommand_Vehicle() )
883 if ( player.GetCommand_Ladder() )
888 if ( player.IsRestrained() )
893 if ( player.GetCommand_Swim() )
898 if ( player.IsRaised() )
903 if ( player.GetCommand_Move() && player.GetCommand_Move().IsOnBack() )
908 if ( player.GetThrowing().IsThrowingModeEnabled())
913 if (player.IsLeaning())
918 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
923 if (player.GetInputController() && player.GetInputController().CameraIsFreeLook())
939 if (entity && !target.GetObject().IsMan())
941 Man man = entity.GetHierarchyRootPlayer();
942 if (man && man != player)
960 int stanceIdx =
DayZPlayerUtils.ConvertStanceMaskToStanceIdx(nextStance);
961 if (stanceIdx != -1 && !
DayZPlayerUtils.PlayerCanChangeStance(player, stanceIdx ))
972 return Can( player, target, item, condition_mask);
982 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp() +
" Failded",
this.ToString() ,
"n/a",
"CanContinue", action_data.
m_Player.ToString() );
995 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp() +
" Failded condition",
this.ToString() ,
"n/a",
"CanContinue", action_data.
m_Player.ToString() );
1044 return m_VariantManager;
1055#ifdef ENABLE_LOGGING
1058 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"InventoryReservation", action_data.
m_Player.ToString() );
1061 if (
g_Game.IsDedicatedServer())
1068 bool success =
true;
1079 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
1080 if ( action_data.
m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
1094 if (action_data.
m_Player.GetInventory().HasInventoryReservation( action_data.
m_Player.GetItemInHands(), handInventoryLocation))
1098 action_data.
m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
1110 if (targetInventoryLocation)
1113 if (handInventoryLocation)
1124#ifdef ENABLE_LOGGING
1127 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"ClearInventoryReservationEx", action_data.
m_Player.ToString() );
1136 action_data.
m_Player.GetInventory().ClearInventoryReservationEx( il.
GetItem() , il );
1148#ifdef ENABLE_LOGGING
1151 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"RefreshReservations", action_data.
m_Player.ToString() );
1161 action_data.
m_Player.GetInventory().ExtendInventoryReservationEx(il.
GetItem() , il, 10000);
1169 bool accepted =
true;
1172#ifdef ENABLE_LOGGING
1175 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"AddActionJuncture", action_data.
m_Player.ToString() );
1181 if (targetEntity && !targetEntity.IsSetForDeletion())
1183 if(!targetEntity.GetInventory())
1185 ErrorEx(
"Error: Target does not have inventory");
1189 targetEntity.GetInventory().GetCurrentInventoryLocation(targetIl);
1192 if (!
g_Game.AddInventoryJunctureEx(action_data.
m_Player, targetEntity, targetIl,
true, 10000, action_data))
1211#ifdef ENABLE_LOGGING
1214 Debug.
ActionLog(
"STS = " + action_data.
m_Player.GetSimulationTimeStamp(),
this.ToString() ,
"n/a",
"ClearActionJuncture", action_data.
m_Player.ToString() );
1235 [
Obsolete(
"Handled by 'ActionData.OnJunctureTimedOut' now")]
1248 g_Game.ExtendActionJuncture(action_data.
m_Player, entity, 10000);
1277 return target.GetObject() && target.GetObject().IsDamageDestroyed();
1282 return target.GetObject() && target.GetObject().IsBuilding();
1287 return target.GetObject() && target.GetObject().IsTransport();
1292 Object obj = target.GetObject();
1296 float distanceRoot, distanceHead;
1297 vector modelPos, worldPos;
1300 maxDistance = maxDistance * maxDistance;
1301 vector playerPosition = player.GetPosition();
1302 vector playerHeadPos = MiscGameplayFunctions.GetPlayerHeadPosition(player);
1305 obj.GetActionComponentNameList(target.GetComponentIndex(), componentNames);
1306 bool inReach =
false;
1307 foreach (
string componentName : componentNames)
1309 modelPos = obj.GetSelectionPositionMS(componentName);
1310 worldPos = obj.ModelToWorld(modelPos);
1314 inReach |= distanceRoot <= maxDistance || distanceHead <= maxDistance;
1326 if (
g_Game.IsServer() && player )
1330 return g_Game.CreateSoundOnObject(player,
m_Sound, 6,
false);
1335 return g_Game.CreateSoundOnObject(player,
m_Sounds.Get(rand_num), 6,
false);
1358 if ( !
g_Game.IsDedicatedServer() )
1378#ifdef ENABLE_LOGGING
1385 action_data.
m_Player.PlacingCancelLocal();
1398#ifdef ENABLE_LOGGING
void OnUpdateServer(float deltatime, float blood_scale, bool no_blood_loss)
const int AC_UNCATEGORIZED
ActionData CreateActionData()
bool CanBeUsedInFreelook()
bool InventoryReservation(ActionData action_data)
bool CanBeSetFromInventory()
bool CanBeStarted()
If for some reason we want a non-performable action (like pure info ones)
void RefreshActionJuncture(ActionData action_data)
bool IsTargetInfoAction()
Should we display additional info panel on ActionTargetsCursor.
bool ActionConditionContinue(ActionData action_data)
class ActionData m_RefreshReservationTimerValue
ref ActionInfoDataBase m_InfoData
ActionVariantManager GetVariantManager()
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
float GetSpecialtyWeight()
void SendMessageToClient(Object reciever, string message)
void ApplyModifiers(ActionData action_data)
void OnEndInput(ActionData action_data)
void OnEndServer(ActionData action_data)
void InformPlayers(PlayerBase player, ActionTarget target, int state)
DEPRECATED delivers message ids to clients based on given context.
static int ComputeConditionMask(PlayerBase player, ActionTarget target, ItemBase item)
bool IsDamageDestroyed(ActionTarget target)
bool IsUsingProxies()
not using plane object - it's using multiple proxies
bool DisplayTargetInActionText()
bool MainItemAlwaysInHands()
void OnStartClient(ActionData action_data)
void CreateConditionComponents()
int GetClosestPossibleStance(PlayerBase player, ActionTarget target, ItemBase item)
bool CanBeUsedWithBrokenLegs()
void RefreshReservations(ActionData action_data)
bool IsBuilding(ActionTarget target)
bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
ref CCIBase m_ConditionItem
void OnStartServer(ActionData action_data)
int GetStanceMaskEx(PlayerBase player, ActionTarget target, ItemBase item)
bool CanContinue(ActionData action_data)
ref CCTBase m_ConditionTarget
SoundOnVehicle PlayActionSound(PlayerBase player)
void SetVariantID(int ID)
void UpdateVariants(Object item, Object target, int componet_index)
bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
void ClearInventoryReservationEx(ActionData action_data)
void SetInput(ActionInput ai)
void ClearActionJuncture(ActionData action_data)
void OnEndRequest(ActionData action_data)
void EndInput(ActionData action_data)
bool IsFullBodyEx(PlayerBase player, ActionTarget target, ItemBase item)
bool CanBePerformedFromQuickbar()
void OnItemLocationChanged(ItemBase item)
bool RemoveForceTargetAfterUse()
ActionInfoDataBase GetClientActionInfo()
bool CanReceiveAction(ActionTarget target)
bool IsTransport(ActionTarget target)
string GetTargetName(PlayerBase player, ActionTarget target)
bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
int GetRefreshReservationTimerValue()
string GetAdminLogMessage(ActionData action_data)
float GetProgress(ActionData action_data)
bool HasProgress()
For UI: hiding of progress bar.
void ActionCleanup(ActionData action_data)
void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
bool CanBeUsedInRestrain()
bool CanBePerformedFromInventory()
bool IsDeploymentAction()
Is an action directly related to deployment/advanced placing.
bool CanBeUsedInVehicle()
ref Param1< string > m_MessageParam
Object GetDisplayInteractObject(PlayerBase player, ActionTarget target)
bool CanTargetBeInVehicle()
ref ActionVariantManager m_VariantManager
void OnEndClient(ActionData action_data)
ref ActionTarget m_Target
ref TStringArray m_Sounds
bool AddActionJuncture(ActionData action_data)
int GetVariants(out array< ref ActionBase > variants)
void EndRequest(ActionData action_data)
bool Post_SetupAction(ActionData action_data)
bool CanBePerformedWhileChangingStance()
Condition used in PlayerBase::CanChangeStance to check if stance can be changed while action is perfo...
override float GetProgressWidgetMultiplier()
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
class BaitData m_MainItem
void DayZPlayerUtils()
cannot be instantiated
void Start()
Plays all elements this effects consists of.
int GetID()
Get the ID registered in SEffectManager.
void SetID(int id)
Set the ID registered in SEffectManager.
override void OnUpdateClient(PlayerBase player, float deltatime)
void ReadFromContext(ParamsReadContext ctx)
void WriteToContext(ParamsWriteContext ctx)
string GetSoundCategory(int ingredientIndex, ItemBase item)
proto static native void End()
Finalizes the testing process.
ref ActionTarget m_Target
int m_RefreshReservationTimer
ref CABase m_ActionComponent
int m_RefreshJunctureTimer
ref array< ref InventoryLocation > m_ReservedInventoryLocations
int m_DelayedAnimationEventID
event float OnJunctureTimedOut()
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.
class array< Class T > 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
proto native int GetState()
returns one of STATE_...