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

◆ ActionCondition()

override bool ActionAttachToConstruction::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

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

21 {
22 EntityAI target_entity = EntityAI.Cast( target.GetObject() );
23
24 if ( target_entity && target_entity.CanUseConstruction() )
25 {
26 string selection = target_entity.GetActionComponentName( target.GetComponentIndex() );
27 ConstructionActionData construction_action_data = player.GetConstructionActionData();
28 int slot_id = construction_action_data.GetAttachmentSlotFromSelection( player, target_entity, item, selection );
29 BaseBuildingBase base_building;
30
31 if ( slot_id != -1 )
32 {
33 base_building = BaseBuildingBase.Cast( target_entity );
34 if ( base_building.CheckSlotVerticalDistance( slot_id, player ) && base_building.IsPlayerInside(player,"") )
35 {
36 construction_action_data.SetSlotId( slot_id );
37
38 return true;
39 }
40 }
41 else if ( item.IsKindOf("CombinationLock") )
42 {
43 base_building = BaseBuildingBase.Cast( target_entity );
44
45 //simpler hack
46 /*construction_action_data.SetSlotId( InventorySlots.GetSlotIdFromString("Att_CombinationLock") );
47 return true;*/
48
49 InventoryLocation loc = new InventoryLocation;
50 bool found = base_building.GetInventory().FindFreeLocationFor(item,FindInventoryLocationType.ATTACHMENT,loc);
51
52 if (found)
53 {
54 //Print("slot name: " + InventorySlots.GetSlotName(loc.GetSlot()) );
55 construction_action_data.SetSlotId( loc.GetSlot() );
56
57 return true;
58 }
59 }
60 }
61
62 return false;
63 }
class LogManager EntityAI
void BaseBuildingBase()
Определения BaseBuildingBase.c:1328
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
override bool IsPlayerInside(PlayerBase player, string selection)
Определения Fence.c:615
override bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
Определения Watchtower.c:295
int GetAttachmentSlotFromSelection(PlayerBase player, EntityAI target, ItemBase item_to_attach, string selection)
Определения ConstructionActionData.c:250
void SetSlotId(int slot_id)
Определения ConstructionActionData.c:98
proto native int GetSlot()
returns slot id if current type is Attachment

Перекрестные ссылки ActionTarget, BaseBuildingBase::CheckSlotVerticalDistance(), ConstructionActionData::GetAttachmentSlotFromSelection(), InventoryLocation::GetSlot(), BaseBuildingBase::IsPlayerInside() и ConstructionActionData::SetSlotId().