DayZ 1.24
Loading...
Searching...
No Matches
ActionDigWorms.c
Go to the documentation of this file.
13
15{
17 {
19 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGMANIPULATE;
20 m_FullBody = true;
21 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
23 m_Text = "#dig_up_worms";
24 }
25
31
32 override bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
33 {
35 return false;
36
37 return player.CheckFreeSpace(vector.Forward, 0.8, false);
38 }
39
40 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
41 {
42 if (player.IsPlacingLocal())
43 return false;
44
46 }
47
49 {
50 return IsPlayerOnGround(action_data.m_Player);
51 }
52
54 {
55 if (super.SetupAction(player, target, item, action_data, extra_data))
56 {
57 if (item)
59
60 return true;
61 }
62
63 return false;
64 }
65
66 override bool HasTarget()
67 {
68 return true;
69 }
70
72 {
74 Class.CastTo(worms, GetGame().CreateObjectEx("Worm", action_data.m_Player.GetPosition(), ECE_PLACE_ON_SURFACE));
75 worms.SetQuantity(10, false);
76 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 4);
77 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
78 }
79
81 {
82 if (item.KindOf("Knife"))
83 {
84 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_1HD;
85 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
86 }
87 else
88 {
89 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGMANIPULATE;
90 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
91 }
92 }
93
94 bool IsTargetFertile(ActionTarget target)
95 {
96 if (target)
97 {
98 string surface_type;
100 position = target.GetCursorHitPos();
101
102 GetGame().SurfaceGetType(position[0], position[2], surface_type);
103
104 if (GetGame().IsSurfaceFertile(surface_type))
105 return true;
106 }
107
108 return false;
109 }
110
112 {
113 vector position = player.GetPosition();
114 float heightDiff = GetGame().SurfaceY(position[0], position[2]);
116
117 return heightDiff <= 0.4; // Player is considered on ground
118 }
119};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
const int ECE_PLACE_ON_SURFACE
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
ItemBase m_MainItem
Definition ActionBase.c:28
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
bool IsPlayerOnGround(PlayerBase player)
override bool ActionConditionContinue(ActionData action_data)
void SetDiggingAnimation(ItemBase item)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
bool IsTargetFertile(ActionTarget target)
override bool HasTarget()
Super root of all classes in Enforce script.
Definition EnScript.c:11
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
const float DEFAULT
const float DIG_WORMS
static const vector Forward
Definition EnConvert.c:109
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.