Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiondigoutstash.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.DIG_STASH);
6  }
7 }
8 
10 {
12  {
13  m_CallbackClass = ActionDigOutStashCB;
14  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGUPCACHE;
15  m_FullBody = true;
16  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
18  m_Text = "#dig_stash";
19  }
20 
21  override void CreateConditionComponents()
22  {
25  }
26 
27  override bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
28  {
29  if (!super.Can(player, target, item, condition_mask))
30  return false;
31 
32  return player.CheckFreeSpace(vector.Forward, 1.0, false);
33  }
34 
35 
36  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
37  {
38  ItemBase target_IB;
39  if (Class.CastTo(target_IB, target.GetObject()))
40  {
41  if (target_IB.CanBeDigged())
42  {
43  return target_IB.IsInherited(UndergroundStash);
44  }
45  }
46 
47  return false;
48  }
49 
50  override void OnExecuteClient(ActionData action_data)
51  {
52  super.OnExecuteClient(action_data);
53 
54  SpawnParticleShovelRaise(action_data);
55  }
56 
57  override void OnExecuteServer(ActionData action_data)
58  {
59  super.OnExecuteServer(action_data);
60 
61  if (!GetGame().IsMultiplayer())
62  {
63  SpawnParticleShovelRaise(action_data);
64  }
65  }
66 
68  {
69  ParticleManager.GetInstance().PlayOnObject(ParticleList.DIGGING_STASH, action_data.m_Player);
70  }
71 
72  override void OnFinishProgressServer( ActionData action_data )
73  {
74  EntityAI targetEntity = EntityAI.Cast(action_data.m_Target.GetObject());
75  if (!targetEntity)
76  {
77  ErrorEx("Cannot get entity=" + targetEntity);
78  return;
79  }
80 
81  InventoryLocation target_IL = new InventoryLocation();
82  if (!targetEntity.GetInventory().GetCurrentInventoryLocation(target_IL))
83  {
84  ErrorEx("Cannot get inventory location of entity=" + targetEntity);
85  return;
86  }
87 
88  // Dig out of stash
89  UndergroundStash stash;
90  if (Class.CastTo(stash, targetEntity))
91  {
92  ItemBase stashedItem = stash.GetStashedItem();
93  if (stashedItem)
94  {
95  DigOutStashLambda lambda(stash, "", action_data.m_Player);
96  action_data.m_Player.ServerReplaceItemWithNew(lambda);
97  }
98  else
99  g_Game.ObjectDelete(stash);
100  }
101 
102  //Apply tool damage
103  MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 10);
104  action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
105  }
106 
107  override string GetAdminLogMessage(ActionData action_data)
108  {
109  return string.Format("Player %1 Dug out %2 at position %3", action_data.m_Player, action_data.m_Target.GetObject(), action_data.m_Target.GetObject().GetPosition());
110  }
111 }
112 
114 {
115  void DigOutStashLambda(EntityAI old_item, string new_item_type, PlayerBase player) {}
116 
117  override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
118  {
119  super.CopyOldPropertiesToNew(old_item, new_item);
120  }
121 }
ItemBase
Definition: inventoryitem.c:730
OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition: actiondigoutstash.c:57
GetGame
proto native CGame GetGame()
SpawnParticleShovelRaise
void SpawnParticleShovelRaise(ActionData action_data)
Definition: actiondigoutstash.c:67
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actiondigoutstash.c:36
UASoftSkillsWeight
Definition: actionconstants.c:118
Can
override bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
Definition: actiondigoutstash.c:27
CCTObject
Definition: cctobject.c:1
ActionDigOutStashCB
Definition: actiondigoutstash.c:1
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
UAMaxDistances
Definition: actionconstants.c:104
ErrorEx
enum ShapeType ErrorEx
GetAdminLogMessage
override string GetAdminLogMessage(ActionData action_data)
Definition: actiondigoutstash.c:107
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
ParticleList
Definition: particlelist.c:11
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actiondigoutstash.c:72
DropEquipAndDestroyRootLambda
this one is a bit special: it drops all items and destroys the ex-root of the hierarchy
Definition: miscgameplayfunctions.c:115
DigOutStashLambda
Definition: actiondigoutstash.c:113
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
ActionDigOutStash
ActionDigOutStashCB ActionContinuousBaseCB ActionDigOutStash()
Definition: actiondigoutstash.c:11
m_Text
protected string m_Text
Definition: actionbase.c:49
OnExecuteClient
override void OnExecuteClient(ActionData action_data)
Definition: actiondigoutstash.c:50
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CreateConditionComponents
override void CreateConditionComponents()
Definition: actiondigoutstash.c:21
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
ParticleManager
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition: particlemanager.c:84
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
EntityAI
Definition: building.c:5