Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
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
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( g_Game.CreateObjectEx( targetChicken.GetDeadItemName(), targetChicken.GetPosition(), ECE_PLACE_ON_SURFACE, RF_ORIGINAL ) );
47 }
48 targetChicken.Delete();
49 }
50 }
51};
ActionBase ActionData
Definition actionbase.c:30
class ActionTargets ActionTarget
const int RF_ORIGINAL
const int ECE_PLACE_ON_SURFACE
string m_Text
Definition actionbase.c:64
ref CCIBase m_ConditionItem
Definition actionbase.c:70
ref CCTBase m_ConditionTarget
Definition actionbase.c:71
override void OnExecuteServer(ActionData action_data)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override string GetDeadItemName()
Definition animalbase.c:283
Super root of all classes in Enforce script.
Definition enscript.c:11
DayZGame g_Game
Definition dayzgame.c:3942
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.