DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionDeployBase.c
См. документацию.
2{
6}
7
8class ActiondeployObjectCB : ActionContinuousBaseCB
9{
10 override void CreateActionComponent()
11 {
12 m_ActionData.m_ActionComponent = new CAContinuousTime(m_ActionData.m_MainItem.GetDeployTime());
13 }
14
17}
18
20{
21 protected const float POSITION_OFFSET = 0.5; // The forward offset at which the item will be placed (if not using hologram)
22
24
26 {
27 m_CallbackClass = ActiondeployObjectCB;
28 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
29 m_FullBody = true;
30
31 m_Text = "#deploy_object";
32 }
33
35 {
38 }
39
40 override bool HasTarget()
41 {
42 return false;
43 }
44
45 override bool HasProgress()
46 {
47 return true;
48 }
49
51 {
54
55 return action_data;
56 }
57
59 {
60 Vector2 udAngle = new Vector2(-80, -20);
61 return udAngle;
62 }
63
64 override void OnFinishProgressServer(ActionData action_data)
65 {
66 PlaceObjectActionData poActionData;
67 poActionData = PlaceObjectActionData.Cast(action_data);
68
69 if (!poActionData)
70 return;
71
72 if (!action_data.m_MainItem)
73 return;
74
75 EntityAI entity_for_placing = action_data.m_MainItem;
76 vector position;
77 vector orientation;
78
79 // In case of placement with hologram
80 if (action_data.m_Player.GetHologramServer())
81 {
82 position = action_data.m_Player.GetLocalProjectionPosition();
83 orientation = action_data.m_Player.GetLocalProjectionOrientation();
84
85 action_data.m_Player.GetHologramServer().EvaluateCollision(action_data.m_MainItem);
86 if (GetGame().IsMultiplayer() && action_data.m_Player.GetHologramServer().IsColliding())
87 return;
88
89 action_data.m_Player.GetHologramServer().PlaceEntity(entity_for_placing);
90
91 if (GetGame().IsMultiplayer())
92 action_data.m_Player.GetHologramServer().CheckPowerSource();
93 }
94 else
95 {
96 position = action_data.m_Player.GetPosition();
97 orientation = action_data.m_Player.GetOrientation();
98 position = position + (action_data.m_Player.GetDirection() * POSITION_OFFSET);
99 }
100
101 MoveEntityToFinalPosition(action_data, position, orientation);
102 GetGame().ClearJunctureEx(action_data.m_Player, entity_for_placing);
103 action_data.m_MainItem.SetIsBeingPlaced(false);
104 poActionData.m_AlreadyPlaced = true;
105
106 entity_for_placing.OnPlacementComplete(action_data.m_Player, position, orientation); //beware, this WILL fire on server before the item is moved to final position!
107 action_data.m_Player.PlacingCompleteServer();
108
109 m_MovedItems.Clear();
110 }
111
112 override void OnItemLocationChanged(ItemBase item)
113 {
114 super.OnItemLocationChanged(item);
115
116 if (!GetGame().IsDedicatedServer())
117 {
118 if (m_MovedItems)
119 m_MovedItems.Insert(item);
120 }
121 }
122
123 override void OnUpdate(ActionData action_data)
124 {
125 super.OnUpdate(action_data);
126
127 foreach (ItemBase item : m_MovedItems)
128 {
129 if (item == action_data.m_MainItem)
130 {
132 item.GetInventory().GetCurrentInventoryLocation(loc);
133 if (loc && loc.GetType() == InventoryLocationType.GROUND) // if main item is placed on ground during deploy, re-reserve it
134 InventoryReservation(action_data);
135 }
136 }
137
138 m_MovedItems.Clear();
139 }
140
142 {
143 ItemBase item;
144 if (!Class.CastTo(item, player.GetItemInHands()))
145 return;
146
147 if (item.IsBasebuildingKit())
148 return;
149
150 player.PredictiveDropEntity(item);
151 }
152
153 void MoveEntityToFinalPosition(ActionData action_data, vector position, vector orientation)
154 {
155 if (action_data.m_MainItem.IsBasebuildingKit())
156 return;
157
158 EntityAI entity_for_placing = action_data.m_MainItem;
159 vector rotation_matrix[3];
160 float direction[4];
162 InventoryLocation destination = new InventoryLocation;
163
164 Math3D.YawPitchRollMatrix(orientation, rotation_matrix);
165 Math3D.MatrixToQuat(rotation_matrix, direction);
166
167 if (entity_for_placing.GetInventory().GetCurrentInventoryLocation(source))
168 {
169 destination.SetGroundEx(entity_for_placing, position, direction);
170
171 if (GetGame().IsMultiplayer())
172 action_data.m_Player.ServerTakeToDst(source, destination);
173 else // singleplayer
174 MoveEntityToFinalPositionSinglePlayer(action_data, source, destination);
175
176 }
177 }
178
180 {
181 if (HasProgress())
182 action_data.m_Player.GetInventory().TakeToDst(InventoryMode.LOCAL, source, destination); // from ground to target position
183 else
184 action_data.m_Player.GetDayZPlayerInventory().RedirectToHandEvent(InventoryMode.LOCAL, source, destination); // placing directly from inventory
185 }
186}
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
ActionBase ActionData
Определения ActionBase.c:30
void DropDuringPlacing()
DEPRECATED.
ActionEat CreateActionComponent
Определения ActionEat.c:39
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
float m_SpecialtyWeight
Определения ActionBase.c:77
bool InventoryReservation(ActionData action_data)
Определения ActionBase.c:967
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_FullBody
Определения ActionBase.c:61
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
override bool HasTarget()
Определения ActionDeployBase.c:40
void DropDuringPlacing(PlayerBase player)
Определения ActionDeployBase.c:141
override void OnFinishProgressServer(ActionData action_data)
Определения ActionDeployBase.c:64
override void OnItemLocationChanged(ItemBase item)
Определения ActionDeployBase.c:112
override void OnUpdate(ActionData action_data)
Определения ActionDeployBase.c:123
void MoveEntityToFinalPosition(ActionData action_data, vector position, vector orientation)
Определения ActionDeployBase.c:153
override ActionData CreateActionData()
Определения ActionDeployBase.c:50
override Vector2 GetCameraUDAngle()
Определения ActionDeployBase.c:58
override void CreateConditionComponents()
Определения ActionDeployBase.c:34
const float POSITION_OFFSET
Определения ActionDeployBase.c:21
void ActionDeployBase()
Определения ActionDeployBase.c:25
override bool HasProgress()
Определения ActionDeployBase.c:45
ref array< ItemBase > m_MovedItems
Определения ActionDeployBase.c:23
void MoveEntityToFinalPositionSinglePlayer(ActionData action_data, InventoryLocation source, InventoryLocation destination)
Определения ActionDeployBase.c:179
Определения CCINone.c:2
Определения CCTNone.c:2
bool ClearJunctureEx(Man player, notnull EntityAI item)
Определения Game.c:762
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения Building.c:6
proto native int GetType()
returns type of InventoryLocation
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
InventoryLocation.
Определения InventoryLocation.c:29
override bool IsBasebuildingKit()
Определения KitBase.c:5
Определения InventoryItem.c:731
Определения EnMath3D.c:28
vector m_Orientation
Определения ActionDeployBase.c:4
bool m_AlreadyPlaced
Определения ActionDeployBase.c:5
vector m_Position
Определения ActionDeployBase.c:3
Определения PlayerBaseClient.c:2
Определения Vector2.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:106
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto void MatrixToQuat(vector mat[3], out float d[4])
Converts rotation matrix to quaternion.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.