DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetQuantityMax()

override int SpawnItemOnLocation::GetQuantityMax ( )
protected

См. определение в файле ItemBase.c строка 8248

8252{
8253 override bool CanPutAsAttachment(EntityAI parent)
8254 {
8255 return true;
8256 }
8257};
8258
8259//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8260
8261class ItemBase extends InventoryItem
8262{
8266
8268
8269 static int m_DebugActionsMask;
8271 // ============================================
8272 // Variable Manipulation System
8273 // ============================================
8274 // Quantity
8275
8276 float m_VarQuantity;
8277 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8279 int m_VarQuantityMin;
8280 int m_VarQuantityMax;
8281 int m_Count;
8282 float m_VarStackMax;
8283 float m_StoreLoadedQuantity = float.LOWEST;
8284 // Wet
8285 float m_VarWet;
8286 float m_VarWetPrev;//for client to know wetness changed during synchronization
8287 float m_VarWetInit;
8288 float m_VarWetMin;
8289 float m_VarWetMax;
8290 // Cleanness
8291 int m_Cleanness;
8292 int m_CleannessInit;
8293 int m_CleannessMin;
8294 int m_CleannessMax;
8295 // impact sounds
8297 bool m_CanPlayImpactSound = true;
8298 float m_ImpactSpeed;
8300 //
8301 float m_HeatIsolation;
8302 float m_ItemModelLength;
8303 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8305 int m_VarLiquidType;
8306 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8307 int m_QuickBarBonus;
8308 bool m_IsBeingPlaced;
8309 bool m_IsHologram;
8310 bool m_IsTakeable;
8311 bool m_ThrowItemOnDrop;
8314 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8315 bool can_this_be_combined; //Check if item can be combined
8316 bool m_CanThisBeSplit; //Check if item can be split
8317 bool m_IsStoreLoad = false;
8318 bool m_CanShowQuantity;
8319 bool m_HasQuantityBar;
8320 protected bool m_CanBeDigged;
8321 protected bool m_IsResultOfSplit
8322
8323 string m_SoundAttType;
8324 // items color variables
8329 //-------------------------------------------------------
8330
8331 // light source managing
8333
8337
8338 //==============================================
8339 // agent system
8340 private int m_AttachedAgents;
8341
8343 void TransferModifiers(PlayerBase reciever);
8344
8345
8346 // Weapons & suppressors particle effects
8351 static int m_LastRegisteredWeaponID = 0;
8352
8353 // Overheating effects
8355 float m_OverheatingShots;
8356 ref Timer m_CheckOverheating;
8357 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8358 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8359 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8360 ref array <ref OverheatingParticle> m_OverheatingParticles;
8361
8363 protected bool m_HideSelectionsBySlot;
8364
8365 // Admin Log
8366 PluginAdminLog m_AdminLog;
8367
8368 // misc
8369 ref Timer m_PhysDropTimer;
8370
8371 // Attachment Locking variables
8372 ref array<int> m_CompatibleLocks;
8373 protected int m_LockType;
8374 protected ref EffectSound m_LockingSound;
8375 protected string m_LockSoundSet;
8376
8377 // ItemSoundHandler
8378 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8379 protected int m_SoundSyncPlay; // id for sound to play
8380 protected int m_SoundSyncStop; // id for sound to stop
8382
8383 //temperature
8384 private float m_TemperaturePerQuantityWeight;
8385
8386 // -------------------------------------------------------------------------
8387 void ItemBase()
8388 {
8389 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8393
8394 if (!GetGame().IsDedicatedServer())
8395 {
8396 if (HasMuzzle())
8397 {
8399
8401 {
8403 }
8404 }
8405
8407 m_ActionsInitialize = false;
8408 }
8409
8410 m_OldLocation = null;
8411
8412 if (GetGame().IsServer())
8413 {
8414 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8415 }
8416
8417 if (ConfigIsExisting("headSelectionsToHide"))
8418 {
8420 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8421 }
8422
8423 m_HideSelectionsBySlot = false;
8424 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8425 {
8426 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8427 }
8428
8429 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8430
8431 m_IsResultOfSplit = false;
8432
8434 }
8435
8436 override void InitItemVariables()
8437 {
8438 super.InitItemVariables();
8439
8440 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8441 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8442 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8443 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8444 m_VarStackMax = ConfigGetFloat("varStackMax");
8445 m_Count = ConfigGetInt("count");
8446
8447 m_CanShowQuantity = ConfigGetBool("quantityShow");
8448 m_HasQuantityBar = ConfigGetBool("quantityBar");
8449
8450 m_CleannessInit = ConfigGetInt("varCleannessInit");
8452 m_CleannessMin = ConfigGetInt("varCleannessMin");
8453 m_CleannessMax = ConfigGetInt("varCleannessMax");
8454
8455 m_WantPlayImpactSound = false;
8456 m_ImpactSpeed = 0.0;
8457
8458 m_VarWetInit = ConfigGetFloat("varWetInit");
8460 m_VarWetMin = ConfigGetFloat("varWetMin");
8461 m_VarWetMax = ConfigGetFloat("varWetMax");
8462
8463 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8464 if (IsLiquidContainer() && GetQuantity() != 0)
8466 m_IsBeingPlaced = false;
8467 m_IsHologram = false;
8468 m_IsTakeable = true;
8469 m_CanBeMovedOverride = false;
8473 m_CanBeDigged = ConfigGetBool("canBeDigged");
8474
8475 m_CompatibleLocks = new array<int>();
8476 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8477 m_LockType = ConfigGetInt("lockType");
8478
8479 //Define if item can be split and set ability to be combined accordingly
8480 m_CanThisBeSplit = false;
8481 can_this_be_combined = false;
8482 if (ConfigIsExisting("canBeSplit"))
8483 {
8484 can_this_be_combined = ConfigGetBool("canBeSplit");
8486 }
8487
8488 m_ItemBehaviour = -1;
8489 if (ConfigIsExisting("itemBehaviour"))
8490 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8491
8492 //RegisterNetSyncVariableInt("m_VariablesMask");
8493 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8494 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8495 RegisterNetSyncVariableInt("m_VarLiquidType");
8496 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8497
8498 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8499 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8500 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8501
8502 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8503 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8504 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8505 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8506
8507 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8508 RegisterNetSyncVariableBool("m_IsTakeable");
8509 RegisterNetSyncVariableBool("m_IsHologram");
8510
8511 InitItemSounds();
8513 {
8514 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8515 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8516 }
8517
8518 m_LockSoundSet = ConfigGetString("lockSoundSet");
8519
8521 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8522 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8523
8524 }
8525
8526 override int GetQuickBarBonus()
8527 {
8528 return m_QuickBarBonus;
8529 }
8530
8531 void InitializeActions()
8532 {
8534 if (!m_InputActionMap)
8535 {
8537 m_InputActionMap = iam;
8538 SetActions();
8540 }
8541 }
8542
8543 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8544 {
8546 {
8547 m_ActionsInitialize = true;
8549 }
8550
8551 actions = m_InputActionMap.Get(action_input_type);
8552 }
8553
8554 void SetActions()
8555 {
8556 AddAction(ActionTakeItem);
8557 AddAction(ActionTakeItemToHands);
8558 AddAction(ActionWorldCraft);
8560 AddAction(ActionAttachWithSwitch);
8561 }
8562
8563 void SetActionAnimOverrides(); // Override action animation for specific item
8564
8565 void AddAction(typename actionName)
8566 {
8567 ActionBase action = ActionManagerBase.GetAction(actionName);
8568
8569 if (!action)
8570 {
8571 Debug.LogError("Action " + actionName + " dosn't exist!");
8572 return;
8573 }
8574
8575 typename ai = action.GetInputType();
8576 if (!ai)
8577 {
8578 m_ActionsInitialize = false;
8579 return;
8580 }
8581
8582 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8583 if (!action_array)
8584 {
8585 action_array = new array<ActionBase_Basic>;
8586 m_InputActionMap.Insert(ai, action_array);
8587 }
8588 if (LogManager.IsActionLogEnable())
8589 {
8590 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8591 }
8592
8593 if (action_array.Find(action) != -1)
8594 {
8595 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8596 }
8597 else
8598 {
8599 action_array.Insert(action);
8600 }
8601 }
8602
8603 void RemoveAction(typename actionName)
8604 {
8605 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8606 ActionBase action = player.GetActionManager().GetAction(actionName);
8607 typename ai = action.GetInputType();
8608 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8609
8610 if (action_array)
8611 {
8612 action_array.RemoveItem(action);
8613 }
8614 }
8615
8616 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8617 // Set -1 for params which should stay in default state
8618 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8619 {
8620 ActionOverrideData overrideData = new ActionOverrideData();
8621 overrideData.m_CommandUID = commandUID;
8622 overrideData.m_CommandUIDProne = commandUIDProne;
8623 overrideData.m_StanceMask = stanceMask;
8624
8625 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8626 if (!actionMap) // create new map of action > overidables map
8627 {
8628 actionMap = new TActionAnimOverrideMap();
8629 m_ItemActionOverrides.Insert(action, actionMap);
8630 }
8631
8632 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8633
8634 }
8635
8636 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8637
8638 ScriptedLightBase GetLight();
8639
8640 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8641 void LoadParticleConfigOnFire(int id)
8642 {
8643 if (!m_OnFireEffect)
8645
8648
8649 string config_to_search = "CfgVehicles";
8650 string muzzle_owner_config;
8651
8652 if (!m_OnFireEffect.Contains(id))
8653 {
8654 if (IsInherited(Weapon))
8655 config_to_search = "CfgWeapons";
8656
8657 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8658
8659 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8660
8661 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8662
8663 if (config_OnFire_subclass_count > 0)
8664 {
8665 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8666
8667 for (int i = 0; i < config_OnFire_subclass_count; i++)
8668 {
8669 string particle_class = "";
8670 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8671 string config_OnFire_entry = config_OnFire_class + particle_class;
8672 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8673 WPOF_array.Insert(WPOF);
8674 }
8675
8676
8677 m_OnFireEffect.Insert(id, WPOF_array);
8678 }
8679 }
8680
8681 if (!m_OnBulletCasingEjectEffect.Contains(id))
8682 {
8683 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8684 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8685
8686 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8687
8688 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8689
8690 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8691 {
8692 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8693
8694 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8695 {
8696 string particle_class2 = "";
8697 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8698 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8699 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8700 WPOBE_array.Insert(WPOBE);
8701 }
8702
8703
8704 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
8705 }
8706 }
8707 }
8708
8709 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8711 {
8714
8715 if (!m_OnOverheatingEffect.Contains(id))
8716 {
8717 string config_to_search = "CfgVehicles";
8718
8719 if (IsInherited(Weapon))
8720 config_to_search = "CfgWeapons";
8721
8722 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
8723 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8724
8725 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
8726 {
8727
8728 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
8729
8731 {
8732 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
8733 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8734 Error(error);
8735 return;
8736 }
8737
8738 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
8739 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
8740
8741
8742
8743 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
8744 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8745
8746 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8747 {
8748 string particle_class = "";
8749 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8750 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8751 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8752
8753 if (entry_type == CT_CLASS)
8754 {
8755 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8756 WPOOH_array.Insert(WPOF);
8757 }
8758 }
8759
8760
8761 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8762 }
8763 }
8764 }
8765
8766 float GetOverheatingValue()
8767 {
8768 return m_OverheatingShots;
8769 }
8770
8771 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8772 {
8773 if (m_MaxOverheatingValue > 0)
8774 {
8776
8777 if (!m_CheckOverheating)
8779
8781 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8782
8783 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8784 }
8785 }
8786
8787 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8788 {
8790 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8791
8793 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8794
8796 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8797
8799 {
8801 }
8802 }
8803
8805 {
8807 }
8808
8809 void OnOverheatingDecay()
8810 {
8811 if (m_MaxOverheatingValue > 0)
8812 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8813 else
8815
8816 if (m_OverheatingShots <= 0)
8817 {
8820 }
8821 else
8822 {
8823 if (!m_CheckOverheating)
8825
8827 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8828 }
8829
8830 CheckOverheating(this, "", this);
8831 }
8832
8833 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8834 {
8836 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8837 }
8838
8839 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8840 {
8842 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8844 }
8845
8846 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8847 {
8849 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8850 }
8851
8852 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8853 {
8855 m_OverheatingParticles = new array<ref OverheatingParticle>;
8856
8857 OverheatingParticle OP = new OverheatingParticle();
8858 OP.RegisterParticle(p);
8859 OP.SetOverheatingLimitMin(min_heat_coef);
8860 OP.SetOverheatingLimitMax(max_heat_coef);
8861 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8862
8863 m_OverheatingParticles.Insert(OP);
8864 }
8865
8866 float GetOverheatingCoef()
8867 {
8868 if (m_MaxOverheatingValue > 0)
8870
8871 return -1;
8872 }
8873
8875 {
8877 {
8878 float overheat_coef = GetOverheatingCoef();
8879 int count = m_OverheatingParticles.Count();
8880
8881 for (int i = count; i > 0; --i)
8882 {
8883 int id = i - 1;
8884 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8885 Particle p = OP.GetParticle();
8886
8887 float overheat_min = OP.GetOverheatingLimitMin();
8888 float overheat_max = OP.GetOverheatingLimitMax();
8889
8890 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8891 {
8892 if (p)
8893 {
8894 p.Stop();
8895 OP.RegisterParticle(null);
8896 }
8897 }
8898 }
8899 }
8900 }
8901
8903 {
8905 {
8906 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8907 {
8908 int id = i - 1;
8909 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8910
8911 if (OP)
8912 {
8913 Particle p = OP.GetParticle();
8914
8915 if (p)
8916 {
8917 p.Stop();
8918 }
8919
8920 delete OP;
8921 }
8922 }
8923
8924 m_OverheatingParticles.Clear();
8926 }
8927 }
8928
8930 float GetInfectionChance(int system = 0, Param param = null)
8931 {
8932 return 0.0;
8933 }
8934
8935
8936 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8937 {
8938 return 250;//default value
8939 }
8940
8941 float GetFilterDamageRatio()
8942 {
8943 return 0;
8944 }
8945
8947 bool HasMuzzle()
8948 {
8949 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8950 return true;
8951
8952 return false;
8953 }
8954
8956 int GetMuzzleID()
8957 {
8958 if (!m_WeaponTypeToID)
8960
8961 if (m_WeaponTypeToID.Contains(GetType()))
8962 {
8963 return m_WeaponTypeToID.Get(GetType());
8964 }
8965 else
8966 {
8967 // Register new weapon ID
8969 }
8970
8972 }
8973
8980 {
8981 return -1;
8982 }
8983
8984
8985
8986 // -------------------------------------------------------------------------
8987 void ~ItemBase()
8988 {
8989 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
8990 {
8991 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8992 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8993
8994 if (r_index >= 0)
8995 {
8996 InventoryLocation r_il = new InventoryLocation;
8997 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8998
8999 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9000 int r_type = r_il.GetType();
9001 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9002 {
9003 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9004 }
9005 else if (r_type == InventoryLocationType.ATTACHMENT)
9006 {
9007 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9008 }
9009
9010 }
9011
9012 player.GetHumanInventory().ClearUserReservedLocation(this);
9013 }
9014
9015 if (m_LockingSound)
9016 SEffectManager.DestroyEffect(m_LockingSound);
9017 }
9018
9019
9020
9021 // -------------------------------------------------------------------------
9022 static int GetDebugActionsMask()
9023 {
9024 return ItemBase.m_DebugActionsMask;
9025 }
9026
9027 static bool HasDebugActionsMask(int mask)
9028 {
9029 return ItemBase.m_DebugActionsMask & mask;
9030 }
9031
9032 static void SetDebugActionsMask(int mask)
9033 {
9034 ItemBase.m_DebugActionsMask = mask;
9035 }
9036
9037 static void AddDebugActionsMask(int mask)
9038 {
9039 ItemBase.m_DebugActionsMask |= mask;
9040 }
9041
9042 static void RemoveDebugActionsMask(int mask)
9043 {
9044 ItemBase.m_DebugActionsMask &= ~mask;
9045 }
9046
9047 static void ToggleDebugActionsMask(int mask)
9048 {
9049 if (HasDebugActionsMask(mask))
9050 {
9052 }
9053 else
9054 {
9055 AddDebugActionsMask(mask);
9056 }
9057 }
9058
9059 // -------------------------------------------------------------------------
9060 void SetCEBasedQuantity()
9061 {
9062 if (GetEconomyProfile())
9063 {
9064 float q_max = GetEconomyProfile().GetQuantityMax();
9065 if (q_max > 0)
9066 {
9067 float q_min = GetEconomyProfile().GetQuantityMin();
9068 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9069
9070 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9071 {
9072 ComponentEnergyManager comp = GetCompEM();
9073 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
9074 {
9075 comp.SetEnergy0To1(quantity_randomized);
9076 }
9077 }
9078 else if (HasQuantity())
9079 {
9080 SetQuantityNormalized(quantity_randomized, false);
9081 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9082 }
9083
9084 }
9085 }
9086 }
9087
9089 void LockToParent()
9090 {
9091 EntityAI parent = GetHierarchyParent();
9092
9093 if (parent)
9094 {
9095 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9096 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9097 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9098 }
9099 }
9100
9102 void UnlockFromParent()
9103 {
9104 EntityAI parent = GetHierarchyParent();
9105
9106 if (parent)
9107 {
9108 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9109 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9110 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9111 }
9112 }
9113
9114 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9115 {
9116 /*
9117 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9118 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9119 */
9120 ItemBase item2 = ItemBase.Cast(entity2);
9121
9122 if (GetGame().IsClient())
9123 {
9124 if (ScriptInputUserData.CanStoreInputUserData())
9125 {
9126 ScriptInputUserData ctx = new ScriptInputUserData;
9128 ctx.Write(-1);
9129 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9130 ctx.Write(i1);
9131 ctx.Write(item2);
9132 ctx.Write(use_stack_max);
9133 ctx.Write(-1);
9134 ctx.Send();
9135
9136 if (IsCombineAll(item2, use_stack_max))
9137 {
9138 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9139 }
9140 }
9141 }
9142 else if (!GetGame().IsMultiplayer())
9143 {
9144 CombineItems(item2, use_stack_max);
9145 }
9146 }
9147
9148 bool IsLiquidPresent()
9149 {
9150 return (GetLiquidType() != 0 && HasQuantity());
9151 }
9152
9153 bool IsLiquidContainer()
9154 {
9155 return m_LiquidContainerMask != 0;
9156 }
9157
9159 {
9160 return m_LiquidContainerMask;
9161 }
9162
9163 bool IsBloodContainer()
9164 {
9165 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9166 return false;
9167 }
9168
9169 bool IsNVG()
9170 {
9171 return false;
9172 }
9173
9176 bool IsExplosive()
9177 {
9178 return false;
9179 }
9180
9182 {
9183 return "";
9184 }
9185
9187
9188 bool IsLightSource()
9189 {
9190 return false;
9191 }
9192
9194 {
9195 return true;
9196 }
9197
9198 //--- ACTION CONDITIONS
9199 //direction
9200 bool IsFacingPlayer(PlayerBase player, string selection)
9201 {
9202 return true;
9203 }
9204
9205 bool IsPlayerInside(PlayerBase player, string selection)
9206 {
9207 return true;
9208 }
9209
9210 override bool CanObstruct()
9211 {
9212 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9213 return !player || !IsPlayerInside(player, "");
9214 }
9215
9216 override bool IsBeingPlaced()
9217 {
9218 return m_IsBeingPlaced;
9219 }
9220
9221 void SetIsBeingPlaced(bool is_being_placed)
9222 {
9223 m_IsBeingPlaced = is_being_placed;
9224 if (!is_being_placed)
9226 SetSynchDirty();
9227 }
9228
9229 //server-side
9230 void OnEndPlacement() {}
9231
9232 override bool IsHologram()
9233 {
9234 return m_IsHologram;
9235 }
9236
9237 bool CanBeDigged()
9238 {
9239 return m_CanBeDigged;
9240 }
9241
9243 {
9244 return 1;
9245 }
9246
9247 bool CanMakeGardenplot()
9248 {
9249 return false;
9250 }
9251
9252 void SetIsHologram(bool is_hologram)
9253 {
9254 m_IsHologram = is_hologram;
9255 SetSynchDirty();
9256 }
9257 /*
9258 protected float GetNutritionalEnergy()
9259 {
9260 Edible_Base edible = Edible_Base.Cast(this);
9261 return edible.GetFoodEnergy();
9262 }
9263
9264 protected float GetNutritionalWaterContent()
9265 {
9266 Edible_Base edible = Edible_Base.Cast(this);
9267 return edible.GetFoodWater();
9268 }
9269
9270 protected float GetNutritionalIndex()
9271 {
9272 Edible_Base edible = Edible_Base.Cast(this);
9273 return edible.GetFoodNutritionalIndex();
9274 }
9275
9276 protected float GetNutritionalFullnessIndex()
9277 {
9278 Edible_Base edible = Edible_Base.Cast(this);
9279 return edible.GetFoodTotalVolume();
9280 }
9281
9282 protected float GetNutritionalToxicity()
9283 {
9284 Edible_Base edible = Edible_Base.Cast(this);
9285 return edible.GetFoodToxicity();
9286
9287 }
9288 */
9289
9290
9291 // -------------------------------------------------------------------------
9292 override void OnMovedInsideCargo(EntityAI container)
9293 {
9294 super.OnMovedInsideCargo(container);
9295
9296 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9297 }
9298
9299 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9300 {
9301 super.EEItemLocationChanged(oldLoc,newLoc);
9302
9303 PlayerBase new_player = null;
9304 PlayerBase old_player = null;
9305
9306 if (newLoc.GetParent())
9307 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9308
9309 if (oldLoc.GetParent())
9310 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9311
9312 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9313 {
9314 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9315
9316 if (r_index >= 0)
9317 {
9318 InventoryLocation r_il = new InventoryLocation;
9319 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9320
9321 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9322 int r_type = r_il.GetType();
9323 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9324 {
9325 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9326 }
9327 else if (r_type == InventoryLocationType.ATTACHMENT)
9328 {
9329 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9330 }
9331
9332 }
9333 }
9334
9335 if (newLoc.GetType() == InventoryLocationType.HANDS)
9336 {
9337 if (new_player)
9338 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9339
9340 if (new_player == old_player)
9341 {
9342
9343 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9344 {
9345 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9346 {
9347 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9348 {
9349 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9350 }
9351 }
9352 else
9353 {
9354 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9355 }
9356 }
9357
9358 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9359 {
9360 int type = oldLoc.GetType();
9361 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9362 {
9363 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9364 }
9365 else if (type == InventoryLocationType.ATTACHMENT)
9366 {
9367 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9368 }
9369 }
9370 if (!m_OldLocation)
9371 {
9372 m_OldLocation = new InventoryLocation;
9373 }
9374 m_OldLocation.Copy(oldLoc);
9375 }
9376 else
9377 {
9378 if (m_OldLocation)
9379 {
9380 m_OldLocation.Reset();
9381 }
9382 }
9383
9385 }
9386 else
9387 {
9388 if (new_player)
9389 {
9390 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9391 if (res_index >= 0)
9392 {
9393 InventoryLocation il = new InventoryLocation;
9394 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9395 ItemBase it = ItemBase.Cast(il.GetItem());
9396 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9397 int rel_type = il.GetType();
9398 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9399 {
9400 il.GetParent().GetOnReleaseLock().Invoke(it);
9401 }
9402 else if (rel_type == InventoryLocationType.ATTACHMENT)
9403 {
9404 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9405 }
9406 //it.GetOnReleaseLock().Invoke(it);
9407 }
9408 }
9409 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9410 {
9411 //ThrowPhysically(old_player, vector.Zero);
9412 m_ThrowItemOnDrop = false;
9413 }
9414
9415 if (m_OldLocation)
9416 {
9417 m_OldLocation.Reset();
9418 }
9419 }
9420 }
9421
9422 override void EOnContact(IEntity other, Contact extra)
9423 {
9425 {
9426 int liquidType = -1;
9427 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9428 if (impactSpeed > 0.0)
9429 {
9430 m_ImpactSpeed = impactSpeed;
9431 #ifndef SERVER
9432 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9433 #else
9434 m_WantPlayImpactSound = true;
9435 SetSynchDirty();
9436 #endif
9437 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9438 }
9439 }
9440
9441 #ifdef SERVER
9442 if (GetCompEM() && GetCompEM().IsPlugged())
9443 {
9444 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9445 GetCompEM().UnplugThis();
9446 }
9447 #endif
9448 }
9449
9450 void RefreshPhysics();
9451
9452 override void OnCreatePhysics()
9453 {
9455 }
9456
9457 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9458 {
9459
9460 }
9461 // -------------------------------------------------------------------------
9462 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9463 {
9464 super.OnItemLocationChanged(old_owner, new_owner);
9465
9466 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9467 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9468
9469 if (!relatedPlayer && playerNew)
9470 relatedPlayer = playerNew;
9471
9472 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9473 {
9474 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9475 if (actionMgr)
9476 {
9477 ActionBase currentAction = actionMgr.GetRunningAction();
9478 if (currentAction)
9479 currentAction.OnItemLocationChanged(this);
9480 }
9481 }
9482
9483 Man ownerPlayerOld = null;
9484 Man ownerPlayerNew = null;
9485
9486 if (old_owner)
9487 {
9488 if (old_owner.IsMan())
9489 {
9490 ownerPlayerOld = Man.Cast(old_owner);
9491 }
9492 else
9493 {
9494 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9495 }
9496 }
9497 else
9498 {
9499 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9500 {
9501 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9502
9503 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9504 {
9505 GetCompEM().UnplugThis();
9506 }
9507 }
9508 }
9509
9510 if (new_owner)
9511 {
9512 if (new_owner.IsMan())
9513 {
9514 ownerPlayerNew = Man.Cast(new_owner);
9515 }
9516 else
9517 {
9518 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9519 }
9520 }
9521
9522 if (ownerPlayerOld != ownerPlayerNew)
9523 {
9524 if (ownerPlayerOld)
9525 {
9526 array<EntityAI> subItemsExit = new array<EntityAI>;
9527 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9528 for (int i = 0; i < subItemsExit.Count(); i++)
9529 {
9530 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9531 itemExit.OnInventoryExit(ownerPlayerOld);
9532 }
9533 }
9534
9535 if (ownerPlayerNew)
9536 {
9537 array<EntityAI> subItemsEnter = new array<EntityAI>;
9538 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9539 for (int j = 0; j < subItemsEnter.Count(); j++)
9540 {
9541 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9542 itemEnter.OnInventoryEnter(ownerPlayerNew);
9543 }
9544 }
9545 }
9546 else if (ownerPlayerNew != null)
9547 {
9548 PlayerBase nplayer;
9549 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9550 {
9551 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9552 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9553 for (int k = 0; k < subItemsUpdate.Count(); k++)
9554 {
9555 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9556 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9557 }
9558 }
9559 }
9560
9561 if (old_owner)
9562 old_owner.OnChildItemRemoved(this);
9563 if (new_owner)
9564 new_owner.OnChildItemReceived(this);
9565 }
9566
9567 // -------------------------------------------------------------------------------
9568 override void EEDelete(EntityAI parent)
9569 {
9570 super.EEDelete(parent);
9571 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9572 if (player)
9573 {
9574 OnInventoryExit(player);
9575
9576 if (player.IsAlive())
9577 {
9578 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9579 if (r_index >= 0)
9580 {
9581 InventoryLocation r_il = new InventoryLocation;
9582 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9583
9584 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9585 int r_type = r_il.GetType();
9586 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9587 {
9588 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9589 }
9590 else if (r_type == InventoryLocationType.ATTACHMENT)
9591 {
9592 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9593 }
9594
9595 }
9596
9597 player.RemoveQuickBarEntityShortcut(this);
9598 }
9599 }
9600 }
9601 // -------------------------------------------------------------------------------
9602 override void EEKilled(Object killer)
9603 {
9604 super.EEKilled(killer);
9605
9607 if (killer && killer.IsFireplace() && CanExplodeInFire())
9608 {
9609 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9610 {
9611 if (IsMagazine())
9612 {
9613 if (Magazine.Cast(this).GetAmmoCount() > 0)
9614 {
9615 ExplodeAmmo();
9616 }
9617 }
9618 else
9619 {
9620 Explode(DamageType.EXPLOSION);
9621 }
9622 }
9623 }
9624 }
9625
9626 override void OnWasAttached(EntityAI parent, int slot_id)
9627 {
9628 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9629
9630 super.OnWasAttached(parent, slot_id);
9631
9632 if (HasQuantity())
9633 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9634
9635 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9636 }
9637
9638 override void OnWasDetached(EntityAI parent, int slot_id)
9639 {
9640 super.OnWasDetached(parent, slot_id);
9641
9642 if (HasQuantity())
9643 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9644 }
9645
9646 override string ChangeIntoOnAttach(string slot)
9647 {
9648 int idx;
9649 TStringArray inventory_slots = new TStringArray;
9650 TStringArray attach_types = new TStringArray;
9651
9652 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9653 if (inventory_slots.Count() < 1) //is string
9654 {
9655 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9656 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9657 }
9658 else //is array
9659 {
9660 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9661 }
9662
9663 idx = inventory_slots.Find(slot);
9664 if (idx < 0)
9665 return "";
9666
9667 return attach_types.Get(idx);
9668 }
9669
9670 override string ChangeIntoOnDetach()
9671 {
9672 int idx = -1;
9673 string slot;
9674
9675 TStringArray inventory_slots = new TStringArray;
9676 TStringArray detach_types = new TStringArray;
9677
9678 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9679 if (inventory_slots.Count() < 1) //is string
9680 {
9681 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9682 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9683 }
9684 else //is array
9685 {
9686 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9687 if (detach_types.Count() < 1)
9688 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9689 }
9690
9691 for (int i = 0; i < inventory_slots.Count(); i++)
9692 {
9693 slot = inventory_slots.Get(i);
9694 }
9695
9696 if (slot != "")
9697 {
9698 if (detach_types.Count() == 1)
9699 idx = 0;
9700 else
9701 idx = inventory_slots.Find(slot);
9702 }
9703 if (idx < 0)
9704 return "";
9705
9706 return detach_types.Get(idx);
9707 }
9708
9709 void ExplodeAmmo()
9710 {
9711 //timer
9712 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
9713
9714 //min/max time
9715 float min_time = 1;
9716 float max_time = 3;
9717 float delay = Math.RandomFloat(min_time, max_time);
9718
9719 explode_timer.Run(delay, this, "DoAmmoExplosion");
9720 }
9721
9722 void DoAmmoExplosion()
9723 {
9724 Magazine magazine = Magazine.Cast(this);
9725 int pop_sounds_count = 6;
9726 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9727
9728 //play sound
9729 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9730 string sound_name = pop_sounds[ sound_idx ];
9731 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
9732
9733 //remove ammo count
9734 magazine.ServerAddAmmoCount(-1);
9735
9736 //if condition then repeat -> ExplodeAmmo
9737 float min_temp_to_explode = 100; //min temperature for item to explode
9738
9739 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
9740 {
9741 ExplodeAmmo();
9742 }
9743 }
9744
9745 // -------------------------------------------------------------------------------
9746 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9747 {
9748 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9749
9750 const int CHANCE_DAMAGE_CARGO = 4;
9751 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9752 const int CHANCE_DAMAGE_NOTHING = 2;
9753
9754 if (IsClothing() || IsContainer() || IsItemTent())
9755 {
9756 float dmg = damageResult.GetDamage("","Health") * -0.5;
9757 int chances;
9758 int rnd;
9759
9760 if (GetInventory().GetCargo())
9761 {
9762 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9763 rnd = Math.RandomInt(0,chances);
9764
9765 if (rnd < CHANCE_DAMAGE_CARGO)
9766 {
9767 DamageItemInCargo(dmg);
9768 }
9769 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9770 {
9772 }
9773 }
9774 else
9775 {
9776 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9777 rnd = Math.RandomInt(0,chances);
9778
9779 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9780 {
9782 }
9783 }
9784 }
9785 }
9786
9787 bool DamageItemInCargo(float damage)
9788 {
9789 if (GetInventory().GetCargo())
9790 {
9791 int item_count = GetInventory().GetCargo().GetItemCount();
9792 if (item_count > 0)
9793 {
9794 int random_pick = Math.RandomInt(0, item_count);
9795 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9796 if (!item.IsExplosive())
9797 {
9798 item.AddHealth("","",damage);
9799 return true;
9800 }
9801 }
9802 }
9803 return false;
9804 }
9805
9806 bool DamageItemAttachments(float damage)
9807 {
9808 int attachment_count = GetInventory().AttachmentCount();
9809 if (attachment_count > 0)
9810 {
9811 int random_pick = Math.RandomInt(0, attachment_count);
9812 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9813 if (!attachment.IsExplosive())
9814 {
9815 attachment.AddHealth("","",damage);
9816 return true;
9817 }
9818 }
9819 return false;
9820 }
9821
9822 override bool IsSplitable()
9823 {
9824 return m_CanThisBeSplit;
9825 }
9826 //----------------
9827 override bool CanBeSplit()
9828 {
9829 if (IsSplitable() && (GetQuantity() > 1))
9830 return GetInventory().CanRemoveEntity();
9831
9832 return false;
9833 }
9834
9835 protected bool ShouldSplitQuantity(float quantity)
9836 {
9837 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
9838 if (!IsSplitable())
9839 return false;
9840
9841 // nothing to split?
9842 if (GetQuantity() <= 1)
9843 return false;
9844
9845 // check if we should re-use the item instead of creating a new copy?
9846 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
9847 int delta = GetQuantity() - quantity;
9848 if (delta == 0)
9849 return false;
9850
9851 // valid to split
9852 return true;
9853 }
9854
9855 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9856 {
9857 if (GetGame().IsClient())
9858 {
9859 if (ScriptInputUserData.CanStoreInputUserData())
9860 {
9861 ScriptInputUserData ctx = new ScriptInputUserData;
9863 ctx.Write(1);
9864 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9865 ctx.Write(i1);
9866 ctx.Write(destination_entity);
9867 ctx.Write(true);
9868 ctx.Write(slot_id);
9869 ctx.Send();
9870 }
9871 }
9872 else if (!GetGame().IsMultiplayer())
9873 {
9874 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9875 }
9876 }
9877
9878 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9879 {
9880 float split_quantity_new;
9881 ItemBase new_item;
9882 float quantity = GetQuantity();
9883 float stack_max = GetTargetQuantityMax(slot_id);
9884 InventoryLocation loc = new InventoryLocation;
9885
9886 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9887 {
9888 if (stack_max <= GetQuantity())
9889 split_quantity_new = stack_max;
9890 else
9891 split_quantity_new = GetQuantity();
9892
9893 if (ShouldSplitQuantity(split_quantity_new))
9894 {
9895 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9896 if (new_item)
9897 {
9898 new_item.SetResultOfSplit(true);
9899 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9900 AddQuantity(-split_quantity_new, false, true);
9901 new_item.SetQuantity(split_quantity_new, false, true);
9902 }
9903 }
9904 }
9905 else if (destination_entity && slot_id == -1)
9906 {
9907 if (quantity > stack_max)
9908 split_quantity_new = stack_max;
9909 else
9910 split_quantity_new = quantity;
9911
9912 if (ShouldSplitQuantity(split_quantity_new))
9913 {
9914 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9915 {
9916 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9917 new_item = ItemBase.Cast(o);
9918 }
9919
9920 if (new_item)
9921 {
9922 new_item.SetResultOfSplit(true);
9923 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9924 AddQuantity(-split_quantity_new, false, true);
9925 new_item.SetQuantity(split_quantity_new, false, true);
9926 }
9927 }
9928 }
9929 else
9930 {
9931 if (stack_max != 0)
9932 {
9933 if (stack_max < GetQuantity())
9934 {
9935 split_quantity_new = GetQuantity() - stack_max;
9936 }
9937
9938 if (split_quantity_new == 0)
9939 {
9940 if (!GetGame().IsMultiplayer())
9941 player.PhysicalPredictiveDropItem(this);
9942 else
9943 player.ServerDropEntity(this);
9944 return;
9945 }
9946
9947 if (ShouldSplitQuantity(split_quantity_new))
9948 {
9949 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9950
9951 if (new_item)
9952 {
9953 new_item.SetResultOfSplit(true);
9954 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9955 SetQuantity(split_quantity_new, false, true);
9956 new_item.SetQuantity(stack_max, false, true);
9957 new_item.PlaceOnSurface();
9958 }
9959 }
9960 }
9961 }
9962 }
9963
9964 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9965 {
9966 float split_quantity_new;
9967 ItemBase new_item;
9968 float quantity = GetQuantity();
9969 float stack_max = GetTargetQuantityMax(slot_id);
9970 InventoryLocation loc = new InventoryLocation;
9971
9972 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9973 {
9974 if (stack_max <= GetQuantity())
9975 split_quantity_new = stack_max;
9976 else
9977 split_quantity_new = GetQuantity();
9978
9979 if (ShouldSplitQuantity(split_quantity_new))
9980 {
9981 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9982 if (new_item)
9983 {
9984 new_item.SetResultOfSplit(true);
9985 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9986 AddQuantity(-split_quantity_new, false, true);
9987 new_item.SetQuantity(split_quantity_new, false, true);
9988 }
9989 }
9990 }
9991 else if (destination_entity && slot_id == -1)
9992 {
9993 if (quantity > stack_max)
9994 split_quantity_new = stack_max;
9995 else
9996 split_quantity_new = quantity;
9997
9998 if (ShouldSplitQuantity(split_quantity_new))
9999 {
10000 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10001 {
10002 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10003 new_item = ItemBase.Cast(o);
10004 }
10005
10006 if (new_item)
10007 {
10008 new_item.SetResultOfSplit(true);
10009 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10010 AddQuantity(-split_quantity_new, false, true);
10011 new_item.SetQuantity(split_quantity_new, false, true);
10012 }
10013 }
10014 }
10015 else
10016 {
10017 if (stack_max != 0)
10018 {
10019 if (stack_max < GetQuantity())
10020 {
10021 split_quantity_new = GetQuantity() - stack_max;
10022 }
10023
10024 if (ShouldSplitQuantity(split_quantity_new))
10025 {
10026 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10027
10028 if (new_item)
10029 {
10030 new_item.SetResultOfSplit(true);
10031 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10032 SetQuantity(split_quantity_new, false, true);
10033 new_item.SetQuantity(stack_max, false, true);
10034 new_item.PlaceOnSurface();
10035 }
10036 }
10037 }
10038 }
10039 }
10040
10041 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10042 {
10043 if (GetGame().IsClient())
10044 {
10045 if (ScriptInputUserData.CanStoreInputUserData())
10046 {
10047 ScriptInputUserData ctx = new ScriptInputUserData;
10049 ctx.Write(4);
10050 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10051 ctx.Write(thiz);
10052 dst.WriteToContext(ctx);
10053 ctx.Send();
10054 }
10055 }
10056 else if (!GetGame().IsMultiplayer())
10057 {
10059 }
10060 }
10061
10062 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10063 {
10064 if (GetGame().IsClient())
10065 {
10066 if (ScriptInputUserData.CanStoreInputUserData())
10067 {
10068 ScriptInputUserData ctx = new ScriptInputUserData;
10070 ctx.Write(2);
10071 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10072 ctx.Write(dummy);
10073 ctx.Write(destination_entity);
10074 ctx.Write(true);
10075 ctx.Write(idx);
10076 ctx.Write(row);
10077 ctx.Write(col);
10078 ctx.Send();
10079 }
10080 }
10081 else if (!GetGame().IsMultiplayer())
10082 {
10083 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10084 }
10085 }
10086
10087 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10088 {
10090 }
10091
10092 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10093 {
10094 float quantity = GetQuantity();
10095 float split_quantity_new;
10096 ItemBase new_item;
10097 if (dst.IsValid())
10098 {
10099 int slot_id = dst.GetSlot();
10100 float stack_max = GetTargetQuantityMax(slot_id);
10101
10102 if (quantity > stack_max)
10103 split_quantity_new = stack_max;
10104 else
10105 split_quantity_new = quantity;
10106
10107 if (ShouldSplitQuantity(split_quantity_new))
10108 {
10109 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10110
10111 if (new_item)
10112 {
10113 new_item.SetResultOfSplit(true);
10114 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10115 AddQuantity(-split_quantity_new, false, true);
10116 new_item.SetQuantity(split_quantity_new, false, true);
10117 }
10118
10119 return new_item;
10120 }
10121 }
10122
10123 return null;
10124 }
10125
10126 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10127 {
10128 float quantity = GetQuantity();
10129 float split_quantity_new;
10130 ItemBase new_item;
10131 if (destination_entity)
10132 {
10133 float stackable = GetTargetQuantityMax();
10134 if (quantity > stackable)
10135 split_quantity_new = stackable;
10136 else
10137 split_quantity_new = quantity;
10138
10139 if (ShouldSplitQuantity(split_quantity_new))
10140 {
10141 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10142 if (new_item)
10143 {
10144 new_item.SetResultOfSplit(true);
10145 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10146 AddQuantity(-split_quantity_new, false, true);
10147 new_item.SetQuantity(split_quantity_new, false, true);
10148 }
10149 }
10150 }
10151 }
10152
10153 void SplitIntoStackMaxHandsClient(PlayerBase player)
10154 {
10155 if (GetGame().IsClient())
10156 {
10157 if (ScriptInputUserData.CanStoreInputUserData())
10158 {
10159 ScriptInputUserData ctx = new ScriptInputUserData;
10161 ctx.Write(3);
10162 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10163 ctx.Write(i1);
10164 ItemBase destination_entity = this;
10165 ctx.Write(destination_entity);
10166 ctx.Write(true);
10167 ctx.Write(0);
10168 ctx.Send();
10169 }
10170 }
10171 else if (!GetGame().IsMultiplayer())
10172 {
10173 SplitIntoStackMaxHands(player);
10174 }
10175 }
10176
10177 void SplitIntoStackMaxHands(PlayerBase player)
10178 {
10179 float quantity = GetQuantity();
10180 float split_quantity_new;
10181 ref ItemBase new_item;
10182 if (player)
10183 {
10184 float stackable = GetTargetQuantityMax();
10185 if (quantity > stackable)
10186 split_quantity_new = stackable;
10187 else
10188 split_quantity_new = quantity;
10189
10190 if (ShouldSplitQuantity(split_quantity_new))
10191 {
10192 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10193 new_item = ItemBase.Cast(in_hands);
10194 if (new_item)
10195 {
10196 new_item.SetResultOfSplit(true);
10197 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10198 AddQuantity(-split_quantity_new, false, true);
10199 new_item.SetQuantity(split_quantity_new, false, true);
10200 }
10201 }
10202 }
10203 }
10204
10205 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10206 {
10207 float quantity = GetQuantity();
10208 float split_quantity_new = Math.Floor(quantity * 0.5);
10209
10210 if (!ShouldSplitQuantity(split_quantity_new))
10211 return;
10212
10213 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10214
10215 if (new_item)
10216 {
10217 if (new_item.GetQuantityMax() < split_quantity_new)
10218 {
10219 split_quantity_new = new_item.GetQuantityMax();
10220 }
10221
10222 new_item.SetResultOfSplit(true);
10223 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10224
10225 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10226 {
10227 AddQuantity(-1, false, true);
10228 new_item.SetQuantity(1, false, true);
10229 }
10230 else
10231 {
10232 AddQuantity(-split_quantity_new, false, true);
10233 new_item.SetQuantity(split_quantity_new, false, true);
10234 }
10235 }
10236 }
10237
10238 void SplitItem(PlayerBase player)
10239 {
10240 float quantity = GetQuantity();
10241 float split_quantity_new = Math.Floor(quantity / 2);
10242
10243 if (!ShouldSplitQuantity(split_quantity_new))
10244 return;
10245
10246 InventoryLocation invloc = new InventoryLocation;
10247 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10248
10249 ItemBase new_item;
10250 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10251
10252 if (new_item)
10253 {
10254 if (new_item.GetQuantityMax() < split_quantity_new)
10255 {
10256 split_quantity_new = new_item.GetQuantityMax();
10257 }
10258 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10259 {
10260 AddQuantity(-1, false, true);
10261 new_item.SetQuantity(1, false, true);
10262 }
10263 else if (split_quantity_new > 1)
10264 {
10265 AddQuantity(-split_quantity_new, false, true);
10266 new_item.SetQuantity(split_quantity_new, false, true);
10267 }
10268 }
10269 }
10270
10272 void OnQuantityChanged(float delta)
10273 {
10274 SetWeightDirty();
10275 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10276
10277 if (parent)
10278 parent.OnAttachmentQuantityChangedEx(this, delta);
10279
10280 if (IsLiquidContainer())
10281 {
10282 if (GetQuantityNormalized() <= 0.0)
10283 {
10285 }
10286 else if (GetLiquidType() == LIQUID_NONE)
10287 {
10288 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10290 }
10291 }
10292
10293 }
10294
10297 {
10298 // insert code here
10299 }
10300
10302 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10303 {
10305 }
10306
10307 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10308 {
10309 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10310
10311 if (GetGame().IsServer())
10312 {
10313 if (newLevel == GameConstants.STATE_RUINED)
10314 {
10316 EntityAI parent = GetHierarchyParent();
10317 if (parent && parent.IsFireplace())
10318 {
10319 CargoBase cargo = GetInventory().GetCargo();
10320 if (cargo)
10321 {
10322 for (int i = 0; i < cargo.GetItemCount(); ++i)
10323 {
10324 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10325 }
10326 }
10327 }
10328 }
10329
10330 if (IsResultOfSplit())
10331 {
10332 // reset the splitting result flag, return to normal item behavior
10333 SetResultOfSplit(false);
10334 return;
10335 }
10336
10337 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10338 {
10339 SetCleanness(0);//unclean the item upon damage dealt
10340 }
10341 }
10342 }
10343
10344 // just the split? TODO: verify
10345 override void OnRightClick()
10346 {
10347 super.OnRightClick();
10348
10349 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10350 {
10351 if (GetGame().IsClient())
10352 {
10353 if (ScriptInputUserData.CanStoreInputUserData())
10354 {
10355 EntityAI root = GetHierarchyRoot();
10356 Man playerOwner = GetHierarchyRootPlayer();
10357 InventoryLocation dst = new InventoryLocation;
10358
10359 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
10360 if (!playerOwner && root && root == this)
10361 {
10363 }
10364 else
10365 {
10366 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
10367 GetInventory().GetCurrentInventoryLocation(dst);
10368 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
10369 {
10370 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10371 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
10372 {
10374 }
10375 else
10376 {
10377 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10378 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10379 this shouldnt cause issues within this scope*/
10380 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10381 {
10383 }
10384 else
10385 {
10386 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10387 }
10388 }
10389 }
10390 }
10391
10392 ScriptInputUserData ctx = new ScriptInputUserData;
10394 ctx.Write(4);
10395 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10396 ctx.Write(thiz);
10397 dst.WriteToContext(ctx);
10398 ctx.Write(true); // dummy
10399 ctx.Send();
10400 }
10401 }
10402 else if (!GetGame().IsMultiplayer())
10403 {
10404 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10405 }
10406 }
10407 }
10408
10409 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
10410 {
10411 if (root)
10412 {
10413 vector m4[4];
10414 root.GetTransform(m4);
10415 dst.SetGround(this, m4);
10416 }
10417 else
10418 {
10419 GetInventory().GetCurrentInventoryLocation(dst);
10420 }
10421 }
10422
10423 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10424 {
10425 //TODO: delete check zero quantity check after fix double posts hands fsm events
10426 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10427 return false;
10428
10429 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10430 return false;
10431
10432 //can_this_be_combined = ConfigGetBool("canBeSplit");
10434 return false;
10435
10436
10437 Magazine mag = Magazine.Cast(this);
10438 if (mag)
10439 {
10440 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10441 return false;
10442
10443 if (stack_max_limit)
10444 {
10445 Magazine other_mag = Magazine.Cast(other_item);
10446 if (other_item)
10447 {
10448 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10449 return false;
10450 }
10451
10452 }
10453 }
10454 else
10455 {
10456 //TODO: delete check zero quantity check after fix double posts hands fsm events
10457 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10458 return false;
10459
10460 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10461 return false;
10462 }
10463
10464 PlayerBase player = null;
10465 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10466 {
10467 if (player.GetInventory().HasAttachment(this))
10468 return false;
10469
10470 if (player.IsItemsToDelete())
10471 return false;
10472 }
10473
10474 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10475 return false;
10476
10477 int slotID;
10478 string slotName;
10479 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10480 return false;
10481
10482 return true;
10483 }
10484
10485 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10486 {
10487 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10488 }
10489
10490 bool IsResultOfSplit()
10491 {
10492 return m_IsResultOfSplit;
10493 }
10494
10495 void SetResultOfSplit(bool value)
10496 {
10497 m_IsResultOfSplit = value;
10498 }
10499
10500 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10501 {
10502 return ComputeQuantityUsedEx(other_item, use_stack_max);
10503 }
10504
10505 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10506 {
10507 float other_item_quantity = other_item.GetQuantity();
10508 float this_free_space;
10509
10510 float stack_max = GetQuantityMax();
10511
10512 this_free_space = stack_max - GetQuantity();
10513
10514 if (other_item_quantity > this_free_space)
10515 {
10516 return this_free_space;
10517 }
10518 else
10519 {
10520 return other_item_quantity;
10521 }
10522 }
10523
10524 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10525 {
10526 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10527 }
10528
10529 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10530 {
10531 if (!CanBeCombined(other_item, false))
10532 return;
10533
10534 if (!IsMagazine() && other_item)
10535 {
10536 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10537 if (quantity_used != 0)
10538 {
10539 float hp1 = GetHealth01("","");
10540 float hp2 = other_item.GetHealth01("","");
10541 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10542 hpResult = hpResult / (GetQuantity() + quantity_used);
10543
10544 hpResult *= GetMaxHealth();
10545 Math.Round(hpResult);
10546 SetHealth("", "Health", hpResult);
10547
10548 AddQuantity(quantity_used);
10549 other_item.AddQuantity(-quantity_used);
10550 }
10551 }
10552 OnCombine(other_item);
10553 }
10554
10555 void OnCombine(ItemBase other_item)
10556 {
10557 #ifdef SERVER
10558 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10559 GetHierarchyParent().IncreaseLifetimeUp();
10560 #endif
10561 };
10562
10563 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10564 {
10565 PlayerBase p = PlayerBase.Cast(player);
10566
10567 array<int> recipesIds = p.m_Recipes;
10568 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10569 if (moduleRecipesManager)
10570 {
10571 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10572 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10573 }
10574
10575 for (int i = 0;i < recipesIds.Count(); i++)
10576 {
10577 int key = recipesIds.Get(i);
10578 string recipeName = moduleRecipesManager.GetRecipeName(key);
10579 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10580 }
10581 }
10582
10583 // -------------------------------------------------------------------------
10584 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10585 {
10586 super.GetDebugActions(outputList);
10587
10588 //quantity
10589 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10590 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10591 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10592 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10593 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10594
10595 //health
10596 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10597 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10598 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10599 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10600 //temperature
10601 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10602 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10603 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10604 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10605
10606 //wet
10607 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10608 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10609 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10610
10611 //liquidtype
10612 if (IsLiquidContainer())
10613 {
10614 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10615 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10616 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10617 }
10618
10619 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10620 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10621
10622 // watch
10623 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10624 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10625 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10626
10627 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10628
10629 InventoryLocation loc = new InventoryLocation();
10630 GetInventory().GetCurrentInventoryLocation(loc);
10631 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
10632 {
10633 if (Gizmo_IsSupported())
10634 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
10635 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
10636 }
10637
10638 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10639 }
10640
10641 // -------------------------------------------------------------------------
10642 // -------------------------------------------------------------------------
10643 // -------------------------------------------------------------------------
10644 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10645 {
10646 super.OnAction(action_id, player, ctx);
10647
10648 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
10649 {
10650 switch (action_id)
10651 {
10652 case EActions.GIZMO_OBJECT:
10653 GetGame().GizmoSelectObject(this);
10654 return true;
10655 case EActions.GIZMO_PHYSICS:
10656 GetGame().GizmoSelectPhysics(GetPhysics());
10657 return true;
10658 }
10659 }
10660
10661 if (GetGame().IsServer())
10662 {
10663 switch (action_id)
10664 {
10665 case EActions.DELETE:
10666 Delete();
10667 return true;
10668 }
10669 }
10670
10671 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10672 {
10673 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10674 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10675 PlayerBase p = PlayerBase.Cast(player);
10676 if (EActions.RECIPES_RANGE_START < 1000)
10677 {
10678 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10679 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10680 }
10681 }
10682 #ifndef SERVER
10683 else if (action_id == EActions.WATCH_PLAYER)
10684 {
10685 PluginDeveloper.SetDeveloperItemClientEx(player);
10686 }
10687 #endif
10688 if (GetGame().IsServer())
10689 {
10690 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10691 {
10692 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10693 OnDebugButtonPressServer(id + 1);
10694 }
10695
10696 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10697 {
10698 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10699 InsertAgent(agent_id,100);
10700 }
10701
10702 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10703 {
10704 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10705 RemoveAgent(agent_id2);
10706 }
10707
10708 else if (action_id == EActions.ADD_QUANTITY)
10709 {
10710 if (IsMagazine())
10711 {
10712 Magazine mag = Magazine.Cast(this);
10713 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10714 }
10715 else
10716 {
10717 AddQuantity(GetQuantityMax() * 0.2);
10718 }
10719
10720 if (m_EM)
10721 {
10722 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10723 }
10724 //PrintVariables();
10725 }
10726
10727 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10728 {
10729 if (IsMagazine())
10730 {
10731 Magazine mag2 = Magazine.Cast(this);
10732 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10733 }
10734 else
10735 {
10736 AddQuantity(- GetQuantityMax() * 0.2);
10737 }
10738 if (m_EM)
10739 {
10740 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10741 }
10742 //PrintVariables();
10743 }
10744
10745 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10746 {
10747 SetQuantity(0);
10748
10749 if (m_EM)
10750 {
10751 m_EM.SetEnergy(0);
10752 }
10753 }
10754
10755 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10756 {
10758
10759 if (m_EM)
10760 {
10761 m_EM.SetEnergy(m_EM.GetEnergyMax());
10762 }
10763 }
10764
10765 else if (action_id == EActions.ADD_HEALTH)
10766 {
10767 AddHealth("","",GetMaxHealth("","Health")/5);
10768 }
10769 else if (action_id == EActions.REMOVE_HEALTH)
10770 {
10771 AddHealth("","",-GetMaxHealth("","Health")/5);
10772 }
10773 else if (action_id == EActions.DESTROY_HEALTH)
10774 {
10775 SetHealth01("","",0);
10776 }
10777 else if (action_id == EActions.WATCH_ITEM)
10778 {
10780 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10781 #ifdef DEVELOPER
10782 SetDebugDeveloper_item(this);
10783 #endif
10784 }
10785
10786 else if (action_id == EActions.ADD_TEMPERATURE)
10787 {
10788 AddTemperature(20);
10789 //PrintVariables();
10790 }
10791
10792 else if (action_id == EActions.REMOVE_TEMPERATURE)
10793 {
10794 AddTemperature(-20);
10795 //PrintVariables();
10796 }
10797
10798 else if (action_id == EActions.FLIP_FROZEN)
10799 {
10800 SetFrozen(!GetIsFrozen());
10801 //PrintVariables();
10802 }
10803
10804 else if (action_id == EActions.ADD_WETNESS)
10805 {
10806 AddWet(GetWetMax()/5);
10807 //PrintVariables();
10808 }
10809
10810 else if (action_id == EActions.REMOVE_WETNESS)
10811 {
10812 AddWet(-GetWetMax()/5);
10813 //PrintVariables();
10814 }
10815
10816 else if (action_id == EActions.LIQUIDTYPE_UP)
10817 {
10818 int curr_type = GetLiquidType();
10819 SetLiquidType(curr_type * 2);
10820 //AddWet(1);
10821 //PrintVariables();
10822 }
10823
10824 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10825 {
10826 int curr_type2 = GetLiquidType();
10827 SetLiquidType(curr_type2 / 2);
10828 }
10829
10830 else if (action_id == EActions.MAKE_SPECIAL)
10831 {
10832 auto debugParams = DebugSpawnParams.WithPlayer(player);
10833 OnDebugSpawnEx(debugParams);
10834 }
10835
10836 }
10837
10838
10839 return false;
10840 }
10841
10842 // -------------------------------------------------------------------------
10843
10844
10847 void OnActivatedByTripWire();
10848
10850 void OnActivatedByItem(notnull ItemBase item);
10851
10852 //----------------------------------------------------------------
10853 //returns true if item is able to explode when put in fire
10854 bool CanExplodeInFire()
10855 {
10856 return false;
10857 }
10858
10859 //----------------------------------------------------------------
10860 bool CanEat()
10861 {
10862 return true;
10863 }
10864
10865 //----------------------------------------------------------------
10866 override bool IsIgnoredByConstruction()
10867 {
10868 return true;
10869 }
10870
10871 //----------------------------------------------------------------
10872 //has FoodStages in config?
10873 bool HasFoodStage()
10874 {
10875 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10876 return GetGame().ConfigIsExisting(config_path);
10877 }
10878
10880 FoodStage GetFoodStage()
10881 {
10882 return null;
10883 }
10884
10885 bool CanBeCooked()
10886 {
10887 return false;
10888 }
10889
10890 bool CanBeCookedOnStick()
10891 {
10892 return false;
10893 }
10894
10896 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10898
10899 //----------------------------------------------------------------
10900 bool CanRepair(ItemBase item_repair_kit)
10901 {
10902 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10903 return module_repairing.CanRepair(this, item_repair_kit);
10904 }
10905
10906 //----------------------------------------------------------------
10907 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10908 {
10909 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10910 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10911 }
10912
10913 //----------------------------------------------------------------
10914 int GetItemSize()
10915 {
10916 /*
10917 vector v_size = this.ConfigGetVector("itemSize");
10918 int v_size_x = v_size[0];
10919 int v_size_y = v_size[1];
10920 int size = v_size_x * v_size_y;
10921 return size;
10922 */
10923
10924 return 1;
10925 }
10926
10927 //----------------------------------------------------------------
10928 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10929 bool CanBeMovedOverride()
10930 {
10931 return m_CanBeMovedOverride;
10932 }
10933
10934 //----------------------------------------------------------------
10935 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10936 void SetCanBeMovedOverride(bool setting)
10937 {
10938 m_CanBeMovedOverride = setting;
10939 }
10940
10941 //----------------------------------------------------------------
10949 void MessageToOwnerStatus(string text)
10950 {
10951 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10952
10953 if (player)
10954 {
10955 player.MessageStatus(text);
10956 }
10957 }
10958
10959 //----------------------------------------------------------------
10967 void MessageToOwnerAction(string text)
10968 {
10969 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10970
10971 if (player)
10972 {
10973 player.MessageAction(text);
10974 }
10975 }
10976
10977 //----------------------------------------------------------------
10985 void MessageToOwnerFriendly(string text)
10986 {
10987 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10988
10989 if (player)
10990 {
10991 player.MessageFriendly(text);
10992 }
10993 }
10994
10995 //----------------------------------------------------------------
11003 void MessageToOwnerImportant(string text)
11004 {
11005 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11006
11007 if (player)
11008 {
11009 player.MessageImportant(text);
11010 }
11011 }
11012
11013 override bool IsItemBase()
11014 {
11015 return true;
11016 }
11017
11018 // Checks if item is of questioned kind
11019 override bool KindOf(string tag)
11020 {
11021 bool found = false;
11022 string item_name = this.GetType();
11023 ref TStringArray item_tag_array = new TStringArray;
11024 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11025
11026 int array_size = item_tag_array.Count();
11027 for (int i = 0; i < array_size; i++)
11028 {
11029 if (item_tag_array.Get(i) == tag)
11030 {
11031 found = true;
11032 break;
11033 }
11034 }
11035 return found;
11036 }
11037
11038
11039 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11040 {
11041 //Debug.Log("OnRPC called");
11042 super.OnRPC(sender, rpc_type,ctx);
11043
11044 //Play soundset for attachment locking (ActionLockAttachment.c)
11045 switch (rpc_type)
11046 {
11047 #ifndef SERVER
11048 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11049 Param2<bool, string> p = new Param2<bool, string>(false, "");
11050
11051 if (!ctx.Read(p))
11052 return;
11053
11054 bool play = p.param1;
11055 string soundSet = p.param2;
11056
11057 if (play)
11058 {
11059 if (m_LockingSound)
11060 {
11062 {
11063 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11064 }
11065 }
11066 else
11067 {
11068 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11069 }
11070 }
11071 else
11072 {
11073 SEffectManager.DestroyEffect(m_LockingSound);
11074 }
11075
11076 break;
11077 #endif
11078
11079 }
11080
11081 if (GetWrittenNoteData())
11082 {
11083 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11084 }
11085 }
11086
11087 //-----------------------------
11088 // VARIABLE MANIPULATION SYSTEM
11089 //-----------------------------
11090 int NameToID(string name)
11091 {
11092 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11093 return plugin.GetID(name);
11094 }
11095
11096 string IDToName(int id)
11097 {
11098 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11099 return plugin.GetName(id);
11100 }
11101
11103 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11104 {
11105 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11106 //read the flags
11107 int varFlags;
11108 if (!ctx.Read(varFlags))
11109 return;
11110
11111 if (varFlags & ItemVariableFlags.FLOAT)
11112 {
11113 ReadVarsFromCTX(ctx);
11114 }
11115 }
11116
11117 override void SerializeNumericalVars(array<float> floats_out)
11118 {
11119 //some variables handled on EntityAI level already!
11120 super.SerializeNumericalVars(floats_out);
11121
11122 // the order of serialization must be the same as the order of de-serialization
11123 //--------------------------------------------
11124 if (IsVariableSet(VARIABLE_QUANTITY))
11125 {
11126 floats_out.Insert(m_VarQuantity);
11127 }
11128 //--------------------------------------------
11129 if (IsVariableSet(VARIABLE_WET))
11130 {
11131 floats_out.Insert(m_VarWet);
11132 }
11133 //--------------------------------------------
11134 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11135 {
11136 floats_out.Insert(m_VarLiquidType);
11137 }
11138 //--------------------------------------------
11139 if (IsVariableSet(VARIABLE_COLOR))
11140 {
11141 floats_out.Insert(m_ColorComponentR);
11142 floats_out.Insert(m_ColorComponentG);
11143 floats_out.Insert(m_ColorComponentB);
11144 floats_out.Insert(m_ColorComponentA);
11145 }
11146 //--------------------------------------------
11147 if (IsVariableSet(VARIABLE_CLEANNESS))
11148 {
11149 floats_out.Insert(m_Cleanness);
11150 }
11151 }
11152
11153 override void DeSerializeNumericalVars(array<float> floats)
11154 {
11155 //some variables handled on EntityAI level already!
11156 super.DeSerializeNumericalVars(floats);
11157
11158 // the order of serialization must be the same as the order of de-serialization
11159 int index = 0;
11160 int mask = Math.Round(floats.Get(index));
11161
11162 index++;
11163 //--------------------------------------------
11164 if (mask & VARIABLE_QUANTITY)
11165 {
11166 if (m_IsStoreLoad)
11167 {
11168 SetStoreLoadedQuantity(floats.Get(index));
11169 }
11170 else
11171 {
11172 float quantity = floats.Get(index);
11173 SetQuantity(quantity, true, false, false, false);
11174 }
11175 index++;
11176 }
11177 //--------------------------------------------
11178 if (mask & VARIABLE_WET)
11179 {
11180 float wet = floats.Get(index);
11181 SetWet(wet);
11182 index++;
11183 }
11184 //--------------------------------------------
11185 if (mask & VARIABLE_LIQUIDTYPE)
11186 {
11187 int liquidtype = Math.Round(floats.Get(index));
11188 SetLiquidType(liquidtype);
11189 index++;
11190 }
11191 //--------------------------------------------
11192 if (mask & VARIABLE_COLOR)
11193 {
11194 m_ColorComponentR = Math.Round(floats.Get(index));
11195 index++;
11196 m_ColorComponentG = Math.Round(floats.Get(index));
11197 index++;
11198 m_ColorComponentB = Math.Round(floats.Get(index));
11199 index++;
11200 m_ColorComponentA = Math.Round(floats.Get(index));
11201 index++;
11202 }
11203 //--------------------------------------------
11204 if (mask & VARIABLE_CLEANNESS)
11205 {
11206 int cleanness = Math.Round(floats.Get(index));
11207 SetCleanness(cleanness);
11208 index++;
11209 }
11210 }
11211
11212 override void WriteVarsToCTX(ParamsWriteContext ctx)
11213 {
11214 super.WriteVarsToCTX(ctx);
11215
11216 //--------------------------------------------
11217 if (IsVariableSet(VARIABLE_QUANTITY))
11218 {
11219 ctx.Write(GetQuantity());
11220 }
11221 //--------------------------------------------
11222 if (IsVariableSet(VARIABLE_WET))
11223 {
11224 ctx.Write(GetWet());
11225 }
11226 //--------------------------------------------
11227 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11228 {
11229 ctx.Write(GetLiquidType());
11230 }
11231 //--------------------------------------------
11232 if (IsVariableSet(VARIABLE_COLOR))
11233 {
11234 int r,g,b,a;
11235 GetColor(r,g,b,a);
11236 ctx.Write(r);
11237 ctx.Write(g);
11238 ctx.Write(b);
11239 ctx.Write(a);
11240 }
11241 //--------------------------------------------
11242 if (IsVariableSet(VARIABLE_CLEANNESS))
11243 {
11244 ctx.Write(GetCleanness());
11245 }
11246 }
11247
11248 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11249 {
11250 if (!super.ReadVarsFromCTX(ctx,version))
11251 return false;
11252
11253 int intValue;
11254 float value;
11255
11256 if (version < 140)
11257 {
11258 if (!ctx.Read(intValue))
11259 return false;
11260
11261 m_VariablesMask = intValue;
11262 }
11263
11264 if (m_VariablesMask & VARIABLE_QUANTITY)
11265 {
11266 if (!ctx.Read(value))
11267 return false;
11268
11269 if (IsStoreLoad())
11270 {
11272 }
11273 else
11274 {
11275 SetQuantity(value, true, false, false, false);
11276 }
11277 }
11278 //--------------------------------------------
11279 if (version < 140)
11280 {
11281 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11282 {
11283 if (!ctx.Read(value))
11284 return false;
11285 SetTemperatureDirect(value);
11286 }
11287 }
11288 //--------------------------------------------
11289 if (m_VariablesMask & VARIABLE_WET)
11290 {
11291 if (!ctx.Read(value))
11292 return false;
11293 SetWet(value);
11294 }
11295 //--------------------------------------------
11296 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11297 {
11298 if (!ctx.Read(intValue))
11299 return false;
11300 SetLiquidType(intValue);
11301 }
11302 //--------------------------------------------
11303 if (m_VariablesMask & VARIABLE_COLOR)
11304 {
11305 int r,g,b,a;
11306 if (!ctx.Read(r))
11307 return false;
11308 if (!ctx.Read(g))
11309 return false;
11310 if (!ctx.Read(b))
11311 return false;
11312 if (!ctx.Read(a))
11313 return false;
11314
11315 SetColor(r,g,b,a);
11316 }
11317 //--------------------------------------------
11318 if (m_VariablesMask & VARIABLE_CLEANNESS)
11319 {
11320 if (!ctx.Read(intValue))
11321 return false;
11322 SetCleanness(intValue);
11323 }
11324 //--------------------------------------------
11325 if (version >= 138 && version < 140)
11326 {
11327 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11328 {
11329 if (!ctx.Read(intValue))
11330 return false;
11331 SetFrozen(intValue);
11332 }
11333 }
11334
11335 return true;
11336 }
11337
11338 //----------------------------------------------------------------
11339 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11340 {
11341 m_IsStoreLoad = true;
11343 {
11344 m_FixDamageSystemInit = true;
11345 }
11346
11347 if (!super.OnStoreLoad(ctx, version))
11348 {
11349 m_IsStoreLoad = false;
11350 return false;
11351 }
11352
11353 if (version >= 114)
11354 {
11355 bool hasQuickBarIndexSaved;
11356
11357 if (!ctx.Read(hasQuickBarIndexSaved))
11358 {
11359 m_IsStoreLoad = false;
11360 return false;
11361 }
11362
11363 if (hasQuickBarIndexSaved)
11364 {
11365 int itmQBIndex;
11366
11367 //Load quickbar item bind
11368 if (!ctx.Read(itmQBIndex))
11369 {
11370 m_IsStoreLoad = false;
11371 return false;
11372 }
11373
11374 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11375 if (itmQBIndex != -1 && parentPlayer)
11376 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11377 }
11378 }
11379 else
11380 {
11381 // Backup of how it used to be
11382 PlayerBase player;
11383 int itemQBIndex;
11384 if (version == int.MAX)
11385 {
11386 if (!ctx.Read(itemQBIndex))
11387 {
11388 m_IsStoreLoad = false;
11389 return false;
11390 }
11391 }
11392 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11393 {
11394 //Load quickbar item bind
11395 if (!ctx.Read(itemQBIndex))
11396 {
11397 m_IsStoreLoad = false;
11398 return false;
11399 }
11400 if (itemQBIndex != -1 && player)
11401 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11402 }
11403 }
11404
11405 if (version < 140)
11406 {
11407 // variable management system
11408 if (!LoadVariables(ctx, version))
11409 {
11410 m_IsStoreLoad = false;
11411 return false;
11412 }
11413 }
11414
11415 //agent trasmission system
11416 if (!LoadAgents(ctx, version))
11417 {
11418 m_IsStoreLoad = false;
11419 return false;
11420 }
11421 if (version >= 132)
11422 {
11423 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11424 if (raib)
11425 {
11426 if (!raib.OnStoreLoad(ctx,version))
11427 {
11428 m_IsStoreLoad = false;
11429 return false;
11430 }
11431 }
11432 }
11433
11434 m_IsStoreLoad = false;
11435 return true;
11436 }
11437
11438 //----------------------------------------------------------------
11439
11440 override void OnStoreSave(ParamsWriteContext ctx)
11441 {
11442 super.OnStoreSave(ctx);
11443
11444 PlayerBase player;
11445 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11446 {
11447 ctx.Write(true); // Keep track of if we should actually read this in or not
11448 //Save quickbar item bind
11449 int itemQBIndex = -1;
11450 itemQBIndex = player.FindQuickBarEntityIndex(this);
11451 ctx.Write(itemQBIndex);
11452 }
11453 else
11454 {
11455 ctx.Write(false); // Keep track of if we should actually read this in or not
11456 }
11457
11458 SaveAgents(ctx);//agent trasmission system
11459
11460 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11461 if (raib)
11462 {
11463 raib.OnStoreSave(ctx);
11464 }
11465 }
11466 //----------------------------------------------------------------
11467
11468 override void AfterStoreLoad()
11469 {
11470 super.AfterStoreLoad();
11471
11473 {
11475 }
11476
11477 if (GetStoreLoadedQuantity() != float.LOWEST)
11478 {
11480 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
11481 }
11482 }
11483
11484 override void EEOnAfterLoad()
11485 {
11486 super.EEOnAfterLoad();
11487
11489 {
11490 m_FixDamageSystemInit = false;
11491 }
11492
11495 }
11496
11497 bool CanBeDisinfected()
11498 {
11499 return false;
11500 }
11501
11502
11503 //----------------------------------------------------------------
11504 override void OnVariablesSynchronized()
11505 {
11506 if (m_Initialized)
11507 {
11508 #ifdef PLATFORM_CONSOLE
11509 //bruteforce it is
11510 if (IsSplitable())
11511 {
11512 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11513 if (menu)
11514 {
11515 menu.Refresh();
11516 }
11517 }
11518 #endif
11519 }
11520
11522 {
11523 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11524 m_WantPlayImpactSound = false;
11525 }
11526
11528 {
11529 SetWeightDirty();
11531 }
11532 if (m_VarWet != m_VarWetPrev)
11533 {
11536 }
11537
11538 if (m_SoundSyncPlay != 0)
11539 {
11540 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11541 m_SoundSyncPlay = 0;
11542 }
11543 if (m_SoundSyncStop != 0)
11544 {
11545 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11546 m_SoundSyncStop = 0;
11547 }
11548
11549 super.OnVariablesSynchronized();
11550 }
11551
11552 //------------------------- Quantity
11553 //----------------------------------------------------------------
11555 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11556 {
11557 if (!IsServerCheck(allow_client))
11558 return false;
11559
11560 if (!HasQuantity())
11561 return false;
11562
11563 float min = GetQuantityMin();
11564 float max = GetQuantityMax();
11565
11566 if (value <= (min + 0.001))
11567 value = min;
11568
11569 if (value == min)
11570 {
11571 if (destroy_config)
11572 {
11573 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11574 if (dstr)
11575 {
11576 m_VarQuantity = Math.Clamp(value, min, max);
11577 this.Delete();
11578 return true;
11579 }
11580 }
11581 else if (destroy_forced)
11582 {
11583 m_VarQuantity = Math.Clamp(value, min, max);
11584 this.Delete();
11585 return true;
11586 }
11587 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11588 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11589 }
11590
11591 float delta = m_VarQuantity;
11592 m_VarQuantity = Math.Clamp(value, min, max);
11593
11594 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11595 {
11596 delta = m_VarQuantity - delta;
11597
11598 if (delta)
11599 OnQuantityChanged(delta);
11600 }
11601
11602 SetVariableMask(VARIABLE_QUANTITY);
11603
11604 return false;
11605 }
11606
11607 //----------------------------------------------------------------
11609 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11610 {
11611 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11612 }
11613 //----------------------------------------------------------------
11614 void SetQuantityMax()
11615 {
11616 float max = GetQuantityMax();
11617 SetQuantity(max);
11618 }
11619
11620 override void SetQuantityToMinimum()
11621 {
11622 float min = GetQuantityMin();
11623 SetQuantity(min);
11624 }
11625 //----------------------------------------------------------------
11627 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11628 {
11629 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11630 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11631 SetQuantity(result, destroy_config, destroy_forced);
11632 }
11633
11634 //----------------------------------------------------------------
11636 override float GetQuantityNormalized()
11637 {
11638 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11639 }
11640
11642 {
11643 return GetQuantityNormalized();
11644 }
11645
11646 /*void SetAmmoNormalized(float value)
11647 {
11648 float value_clamped = Math.Clamp(value, 0, 1);
11649 Magazine this_mag = Magazine.Cast(this);
11650 int max_rounds = this_mag.GetAmmoMax();
11651 int result = value * max_rounds;//can the rounded if higher precision is required
11652 this_mag.SetAmmoCount(result);
11653 }*/
11654 //----------------------------------------------------------------
11655 override int GetQuantityMax()
11656 {
11657 int slot = -1;
11658 if (GetInventory())
11659 {
11660 InventoryLocation il = new InventoryLocation;
11661 GetInventory().GetCurrentInventoryLocation(il);
11662 slot = il.GetSlot();
11663 }
11664
11665 return GetTargetQuantityMax(slot);
11666 }
11667
11668 override int GetTargetQuantityMax(int attSlotID = -1)
11669 {
11670 float quantity_max = 0;
11671
11672 if (IsSplitable()) //only stackable/splitable items can check for stack size
11673 {
11674 if (attSlotID != -1)
11675 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11676
11677 if (quantity_max <= 0)
11678 quantity_max = m_VarStackMax;
11679 }
11680
11681 if (quantity_max <= 0)
11682 quantity_max = m_VarQuantityMax;
11683
11684 return quantity_max;
11685 }
11686 //----------------------------------------------------------------
11687 override int GetQuantityMin()
11688 {
11689 return m_VarQuantityMin;
11690 }
11691 //----------------------------------------------------------------
11692 int GetQuantityInit()
11693 {
11694 return m_VarQuantityInit;
11695 }
11696
11697 //----------------------------------------------------------------
11698 override bool HasQuantity()
11699 {
11700 return !(GetQuantityMax() - GetQuantityMin() == 0);
11701 }
11702
11703 override float GetQuantity()
11704 {
11705 return m_VarQuantity;
11706 }
11707
11708 bool IsFullQuantity()
11709 {
11710 return GetQuantity() >= GetQuantityMax();
11711 }
11712
11713 //Calculates weight of single item without attachments and cargo
11714 override float GetSingleInventoryItemWeightEx()
11715 {
11716 //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
11717 float weightEx = GetWeightEx();//overall weight of the item
11718 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11719 return weightEx - special;
11720 }
11721
11722 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11724 {
11726 }
11727
11728 override protected float GetWeightSpecialized(bool forceRecalc = false)
11729 {
11730 if (IsSplitable()) //quantity determines size of the stack
11731 {
11732 #ifdef DEVELOPER
11733 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11734 {
11735 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11736 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11737 }
11738 #endif
11739
11740 return GetQuantity() * GetConfigWeightModified();
11741 }
11742 else if (HasEnergyManager())// items with energy manager
11743 {
11744 #ifdef DEVELOPER
11745 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11746 {
11747 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11748 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11749 }
11750 #endif
11751 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11752 }
11753 else//everything else
11754 {
11755 #ifdef DEVELOPER
11756 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11757 {
11758 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11759 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11760 }
11761 #endif
11762 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11763 }
11764 }
11765
11767 int GetNumberOfItems()
11768 {
11769 int item_count = 0;
11770 ItemBase item;
11771
11772 if (GetInventory().GetCargo() != NULL)
11773 {
11774 item_count = GetInventory().GetCargo().GetItemCount();
11775 }
11776
11777 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11778 {
11779 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11780 if (item)
11781 item_count += item.GetNumberOfItems();
11782 }
11783 return item_count;
11784 }
11785
11787 float GetUnitWeight(bool include_wetness = true)
11788 {
11789 float weight = 0;
11790 float wetness = 1;
11791 if (include_wetness)
11792 wetness += GetWet();
11793 if (IsSplitable()) //quantity determines size of the stack
11794 {
11795 weight = wetness * m_ConfigWeight;
11796 }
11797 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11798 {
11799 weight = 1;
11800 }
11801 return weight;
11802 }
11803
11804 //-----------------------------------------------------------------
11805
11806 override void ClearInventory()
11807 {
11808 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11809 {
11810 GameInventory inv = GetInventory();
11811 array<EntityAI> items = new array<EntityAI>;
11812 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11813 for (int i = 0; i < items.Count(); i++)
11814 {
11815 ItemBase item = ItemBase.Cast(items.Get(i));
11816 if (item)
11817 {
11818 GetGame().ObjectDelete(item);
11819 }
11820 }
11821 }
11822 }
11823
11824 //------------------------- Energy
11825
11826 //----------------------------------------------------------------
11827 float GetEnergy()
11828 {
11829 float energy = 0;
11830 if (HasEnergyManager())
11831 {
11832 energy = GetCompEM().GetEnergy();
11833 }
11834 return energy;
11835 }
11836
11837
11838 override void OnEnergyConsumed()
11839 {
11840 super.OnEnergyConsumed();
11841
11843 }
11844
11845 override void OnEnergyAdded()
11846 {
11847 super.OnEnergyAdded();
11848
11850 }
11851
11852 // Converts energy (from Energy Manager) to quantity, if enabled.
11854 {
11855 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11856 {
11857 if (HasQuantity())
11858 {
11859 float energy_0to1 = GetCompEM().GetEnergy0To1();
11860 SetQuantityNormalized(energy_0to1);
11861 }
11862 }
11863 }
11864
11865 //----------------------------------------------------------------
11866 float GetHeatIsolationInit()
11867 {
11868 return ConfigGetFloat("heatIsolation");
11869 }
11870
11871 float GetHeatIsolation()
11872 {
11873 return m_HeatIsolation;
11874 }
11875
11876 float GetDryingIncrement(string pIncrementName)
11877 {
11878 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11879 if (GetGame().ConfigIsExisting(paramPath))
11880 return GetGame().ConfigGetFloat(paramPath);
11881
11882 return 0.0;
11883 }
11884
11885 float GetSoakingIncrement(string pIncrementName)
11886 {
11887 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11888 if (GetGame().ConfigIsExisting(paramPath))
11889 return GetGame().ConfigGetFloat(paramPath);
11890
11891 return 0.0;
11892 }
11893 //----------------------------------------------------------------
11894 override void SetWet(float value, bool allow_client = false)
11895 {
11896 if (!IsServerCheck(allow_client))
11897 return;
11898
11899 float min = GetWetMin();
11900 float max = GetWetMax();
11901
11902 float previousValue = m_VarWet;
11903
11904 m_VarWet = Math.Clamp(value, min, max);
11905
11906 if (previousValue != m_VarWet)
11907 {
11908 SetVariableMask(VARIABLE_WET);
11909 OnWetChanged(m_VarWet, previousValue);
11910 }
11911 }
11912 //----------------------------------------------------------------
11913 override void AddWet(float value)
11914 {
11915 SetWet(GetWet() + value);
11916 }
11917 //----------------------------------------------------------------
11918 override void SetWetMax()
11919 {
11921 }
11922 //----------------------------------------------------------------
11923 override float GetWet()
11924 {
11925 return m_VarWet;
11926 }
11927 //----------------------------------------------------------------
11928 override float GetWetMax()
11929 {
11930 return m_VarWetMax;
11931 }
11932 //----------------------------------------------------------------
11933 override float GetWetMin()
11934 {
11935 return m_VarWetMin;
11936 }
11937 //----------------------------------------------------------------
11938 override float GetWetInit()
11939 {
11940 return m_VarWetInit;
11941 }
11942 //----------------------------------------------------------------
11943 override void OnWetChanged(float newVal, float oldVal)
11944 {
11945 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11946 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11947 if (newLevel != oldLevel)
11948 {
11949 OnWetLevelChanged(newLevel,oldLevel);
11950 }
11951 }
11952
11953 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11954 {
11955 SetWeightDirty();
11956 }
11957
11958 override EWetnessLevel GetWetLevel()
11959 {
11960 return GetWetLevelInternal(m_VarWet);
11961 }
11962
11963 //----------------------------------------------------------------
11964
11965 override void SetStoreLoad(bool value)
11966 {
11967 m_IsStoreLoad = value;
11968 }
11969
11970 override bool IsStoreLoad()
11971 {
11972 return m_IsStoreLoad;
11973 }
11974
11975 override void SetStoreLoadedQuantity(float value)
11976 {
11977 m_StoreLoadedQuantity = value;
11978 }
11979
11980 override float GetStoreLoadedQuantity()
11981 {
11982 return m_StoreLoadedQuantity;
11983 }
11984
11985 //----------------------------------------------------------------
11986
11987 float GetItemModelLength()
11988 {
11989 if (ConfigIsExisting("itemModelLength"))
11990 {
11991 return ConfigGetFloat("itemModelLength");
11992 }
11993 return 0;
11994 }
11995
11996 float GetItemAttachOffset()
11997 {
11998 if (ConfigIsExisting("itemAttachOffset"))
11999 {
12000 return ConfigGetFloat("itemAttachOffset");
12001 }
12002 return 0;
12003 }
12004
12005 override void SetCleanness(int value, bool allow_client = false)
12006 {
12007 if (!IsServerCheck(allow_client))
12008 return;
12009
12010 int previousValue = m_Cleanness;
12011
12012 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12013
12014 if (previousValue != m_Cleanness)
12015 SetVariableMask(VARIABLE_CLEANNESS);
12016 }
12017
12018 override int GetCleanness()
12019 {
12020 return m_Cleanness;
12021 }
12022
12024 {
12025 return true;
12026 }
12027
12028 //----------------------------------------------------------------
12029 // ATTACHMENT LOCKING
12030 // Getters relevant to generic ActionLockAttachment
12031 int GetLockType()
12032 {
12033 return m_LockType;
12034 }
12035
12036 string GetLockSoundSet()
12037 {
12038 return m_LockSoundSet;
12039 }
12040
12041 //----------------------------------------------------------------
12042 //------------------------- Color
12043 // sets items color variable given color components
12044 override void SetColor(int r, int g, int b, int a)
12045 {
12050 SetVariableMask(VARIABLE_COLOR);
12051 }
12053 override void GetColor(out int r,out int g,out int b,out int a)
12054 {
12059 }
12060
12061 bool IsColorSet()
12062 {
12063 return IsVariableSet(VARIABLE_COLOR);
12064 }
12065
12067 string GetColorString()
12068 {
12069 int r,g,b,a;
12070 GetColor(r,g,b,a);
12071 r = r/255;
12072 g = g/255;
12073 b = b/255;
12074 a = a/255;
12075 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12076 }
12077 //----------------------------------------------------------------
12078 //------------------------- LiquidType
12079
12080 override void SetLiquidType(int value, bool allow_client = false)
12081 {
12082 if (!IsServerCheck(allow_client))
12083 return;
12084
12085 int old = m_VarLiquidType;
12086 m_VarLiquidType = value;
12087 OnLiquidTypeChanged(old,value);
12088 SetVariableMask(VARIABLE_LIQUIDTYPE);
12089 }
12090
12091 int GetLiquidTypeInit()
12092 {
12093 return ConfigGetInt("varLiquidTypeInit");
12094 }
12095
12096 override int GetLiquidType()
12097 {
12098 return m_VarLiquidType;
12099 }
12100
12101 protected void OnLiquidTypeChanged(int oldType, int newType)
12102 {
12103 if (newType == LIQUID_NONE && GetIsFrozen())
12104 SetFrozen(false);
12105 }
12106
12108 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12109 {
12110 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12111 }
12112
12113 // -------------------------------------------------------------------------
12115 void OnInventoryEnter(Man player)
12116 {
12117 PlayerBase nplayer;
12118 if (PlayerBase.CastTo(nplayer, player))
12119 {
12120 m_CanPlayImpactSound = true;
12121 //nplayer.OnItemInventoryEnter(this);
12122 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12123 }
12124 }
12125
12126 // -------------------------------------------------------------------------
12128 void OnInventoryExit(Man player)
12129 {
12130 PlayerBase nplayer;
12131 if (PlayerBase.CastTo(nplayer,player))
12132 {
12133 //nplayer.OnItemInventoryExit(this);
12134 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12135
12136 }
12137
12138 //if (!GetGame().IsDedicatedServer())
12139 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12140
12141
12142 if (HasEnergyManager())
12143 {
12144 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12145 }
12146 }
12147
12148 // ADVANCED PLACEMENT EVENTS
12149 override void OnPlacementStarted(Man player)
12150 {
12151 super.OnPlacementStarted(player);
12152
12153 SetTakeable(false);
12154 }
12155
12156 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12157 {
12158 if (m_AdminLog)
12159 {
12160 m_AdminLog.OnPlacementComplete(player, this);
12161 }
12162
12163 super.OnPlacementComplete(player, position, orientation);
12164 }
12165
12166 //-----------------------------
12167 // AGENT SYSTEM
12168 //-----------------------------
12169 //--------------------------------------------------------------------------
12170 bool ContainsAgent(int agent_id)
12171 {
12172 if (agent_id & m_AttachedAgents)
12173 {
12174 return true;
12175 }
12176 else
12177 {
12178 return false;
12179 }
12180 }
12181
12182 //--------------------------------------------------------------------------
12183 override void RemoveAgent(int agent_id)
12184 {
12185 if (ContainsAgent(agent_id))
12186 {
12187 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12188 }
12189 }
12190
12191 //--------------------------------------------------------------------------
12192 override void RemoveAllAgents()
12193 {
12194 m_AttachedAgents = 0;
12195 }
12196 //--------------------------------------------------------------------------
12197 override void RemoveAllAgentsExcept(int agent_to_keep)
12198 {
12199 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12200 }
12201 // -------------------------------------------------------------------------
12202 override void InsertAgent(int agent, float count = 1)
12203 {
12204 if (count < 1)
12205 return;
12206 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12208 }
12209
12211 void TransferAgents(int agents)
12212 {
12214 }
12215
12216 // -------------------------------------------------------------------------
12217 override int GetAgents()
12218 {
12219 return m_AttachedAgents;
12220 }
12221 //----------------------------------------------------------------------
12222
12223 /*int GetContaminationType()
12224 {
12225 int contamination_type;
12226
12227 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12228 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12229 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12230 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12231
12232 Edible_Base edible = Edible_Base.Cast(this);
12233 int agents = GetAgents();
12234 if (edible)
12235 {
12236 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12237 if (profile)
12238 {
12239 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12240 }
12241 }
12242 if (agents & CONTAMINATED_MASK)
12243 {
12244 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12245 }
12246 if (agents & POISONED_MASK)
12247 {
12248 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12249 }
12250 if (agents & NERVE_GAS_MASK)
12251 {
12252 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12253 }
12254 if (agents & DIRTY_MASK)
12255 {
12256 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12257 }
12258
12259 return agents;
12260 }*/
12261
12262 // -------------------------------------------------------------------------
12263 bool LoadAgents(ParamsReadContext ctx, int version)
12264 {
12265 if (!ctx.Read(m_AttachedAgents))
12266 return false;
12267 return true;
12268 }
12269 // -------------------------------------------------------------------------
12271 {
12272
12274 }
12275 // -------------------------------------------------------------------------
12276
12278 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12279 {
12280 super.CheckForRoofLimited(timeTresholdMS);
12281
12282 float time = GetGame().GetTime();
12283 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12284 {
12285 m_PreviousRoofTestTime = time;
12286 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12287 }
12288 }
12289
12290 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12291 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12292 {
12293 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12294 {
12295 return 0;
12296 }
12297
12298 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12299 {
12300 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12301 if (filter)
12302 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12303 else
12304 return 0;//otherwise return 0 when no filter attached
12305 }
12306
12307 string subclassPath, entryName;
12308
12309 switch (type)
12310 {
12311 case DEF_BIOLOGICAL:
12312 entryName = "biological";
12313 break;
12314 case DEF_CHEMICAL:
12315 entryName = "chemical";
12316 break;
12317 default:
12318 entryName = "biological";
12319 break;
12320 }
12321
12322 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12323
12324 return GetGame().ConfigGetFloat(subclassPath + entryName);
12325 }
12326
12327
12328
12330 override void EEOnCECreate()
12331 {
12332 if (!IsMagazine())
12334
12336 }
12337
12338
12339 //-------------------------
12340 // OPEN/CLOSE USER ACTIONS
12341 //-------------------------
12343 void Open();
12344 void Close();
12345 bool IsOpen()
12346 {
12347 return true;
12348 }
12349
12350 override bool CanDisplayCargo()
12351 {
12352 return IsOpen();
12353 }
12354
12355
12356 // ------------------------------------------------------------
12357 // CONDITIONS
12358 // ------------------------------------------------------------
12359 override bool CanPutInCargo(EntityAI parent)
12360 {
12361 if (parent)
12362 {
12363 if (parent.IsInherited(DayZInfected))
12364 return true;
12365
12366 if (!parent.IsRuined())
12367 return true;
12368 }
12369
12370 return true;
12371 }
12372
12373 override bool CanPutAsAttachment(EntityAI parent)
12374 {
12375 if (!super.CanPutAsAttachment(parent))
12376 {
12377 return false;
12378 }
12379
12380 if (!IsRuined() && !parent.IsRuined())
12381 {
12382 return true;
12383 }
12384
12385 return false;
12386 }
12387
12388 override bool CanReceiveItemIntoCargo(EntityAI item)
12389 {
12390 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12391 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12392 // return false;
12393
12394 return super.CanReceiveItemIntoCargo(item);
12395 }
12396
12397 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12398 {
12399 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12400 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12401 // return false;
12402
12403 GameInventory attachmentInv = attachment.GetInventory();
12404 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12405 {
12406 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12407 return false;
12408 }
12409
12410 InventoryLocation loc = new InventoryLocation();
12411 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12412 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12413 return false;
12414
12415 return super.CanReceiveAttachment(attachment, slotId);
12416 }
12417
12418 override bool CanReleaseAttachment(EntityAI attachment)
12419 {
12420 if (!super.CanReleaseAttachment(attachment))
12421 return false;
12422
12423 return GetInventory().AreChildrenAccessible();
12424 }
12425
12426 /*override bool CanLoadAttachment(EntityAI attachment)
12427 {
12428 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12429 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12430 // return false;
12431
12432 GameInventory attachmentInv = attachment.GetInventory();
12433 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12434 {
12435 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12436 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12437
12438 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12439 return false;
12440 }
12441
12442 return super.CanLoadAttachment(attachment);
12443 }*/
12444
12445 // Plays muzzle flash particle effects
12446 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12447 {
12448 int id = muzzle_owner.GetMuzzleID();
12449 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12450
12451 if (WPOF_array)
12452 {
12453 for (int i = 0; i < WPOF_array.Count(); i++)
12454 {
12455 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12456
12457 if (WPOF)
12458 {
12459 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12460 }
12461 }
12462 }
12463 }
12464
12465 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12466 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12467 {
12468 int id = muzzle_owner.GetMuzzleID();
12469 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12470
12471 if (WPOBE_array)
12472 {
12473 for (int i = 0; i < WPOBE_array.Count(); i++)
12474 {
12475 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12476
12477 if (WPOBE)
12478 {
12479 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12480 }
12481 }
12482 }
12483 }
12484
12485 // Plays all weapon overheating particles
12486 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12487 {
12488 int id = muzzle_owner.GetMuzzleID();
12489 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12490
12491 if (WPOOH_array)
12492 {
12493 for (int i = 0; i < WPOOH_array.Count(); i++)
12494 {
12495 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12496
12497 if (WPOOH)
12498 {
12499 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12500 }
12501 }
12502 }
12503 }
12504
12505 // Updates all weapon overheating particles
12506 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12507 {
12508 int id = muzzle_owner.GetMuzzleID();
12509 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12510
12511 if (WPOOH_array)
12512 {
12513 for (int i = 0; i < WPOOH_array.Count(); i++)
12514 {
12515 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12516
12517 if (WPOOH)
12518 {
12519 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12520 }
12521 }
12522 }
12523 }
12524
12525 // Stops overheating particles
12526 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12527 {
12528 int id = muzzle_owner.GetMuzzleID();
12529 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12530
12531 if (WPOOH_array)
12532 {
12533 for (int i = 0; i < WPOOH_array.Count(); i++)
12534 {
12535 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12536
12537 if (WPOOH)
12538 {
12539 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12540 }
12541 }
12542 }
12543 }
12544
12545 //----------------------------------------------------------------
12546 //Item Behaviour - unified approach
12547 override bool IsHeavyBehaviour()
12548 {
12549 if (m_ItemBehaviour == 0)
12550 {
12551 return true;
12552 }
12553
12554 return false;
12555 }
12556
12557 override bool IsOneHandedBehaviour()
12558 {
12559 if (m_ItemBehaviour == 1)
12560 {
12561 return true;
12562 }
12563
12564 return false;
12565 }
12566
12567 override bool IsTwoHandedBehaviour()
12568 {
12569 if (m_ItemBehaviour == 2)
12570 {
12571 return true;
12572 }
12573
12574 return false;
12575 }
12576
12577 bool IsDeployable()
12578 {
12579 return false;
12580 }
12581
12583 float GetDeployTime()
12584 {
12585 return UATimeSpent.DEFAULT_DEPLOY;
12586 }
12587
12588
12589 //----------------------------------------------------------------
12590 // Item Targeting (User Actions)
12591 override void SetTakeable(bool pState)
12592 {
12593 m_IsTakeable = pState;
12594 SetSynchDirty();
12595 }
12596
12597 override bool IsTakeable()
12598 {
12599 return m_IsTakeable;
12600 }
12601
12602 // For cases where we want to show object widget which cant be taken to hands
12604 {
12605 return false;
12606 }
12607
12609 protected void PreLoadSoundAttachmentType()
12610 {
12611 string att_type = "None";
12612
12613 if (ConfigIsExisting("soundAttType"))
12614 {
12615 att_type = ConfigGetString("soundAttType");
12616 }
12617
12618 m_SoundAttType = att_type;
12619 }
12620
12621 override string GetAttachmentSoundType()
12622 {
12623 return m_SoundAttType;
12624 }
12625
12626 //----------------------------------------------------------------
12627 //SOUNDS - ItemSoundHandler
12628 //----------------------------------------------------------------
12629
12630 string GetPlaceSoundset(); // played when deploy starts
12631 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12632 string GetDeploySoundset(); // played when deploy sucessfully finishes
12633 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
12634 string GetFoldSoundset(); // played when fold sucessfully finishes
12635
12637 {
12638 if (!m_ItemSoundHandler)
12640
12641 return m_ItemSoundHandler;
12642 }
12643
12644 // override to initialize sounds
12645 protected void InitItemSounds()
12646 {
12647 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12648 return;
12649
12651
12652 if (GetPlaceSoundset() != string.Empty)
12653 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12654
12655 if (GetDeploySoundset() != string.Empty)
12656 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12657
12658 SoundParameters params = new SoundParameters();
12659 params.m_Loop = true;
12660 if (GetLoopDeploySoundset() != string.Empty)
12661 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12662 }
12663
12664 // Start sound using ItemSoundHandler
12665 void StartItemSoundServer(int id)
12666 {
12667 if (!GetGame().IsServer())
12668 return;
12669
12670 m_SoundSyncPlay = id;
12671 SetSynchDirty();
12672
12673 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12675 }
12676
12677 // Stop sound using ItemSoundHandler
12678 void StopItemSoundServer(int id)
12679 {
12680 if (!GetGame().IsServer())
12681 return;
12682
12683 m_SoundSyncStop = id;
12684 SetSynchDirty();
12685
12686 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12688 }
12689
12690 protected void ClearStartItemSoundServer()
12691 {
12692 m_SoundSyncPlay = 0;
12693 }
12694
12695 protected void ClearStopItemSoundServer()
12696 {
12697 m_SoundSyncStop = 0;
12698 }
12699
12701 void PlayAttachSound(string slot_type)
12702 {
12703 if (!GetGame().IsDedicatedServer())
12704 {
12705 if (ConfigIsExisting("attachSoundSet"))
12706 {
12707 string cfg_path = "";
12708 string soundset = "";
12709 string type_name = GetType();
12710
12711 TStringArray cfg_soundset_array = new TStringArray;
12712 TStringArray cfg_slot_array = new TStringArray;
12713 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12714 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12715
12716 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12717 {
12718 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12719 {
12720 if (cfg_slot_array[i] == slot_type)
12721 {
12722 soundset = cfg_soundset_array[i];
12723 break;
12724 }
12725 }
12726 }
12727
12728 if (soundset != "")
12729 {
12730 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12731 sound.SetAutodestroy(true);
12732 }
12733 }
12734 }
12735 }
12736
12737 void PlayDetachSound(string slot_type)
12738 {
12739 //TODO - evaluate if needed and devise universal config structure if so
12740 }
12741
12742 void OnApply(PlayerBase player);
12743
12745 {
12746 return 1.0;
12747 };
12748 //returns applicable selection
12749 array<string> GetHeadHidingSelection()
12750 {
12752 }
12753
12755 {
12757 }
12758
12759 WrittenNoteData GetWrittenNoteData() {};
12760
12762 {
12763 SetDynamicPhysicsLifeTime(0.01);
12764 m_ItemBeingDroppedPhys = false;
12765 }
12766
12768 {
12769 array<string> zone_names = new array<string>;
12770 GetDamageZones(zone_names);
12771 for (int i = 0; i < zone_names.Count(); i++)
12772 {
12773 SetHealthMax(zone_names.Get(i),"Health");
12774 }
12775 SetHealthMax("","Health");
12776 }
12777
12779 void SetZoneDamageCEInit()
12780 {
12781 float global_health = GetHealth01("","Health");
12782 array<string> zones = new array<string>;
12783 GetDamageZones(zones);
12784 //set damage of all zones to match global health level
12785 for (int i = 0; i < zones.Count(); i++)
12786 {
12787 SetHealth01(zones.Get(i),"Health",global_health);
12788 }
12789 }
12790
12792 bool IsCoverFaceForShave(string slot_name)
12793 {
12794 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12795 }
12796
12797 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12798 {
12799 if (!hasRootAsPlayer)
12800 {
12801 if (refParentIB)
12802 {
12803 // parent is wet
12804 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12805 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12806 // parent has liquid inside
12807 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12808 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12809 // drying
12810 else if (m_VarWet > m_VarWetMin)
12811 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12812 }
12813 else
12814 {
12815 // drying on ground or inside non-itembase (car, ...)
12816 if (m_VarWet > m_VarWetMin)
12817 AddWet(-1 * delta * GetDryingIncrement("ground"));
12818 }
12819 }
12820 }
12821
12822 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12823 {
12825 {
12826 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12827 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12828 {
12829 float heatPermCoef = 1.0;
12830 EntityAI ent = this;
12831 while (ent)
12832 {
12833 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12834 ent = ent.GetHierarchyParent();
12835 }
12836
12837 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12838 }
12839 }
12840 }
12841
12842 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12843 {
12844 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12845 EntityAI parent = GetHierarchyParent();
12846 if (!parent)
12847 {
12848 hasParent = false;
12849 hasRootAsPlayer = false;
12850 }
12851 else
12852 {
12853 hasParent = true;
12854 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12855 refParentIB = ItemBase.Cast(parent);
12856 }
12857 }
12858
12859 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12860 {
12861 // this is stub, implemented on Edible_Base
12862 }
12863
12864 bool CanDecay()
12865 {
12866 // return true used on selected food clases so they can decay
12867 return false;
12868 }
12869
12870 protected bool CanProcessDecay()
12871 {
12872 // this is stub, implemented on Edible_Base class
12873 // used to determine whether it is still necessary for the food to decay
12874 return false;
12875 }
12876
12877 protected bool CanHaveWetness()
12878 {
12879 // return true used on selected items that have a wetness effect
12880 return false;
12881 }
12882
12884 bool CanBeConsumed(ConsumeConditionData data = null)
12885 {
12886 return !GetIsFrozen() && IsOpen();
12887 }
12888
12889 override void ProcessVariables()
12890 {
12891 bool hasParent = false, hasRootAsPlayer = false;
12892 ItemBase refParentIB;
12893
12894 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12895 bool foodDecay = g_Game.IsFoodDecayEnabled();
12896
12897 if (wwtu || foodDecay)
12898 {
12899 bool processWetness = wwtu && CanHaveWetness();
12900 bool processTemperature = wwtu && CanHaveTemperature();
12901 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12902
12903 if (processWetness || processTemperature || processDecay)
12904 {
12905 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12906
12907 if (processWetness)
12908 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12909
12910 if (processTemperature)
12911 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12912
12913 if (processDecay)
12914 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12915 }
12916 }
12917 }
12918
12921 {
12922 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12923 }
12924
12925 override float GetTemperatureFreezeThreshold()
12926 {
12928 return Liquid.GetFreezeThreshold(GetLiquidType());
12929
12930 return super.GetTemperatureFreezeThreshold();
12931 }
12932
12933 override float GetTemperatureThawThreshold()
12934 {
12936 return Liquid.GetThawThreshold(GetLiquidType());
12937
12938 return super.GetTemperatureThawThreshold();
12939 }
12940
12941 override float GetItemOverheatThreshold()
12942 {
12944 return Liquid.GetBoilThreshold(GetLiquidType());
12945
12946 return super.GetItemOverheatThreshold();
12947 }
12948
12949 override float GetTemperatureFreezeTime()
12950 {
12951 if (HasQuantity())
12952 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12953
12954 return super.GetTemperatureFreezeTime();
12955 }
12956
12957 override float GetTemperatureThawTime()
12958 {
12959 if (HasQuantity())
12960 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12961
12962 return super.GetTemperatureThawTime();
12963 }
12964
12966 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12968 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12969
12970 bool IsCargoException4x3(EntityAI item)
12971 {
12972 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12973 }
12974
12976 {
12977 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12978 }
12979
12981 void AddLightSourceItem(ItemBase lightsource)
12982 {
12983 m_LightSourceItem = lightsource;
12984 }
12985
12987 {
12988 m_LightSourceItem = null;
12989 }
12990
12992 {
12993 return m_LightSourceItem;
12994 }
12995
12997 array<int> GetValidFinishers()
12998 {
12999 return null;
13000 }
13001
13003 bool GetActionWidgetOverride(out typename name)
13004 {
13005 return false;
13006 }
13007
13008 bool PairWithDevice(notnull ItemBase otherDevice)
13009 {
13010 if (GetGame().IsServer())
13011 {
13012 ItemBase explosive = otherDevice;
13014 if (!trg)
13015 {
13016 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13017 explosive = this;
13018 }
13019
13020 explosive.PairRemote(trg);
13021 trg.SetControlledDevice(explosive);
13022
13023 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13024 trg.SetPersistentPairID(persistentID);
13025 explosive.SetPersistentPairID(persistentID);
13026
13027 return true;
13028 }
13029 return false;
13030 }
13031
13033 float GetBaitEffectivity()
13034 {
13035 float ret = 1.0;
13036 if (HasQuantity())
13037 ret *= GetQuantityNormalized();
13038 ret *= GetHealth01();
13039
13040 return ret;
13041 }
13042
13043 #ifdef DEVELOPER
13044 override void SetDebugItem()
13045 {
13046 super.SetDebugItem();
13047 _itemBase = this;
13048 }
13049
13050 override string GetDebugText()
13051 {
13052 string text = super.GetDebugText();
13053
13054 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13055 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13056
13057 return text;
13058 }
13059 #endif
13060
13061 bool CanBeUsedForSuicide()
13062 {
13063 return true;
13064 }
13065
13067 //DEPRECATED BELOW
13069 // Backwards compatibility
13070 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13071 {
13072 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13073 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13074 }
13075
13076 // replaced by ItemSoundHandler
13077 protected EffectSound m_SoundDeployFinish;
13078 protected EffectSound m_SoundPlace;
13079 protected EffectSound m_DeployLoopSoundEx;
13080 protected EffectSound m_SoundDeploy;
13081 bool m_IsPlaceSound;
13082 bool m_IsDeploySound;
13084
13085 string GetDeployFinishSoundset();
13086 void PlayDeploySound();
13087 void PlayDeployFinishSound();
13088 void PlayPlaceSound();
13089 void PlayDeployLoopSoundEx();
13090 void StopDeployLoopSoundEx();
13091 void SoundSynchRemoteReset();
13092 void SoundSynchRemote();
13093 bool UsesGlobalDeploy(){return false;}
13094 bool CanPlayDeployLoopSound(){return false;}
13096 bool IsPlaceSound(){return m_IsPlaceSound;}
13097 bool IsDeploySound(){return m_IsDeploySound;}
13098 void SetIsPlaceSound(bool is_place_sound);
13099 void SetIsDeploySound(bool is_deploy_sound);
13100}
13101
13102EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13103{
13104 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13105 if (entity)
13106 {
13107 bool is_item = entity.IsInherited(ItemBase);
13108 if (is_item && full_quantity)
13109 {
13110 ItemBase item = ItemBase.Cast(entity);
13111 item.SetQuantity(item.GetQuantityInit());
13112 }
13113 }
13114 else
13115 {
13116 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13117 return NULL;
13118 }
13119 return entity;
13120}
13121
13122void SetupSpawnedItem(ItemBase item, float health, float quantity)
13123{
13124 if (item)
13125 {
13126 if (health > 0)
13127 item.SetHealth("", "", health);
13128
13129 if (item.CanHaveTemperature())
13130 {
13131 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13132 if (item.CanFreeze())
13133 item.SetFrozen(false);
13134 }
13135
13136 if (item.HasEnergyManager())
13137 {
13138 if (quantity >= 0)
13139 {
13140 item.GetCompEM().SetEnergy0To1(quantity);
13141 }
13142 else
13143 {
13144 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13145 }
13146 }
13147 else if (item.IsMagazine())
13148 {
13149 Magazine mag = Magazine.Cast(item);
13150 if (quantity >= 0)
13151 {
13152 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13153 }
13154 else
13155 {
13156 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13157 }
13158
13159 }
13160 else
13161 {
13162 if (quantity >= 0)
13163 {
13164 item.SetQuantityNormalized(quantity, false);
13165 }
13166 else
13167 {
13168 item.SetQuantity(Math.AbsFloat(quantity));
13169 }
13170
13171 }
13172 }
13173}
13174
13175#ifdef DEVELOPER
13176ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13177#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
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 RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
int GetLiquidType()
Определения CCTWaterSurface.c:129
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
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
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
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
class GP5GasMask extends MaskBase ItemBase
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:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
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:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
ScriptedLightBase GetLight()
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:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override 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:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
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:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
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
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
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
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
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)
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
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения 3_Game/Entities/Man.c:44
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения 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
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
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override string GetFoldSoundset()
Определения BaseBuildingBase.c:108
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1238
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 InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:489
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1032
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения EnMath.c:7
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
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
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 bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения 3_Game/tools/Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
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
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
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)
array< string > TStringArray
Определения EnScript.c:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
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
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()

Используется в Bottle_Base::AffectLiquidContainerOnFill(), FilteringBottle::AffectLiquidContainerOnFill(), Bottle_Base::AffectLiquidContainerOnTransfer(), FilteringBottle::AffectLiquidContainerOnTransfer(), CalcAndSetQuantity(), InventoryItem::CanBeCombined(), Capture(), InventoryItem::ComputeQuantityUsedEx(), DisinfectantAlcohol::GetDisinfectQuantity(), DisinfectantSpray::GetDisinfectQuantity(), IodineTincture::GetDisinfectQuantity(), Mask_Base::GetFilterQuantity01(), Mask_Base::GetFilterQuantityMax(), InventoryItem::GetQuantityNormalized(), InventoryItem::HasQuantity(), InventoryItem::IsFullQuantity(), InventoryItem::OnAction(), InventoryItem::SetQuantity(), InventoryItem::SetQuantityMax(), InventoryItem::SetQuantityNormalized(), BroomBase::UpdateParticle() и ItemBase::UpdateSelections().