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

◆ GetItemModelLength()

float SpawnItemOnLocation::GetItemModelLength ( )
protected

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

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

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