DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс ActionAttachToConstruction
+ Граф наследования:ActionAttachToConstruction:

Защищенные члены

void OnExecuteImpl (ActionData action_data)
 
override void OnExecuteClient (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 

Закрытые члены

void ActionAttachToConstruction ()
 
override void CreateConditionComponents ()
 
override ActionData CreateActionData ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartClient (ActionData action_data)
 

Подробное описание

Конструктор(ы)

◆ ActionAttachToConstruction()

void ActionAttachToConstruction ( )
inlineprivate
4 {
5 m_Text = "#attach";
6 }
string m_Text
Definition ActionBase.c:58

Перекрестные ссылки ActionBase::m_Text.

Методы

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate
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 );
30
31 if ( slot_id != -1 )
32 {
34 if ( base_building.CheckSlotVerticalDistance( slot_id, player ) && base_building.IsPlayerInside(player,"") )
35 {
37
38 return true;
39 }
40 }
41 else if ( item.IsKindOf("CombinationLock") )
42 {
44
45 //simpler hack
46 /*construction_action_data.SetSlotId( InventorySlots.GetSlotIdFromString("Att_CombinationLock") );
47 return true;*/
48
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 }
FindInventoryLocationType
flags for searching locations in inventory
Definition InventoryLocation.c:17
Definition Fence.c:2
Definition ConstructionActionData.c:2
Definition Building.c:6
InventoryLocation.
Definition InventoryLocation.c:29
Definition EntityAI.c:95

◆ CreateActionData()

override ActionData CreateActionData ( )
inlineprivate
15 {
17 return action_data;
18 }
Definition ActionAttach.c:2

◆ CreateConditionComponents()

override void CreateConditionComponents ( )
inlineprivate
9 {
12 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:64
ref CCTBase m_ConditionTarget
Definition ActionBase.c:65
Definition CCINonRuined.c:2
Definition CCTCursor.c:2

Перекрестные ссылки ActionBase::m_ConditionItem и ActionBase::m_ConditionTarget.

◆ OnExecuteClient()

override void OnExecuteClient ( ActionData action_data)
inlineprotected
107 {
110 }
void OnExecuteImpl(ActionData action_data)
Definition ActionAttachToConstruction.c:72
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:921

Перекрестные ссылки ActionBase::ClearInventoryReservationEx() и OnExecuteImpl().

◆ OnExecuteImpl()

void OnExecuteImpl ( ActionData action_data)
inlineprotected
73 {
74 EntityAI target_entity = EntityAI.Cast( action_data.m_Target.GetObject() );
75 ItemBase item = ItemBase.Cast( action_data.m_MainItem );
76
77 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
78 int slot_id = construction_action_data.GetSlotId();
79
80 if ( slot_id != -1 )
81 {
82 ItemBase attachment = ItemBase.Cast( target_entity.GetInventory().FindAttachment( slot_id ) );
83
84 if ( attachment )
85 {
86 //combine
87 attachment.CombineItemsClient( item );
88 }
89 else// if( target_entity.GetInventory().CanAddAttachmentEx( item, slot_id ) )
90 {
92 float stackable = item_base.GetTargetQuantityMax( slot_id );
93
94 if( stackable == 0 || stackable >= item_base.GetQuantity() )
95 {
96 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(target_entity, item, slot_id);
97 }
98 else if( stackable != 0 && stackable < item_base.GetQuantity() )
99 {
100 item_base.SplitIntoStackMaxClient( target_entity, slot_id );
101 }
102 }
103 }
104 }
Definition InventoryItem.c:731

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

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)
inlineprotected
113 {
114 if ( !GetGame().IsMultiplayer() )
115 {
117
118 OnExecuteImpl(action_data); // single player
119 }
120 }
proto native CGame GetGame()

Перекрестные ссылки ActionBase::ClearInventoryReservationEx(), GetGame() и OnExecuteImpl().

◆ OnStartClient()

override void OnStartClient ( ActionData action_data)
inlineprivate
66 {
67 //set action initiator
68 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
69 construction_action_data.SetActionInitiator( action_data.m_Player );
70 }

Объявления и описания членов класса находятся в файле: