DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл FishingRod_Base.c

См. исходные тексты.

Структуры данных

class  FishingRod_Base_New
 

Функции

void FishingRod_Base ()
 
void Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
bool IsFishingActive ()
 
void ActivateFishing ()
 
void DeactivateFishing ()
 
void FishPull ()
 
void Catching ()
 
void Pulling ()
 
void End (int result)
 
void AddPull (float delta)
 
void DisplayState ()
 
override bool CanPutInCargo (EntityAI parent)
 
override void SetActions ()
 
float GetFishingEffectivityBonus ()
 

Переменные

FishingRod_Base_New ANIM_PHASE_OPENED = "OpenRod"
 
const string ANIM_PHASE_CLOSED = "CloseRod"
 
const float BREAK_PULL = 36
 
const float TOO_MUCH_PULL = 32
 
const float HIGH_PULL = 22
 
const float LOW_PULL = 18
 
const float TOO_FEW_PULL = 8
 
const float LOOSE_PULL = 0
 
const int LOSS_BREAK = 0
 
const int LOSS_LOOSE = 1
 
const int WIN = 2
 
const int INTERUPTED = 3
 
const float INIT_LINE_STRETCH = 15
 
const float MIN_FISHING_TIME = 100
 
const float MAX_FISHING_TIME = 150
 
const int FISH_PULL_CHANCE = 15
 
const int FISH_AGILITY = 15
 
int m_FishProximity
 
bool m_Fishing
 
ref Timer m_CyclerCatching
 
ref Timer m_Cycler
 
float m_Pull
 
float m_DeltaT
 
bool m_WasPulled
 
bool m_IsFishPulling
 
float m_PullTime
 
float m_FishPull
 
int m_FishingTime
 
PlayerBase m_Player
 
int m_ChanceRange
 

Функции

◆ ActivateFishing()

void ActivateFishing ( )
138 {
139 m_Fishing = true;
140 //Init();
141 }
bool m_Fishing
Definition FishingRod_Base.c:92

Перекрестные ссылки m_Fishing.

◆ AddPull()

void AddPull ( float delta)
322 {
323 m_DeltaT = delta;
324 m_WasPulled = true;
325 }
bool m_WasPulled
Definition FishingRod_Base.c:97
float m_DeltaT
Definition FishingRod_Base.c:96
Definition EntityAI.c:95

Перекрестные ссылки m_DeltaT и m_WasPulled.

◆ CanPutInCargo()

override bool CanPutInCargo ( EntityAI parent)
365 {
366 if( !super.CanPutInCargo(parent) ) {return false;}
367 if ( GetAnimationPhase(ANIM_PHASE_CLOSED) > 0.5 )
368 {
369 return true;
370 }
371 return false;
372 }
const string ANIM_PHASE_CLOSED
Definition FishingRod_Base.c:73

Перекрестные ссылки ANIM_PHASE_CLOSED.

◆ Catching()

void Catching ( )
182 {
183 if(m_FishProximity == 0 && m_WasPulled)
184 {
185 m_CyclerCatching.Stop();
186 m_Cycler.Run(0.3, this, "Pulling", NULL,true);
187 }
188 else
189 {
190 if (m_WasPulled)
191 {
192 m_WasPulled = false;
194 }
195 //TIMERDEPRECATED - randomized proximity of fish to
197 string fline = "";
198 for (int i = 0; i < m_FishProximity; i++)
199 {
200 fline += " .";
201 }
202 m_Player.Message("", "colorStatusChannel");
203 m_Player.Message("HOLD right mouse button to pull the fishing line", "colorAction");
204 m_Player.Message("", "colorStatusChannel");
205 m_Player.Message("", "colorStatusChannel");
206 m_Player.Message("", "colorStatusChannel");
207 m_Player.Message("Start pulling when J and <*)))>< meet:", "colorStatusChannel");
208 m_Player.Message("", "colorStatusChannel");
209 m_Player.Message("J"+fline+" <*)))><", "colorImportant");
210 if(m_ChanceRange > 0)
211 {
213 }
214 }
215 }
ref Timer m_CyclerCatching
Definition FishingRod_Base.c:93
PlayerBase m_Player
Definition FishingRod_Base.c:102
int m_FishProximity
Definition FishingRod_Base.c:91
int m_ChanceRange
Definition FishingRod_Base.c:103
ref Timer m_Cycler
Definition FishingRod_Base.c:94
Definition EnMath.c:7
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

