DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ItemBase.c
См. документацию.
3
4class DummyItem extends ItemBase
5{
6 override bool CanPutAsAttachment(EntityAI parent)
7 {
8 return true;
9 }
10};
11
12//const bool QUANTITY_DEBUG_REMOVE_ME = false;
13
15{
19
21
24 // ============================================
25 // Variable Manipulation System
26 // ============================================
27 // Quantity
28
30 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
36 float m_StoreLoadedQuantity = float.LOWEST;
37 // Wet
38 float m_VarWet;
39 float m_VarWetPrev;//for client to know wetness changed during synchronization
43 // Cleanness
48 // impact sounds
53 //
56 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
59 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
67 bool m_FixDamageSystemInit = false; //can be changed on storage version check
68 bool can_this_be_combined; //Check if item can be combined
69 bool m_CanThisBeSplit; //Check if item can be split
70 bool m_IsStoreLoad = false;
73 protected bool m_CanBeDigged;
74 protected bool m_IsResultOfSplit
75
77 // items color variables
82 //-------------------------------------------------------
83
84 // light source managing
86
90
91 //==============================================
92 // agent system
93 private int m_AttachedAgents;
94
97
98
99 // Weapons & suppressors particle effects
105
106 // Overheating effects
110 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
111 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
112 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
113 ref array <ref OverheatingParticle> m_OverheatingParticles;
114
117
118 // Admin Log
119 PluginAdminLog m_AdminLog;
120
121 // misc
123
124 // Attachment Locking variables
126 protected int m_LockType;
128 protected string m_LockSoundSet;
129
130 // ItemSoundHandler
131 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
132 protected int m_SoundSyncPlay; // id for sound to play
133 protected int m_SoundSyncStop; // id for sound to stop
135
136 //temperature
138
139 // -------------------------------------------------------------------------
140 void ItemBase()
141 {
142 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
146
147 if (!GetGame().IsDedicatedServer())
148 {
149 if (HasMuzzle())
150 {
152
154 {
156 }
157 }
158
160 m_ActionsInitialize = false;
161 }
162
163 m_OldLocation = null;
164
165 if (GetGame().IsServer())
166 {
167 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
168 }
169
170 if (ConfigIsExisting("headSelectionsToHide"))
171 {
173 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
174 }
175
177 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
178 {
179 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
180 }
181
182 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
183
184 m_IsResultOfSplit = false;
185
187 }
188
189 override void InitItemVariables()
190 {
191 super.InitItemVariables();
192
193 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
194 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
195 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
196 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
197 m_VarStackMax = ConfigGetFloat("varStackMax");
198 m_Count = ConfigGetInt("count");
199
200 m_CanShowQuantity = ConfigGetBool("quantityShow");
201 m_HasQuantityBar = ConfigGetBool("quantityBar");
202
203 m_CleannessInit = ConfigGetInt("varCleannessInit");
205 m_CleannessMin = ConfigGetInt("varCleannessMin");
206 m_CleannessMax = ConfigGetInt("varCleannessMax");
207
208 m_WantPlayImpactSound = false;
209 m_ImpactSpeed = 0.0;
210
211 m_VarWetInit = ConfigGetFloat("varWetInit");
213 m_VarWetMin = ConfigGetFloat("varWetMin");
214 m_VarWetMax = ConfigGetFloat("varWetMax");
215
216 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
217 if (IsLiquidContainer() && GetQuantity() != 0)
219 m_IsBeingPlaced = false;
220 m_IsHologram = false;
221 m_IsTakeable = true;
222 m_CanBeMovedOverride = false;
226 m_CanBeDigged = ConfigGetBool("canBeDigged");
227
229 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
230 m_LockType = ConfigGetInt("lockType");
231
232 //Define if item can be split and set ability to be combined accordingly
233 m_CanThisBeSplit = false;
234 can_this_be_combined = false;
235 if (ConfigIsExisting("canBeSplit"))
236 {
237 can_this_be_combined = ConfigGetBool("canBeSplit");
239 }
240
241 m_ItemBehaviour = -1;
242 if (ConfigIsExisting("itemBehaviour"))
243 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
244
245 //RegisterNetSyncVariableInt("m_VariablesMask");
246 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
247 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
248 RegisterNetSyncVariableInt("m_VarLiquidType");
249 RegisterNetSyncVariableInt("m_Cleanness",0,1);
250
251 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
252 RegisterNetSyncVariableFloat("m_ImpactSpeed");
253 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
254
255 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
256 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
257 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
258 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
259
260 RegisterNetSyncVariableBool("m_IsBeingPlaced");
261 RegisterNetSyncVariableBool("m_IsTakeable");
262 RegisterNetSyncVariableBool("m_IsHologram");
263
266 {
267 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
268 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
269 }
270
271 m_LockSoundSet = ConfigGetString("lockSoundSet");
272
274 if (ConfigIsExisting("temperaturePerQuantityWeight"))
275 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
276
277 }
278
279 override int GetQuickBarBonus()
280 {
281 return m_QuickBarBonus;
282 }
283
285 {
287 if (!m_InputActionMap)
288 {
290 m_InputActionMap = iam;
291 SetActions();
292 m_ItemTypeActionsMap.Insert(this.Type(), m_InputActionMap);
293 }
294 }
295
296 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
297 {
299 {
300 m_ActionsInitialize = true;
302 }
303
304 actions = m_InputActionMap.Get(action_input_type);
305 }
306
315
316 void SetActionAnimOverrides(); // Override action animation for specific item
317
318 void AddAction(typename actionName)
319 {
320 ActionBase action = ActionManagerBase.GetAction(actionName);
321
322 if (!action)
323 {
324 Debug.LogError("Action " + actionName + " dosn't exist!");
325 return;
326 }
327
328 typename ai = action.GetInputType();
329 if (!ai)
330 {
331 m_ActionsInitialize = false;
332 return;
333 }
334
335 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
336 if (!action_array)
337 {
338 action_array = new array<ActionBase_Basic>;
339 m_InputActionMap.Insert(ai, action_array);
340 }
342 {
343 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
344 }
345
346 if (action_array.Find(action) != -1)
347 {
348 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
349 }
350 else
351 {
352 action_array.Insert(action);
353 }
354 }
355
356 void RemoveAction(typename actionName)
357 {
358 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
359 ActionBase action = player.GetActionManager().GetAction(actionName);
360 typename ai = action.GetInputType();
361 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
362
363 if (action_array)
364 {
365 action_array.RemoveItem(action);
366 }
367 }
368
369 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
370 // Set -1 for params which should stay in default state
371 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
372 {
373 ActionOverrideData overrideData = new ActionOverrideData();
374 overrideData.m_CommandUID = commandUID;
375 overrideData.m_CommandUIDProne = commandUIDProne;
376 overrideData.m_StanceMask = stanceMask;
377
378 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
379 if (!actionMap) // create new map of action > overidables map
380 {
381 actionMap = new TActionAnimOverrideMap();
382 m_ItemActionOverrides.Insert(action, actionMap);
383 }
384
385 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
386
387 }
388
390
392
393 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
395 {
396 if (!m_OnFireEffect)
398
401
402 string config_to_search = "CfgVehicles";
403 string muzzle_owner_config;
404
405 if (!m_OnFireEffect.Contains(id))
406 {
407 if (IsInherited(Weapon))
408 config_to_search = "CfgWeapons";
409
410 muzzle_owner_config = config_to_search + " " + GetType() + " ";
411
412 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
413
414 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
415
416 if (config_OnFire_subclass_count > 0)
417 {
419
420 for (int i = 0; i < config_OnFire_subclass_count; i++)
421 {
422 string particle_class = "";
423 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
424 string config_OnFire_entry = config_OnFire_class + particle_class;
425 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
426 WPOF_array.Insert(WPOF);
427 }
428
429
430 m_OnFireEffect.Insert(id, WPOF_array);
431 }
432 }
433
434 if (!m_OnBulletCasingEjectEffect.Contains(id))
435 {
436 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
437 muzzle_owner_config = config_to_search + " " + GetType() + " ";
438
439 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
440
441 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
442
443 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
444 {
446
447 for (i = 0; i < config_OnBulletCasingEject_count; i++)
448 {
449 string particle_class2 = "";
450 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
451 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
452 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
453 WPOBE_array.Insert(WPOBE);
454 }
455
456
457 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
458 }
459 }
460 }
461
462 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
464 {
467
468 if (!m_OnOverheatingEffect.Contains(id))
469 {
470 string config_to_search = "CfgVehicles";
471
472 if (IsInherited(Weapon))
473 config_to_search = "CfgWeapons";
474
475 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
476 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
477
478 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
479 {
480
481 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
482
484 {
485 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
486 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
487 Error(error);
488 return;
489 }
490
491 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
492 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
493
494
495
496 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
498
499 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
500 {
501 string particle_class = "";
502 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
503 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
504 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
505
506 if (entry_type == CT_CLASS)
507 {
508 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
509 WPOOH_array.Insert(WPOF);
510 }
511 }
512
513
514 m_OnOverheatingEffect.Insert(id, WPOOH_array);
515 }
516 }
517 }
518
520 {
521 return m_OverheatingShots;
522 }
523
524 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
525 {
526 if (m_MaxOverheatingValue > 0)
527 {
529
532
533 m_CheckOverheating.Stop();
534 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
535
536 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
537 }
538 }
539
540 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
541 {
543 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
544
546 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
547
549 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
550
552 {
554 }
555 }
556
561
563 {
564 if (m_MaxOverheatingValue > 0)
565 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
566 else
568
569 if (m_OverheatingShots <= 0)
570 {
571 m_CheckOverheating.Stop();
573 }
574 else
575 {
578
579 m_CheckOverheating.Stop();
580 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
581 }
582
583 CheckOverheating(this, "", this);
584 }
585
586 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
587 {
589 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
590 }
591
592 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
593 {
595 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
597 }
598
599 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
600 {
602 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
603 }
604
605 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
606 {
609
611 OP.RegisterParticle(p);
612 OP.SetOverheatingLimitMin(min_heat_coef);
613 OP.SetOverheatingLimitMax(max_heat_coef);
614 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
615
616 m_OverheatingParticles.Insert(OP);
617 }
618
620 {
621 if (m_MaxOverheatingValue > 0)
623
624 return -1;
625 }
626
628 {
630 {
631 float overheat_coef = GetOverheatingCoef();
632 int count = m_OverheatingParticles.Count();
633
634 for (int i = count; i > 0; --i)
635 {
636 int id = i - 1;
638 Particle p = OP.GetParticle();
639
640 float overheat_min = OP.GetOverheatingLimitMin();
641 float overheat_max = OP.GetOverheatingLimitMax();
642
643 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
644 {
645 if (p)
646 {
647 p.Stop();
648 OP.RegisterParticle(null);
649 }
650 }
651 }
652 }
653 }
654
656 {
658 {
659 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
660 {
661 int id = i - 1;
663
664 if (OP)
665 {
666 Particle p = OP.GetParticle();
667
668 if (p)
669 {
670 p.Stop();
671 }
672
673 delete OP;
674 }
675 }
676
679 }
680 }
681
683 float GetInfectionChance(int system = 0, Param param = null)
684 {
685 return 0.0;
686 }
687
688
689 float GetDisinfectQuantity(int system = 0, Param param1 = null)
690 {
691 return 250;//default value
692 }
693
695 {
696 return 0;
697 }
698
701 {
702 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
703 return true;
704
705 return false;
706 }
707
710 {
711 if (!m_WeaponTypeToID)
713
714 if (m_WeaponTypeToID.Contains(GetType()))
715 {
716 return m_WeaponTypeToID.Get(GetType());
717 }
718 else
719 {
720 // Register new weapon ID
722 }
723
725 }
726
733 {
734 return -1;
735 }
736
737
738
739 // -------------------------------------------------------------------------
741 {
742 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
743 {
744 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
745 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
746
747 if (r_index >= 0)
748 {
750 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
751
752 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
753 int r_type = r_il.GetType();
754 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
755 {
756 r_il.GetParent().GetOnReleaseLock().Invoke(this);
757 }
758 else if (r_type == InventoryLocationType.ATTACHMENT)
759 {
760 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
761 }
762
763 }
764
765 player.GetHumanInventory().ClearUserReservedLocation(this);
766 }
767
768 if (m_LockingSound)
770 }
771
772
773
774 // -------------------------------------------------------------------------
776 {
777 return ItemBase.m_DebugActionsMask;
778 }
779
780 static bool HasDebugActionsMask(int mask)
781 {
782 return ItemBase.m_DebugActionsMask & mask;
783 }
784
785 static void SetDebugActionsMask(int mask)
786 {
787 ItemBase.m_DebugActionsMask = mask;
788 }
789
790 static void AddDebugActionsMask(int mask)
791 {
792 ItemBase.m_DebugActionsMask |= mask;
793 }
794
795 static void RemoveDebugActionsMask(int mask)
796 {
797 ItemBase.m_DebugActionsMask &= ~mask;
798 }
799
800 static void ToggleDebugActionsMask(int mask)
801 {
802 if (HasDebugActionsMask(mask))
803 {
805 }
806 else
807 {
809 }
810 }
811
812 // -------------------------------------------------------------------------
814 {
815 if (GetEconomyProfile())
816 {
817 float q_max = GetEconomyProfile().GetQuantityMax();
818 if (q_max > 0)
819 {
820 float q_min = GetEconomyProfile().GetQuantityMin();
821 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
822
823 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
824 {
825 ComponentEnergyManager comp = GetCompEM();
826 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))//checking for a potential for energy, we need to check both values, as both are optional, only when both are set to 0, we know the item can't have energy
827 {
828 comp.SetEnergy0To1(quantity_randomized);
829 }
830 }
831 else if (HasQuantity())
832 {
833 SetQuantityNormalized(quantity_randomized, false);
834 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
835 }
836
837 }
838 }
839 }
840
843 {
844 EntityAI parent = GetHierarchyParent();
845
846 if (parent)
847 {
848 InventoryLocation inventory_location_to_lock = new InventoryLocation;
849 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
850 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
851 }
852 }
853
856 {
857 EntityAI parent = GetHierarchyParent();
858
859 if (parent)
860 {
861 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
862 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
863 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
864 }
865 }
866
867 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
868 {
869 /*
870 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
871 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
872 */
873 ItemBase item2 = ItemBase.Cast(entity2);
874
875 if (GetGame().IsClient())
876 {
878 {
881 ctx.Write(-1);
882 ItemBase i1 = this; // @NOTE: workaround for correct serialization
883 ctx.Write(i1);
884 ctx.Write(item2);
885 ctx.Write(use_stack_max);
886 ctx.Write(-1);
887 ctx.Send();
888
889 if (IsCombineAll(item2, use_stack_max))
890 {
891 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
892 }
893 }
894 }
895 else if (!GetGame().IsMultiplayer())
896 {
897 CombineItems(item2, use_stack_max);
898 }
899 }
900
902 {
903 return (GetLiquidType() != 0 && HasQuantity());
904 }
905
907 {
908 return m_LiquidContainerMask != 0;
909 }
910
912 {
914 }
915
917 {
918 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
919 return false;
920 }
921
922 bool IsNVG()
923 {
924 return false;
925 }
926
930 {
931 return false;
932 }
933
935 {
936 return "";
937 }
938
940
942 {
943 return false;
944 }
945
947 {
948 return true;
949 }
950
951 //--- ACTION CONDITIONS
952 //direction
953 bool IsFacingPlayer(PlayerBase player, string selection)
954 {
955 return true;
956 }
957
958 bool IsPlayerInside(PlayerBase player, string selection)
959 {
960 return true;
961 }
962
963 override bool CanObstruct()
964 {
965 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
966 return !player || !IsPlayerInside(player, "");
967 }
968
969 override bool IsBeingPlaced()
970 {
971 return m_IsBeingPlaced;
972 }
973
974 void SetIsBeingPlaced(bool is_being_placed)
975 {
976 m_IsBeingPlaced = is_being_placed;
977 if (!is_being_placed)
979 SetSynchDirty();
980 }
981
982 //server-side
984
985 override bool IsHologram()
986 {
987 return m_IsHologram;
988 }
989
991 {
992 return m_CanBeDigged;
993 }
994
996 {
997 return 1;
998 }
999
1001 {
1002 return false;
1003 }
1004
1005 void SetIsHologram(bool is_hologram)
1006 {
1007 m_IsHologram = is_hologram;
1008 SetSynchDirty();
1009 }
1010 /*
1011 protected float GetNutritionalEnergy()
1012 {
1013 Edible_Base edible = Edible_Base.Cast(this);
1014 return edible.GetFoodEnergy();
1015 }
1016
1017 protected float GetNutritionalWaterContent()
1018 {
1019 Edible_Base edible = Edible_Base.Cast(this);
1020 return edible.GetFoodWater();
1021 }
1022
1023 protected float GetNutritionalIndex()
1024 {
1025 Edible_Base edible = Edible_Base.Cast(this);
1026 return edible.GetFoodNutritionalIndex();
1027 }
1028
1029 protected float GetNutritionalFullnessIndex()
1030 {
1031 Edible_Base edible = Edible_Base.Cast(this);
1032 return edible.GetFoodTotalVolume();
1033 }
1034
1035 protected float GetNutritionalToxicity()
1036 {
1037 Edible_Base edible = Edible_Base.Cast(this);
1038 return edible.GetFoodToxicity();
1039
1040 }
1041 */
1042
1043
1044 // -------------------------------------------------------------------------
1045 override void OnMovedInsideCargo(EntityAI container)
1046 {
1047 super.OnMovedInsideCargo(container);
1048
1049 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
1050 }
1051
1052 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
1053 {
1054 super.EEItemLocationChanged(oldLoc,newLoc);
1055
1056 PlayerBase new_player = null;
1057 PlayerBase old_player = null;
1058
1059 if (newLoc.GetParent())
1060 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
1061
1062 if (oldLoc.GetParent())
1063 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
1064
1065 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
1066 {
1067 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
1068
1069 if (r_index >= 0)
1070 {
1072 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1073
1074 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1075 int r_type = r_il.GetType();
1076 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
1077 {
1078 r_il.GetParent().GetOnReleaseLock().Invoke(this);
1079 }
1080 else if (r_type == InventoryLocationType.ATTACHMENT)
1081 {
1082 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
1083 }
1084
1085 }
1086 }
1087
1088 if (newLoc.GetType() == InventoryLocationType.HANDS)
1089 {
1090 if (new_player)
1091 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
1092
1093 if (new_player == old_player)
1094 {
1095
1096 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1097 {
1098 if (oldLoc.GetType() == InventoryLocationType.CARGO)
1099 {
1100 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
1101 {
1102 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1103 }
1104 }
1105 else
1106 {
1107 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1108 }
1109 }
1110
1111 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
1112 {
1113 int type = oldLoc.GetType();
1114 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
1115 {
1116 oldLoc.GetParent().GetOnSetLock().Invoke(this);
1117 }
1118 else if (type == InventoryLocationType.ATTACHMENT)
1119 {
1120 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
1121 }
1122 }
1123 if (!m_OldLocation)
1124 {
1125 m_OldLocation = new InventoryLocation;
1126 }
1127 m_OldLocation.Copy(oldLoc);
1128 }
1129 else
1130 {
1131 if (m_OldLocation)
1132 {
1133 m_OldLocation.Reset();
1134 }
1135 }
1136
1138 }
1139 else
1140 {
1141 if (new_player)
1142 {
1143 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
1144 if (res_index >= 0)
1145 {
1147 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
1148 ItemBase it = ItemBase.Cast(il.GetItem());
1149 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
1150 int rel_type = il.GetType();
1151 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
1152 {
1153 il.GetParent().GetOnReleaseLock().Invoke(it);
1154 }
1155 else if (rel_type == InventoryLocationType.ATTACHMENT)
1156 {
1157 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
1158 }
1159 //it.GetOnReleaseLock().Invoke(it);
1160 }
1161 }
1162 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
1163 {
1164 //ThrowPhysically(old_player, vector.Zero);
1165 m_ThrowItemOnDrop = false;
1166 }
1167
1168 if (m_OldLocation)
1169 {
1170 m_OldLocation.Reset();
1171 }
1172 }
1173 }
1174
1175 override void EOnContact(IEntity other, Contact extra)
1176 {
1178 {
1179 int liquidType = -1;
1180 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
1181 if (impactSpeed > 0.0)
1182 {
1183 m_ImpactSpeed = impactSpeed;
1184 #ifndef SERVER
1185 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
1186 #else
1187 m_WantPlayImpactSound = true;
1188 SetSynchDirty();
1189 #endif
1190 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
1191 }
1192 }
1193
1194 #ifdef SERVER
1195 if (GetCompEM() && GetCompEM().IsPlugged())
1196 {
1197 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
1198 GetCompEM().UnplugThis();
1199 }
1200 #endif
1201 }
1202
1204
1205 override void OnCreatePhysics()
1206 {
1208 }
1209
1210 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
1211 {
1212
1213 }
1214 // -------------------------------------------------------------------------
1215 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
1216 {
1217 super.OnItemLocationChanged(old_owner, new_owner);
1218
1219 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
1220 PlayerBase playerNew = PlayerBase.Cast(new_owner);
1221
1222 if (!relatedPlayer && playerNew)
1223 relatedPlayer = playerNew;
1224
1225 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
1226 {
1227 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
1228 if (actionMgr)
1229 {
1230 ActionBase currentAction = actionMgr.GetRunningAction();
1231 if (currentAction)
1232 currentAction.OnItemLocationChanged(this);
1233 }
1234 }
1235
1236 Man ownerPlayerOld = null;
1237 Man ownerPlayerNew = null;
1238
1239 if (old_owner)
1240 {
1241 if (old_owner.IsMan())
1242 {
1243 ownerPlayerOld = Man.Cast(old_owner);
1244 }
1245 else
1246 {
1247 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
1248 }
1249 }
1250 else
1251 {
1252 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
1253 {
1255
1256 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
1257 {
1258 GetCompEM().UnplugThis();
1259 }
1260 }
1261 }
1262
1263 if (new_owner)
1264 {
1265 if (new_owner.IsMan())
1266 {
1267 ownerPlayerNew = Man.Cast(new_owner);
1268 }
1269 else
1270 {
1271 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
1272 }
1273 }
1274
1275 if (ownerPlayerOld != ownerPlayerNew)
1276 {
1277 if (ownerPlayerOld)
1278 {
1279 array<EntityAI> subItemsExit = new array<EntityAI>;
1280 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
1281 for (int i = 0; i < subItemsExit.Count(); i++)
1282 {
1283 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
1284 itemExit.OnInventoryExit(ownerPlayerOld);
1285 }
1286 }
1287
1288 if (ownerPlayerNew)
1289 {
1290 array<EntityAI> subItemsEnter = new array<EntityAI>;
1291 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
1292 for (int j = 0; j < subItemsEnter.Count(); j++)
1293 {
1294 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
1295 itemEnter.OnInventoryEnter(ownerPlayerNew);
1296 }
1297 }
1298 }
1299 else if (ownerPlayerNew != null)
1300 {
1301 PlayerBase nplayer;
1302 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
1303 {
1304 array<EntityAI> subItemsUpdate = new array<EntityAI>;
1305 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
1306 for (int k = 0; k < subItemsUpdate.Count(); k++)
1307 {
1308 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
1309 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
1310 }
1311 }
1312 }
1313
1314 if (old_owner)
1315 old_owner.OnChildItemRemoved(this);
1316 if (new_owner)
1317 new_owner.OnChildItemReceived(this);
1318 }
1319
1320 // -------------------------------------------------------------------------------
1321 override void EEDelete(EntityAI parent)
1322 {
1323 super.EEDelete(parent);
1324 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
1325 if (player)
1326 {
1327 OnInventoryExit(player);
1328
1329 if (player.IsAlive())
1330 {
1331 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
1332 if (r_index >= 0)
1333 {
1335 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1336
1337 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1338 int r_type = r_il.GetType();
1339 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
1340 {
1341 r_il.GetParent().GetOnReleaseLock().Invoke(this);
1342 }
1343 else if (r_type == InventoryLocationType.ATTACHMENT)
1344 {
1345 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
1346 }
1347
1348 }
1349
1350 player.RemoveQuickBarEntityShortcut(this);
1351 }
1352 }
1353 }
1354 // -------------------------------------------------------------------------------
1355 override void EEKilled(Object killer)
1356 {
1357 super.EEKilled(killer);
1358
1360 if (killer && killer.IsFireplace() && CanExplodeInFire())
1361 {
1362 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
1363 {
1364 if (IsMagazine())
1365 {
1366 if (Magazine.Cast(this).GetAmmoCount() > 0)
1367 {
1368 ExplodeAmmo();
1369 }
1370 }
1371 else
1372 {
1373 Explode(DamageType.EXPLOSION);
1374 }
1375 }
1376 }
1377 }
1378
1379 override void OnWasAttached(EntityAI parent, int slot_id)
1380 {
1381 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
1382
1383 super.OnWasAttached(parent, slot_id);
1384
1385 if (HasQuantity())
1386 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
1387
1389 }
1390
1391 override void OnWasDetached(EntityAI parent, int slot_id)
1392 {
1393 super.OnWasDetached(parent, slot_id);
1394
1395 if (HasQuantity())
1396 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
1397 }
1398
1399 override string ChangeIntoOnAttach(string slot)
1400 {
1401 int idx;
1402 TStringArray inventory_slots = new TStringArray;
1403 TStringArray attach_types = new TStringArray;
1404
1405 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
1406 if (inventory_slots.Count() < 1) //is string
1407 {
1408 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
1409 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
1410 }
1411 else //is array
1412 {
1413 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
1414 }
1415
1416 idx = inventory_slots.Find(slot);
1417 if (idx < 0)
1418 return "";
1419
1420 return attach_types.Get(idx);
1421 }
1422
1423 override string ChangeIntoOnDetach()
1424 {
1425 int idx = -1;
1426 string slot;
1427
1428 TStringArray inventory_slots = new TStringArray;
1429 TStringArray detach_types = new TStringArray;
1430
1431 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
1432 if (inventory_slots.Count() < 1) //is string
1433 {
1434 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
1435 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
1436 }
1437 else //is array
1438 {
1439 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
1440 if (detach_types.Count() < 1)
1441 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
1442 }
1443
1444 for (int i = 0; i < inventory_slots.Count(); i++)
1445 {
1446 slot = inventory_slots.Get(i);
1447 }
1448
1449 if (slot != "")
1450 {
1451 if (detach_types.Count() == 1)
1452 idx = 0;
1453 else
1454 idx = inventory_slots.Find(slot);
1455 }
1456 if (idx < 0)
1457 return "";
1458
1459 return detach_types.Get(idx);
1460 }
1461
1463 {
1464 //timer
1465 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
1466
1467 //min/max time
1468 float min_time = 1;
1469 float max_time = 3;
1470 float delay = Math.RandomFloat(min_time, max_time);
1471
1472 explode_timer.Run(delay, this, "DoAmmoExplosion");
1473 }
1474
1476 {
1477 Magazine magazine = Magazine.Cast(this);
1478 int pop_sounds_count = 6;
1479 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
1480
1481 //play sound
1482 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
1483 string sound_name = pop_sounds[ sound_idx ];
1484 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
1485
1486 //remove ammo count
1487 magazine.ServerAddAmmoCount(-1);
1488
1489 //if condition then repeat -> ExplodeAmmo
1490 float min_temp_to_explode = 100; //min temperature for item to explode
1491
1492 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
1493 {
1494 ExplodeAmmo();
1495 }
1496 }
1497
1498 // -------------------------------------------------------------------------------
1499 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
1500 {
1501 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
1502
1503 const int CHANCE_DAMAGE_CARGO = 4;
1504 const int CHANCE_DAMAGE_ATTACHMENT = 1;
1505 const int CHANCE_DAMAGE_NOTHING = 2;
1506
1507 if (IsClothing() || IsContainer() || IsItemTent())
1508 {
1509 float dmg = damageResult.GetDamage("","Health") * -0.5;
1510 int chances;
1511 int rnd;
1512
1513 if (GetInventory().GetCargo())
1514 {
1515 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1516 rnd = Math.RandomInt(0,chances);
1517
1518 if (rnd < CHANCE_DAMAGE_CARGO)
1519 {
1520 DamageItemInCargo(dmg);
1521 }
1522 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
1523 {
1525 }
1526 }
1527 else
1528 {
1529 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1530 rnd = Math.RandomInt(0,chances);
1531
1532 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
1533 {
1535 }
1536 }
1537 }
1538 }
1539
1540 bool DamageItemInCargo(float damage)
1541 {
1542 if (GetInventory().GetCargo())
1543 {
1544 int item_count = GetInventory().GetCargo().GetItemCount();
1545 if (item_count > 0)
1546 {
1547 int random_pick = Math.RandomInt(0, item_count);
1548 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
1549 if (!item.IsExplosive())
1550 {
1551 item.AddHealth("","",damage);
1552 return true;
1553 }
1554 }
1555 }
1556 return false;
1557 }
1558
1559 bool DamageItemAttachments(float damage)
1560 {
1561 int attachment_count = GetInventory().AttachmentCount();
1562 if (attachment_count > 0)
1563 {
1564 int random_pick = Math.RandomInt(0, attachment_count);
1565 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
1566 if (!attachment.IsExplosive())
1567 {
1568 attachment.AddHealth("","",damage);
1569 return true;
1570 }
1571 }
1572 return false;
1573 }
1574
1575 override bool IsSplitable()
1576 {
1577 return m_CanThisBeSplit;
1578 }
1579 //----------------
1580 override bool CanBeSplit()
1581 {
1582 if (IsSplitable() && (GetQuantity() > 1))
1583 return GetInventory().CanRemoveEntity();
1584
1585 return false;
1586 }
1587
1588 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
1589 {
1590 if (!CanBeSplit())
1591 return;
1592
1593 if (GetGame().IsClient())
1594 {
1596 {
1599 ctx.Write(1);
1600 ItemBase i1 = this; // @NOTE: workaround for correct serialization
1601 ctx.Write(i1);
1602 ctx.Write(destination_entity);
1603 ctx.Write(true);
1604 ctx.Write(slot_id);
1605 ctx.Send();
1606 }
1607 }
1608 else if (!GetGame().IsMultiplayer())
1609 {
1610 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
1611 }
1612 }
1613
1614 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
1615 {
1616 if (!CanBeSplit())
1617 return;
1618
1619 float split_quantity_new;
1620 ref ItemBase new_item;
1621 float quantity = GetQuantity();
1622 float stack_max = GetTargetQuantityMax(slot_id);
1624
1625 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
1626 {
1627 if (stack_max <= GetQuantity())
1628 split_quantity_new = stack_max;
1629 else
1630 split_quantity_new = GetQuantity();
1631
1632 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
1633 if (new_item)
1634 {
1635 new_item.SetResultOfSplit(true);
1636 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1637 AddQuantity(-split_quantity_new);
1638 new_item.SetQuantity(split_quantity_new);
1639 }
1640 }
1641 else if (destination_entity && slot_id == -1)
1642 {
1643 if (quantity > stack_max)
1644 split_quantity_new = stack_max;
1645 else
1646 split_quantity_new = quantity;
1647
1648 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
1649 {
1650 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
1651 new_item = ItemBase.Cast(o);
1652 }
1653
1654 if (new_item)
1655 {
1656 new_item.SetResultOfSplit(true);
1657 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1658 AddQuantity(-split_quantity_new);
1659 new_item.SetQuantity(split_quantity_new);
1660 }
1661 }
1662 else
1663 {
1664 if (stack_max != 0)
1665 {
1666 if (stack_max < GetQuantity())
1667 {
1668 split_quantity_new = GetQuantity() - stack_max;
1669 }
1670
1671 if (split_quantity_new == 0)
1672 {
1673 if (!GetGame().IsMultiplayer())
1674 player.PhysicalPredictiveDropItem(this);
1675 else
1676 player.ServerDropEntity(this);
1677 return;
1678 }
1679
1680 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
1681
1682 if (new_item)
1683 {
1684 new_item.SetResultOfSplit(true);
1685 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1686 SetQuantity(split_quantity_new);
1687 new_item.SetQuantity(stack_max);
1688 new_item.PlaceOnSurface();
1689 }
1690 }
1691 }
1692 }
1693
1694 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
1695 {
1696 if (!CanBeSplit())
1697 return;
1698
1699 float split_quantity_new;
1700 ref ItemBase new_item;
1701 float quantity = GetQuantity();
1702 float stack_max = GetTargetQuantityMax(slot_id);
1704
1705 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
1706 {
1707 if (stack_max <= GetQuantity())
1708 split_quantity_new = stack_max;
1709 else
1710 split_quantity_new = GetQuantity();
1711
1712 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
1713 if (new_item)
1714 {
1715 new_item.SetResultOfSplit(true);
1716 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1717 AddQuantity(-split_quantity_new);
1718 new_item.SetQuantity(split_quantity_new);
1719 }
1720 }
1721 else if (destination_entity && slot_id == -1)
1722 {
1723 if (quantity > stack_max)
1724 split_quantity_new = stack_max;
1725 else
1726 split_quantity_new = quantity;
1727
1728 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
1729 {
1730 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
1731 new_item = ItemBase.Cast(o);
1732 }
1733
1734 if (new_item)
1735 {
1736 new_item.SetResultOfSplit(true);
1737 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1738 AddQuantity(-split_quantity_new);
1739 new_item.SetQuantity(split_quantity_new);
1740 }
1741 }
1742 else
1743 {
1744 if (stack_max != 0)
1745 {
1746 if (stack_max < GetQuantity())
1747 {
1748 split_quantity_new = GetQuantity() - stack_max;
1749 }
1750
1751 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
1752
1753 if (new_item)
1754 {
1755 new_item.SetResultOfSplit(true);
1756 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1757 SetQuantity(split_quantity_new);
1758 new_item.SetQuantity(stack_max);
1759 new_item.PlaceOnSurface();
1760 }
1761 }
1762 }
1763 }
1764
1766 {
1767 if (!CanBeSplit())
1768 return;
1769
1770 if (GetGame().IsClient())
1771 {
1773 {
1776 ctx.Write(4);
1777 ItemBase thiz = this; // @NOTE: workaround for correct serialization
1778 ctx.Write(thiz);
1779 dst.WriteToContext(ctx);
1780 ctx.Send();
1781 }
1782 }
1783 else if (!GetGame().IsMultiplayer())
1784 {
1786 }
1787 }
1788
1789 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
1790 {
1791 if (!CanBeSplit())
1792 return;
1793
1794 if (GetGame().IsClient())
1795 {
1797 {
1800 ctx.Write(2);
1801 ItemBase dummy = this; // @NOTE: workaround for correct serialization
1802 ctx.Write(dummy);
1803 ctx.Write(destination_entity);
1804 ctx.Write(true);
1805 ctx.Write(idx);
1806 ctx.Write(row);
1807 ctx.Write(col);
1808 ctx.Send();
1809 }
1810 }
1811 else if (!GetGame().IsMultiplayer())
1812 {
1813 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
1814 }
1815 }
1816
1821
1823 {
1824 if (!CanBeSplit())
1825 return this;
1826
1827 float quantity = GetQuantity();
1828 float split_quantity_new;
1829 ItemBase new_item;
1830 if (dst.IsValid())
1831 {
1832 int slot_id = dst.GetSlot();
1833 float stack_max = GetTargetQuantityMax(slot_id);
1834
1835 if (quantity > stack_max)
1836 split_quantity_new = stack_max;
1837 else
1838 split_quantity_new = quantity;
1839
1840 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
1841
1842 if (new_item)
1843 {
1844 new_item.SetResultOfSplit(true);
1845 MiscGameplayFunctions.TransferItemProperties(this,new_item);
1846 AddQuantity(-split_quantity_new);
1847 new_item.SetQuantity(split_quantity_new);
1848 }
1849
1850 return new_item;
1851 }
1852
1853 return null;
1854 }
1855
1856 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
1857 {
1858 if (!CanBeSplit())
1859 return;
1860
1861 float quantity = GetQuantity();
1862 float split_quantity_new;
1863 ref ItemBase new_item;
1864 if (destination_entity)
1865 {
1866 float stackable = GetTargetQuantityMax();
1867 if (quantity > stackable)
1868 split_quantity_new = stackable;
1869 else
1870 split_quantity_new = quantity;
1871
1872 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
1873 if (new_item)
1874 {
1875 new_item.SetResultOfSplit(true);
1876 MiscGameplayFunctions.TransferItemProperties(this,new_item);
1877 AddQuantity(-split_quantity_new);
1878 new_item.SetQuantity(split_quantity_new);
1879 }
1880 }
1881 }
1882
1884 {
1885 if (!CanBeSplit())
1886 return;
1887
1888 if (GetGame().IsClient())
1889 {
1891 {
1894 ctx.Write(3);
1895 ItemBase i1 = this; // @NOTE: workaround for correct serialization
1896 ctx.Write(i1);
1897 ItemBase destination_entity = this;
1898 ctx.Write(destination_entity);
1899 ctx.Write(true);
1900 ctx.Write(0);
1901 ctx.Send();
1902 }
1903 }
1904 else if (!GetGame().IsMultiplayer())
1905 {
1906 SplitIntoStackMaxHands(player);
1907 }
1908 }
1909
1911 {
1912 if (!CanBeSplit())
1913 return;
1914
1915 float quantity = GetQuantity();
1916 float split_quantity_new;
1917 ref ItemBase new_item;
1918 if (player)
1919 {
1920 float stackable = GetTargetQuantityMax();
1921 if (quantity > stackable)
1922 split_quantity_new = stackable;
1923 else
1924 split_quantity_new = quantity;
1925
1926 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
1927 new_item = ItemBase.Cast(in_hands);
1928 if (new_item)
1929 {
1930 new_item.SetResultOfSplit(true);
1931 MiscGameplayFunctions.TransferItemProperties(this,new_item);
1932 AddQuantity(-split_quantity_new);
1933 new_item.SetQuantity(split_quantity_new);
1934 }
1935 }
1936 }
1937
1939 {
1940 if (!CanBeSplit())
1941 return;
1942
1943 float quantity = GetQuantity();
1944 float split_quantity_new = Math.Floor(quantity * 0.5);
1945
1947
1948 if (new_item)
1949 {
1950 if (new_item.GetQuantityMax() < split_quantity_new)
1951 {
1952 split_quantity_new = new_item.GetQuantityMax();
1953 }
1954
1955 new_item.SetResultOfSplit(true);
1956 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1957
1958 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
1959 {
1960 AddQuantity(-1);
1961 new_item.SetQuantity(1);
1962 }
1963 else
1964 {
1965 AddQuantity(-split_quantity_new);
1966 new_item.SetQuantity(split_quantity_new);
1967 }
1968 }
1969 }
1970
1972 {
1973 if (!CanBeSplit())
1974 return;
1975
1976 float quantity = GetQuantity();
1977 float split_quantity_new = Math.Floor(quantity / 2);
1978
1980 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
1981
1982 ItemBase new_item;
1983 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
1984
1985 if (new_item)
1986 {
1987 if (new_item.GetQuantityMax() < split_quantity_new)
1988 {
1989 split_quantity_new = new_item.GetQuantityMax();
1990 }
1991 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
1992 {
1993 AddQuantity(-1);
1994 new_item.SetQuantity(1);
1995 }
1996 else
1997 {
1998 AddQuantity(-split_quantity_new);
1999 new_item.SetQuantity(split_quantity_new);
2000 }
2001 }
2002 }
2003
2005 void OnQuantityChanged(float delta)
2006 {
2007 SetWeightDirty();
2008 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
2009
2010 if (parent)
2011 parent.OnAttachmentQuantityChangedEx(this, delta);
2012
2013 if (IsLiquidContainer())
2014 {
2015 if (GetQuantityNormalized() <= 0.0)
2016 {
2018 }
2019 else if (GetLiquidType() == LIQUID_NONE)
2020 {
2021 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
2023 }
2024 }
2025
2026 }
2027
2030 {
2031 // insert code here
2032 }
2033
2036 {
2038 }
2039
2040 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
2041 {
2042 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2043
2044 if (GetGame().IsServer())
2045 {
2046 if (newLevel == GameConstants.STATE_RUINED)
2047 {
2049 EntityAI parent = GetHierarchyParent();
2050 if (parent && parent.IsFireplace())
2051 {
2052 CargoBase cargo = GetInventory().GetCargo();
2053 if (cargo)
2054 {
2055 for (int i = 0; i < cargo.GetItemCount(); ++i)
2056 {
2057 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
2058 }
2059 }
2060 }
2061 }
2062
2063 if (IsResultOfSplit())
2064 {
2065 // reset the splitting result flag, return to normal item behavior
2066 SetResultOfSplit(false);
2067 return;
2068 }
2069
2070 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
2071 {
2072 SetCleanness(0);//unclean the item upon damage dealt
2073 }
2074 }
2075 }
2076
2077 // just the split? TODO: verify
2078 override void OnRightClick()
2079 {
2080 super.OnRightClick();
2081
2082 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
2083 {
2084 if (GetGame().IsClient())
2085 {
2087 {
2088 vector m4[4];
2089 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
2090
2091 EntityAI root = GetHierarchyRoot();
2092
2094 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
2095 {
2096 if (root)
2097 {
2098 root.GetTransform(m4);
2099 dst.SetGround(this, m4);
2100 }
2101 else
2102 GetInventory().GetCurrentInventoryLocation(dst);
2103 }
2104 else
2105 {
2106 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
2107 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
2108 this shouldnt cause issues within this scope*/
2109 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
2110 {
2111 if (root)
2112 {
2113 root.GetTransform(m4);
2114 dst.SetGround(this, m4);
2115 }
2116 else
2117 GetInventory().GetCurrentInventoryLocation(dst);
2118 }
2119 else
2120 {
2121 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
2122 }
2123 }
2124
2127 ctx.Write(4);
2128 ItemBase thiz = this; // @NOTE: workaround for correct serialization
2129 ctx.Write(thiz);
2130 dst.WriteToContext(ctx);
2131 ctx.Write(true); // dummy
2132 ctx.Send();
2133 }
2134 }
2135 else if (!GetGame().IsMultiplayer())
2136 {
2138 }
2139 }
2140 }
2141
2142 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
2143 {
2144 //TODO: delete check zero quantity check after fix double posts hands fsm events
2145 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
2146 return false;
2147
2148 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
2149 return false;
2150
2151 //can_this_be_combined = ConfigGetBool("canBeSplit");
2153 return false;
2154
2155
2156 Magazine mag = Magazine.Cast(this);
2157 if (mag)
2158 {
2159 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
2160 return false;
2161
2162 if (stack_max_limit)
2163 {
2164 Magazine other_mag = Magazine.Cast(other_item);
2165 if (other_item)
2166 {
2167 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
2168 return false;
2169 }
2170
2171 }
2172 }
2173 else
2174 {
2175 //TODO: delete check zero quantity check after fix double posts hands fsm events
2176 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
2177 return false;
2178
2179 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
2180 return false;
2181 }
2182
2183 PlayerBase player = null;
2184 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
2185 {
2186 if (player.GetInventory().HasAttachment(this))
2187 return false;
2188
2189 if (player.IsItemsToDelete())
2190 return false;
2191 }
2192
2193 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
2194 return false;
2195
2196 int slotID;
2197 string slotName;
2198 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
2199 return false;
2200
2201 return true;
2202 }
2203
2204 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
2205 {
2206 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
2207 }
2208
2210 {
2211 return m_IsResultOfSplit;
2212 }
2213
2214 void SetResultOfSplit(bool value)
2215 {
2216 m_IsResultOfSplit = value;
2217 }
2218
2219 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
2220 {
2221 return ComputeQuantityUsedEx(other_item, use_stack_max);
2222 }
2223
2224 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
2225 {
2226 float other_item_quantity = other_item.GetQuantity();
2227 float this_free_space;
2228
2229 float stack_max = GetQuantityMax();
2230
2231 this_free_space = stack_max - GetQuantity();
2232
2233 if (other_item_quantity > this_free_space)
2234 {
2235 return this_free_space;
2236 }
2237 else
2238 {
2239 return other_item_quantity;
2240 }
2241 }
2242
2243 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
2244 {
2245 CombineItems(ItemBase.Cast(entity2),use_stack_max);
2246 }
2247
2248 void CombineItems(ItemBase other_item, bool use_stack_max = true)
2249 {
2250 if (!CanBeCombined(other_item, false))
2251 return;
2252
2253 if (!IsMagazine() && other_item)
2254 {
2255 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
2256 if (quantity_used != 0)
2257 {
2258 float hp1 = GetHealth01("","");
2259 float hp2 = other_item.GetHealth01("","");
2260 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
2261 hpResult = hpResult / (GetQuantity() + quantity_used);
2262
2263 hpResult *= GetMaxHealth();
2264 Math.Round(hpResult);
2265 SetHealth("", "Health", hpResult);
2266
2267 AddQuantity(quantity_used);
2268 other_item.AddQuantity(-quantity_used);
2269 }
2270 }
2271 OnCombine(other_item);
2272 }
2273
2274 void OnCombine(ItemBase other_item)
2275 {
2276 #ifdef SERVER
2277 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
2278 GetHierarchyParent().IncreaseLifetimeUp();
2279 #endif
2280 };
2281
2282 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
2283 {
2284 PlayerBase p = PlayerBase.Cast(player);
2285
2286 array<int> recipesIds = p.m_Recipes;
2287 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
2288 if (moduleRecipesManager)
2289 {
2290 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
2291 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
2292 }
2293
2294 for (int i = 0;i < recipesIds.Count(); i++)
2295 {
2296 int key = recipesIds.Get(i);
2297 string recipeName = moduleRecipesManager.GetRecipeName(key);
2298 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
2299 }
2300 }
2301
2302 // -------------------------------------------------------------------------
2303 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2304 {
2305 super.GetDebugActions(outputList);
2306
2307 //quantity
2308 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
2309 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
2310 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
2311 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
2312
2313 //health
2314 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
2315 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
2316 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
2317 //temperature
2318 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
2319 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
2320 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
2321
2322 //wet
2323 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
2324 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
2325
2326 //liquidtype
2327 if (IsLiquidContainer())
2328 {
2329 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
2330 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
2331 }
2332
2333 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
2334 // watch
2335 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
2336 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
2337
2338 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
2339 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
2340 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
2341 }
2342
2343 // -------------------------------------------------------------------------
2344 // -------------------------------------------------------------------------
2345 // -------------------------------------------------------------------------
2346 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
2347 {
2348 super.OnAction(action_id, player, ctx);
2349 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
2350 {
2351 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
2352 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
2353 PlayerBase p = PlayerBase.Cast(player);
2354 if (EActions.RECIPES_RANGE_START < 1000)
2355 {
2356 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2357 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2358 }
2359 }
2360 #ifndef SERVER
2361 else if (action_id == EActions.WATCH_PLAYER)
2362 {
2363 PluginDeveloper.SetDeveloperItemClientEx(player);
2364 }
2365 #endif
2366 if (GetGame().IsServer())
2367 {
2368 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2369 {
2370 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2371 OnDebugButtonPressServer(id + 1);
2372 }
2373
2374 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2375 {
2376 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2377 InsertAgent(agent_id,100);
2378 }
2379
2380 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2381 {
2382 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2383 RemoveAgent(agent_id2);
2384 }
2385
2386 else if (action_id == EActions.ADD_QUANTITY)
2387 {
2388 if (IsMagazine())
2389 {
2390 Magazine mag = Magazine.Cast(this);
2391 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2392 }
2393 else
2394 {
2395 AddQuantity(GetQuantityMax() * 0.2);
2396 }
2397
2398 if (m_EM)
2399 {
2400 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2401 }
2402 //PrintVariables();
2403 }
2404
2405 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
2406 {
2407 if (IsMagazine())
2408 {
2409 Magazine mag2 = Magazine.Cast(this);
2410 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2411 }
2412 else
2413 {
2414 AddQuantity(- GetQuantityMax() * 0.2);
2415 }
2416 if (m_EM)
2417 {
2418 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2419 }
2420 //PrintVariables();
2421 }
2422
2423 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
2424 {
2425 SetQuantity(0);
2426
2427 if (m_EM)
2428 {
2429 m_EM.SetEnergy(0);
2430 }
2431 }
2432
2433 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
2434 {
2436
2437 if (m_EM)
2438 {
2439 m_EM.SetEnergy(m_EM.GetEnergyMax());
2440 }
2441 }
2442
2443 else if (action_id == EActions.ADD_HEALTH)
2444 {
2445 AddHealth("","",GetMaxHealth("","Health")/5);
2446 }
2447 else if (action_id == EActions.REMOVE_HEALTH)
2448 {
2449 AddHealth("","",-GetMaxHealth("","Health")/5);
2450 }
2451 else if (action_id == EActions.DESTROY_HEALTH)
2452 {
2453 SetHealth01("","",0);
2454 }
2455 else if (action_id == EActions.WATCH_ITEM)
2456 {
2458 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
2459 #ifdef DEVELOPER
2460 SetDebugDeveloper_item(this);
2461 #endif
2462 }
2463
2464 else if (action_id == EActions.ADD_TEMPERATURE)
2465 {
2466 AddTemperature(20);
2467 //PrintVariables();
2468 }
2469
2470 else if (action_id == EActions.REMOVE_TEMPERATURE)
2471 {
2472 AddTemperature(-20);
2473 //PrintVariables();
2474 }
2475
2476 else if (action_id == EActions.FLIP_FROZEN)
2477 {
2478 SetFrozen(!GetIsFrozen());
2479 //PrintVariables();
2480 }
2481
2482 else if (action_id == EActions.ADD_WETNESS)
2483 {
2484 AddWet(GetWetMax()/5);
2485 //PrintVariables();
2486 }
2487
2488 else if (action_id == EActions.REMOVE_WETNESS)
2489 {
2490 AddWet(-GetWetMax()/5);
2491 //PrintVariables();
2492 }
2493
2494 else if (action_id == EActions.LIQUIDTYPE_UP)
2495 {
2496 int curr_type = GetLiquidType();
2497 SetLiquidType(curr_type * 2);
2498 //AddWet(1);
2499 //PrintVariables();
2500 }
2501
2502 else if (action_id == EActions.LIQUIDTYPE_DOWN)
2503 {
2504 int curr_type2 = GetLiquidType();
2505 SetLiquidType(curr_type2 / 2);
2506 }
2507
2508 else if (action_id == EActions.MAKE_SPECIAL)
2509 {
2510 auto debugParams = DebugSpawnParams.WithPlayer(player);
2511 OnDebugSpawnEx(debugParams);
2512 }
2513
2514 else if (action_id == EActions.DELETE)
2515 {
2516 Delete();
2517 }
2518
2519 }
2520
2521
2522 return false;
2523 }
2524
2525 // -------------------------------------------------------------------------
2526
2527
2531
2533 void OnActivatedByItem(notnull ItemBase item);
2534
2535 //----------------------------------------------------------------
2536 //returns true if item is able to explode when put in fire
2538 {
2539 return false;
2540 }
2541
2542 //----------------------------------------------------------------
2543 bool CanEat()
2544 {
2545 return true;
2546 }
2547
2548 //----------------------------------------------------------------
2550 {
2551 return true;
2552 }
2553
2554 //----------------------------------------------------------------
2555 //has FoodStages in config?
2557 {
2558 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
2559 return GetGame().ConfigIsExisting(config_path);
2560 }
2561
2563 FoodStage GetFoodStage()
2564 {
2565 return null;
2566 }
2567
2569 {
2570 return false;
2571 }
2572
2574 {
2575 return false;
2576 }
2577
2579 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
2581
2582 //----------------------------------------------------------------
2583 bool CanRepair(ItemBase item_repair_kit)
2584 {
2585 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
2586 return module_repairing.CanRepair(this, item_repair_kit);
2587 }
2588
2589 //----------------------------------------------------------------
2590 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
2591 {
2592 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
2593 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
2594 }
2595
2596 //----------------------------------------------------------------
2598 {
2599 /*
2600 vector v_size = this.ConfigGetVector("itemSize");
2601 int v_size_x = v_size[0];
2602 int v_size_y = v_size[1];
2603 int size = v_size_x * v_size_y;
2604 return size;
2605 */
2606
2607 return 1;
2608 }
2609
2610 //----------------------------------------------------------------
2611 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
2613 {
2614 return m_CanBeMovedOverride;
2615 }
2616
2617 //----------------------------------------------------------------
2618 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
2619 void SetCanBeMovedOverride(bool setting)
2620 {
2621 m_CanBeMovedOverride = setting;
2622 }
2623
2624 //----------------------------------------------------------------
2632 void MessageToOwnerStatus(string text)
2633 {
2634 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
2635
2636 if (player)
2637 {
2638 player.MessageStatus(text);
2639 }
2640 }
2641
2642 //----------------------------------------------------------------
2650 void MessageToOwnerAction(string text)
2651 {
2652 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
2653
2654 if (player)
2655 {
2656 player.MessageAction(text);
2657 }
2658 }
2659
2660 //----------------------------------------------------------------
2668 void MessageToOwnerFriendly(string text)
2669 {
2670 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
2671
2672 if (player)
2673 {
2674 player.MessageFriendly(text);
2675 }
2676 }
2677
2678 //----------------------------------------------------------------
2686 void MessageToOwnerImportant(string text)
2687 {
2688 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
2689
2690 if (player)
2691 {
2692 player.MessageImportant(text);
2693 }
2694 }
2695
2696 override bool IsItemBase()
2697 {
2698 return true;
2699 }
2700
2701 // Checks if item is of questioned kind
2702 override bool KindOf(string tag)
2703 {
2704 bool found = false;
2705 string item_name = this.GetType();
2706 ref TStringArray item_tag_array = new TStringArray;
2707 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
2708
2709 int array_size = item_tag_array.Count();
2710 for (int i = 0; i < array_size; i++)
2711 {
2712 if (item_tag_array.Get(i) == tag)
2713 {
2714 found = true;
2715 break;
2716 }
2717 }
2718 return found;
2719 }
2720
2721
2722 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
2723 {
2724 //Debug.Log("OnRPC called");
2725 super.OnRPC(sender, rpc_type,ctx);
2726
2727 //Play soundset for attachment locking (ActionLockAttachment.c)
2728 switch (rpc_type)
2729 {
2730 #ifndef SERVER
2731 case ERPCs.RPC_SOUND_LOCK_ATTACH:
2732 Param2<bool, string> p = new Param2<bool, string>(false, "");
2733
2734 if (!ctx.Read(p))
2735 return;
2736
2737 bool play = p.param1;
2738 string soundSet = p.param2;
2739
2740 if (play)
2741 {
2742 if (m_LockingSound)
2743 {
2744 if (!m_LockingSound.IsSoundPlaying())
2745 {
2746 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
2747 }
2748 }
2749 else
2750 {
2751 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
2752 }
2753 }
2754 else
2755 {
2757 }
2758
2759 break;
2760 #endif
2761
2762 }
2763
2764 if (GetWrittenNoteData())
2765 {
2766 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
2767 }
2768 }
2769
2770 //-----------------------------
2771 // VARIABLE MANIPULATION SYSTEM
2772 //-----------------------------
2773 int NameToID(string name)
2774 {
2775 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
2776 return plugin.GetID(name);
2777 }
2778
2779 string IDToName(int id)
2780 {
2781 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
2782 return plugin.GetName(id);
2783 }
2784
2786 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
2787 {
2788 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
2789 //read the flags
2790 int varFlags;
2791 if (!ctx.Read(varFlags))
2792 return;
2793
2794 if (varFlags & ItemVariableFlags.FLOAT)
2795 {
2796 ReadVarsFromCTX(ctx);
2797 }
2798 }
2799
2800 override void SerializeNumericalVars(array<float> floats_out)
2801 {
2802 //some variables handled on EntityAI level already!
2803 super.SerializeNumericalVars(floats_out);
2804
2805 // the order of serialization must be the same as the order of de-serialization
2806 //--------------------------------------------
2807 if (IsVariableSet(VARIABLE_QUANTITY))
2808 {
2809 floats_out.Insert(m_VarQuantity);
2810 }
2811 //--------------------------------------------
2812 if (IsVariableSet(VARIABLE_WET))
2813 {
2814 floats_out.Insert(m_VarWet);
2815 }
2816 //--------------------------------------------
2817 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
2818 {
2819 floats_out.Insert(m_VarLiquidType);
2820 }
2821 //--------------------------------------------
2822 if (IsVariableSet(VARIABLE_COLOR))
2823 {
2824 floats_out.Insert(m_ColorComponentR);
2825 floats_out.Insert(m_ColorComponentG);
2826 floats_out.Insert(m_ColorComponentB);
2827 floats_out.Insert(m_ColorComponentA);
2828 }
2829 //--------------------------------------------
2830 if (IsVariableSet(VARIABLE_CLEANNESS))
2831 {
2832 floats_out.Insert(m_Cleanness);
2833 }
2834 }
2835
2837 {
2838 //some variables handled on EntityAI level already!
2839 super.DeSerializeNumericalVars(floats);
2840
2841 // the order of serialization must be the same as the order of de-serialization
2842 int index = 0;
2843 int mask = Math.Round(floats.Get(index));
2844
2845 index++;
2846 //--------------------------------------------
2847 if (mask & VARIABLE_QUANTITY)
2848 {
2849 if (m_IsStoreLoad)
2850 {
2851 SetStoreLoadedQuantity(floats.Get(index));
2852 }
2853 else
2854 {
2855 float quantity = floats.Get(index);
2856 SetQuantity(quantity, true, false, false, false);
2857 }
2858 index++;
2859 }
2860 //--------------------------------------------
2861 if (mask & VARIABLE_WET)
2862 {
2863 float wet = floats.Get(index);
2864 SetWet(wet);
2865 index++;
2866 }
2867 //--------------------------------------------
2868 if (mask & VARIABLE_LIQUIDTYPE)
2869 {
2870 int liquidtype = Math.Round(floats.Get(index));
2871 SetLiquidType(liquidtype);
2872 index++;
2873 }
2874 //--------------------------------------------
2875 if (mask & VARIABLE_COLOR)
2876 {
2877 m_ColorComponentR = Math.Round(floats.Get(index));
2878 index++;
2879 m_ColorComponentG = Math.Round(floats.Get(index));
2880 index++;
2881 m_ColorComponentB = Math.Round(floats.Get(index));
2882 index++;
2883 m_ColorComponentA = Math.Round(floats.Get(index));
2884 index++;
2885 }
2886 //--------------------------------------------
2887 if (mask & VARIABLE_CLEANNESS)
2888 {
2889 int cleanness = Math.Round(floats.Get(index));
2890 SetCleanness(cleanness);
2891 index++;
2892 }
2893 }
2894
2896 {
2897 super.WriteVarsToCTX(ctx);
2898
2899 //--------------------------------------------
2900 if (IsVariableSet(VARIABLE_QUANTITY))
2901 {
2902 ctx.Write(GetQuantity());
2903 }
2904 //--------------------------------------------
2905 if (IsVariableSet(VARIABLE_WET))
2906 {
2907 ctx.Write(GetWet());
2908 }
2909 //--------------------------------------------
2910 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
2911 {
2912 ctx.Write(GetLiquidType());
2913 }
2914 //--------------------------------------------
2915 if (IsVariableSet(VARIABLE_COLOR))
2916 {
2917 int r,g,b,a;
2918 GetColor(r,g,b,a);
2919 ctx.Write(r);
2920 ctx.Write(g);
2921 ctx.Write(b);
2922 ctx.Write(a);
2923 }
2924 //--------------------------------------------
2925 if (IsVariableSet(VARIABLE_CLEANNESS))
2926 {
2927 ctx.Write(GetCleanness());
2928 }
2929 }
2930
2931 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
2932 {
2933 if (!super.ReadVarsFromCTX(ctx,version))
2934 return false;
2935
2936 int intValue;
2937 float value;
2938
2939 if (version < 140)
2940 {
2941 if (!ctx.Read(intValue))
2942 return false;
2943
2944 m_VariablesMask = intValue;
2945 }
2946
2947 if (m_VariablesMask & VARIABLE_QUANTITY)
2948 {
2949 if (!ctx.Read(value))
2950 return false;
2951
2952 if (IsStoreLoad())
2953 {
2955 }
2956 else
2957 {
2958 SetQuantity(value, true, false, false, false);
2959 }
2960 }
2961 //--------------------------------------------
2962 if (version < 140)
2963 {
2964 if (m_VariablesMask & VARIABLE_TEMPERATURE)
2965 {
2966 if (!ctx.Read(value))
2967 return false;
2968 SetTemperatureDirect(value);
2969 }
2970 }
2971 //--------------------------------------------
2972 if (m_VariablesMask & VARIABLE_WET)
2973 {
2974 if (!ctx.Read(value))
2975 return false;
2976 SetWet(value);
2977 }
2978 //--------------------------------------------
2979 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
2980 {
2981 if (!ctx.Read(intValue))
2982 return false;
2983 SetLiquidType(intValue);
2984 }
2985 //--------------------------------------------
2986 if (m_VariablesMask & VARIABLE_COLOR)
2987 {
2988 int r,g,b,a;
2989 if (!ctx.Read(r))
2990 return false;
2991 if (!ctx.Read(g))
2992 return false;
2993 if (!ctx.Read(b))
2994 return false;
2995 if (!ctx.Read(a))
2996 return false;
2997
2998 SetColor(r,g,b,a);
2999 }
3000 //--------------------------------------------
3001 if (m_VariablesMask & VARIABLE_CLEANNESS)
3002 {
3003 if (!ctx.Read(intValue))
3004 return false;
3005 SetCleanness(intValue);
3006 }
3007 //--------------------------------------------
3008 if (version >= 138 && version < 140)
3009 {
3010 if (m_VariablesMask & VARIABLE_TEMPERATURE)
3011 {
3012 if (!ctx.Read(intValue))
3013 return false;
3014 SetFrozen(intValue);
3015 }
3016 }
3017
3018 return true;
3019 }
3020
3021 //----------------------------------------------------------------
3022 override bool OnStoreLoad(ParamsReadContext ctx, int version)
3023 {
3024 m_IsStoreLoad = true;
3026 {
3027 m_FixDamageSystemInit = true;
3028 }
3029
3030 if (!super.OnStoreLoad(ctx, version))
3031 {
3032 m_IsStoreLoad = false;
3033 return false;
3034 }
3035
3036 if (version >= 114)
3037 {
3038 bool hasQuickBarIndexSaved;
3039
3040 if (!ctx.Read(hasQuickBarIndexSaved))
3041 {
3042 m_IsStoreLoad = false;
3043 return false;
3044 }
3045
3046 if (hasQuickBarIndexSaved)
3047 {
3048 int itmQBIndex;
3049
3050 //Load quickbar item bind
3051 if (!ctx.Read(itmQBIndex))
3052 {
3053 m_IsStoreLoad = false;
3054 return false;
3055 }
3056
3057 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
3058 if (itmQBIndex != -1 && parentPlayer)
3059 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
3060 }
3061 }
3062 else
3063 {
3064 // Backup of how it used to be
3065 PlayerBase player;
3066 int itemQBIndex;
3067 if (version == int.MAX)
3068 {
3069 if (!ctx.Read(itemQBIndex))
3070 {
3071 m_IsStoreLoad = false;
3072 return false;
3073 }
3074 }
3075 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
3076 {
3077 //Load quickbar item bind
3078 if (!ctx.Read(itemQBIndex))
3079 {
3080 m_IsStoreLoad = false;
3081 return false;
3082 }
3083 if (itemQBIndex != -1 && player)
3084 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
3085 }
3086 }
3087
3088 if (version < 140)
3089 {
3090 // variable management system
3091 if (!LoadVariables(ctx, version))
3092 {
3093 m_IsStoreLoad = false;
3094 return false;
3095 }
3096 }
3097
3098 //agent trasmission system
3099 if (!LoadAgents(ctx, version))
3100 {
3101 m_IsStoreLoad = false;
3102 return false;
3103 }
3104 if (version >= 132)
3105 {
3107 if (raib)
3108 {
3109 if (!raib.OnStoreLoad(ctx,version))
3110 {
3111 m_IsStoreLoad = false;
3112 return false;
3113 }
3114 }
3115 }
3116
3117 m_IsStoreLoad = false;
3118 return true;
3119 }
3120
3121 //----------------------------------------------------------------
3122
3124 {
3125 super.OnStoreSave(ctx);
3126
3127 PlayerBase player;
3128 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
3129 {
3130 ctx.Write(true); // Keep track of if we should actually read this in or not
3131 //Save quickbar item bind
3132 int itemQBIndex = -1;
3133 itemQBIndex = player.FindQuickBarEntityIndex(this);
3134 ctx.Write(itemQBIndex);
3135 }
3136 else
3137 {
3138 ctx.Write(false); // Keep track of if we should actually read this in or not
3139 }
3140
3141 SaveAgents(ctx);//agent trasmission system
3142
3144 if (raib)
3145 {
3146 raib.OnStoreSave(ctx);
3147 }
3148 }
3149 //----------------------------------------------------------------
3150
3151 override void AfterStoreLoad()
3152 {
3153 super.AfterStoreLoad();
3154
3156 {
3158 }
3159
3160 if (GetStoreLoadedQuantity() != float.LOWEST)
3161 {
3163 SetStoreLoadedQuantity(float.LOWEST);//IMPORTANT to do this !! we use 'm_StoreLoadedQuantity' inside SetQuantity to distinguish between initial quantity setting and the consequent(normal gameplay) calls
3164 }
3165 }
3166
3167 override void EEOnAfterLoad()
3168 {
3169 super.EEOnAfterLoad();
3170
3172 {
3173 m_FixDamageSystemInit = false;
3174 }
3175
3178 }
3179
3181 {
3182 return false;
3183 }
3184
3185
3186 //----------------------------------------------------------------
3188 {
3189 if (m_Initialized)
3190 {
3191 #ifdef PLATFORM_CONSOLE
3192 //bruteforce it is
3193 if (IsSplitable())
3194 {
3196 if (menu)
3197 {
3198 menu.Refresh();
3199 }
3200 }
3201 #endif
3202 }
3203
3205 {
3206 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
3207 m_WantPlayImpactSound = false;
3208 }
3209
3211 {
3212 SetWeightDirty();
3214 }
3215 if (m_VarWet != m_VarWetPrev)
3216 {
3219 }
3220
3221 if (m_SoundSyncPlay != 0)
3222 {
3223 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
3224 m_SoundSyncPlay = 0;
3225 }
3226 if (m_SoundSyncStop != 0)
3227 {
3228 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
3229 m_SoundSyncStop = 0;
3230 }
3231
3232 super.OnVariablesSynchronized();
3233 }
3234
3235 //------------------------- Quantity
3236 //----------------------------------------------------------------
3238 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
3239 {
3240 if (!IsServerCheck(allow_client))
3241 return false;
3242
3243 if (!HasQuantity())
3244 return false;
3245
3246 float min = GetQuantityMin();
3247 float max = GetQuantityMax();
3248
3249 if (value <= (min + 0.001))
3250 value = min;
3251
3252 if (value == min)
3253 {
3254 if (destroy_config)
3255 {
3256 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
3257 if (dstr)
3258 {
3259 m_VarQuantity = Math.Clamp(value, min, max);
3260 this.Delete();
3261 return true;
3262 }
3263 }
3264 else if (destroy_forced)
3265 {
3266 m_VarQuantity = Math.Clamp(value, min, max);
3267 this.Delete();
3268 return true;
3269 }
3270 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
3271 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
3272 }
3273
3274 float delta = m_VarQuantity;
3275 m_VarQuantity = Math.Clamp(value, min, max);
3276
3277 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
3278 {
3279 delta = m_VarQuantity - delta;
3280
3281 if (delta)
3282 OnQuantityChanged(delta);
3283 }
3284
3285 SetVariableMask(VARIABLE_QUANTITY);
3286
3287 return false;
3288 }
3289
3290 //----------------------------------------------------------------
3292 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
3293 {
3294 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
3295 }
3296 //----------------------------------------------------------------
3298 {
3299 float max = GetQuantityMax();
3300 SetQuantity(max);
3301 }
3302
3303 override void SetQuantityToMinimum()
3304 {
3305 float min = GetQuantityMin();
3306 SetQuantity(min);
3307 }
3308 //----------------------------------------------------------------
3310 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
3311 {
3312 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
3313 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
3314 SetQuantity(result, destroy_config, destroy_forced);
3315 }
3316
3317 //----------------------------------------------------------------
3319 override float GetQuantityNormalized()
3320 {
3322 }
3323
3325 {
3326 return GetQuantityNormalized();
3327 }
3328
3329 /*void SetAmmoNormalized(float value)
3330 {
3331 float value_clamped = Math.Clamp(value, 0, 1);
3332 Magazine this_mag = Magazine.Cast(this);
3333 int max_rounds = this_mag.GetAmmoMax();
3334 int result = value * max_rounds;//can the rounded if higher precision is required
3335 this_mag.SetAmmoCount(result);
3336 }*/
3337 //----------------------------------------------------------------
3338 override int GetQuantityMax()
3339 {
3340 int slot = -1;
3341 if (GetInventory())
3342 {
3344 GetInventory().GetCurrentInventoryLocation(il);
3345 slot = il.GetSlot();
3346 }
3347
3348 return GetTargetQuantityMax(slot);
3349 }
3350
3351 override int GetTargetQuantityMax(int attSlotID = -1)
3352 {
3353 float quantity_max = 0;
3354
3355 if (IsSplitable()) //only stackable/splitable items can check for stack size
3356 {
3357 if (attSlotID != -1)
3358 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
3359
3360 if (quantity_max <= 0)
3361 quantity_max = m_VarStackMax;
3362 }
3363
3364 if (quantity_max <= 0)
3365 quantity_max = m_VarQuantityMax;
3366
3367 return quantity_max;
3368 }
3369 //----------------------------------------------------------------
3370 override int GetQuantityMin()
3371 {
3372 return m_VarQuantityMin;
3373 }
3374 //----------------------------------------------------------------
3376 {
3377 return m_VarQuantityInit;
3378 }
3379
3380 //----------------------------------------------------------------
3381 override bool HasQuantity()
3382 {
3383 return !(GetQuantityMax() - GetQuantityMin() == 0);
3384 }
3385
3386 override float GetQuantity()
3387 {
3388 return m_VarQuantity;
3389 }
3390
3392 {
3393 return GetQuantity() >= GetQuantityMax();
3394 }
3395
3396 //Calculates weight of single item without attachments and cargo
3398 {
3399 //this needs to be first stored inside local variables, when returned directly during inside return call, the result is completely different due to enforce script bug
3400 float weightEx = GetWeightEx();//overall weight of the item
3401 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
3402 return weightEx - special;
3403 }
3404
3405 // Obsolete, use GetSingleInventoryItemWeightEx() instead
3410
3411 override protected float GetWeightSpecialized(bool forceRecalc = false)
3412 {
3413 if (IsSplitable()) //quantity determines size of the stack
3414 {
3415 #ifdef DEVELOPER
3416 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3417 {
3418 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
3419 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
3420 }
3421 #endif
3422
3423 return GetQuantity() * GetConfigWeightModified();
3424 }
3425 else if (HasEnergyManager())// items with energy manager
3426 {
3427 #ifdef DEVELOPER
3428 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3429 {
3430 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
3431 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
3432 }
3433 #endif
3434 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
3435 }
3436 else//everything else
3437 {
3438 #ifdef DEVELOPER
3439 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3440 {
3441 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
3442 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
3443 }
3444 #endif
3445 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
3446 }
3447 }
3448
3451 {
3452 int item_count = 0;
3453 ItemBase item;
3454
3455 if (GetInventory().GetCargo() != NULL)
3456 {
3457 item_count = GetInventory().GetCargo().GetItemCount();
3458 }
3459
3460 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
3461 {
3462 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
3463 if (item)
3464 item_count += item.GetNumberOfItems();
3465 }
3466 return item_count;
3467 }
3468
3470 float GetUnitWeight(bool include_wetness = true)
3471 {
3472 float weight = 0;
3473 float wetness = 1;
3474 if (include_wetness)
3475 wetness += GetWet();
3476 if (IsSplitable()) //quantity determines size of the stack
3477 {
3478 weight = wetness * m_ConfigWeight;
3479 }
3480 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
3481 {
3482 weight = 1;
3483 }
3484 return weight;
3485 }
3486
3487 //-----------------------------------------------------------------
3488
3489 override void ClearInventory()
3490 {
3491 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
3492 {
3493 GameInventory inv = GetInventory();
3494 array<EntityAI> items = new array<EntityAI>;
3495 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
3496 for (int i = 0; i < items.Count(); i++)
3497 {
3498 ItemBase item = ItemBase.Cast(items.Get(i));
3499 if (item)
3500 {
3501 GetGame().ObjectDelete(item);
3502 }
3503 }
3504 }
3505 }
3506
3507 //------------------------- Energy
3508
3509 //----------------------------------------------------------------
3511 {
3512 float energy = 0;
3513 if (HasEnergyManager())
3514 {
3515 energy = GetCompEM().GetEnergy();
3516 }
3517 return energy;
3518 }
3519
3520
3521 override void OnEnergyConsumed()
3522 {
3523 super.OnEnergyConsumed();
3524
3526 }
3527
3528 override void OnEnergyAdded()
3529 {
3530 super.OnEnergyAdded();
3531
3533 }
3534
3535 // Converts energy (from Energy Manager) to quantity, if enabled.
3537 {
3538 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
3539 {
3540 if (HasQuantity())
3541 {
3542 float energy_0to1 = GetCompEM().GetEnergy0To1();
3543 SetQuantityNormalized(energy_0to1);
3544 }
3545 }
3546 }
3547
3548 //----------------------------------------------------------------
3550 {
3551 return ConfigGetFloat("heatIsolation");
3552 }
3553
3555 {
3556 return m_HeatIsolation;
3557 }
3558
3559 float GetDryingIncrement(string pIncrementName)
3560 {
3561 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
3562 if (GetGame().ConfigIsExisting(paramPath))
3563 return GetGame().ConfigGetFloat(paramPath);
3564
3565 return 0.0;
3566 }
3567
3568 float GetSoakingIncrement(string pIncrementName)
3569 {
3570 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
3571 if (GetGame().ConfigIsExisting(paramPath))
3572 return GetGame().ConfigGetFloat(paramPath);
3573
3574 return 0.0;
3575 }
3576 //----------------------------------------------------------------
3577 override void SetWet(float value, bool allow_client = false)
3578 {
3579 if (!IsServerCheck(allow_client))
3580 return;
3581
3582 float min = GetWetMin();
3583 float max = GetWetMax();
3584
3585 float previousValue = m_VarWet;
3586
3587 m_VarWet = Math.Clamp(value, min, max);
3588
3589 if (previousValue != m_VarWet)
3590 {
3591 SetVariableMask(VARIABLE_WET);
3592 OnWetChanged(m_VarWet, previousValue);
3593 }
3594 }
3595 //----------------------------------------------------------------
3596 override void AddWet(float value)
3597 {
3598 SetWet(GetWet() + value);
3599 }
3600 //----------------------------------------------------------------
3601 override void SetWetMax()
3602 {
3604 }
3605 //----------------------------------------------------------------
3606 override float GetWet()
3607 {
3608 return m_VarWet;
3609 }
3610 //----------------------------------------------------------------
3611 override float GetWetMax()
3612 {
3613 return m_VarWetMax;
3614 }
3615 //----------------------------------------------------------------
3616 override float GetWetMin()
3617 {
3618 return m_VarWetMin;
3619 }
3620 //----------------------------------------------------------------
3621 override float GetWetInit()
3622 {
3623 return m_VarWetInit;
3624 }
3625 //----------------------------------------------------------------
3626 override void OnWetChanged(float newVal, float oldVal)
3627 {
3628 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
3629 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
3630 if (newLevel != oldLevel)
3631 {
3632 OnWetLevelChanged(newLevel,oldLevel);
3633 }
3634 }
3635
3636 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
3637 {
3638 SetWeightDirty();
3639 }
3640
3642 {
3643 return GetWetLevelInternal(m_VarWet);
3644 }
3645
3646 //----------------------------------------------------------------
3647
3648 override void SetStoreLoad(bool value)
3649 {
3650 m_IsStoreLoad = value;
3651 }
3652
3653 override bool IsStoreLoad()
3654 {
3655 return m_IsStoreLoad;
3656 }
3657
3658 override void SetStoreLoadedQuantity(float value)
3659 {
3660 m_StoreLoadedQuantity = value;
3661 }
3662
3663 override float GetStoreLoadedQuantity()
3664 {
3665 return m_StoreLoadedQuantity;
3666 }
3667
3668 //----------------------------------------------------------------
3669
3671 {
3672 if (ConfigIsExisting("itemModelLength"))
3673 {
3674 return ConfigGetFloat("itemModelLength");
3675 }
3676 return 0;
3677 }
3678
3680 {
3681 if (ConfigIsExisting("itemAttachOffset"))
3682 {
3683 return ConfigGetFloat("itemAttachOffset");
3684 }
3685 return 0;
3686 }
3687
3688 override void SetCleanness(int value, bool allow_client = false)
3689 {
3690 if (!IsServerCheck(allow_client))
3691 return;
3692
3693 int previousValue = m_Cleanness;
3694
3696
3697 if (previousValue != m_Cleanness)
3698 SetVariableMask(VARIABLE_CLEANNESS);
3699 }
3700
3701 override int GetCleanness()
3702 {
3703 return m_Cleanness;
3704 }
3705
3707 {
3708 return true;
3709 }
3710
3711 //----------------------------------------------------------------
3712 // ATTACHMENT LOCKING
3713 // Getters relevant to generic ActionLockAttachment
3715 {
3716 return m_LockType;
3717 }
3718
3720 {
3721 return m_LockSoundSet;
3722 }
3723
3724 //----------------------------------------------------------------
3725 //------------------------- Color
3726 // sets items color variable given color components
3727 override void SetColor(int r, int g, int b, int a)
3728 {
3733 SetVariableMask(VARIABLE_COLOR);
3734 }
3735
3736 override void GetColor(out int r,out int g,out int b,out int a)
3737 {
3742 }
3743
3745 {
3746 return IsVariableSet(VARIABLE_COLOR);
3747 }
3748
3751 {
3752 int r,g,b,a;
3753 GetColor(r,g,b,a);
3754 r = r/255;
3755 g = g/255;
3756 b = b/255;
3757 a = a/255;
3758 return MiscGameplayFunctions.GetColorString(r, g, b, a);
3759 }
3760 //----------------------------------------------------------------
3761 //------------------------- LiquidType
3762
3763 override void SetLiquidType(int value, bool allow_client = false)
3764 {
3765 if (!IsServerCheck(allow_client))
3766 return;
3767
3768 int old = m_VarLiquidType;
3769 m_VarLiquidType = value;
3770 OnLiquidTypeChanged(old,value);
3771 SetVariableMask(VARIABLE_LIQUIDTYPE);
3772 }
3773
3775 {
3776 return ConfigGetInt("varLiquidTypeInit");
3777 }
3778
3779 override int GetLiquidType()
3780 {
3781 return m_VarLiquidType;
3782 }
3783
3784 protected void OnLiquidTypeChanged(int oldType, int newType)
3785 {
3786 if (newType == LIQUID_NONE && GetIsFrozen())
3787 SetFrozen(false);
3788 }
3789
3792 {
3793 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
3794 }
3795
3796 // -------------------------------------------------------------------------
3798 void OnInventoryEnter(Man player)
3799 {
3800 PlayerBase nplayer;
3801 if (PlayerBase.CastTo(nplayer, player))
3802 {
3803 m_CanPlayImpactSound = true;
3804 //nplayer.OnItemInventoryEnter(this);
3805 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
3806 }
3807 }
3808
3809 // -------------------------------------------------------------------------
3811 void OnInventoryExit(Man player)
3812 {
3813 PlayerBase nplayer;
3814 if (PlayerBase.CastTo(nplayer,player))
3815 {
3816 //nplayer.OnItemInventoryExit(this);
3817 nplayer.SetEnableQuickBarEntityShortcut(this,false);
3818
3819 }
3820
3821 //if (!GetGame().IsDedicatedServer())
3822 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
3823
3824
3825 if (HasEnergyManager())
3826 {
3827 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
3828 }
3829 }
3830
3831 // ADVANCED PLACEMENT EVENTS
3832 override void OnPlacementStarted(Man player)
3833 {
3834 super.OnPlacementStarted(player);
3835
3836 SetTakeable(false);
3837 }
3838
3839 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
3840 {
3841 if (m_AdminLog)
3842 {
3843 m_AdminLog.OnPlacementComplete(player, this);
3844 }
3845
3846 super.OnPlacementComplete(player, position, orientation);
3847 }
3848
3849 //-----------------------------
3850 // AGENT SYSTEM
3851 //-----------------------------
3852 //--------------------------------------------------------------------------
3853 bool ContainsAgent(int agent_id)
3854 {
3855 if (agent_id & m_AttachedAgents)
3856 {
3857 return true;
3858 }
3859 else
3860 {
3861 return false;
3862 }
3863 }
3864
3865 //--------------------------------------------------------------------------
3866 override void RemoveAgent(int agent_id)
3867 {
3868 if (ContainsAgent(agent_id))
3869 {
3870 m_AttachedAgents = ~agent_id & m_AttachedAgents;
3871 }
3872 }
3873
3874 //--------------------------------------------------------------------------
3875 override void RemoveAllAgents()
3876 {
3877 m_AttachedAgents = 0;
3878 }
3879 //--------------------------------------------------------------------------
3880 override void RemoveAllAgentsExcept(int agent_to_keep)
3881 {
3882 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
3883 }
3884 // -------------------------------------------------------------------------
3885 override void InsertAgent(int agent, float count = 1)
3886 {
3887 if (count < 1)
3888 return;
3889 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
3891 }
3892
3894 void TransferAgents(int agents)
3895 {
3897 }
3898
3899 // -------------------------------------------------------------------------
3900 override int GetAgents()
3901 {
3902 return m_AttachedAgents;
3903 }
3904 //----------------------------------------------------------------------
3905
3906 /*int GetContaminationType()
3907 {
3908 int contamination_type;
3909
3910 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
3911 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
3912 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
3913 const int DIRTY_MASK = eAgents.WOUND_AGENT;
3914
3915 Edible_Base edible = Edible_Base.Cast(this);
3916 int agents = GetAgents();
3917 if (edible)
3918 {
3919 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
3920 if (profile)
3921 {
3922 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
3923 }
3924 }
3925 if (agents & CONTAMINATED_MASK)
3926 {
3927 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
3928 }
3929 if (agents & POISONED_MASK)
3930 {
3931 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
3932 }
3933 if (agents & NERVE_GAS_MASK)
3934 {
3935 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
3936 }
3937 if (agents & DIRTY_MASK)
3938 {
3939 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
3940 }
3941
3942 return agents;
3943 }*/
3944
3945 // -------------------------------------------------------------------------
3946 bool LoadAgents(ParamsReadContext ctx, int version)
3947 {
3948 if (!ctx.Read(m_AttachedAgents))
3949 return false;
3950 return true;
3951 }
3952 // -------------------------------------------------------------------------
3954 {
3955
3957 }
3958 // -------------------------------------------------------------------------
3959
3961 override void CheckForRoofLimited(float timeTresholdMS = 3000)
3962 {
3963 super.CheckForRoofLimited(timeTresholdMS);
3964
3965 float time = GetGame().GetTime();
3966 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
3967 {
3968 m_PreviousRoofTestTime = time;
3969 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
3970 }
3971 }
3972
3973 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
3974 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
3975 {
3976 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
3977 {
3978 return 0;
3979 }
3980
3981 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
3982 {
3983 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
3984 if (filter)
3985 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
3986 else
3987 return 0;//otherwise return 0 when no filter attached
3988 }
3989
3990 string subclassPath, entryName;
3991
3992 switch (type)
3993 {
3994 case DEF_BIOLOGICAL:
3995 entryName = "biological";
3996 break;
3997 case DEF_CHEMICAL:
3998 entryName = "chemical";
3999 break;
4000 default:
4001 entryName = "biological";
4002 break;
4003 }
4004
4005 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
4006
4007 return GetGame().ConfigGetFloat(subclassPath + entryName);
4008 }
4009
4010
4011
4013 override void EEOnCECreate()
4014 {
4015 if (!IsMagazine())
4017
4019 }
4020
4021
4022 //-------------------------
4023 // OPEN/CLOSE USER ACTIONS
4024 //-------------------------
4026 void Open();
4027 void Close();
4028 bool IsOpen()
4029 {
4030 return true;
4031 }
4032
4033 override bool CanDisplayCargo()
4034 {
4035 return IsOpen();
4036 }
4037
4038
4039 // ------------------------------------------------------------
4040 // CONDITIONS
4041 // ------------------------------------------------------------
4042 override bool CanPutInCargo(EntityAI parent)
4043 {
4044 if (parent)
4045 {
4046 if (parent.IsInherited(DayZInfected))
4047 return true;
4048
4049 if (!parent.IsRuined())
4050 return true;
4051 }
4052
4053 return true;
4054 }
4055
4056 override bool CanPutAsAttachment(EntityAI parent)
4057 {
4058 if (!super.CanPutAsAttachment(parent))
4059 {
4060 return false;
4061 }
4062
4063 if (!IsRuined() && !parent.IsRuined())
4064 {
4065 return true;
4066 }
4067
4068 return false;
4069 }
4070
4072 {
4073 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
4074 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
4075 // return false;
4076
4077 return super.CanReceiveItemIntoCargo(item);
4078 }
4079
4080 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
4081 {
4082 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
4083 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
4084 // return false;
4085
4086 GameInventory attachmentInv = attachment.GetInventory();
4087 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
4088 {
4089 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
4090 return false;
4091 }
4092
4094 attachment.GetInventory().GetCurrentInventoryLocation(loc);
4095 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
4096 return false;
4097
4098 return super.CanReceiveAttachment(attachment, slotId);
4099 }
4100
4101 override bool CanReleaseAttachment(EntityAI attachment)
4102 {
4103 if (!super.CanReleaseAttachment(attachment))
4104 return false;
4105
4106 return GetInventory().AreChildrenAccessible();
4107 }
4108
4109 /*override bool CanLoadAttachment(EntityAI attachment)
4110 {
4111 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
4112 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
4113 // return false;
4114
4115 GameInventory attachmentInv = attachment.GetInventory();
4116 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
4117 {
4118 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
4119 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
4120
4121 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
4122 return false;
4123 }
4124
4125 return super.CanLoadAttachment(attachment);
4126 }*/
4127
4128 // Plays muzzle flash particle effects
4129 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
4130 {
4131 int id = muzzle_owner.GetMuzzleID();
4133
4134 if (WPOF_array)
4135 {
4136 for (int i = 0; i < WPOF_array.Count(); i++)
4137 {
4138 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
4139
4140 if (WPOF)
4141 {
4142 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
4143 }
4144 }
4145 }
4146 }
4147
4148 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
4149 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
4150 {
4151 int id = muzzle_owner.GetMuzzleID();
4153
4154 if (WPOBE_array)
4155 {
4156 for (int i = 0; i < WPOBE_array.Count(); i++)
4157 {
4158 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
4159
4160 if (WPOBE)
4161 {
4162 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4163 }
4164 }
4165 }
4166 }
4167
4168 // Plays all weapon overheating particles
4169 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
4170 {
4171 int id = muzzle_owner.GetMuzzleID();
4172 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
4173
4174 if (WPOOH_array)
4175 {
4176 for (int i = 0; i < WPOOH_array.Count(); i++)
4177 {
4178 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4179
4180 if (WPOOH)
4181 {
4182 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4183 }
4184 }
4185 }
4186 }
4187
4188 // Updates all weapon overheating particles
4189 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
4190 {
4191 int id = muzzle_owner.GetMuzzleID();
4192 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
4193
4194 if (WPOOH_array)
4195 {
4196 for (int i = 0; i < WPOOH_array.Count(); i++)
4197 {
4198 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4199
4200 if (WPOOH)
4201 {
4202 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4203 }
4204 }
4205 }
4206 }
4207
4208 // Stops overheating particles
4209 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
4210 {
4211 int id = muzzle_owner.GetMuzzleID();
4212 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
4213
4214 if (WPOOH_array)
4215 {
4216 for (int i = 0; i < WPOOH_array.Count(); i++)
4217 {
4218 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4219
4220 if (WPOOH)
4221 {
4222 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4223 }
4224 }
4225 }
4226 }
4227
4228 //----------------------------------------------------------------
4229 //Item Behaviour - unified approach
4230 override bool IsHeavyBehaviour()
4231 {
4232 if (m_ItemBehaviour == 0)
4233 {
4234 return true;
4235 }
4236
4237 return false;
4238 }
4239
4240 override bool IsOneHandedBehaviour()
4241 {
4242 if (m_ItemBehaviour == 1)
4243 {
4244 return true;
4245 }
4246
4247 return false;
4248 }
4249
4250 override bool IsTwoHandedBehaviour()
4251 {
4252 if (m_ItemBehaviour == 2)
4253 {
4254 return true;
4255 }
4256
4257 return false;
4258 }
4259
4261 {
4262 return false;
4263 }
4264
4267 {
4269 }
4270
4271
4272 //----------------------------------------------------------------
4273 // Item Targeting (User Actions)
4274 override void SetTakeable(bool pState)
4275 {
4276 m_IsTakeable = pState;
4277 SetSynchDirty();
4278 }
4279
4280 override bool IsTakeable()
4281 {
4282 return m_IsTakeable;
4283 }
4284
4285 // For cases where we want to show object widget which cant be taken to hands
4287 {
4288 return false;
4289 }
4290
4293 {
4294 string att_type = "None";
4295
4296 if (ConfigIsExisting("soundAttType"))
4297 {
4298 att_type = ConfigGetString("soundAttType");
4299 }
4300
4301 m_SoundAttType = att_type;
4302 }
4303
4304 override string GetAttachmentSoundType()
4305 {
4306 return m_SoundAttType;
4307 }
4308
4309 //----------------------------------------------------------------
4310 //SOUNDS - ItemSoundHandler
4311 //----------------------------------------------------------------
4312
4313 string GetPlaceSoundset(); // played when deploy starts
4314 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
4315 string GetDeploySoundset(); // played when deploy sucessfully finishes
4316
4324
4325 // override to initialize sounds
4326 protected void InitItemSounds()
4327 {
4328 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
4329 return;
4330
4332
4333 if (GetPlaceSoundset() != string.Empty)
4334 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
4335
4336 if (GetDeploySoundset() != string.Empty)
4337 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
4338
4339 SoundParameters params = new SoundParameters();
4340 params.m_Loop = true;
4341 if (GetLoopDeploySoundset() != string.Empty)
4342 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
4343 }
4344
4345 // Start sound using ItemSoundHandler
4347 {
4348 if (!GetGame().IsServer())
4349 return;
4350
4351 m_SoundSyncPlay = id;
4352 SetSynchDirty();
4353
4354 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
4356 }
4357
4358 // Stop sound using ItemSoundHandler
4360 {
4361 if (!GetGame().IsServer())
4362 return;
4363
4364 m_SoundSyncStop = id;
4365 SetSynchDirty();
4366
4367 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
4369 }
4370
4372 {
4373 m_SoundSyncPlay = 0;
4374 }
4375
4377 {
4378 m_SoundSyncStop = 0;
4379 }
4380
4382 void PlayAttachSound(string slot_type)
4383 {
4384 if (!GetGame().IsDedicatedServer())
4385 {
4386 if (ConfigIsExisting("attachSoundSet"))
4387 {
4388 string cfg_path = "";
4389 string soundset = "";
4390 string type_name = GetType();
4391
4392 TStringArray cfg_soundset_array = new TStringArray;
4393 TStringArray cfg_slot_array = new TStringArray;
4394 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
4395 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
4396
4397 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
4398 {
4399 for (int i = 0; i < cfg_soundset_array.Count(); i++)
4400 {
4401 if (cfg_slot_array[i] == slot_type)
4402 {
4403 soundset = cfg_soundset_array[i];
4404 break;
4405 }
4406 }
4407 }
4408
4409 if (soundset != "")
4410 {
4411 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
4412 sound.SetAutodestroy(true);
4413 }
4414 }
4415 }
4416 }
4417
4418 void PlayDetachSound(string slot_type)
4419 {
4420 //TODO - evaluate if needed and devise universal config structure if so
4421 }
4422
4423 void OnApply(PlayerBase player);
4424
4426 {
4427 return 1.0;
4428 };
4429 //returns applicable selection
4434
4436 {
4438 }
4439
4441
4443 {
4444 SetDynamicPhysicsLifeTime(0.01);
4445 m_ItemBeingDroppedPhys = false;
4446 }
4447
4449 {
4450 array<string> zone_names = new array<string>;
4451 GetDamageZones(zone_names);
4452 for (int i = 0; i < zone_names.Count(); i++)
4453 {
4454 SetHealthMax(zone_names.Get(i),"Health");
4455 }
4456 SetHealthMax("","Health");
4457 }
4458
4461 {
4462 float global_health = GetHealth01("","Health");
4463 array<string> zones = new array<string>;
4464 GetDamageZones(zones);
4465 //set damage of all zones to match global health level
4466 for (int i = 0; i < zones.Count(); i++)
4467 {
4468 SetHealth01(zones.Get(i),"Health",global_health);
4469 }
4470 }
4471
4473 bool IsCoverFaceForShave(string slot_name)
4474 {
4475 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
4476 }
4477
4478 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
4479 {
4480 if (!hasRootAsPlayer)
4481 {
4482 if (refParentIB)
4483 {
4484 // parent is wet
4485 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
4487 // parent has liquid inside
4488 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
4490 // drying
4491 else if (m_VarWet > m_VarWetMin)
4492 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
4493 }
4494 else
4495 {
4496 // drying on ground or inside non-itembase (car, ...)
4497 if (m_VarWet > m_VarWetMin)
4498 AddWet(-1 * delta * GetDryingIncrement("ground"));
4499 }
4500 }
4501 }
4502
4503 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
4504 {
4506 {
4507 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
4508 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
4509 {
4510 float heatPermCoef = 1.0;
4511 EntityAI ent = this;
4512 while (ent)
4513 {
4514 heatPermCoef *= ent.GetHeatPermeabilityCoef();
4515 ent = ent.GetHierarchyParent();
4516 }
4517
4518 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
4519 }
4520 }
4521 }
4522
4523 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
4524 {
4525 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
4526 EntityAI parent = GetHierarchyParent();
4527 if (!parent)
4528 {
4529 hasParent = false;
4530 hasRootAsPlayer = false;
4531 }
4532 else
4533 {
4534 hasParent = true;
4535 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
4536 refParentIB = ItemBase.Cast(parent);
4537 }
4538 }
4539
4540 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
4541 {
4542 // this is stub, implemented on Edible_Base
4543 }
4544
4546 {
4547 // return true used on selected food clases so they can decay
4548 return false;
4549 }
4550
4551 protected bool CanProcessDecay()
4552 {
4553 // this is stub, implemented on Edible_Base class
4554 // used to determine whether it is still necessary for the food to decay
4555 return false;
4556 }
4557
4558 protected bool CanHaveWetness()
4559 {
4560 // return true used on selected items that have a wetness effect
4561 return false;
4562 }
4563
4566 {
4567 return !GetIsFrozen() && IsOpen();
4568 }
4569
4570 override void ProcessVariables()
4571 {
4572 bool hasParent = false, hasRootAsPlayer = false;
4573 ItemBase refParentIB;
4574
4575 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
4576 bool foodDecay = g_Game.IsFoodDecayEnabled();
4577
4578 if (wwtu || foodDecay)
4579 {
4580 bool processWetness = wwtu && CanHaveWetness();
4581 bool processTemperature = wwtu && CanHaveTemperature();
4582 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
4583
4584 if (processWetness || processTemperature || processDecay)
4585 {
4586 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
4587
4588 if (processWetness)
4589 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
4590
4591 if (processTemperature)
4592 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
4593
4594 if (processDecay)
4595 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
4596 }
4597 }
4598 }
4599
4605
4607 {
4609 return Liquid.GetFreezeThreshold(GetLiquidType());
4610
4611 return super.GetTemperatureFreezeThreshold();
4612 }
4613
4615 {
4617 return Liquid.GetThawThreshold(GetLiquidType());
4618
4619 return super.GetTemperatureThawThreshold();
4620 }
4621
4623 {
4625 return Liquid.GetBoilThreshold(GetLiquidType());
4626
4627 return super.GetItemOverheatThreshold();
4628 }
4629
4631 {
4632 if (HasQuantity())
4634
4635 return super.GetTemperatureFreezeTime();
4636 }
4637
4638 override float GetTemperatureThawTime()
4639 {
4640 if (HasQuantity())
4642
4643 return super.GetTemperatureThawTime();
4644 }
4645
4647 void AffectLiquidContainerOnFill(int liquid_type, float amount);
4649 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
4650
4652 {
4653 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
4654 }
4655
4657 {
4658 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
4659 }
4660
4663 {
4664 m_LightSourceItem = lightsource;
4665 }
4666
4668 {
4669 m_LightSourceItem = null;
4670 }
4671
4673 {
4674 return m_LightSourceItem;
4675 }
4676
4679 {
4680 return null;
4681 }
4682
4685 {
4686 return false;
4687 }
4688
4689 bool PairWithDevice(notnull ItemBase otherDevice)
4690 {
4691 if (GetGame().IsServer())
4692 {
4693 ItemBase explosive = otherDevice;
4695 if (!trg)
4696 {
4697 trg = RemoteDetonatorTrigger.Cast(otherDevice);
4698 explosive = this;
4699 }
4700
4701 explosive.PairRemote(trg);
4702 trg.SetControlledDevice(explosive);
4703
4705 trg.SetPersistentPairID(persistentID);
4706 explosive.SetPersistentPairID(persistentID);
4707
4708 return true;
4709 }
4710 return false;
4711 }
4712
4715 {
4716 float ret = 1.0;
4717 if (HasQuantity())
4718 ret *= GetQuantityNormalized();
4719 ret *= GetHealth01();
4720
4721 return ret;
4722 }
4723
4724 #ifdef DEVELOPER
4725 override void SetDebugItem()
4726 {
4727 super.SetDebugItem();
4728 _itemBase = this;
4729 }
4730
4731 override string GetDebugText()
4732 {
4733 string text = super.GetDebugText();
4734
4735 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
4736 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
4737
4738 return text;
4739 }
4740 #endif
4741
4743 {
4744 return true;
4745 }
4746
4748 //DEPRECATED BELOW
4750 // Backwards compatibility
4751 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
4752 {
4753 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
4754 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
4755 }
4756
4757 // replaced by ItemSoundHandler
4765
4774 bool UsesGlobalDeploy(){return false;}
4775 bool CanPlayDeployLoopSound(){return false;}
4779 void SetIsPlaceSound(bool is_place_sound);
4780 void SetIsDeploySound(bool is_deploy_sound);
4781}
4782
4783EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
4785 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
4786 if (entity)
4787 {
4788 bool is_item = entity.IsInherited(ItemBase);
4789 if (is_item && full_quantity)
4791 ItemBase item = ItemBase.Cast(entity);
4792 item.SetQuantity(item.GetQuantityInit());
4793 }
4794 }
4795 else
4796 {
4797 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
4798 return NULL;
4800 return entity;
4803void SetupSpawnedItem(ItemBase item, float health, float quantity)
4805 if (item)
4807 if (health > 0)
4808 item.SetHealth("", "", health);
4810 if (item.CanHaveTemperature())
4811 {
4813 if (item.CanFreeze())
4814 item.SetFrozen(false);
4816
4817 if (item.HasEnergyManager())
4819 if (quantity >= 0)
4821 item.GetCompEM().SetEnergy0To1(quantity);
4823 else
4825 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
4828 else if (item.IsMagazine())
4830 Magazine mag = Magazine.Cast(item);
4831 if (quantity >= 0)
4833 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
4835 else
4837 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
4841 else
4842 {
4843 if (quantity >= 0)
4845 item.SetQuantityNormalized(quantity, false);
4847 else
4849 item.SetQuantity(Math.AbsFloat(quantity));
4850 }
4851
4852 }
4854}
4856#ifdef DEVELOPER
4857ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
4858#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
eBleedingSourceType GetType()
Определения BleedingSource.c:63
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void InitializeActions()
Определения AdvancedCommunication.c:190
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
const int MAX
Определения EnConvert.c:27
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
bool IsOpen()
Определения ItemBase.c:8796
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8078
override float GetWetMax()
Определения ItemBase.c:8379
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
void SetCEBasedQuantity()
Определения ItemBase.c:5581
float GetOverheatingCoef()
Определения ItemBase.c:5387
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
float GetItemModelLength()
Определения ItemBase.c:8438
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
bool CanHaveWetness()
Определения ItemBase.c:9326
float GetHeatIsolationInit()
Определения ItemBase.c:8317
override bool HasQuantity()
Определения ItemBase.c:8149
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
float GetEnergy()
Определения ItemBase.c:8278
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool IsLiquidContainer()
Определения ItemBase.c:5674
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
float GetItemAttachOffset()
Определения ItemBase.c:8447
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
override int GetQuantityMax()
Определения ItemBase.c:8106
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
int GetLiquidTypeInit()
Определения ItemBase.c:8542
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
override float GetWet()
Определения ItemBase.c:8374
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
override float GetWetMin()
Определения ItemBase.c:8384
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
Определения ActionBase.c:53
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
Определения ActionBase.c:22
Определения ActionTakeItem.c:7
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
Определения AmmunitionPiles.c:84
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
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 void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Определения Cargo.c:7
Super root of all classes in Enforce script.
Определения EnScript.c:11
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
Определения EnPhysics.c:305
Определения ZombieBase.c:2
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Определения Debug.c:245
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
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:127
Определения Debug.c:2
Определения Magnum.c:398
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
override bool IsMan()
Определения Man.c:44
proto native HumanInventory GetHumanInventory()
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
const int c_InventoryReservationTimeoutShortMS
Определения Inventory.c:713
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
script counterpart to engine's class Inventory
Определения Inventory.c:79
proto native EntityAI GetEntityInHands()
Определения EnEntity.c:165
bool m_IsStoreLoad
Определения ItemBase.c:70
string m_LockSoundSet
Определения ItemBase.c:128
override string GetAttachmentSoundType()
Определения ItemBase.c:4304
void KillAllOverheatingParticles()
Определения ItemBase.c:655
float m_VarWetPrev
Определения ItemBase.c:39
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:134
void PlayDeploySound()
bool IsActionTargetVisible()
Определения ItemBase.c:4286
bool IsOpen()
Определения ItemBase.c:4028
override float GetQuantity()
Определения ItemBase.c:3386
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:4460
override string ChangeIntoOnDetach()
Определения ItemBase.c:1423
bool m_IsBeingPlaced
Определения ItemBase.c:61
float m_HeatIsolation
Определения ItemBase.c:54
override void OnEnergyConsumed()
Определения ItemBase.c:3521
string GetLoopDeploySoundset()
override void ClearInventory()
Определения ItemBase.c:3489
void SoundSynchRemoteReset()
void PlayDeployLoopSoundEx()
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:65
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:4013
void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
EffectSound m_SoundDeployFinish
Определения ItemBase.c:4758
ItemBase GetLightSourceItem()
Определения ItemBase.c:4672
override bool IsOneHandedBehaviour()
Определения ItemBase.c:4240
int m_ColorComponentB
Определения ItemBase.c:80
override bool IsSplitable()
Определения ItemBase.c:1575
override void SetColor(int r, int g, int b, int a)
Определения ItemBase.c:3727
override int GetCleanness()
Определения ItemBase.c:3701
int m_SoundSyncPlay
Определения ItemBase.c:132
bool m_IsPlaceSound
Определения ItemBase.c:4762
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:2224
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения ItemBase.c:2303
bool IsLightSource()
Определения ItemBase.c:941
override float GetTemperatureThawThreshold()
Определения ItemBase.c:4614
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:2563
void RemoveAction(typename actionName)
Определения ItemBase.c:356
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:1938
void PlayPlaceSound()
override bool HasQuantity()
Определения ItemBase.c:3381
override float GetTemperatureThawTime()
Определения ItemBase.c:4638
void StopItemDynamicPhysics()
Определения ItemBase.c:4442
bool IsLiquidContainer()
Определения ItemBase.c:906
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:3791
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:855
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:700
bool m_ActionsInitialize
Определения ItemBase.c:20
override bool IsStoreLoad()
Определения ItemBase.c:3653
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения ItemBase.c:4080
override float GetWetMin()
Определения ItemBase.c:3616
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:113
int m_CleannessMax
Определения ItemBase.c:47
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:592
override bool CanDisplayCargo()
Определения ItemBase.c:4033
override void SetWetMax()
Определения ItemBase.c:3601
float GetHeatIsolation()
Определения ItemBase.c:3554
bool CanPlayDeployLoopSound()
Определения ItemBase.c:4775
bool CanExplodeInFire()
Определения ItemBase.c:2537
int m_VarQuantityMin
Определения ItemBase.c:32
override bool IsHologram()
Определения ItemBase.c:985
array< string > GetHeadHidingSelection()
Определения ItemBase.c:4430
float GetHeatIsolationInit()
Определения ItemBase.c:3549
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:2029
override void InitItemVariables()
Определения ItemBase.c:189
int GetQuantityInit()
Определения ItemBase.c:3375
override void ProcessVariables()
Определения ItemBase.c:4570
bool HidesSelectionBySlot()
Определения ItemBase.c:4435
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения ItemBase.c:3839
bool m_IsSoundSynchRemote
Определения ItemBase.c:4764
void RemoveAudioVisualsOnClient()
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:2650
void SetIsPlaceSound(bool is_place_sound)
bool m_CanShowQuantity
Определения ItemBase.c:71
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
void ClearStopItemSoundServer()
Определения ItemBase.c:4376
override void RemoveAllAgents()
Определения ItemBase.c:3875
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:3292
float m_ItemAttachOffset
Определения ItemBase.c:56
override void OnStoreSave(ParamsWriteContext ctx)
Определения ItemBase.c:3123
override bool CanPutInCargo(EntityAI parent)
Определения ItemBase.c:4042
override void SetQuantityToMinimum()
Определения ItemBase.c:3303
WrittenNoteData GetWrittenNoteData()
Определения ItemBase.c:4440
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:4601
float GetOverheatingValue()
Определения ItemBase.c:519
ref TIntArray m_SingleUseActions
Определения ItemBase.c:87
float m_ImpactSpeed
Определения ItemBase.c:51
override void SetTakeable(bool pState)
Определения ItemBase.c:4274
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:4678
ref Timer m_CheckOverheating
Определения ItemBase.c:109
bool IsDeployable()
Определения ItemBase.c:4260
bool CanBeCookedOnStick()
Определения ItemBase.c:2573
float GetOverheatingCoef()
Определения ItemBase.c:619
bool m_RecipesInitialized
Определения ItemBase.c:23
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:3750
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:4714
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:4565
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:3577
void RefreshPhysics()
bool CanDecay()
Определения ItemBase.c:4545
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:3568
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:3961
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:1883
static int m_LastRegisteredWeaponID
Определения ItemBase.c:104
bool m_IsDeploySound
Определения ItemBase.c:4763
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:4503
TInputActionMap m_InputActionMap
Определения ItemBase.c:17
override void EEKilled(Object killer)
Определения ItemBase.c:1355
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:2248
int m_Count
Определения ItemBase.c:34
void OnInventoryExit(Man player)
Event called on item when it is removed from the player(Man) inventory, passes the old owner as a par...
Определения ItemBase.c:3811
int m_MaxOverheatingValue
Определения ItemBase.c:111
override float GetTemperatureFreezeTime()
Определения ItemBase.c:4630
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:3894
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:3470
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:4056
int GetOnDigWormsAmount()
Определения ItemBase.c:995
ref EffectSound m_LockingSound
Определения ItemBase.c:127
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:867
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:18
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:4523
float m_VarWet
Определения ItemBase.c:38
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:3450
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:1052
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:4317
float m_VarQuantityPrev
Определения ItemBase.c:30
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:2590
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:3953
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:16
int m_ColorComponentA
Определения ItemBase.c:81
bool CanProcessDecay()
Определения ItemBase.c:4551
void OnEndPlacement()
Определения ItemBase.c:983
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:1910
override void OnEnergyAdded()
Определения ItemBase.c:3528
int m_VarLiquidType
Определения ItemBase.c:58
void StopDeployLoopSoundEx()
bool IsDeploySound()
Определения ItemBase.c:4778
bool m_ThrowItemOnDrop
Определения ItemBase.c:64
void SetActions()
Определения ItemBase.c:307
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:1856
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения ItemBase.c:296
override bool KindOf(string tag)
Определения ItemBase.c:2702
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:3885
int m_ShotsToStartOverheating
Определения ItemBase.c:110
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:3641
override int GetQuantityMax()
Определения ItemBase.c:3338
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:101
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:599
override void OnCreatePhysics()
Определения ItemBase.c:1205
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:709
bool m_HasQuantityBar
Определения ItemBase.c:72
static int GetDebugActionsMask()
Определения ItemBase.c:775
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:1765
float m_VarWetInit
Определения ItemBase.c:40
void ConvertEnergyToQuantity()
Определения ItemBase.c:3536
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:4382
bool IsFacingPlayer(PlayerBase player, string selection)
Определения ItemBase.c:953
override float GetWetInit()
Определения ItemBase.c:3621
void SetQuantityMax()
Определения ItemBase.c:3297
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:3658
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:1694
void SetIsDeploySound(bool is_deploy_sound)
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:3880
override void OnPlacementStarted(Man player)
Определения ItemBase.c:3832
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:795
override int GetQuickBarBonus()
Определения ItemBase.c:279
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:1210
int m_ColorComponentG
Определения ItemBase.c:79
override int GetLiquidType()
Определения ItemBase.c:3779
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:540
override bool CanObstruct()
Определения ItemBase.c:963
void PerformDamageSystemReinit()
Определения ItemBase.c:4448
EffectSound m_SoundPlace
Определения ItemBase.c:4759
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:3238
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:4149
float m_OverheatingDecayInterval
Определения ItemBase.c:112
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int m_SoundSyncStop
Определения ItemBase.c:133
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:780
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:4684
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:3351
void StartItemSoundServer(int id)
Определения ItemBase.c:4346
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:586
void AddAction(typename actionName)
Определения ItemBase.c:318
bool m_CanThisBeSplit
Определения ItemBase.c:69
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения ItemBase.c:2346
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:4651
bool m_FixDamageSystemInit
Определения ItemBase.c:67
override void EEOnAfterLoad()
Определения ItemBase.c:3167
float m_StoreLoadedQuantity
Определения ItemBase.c:36
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:3763
override void OnVariablesSynchronized()
Определения ItemBase.c:3187
float m_VarWetMax
Определения ItemBase.c:42
void OnInventoryEnter(Man player)
Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter.
Определения ItemBase.c:3798
override void OnWasDetached(EntityAI parent, int slot_id)
Определения ItemBase.c:1391
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:1045
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:3397
int m_AttachedAgents
Определения ItemBase.c:93
override bool IsIgnoredByConstruction()
Определения ItemBase.c:2549
void OnActivatedByTripWire()
bool ContainsAgent(int agent_id)
Определения ItemBase.c:3853
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:103
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:137
bool CanBeMovedOverride()
Определения ItemBase.c:2612
void Open()
Implementations only.
bool m_HideSelectionsBySlot
Определения ItemBase.c:116
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:76
override bool IsItemBase()
Определения ItemBase.c:2696
bool IsResultOfSplit()
Определения ItemBase.c:2209
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:785
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:4250
override float GetItemOverheatThreshold()
Определения ItemBase.c:4622
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:4209
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:3411
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:4266
float m_VarQuantity
Определения ItemBase.c:29
float m_VarStackMax
Определения ItemBase.c:35
override float GetStoreLoadedQuantity()
Определения ItemBase.c:3663
float GetBandagingEffectivity()
Определения ItemBase.c:4425
bool CanBeUsedForSuicide()
Определения ItemBase.c:4742
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:52
bool can_this_be_combined
Определения ItemBase.c:68
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:3636
override bool IsTakeable()
Определения ItemBase.c:4280
bool CanMakeGardenplot()
Определения ItemBase.c:1000
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:3688
override void SetStoreLoad(bool value)
Определения ItemBase.c:3648
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:790
bool m_IsTakeable
Определения ItemBase.c:63
int GetLockType()
Определения ItemBase.c:3714
int m_QuickBarBonus
Определения ItemBase.c:60
override void OnWasAttached(EntityAI parent, int slot_id)
Определения ItemBase.c:1379
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:2219
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:2931
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:2204
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:605
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:2836
bool HasFoodStage()
Определения ItemBase.c:2556
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:1399
EffectSound m_SoundDeploy
Определения ItemBase.c:4761
void DoAmmoExplosion()
Определения ItemBase.c:1475
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:4606
float m_ItemModelLength
Определения ItemBase.c:55
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:4478
bool m_IsOverheatingEffectActive
Определения ItemBase.c:107
override void AfterStoreLoad()
Определения ItemBase.c:3151
string GetLockSoundSet()
Определения ItemBase.c:3719
bool IsNVG()
Определения ItemBase.c:922
bool CanBeCooked()
Определения ItemBase.c:2568
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:800
bool m_WantPlayImpactSound
Определения ItemBase.c:49
int GetItemSize()
Определения ItemBase.c:2597
void ItemBase()
Определения ItemBase.c:140
int m_Cleanness
Определения ItemBase.c:44
bool DamageItemAttachments(float damage)
Определения ItemBase.c:1559
float GetSingleInventoryItemWeight()
Определения ItemBase.c:3406
bool IsBloodContainer()
Определения ItemBase.c:916
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:1005
bool CanEat()
Определения ItemBase.c:2543
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:2786
override int GetQuantityMin()
Определения ItemBase.c:3370
bool m_CanPlayImpactSound
Определения ItemBase.c:50
void StopItemSoundServer(int id)
Определения ItemBase.c:4359
string GetPlaceSoundset()
void InitItemSounds()
Определения ItemBase.c:4326
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:1817
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:2895
bool CanBeRepairedByCrafting()
Определения ItemBase.c:946
void PlayDeployFinishSound()
bool IsFullQuantity()
Определения ItemBase.c:3391
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:3559
override void RemoveAgent(int agent_id)
Определения ItemBase.c:3866
bool m_CanBeMovedOverride
Определения ItemBase.c:66
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:4129
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:3974
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:1789
int m_CleannessMin
Определения ItemBase.c:46
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:4751
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:100
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:463
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:2800
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:1588
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:2619
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:4169
bool m_IsHologram
Определения ItemBase.c:62
int m_LiquidContainerMask
Определения ItemBase.c:57
void OnOverheatingDecay()
Определения ItemBase.c:562
int m_ColorComponentR
Определения ItemBase.c:78
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения ItemBase.c:4071
void ~ItemBase()
Определения ItemBase.c:740
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:2282
int GetLiquidTypeInit()
Определения ItemBase.c:3774
void UpdateAllOverheatingParticles()
Определения ItemBase.c:627
int GetDamageSystemVersionChange()
Re-sets DamageSystem changes.
Определения ItemBase.c:732
bool IsSoundSynchRemote()
Определения ItemBase.c:4776
int m_CleannessInit
Определения ItemBase.c:45
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:4656
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:842
bool IsPlayerInside(PlayerBase player, string selection)
Определения ItemBase.c:958
PluginAdminLog m_AdminLog
Определения ItemBase.c:119
bool IsColorSet()
Определения ItemBase.c:3744
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ItemBase.c:2722
override int GetAgents()
Определения ItemBase.c:3900
float GetItemModelLength()
Определения ItemBase.c:3670
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения ItemBase.c:2040
void ClearStartItemSoundServer()
Определения ItemBase.c:4371
void OnCombine(ItemBase other_item)
Определения ItemBase.c:2274
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения ItemBase.c:1215
void SetResultOfSplit(bool value)
Определения ItemBase.c:2214
float GetFilterDamageRatio()
Определения ItemBase.c:694
void SplitItem(PlayerBase player)
Определения ItemBase.c:1971
bool UsesGlobalDeploy()
Определения ItemBase.c:4774
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения ItemBase.c:3022
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:4189
bool IsExplosive()
Определения ItemBase.c:929
bool CanBeDigged()
Определения ItemBase.c:990
override float GetWet()
Определения ItemBase.c:3606
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:3626
bool CanBeDisinfected()
Определения ItemBase.c:3180
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:3784
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения ItemBase.c:2142
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:2632
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:4473
int NameToID(string name)
Определения ItemBase.c:2773
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:2668
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:1499
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:974
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:689
bool m_CanBeDigged
Определения ItemBase.c:73
ref array< int > m_CompatibleLocks
Определения ItemBase.c:125
override bool CanBeSplit()
Определения ItemBase.c:1580
ref TIntArray m_ContinuousActions
Определения ItemBase.c:88
float GetItemAttachOffset()
Определения ItemBase.c:3679
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:2583
ScriptedLightBase GetLight()
float GetEnergy()
Определения ItemBase.c:3510
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:4689
void InitializeActions()
Определения ItemBase.c:284
bool IsPlaceSound()
Определения ItemBase.c:4777
int m_LockType
Определения ItemBase.c:126
void SoundSynchRemote()
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:371
override void GetColor(out int r, out int g, out int b, out int a)
gets item's color variable as components
Определения ItemBase.c:3736
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:2243
static int m_DebugActionsMask
Определения ItemBase.c:22
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:934
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:4760
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:1614
int m_VarQuantityInit
Определения ItemBase.c:31
bool AllowFoodConsumption()
Определения ItemBase.c:3706
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:524
override bool IsBeingPlaced()
Определения ItemBase.c:969
override void EEDelete(EntityAI parent)
Определения ItemBase.c:1321
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:3310
string GetDeploySoundset()
void PlayDetachSound(string slot_type)
Определения ItemBase.c:4418
void SetCEBasedQuantity()
Определения ItemBase.c:813
void ExplodeAmmo()
Определения ItemBase.c:1462
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:2035
float m_VarWetMin
Определения ItemBase.c:41
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:1822
override void OnRightClick()
Определения ItemBase.c:2078
string IDToName(int id)
Определения ItemBase.c:2779
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:4540
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:4101
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:4662
bool IsOverheatingEffectActive()
Определения ItemBase.c:557
ItemBase m_LightSourceItem
Определения ItemBase.c:85
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:2005
void OnItemInHandsPlayerSwimStart(PlayerBase player)
float m_OverheatingShots
Определения ItemBase.c:108
bool IsLiquidPresent()
Определения ItemBase.c:901
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:3319
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:3946
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:131
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:4292
ref TIntArray m_InteractActions
Определения ItemBase.c:89
bool DamageItemInCargo(float damage)
Определения ItemBase.c:1540
bool CanHaveWetness()
Определения ItemBase.c:4558
int m_ItemBehaviour
Определения ItemBase.c:59
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:394
override bool IsHeavyBehaviour()
Определения ItemBase.c:4230
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:2686
int m_VarQuantityMax
Определения ItemBase.c:33
float GetQuantityNormalizedScripted()
Определения ItemBase.c:3324
ref Timer m_PhysDropTimer
Определения ItemBase.c:122
void RemoveLightSourceItem()
Определения ItemBase.c:4667
float GetInfectionChance(int system=0, Param param=null)
Infection chance while/after using this item, originally used for wound infection after bandaging,...
Определения ItemBase.c:683
string GetDeployFinishSoundset()
override float GetWetMax()
Определения ItemBase.c:3611
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:115
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:1175
void OnApply(PlayerBase player)
int GetLiquidContainerMask()
Определения ItemBase.c:911
void SetActionAnimOverrides()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:102
override void AddWet(float value)
Определения ItemBase.c:3596
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
static proto native bool IsSlotIdValid(int slotId)
verifies existence of the slot id
static proto native int GetStackMaxForSlotId(int slot_Id)
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
Определения InventorySlots.c:6
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override string GetDeploySoundset()
Определения BarbedWire.c:392
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void RefreshPhysics()
Определения BatteryCharger.c:359
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override void InitItemSounds()
Определения TentBase.c:810
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
static const int FLOAT
Определения UtilityClasses.c:4
static bool IsActionLogEnable()
Определения Debug.c:638
Определения Debug.c:594
Определения EnMath.c:7
Определения ObjectTyped.c:2
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
Определения PPEConstants.c:68
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
Legacy way of using particles in the game.
Определения Particle.c:7
Определения PlayerBaseClient.c:2
The class that will be instanced (moddable)
Определения gameplay.c:389
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Определения EffectManager.c:169
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Определения EffectManager.c:271
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
proto void Remove(func fn)
remove specific call from queue
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 native void Send()
proto static native bool CanStoreInputUserData()
Returns true when the channel is free, AND the InputBuffer is NOT full (same as '!...
Определения gameplay.c:121
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
Определения DayZPlayerImplement.c:63
proto native float GetDamage(string zoneName, string healthType)
Определения DamageSystem.c:2
const float DEFAULT_DEPLOY
Определения ActionConstants.c:38
Определения ActionConstants.c:28
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
Определения DayZGame.c:64
script counterpart to engine's class Weapon
Определения InventoryItem.c:49
void SetCalcDetails(string details)
Определения Debug.c:816
Определения Debug.c:799
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
Определения WrittenNoteData.c:2
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
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
const float WETNESS_RATE_WETTING_INSIDE
Определения constants.c:909
const float ITEM_TEMPERATURE_TO_EXPLODE_MIN
misc
Определения constants.c:1012
const float WETNESS_RATE_WETTING_LIQUID
Определения constants.c:910
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
const float TEMP_COEF_WORLD
Определения constants.c:940
static const float TEMPERATURE_TIME_THAW_MIN
Определения constants.c:931
static const float TEMPERATURE_TIME_FREEZE_MIN
Определения constants.c:930
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const float ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER
Определения constants.c:804
const int STATE_RUINED
Определения constants.c:846
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const float STATE_SOAKING_WET
Определения constants.c:871
const int LIQUID_NONE
Определения constants.c:527
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:106
static proto float Round(float f)
Returns mathematical round of value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
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 InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
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
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()