Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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;
17 m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_LOW;
18 m_Text = "#dig_stash";
19 }
20
22 {
23 m_ConditionTarget = new CCTObject(UAMaxDistances.DEFAULT);
24 m_ConditionItem = new CCINonRuined();
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
67 void SpawnParticleShovelRaise(ActionData action_data)
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.DealEvinronmentAdjustedDmg(action_data.m_MainItem, action_data.m_Player, 10);
104 }
105
106 override string GetAdminLogMessage(ActionData action_data)
107 {
108 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());
109 }
110}
111
113{
114 void DigOutStashLambda(EntityAI old_item, string new_item_type, PlayerBase player) {}
115
116 override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
117 {
118 super.CopyOldPropertiesToNew(old_item, new_item);
119 }
120}
int m_CommandUID
Definition actionbase.c:31
int m_StanceMask
Definition actionbase.c:33
ActionDigOutStashCB ActionContinuousBaseCB ActionDigOutStash()
void SpawnParticleShovelRaise(ActionData action_data)
ActionData m_ActionData
string GetAdminLogMessage(ActionData action_data)
bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
Definition actionbase.c:897
void CreateConditionComponents()
Definition actionbase.c:230
void OnFinishProgressServer(ActionData action_data)
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
this one is a bit special: it drops all items and destroys the ex-root of the hierarchy
InventoryLocation.
DayZGame g_Game
Definition dayzgame.c:3868
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()
enum ShapeType ErrorEx
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)