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

◆ GetClosestCarWheel()

EntityAI GetClosestCarWheel ( EntityAI victim)
protected

carscript specific handling (not all traps are uses this)

ruined wheel, bail out

ignore all spare wheel

actual, healthy wheel, let it pass

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

624 {
626 vector trapPosXZ = GetPosition();
627 trapPosXZ[1] = 0;
628
629 GameInventory inv = victim.GetInventory();
630 for (int i = 0; i < inv.AttachmentCount(); i++)
631 {
633 EntityAI wheelEntity = inv.GetAttachmentFromIndex(i);
634 if (wheelEntity && wheelEntity.Type() == CarWheel_Ruined)
635 {
636 continue;
637 }
638
640 int slotId;
641 string slotName;
642 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId, slotName);
643 slotName.ToLower();
644 if (slotName.Contains("spare"))
645 {
646 continue
647 }
648
650 if (wheelEntity && wheelEntity.IsInherited(CarWheel))
651 {
652 vector entPosXZ = wheelEntity.GetPosition();
653 entPosXZ[1] = 0;
654 if (vector.Distance(trapPosXZ, entPosXZ) < 1)
655 {
656 return wheelEntity;
657 }
658 }
659 }
660
661 return null;
662 }
PlayerSpawnPreset slotName
Определения InventoryItem.c:310
Определения InventoryItem.c:413
Определения Building.c:6
proto native EntityAI GetAttachmentFromIndex(int index)
proto native int AttachmentCount()
Returns count of attachments attached to this item.
script counterpart to engine's class Inventory
Определения Inventory.c:79
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Определения EnConvert.c:106
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9

Перекрестные ссылки GameInventory::AttachmentCount(), vector::Distance(), GameInventory::GetAttachmentFromIndex(), GetPosition и slotName.

Используется в OnUpdate() и TrapBase::OnUpdate().