Перекрестные ссылки m_ChanceRange, m_Cycler, m_CyclerCatching, m_FishProximity, m_Player, m_WasPulled и Math::RandomInt().

◆ DeactivateFishing()

void DeactivateFishing ( )
144 {
146 }
void End()
called on surrender end request end
const int INTERUPTED
Definition FishingRod_Base.c:84

Перекрестные ссылки End() и INTERUPTED.

◆ DisplayState()

void DisplayState ( )
328 {
329 string fline = "";
330 for (int i = 0; i < m_Pull; i++)
331 {
332 fline += "-";
333 }
334 m_Player.Message("", "colorStatusChannel");
335 m_Player.Message("HOLD right mouse button to pull the fishing line", "colorAction");
336 m_Player.Message("RELEASE right mouse button to loosen the fishing line", "colorAction");
337 m_Player.Message("", "colorStatusChannel");
338 m_Player.Message("", "colorStatusChannel");
339 m_Player.Message("Fishing line stretch :", "colorStatusChannel");
340 m_Player.Message("", "colorStatusChannel");
341 if (m_Pull >= TOO_MUCH_PULL)
342 {
343 m_Player.Message("<"+fline+">", "colorImportant");
344 }
346 {
347 m_Player.Message("<"+fline+">", "colorAction");
348 }
350 {
351 m_Player.Message("<"+fline+">", "colorFriendly");
352 }
354 {
355 m_Player.Message("<"+fline+">", "colorStatusChannel");
356 }
357 if (m_Pull <= TOO_FEW_PULL)
358 {
359 m_Player.Message("<"+fline+">", "colorImportant");
360 }
361 }
const float TOO_FEW_PULL
Definition FishingRod_Base.c:79
const float TOO_MUCH_PULL
Definition FishingRod_Base.c:76
float m_Pull
Definition FishingRod_Base.c:95
const float LOW_PULL
Definition FishingRod_Base.c:78
const float HIGH_PULL
Definition FishingRod_Base.c:77

Перекрестные ссылки HIGH_PULL, LOW_PULL, m_Player, m_Pull, TOO_FEW_PULL и TOO_MUCH_PULL.

Используется в Pulling().

◆ End()

void End ( int result)
264 {
265 m_Cycler.Stop();
266 m_CyclerCatching.Stop();
267 m_Fishing = false;
268
269 switch (result)
270 {
271 case LOSS_BREAK:
272 m_Player.Message("", "colorStatusChannel");
273 m_Player.Message("", "colorStatusChannel");
274 m_Player.Message("", "colorStatusChannel");
275 m_Player.Message("The fish had broken the fishing line and swam away.", "colorImportant");
276 m_Player.Message("", "colorStatusChannel");
277 m_Player.Message("", "colorStatusChannel");
278 m_Player.Message("", "colorStatusChannel");
279 m_Player.Message("", "colorStatusChannel");
280 break;
281
282 case LOSS_LOOSE:
283 m_Player.Message("", "colorStatusChannel");
284 m_Player.Message("", "colorStatusChannel");
285 m_Player.Message("", "colorStatusChannel");
286 m_Player.Message("The fish escaped.", "colorImportant");
287 m_Player.Message("", "colorStatusChannel");
288 m_Player.Message("", "colorStatusChannel");
289 m_Player.Message("", "colorStatusChannel");
290 m_Player.Message("", "colorStatusChannel");
291 break;
292
293 case WIN:
294 m_Player.Message("", "colorStatusChannel");
295 m_Player.Message("", "colorStatusChannel");
296 m_Player.Message("", "colorStatusChannel");
297 m_Player.Message("I caught the fish!", "colorFriendly");
298 m_Player.Message("", "colorStatusChannel");
299 m_Player.Message("", "colorStatusChannel");
300 m_Player.Message("", "colorStatusChannel");
301 m_Player.Message("", "colorStatusChannel");
302 break;
303
304 case INTERUPTED:
305 m_Player.Message("", "colorStatusChannel");
306 m_Player.Message("", "colorStatusChannel");
307 m_Player.Message("", "colorStatusChannel");
308 m_Player.Message("Fishing time is over.", "colorFriendly");
309 m_Player.Message("", "colorStatusChannel");
310 m_Player.Message("", "colorStatusChannel");
311 m_Player.Message("", "colorStatusChannel");
312 m_Player.Message("", "colorStatusChannel");
313 break;
314
315 default:
316 Print("Wrong number");
317 break;
318 }
319 }
const int LOSS_LOOSE
Definition FishingRod_Base.c:82
const int LOSS_BREAK
Definition FishingRod_Base.c:81
const int WIN
Definition FishingRod_Base.c:83
proto void Print(void var)
Prints content of variable to console/log.

