DayZ 1.24
Loading...
Searching...
No Matches
ActionDigGardenPlot Class Reference
Inheritance diagram for ActionDigGardenPlot:
[legend]
Collaboration diagram for ActionDigGardenPlot:
[legend]

Private Member Functions

void ActionDigGardenPlot ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void SetupAnimation (ItemBase item)
 
void CheckSurfaceBelowGardenPlot (PlayerBase player, GardenPlot item_GP, Hologram hologram)
 
override void DropDuringPlacing (PlayerBase player)
 
override void OnFinishProgressClient (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 

Private Attributes

GardenPlot m_GardenPlot
 

Detailed Description

Definition at line 9 of file ActionDigGardenPlot.c.

Constructor & Destructor Documentation

◆ ActionDigGardenPlot()

void ActionDigGardenPlot::ActionDigGardenPlot ( )
inlineprivate

Definition at line 13 of file ActionDigGardenPlot.c.

14 {
15 m_CallbackClass = ActionDigGardenPlotCB;
16 m_FullBody = true;
17 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
19 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGMANIPULATE;
20
21 m_Text = "#make_garden_plot";
22 }
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

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

Member Function Documentation

◆ ActionCondition()

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

Definition at line 24 of file ActionDigGardenPlot.c.

25 {
26 //Client
27 if (!GetGame().IsDedicatedServer())
28 {
29 //Action not allowed if player has broken legs
30 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
31 return false;
32
33 if (player.IsPlacingLocal())
34 {
35 Hologram hologram = player.GetHologramLocal();
36 GardenPlot item_GP;
37 Class.CastTo(item_GP, hologram.GetProjectionEntity());
39
40 if (!hologram.IsColliding())
41 return true;
42 }
43 return false;
44 }
45 //Server
46 return true;
47 }
eBrokenLegs
Definition EBrokenLegs.c:2
void CheckSurfaceBelowGardenPlot(PlayerBase player, GardenPlot item_GP, Hologram hologram)
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), CheckSurfaceBelowGardenPlot(), and GetGame().

◆ CheckSurfaceBelowGardenPlot()

void ActionDigGardenPlot::CheckSurfaceBelowGardenPlot ( PlayerBase player,
GardenPlot item_GP,
Hologram hologram )
inlineprivate

Definition at line 55 of file ActionDigGardenPlot.c.

56 {
57 vector min_max[2];
58 item_GP.GetCollisionBox(min_max);
59 float offset = min_max[1][1] - min_max[0][1];
60 //Print(offset);
61 vector pos_adjusted = item_GP.GetPosition();
63
64 if (item_GP.CanBePlaced(player, /*item_GP.GetPosition()*/pos_adjusted))
65 {
66 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftCloseProjectionVector())))
67 {
68 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightCloseProjectionVector())))
69 {
70 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftFarProjectionVector())))
71 {
72 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightFarProjectionVector())))
73 {
74 hologram.SetIsCollidingGPlot(false);
75
76 return;
77 }
78 }
79 }
80 }
81 }
82
83 hologram.SetIsCollidingGPlot(true);
84 }

Referenced by ActionCondition().

◆ DropDuringPlacing()

override void ActionDigGardenPlot::DropDuringPlacing ( PlayerBase player)
inlineprivate

Definition at line 86 of file ActionDigGardenPlot.c.

87 {
88 }

◆ OnFinishProgressClient()

override void ActionDigGardenPlot::OnFinishProgressClient ( ActionData action_data)
inlineprivate

Definition at line 90 of file ActionDigGardenPlot.c.

◆ OnFinishProgressServer()

override void ActionDigGardenPlot::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 97 of file ActionDigGardenPlot.c.

98 {
102 vector position = action_data.m_Player.GetLocalProjectionPosition();
103 vector orientation = action_data.m_Player.GetLocalProjectionOrientation();
104
105 if (GetGame().IsMultiplayer())
106 {
107 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramServer().PlaceEntity(entity_for_placing));
108 m_GardenPlot.SetOrientation(orientation);
109 action_data.m_Player.GetHologramServer().CheckPowerSource();
110 action_data.m_Player.PlacingCompleteServer();
111
112 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
113 }
114
115 //local singleplayer
116 if (!GetGame().IsMultiplayer())
117 {
118 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramLocal().PlaceEntity(entity_for_placing));
119 m_GardenPlot.SetOrientation(orientation);
120 action_data.m_Player.PlacingCompleteLocal();
121
122 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
123 }
124
125 GetGame().ClearJuncture(action_data.m_Player, entity_for_placing);
126 action_data.m_MainItem.SetIsBeingPlaced(false);
127 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
128 poActionData.m_AlreadyPlaced = true;
129 action_data.m_MainItem.SoundSynchRemoteReset();
130
131 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 10);
132
133 }

References GetGame(), m_GardenPlot, and m_SpecialtyWeight.

◆ SetupAnimation()

override void ActionDigGardenPlot::SetupAnimation ( ItemBase item)
inlineprivate

Definition at line 49 of file ActionDigGardenPlot.c.

50 {
51 if (item)
52 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
53 }

Member Data Documentation

◆ m_GardenPlot

GardenPlot ActionDigGardenPlot::m_GardenPlot
private

Definition at line 11 of file ActionDigGardenPlot.c.

Referenced by OnFinishProgressServer().


The documentation for this class was generated from the following file: