DayZ 1.24
Loading...
Searching...
No Matches
PlantBase.c
Go to the documentation of this file.
1class PlantBase extends ItemBase
2{
3 // Plant states
4 static const int STATE_DRY = 0;
5 static const int STATE_GROWING = 1;
6 static const int STATE_MATURE = 2;
7 static const int STATE_SPOILED = 3;
8
9 private float m_SprayUsage; // How much spray is needed to stop infestation of plant
10
11 private float m_InfestationChance;
12
14 private int m_CropsCount;
15 private bool m_HasCrops;
16 private string m_CropsType;
18
19 private int m_PlantState;
20 private int m_PlantStateIndex;
22
23 private bool m_IsInfested;
24 private float m_SprayQuantity;
25 bool m_MarkForDeletion = false;
26
27 int m_DeleteDryPlantTime; // For how long in seconds can an unwatered plant exist before it disappears
28 int m_SpoiledRemoveTime; // For how long in seconds a spoiled plant will exist
29 int m_FullMaturityTime; // How much time needs plant to be full grown in seconds
30 int m_SpoilAfterFullMaturityTime; // How long in seconds it takes for plant to be spoiled after it is full grown
31 int m_StateChangeTime; // For how long in seconds will plant stay in one state before its going to next state
32
33 ref Timer m_GrowthTimer = NULL;
34 ref Timer m_InfestationTimer = NULL;
35 ref Timer m_SpoilAfterFullMaturityTimer = NULL;
36 ref Timer m_SpoiledRemoveTimer = NULL;
37 ref Timer m_DeleteDryPlantTimer = NULL;
38
39 private GardenBase m_GardenBase = NULL;
40 private ref Slot m_Slot = NULL;
41
42 private PluginHorticulture m_ModuleHorticulture;
43
44 private const float SPOIL_AFTER_MATURITY_TIME = 14400; //The time it takes for a fully grown plant to spoil, in seconds
45
46 void PlantBase()
47 {
48 m_ModuleHorticulture = PluginHorticulture.Cast(GetPlugin(PluginHorticulture));
49
50 m_SprayUsage = 5;
51 m_DeleteDryPlantTime = (60 * 10) + Math.RandomInt(0, 60 * 2);
52 m_SpoiledRemoveTime = (60 * 20) + Math.RandomInt(0, 60 * 5);
53
54 //Must be between 0 and 1
55 m_InfestationChance = 0.2; // Temporarily disabled until its fixed. Infestation is not visualy persistent over server restarts and m_SpoiledRemoveTimer crashes when it's meant to delete the plant.
56
57 string plant_type = this.GetType();
58 m_GrowthStagesCount = GetGame().ConfigGetInt("cfgVehicles " + plant_type + " Horticulture GrowthStagesCount");
59 m_CropsCount = GetGame().ConfigGetInt("cfgVehicles " + plant_type + " Horticulture CropsCount");
60 GetGame().ConfigGetText("cfgVehicles " + plant_type + " Horticulture CropsType", m_CropsType);
61
62 m_PlantStateIndex = -1;
63 m_CurrentPlantMaterialQuantity = 0;
64 m_IsInfested = false;
65 m_SprayQuantity = 0.0;
66 m_HasCrops = true;
67
68 SetTakeable(false);
69
70
71 RegisterNetSyncVariableBool("m_HasCrops");
72 RegisterNetSyncVariableInt("m_PlantState");
73 RegisterNetSyncVariableInt("m_PlantStateIndex");
74 }
75
77 {
78 if (!m_MarkForDeletion)
79 DestroyPlant();
80 }
81
83 {
84 m_GardenBase = garden_base;
85
86 m_FullMaturityTime += Math.RandomInt(-60, 180);
87 float divided = /*(float) ((60 * 5) + Math.RandomInt(0, 60 * 1)) / fertility;*/ m_FullMaturityTime;
88
89 //divided = (float)((60 * 30) + Math.RandomInt(0, 60 * 30)) * fertility;
90 m_SpoilAfterFullMaturityTime = SPOIL_AFTER_MATURITY_TIME; //divided;
91
92 divided = (float)((float)m_FullMaturityTime / ((float)m_GrowthStagesCount - 2.0));
93 m_StateChangeTime = divided;
94
95 float count = m_CropsCount * fertility * harvesting_efficiency;
96 m_CropsCount = (int)Math.Ceil(count);
97
98 m_PlantMaterialMultiplier = 0.1 * harvesting_efficiency;
99
100 float rain_intensity = GetGame().GetWeather().GetRain().GetActual();
101 if (rain_intensity > 0.0)
102 CheckWater();
103 else
104 {
105 CheckWater();
106
107 if (NeedsWater())
108 {
109 SetPlantState(STATE_DRY);
110
111 if (GetGame().IsServer())
112 {
113 m_DeleteDryPlantTimer = new Timer(CALL_CATEGORY_SYSTEM);
114 m_DeleteDryPlantTimer.Run(m_DeleteDryPlantTime, this, "DeleteDryPlantTick", NULL, false);
115 }
116 }
117 }
118 }
119
120
121 override bool OnStoreLoad(ParamsReadContext ctx, int version)
122 {
123 if (!super.OnStoreLoad(ctx, version))
124 return false;
125
126 //Print("Plant - OnStoreLoad - ");
127
128 GardenBase garden = GardenBase.Cast(GetHierarchyParent());
129 //Print(garden);
130
131 int slot_index = -1;
132 ctx.Read(slot_index);
133
134 //Print(slot_index);
135
136 Slot slot = garden.GetSlotByIndex(slot_index);
137 //Print(slot);
138
139 SetSlot(slot);
140
141 if (!OnStoreLoadCustom(ctx, version))
142 return false;
143
144 return true;
145 }
146
148 {
149 super.OnStoreSave(ctx);
150
151 Slot slot = GetSlot();
152
153 if (slot)
154 {
155 int slot_index = slot.GetSlotIndex();
156 slot.SetPlant(this); // hack
157
158 ctx.Write(slot_index);
159
160 OnStoreSaveCustom(ctx);
161 }
162 else
163 {
164 GetGame().ObjectDelete(this); // Plants that exist without a garden must be deleted. Otherwise they might cause problems.
165 Print("Warning! A plant existed without a garden. Therefore it was deleted from the world to prevent issues!");
166 }
167 }
168
170 {
171 return m_CropsType;
172 }
173
174
176 {
177 int loadInt;
178 if (!ctx.Read(loadInt))
179 loadInt = 0;
180
181 m_SprayUsage = loadInt;
182
183 loadInt = 0;
184 if (!ctx.Read(loadInt))
185 loadInt = 5;
186
187 m_DeleteDryPlantTime = loadInt;
188
189 loadInt = 0;
190 if (!ctx.Read(loadInt))
191 loadInt = 5;
192 m_SpoiledRemoveTime = loadInt;
193
194 loadInt = 0;
195 if (!ctx.Read(loadInt))
196 loadInt = 300;
197 m_FullMaturityTime = loadInt;
198
199 loadInt = 0;
200 if (!ctx.Read(loadInt))
201 loadInt = 300;
202 m_SpoilAfterFullMaturityTime = loadInt;
203
204 loadInt = 0;
205 if (!ctx.Read(loadInt))
206 return false;
207 m_StateChangeTime = loadInt;
208
209 float loadFloat = 0.0;
210 if (!ctx.Read(loadFloat))
211 loadFloat = 0;
212 m_InfestationChance = loadFloat;
213
214 loadInt = 0;
215 if (!ctx.Read(loadInt))
216 return false;
217 m_GrowthStagesCount = loadInt;
218
219 loadInt = 0;
220 if (!ctx.Read(loadInt))
221 loadInt = 1;
222 m_CropsCount = loadInt;
223
224 string loadString = "";
225 if (!ctx.Read(loadString))
226 return false;
227 m_CropsType = loadString;
228
229 loadFloat = 0.0;
230 if (!ctx.Read(loadFloat))
231 loadFloat = 1;
232 m_PlantMaterialMultiplier = loadFloat;
233
234 loadInt = 0;
235 if (!ctx.Read(loadInt))
236 loadInt = 1;
237 m_PlantState = loadInt;
238
239 loadInt = 0;
240 if (!ctx.Read(loadInt))
241 loadInt = 0;
242 m_PlantStateIndex = loadInt;
243
244 loadFloat = 0.0;
245 if (!ctx.Read(loadFloat))
246 loadFloat = 1;
247 m_CurrentPlantMaterialQuantity = loadFloat;
248
249 bool loadBool = false;
250 if (!ctx.Read(loadBool))
251 loadBool = false;
252 m_IsInfested = loadBool;
253
254 loadFloat = 0.0;
255 if (!ctx.Read(loadFloat))
256 loadFloat = 0;
257 m_SprayQuantity = loadFloat;
258
259
260 loadBool = false;
261 if (ctx.Read(loadBool))
262 {
263 if (loadBool)
264 {
265 if (GetGame().IsServer())
266 {
267 m_GrowthTimer = new Timer(CALL_CATEGORY_SYSTEM);
268 m_GrowthTimer.Run(m_StateChangeTime, this, "GrowthTimerTick", NULL, true);
269 }
270 }
271 }
272 else
273 return false;
274
275 loadFloat = 0.0;
276 if (ctx.Read(loadFloat))
277 {
278 if (loadFloat > 0.0)
279 {
280 if (GetGame().IsServer())
281 {
282 m_InfestationTimer = new Timer(CALL_CATEGORY_SYSTEM);
283 m_InfestationTimer.Run(loadFloat, this, "InfestationTimerTick", NULL, false);
284 }
285 }
286 }
287 else
288 return false;
289
290 loadFloat = 0.0;
291 if (ctx.Read(loadFloat))
292 {
293 if (loadFloat > 0.0)
294 {
295 if (GetGame().IsServer())
296 {
297 m_SpoilAfterFullMaturityTimer = new Timer(CALL_CATEGORY_SYSTEM);
298 m_SpoilAfterFullMaturityTimer.Run(loadFloat, this, "SetSpoiled", NULL, false);
299 }
300 }
301 }
302 else
303 return false;
304
305 loadFloat = 0.0;
306 if (ctx.Read(loadFloat))
307 {
308 if (loadFloat > 0.0)
309 {
310 if (GetGame().IsServer())
311 {
312 if (!m_SpoiledRemoveTimer)
313 m_SpoiledRemoveTimer = new Timer(CALL_CATEGORY_SYSTEM);
314
315 m_SpoiledRemoveTimer.Run(loadFloat, this, "SpoiledRemoveTimerTick", NULL, false);
316 }
317 }
318 }
319 else
320 return false;
321
322 loadFloat = 0.0;
323 if (ctx.Read(loadFloat))
324 {
325 if (loadFloat > 0.0)
326 {
327 if (GetGame().IsServer())
328 {
329 m_DeleteDryPlantTimer = new Timer(CALL_CATEGORY_SYSTEM);
330 m_DeleteDryPlantTimer.Run(loadFloat, this, "DeleteDryPlantTick", NULL, false);
331 }
332 }
333 }
334 else
335 return false;
336
337
338 UpdatePlant();
339 return true;
340 }
341
343 {
344 ctx.Write(m_SprayUsage);
345
346 ctx.Write(m_DeleteDryPlantTime);
347
348 ctx.Write(m_SpoiledRemoveTime);
349
350 ctx.Write(m_FullMaturityTime);
351
352 ctx.Write(m_SpoilAfterFullMaturityTime);
353
354 ctx.Write(m_StateChangeTime);
355
356 ctx.Write(m_InfestationChance);
357
358 ctx.Write(m_GrowthStagesCount);
359
360 ctx.Write(m_CropsCount);
361
362 ctx.Write(m_CropsType);
363
364 ctx.Write(m_PlantMaterialMultiplier);
365
366 ctx.Write(m_PlantState);
367
368 ctx.Write(m_PlantStateIndex);
369
370 ctx.Write(m_CurrentPlantMaterialQuantity);
371
372 ctx.Write(m_IsInfested);
373
374 ctx.Write(m_SprayQuantity);
375
376 bool saveBool = false;
377 if (m_GrowthTimer != NULL)
378 saveBool = true;
379 ctx.Write(saveBool);
380
381 float saveFloat = 0.0;
382 if (m_InfestationTimer != NULL)
383 saveFloat = m_InfestationTimer.GetRemaining();
384 ctx.Write(saveFloat);
385
386 saveFloat = 0.0;
387 if (m_SpoilAfterFullMaturityTimer != NULL)
388 saveFloat = m_SpoilAfterFullMaturityTimer.GetRemaining();
389 ctx.Write(saveFloat);
390
391 saveFloat = 0.0;
392 if (m_SpoiledRemoveTimer != NULL)
393 saveFloat = m_SpoiledRemoveTimer.GetRemaining();
394 ctx.Write(saveFloat);
395
396 saveFloat = 0.0;
397 if (m_DeleteDryPlantTimer != NULL)
398 saveFloat = m_DeleteDryPlantTimer.GetRemaining();
399 ctx.Write(saveFloat);
400 }
401
403 {
404 Print("PRINT ALL VALUES OF PLANT...");
405 Print(this);
406
407 Print(m_HasCrops);
408 Print(m_PlantState);
409 Print(m_PlantStateIndex);
410 Print(m_CurrentPlantMaterialQuantity);
411 Print(m_IsInfested);
412 Print(m_SprayQuantity);
413 Print(m_Slot);
414 Print(m_GardenBase);
415 Print("----------------------------------------------------------");
416 }
417
418 override bool CanPutInCargo(EntityAI parent)
419 {
420 return super.CanPutInCargo(parent);
421 }
422
424 {
425 return super.CanPutIntoHands(parent);
426 }
427
429 {
430 return false;
431 }
432
434 {
435 m_IsInfested = is_infested;
436
437 string plant_type = GetType();
438 PlantMaterialHealth material = m_ModuleHorticulture.GetPlantMaterial(plant_type);
439
440 if (m_IsInfested)
441 {
442 if (material.m_InfestedTex != "")
443 SetObjectTexture(0, material.m_InfestedTex);
444 if (material.m_InfestedMat != "")
445 SetObjectMaterial(0, material.m_InfestedMat);
446 }
447 else
448 {
449 if (material.m_HealthyTex != "")
450 SetObjectTexture(0, material.m_HealthyTex);
451 if (material.m_HealthyMat != "")
452 SetObjectMaterial(0, material.m_HealthyMat);
453 }
454 }
455
457 {
458 if (m_PlantStateIndex > 0)
459 {
460 string plant_state_index = m_PlantStateIndex.ToStringLen(2);
461 string prev_plant_state_index = (m_PlantStateIndex - 1).ToStringLen(2);
462
463 // HIDING PREVIOUS PLANT STATE AND SHOWING THE CURRENT ONE
464 ShowSelection("plantStage_" + plant_state_index); // SHOW!
465 HideSelection("plantStage_" + prev_plant_state_index); // HIDE!
466
467 // HIDING PREVIOUS CROPS STATE AND SHOWING THE CURRENT ONE
468
469 if (HasCrops())
470 {
471 ShowSelection("plantStage_" + plant_state_index + "_crops"); // SHOW!
472 HideSelection("plantStage_" + prev_plant_state_index + "_crops"); // HIDE!
473 }
474 else
475 {
476 HideSelection("plantStage_" + plant_state_index + "_crops"); // HIDE!
477 HideSelection("plantStage_" + prev_plant_state_index + "_crops"); // HIDE!
478 }
479
480 // HIDING PREVIOUS SHADOW STATE AND SHOWING THE CURRENT ONE
481 ShowSelection("plantStage_" + plant_state_index + "_shadow"); // SHOW!
482 HideSelection("plantStage_" + prev_plant_state_index + "_shadow"); // HIDE!
483 }
484
485 float float_plant_state_index = (float)m_PlantStateIndex;
486 m_CurrentPlantMaterialQuantity = m_PlantMaterialMultiplier * float_plant_state_index;
487 }
488
490 {
491 if (IsGrowing())
492 {
493 if (m_PlantStateIndex < m_GrowthStagesCount - 2)
494 {
495 m_PlantStateIndex++;
496 UpdatePlant();
497 SetSynchDirty();
498
499 if (m_PlantStateIndex == 0)
500 {
501 float infestation_time_min = (float)m_FullMaturityTime * 0.2;
503
504 float infestation_time_max = (float)m_FullMaturityTime * 0.6;
506
507 if (GetGame().IsServer())
508 {
509 if (!m_InfestationTimer)
510 m_InfestationTimer = new Timer(CALL_CATEGORY_SYSTEM);
511
512 m_InfestationTimer.Run(Math.RandomInt(int_infestation_time_min, int_infestation_time_max), this, "InfestationTimerTick", NULL, false);
513 }
514 }
515
516 if (m_PlantStateIndex == m_GrowthStagesCount - 2)
517 {
518 if (m_IsInfested)
519 SetSpoiled();
520 else
521 SetPlantState(STATE_MATURE);
522 }
523 }
524 }
525 else if (IsMature())
526 {
527 if (GetGame().IsServer())
528 {
529 if (!m_SpoilAfterFullMaturityTimer)
530 m_SpoilAfterFullMaturityTimer = new Timer(CALL_CATEGORY_SYSTEM);
531
532 if (!m_SpoilAfterFullMaturityTimer.IsRunning())
533 m_SpoilAfterFullMaturityTimer.Run(m_SpoilAfterFullMaturityTime, this, "SetSpoiled", NULL, false);
534 }
535 }
536 }
537
539 {
541
542 if (m_InfestationChance > infestation_rnd)
543 ChangeInfestation(true);
544 }
545
547 {
548 if (m_GrowthTimer != NULL)
549 m_GrowthTimer.Stop();
550
551 RemoveSlot();
552 }
553
555 {
556 /*if ( IsDry() )
557 {
558 RemoveSlot();
559 }*/
560 }
561
563 {
564 if (IsSpoiled() == false)
565 {
566 m_PlantStateIndex++;
567 SetPlantState(STATE_SPOILED);
568 UpdatePlant();
569 SetSynchDirty();
570
571 if (GetGame().IsServer())
572 {
573 if (!m_SpoiledRemoveTimer)
574 m_SpoiledRemoveTimer = new Timer(CALL_CATEGORY_SYSTEM);
575
576 if (!m_SpoiledRemoveTimer.IsRunning())
577 m_SpoiledRemoveTimer.Run(m_SpoiledRemoveTime, this, "SpoiledRemoveTimerTick", NULL, false);
578 }
579 }
580 }
581
583 {
584 if (!IsMature() && !NeedsWater())
585 {
586 if (m_DeleteDryPlantTimer)
587 m_DeleteDryPlantTimer.Stop();
588
589 SetPlantState(STATE_GROWING);
590
591 if (GetGame().IsServer())
592 {
593 m_GrowthTimer = new Timer(CALL_CATEGORY_SYSTEM);
594 m_GrowthTimer.Run(m_StateChangeTime, this, "GrowthTimerTick", NULL, true);
595 }
596 }
597 }
598
599 //NEW METHOD FOR PLANT SPRAYING
601 {
602 //Rework this to have something smooth
603 m_SprayQuantity += consumed_quantity;
604
605 if (!NeedsSpraying())
606 {
607 if (m_InfestationTimer != NULL)
608 m_InfestationTimer.Stop();
609
610 m_IsInfested = false;
611 m_InfestationChance = 0;
612
613 ChangeInfestation(false);
614 UpdatePlant();
615 }
616 }
617
618 //DEPRECATED
620 {
621 m_SprayQuantity += consumed_quantity;
622
623 if (!NeedsSpraying())
624 {
625 if (m_InfestationTimer != NULL)
626 m_InfestationTimer.Stop();
627
628 m_IsInfested = false;
629 m_InfestationChance = 0;
630
631 ChangeInfestation(false);
632 UpdatePlant();
633
634 return "I've sprayed the plant a bit. Now it is enough spayed.";
635 }
636 else
637 return "I've sprayed the plant a bit.";
638 }
639
640 //DEPRECATED
642 {
643 if (GetGame() && GetGame().IsServer())
644 {
646
647 if (m_CurrentPlantMaterialQuantity > 0.0)
648 {
649 vector pos = GetPosition();
650 ItemBase item = ItemBase.Cast(GetGame().CreateObjectEx("PlantMaterial", pos, ECE_PLACE_ON_SURFACE));
651 item.SetQuantity(m_CurrentPlantMaterialQuantity * 1000.0);
652 }
653
654 RemoveSlot();
655 }
656 }
657
659 {
660 if (GetGame() && GetGame().IsServer())
661 {
663
664 if (m_CurrentPlantMaterialQuantity > 0.0)
665 {
666 ItemBase item = ItemBase.Cast(GetGame().CreateObjectEx("PlantMaterial", pos, ECE_PLACE_ON_SURFACE));
667 item.SetQuantity(m_CurrentPlantMaterialQuantity * 1000.0);
668 }
669
670 RemoveSlot();
671 }
672 }
673
675 {
676 if (GetGame() && GetGame().IsServer())
677 {
679
680 RemoveSlot();
681 }
682 }
683
685 {
686 //TODO Boris: Add soft skill 2.0
687 //PluginExperience module_exp = GetPlugin(PluginExperience);
688 //float harvesting_efficiency = module_exp.GetExpParamNumber(player, PluginExperience.EXP_FARMER_HARVESTING, "efficiency");
689
690 //m_CropsCount = m_CropsCount * harvesting_efficiency;
691
692 if (!IsSpoiled())
693 {
694 for (int i = 0; i < m_CropsCount; i++)
695 {
696 vector pos = player.GetPosition();
697 ItemBase item = ItemBase.Cast(GetGame().CreateObjectEx(m_CropsType, pos, ECE_PLACE_ON_SURFACE));
698 item.SetQuantity(item.GetQuantityMax());
699 }
700 }
701
702 m_HasCrops = false;
703 SetSynchDirty();
704 UpdatePlant();
705 }
706
708 {
709 m_PlantState = state;
710 SetSynchDirty();
711 }
712
714 {
715 return m_PlantState;
716 }
717
719 {
720 return m_PlantStateIndex;
721 }
722
723 float GetWater()
724 {
725 if (GetSlot())
726 return GetSlot().GetWater();
727
728 return 0;
729 }
730
732 {
733 if (GetSlot())
734 return GetSlot().GetWaterUsage();
735
736 return 0;
737 }
738
740 {
741 Slot slotPlant = m_Slot;
742
743 if (IsDry() && slotPlant && slotPlant.GetWater() < slotPlant.GetWaterUsage())
744 return true;
745 else
746 return false;
747 }
748
750 {
751 if (m_SprayQuantity < m_SprayUsage)
752 return true;
753 else
754 return false;
755 }
756
758 {
759 return m_SprayQuantity;
760 }
761
763 {
764 return m_SprayUsage;
765 }
766
768 {
769 GardenBase garden = GardenBase.Cast(GetHierarchyParent());
770
771 if (garden)
772 {
773 if (m_SpoiledRemoveTimer)
774 {
775 m_SpoiledRemoveTimer.Stop();
776 m_SpoiledRemoveTimer = NULL;
777 }
778
779 garden.RemoveSlotPlant(this);
780 }
781 }
782
783 void SetSlot(Slot slot)
784 {
785 if (slot)
786 m_Slot = slot;
787 }
788
790 {
791 return m_Slot;
792 }
793
795 {
796 return m_GardenBase;
797 }
798
799 bool IsDry()
800 {
801 if (GetPlantState() == STATE_DRY)
802 return true;
803 else
804 return false;
805 }
806
808 {
809 if (GetPlantState() == STATE_GROWING)
810 return true;
811 else
812 return false;
813 }
814
815
816 bool IsMature()
817 {
818 if (GetPlantState() == STATE_MATURE)
819 return true;
820 else
821 return false;
822 }
823
825 {
826 if (GetPlantState() == STATE_SPOILED)
827 return true;
828 else
829 return false;
830 }
831
832 bool HasCrops()
833 {
834 return m_HasCrops;
835 }
836
837 override void SetActions()
838 {
839 super.SetActions();
840
843 }
844}
Param3 int
eBleedingSourceType GetType()
void AddAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
string ToStringLen(int len)
Integer to string with fixed length, padded with zeroes.
Definition EnConvert.c:59
override void SetTakeable(bool pState)
Definition ItemBase.c:8905
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Definition ItemBase.c:5516
PluginBase GetPlugin(typename plugin_type)
class JsonUndergroundAreaTriggerData GetPosition
override bool CanPutIntoHands(EntityAI player)
Definition PlantBase.c:423
float GetWater()
Definition PlantBase.c:723
float m_SprayQuantity
Definition PlantBase.c:24
void SprayPlant(float consumed_quantity)
Definition PlantBase.c:600
void CheckWater()
Definition PlantBase.c:582
int GetPlantStateIndex()
Definition PlantBase.c:718
float m_CurrentPlantMaterialQuantity
Definition PlantBase.c:21
bool IsDry()
Definition PlantBase.c:799
int m_PlantState
Definition PlantBase.c:19
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition PlantBase.c:121
void ChangeInfestation(bool is_infested)
Definition PlantBase.c:433
float m_SprayUsage
Definition PlantBase.c:9
bool m_IsInfested
Definition PlantBase.c:23
override bool CanRemoveFromHands(EntityAI player)
Definition PlantBase.c:428
override void SetActions()
Definition PlantBase.c:837
int m_SpoiledRemoveTime
Definition PlantBase.c:28
int GetPlantState()
Definition PlantBase.c:713
void GrowthTimerTick()
Definition PlantBase.c:489
void Init(GardenBase garden_base, float fertility, float harvesting_efficiency, float water)
Definition PlantBase.c:82
bool NeedsSpraying()
Definition PlantBase.c:749
void UpdatePlant()
Definition PlantBase.c:456
bool HasCrops()
Definition PlantBase.c:832
bool NeedsWater()
Definition PlantBase.c:739
void SetSpoiled()
Definition PlantBase.c:562
int m_CropsCount
Definition PlantBase.c:14
void RemovePlant()
Definition PlantBase.c:641
float m_InfestationChance
Definition PlantBase.c:11
bool IsSpoiled()
Definition PlantBase.c:824
override void OnStoreSave(ParamsWriteContext ctx)
Definition PlantBase.c:147
void PlantBase()
Definition PlantBase.c:46
int m_SpoilAfterFullMaturityTime
Definition PlantBase.c:30
void ~PlantBase()
Definition PlantBase.c:76
void InfestationTimerTick()
Definition PlantBase.c:538
void DestroyPlant()
Definition PlantBase.c:674
bool IsGrowing()
Definition PlantBase.c:807
int m_GrowthStagesCount
Definition PlantBase.c:13
void SpoiledRemoveTimerTick()
Definition PlantBase.c:546
void Harvest(PlayerBase player)
Definition PlantBase.c:684
float GetWaterMax()
Definition PlantBase.c:731
int m_StateChangeTime
Definition PlantBase.c:31
void DeleteDryPlantTick()
Definition PlantBase.c:554
int m_DeleteDryPlantTime
Definition PlantBase.c:27
string StopInfestation(float consumed_quantity)
Definition PlantBase.c:619
bool m_HasCrops
Definition PlantBase.c:15
int m_PlantStateIndex
Definition PlantBase.c:20
override bool CanPutInCargo(EntityAI parent)
Definition PlantBase.c:418
bool OnStoreLoadCustom(ParamsReadContext ctx, int version)
Definition PlantBase.c:175
void RemoveSlot()
Definition PlantBase.c:767
void SetSlot(Slot slot)
Definition PlantBase.c:783
void RemovePlantEx(vector pos)
Definition PlantBase.c:658
float GetSprayUsage()
Definition PlantBase.c:762
void OnStoreSaveCustom(ParamsWriteContext ctx)
Definition PlantBase.c:342
string m_CropsType
Definition PlantBase.c:16
PluginHorticulture m_ModuleHorticulture
Definition PlantBase.c:42
GardenBase GetGarden()
Definition PlantBase.c:794
int m_FullMaturityTime
Definition PlantBase.c:29
float m_PlantMaterialMultiplier
Definition PlantBase.c:17
bool IsMature()
Definition PlantBase.c:816
void PrintValues()
Definition PlantBase.c:402
float GetSprayQuantity()
Definition PlantBase.c:757
Slot GetSlot()
Definition PlantBase.c:789
void SetPlantState(int state)
Definition PlantBase.c:707
string GetCropsType()
Definition PlantBase.c:169
Definition EnMath.c:7
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto float Ceil(float f)
Returns ceil of value.
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8