DayZ 1.24
Loading...
Searching...
No Matches
ActionPickupChicken.c
Go to the documentation of this file.
2{
4 {
5 m_Text = "#take";
6 }
7
8 override typename GetInputType()
9 {
11 }
12
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 return !chicken.IsAlive();
27 return false;
28 }
29
31 {
32 // We will switch the item
34 if (targetChicken)
35 {
36 DeadChicken_ColorBase deadChicken = DeadChicken_ColorBase.Cast(action_data.m_Player.GetHumanInventory().CreateInHands(targetChicken.GetDeadItemName()));
37
38 if (deadChicken == null)
39 {
40 deadChicken = DeadChicken_ColorBase.Cast(action_data.m_Player.GetHumanInventory().CreateInInventory(targetChicken.GetDeadItemName()));
41
42 if (deadChicken == null)
43 deadChicken = DeadChicken_ColorBase.Cast(GetGame().CreateObjectEx(targetChicken.GetDeadItemName(), targetChicken.GetPosition(), ECE_PLACE_ON_SURFACE, RF_ORIGINAL));
44 }
45 targetChicken.Delete();
46 }
47 }
48};
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const int RF_ORIGINAL
const int ECE_PLACE_ON_SURFACE
override void OnExecuteServer(ActionData action_data)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.