DayZ 1.24
Loading...
Searching...
No Matches
ActionFillBottleBase.c
Go to the documentation of this file.
17
19{
20 private const float WATER_DEPTH = 0.5;
21 private const string ALLOWED_WATER_SURFACES = string.Format("%1|%2", UAWaterType.FRESH, UAWaterType.STILL);
22
24 {
26 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEPOND;
27 m_FullBody = true;
28 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
30 m_Text = "#fill";
31 }
32
34 {
37 }
38
39 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
40 {
41 if (item.IsFullQuantity())
42 return false;
43
44 Object targetObject = target.GetObject();
45 if (targetObject)
46 {
48 if (fuelstation)
49 {
50 if (!fuelstation.HasFuelToGive())
51 return false;
52 }
54 return false;
55
56 if (targetObject.GetWaterSourceObjectType() != EWaterSourceObjectType.NONE || targetObject.GetWaterSourceObjectType() == EWaterSourceObjectType.THROUGH || targetObject.IsFuelStation())
57 return GetLiquidType(player, target, item) != -1;
58 }
59
61 if (waterCheck.Can(player, target))
62 return GetLiquidType(player, target, item) != -1;
63
64 return false;
65 }
66
68 {
69 return action_data.m_MainItem.GetQuantity() < action_data.m_MainItem.GetQuantityMax();
70 }
71
73 {
75
76 if (super.SetupAction(player, target, item, action_data, extra_data))
77 {
78 if (action_data.m_Target.GetObject())
79 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEWELL;
80
81 return true;
82 }
83
84 return false;
85 }
86
88 {
89 if (target.GetObject() && target.GetObject().IsFuelStation())
90 {
92 return LIQUID_GASOLINE;
93 }
94 else if ((!target.GetObject() || target.GetObject().IsWell() || target.GetObject().GetWaterSourceObjectType() == EWaterSourceObjectType.WELL || target.GetObject().GetWaterSourceObjectType() == EWaterSourceObjectType.THROUGH) && Liquid.CanFillContainer(item, LIQUID_WATER))
95 return LIQUID_WATER;
96
97 return -1;
98 }
99
101 {
102 //returns in format (totalWaterDepth, characterDepht, 0)
103 vector water_info = HumanCommandSwim.WaterLevelCheck(player, player.GetPosition());
104 if (water_info[1] > WATER_DEPTH)
105 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
106 else
107 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
108 }
109}
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
EWaterSourceObjectType
int GetLiquidType()
Definition ItemBase.c:8442
ActionData m_ActionData
PlayerBase m_Player
Definition ActionBase.c:33
ref ActionTarget m_Target
Definition ActionBase.c:32
ref CABase m_ActionComponent
Definition ActionBase.c:30
ItemBase m_MainItem
Definition ActionBase.c:28
ref ActionBase m_Action
Definition ActionBase.c:27
override void CreateActionComponent()
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
override bool ActionConditionContinue(ActionData action_data)
int GetLiquidType(PlayerBase player, ActionTarget target, ItemBase item)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const string ALLOWED_WATER_SURFACES
void SetupStance(PlayerBase player)
override void CreateConditionComponents()
Definition Liquid.c:2
static bool CanFillContainer(ItemBase container, int liquid_type, bool ignore_fullness_check=false)
Definition Liquid.c:136
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
const float DEFAULT
const float FILL_LIQUID
const string FRESH
fake
const string STILL
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
const int LIQUID_GASOLINE
Definition constants.c:508
const int LIQUID_WATER
Definition constants.c:504
class HumanCommandLadder HumanCommandSwim()
Definition human.c:669