DayZ 1.24
Loading...
Searching...
No Matches
ActionDigOutStash.c File Reference

Go to the source code of this file.

Classes

class  ActionDigOutStashCB
 
class  DigOutStashLambda
 

Functions

ActionDigOutStashCB ActionContinuousBaseCB ActionDigOutStash ()
 
override void CreateActionComponent ()
 
override void CreateConditionComponents ()
 
override bool Can (PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteClient (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 
void SpawnParticleShovelRaise (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 
override string GetAdminLogMessage (ActionData action_data)
 

Function Documentation

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )

Definition at line 36 of file ActionDigOutStash.c.

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 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

◆ ActionDigOutStash()

Definition at line 1 of file ActionDigOutStash.c.

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 }
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
float m_SpecialtyWeight
Definition ActionBase.c:68
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

Referenced by ActionConstructor::RegisterActions(), ItemBase::SetActions(), and FarmingHoe::SetActions().

◆ Can()

override bool Can ( PlayerBase player,
ActionTarget target,
ItemBase item,
int condition_mask )

Definition at line 27 of file ActionDigOutStash.c.

28 {
30 return false;
31
32 return player.CheckFreeSpace(vector.Forward, 1.0, false);
33 }
static const vector Forward
Definition EnConvert.c:109

References vector::Forward.

◆ CreateActionComponent()

override void ActionDigOutStash::CreateActionComponent ( )

Definition at line 12 of file ActionDigOutStash.c.

12 {
13 m_CallbackClass = ActionDigOutStashCB;
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGUPCACHE;
15 m_FullBody = true;

References m_FullBody, m_SpecialtyWeight, m_StanceMask, m_Text, and UASoftSkillsWeight::ROUGH_LOW.

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 21 of file ActionDigOutStash.c.

22 {
25 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetAdminLogMessage()

override string GetAdminLogMessage ( ActionData action_data)

Definition at line 103 of file ActionDigOutStash.c.

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 }

References string::Format().

◆ OnExecuteClient()

override void OnExecuteClient ( ActionData action_data)

Definition at line 48 of file ActionDigOutStash.c.

49 {
50 super.OnExecuteClient(action_data);
51
53 }
void SpawnParticleShovelRaise(ActionData action_data)

References SpawnParticleShovelRaise().

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)

Definition at line 55 of file ActionDigOutStash.c.

56 {
57 super.OnExecuteServer(action_data);
58
59 if (!GetGame().IsMultiplayer())
61 }
proto native CGame GetGame()

References GetGame(), and SpawnParticleShovelRaise().

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)

Definition at line 68 of file ActionDigOutStash.c.

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 }
DayZGame g_Game
Definition DayZGame.c:3528
InventoryLocation.
enum ShapeType ErrorEx

References Class::CastTo(), ErrorEx, g_Game, and m_SpecialtyWeight.

◆ SpawnParticleShovelRaise()

void SpawnParticleShovelRaise ( ActionData action_data)

Definition at line 63 of file ActionDigOutStash.c.

64 {
65 ParticleManager.GetInstance().PlayOnObject(ParticleList.DIGGING_STASH, action_data.m_Player);
66 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
static const int DIGGING_STASH

References ParticleList::DIGGING_STASH, and ParticleManager().

Referenced by OnExecuteClient(), and OnExecuteServer().