DayZ 1.24
Loading...
Searching...
No Matches
GardenBase.c
Go to the documentation of this file.
1class GardenBase extends ItemBase //BuildingSuper
2{
3 // Paths to slot textures. Slots can have multiple states, so multiple textures must be generated
4 static const string SLOT_TEXTURE_DIGGED_WET_LIME = "dz\\gear\\cultivation\\data\\soil_digged_wet_lime_CO.paa";
5 static const string SLOT_TEXTURE_DIGGED_WET_PLANT = "dz\\gear\\cultivation\\data\\soil_digged_wet_plant_CO.paa";
6
7 // Wet/dry material
8 static const string SLOT_MATERIAL_WET = "dz\\gear\\cultivation\\data\\soil_cultivated_wet.rvmat";
9 static const string SLOT_MATERIAL_DRY = "dz\\gear\\cultivation\\data\\soil_cultivated.rvmat";
10
11 static const string SLOT_MATERIAL_LIMED_WET = "dz\\gear\\cultivation\\data\\soil_cultivated_limed_wet.rvmat";
12 static const string SLOT_MATERIAL_LIMED_DRY = "dz\\gear\\cultivation\\data\\soil_cultivated_limed.rvmat";
13 static const string SLOT_MATERIAL_COMPOST_WET = "dz\\gear\\cultivation\\data\\soil_cultivated_compost_wet.rvmat";
14 static const string SLOT_MATERIAL_COMPOST_DRY = "dz\\gear\\cultivation\\data\\soil_cultivated_compost.rvmat";
15
16 // slot names -> MUST BE LOWERCASE
17 private static const string SLOT_SELECTION_DIGGED_PREFIX = "seedbase_";
18 private static const string SLOT_SELECTION_COVERED_PREFIX = "slotCovered_";
19 private static const string SLOT_MEMORY_POINT_PREFIX = "slot_";
20 private static const string SLOT_SEEDBASE_PREFIX = "seedbase_";
21
22
23 private static const int CHECK_RAIN_INTERVAL = 15;
24
26 protected int m_SlotFertilityState = 0; //Used to store fertility state of all slots
27 protected int m_SlotWateredState = 0; //Used to store fertility state of all slots
28 protected int m_MaxWateredStateVal = 0; //Used to store fertility state of all slots
29 protected float m_DefaultFertility = 1;
31
32 private static ref map<string, string> m_map_slots; // For the 'attachment slot -> plant slot' conversion. It is possible that this will be removed later.
33
35 {
36 RegisterNetSyncVariableInt("m_SlotFertilityState");
37 RegisterNetSyncVariableInt("m_SlotWateredState");
38
39 m_map_slots = new map<string, string>;
40
41 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
42
43 // Prepare m_map_slots
44 for (int i = 1; i <= GetGardenSlotsCount() ; ++i)
45 {
46 // m_map_slots is supposed to be: <input, output>
47 string input = SLOT_SEEDBASE_PREFIX + i.ToString();
48 string output = SLOT_MEMORY_POINT_PREFIX;
49
50 if (i < 10)
51 output = output + "0"; // Example: '1' changes to '01'
52
53 output = output + i.ToString();
54
55 m_map_slots.Set(input, output);
56 }
57
58 if (GetGame().IsServer())
59 CheckRainStart();
60
61 InitializeSlots();
62
63 SetMaxWaterStateVal();
64 }
65
67 {
68 super.OnVariablesSynchronized();
69
70 SyncSlots();
71 }
72
73 override bool HasProxyParts()
74 {
75 return true;
76 }
77
78 override int GetHideIconMask()
79 {
80 return EInventoryIconVisibility.HIDE_VICINITY;
81 }
82
84 {
85 m_DefaultFertility = value;
86 }
87
89 {
90 return m_DefaultFertility;
91 }
92
93 override void EOnInit(IEntity other, int extra)
94 {
95 CheckRainTick();
96 UpdateTexturesOnAllSlots();
97 }
98
100 {
101 m_Slots = new array<ref Slot>;
103
104 for (int i = 0; i < slots_count; i++)
105 {
106 Slot slot = new Slot(GetBaseFertility());
107 slot.SetSlotIndex(i);
108 int i1 = i + 1;
109 string name = "SeedBase_" + i1;
111 slot.SetSlotId(slot_id);
112 slot.SetGarden(this);
113 slot.m_State = Slot.STATE_DIGGED;
114 m_Slots.Insert(slot);
115 }
116 }
117
119 {
120 int state = 0;
121
122 for (int i = 0; i < m_Slots.Count(); i++)
123 state += 1 * Math.Pow(2, i);
124
125 m_MaxWateredStateVal = state;
126 }
127
129 {
130 return m_MaxWateredStateVal;
131 }
132
134 {
136
137 for (int i = 0; i < slots_count; i++)
138 UpdateSlotTexture(i);
139 }
140
141 override bool OnStoreLoad(ParamsReadContext ctx, int version)
142 {
143 if (version <= 118)
144 return true;
145
146 if (!super.OnStoreLoad(ctx, version))
147 return false;
148
149 if (version < 102)
150 {
151 float some_value;
152 ctx.Read(some_value); // compatibility check
153 }
154
156
157 for (int i = 0; i < slots_count; i++)
158 {
159 Slot slot = m_Slots.Get(i);
160
161 if (!slot.OnStoreLoadCustom(ctx, version))
162 return false;
163
164 //Slot textures will be updated after store load
165 //UpdateSlotTexture( i );
166 }
167
168 if (version >= 119)
169 ctx.Read(m_SlotFertilityState);
170
171 if (version >= 120)
172 ctx.Read(m_SlotWateredState);
173
174 return true;
175 }
176
177 override void AfterStoreLoad()
178 {
179 super.AfterStoreLoad();
180 }
181
182 override void EEOnAfterLoad()
183 {
184 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(SyncSlots, 500, false, this);
185 super.EEOnAfterLoad();
186 }
187
189 {
190 for (int i = 0; i < GetGardenSlotsCount(); i++)
191 {
192 // Read relevant bit
193 int fertilityState = (m_SlotFertilityState >> i) & 1;
194 m_Slots[i].SetFertilityState(fertilityState);
195
196 int wateredState = (m_SlotWateredState >> i) & 1;
197 m_Slots[i].SetWateredState(wateredState);
198
199 if (fertilityState == eFertlityState.NONE)
200 {
201 m_Slots[i].SetFertilityType("");
202 m_Slots[i].SetFertilizerQuantity(0);
203 }
204
205 if (wateredState == eWateredState.DRY)
206 m_Slots[i].SetWater(0);
207
208 UpdateSlotTexture(i);
209 }
210
211 if (GetGame().IsServer())
212 SetSynchDirty();
213 }
214
216 {
217 super.OnStoreSave(ctx);
218
220
221 for (int i = 0; i < slots_count; i++)
222 {
223 Slot slot = m_Slots.Get(i);
224
225 slot.OnStoreSaveCustom(ctx);
226 }
227
228 ctx.Write(m_SlotFertilityState);
229
230 ctx.Write(m_SlotWateredState);
231 }
232
234 {
235 Debug.Log("PRINT ALL SLOTS FROM...");
236 Debug.Log("" + this);
237 int slots = GetInventory().GetAttachmentSlotsCount();
238 Debug.Log("Nb Slots : " + slots);
239
240 for (int i = 0; i < slots ; i++)
241 {
242 Slot slot = m_Slots.Get(i);
243 Debug.Log("i : " + i);
244 Debug.Log("Slot : " + slot);
245
246 float slot_fertility = slot.GetFertility();
247 float slot_fertility_usage = slot.GetFertilityMax();
248 string slot_fertility_type = slot.GetFertilityType();
249 float slot_water = slot.GetWater();
250 float slot_water_usage = slot.GetWaterUsage();
251 ItemBase slot_seed = slot.GetSeed();
252 ItemBase slot_plant = slot.GetPlant();
253 float slot_state = slot.GetState();
254 float slot_slot_Index = slot.GetSlotIndex();
255 float slot_slot_ID = slot.GetSlotId();
256 int slot_wateredState = slot.GetWateredState();
257 int slot_FertilityState = slot.GetFertilityState();
258
259 Debug.Log("Fertility : " + slot_fertility);
260 Debug.Log("Fertility Usage : " + slot_fertility_usage);
261 Debug.Log("Fertility Type : " + slot_fertility_type);
262 Debug.Log("Fertility State : " + slot_FertilityState);
263 Debug.Log("Water : " + slot_water);
264 Debug.Log("Water Usage : " + slot_water_usage);
265 Debug.Log("Watered State : " + slot_wateredState);
266 Debug.Log("Seed : " + slot_seed);
267 Debug.Log("Plant : " + slot_plant);
268 Debug.Log("State : " + slot_state);
269 Debug.Log("Slot Index : " + slot_slot_Index);
270 Debug.Log("Slot ID : " + slot_slot_ID);
271 Debug.Log("///////////////////////////");
272 }
273
274 Debug.Log("END OF ALL SLOTS FOR...");
275 Debug.Log("" + this);
276 }
277
278 override bool CanPutInCargo(EntityAI parent)
279 {
280 if (!super.CanPutInCargo(parent)) return false;
281 return false;
282 }
283
285 {
286 if (!super.CanPutIntoHands(parent))
287 return false;
288 return false;
289 }
290
292 {
293 return false;
294 }
295
297 {
298 return 0;
299 }
300
302 {
303 Slot slot = GetSlotBySelection(selection_component);
304
305 if (slot != NULL && slot.m_State == Slot.STATE_DIGGED)
306 return true;
307 else
308 return false;
309 }
310
311 // Converts attachment slot name into plant slot name. Example: 'seedbase_1' -> 'component02'
313 {
314 // Give result
315 if (m_map_slots.Contains(attach_slot))
316 {
317 string return_value = m_map_slots.Get(attach_slot);
318 return return_value;
319 }
320
321 return "";
322 }
323
324 override void EEItemAttached(EntityAI item, string slot_name)
325 {
326 super.EEItemAttached(item, slot_name);
327
328 string path = string.Format("CfgVehicles %1 Horticulture PlantType", item.GetType());
329 bool IsItemSeed = GetGame().ConfigIsExisting(path); // Is this item a seed?
330
332
333 if (IsItemSeed)
334 {
335 string converted_slot_name;
336
337 vector pos = GetPosition();
338 int index = GetSlotIndexByAttachmentSlot(slot_name);
339
340 if (index < 10)
341 converted_slot_name = SLOT_MEMORY_POINT_PREFIX + "0" + index.ToString();
342 else
343 converted_slot_name = SLOT_MEMORY_POINT_PREFIX + index.ToString();
344
345 PlantSeed(ItemBase.Cast(item), converted_slot_name);
346 }
347 else if (g_Game.IsClient())
348 {
349 Slot slot = GetSlotByIndex(GetSlotIndexByAttachmentSlot(slot_name) - 1);
350 if (slot)
351 {
352 slot.SetPlant(PlantBase.Cast(item));
353 slot.m_State = Slot.STATE_PLANTED;
354 }
355 }
356 }
357
358 override void EEItemDetached(EntityAI item, string slot_name)
359 {
360 super.EEItemDetached(item, slot_name);
361
362 slot_name.ToLower();
363
364 string path = string.Format("CfgVehicles %1 Horticulture PlantType", item.GetType());
365 bool IsItemSeed = GetGame().ConfigIsExisting(path); // Is this item a seed?
366
367 string converted_slot_name = ConvertAttSlotToPlantSlot(slot_name);
368 Slot slot = GetSlotBySelection(converted_slot_name);
369
370 if (slot)
371 {
372 if (IsItemSeed)
373 slot.SetSeed(NULL);
374
375 slot.SetState(Slot.STATE_DIGGED);
376 }
377 }
378
379 // Plants the seed into slot (selection_component)
381 {
382 int slot_index = GetSlotIndexBySelection(selection_component);
383
384 if (slot_index != -1)
385 {
386 PluginHorticulture module_horticulture = PluginHorticulture.Cast(GetPlugin(PluginHorticulture));
387 string plant_type = module_horticulture.GetPlantType(seed);
388
389 Slot slot = m_Slots.Get(slot_index);
390 slot.SetState(Slot.STATE_PLANTED);
391 slot.m_PlantType = plant_type;
392 slot.SetSeed(seed);
393
394 if (!slot.NeedsWater())
395 {
396 seed.LockToParent();
397 //Take some small amount of time before making a plant out of seeds
401 growthTimer.Run(0.1, this, "CreatePlant", createPlantParam, false); //Use a const for timer delay
402 }
403 }
404 }
405
406 // Creates a plant
407 void CreatePlant(Slot slot)
408 {
409 if (g_Game.IsServer())
410 {
411 ItemBase seed = slot.GetSeed();
412 seed.UnlockFromParent();
413 GetGame().ObjectDelete(seed);
414
415 PlantBase plant = PlantBase.Cast(GetInventory().CreateAttachmentEx(slot.m_PlantType, slot.GetSlotId()));
416
417 int slot_index = slot.GetSlotIndex();
418 slot.SetPlant(plant);
419 plant.Init(this, slot.GetFertility(), slot.m_HarvestingEfficiency, slot.GetWater());
420 //ShowSelection(SLOT_SELECTION_COVERED_PREFIX + (slot_index + 1).ToStringLen(2));
421
422 plant.LockToParent();
423 }
424 }
425
427 {
428 Slot slot = GetSlotBySelection(selection_component);
429
430 if (slot != NULL)
431 {
432 string item_type = item.GetType();
433
434 if (slot.GetFertilityType() == "" || slot.GetFertilityType() == item_type)
435 {
436 slot.SetFertilityType(item_type);
437
438 float add_energy_to_slot = GetGame().ConfigGetFloat(string.Format("cfgVehicles %1 Horticulture AddEnergyToSlot", item_type));
439 slot.m_FertilizerUsage = GetGame().ConfigGetFloat(string.Format("cfgVehicles %1 Horticulture ConsumedQuantity", item_type));
440
441 float coef = Math.Clamp(consumed_quantity / slot.m_FertilizerUsage, 0.0, 1.0);
443
444 slot.m_FertilizerQuantity += consumed_quantity;
445 slot.m_Fertility += add_energy_to_slot;
446
447 if (slot.GetFertilizerQuantity() >= slot.GetFertilizerQuantityMax())
448 {
449 int slot_index = slot.GetSlotIndex();
450
451 if (slot_index > -1)
452 {
453 UpdateSlotTexture(slot_index);
454 slot.SetFertilityState(eFertlityState.FERTILIZED);
455 // Set relevant bit
456 m_SlotFertilityState |= slot.GetFertilityState() << slot.GetSlotIndex();
457
458 //TODO Boris: Add soft skill 2.0
459 //PluginExperience module_exp = GetPlugin(PluginExperience);
460 //slot.m_HarvestingEfficiency = module_exp.GetExpParamNumber(player, PluginExperience.EXP_FARMER_FERTILIZATION, "efficiency");
461 }
462 }
463 }
464 else
465 {
466 slot.SetFertilizerQuantity(0);
467 slot.SetFertilityType("");
468 slot.SetFertilityState(eFertlityState.NONE);
469 }
470 SetSynchDirty();
471 }
472 }
473
475 {
476 Slot slot = GetSlotBySelection(selection_component);
477
478 if (slot != NULL)
479 {
480 string item_type = item.GetType();
481
482 if (slot.GetFertilityType() == "" || slot.GetFertilityType() == item_type)
483 return true;
484 }
485
486 return false;
487 }
488
490 {
491 Slot slot = GetSlotBySelection(selection_component);
492
493 if (slot)
494 {
495 if (slot.GetFertilityState() == eFertlityState.NONE)
496 return true;
497 }
498
499 return false;
500 }
501
503 {
504 // Set relevant bit
505 m_SlotWateredState |= slot.GetWateredState() << slot.GetSlotIndex();
506 SetSynchDirty();
507 }
508
510 {
511 // TO DO: Fix DAYZ-30633 here!
512 Slot slot = m_Slots.Get(slot_index);
513
514 // Show / Hide selections according to DIGGED or COVERED states.
515
516 if (slot.IsDigged() || slot.IsPlanted())
517 {
518 string str_hide = SLOT_SELECTION_COVERED_PREFIX + (slot_index + 1).ToStringLen(2);
519 string str_show = SLOT_SELECTION_DIGGED_PREFIX + (slot_index + 1).ToStringLen(1);
520
521 HideSelection(str_hide);
522 ShowSelection(str_show);
523 }
524
525 if (slot.GetFertilityType() != "")
526 SetSlotTextureFertilized(slot_index, slot.GetFertilityType());
527 else
528 SetSlotTextureDigged(slot_index);
529 }
530
532 {
533 TStringArray textures = GetHiddenSelectionsTextures();
534
535 string str_digged = SLOT_SELECTION_DIGGED_PREFIX + (slot_index + 1).ToStringLen(1);
536
537 ShowSelection(str_digged);
538 string texture = textures.Get(0);
539 SetObjectTexture(slot_index, texture);
540
541 Slot slot = m_Slots.Get(slot_index);
542
543 if (slot.GetWateredState() == 0)
544 {
545 // Set dry material
546 SetObjectMaterial(slot_index, SLOT_MATERIAL_DRY);
547 }
548 else
549 {
550 // Set wet material
551 SetObjectMaterial(slot_index, SLOT_MATERIAL_WET);
552 }
553 }
554
556 {
557 TStringArray textures = GetHiddenSelectionsTextures();
558
559 int tex_id = GetGame().ConfigGetInt(string.Format("cfgVehicles %1 Horticulture TexId", item_type));
560
561 string str_show = SLOT_SELECTION_DIGGED_PREFIX + (slot_index + 1).ToStringLen(2);
562
563 ShowSelection(str_show);
564 SetObjectTexture(slot_index, textures.Get(tex_id));
565
566 Slot slot = m_Slots.Get(slot_index);
567
568 int slot_index_offset = 0;
569
570 // Set material according to dry / wet states
571 if (slot.GetWateredState() == 0)
572 {
573 // Set dry material for garden lime
574 if (slot.GetFertilityType() == "GardenLime")
575 SetObjectMaterial(slot_index + slot_index_offset, SLOT_MATERIAL_LIMED_DRY);
576 else if (slot.GetFertilityType() == "PlantMaterial")
577 SetObjectMaterial(slot_index + slot_index_offset, SLOT_MATERIAL_COMPOST_DRY);
578 }
579 else
580 {
581 // Set dry material for compost
582 if (slot.GetFertilityType() == "GardenLime")
583 SetObjectMaterial(slot_index + slot_index_offset, SLOT_MATERIAL_LIMED_WET);
584 else if (slot.GetFertilityType() == "PlantMaterial")
585 SetObjectMaterial(slot_index + slot_index_offset, SLOT_MATERIAL_COMPOST_WET);
586 }
587 }
588
590 {
591 if (m_Slots != NULL)
592 {
593 Slot slot = m_Slots.Get(index);
594 PlantBase plant = slot.GetPlant();
595
596 if (plant)
597 {
598 plant.UnlockFromParent();
599 plant.m_MarkForDeletion = true;
600 GetGame().ObjectDelete(plant);
601 }
602
603 slot.Init(GetBaseFertility());
604
605 // Clear relevant bit
606 slot.SetFertilityState(eFertlityState.NONE);
607 m_SlotFertilityState &= ~(1 << slot.GetSlotIndex());
608
609 slot.SetWateredState(eWateredState.DRY);
610 m_SlotWateredState &= ~(1 << slot.GetSlotIndex());
611
612 SetSynchDirty();
613
614 HideSelection(SLOT_SELECTION_COVERED_PREFIX + (index + 1).ToStringLen(2));
615 UpdateSlotTexture(index);
616 }
617 }
618
620 {
621 int index = GetSlotIndexByPlant(plant);
622 if (index >= 0)
623 RemoveSlot(index);
624 }
625
627 {
628 int slot_index = GetSlotIndexBySelection(selection_component);
629
630 if (slot_index > -1)
631 return m_Slots.Get(slot_index);
632 else
633 return NULL;
634 }
635
636 // Returns slot array index by selection, starting from 0 as the first one.
638 {
639 int slot_index = -1;
640
641 if (m_Slots != NULL)
642 {
645
646 int start = selection_component_lower.IndexOf(SLOT_MEMORY_POINT_PREFIX);
647
648 if (start > -1)
649 {
650 start += SLOT_MEMORY_POINT_PREFIX.Length();
651 int end = start + 2;
652 int length = selection_component.Length();
653
654 if (length >= end)
655 {
656 int length_add = length - end; // Hack-fix for inconsistent component names in p3d
657 int length_from_end = 2 + length_add;
659 slot_index = num_str.ToInt();
660
662 }
663 }
664 }
665
666 return slot_index;
667 }
668
670 {
671 int slot_index = -1;
672
673 int start = "SeedBase_".Length();
674 int end = att_slot.Length();//start + 2;
675 int len = end - start;
676
677 string num_str = att_slot.Substring(start, len);
678 slot_index = num_str.ToInt();
679
680 return slot_index;
681 }
682
684 {
685 if (m_Slots != NULL)
686 {
687 for (int i = 0; i < m_Slots.Count(); i++)
688 {
689 PlantBase found_plant = m_Slots.Get(i).GetPlant();
690
691 if (found_plant == plant)
692 return i;
693 }
694 }
695
696 return -1;
697 }
698
700 {
701 float nearest_distance = 1000.0;
702 int nearest_slot_index = -1;
704 for (int i = 0; i < slots_count; i++)
705 {
706 Slot slot = m_Slots.Get(i); // Move this line by a scope higher in this function after debugging
707
708 vector slot_pos = GetSlotPosition(i);
710
712 {
713 if (slot != NULL && slot.m_State == slot_state)
714 {
717 }
718 }
719 }
720
721 return nearest_slot_index;
722 }
723
725 {
726 string memory_point = SLOT_MEMORY_POINT_PREFIX + (index + 1).ToStringLen(2);
727 vector pos = this.GetSelectionPositionMS(memory_point);
728
729 return this.ModelToWorld(pos);
730 }
731
733 {
734 if (!m_CheckRainTimer)
735 m_CheckRainTimer = new Timer(CALL_CATEGORY_SYSTEM);
736
737 m_CheckRainTimer.Run(CHECK_RAIN_INTERVAL, this, "CheckRainTick", NULL, true);
738 }
739
741 {
742 float rain_intensity = GetGame().GetWeather().GetRain().GetActual();
743
744 float wetness = rain_intensity * 20 * CHECK_RAIN_INTERVAL;
745
746 if (rain_intensity > 1 || rain_intensity < 0)
747 wetness = 0; // hackfix for weird values returned by weather system
748
749 if (wetness == 0)
750 wetness = -0.1 * CHECK_RAIN_INTERVAL;
751
753
754 if (rain_intensity > 0)
755 {
756 WaterAllSlots();
757 SetSynchDirty();
758 }
759
760 for (int i = 0; i < slots_count; i++)
761 {
762 if (m_Slots)
763 {
764 Slot slot = m_Slots.Get(i);
765
766 if (slot)
767 slot.GiveWater(wetness * Math.RandomFloat01());
768 }
769 }
770 }
771
772 //Used to update
774 {
775 int state = 0;
776
777 for (int i = 0; i < m_Slots.Count(); i++)
778 state += 1 * Math.Pow(2, i);
779
780 SetSlotWateredState(state);
781 }
782
784 {
785 return m_Slots;
786 }
787
789 {
790 return m_Slots.Get(index);
791 }
792
794 {
795 return m_SlotWateredState;
796 }
797
799 {
800 m_SlotWateredState = newState;
801 }
802
809}
void AddAction(typename actionName)
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Definition DayZGame.c:3528
string ToStringLen(int len)
Integer to string with fixed length, padded with zeroes.
Definition EnConvert.c:59
override void SyncSlots()
Definition GardenPlot.c:153
PluginBase GetPlugin(typename plugin_type)
eFertlityState
Definition Slot.c:2
class JsonUndergroundAreaTriggerData GetPosition
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
override int GetGardenSlotsCount()
Definition GardenPlot.c:46
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
override void EEItemAttached(EntityAI item, string slot_name)
Definition GardenBase.c:324
override bool CanPutIntoHands(EntityAI player)
Definition GardenBase.c:284
int GetSlotIndexBySelection(string selection_component)
Definition GardenBase.c:637
void InitializeSlots()
Definition GardenBase.c:99
Slot GetSlotByIndex(int index)
Definition GardenBase.c:788
vector GetSlotPosition(int index)
Definition GardenBase.c:724
void CheckRainTick()
Definition GardenBase.c:740
void PlantSeed(ItemBase seed, string selection_component)
Definition GardenBase.c:380
void CheckRainStart()
Definition GardenBase.c:732
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition GardenBase.c:141
Slot GetSlotBySelection(string selection_component)
Definition GardenBase.c:626
override void EEOnAfterLoad()
Definition GardenBase.c:182
void RemoveSlotPlant(Object plant)
Definition GardenBase.c:619
override bool HasProxyParts()
Definition GardenBase.c:73
int GetSlotWateredState()
Definition GardenBase.c:793
int GetMaxWaterStateVal()
Definition GardenBase.c:128
override bool CanRemoveFromHands(EntityAI player)
Definition GardenBase.c:291
override void SetActions()
Definition GardenBase.c:803
void PrintSlots()
Definition GardenBase.c:233
ref array< ref Slot > m_Slots
Definition GardenBase.c:25
int GetSlotIndexByPlant(Object plant)
Definition GardenBase.c:683
void WaterAllSlots()
Definition GardenBase.c:773
int GetNearestSlotIDByState(vector position, int slot_state)
Definition GardenBase.c:699
int GetGardenSlotsCount()
Definition GardenBase.c:296
bool NeedsFertilization(string selection_component)
Definition GardenBase.c:489
bool IsCorrectFertilizer(ItemBase item, string selection_component)
Definition GardenBase.c:474
array< ref Slot > GetSlots()
Definition GardenBase.c:783
void SetBaseFertility(float value)
Definition GardenBase.c:83
override int GetHideIconMask()
Definition GardenBase.c:78
int GetSlotIndexByAttachmentSlot(string att_slot)
Definition GardenBase.c:669
ref Timer m_CheckRainTimer
Definition GardenBase.c:30
void SyncSlots()
Definition GardenBase.c:188
override void OnStoreSave(ParamsWriteContext ctx)
Definition GardenBase.c:215
override void AfterStoreLoad()
Definition GardenBase.c:177
void SetMaxWaterStateVal()
Definition GardenBase.c:118
override void EEItemDetached(EntityAI item, string slot_name)
Definition GardenBase.c:358
override void OnVariablesSynchronized()
Definition GardenBase.c:66
void GardenBase()
Definition GardenBase.c:34
void CreatePlant(Slot slot)
Definition GardenBase.c:407
override bool CanPutInCargo(EntityAI parent)
Definition GardenBase.c:278
void Fertilize(PlayerBase player, ItemBase item, float consumed_quantity, string selection_component)
Definition GardenBase.c:426
void SetSlotTextureDigged(int slot_index)
Definition GardenBase.c:531
void RemoveSlot(int index)
Definition GardenBase.c:589
void SlotWaterStateUpdate(Slot slot)
Definition GardenBase.c:502
void SetSlotWateredState(int newState)
Definition GardenBase.c:798
bool CanPlantSeed(string selection_component)
Definition GardenBase.c:301
void UpdateTexturesOnAllSlots()
Definition GardenBase.c:133
override void EOnInit(IEntity other, int extra)
Definition GardenBase.c:93
float GetBaseFertility()
Definition GardenBase.c:88
string ConvertAttSlotToPlantSlot(string attach_slot)
Definition GardenBase.c:312
static ref map< string, string > m_map_slots
Definition GardenBase.c:32
void UpdateSlotTexture(int slot_index)
Definition GardenBase.c:509
void SetSlotTextureFertilized(int slot_index, string item_type)
Definition GardenBase.c:555
Definition EnMath.c:7
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Pow(float v, float power)
Return power of v ^ power.
proto native int Length()
Returns length of string.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8