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

◆ GetWetLevel()

override EWetnessLevel SpawnItemOnLocation::GetWetLevel ( )
protected

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

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

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