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

◆ DropEssentialAttachments()

void DropEssentialAttachments ( Man player,
string partName )
protected

Drop other, non-material attachments tied to the construction part.

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

1339 {
1340 ConstructionPart part = GetConstructionPart(partName);
1341 if (part.HasEssentialAttachmentSlots())
1342 {
1344 ItemBase attachment;
1345 GameInventory parentInventory = m_EntityParent.GetInventory();
1346 vector groundPos;
1347 foreach (string slotName: slots)
1348 {
1349 if (Class.CastTo(attachment, m_EntityParent.FindAttachmentBySlotName(slotName)))
1350 {
1351 //first get rid of any possible locks preventing the drop
1352 parentInventory.SetSlotLock(InventorySlots.GetSlotIdFromString(slotName), false);
1353
1354 //now drop
1355 int mode = InventoryMode.LOCAL;
1356 if (g_Game.IsMultiplayer())
1357 mode = InventoryMode.SERVER;
1358
1359 if (m_EntityParent.MemoryPointExists(slotName))
1360 {
1361 groundPos = m_EntityParent.ModelToWorld(m_EntityParent.GetMemoryPointPos(slotName));
1362 }
1363 else if (player)
1364 {
1365 groundPos = player.GetPosition();
1366 }
1367 else
1368 {
1369 groundPos = attachment.GetPosition();
1370 }
1371
1372 vector m4[4];
1374 m4[3] = groundPos;
1375
1376 parentInventory.DropEntityWithTransform(mode, m_EntityParent, attachment, m4);
1377 }
1378 }
1379 }
1380 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
ConstructionPart GetConstructionPart()
Определения ActionPartInfo.c:235
PlayerSpawnPreset slotName
EntityAI m_EntityParent
Определения ConstructionBase.c:45
DayZGame g_Game
Определения DayZGame.c:4074
Super root of all classes in Enforce script.
Определения EnScript.c:11
bool HasEssentialAttachmentSlots()
Определения ConstructionPart.c:263
array< string > GetEssentialAttachmentSlots()
Определения ConstructionPart.c:305
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
bool DropEntityWithTransform(InventoryMode mode, EntityAI owner, notnull EntityAI item, vector transform[4])
proto native bool SetSlotLock(int slot, bool locked)
script counterpart to engine's class Inventory
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
provides access to slot configuration
Определения InventorySlots.c:6
Определения EnMath3D.c:28
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:119
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Определения EnMath3D.c:256

Перекрестные ссылки Class::CastTo(), GameInventory::DropEntityWithTransform(), g_Game, GetConstructionPart(), ConstructionPart::GetEssentialAttachmentSlots(), InventorySlots::GetSlotIdFromString(), ConstructionPart::HasEssentialAttachmentSlots(), m_EntityParent, Math3D::MatrixIdentity4(), GameInventory::SetSlotLock() и slotName.

Используется в DestroyPartServer() и DismantlePartServerEx().