DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionFillBottleBase.c
См. документацию.
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 GetGame().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
Определения ActionBase.c:30
class ActionTargets ActionTarget
void CCTWaterSurfaceEx(float maximal_target_distance, int allowedLiquidSource)
Определения CCTWaterSurface.c:62
DayZGame g_Game
Определения DayZGame.c:3868
override int GetLiquidType()
Определения ItemBase.c:8547
float m_SpecialtyWeight
Определения ActionBase.c:77
int m_StanceMask
Определения ActionBase.c:62
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_FullBody
Определения ActionBase.c:61
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
ActionData m_ActionData
Определения AnimatedActionBase.c:3
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
override bool ActionConditionContinue(ActionData action_data)
Определения ActionFillBottleBase.c:74
int GetLiquidType(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionFillBottleBase.c:103
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionFillBottleBase.c:51
int GetActionCommandEx(ActionData actionData)
Определения ActionFillBottleBase.c:92
const string ALLOWED_WATER_SURFACES
Определения ActionFillBottleBase.c:29
int m_AllowedLiquidMask
Определения ActionFillBottleBase.c:30
const float WATER_DEPTH
Определения ActionFillBottleBase.c:28
void ActionFillBottleBase()
Определения ActionFillBottleBase.c:32
int GetStanceMask(PlayerBase player)
Определения ActionFillBottleBase.c:79
void SetupStance(PlayerBase player)
Определения ActionFillBottleBase.c:131
const int ALLOWED_LIQUID
Определения ActionFillBottleBase.c:151
override bool IsLockTargetOnUse()
Определения ActionFillBottleBase.c:145
override void CreateConditionComponents()
Определения ActionFillBottleBase.c:45
float m_BaseFillQuantity
Определения ActionFillBottleBase.c:4
override void CreateActionComponent()
Определения ActionFillBottleBase.c:6
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINonRuined.c:2
Определения CCTNone.c:2
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.
Определения InventoryItem.c:731
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
proto int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
static proto SurfaceInfo GetByName(string name)
Определения SurfaceInfo.c:9
const float DEFAULT
Определения ActionConstants.c:112
const float FUEL
Определения ActionConstants.c:17
const float FILL_SNOW
Определения ActionConstants.c:11
const float FILL_LIQUID
Определения ActionConstants.c:10
const string FRESH
fake
Определения ActionConstants.c:163
const string STILL
Определения ActionConstants.c:164
const string SNOW
Определения ActionConstants.c:165
Определения ActionConstants.c:161
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:106
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
const int LIQUID_NONE
Определения constants.c:527
const int LIQUID_GROUP_DRINKWATER
Определения constants.c:554
const int LIQUID_GASOLINE
Определения constants.c:543
const int LIQUID_SALTWATER
Определения constants.c:548
const int LIQUID_SNOW
Определения constants.c:547
class HumanCommandLadder HumanCommandSwim()
Определения human.c:673