DayZ 1.30
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 строка 622

623 {
625 vector trapPosXZ = GetPosition();
626 trapPosXZ[1] = 0;
627
628 GameInventory inv = victim.GetInventory();
629 for (int i = 0; i < inv.AttachmentCount(); i++)
630 {
632 EntityAI wheelEntity = inv.GetAttachmentFromIndex(i);
633 if (wheelEntity && wheelEntity.Type() == CarWheel_Ruined)
634 {
635 continue;
636 }
637
639 int slotId;
640 string slotName;
641 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId, slotName);
642 slotName.ToLower();
643 if (slotName.Contains("spare"))
644 {
645 continue
646 }
647
649 if (wheelEntity && wheelEntity.IsInherited(CarWheel))
650 {
651 vector entPosXZ = wheelEntity.GetPosition();
652 entPosXZ[1] = 0;
653 if (vector.Distance(trapPosXZ, entPosXZ) < 1)
654 {
655 return wheelEntity;
656 }
657 }
658 }
659
660 return null;
661 }
PlayerSpawnPreset slotName
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
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Определения EnConvert.c:119
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473

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

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