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

◆ GetColor()

override void SpawnItemOnLocation::GetColor ( out int r,
out int g,
out int b,
out int a )
protected

gets item's color variable as components

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

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