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

◆ ThrowAllItemsInInventory()

static void ThrowAllItemsInInventory ( notnull EntityAI parent,
int flags )
staticprotected

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

1123 {
1124 vector position = parent.GetPosition();
1125 vector orientation = parent.GetOrientation();
1126 vector rotation_matrix[3];
1127 float direction[4];
1128 vector randomPos;
1129 vector minmax[2];
1130 parent.GetCollisionBox(minmax);
1131
1132 Math3D.YawPitchRollMatrix( orientation, rotation_matrix );
1133 Math3D.MatrixToQuat( rotation_matrix, direction );
1134
1135 //gather entities first
1137 int count, i;
1138 //atts
1139 GameInventory parentInventory = parent.GetInventory();
1140 count = parentInventory.AttachmentCount();
1141 for (i = 0; i < count; ++i)
1142 {
1143 ents.Insert(parentInventory.GetAttachmentFromIndex(i));
1144 }
1145
1146 //cargo
1147 CargoBase parentCargo = parentInventory.GetCargo();
1148 count = parentCargo.GetItemCount();
1149 for (i = 0; i < count; ++i)
1150 {
1151 ents.Insert(parentCargo.GetItem(i));
1152 }
1153
1154 //now throw them all
1155 foreach (EntityAI ent : ents)
1156 {
1157 randomPos = Vector(position[0] + Math.RandomFloat(minmax[0][0], minmax[1][0]),
1158 position[1] + Math.RandomFloat(minmax[0][1], minmax[1][1]),
1159 position[2] + Math.RandomFloat(minmax[0][2], minmax[1][2]));
1160 ThrowEntityFromInventory(ent, randomPos, direction, -GetVelocity(parent), ThrowEntityFlags.NONE);
1161 }
1162 }
ThrowEntityFlags
Определения MiscGameplayFunctions.c:208
static void ThrowEntityFromInventory(notnull EntityAI entity, vector position, float direction[4], vector force, int flags)
Определения MiscGameplayFunctions.c:1164
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Определения Cargo.c:7
proto native EntityAI GetAttachmentFromIndex(int index)
proto native CargoBase GetCargo()
cargo
proto native int AttachmentCount()
Returns count of attachments attached to this item.
script counterpart to engine's class Inventory
Определения EnMath3D.c:28
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:119
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
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.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.

Перекрестные ссылки GameInventory::AttachmentCount(), GameInventory::GetAttachmentFromIndex(), GameInventory::GetCargo(), CargoBase::GetItem(), CargoBase::GetItemCount(), GetVelocity(), Math3D::MatrixToQuat(), Math::RandomFloat(), ThrowEntityFromInventory(), Vector() и Math3D::YawPitchRollMatrix().