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

◆ IsFullQuantity()

bool SpawnItemOnLocation::IsFullQuantity ( )
protected

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

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

Используется в CAContinuousMineWood::CreatePrimaryItems().