Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionpickupchicken.c
Go to the documentation of this file.
2 {
4  {
5  m_Text = "#take";
6  }
7 
8  override typename GetInputType()
9  {
11  }
12 
13  override void CreateConditionComponents()
14  {
17  }
18 
19  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
20  {
21  if ( player.GetCommand_Vehicle() )
22  return false;
23 
25  if ( Class.CastTo( chicken, target.GetObject() ) )
26  {
27  return !chicken.IsAlive();
28  }
29  return false;
30  }
31 
32  override void OnExecuteServer( ActionData action_data )
33  {
34  // We will switch the item
35  Animal_GallusGallusDomesticus targetChicken = Animal_GallusGallusDomesticus.Cast( action_data.m_Target.GetObject() );
36  if ( targetChicken )
37  {
38  DeadChicken_ColorBase deadChicken = DeadChicken_ColorBase.Cast( action_data.m_Player.GetHumanInventory().CreateInHands( targetChicken.GetDeadItemName() ) );
39 
40  if ( deadChicken == null )
41  {
42  deadChicken = DeadChicken_ColorBase.Cast( action_data.m_Player.GetHumanInventory().CreateInInventory( targetChicken.GetDeadItemName() ) );
43 
44  if ( deadChicken == null )
45  deadChicken = DeadChicken_ColorBase.Cast( GetGame().CreateObjectEx( targetChicken.GetDeadItemName(), targetChicken.GetPosition(), ECE_PLACE_ON_SURFACE, RF_ORIGINAL ) );
46  }
47  targetChicken.Delete();
48  }
49  }
50 };
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
RF_ORIGINAL
const int RF_ORIGINAL
Definition: centraleconomy.c:63
ContinuousInteractActionInput
Definition: actioninput.c:521
CCINone
Definition: ccinone.c:1
Animal_GallusGallusDomesticus
Definition: animalbase.c:238
DeadChicken_ColorBase
class PurificationTablets extends Edible_Base DeadChicken_ColorBase
CCTNone
Definition: cctnone.c:1
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition: centraleconomy.c:37
ActionPickupChicken
Definition: actionpickupchicken.c:1
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10