Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionfillbottlebase.c
Go to the documentation of this file.
2{
3 private float m_BaseFillQuantity;
4
5 override void CreateActionComponent()
6 {
7 CCTWaterSurfaceEx waterCheck = CCTWaterSurfaceEx.Cast(m_ActionData.m_Action.m_ConditionTarget);
8 if (!waterCheck)
9 return;
10
11 int liquidType = waterCheck.GetLiquidType();
12 if (liquidType == LIQUID_GASOLINE)
13 {
14 m_BaseFillQuantity = UAQuantityConsumed.FUEL;
15 }
16 else if (liquidType == LIQUID_SNOW)
17 {
18 m_BaseFillQuantity = UAQuantityConsumed.FILL_SNOW;
19 }
20 else
21 {
22 m_BaseFillQuantity = UAQuantityConsumed.FILL_LIQUID;
23 }
24 m_ActionData.m_ActionComponent = new CAContinuousFill(m_BaseFillQuantity, liquidType);
25 }
26
27 // DEPRECATED
28 private int m_liquid_type;
29};
30
32{
33 private const float WATER_DEPTH = 0.5;
34 private const string ALLOWED_WATER_SURFACES = string.Format("%1|%2|%3", UAWaterType.FRESH, UAWaterType.STILL, UAWaterType.SNOW);
35 protected int m_AllowedLiquidMask;
36
38 {
40 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEPOND;
41 m_FullBody = true;
42 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
43 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
44 m_Text = "#fill";
45
47 m_AllowedLiquidMask &= ~LIQUID_SNOW;
48 }
49
55
56 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
57 {
58 int liquidType = LIQUID_NONE;
60 if (waterCheck)
61 liquidType = waterCheck.GetSurfaceLiquidType(target);
62
63 return liquidType != LIQUID_NONE && Liquid.CanFillContainer(item, liquidType);
64 }
65
66 override bool ActionConditionContinue(ActionData action_data)
67 {
68 return action_data.m_MainItem.GetQuantity() < action_data.m_MainItem.GetQuantityMax();
69 }
70
71 override protected int GetStanceMask(PlayerBase player)
72 {
73 vector water_info = HumanCommandSwim.WaterLevelCheck(player, player.GetPosition());
74 if (water_info[1] > WATER_DEPTH)
75 {
76 return DayZPlayerConstants.STANCEMASK_ERECT;
77 }
78 else
79 {
80 return DayZPlayerConstants.STANCEMASK_CROUCH;
81 }
82 }
83
84 override protected int GetActionCommandEx(ActionData actionData)
85 {
86 int commandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEPOND;
87 Object targetObj = actionData.m_Target.GetObject();
88
89 if (targetObj && (targetObj.IsWell() || targetObj.IsFuelStation()))
90 {
91 commandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEWELL;
92 }
93
94 return commandUID;
95 }
96
98 {
99 //returns in format (totalWaterDepth, characterDepht, 0)
100 vector water_info = HumanCommandSwim.WaterLevelCheck(player, player.GetPosition());
101 if (water_info[1] > WATER_DEPTH)
102 {
103 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
104 }
105 else
106 {
107 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
108 }
109 }
110
111 override bool IsLockTargetOnUse()
112 {
113 return false;
114 }
115
116 // DEPRECATED
117 private const int ALLOWED_LIQUID;
118
119 [Obsolete("CCTWaterSurfaceEx::GetSurfaceLiquidType can be used instead")]
120 int GetLiquidType(PlayerBase player, ActionTarget target, ItemBase item)
121 {
122 int liquidType = LIQUID_NONE;
123 if ( target.GetObject() )
124 {
125 liquidType = target.GetObject().GetLiquidSourceType();
126 }
127 else
128 {
129 string surfaceType;
130 vector hit_pos = target.GetCursorHitPos();
131 GetGame().SurfaceGetType3D(hit_pos[0], hit_pos[1], hit_pos[2], surfaceType);
132 if (surfaceType == "")
133 {
134 if ( hit_pos[1] <= g_Game.SurfaceGetSeaLevel() + 0.001 )
135 {
136 liquidType = LIQUID_SALTWATER;
137 }
138 }
139 else
140 {
141 liquidType = SurfaceInfo.GetByName(surfaceType).GetLiquidType();
142 }
143 }
144
145 return liquidType & m_AllowedLiquidMask;
146 }
147}
#define LIQUID_SNOW
#define LIQUID_GASOLINE
#define LIQUID_SALTWATER
void CCTWaterSurfaceEx(float maximal_target_distance, int allowedLiquidSource)
int GetLiquidType()
ActionData m_ActionData
float m_SpecialtyWeight
Definition actionbase.c:77
int m_StanceMask
Definition actionbase.c:62
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
bool m_FullBody
Definition actionbase.c:61
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
override bool ActionConditionContinue(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
int GetActionCommandEx(ActionData actionData)
int GetStanceMask(PlayerBase player)
void SetupStance(PlayerBase player)
override bool IsLockTargetOnUse()
override void CreateConditionComponents()
proto float SurfaceGetType3D(float x, float y, float z, out string type)
Y input: Maximum Y to trace down from; Returns: Y position the surface was found.
proto int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
static proto SurfaceInfo GetByName(string name)
DayZGame g_Game
Definition dayzgame.c:3868
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
const float WATER_DEPTH
proto native CGame GetGame()
void Obsolete(string msg="")
Definition enscript.c:371
const int LIQUID_NONE
Definition constants.c:529
const int LIQUID_GROUP_DRINKWATER
Definition constants.c:556