DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionFillBottleBase.c
Go to the documentation of this file.
2{
3 private int m_liquid_type;
4 private float m_BaseFillQuantity;
5
6 override void CreateActionComponent()
7 {
9
10 if (m_ActionData.m_Target.GetObject() && m_ActionData.m_Target.GetObject().IsFuelStation())
11 {
13 }
14 else
15 {
17 }
19 }
20};
21
23{
24 private const float WATER_DEPTH = 0.5;
25 private const string ALLOWED_WATER_SURFACES = string.Format("%1|%2", UAWaterType.FRESH, UAWaterType.STILL);
26
28 {
30 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEPOND;
31 m_FullBody = true;
32 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
34 m_Text = "#fill";
35 }
36
38 {
41 }
42
43 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
44 {
45 if (item.IsFullQuantity())
46 return false;
47
48 Object targetObject = target.GetObject();
49 if (targetObject)
50 {
51 if (vector.DistanceSq(player.GetPosition(), targetObject.GetPosition()) > UAMaxDistances.DEFAULT * UAMaxDistances.DEFAULT)
52 return false;
53
54 if (targetObject.GetWaterSourceObjectType() != EWaterSourceObjectType.NONE || targetObject.GetWaterSourceObjectType() == EWaterSourceObjectType.THROUGH || targetObject.IsFuelStation())
55 {
56 return GetLiquidType(player, target, item) != -1;
57 }
58 }
59
61 if (waterCheck.Can(player, target))
62 return GetLiquidType(player, target, item) != -1;
63
64 return false;
65 }
66
67 override bool ActionConditionContinue(ActionData action_data)
68 {
69 return action_data.m_MainItem.GetQuantity() < action_data.m_MainItem.GetQuantityMax();
70 }
71
72 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
73 {
74 SetupStance(player);
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 {
96 return LIQUID_WATER;
97 }
98
99 return -1;
100 }
101
103 {
104 //returns in format (totalWaterDepth, characterDepht, 0)
105 vector water_info = HumanCommandSwim.WaterLevelCheck(player, player.GetPosition());
106 if (water_info[1] > WATER_DEPTH)
107 {
108 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
109 }
110 else
111 {
112 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
113 }
114 }
115}
protected float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
EWaterSourceObjectType
int GetLiquidType()
Definition ItemBase.c:8383
protected ActionData m_ActionData
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
ref ActionBase m_Action
Definition ActionBase.c:27
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionTarget m_Target
Definition ActionBase.c:32
override void CreateActionComponent()
override bool ActionConditionContinue(ActionData action_data)
void SetupStance(PlayerBase player)
int GetLiquidType(PlayerBase player, ActionTarget target, ItemBase item)
private const string ALLOWED_WATER_SURFACES
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
private const float WATER_DEPTH
override bool Can(PlayerBase player, ActionTarget target)
Definition Liquid.c:2
static bool CanFillContainer(ItemBase container, int liquid_type, bool ignore_fullness_check=false)
Definition Liquid.c:148
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 STILL
const string FRESH
fake
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:602
const int LIQUID_GASOLINE
Definition constants.c:493
const int LIQUID_WATER
Definition constants.c:489
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
class HumanCommandLadder HumanCommandSwim()
Definition human.c:662