DayZ 1.29
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 строка 613

614 {
616 vector trapPosXZ = GetPosition();
617 trapPosXZ[1] = 0;
618
619 GameInventory inv = victim.GetInventory();
620 for (int i = 0; i < inv.AttachmentCount(); i++)
621 {
623 EntityAI wheelEntity = inv.GetAttachmentFromIndex(i);
624 if (wheelEntity && wheelEntity.Type() == CarWheel_Ruined)
625 {
626 continue;
627 }
628
630 int slotId;
631 string slotName;
632 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId, slotName);
633 slotName.ToLower();
634 if (slotName.Contains("spare"))
635 {
636 continue
637 }
638
640 if (wheelEntity && wheelEntity.IsInherited(CarWheel))
641 {
642 vector entPosXZ = wheelEntity.GetPosition();
643 entPosXZ[1] = 0;
644 if (vector.Distance(trapPosXZ, entPosXZ) < 1)
645 {
646 return wheelEntity;
647 }
648 }
649 }
650
651 return null;
652 }
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().