DayZ 1.24
Loading...
Searching...
No Matches
ActionDigOutStash.c
Go to the documentation of this file.
2{
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
26
27 override bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
28 {
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 {
39 if (Class.CastTo(target_IB, target.GetObject()))
40 {
41 if (target_IB.CanBeDigged())
42 return target_IB.IsInherited(UndergroundStash);
43 }
44
45 return false;
46 }
47
49 {
50 super.OnExecuteClient(action_data);
51
53 }
54
56 {
57 super.OnExecuteServer(action_data);
58
59 if (!GetGame().IsMultiplayer())
61 }
62
64 {
65 ParticleManager.GetInstance().PlayOnObject(ParticleList.DIGGING_STASH, action_data.m_Player);
66 }
67
69 {
70 EntityAI targetEntity = EntityAI.Cast(action_data.m_Target.GetObject());
71 if (!targetEntity)
72 {
73 ErrorEx("Cannot get entity=" + targetEntity);
74 return;
75 }
76
78 if (!targetEntity.GetInventory().GetCurrentInventoryLocation(target_IL))
79 {
80 ErrorEx("Cannot get inventory location of entity=" + targetEntity);
81 return;
82 }
83
84 // Dig out of stash
85 UndergroundStash stash;
87 {
88 ItemBase stashedItem = stash.GetStashedItem();
89 if (stashedItem)
90 {
92 action_data.m_Player.ServerReplaceItemWithNew(lambda);
93 }
94 else
95 g_Game.ObjectDelete(stash);
96 }
97
98 //Apply tool damage
99 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 10);
100 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
101 }
102
104 {
105 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());
106 }
107}
108
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
void CreateConditionComponents()
Definition ActionBase.c:196
bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
Definition ActionBase.c:641
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
string GetAdminLogMessage(ActionData action_data)
int m_StanceMask
Definition ActionBase.c:53
ActionDigOutStashCB ActionContinuousBaseCB ActionDigOutStash()
void SpawnParticleShovelRaise(ActionData action_data)
DayZGame g_Game
Definition DayZGame.c:3528
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
ActionData m_ActionData
void OnFinishProgressServer(ActionData action_data)
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void OnExecuteServer(ActionData action_data)
void OnExecuteClient(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
void DigOutStashLambda(EntityAI old_item, string new_item_type, PlayerBase player)
this one is a bit special: it drops all items and destroys the ex-root of the hierarchy
InventoryLocation.
static const int DIGGING_STASH
const float DEFAULT
const float DIG_STASH
static const vector Forward
Definition EnConvert.c:109
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.