DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ItemFall()

void ItemFall ( string partName)
protected

Temp fix for DZ-32838

We checking if the item instance still exists as it could have been deleted with the OnItemFallRebuilding call

См. определение в файле ConstructionBase.c строка 250

251 {
252 vector minMax[2];
253 if (!GetItemFallDetectionBoxData(partName, minMax))
254 {
255 ErrorEx(string.Format("Wrong collision_data configuration of %1 for object %2; valid collision_data must contain exactly 2 strings (min/max) or must be a base building object for auto evaluation for boundings!", partName, m_EntityParent), ErrorExSeverity.INFO);
256 return;
257 }
258
259 vector center = GetBoxCenter(minMax);
260 center = m_EntityParent.ModelToWorld(center); //convert to world coordinates
261 vector edgeLength = GetCollisionBoxSize(minMax);
262 vector orientation = m_EntityParent.GetOrientation();
264 params.SetParams(center, orientation, edgeLength, ObjIntersect.View, ObjIntersect.Geom, false);
265
266 array<Object> excludes; //null by default
268
269 if (g_Game.IsBoxCollidingGeometryProxy(params, excludes, results))
270 {
271 foreach (BoxCollidingResult res : results)
272 {
273 if (res.obj == m_EntityParent) //skip parent
274 continue;
275
276 Physics objPhysics = res.obj.GetPhysics();
277 SimulationState simState = objPhysics.GetSimulationState();
278 if (simState != SimulationState.NONE && simState != SimulationState.COLLISION)
279 continue;
280
281 Transport vehicle;
282 if (Class.CastTo(vehicle, res.obj)) //special treatment for transports
283 {
284 dBodyActive(vehicle, ActiveState.ACTIVE);
285 continue;
286 }
287
288 PlayerBase player;
289 if (Class.CastTo(player, res.obj)) //special treatment for characters
290 {
291 objPhysics.ApplyImpulse(-vector.Up * 0.01);
292 continue;
293 }
294
295 InventoryItem item;
296 if (Class.CastTo(item, res.obj))
297 {
298 item.OnItemFallRebuilding();
299 if (item)
300 item.ThrowPhysically(null, vector.Zero);
301 }
302 }
303 }
304 }
vector GetBoxCenter(vector min_max[2])
Определения ConstructionBase.c:1634
vector GetCollisionBoxSize(vector min_max[2])
Определения ConstructionBase.c:1574
bool GetItemFallDetectionBoxData(string partName, out vector minMax[2])
Определения ConstructionBase.c:1608
EntityAI m_EntityParent
Определения ConstructionBase.c:45
DayZGame g_Game
Определения DayZGame.c:4074
vector orientation
Определения DustKickupEffects.c:21
proto native void SetParams(vector center, vector orientation, vector edgeLength, ObjIntersect primaryType, ObjIntersect secondaryType, bool fullComponentInfo)
Set the parameters.
Class that holds parameters to feed into CGame.IsBoxCollidingGeometryProxy.
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения Feet.c:1
proto external SimulationState GetSimulationState()
Returns simulation state of the physics body.
proto external void ApplyImpulse(vector impulse)
Applies impulse on the physics body.
Определения Physics.c:17
Определения PlayerBaseClient.c:2
Native class for boats - handles physics simulation.
Определения Boat.c:29
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Zero
Определения EnConvert.c:123
static const vector Up
Определения EnConvert.c:120
Определения EnConvert.c:119
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
SimulationState
Определения SimulationState.c:13
ActiveState
Определения ActiveState.c:10
proto native void dBodyActive(notnull IEntity ent, ActiveState activeState)

Перекрестные ссылки Physics::ApplyImpulse(), Class::CastTo(), dBodyActive(), ErrorEx, g_Game, GetBoxCenter(), GetCollisionBoxSize(), GetItemFallDetectionBoxData(), Physics::GetSimulationState(), m_EntityParent, orientation, BoxCollidingParams::SetParams(), vector::Up и vector::Zero.

Используется в HandleEntityFalling().