Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
actionfillbottlebase.c
Go to the documentation of this file.
25
27{
28 private const float WATER_DEPTH = 0.5;
29 private const string ALLOWED_WATER_SURFACES = string.Format("%1|%2|%3", UAWaterType.FRESH, UAWaterType.STILL, UAWaterType.SNOW);
30 protected int m_AllowedLiquidMask;
31
33 {
35 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEPOND;
36 m_FullBody = true;
37 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
38 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
39 m_Text = "#fill";
40
43 }
44
46 {
49 }
50
51 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
52 {
53 Object targetObject = target.GetObject();
54 if (targetObject)
55 {
56 if (vector.DistanceSq(player.GetPosition(), targetObject.GetPosition()) > UAMaxDistances.DEFAULT * UAMaxDistances.DEFAULT)
57 return false;
58 }
59 else
60 {
62 if (!waterCheck.Can(player, target))
63 return false;
64 }
65
66 int liquidType = GetLiquidType(player, target, item);
67
68 if (item.GetQuantity() > item.GetQuantityMin())
69 liquidType = Liquid.TranslateLiquidType(liquidType);
70
71 return liquidType != LIQUID_NONE && Liquid.CanFillContainer(item,liquidType);
72 }
73
74 override bool ActionConditionContinue(ActionData action_data)
75 {
76 return action_data.m_MainItem.GetQuantity() < action_data.m_MainItem.GetQuantityMax();
77 }
78
79 override protected int GetStanceMask(PlayerBase player)
80 {
81 vector water_info = HumanCommandSwim.WaterLevelCheck(player, player.GetPosition());
82 if (water_info[1] > WATER_DEPTH)
83 {
84 return DayZPlayerConstants.STANCEMASK_ERECT;
85 }
86 else
87 {
88 return DayZPlayerConstants.STANCEMASK_CROUCH;
89 }
90 }
91
92 override protected int GetActionCommandEx(ActionData actionData)
93 {
94 int commandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEPOND;
95 if (actionData.m_Target.GetObject())
96 {
97 commandUID = DayZPlayerConstants.CMD_ACTIONFB_FILLBOTTLEWELL;
98 }
99
100 return commandUID;
101 }
102
104 {
105 int liquidType = LIQUID_NONE;
106 if ( target.GetObject() )
107 {
108 liquidType = target.GetObject().GetLiquidSourceType();
109 }
110 else
111 {
112 string surfaceType;
113 vector hit_pos = target.GetCursorHitPos();
114 g_Game.SurfaceGetType3D(hit_pos[0], hit_pos[1], hit_pos[2], surfaceType);
115 if (surfaceType == "")
116 {
117 if ( hit_pos[1] <= g_Game.SurfaceGetSeaLevel() + 0.001 )
118 {
119 liquidType = LIQUID_SALTWATER;
120 }
121 }
122 else
123 {
124 liquidType = SurfaceInfo.GetByName(surfaceType).GetLiquidType();
125 }
126 }
127
128 return liquidType & m_AllowedLiquidMask;
129 }
130
132 {
133 //returns in format (totalWaterDepth, characterDepht, 0)
134 vector water_info = HumanCommandSwim.WaterLevelCheck(player, player.GetPosition());
135 if (water_info[1] > WATER_DEPTH)
136 {
137 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
138 }
139 else
140 {
141 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
142 }
143 }
144
145 override bool IsLockTargetOnUse()
146 {
147 return false;
148 }
149
150 // deprecated
151 private const int ALLOWED_LIQUID;
152}
ActionBase ActionData
Definition actionbase.c:30
class ActionTargets ActionTarget
void CCTWaterSurfaceEx(float maximal_target_distance, int allowedLiquidSource)
ActionData m_ActionData
bool m_FullBody
Definition actionbase.c:67
string m_Text
Definition actionbase.c:64
ref CCIBase m_ConditionItem
Definition actionbase.c:70
float m_SpecialtyWeight
Definition actionbase.c:83
ref CCTBase m_ConditionTarget
Definition actionbase.c:71
int m_StanceMask
Definition actionbase.c:68
override void CreateActionComponent()
override bool ActionConditionContinue(ActionData action_data)
void SetupStance(PlayerBase player)
int GetLiquidType(PlayerBase player, ActionTarget target, ItemBase item)
override void CreateConditionComponents()
int GetActionCommandEx(ActionData actionData)
int GetStanceMask(PlayerBase player)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool IsLockTargetOnUse()
const string ALLOWED_WATER_SURFACES
Unmanaged surface info handle.
Definition surfaceinfo.c:9
static proto SurfaceInfo GetByName(string name)
Warning: O(n) time complexity where n is the total number of loaded surfaces Note: Will load the surf...
proto int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
const float DEFAULT
const float FILL_LIQUID
const string STILL
const string SNOW
const string FRESH
fake
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
DayZGame g_Game
Definition dayzgame.c:3942
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
const int LIQUID_NONE
Definition constants.c:532
const int LIQUID_GROUP_DRINKWATER
Definition constants.c:559
const int LIQUID_GASOLINE
Definition constants.c:548
const int LIQUID_SALTWATER
Definition constants.c:553
const int LIQUID_SNOW
Definition constants.c:552
class HumanCommandLadder HumanCommandSwim()
Definition human.c:673
override int GetLiquidType()
Definition itembase.c:8794