DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionDigGardenPlot.c
См. документацию.
1class ActionDigGardenPlotCB : ActiondeployObjectCB
2{
3 override void CreateActionComponent()
4 {
5 m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.DIG_GARDEN);
6 }
7};
8
10{
11 GardenPlot m_GardenPlot;
12
14 {
15 m_CallbackClass = ActionDigGardenPlotCB;
16 m_FullBody = true;
17 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
18 m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_LOW;
19 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGMANIPULATE;
20
21 m_Text = "#make_garden_plot";
22 }
23
24 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
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 (!CfgGameplayHandler.GetDisableColdAreaPlacementCheck() && player.GetInColdArea())
34 return false;
35
36 if (player.IsPlacingLocal())
37 {
38 Hologram hologram = player.GetHologramLocal();
39 GardenPlot item_GP;
40 Class.CastTo(item_GP, hologram.GetProjectionEntity());
41 CheckSurfaceBelowGardenPlot(player, item_GP, hologram);
42
43 if (!hologram.IsColliding())
44 {
45 return true;
46 }
47 }
48 return false;
49 }
50 //Server
51 return true;
52 }
53
54 override void SetupAnimation(ItemBase item)
55 {
56 if (item)
57 {
58 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
59 }
60 }
61
62 void CheckSurfaceBelowGardenPlot(PlayerBase player, GardenPlot item_GP, Hologram hologram)
63 {
64 vector min_max[2];
65 item_GP.GetCollisionBox(min_max);
66 float offset = min_max[1][1] - min_max[0][1];
67 //Print(offset);
68 vector pos_adjusted = item_GP.GetPosition();
69 pos_adjusted[1] = pos_adjusted[1] + offset;
70
71 if (item_GP.CanBePlaced(player, /*item_GP.GetPosition()*/pos_adjusted) )
72 {
73 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftCloseProjectionVector())))
74 {
75 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightCloseProjectionVector())))
76 {
77 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftFarProjectionVector())))
78 {
79 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightFarProjectionVector())))
80 {
81 hologram.SetIsCollidingGPlot(false);
82
83 return;
84 }
85 }
86 }
87 }
88 }
89
90 hologram.SetIsCollidingGPlot(true);
91 }
92
93 override void DropDuringPlacing(PlayerBase player)
94 {
95 }
96
97 override void OnFinishProgressClient(ActionData action_data)
98 {
99 PlaceObjectActionData poActionData;
100 poActionData = PlaceObjectActionData.Cast(action_data);
101 poActionData.m_AlreadyPlaced = true;
102 }
103
104 override void OnFinishProgressServer(ActionData action_data)
105 {
106 PlaceObjectActionData poActionData;
107 poActionData = PlaceObjectActionData.Cast(action_data);
108 EntityAI entity_for_placing = action_data.m_MainItem;
109 vector position = action_data.m_Player.GetLocalProjectionPosition();
110 vector orientation = action_data.m_Player.GetLocalProjectionOrientation();
111
112 if (GetGame().IsMultiplayer())
113 {
114 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramServer().PlaceEntity(entity_for_placing));
115 m_GardenPlot.SetOrientation(orientation);
116 action_data.m_Player.GetHologramServer().CheckPowerSource();
117 action_data.m_Player.PlacingCompleteServer();
118
119 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
120 }
121
122 //local singleplayer
123 if (!GetGame().IsMultiplayer())
124 {
125 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramLocal().PlaceEntity(entity_for_placing));
126 m_GardenPlot.SetOrientation(orientation);
127 action_data.m_Player.PlacingCompleteServer();
128 action_data.m_Player.PlacingCompleteLocal();
129
130 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
131 }
132
133 GetGame().ClearJuncture(action_data.m_Player, entity_for_placing);
134 action_data.m_MainItem.SetIsBeingPlaced(false);
135 poActionData.m_AlreadyPlaced = true;
136
137 MiscGameplayFunctions.DealEvinronmentAdjustedDmg(action_data.m_MainItem, action_data.m_Player, 10);
138
139 }
140};
int m_CommandUID
Определения ActionBase.c:31
int m_StanceMask
Определения ActionBase.c:33
ActionBase ActionData
Определения ActionBase.c:30
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Определения ActionDeployObject.c:9
class ActionTargets ActionTarget
eBrokenLegs
Определения EBrokenLegs.c:2
override void SetupAnimation(ItemBase item)
Определения ActionDigGardenPlot.c:54
void ActionDigGardenPlot()
Определения ActionDigGardenPlot.c:13
override void OnFinishProgressServer(ActionData action_data)
Определения ActionDigGardenPlot.c:104
override void OnFinishProgressClient(ActionData action_data)
Определения ActionDigGardenPlot.c:97
override void DropDuringPlacing(PlayerBase player)
Определения ActionDigGardenPlot.c:93
void CheckSurfaceBelowGardenPlot(PlayerBase player, GardenPlot item_GP, Hologram hologram)
Определения ActionDigGardenPlot.c:62
GardenPlot m_GardenPlot
Определения ActionDigGardenPlot.c:11
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionDigGardenPlot.c:24
override void CreateActionComponent()
Определения ActionDigGardenPlot.c:3
proto native bool ClearJuncture(Man player, notnull EntityAI item)
static bool GetDisableColdAreaPlacementCheck()
Определения CfgGameplayHandler.c:332
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения Building.c:6
void SetIsCollidingGPlot(bool is_colliding_gplot)
Определения Hologram.c:1311
vector GetLeftFarProjectionVector()
Определения Hologram.c:1056
vector GetRightFarProjectionVector()
Определения Hologram.c:1065
bool IsColliding()
Определения Hologram.c:1324
vector GetLeftCloseProjectionVector()
Определения Hologram.c:1038
vector GetRightCloseProjectionVector()
Определения Hologram.c:1046
EntityAI GetProjectionEntity()
Определения Hologram.c:1283
Определения Hologram.c:2
Определения InventoryItem.c:731
bool m_AlreadyPlaced
Определения ActionDeployBase.c:5
Определения PlayerBaseClient.c:2
const float DIG_GARDEN
Определения ActionConstants.c:77
Определения ActionConstants.c:28
Определения EnConvert.c:106
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.