Перекрестные ссылки INTERUPTED, LOSS_BREAK, LOSS_LOOSE, m_Cycler, m_CyclerCatching, m_Fishing, m_Player, Print() и WIN.

◆ FishingRod_Base()

void FishingRod_Base ( )
106 {
107 m_Fishing = false;
108 }

Перекрестные ссылки m_Fishing.

◆ FishPull()

void FishPull ( )
151 {
152 if ( !m_IsFishPulling )
153 {
156 {
157 //TIMERDEPRECATED - randomizing timeframe to pull fish out
158 if ( Math.RandomInt(0, 1) )
159 {
161 }
162 else
163 {
164 m_FishPull = -rand;
165 }
166 //TIMERDEPRECATED - randomizing timeframe to pull fish out
167 m_PullTime = Math.RandomInt(2, 6);
168 m_IsFishPulling = true;
169 }
170 }
171 else
172 {
173 m_PullTime--;
174 if (m_PullTime == 0)
175 {
176 m_IsFishPulling = false;
177 }
178 }
179 }
float m_PullTime
Definition FishingRod_Base.c:99
float m_FishPull
Definition FishingRod_Base.c:100
bool m_IsFishPulling
Definition FishingRod_Base.c:98
const int FISH_PULL_CHANCE
Definition FishingRod_Base.c:88

Перекрестные ссылки FISH_PULL_CHANCE, m_FishPull, m_IsFishPulling, m_PullTime, Math::RandomInt() и TOO_FEW_PULL.

Используется в Pulling().

◆ GetFishingEffectivityBonus()

float GetFishingEffectivityBonus ( )
383 {
384 return 0.0;
385 }

◆ Init()

void Init ( )

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

pre-init arrays

111 {
112 m_Player = PlayerBase.Cast( GetGame().GetPlayer() );
114 m_IsFishPulling = false;
115 //TIMERDEPRECATED - randomized time of fishing
119 //TIMERDEPRECATED
120 if(!m_Cycler)
121 {
122 m_Cycler = new Timer();
123 }
125 {
126 m_CyclerCatching = new Timer();
127 }
128 m_CyclerCatching.Run(4, this, "Catching", NULL,true);
129 m_Player.Message("I have started fishing.", "colorFriendly");
130 }
const float MIN_FISHING_TIME
Definition FishingRod_Base.c:86
const int FISH_AGILITY
Definition FishingRod_Base.c:89
int m_FishingTime
Definition FishingRod_Base.c:101
const float MAX_FISHING_TIME
Definition FishingRod_Base.c:87
const float INIT_LINE_STRETCH
Definition FishingRod_Base.c:85
PlayerBase GetPlayer()
Definition ModifierBase.c:51
Definition PlayerBaseClient.c:2
Definition DayZPlayerImplement.c:63
proto native CGame GetGame()

Перекрестные ссылки FISH_AGILITY, GetGame(), GetPlayer(), INIT_LINE_STRETCH, m_ChanceRange, m_Cycler, m_CyclerCatching, m_FishingTime, m_FishProximity, m_IsFishPulling, m_Player, m_Pull, MAX_FISHING_TIME, MIN_FISHING_TIME и Math::RandomInt().

◆ IsFishingActive()

bool IsFishingActive ( )
133 {
134 return m_Fishing;
135 }

Перекрестные ссылки m_Fishing.

◆ Pulling()

