Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionpickupchicken.c
Go to the documentation of this file.
1
3{
5 {
6 m_Text = "#take";
7 }
8
9 override typename GetInputType()
10 {
12 }
13
14 override void CreateConditionComponents()
15 {
18 }
19
20 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
21 {
22 if ( player.GetCommand_Vehicle() )
23 return false;
24
26 if ( Class.CastTo( chicken, target.GetObject() ) )
27 {
28 return !chicken.IsAlive();
29 }
30 return false;
31 }
32
33 override void OnExecuteServer( ActionData action_data )
34 {
35 // We will switch the item
36 Animal_GallusGallusDomesticus targetChicken = Animal_GallusGallusDomesticus.Cast( action_data.m_Target.GetObject() );
37 if ( targetChicken )
38 {
39 DeadChicken_ColorBase deadChicken = DeadChicken_ColorBase.Cast( action_data.m_Player.GetHumanInventory().CreateInHands( targetChicken.GetDeadItemName() ) );
40
41 if ( deadChicken == null )
42 {
43 deadChicken = DeadChicken_ColorBase.Cast( action_data.m_Player.GetHumanInventory().CreateInInventory( targetChicken.GetDeadItemName() ) );
44
45 if ( deadChicken == null )
46 deadChicken = DeadChicken_ColorBase.Cast( GetGame().CreateObjectEx( targetChicken.GetDeadItemName(), targetChicken.GetPosition(), ECE_PLACE_ON_SURFACE, RF_ORIGINAL ) );
47 }
48 targetChicken.Delete();
49 }
50 }
51};
const int RF_ORIGINAL
const int ECE_PLACE_ON_SURFACE
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
Super root of all classes in Enforce script.
Definition enscript.c:11
proto native CGame GetGame()