DayZ 1.30
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 (!g_Game.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 vector pos_adjusted = item_GP.GetPosition();
68 pos_adjusted[1] = pos_adjusted[1] + offset;
69
70 if (item_GP.CanBePlaced(player, /*item_GP.GetPosition()*/pos_adjusted) )
71 {
72 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftCloseProjectionVector())))
73 {
74 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightCloseProjectionVector())))
75 {
76 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftFarProjectionVector())))
77 {
78 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightFarProjectionVector())))
79 {
80 hologram.SetIsCollidingGPlot(false);
81
82 return;
83 }
84 }
85 }
86 }
87 }
88
89 hologram.SetIsCollidingGPlot(true);
90 }
91
92 override void DropDuringPlacing(PlayerBase player)
93 {
94 }
95
96 override void OnFinishProgressClient(ActionData action_data)
97 {
98 PlaceObjectActionData poActionData;
99 poActionData = PlaceObjectActionData.Cast(action_data);
100 poActionData.m_AlreadyPlaced = true;
101 }
102
103 override void OnFinishProgressServer(ActionData action_data)
104 {
105 PlaceObjectActionData poActionData;
106 poActionData = PlaceObjectActionData.Cast(action_data);
107 EntityAI entity_for_placing = action_data.m_MainItem;
108 vector position = action_data.m_Player.GetLocalProjectionPosition();
109 vector orientation = action_data.m_Player.GetLocalProjectionOrientation();
110
111 if (g_Game.IsMultiplayer())
112 {
113 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramServer().PlaceEntity(entity_for_placing));
114 m_GardenPlot.SetOrientation(orientation);
115 action_data.m_Player.GetHologramServer().CheckPowerSource();
116 action_data.m_Player.PlacingCompleteServer();
117
118 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
119 }
120
121 //local singleplayer
122 if (!g_Game.IsMultiplayer())
123 {
124 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramLocal().PlaceEntity(entity_for_placing));
125 m_GardenPlot.SetOrientation(orientation);
126 action_data.m_Player.PlacingCompleteServer();
127 action_data.m_Player.PlacingCompleteLocal();
128
129 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
130 }
131
132 g_Game.ClearJuncture(action_data.m_Player, entity_for_placing);
133 action_data.m_MainItem.SetIsBeingPlaced(false);
134 poActionData.m_AlreadyPlaced = true;
135
136 MiscGameplayFunctions.DealEvinronmentAdjustedDmg(action_data.m_MainItem, action_data.m_Player, 10);
137
138 }
139};
bool m_FullBody
Определения ActionBase.c:60
string m_Text
Определения ActionBase.c:57
float m_SpecialtyWeight
Определения ActionBase.c:77
int m_StanceMask
Определения ActionBase.c:61
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Определения ActionDeployObject.c:9
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
vector orientation
Определения DustKickupEffects.c:21
eBrokenLegs
Определения EBrokenLegs.c:2
PlayerBase m_Player
Определения ActionBase.c:40
ItemBase m_MainItem
Определения ActionBase.c:35
Определения ActionBase.c:22
override void SetupAnimation(ItemBase item)
Определения ActionDigGardenPlot.c:54
void ActionDigGardenPlot()
Определения ActionDigGardenPlot.c:13
override void OnFinishProgressServer(ActionData action_data)
Определения ActionDigGardenPlot.c:103
override void OnFinishProgressClient(ActionData action_data)
Определения ActionDigGardenPlot.c:96
override void DropDuringPlacing(PlayerBase player)
Определения ActionDigGardenPlot.c:92
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
static bool GetDisableColdAreaPlacementCheck()
Определения CfgGameplayHandler.c:367
Super root of all classes in Enforce script.
Определения EnScript.c:11
void SetIsCollidingGPlot(bool is_colliding_gplot)
Определения Hologram.c:1360
vector GetLeftFarProjectionVector()
Определения Hologram.c:1107
vector GetRightFarProjectionVector()
Определения Hologram.c:1116
bool IsColliding()
Определения Hologram.c:1373
vector GetLeftCloseProjectionVector()
Определения Hologram.c:1089
vector GetRightCloseProjectionVector()
Определения Hologram.c:1097
EntityAI GetProjectionEntity()
Определения Hologram.c:1332
Определения Hologram.c:2
bool m_AlreadyPlaced
Определения ActionDeployBase.c:5
Определения PlayerBaseClient.c:2
const float DIG_GARDEN
Определения ActionConstants.c:77
Определения ActionConstants.c:28
Определения EnConvert.c:119
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.