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