void Pulling ( )
218 {
219 float agent_speed_distance = vector.Distance("0 0 0",m_Player.GetModelSpeed());
220 if (m_Player.GetItemInHands() != this || !m_Player.IsInWater() || agent_speed_distance > 1 )
221 {
223 }
224 else
225 {
226 if ( m_FishingTime <= 0)
227 {
228 ItemBase pcatch = ItemBase.Cast( m_Player.GetInventory().CreateInInventory("Carp") );
229 //ItemBase pcatch = ItemBase.Cast( m_Player.CreateInInventory("Carp","cargo_bait") );
230 pcatch.SetQuantity(800,false);
231 End(WIN);
232 }
233 else
234 {
235 FishPull();
236 if ( m_IsFishPulling )
237 {
239 }
240 if (m_WasPulled)
241 {
242 m_Pull += 1;
243 }
244 else
245 {
246 m_Pull -= 1;
247 }
248 m_WasPulled = false;
250 DisplayState();
251 if ( m_Pull <= LOOSE_PULL)
252 {
254 }
255 if ( m_Pull >= BREAK_PULL)
256 {
258 }
259 }
260 }
261 }
void FishPull()
Definition FishingRod_Base.c:150
const float BREAK_PULL
Definition FishingRod_Base.c:75
void DisplayState()
Definition FishingRod_Base.c:327
const float LOOSE_PULL
Definition FishingRod_Base.c:80
Definition InventoryItem.c:731
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

Перекрестные ссылки BREAK_PULL, DisplayState(), vector::Distance(), End(), FishPull(), INTERUPTED, LOOSE_PULL, LOSS_BREAK, LOSS_LOOSE, m_FishingTime, m_FishPull, m_IsFishPulling, m_Player, m_Pull, m_WasPulled и WIN.

◆ SetActions()

override void SetActions ( )
375 {
376 super.SetActions();
377
378 //AddAction(ActionToggleFishing);
379 //AddAction(ActionFishingNew);
380 }

Переменные

◆ ANIM_PHASE_CLOSED

const string ANIM_PHASE_CLOSED = "CloseRod"

Используется в CanPutInCargo().

◆ ANIM_PHASE_OPENED

FishingRod_Base_New ANIM_PHASE_OPENED = "OpenRod"

◆ BREAK_PULL

const float BREAK_PULL = 36

Используется в Pulling().

◆ FISH_AGILITY

const int FISH_AGILITY = 15

Используется в Init().

◆ FISH_PULL_CHANCE

const int FISH_PULL_CHANCE = 15

Используется в FishPull().

◆ HIGH_PULL

const float HIGH_PULL = 22

Используется в DisplayState().

◆ INIT_LINE_STRETCH

const float INIT_LINE_STRETCH = 15

Используется в Init().

◆ INTERUPTED

const int INTERUPTED = 3

Используется в DeactivateFishing(), End() и Pulling().

◆ LOOSE_PULL

const float LOOSE_PULL = 0

Используется в Pulling().

◆ LOSS_BREAK

const int LOSS_BREAK = 0

Используется в End() и Pulling().

◆ LOSS_LOOSE

const int LOSS_LOOSE = 1

Используется в End() и Pulling().

◆ LOW_PULL

const float LOW_PULL = 18

Используется в DisplayState().

◆ m_ChanceRange

int m_ChanceRange

Используется в Catching() и Init().

◆ m_Cycler

ref Timer m_Cycler

Используется в Catching(), End() и Init().

◆ m_CyclerCatching

ref Timer m_CyclerCatching

Используется в Catching(), End() и Init().

◆ m_DeltaT

float m_DeltaT

Используется в AddPull().

◆ m_Fishing

bool m_Fishing

Используется в ActivateFishing(), End(), FishingRod_Base() и IsFishingActive().

◆ m_FishingTime

int m_FishingTime

Используется в Init() и Pulling().

◆ m_FishProximity

int m_FishProximity

Используется в Catching() и Init().

◆ m_FishPull

float m_FishPull

Используется в FishPull() и Pulling().

◆ m_IsFishPulling

bool m_IsFishPulling

Используется в FishPull(), Init() и Pulling().

◆ m_Player

PlayerBase m_Player

◆ m_Pull

float m_Pull

Используется в DisplayState(), Init() и Pulling().

◆ m_PullTime

float m_PullTime

Используется в FishPull().

◆ m_WasPulled

bool m_WasPulled

Используется в AddPull(), Catching() и Pulling().

◆ MAX_FISHING_TIME

const float MAX_FISHING_TIME = 150

Используется в Init().

◆ MIN_FISHING_TIME

const float MIN_FISHING_TIME = 100

Используется в Init().

◆ TOO_FEW_PULL

const float TOO_FEW_PULL = 8

Используется в DisplayState() и FishPull().

◆ TOO_MUCH_PULL

const float TOO_MUCH_PULL = 32

Используется в DisplayState().

◆ WIN

const int WIN = 2

Используется в End() и Pulling().