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

◆ SpawnEntityOnGroundPos()

override EntityAI ManBase::SpawnEntityOnGroundPos ( string object_name,
vector pos )
inlineprotected

Temporary fix for offset y position (height)

If there is a missmatch between surface y and surface road y we assume owner is bellow or above terrain level and replace the position y with the surface road y

Use owner position y with slight offset to avoid clipping into ground

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

6742 {
6743 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !g_Game.IsMultiplayer())
6744 {
6746 float surfaceY = g_Game.SurfaceY(pos[0], pos[2]);
6747 float roadY = g_Game.SurfaceRoadY(pos[0], pos[2]);
6748 float diffY = surfaceY - roadY;
6749
6750 if (diffY > 0)
6751 {
6754 if (surfaceY != roadY)
6755 {
6756 pos[1] = roadY;
6757 }
6758 }
6759 else
6760 {
6761 float ownerY = GetPosition()[1];
6762 diffY = surfaceY - ownerY;
6763 if (diffY > 0)
6764 {
6766 pos[1] = ownerY + 0.05;
6767 }
6768 }
6769
6770 bool is_AI = g_Game.IsKindOf(object_name, "DZ_LightAI");
6771 if (is_AI)
6772 {
6773 return SpawnAI(object_name, pos);
6774 }
6775 else
6776 {
6777 InventoryLocation inv_loc = new InventoryLocation;
6778 vector mtx[4];
6779 Math3D.MatrixIdentity4(mtx);
6780 mtx[3] = pos;
6781 inv_loc.SetGround(null, mtx);
6782
6783 int flags = ECE_PLACE_ON_SURFACE;
6784 #ifdef DEVELOPER
6785 if (g_Game.IsKindOf(object_name, "Boat"))
6786 flags = ECE_KEEPHEIGHT;
6787 #endif
6788
6789 return EntityAI.Cast(g_Game.CreateObjectEx(object_name, inv_loc.GetPos(), flags));
6790 }
6791 }
6792 return null;
6793 }
class LogManager EntityAI
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:38
const int ECE_KEEPHEIGHT
Определения CentralEconomy.c:28
DayZGame g_Game
Определения DayZGame.c:4074
proto native vector GetPos()
returns position of item in world if type is Ground
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
EntityAI SpawnAI(string object_name, vector pos)
Определения PlayerBase.c:6807
DayZPlayerInstanceType
defined in C++
Определения dayzplayer.c:1084
proto native DayZPlayerInstanceType GetInstanceType()
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473

Перекрестные ссылки ECE_KEEPHEIGHT, ECE_PLACE_ON_SURFACE, g_Game, GetInstanceType(), InventoryLocation::GetPos(), GetPosition(), Math3D::MatrixIdentity4(), InventoryLocation::SetGround() и SpawnAI().

Используется в CreateCopyOfItemInInventoryOrGroundEx(), SpawnEntityOnGroundOnCursorDir() и SpawnEntityOnGroundRaycastDispersed().