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

◆ KindOf()

override bool SpawnItemOnLocation::KindOf ( string tag)
private

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

7474{
7475 override bool CanPutAsAttachment(EntityAI parent)
7476 {
7477 return true;
7478 }
7479};
7480
7481//const bool QUANTITY_DEBUG_REMOVE_ME = false;
7482
7483class ItemBase extends InventoryItem
7484{
7488
7490
7491 static int m_DebugActionsMask;
7493 // ============================================
7494 // Variable Manipulation System
7495 // ============================================
7496 // Quantity
7497
7498 float m_VarQuantity;
7499 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
7501 int m_VarQuantityMin;
7502 int m_VarQuantityMax;
7503 int m_Count;
7504 float m_VarStackMax;
7505 float m_StoreLoadedQuantity = float.LOWEST;
7506 // Wet
7507 float m_VarWet;
7508 float m_VarWetPrev;//for client to know wetness changed during synchronization
7509 float m_VarWetInit;
7510 float m_VarWetMin;
7511 float m_VarWetMax;
7512 // Cleanness
7513 int m_Cleanness;
7514 int m_CleannessInit;
7515 int m_CleannessMin;
7516 int m_CleannessMax;
7517 // impact sounds
7519 bool m_CanPlayImpactSound = true;
7520 float m_ImpactSpeed;
7522 //
7523 float m_HeatIsolation;
7524 float m_ItemModelLength;
7525 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
7527 int m_VarLiquidType;
7528 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
7529 int m_QuickBarBonus;
7530 bool m_IsBeingPlaced;
7531 bool m_IsHologram;
7532 bool m_IsTakeable;
7533 bool m_ThrowItemOnDrop;
7536 bool m_FixDamageSystemInit = false; //can be changed on storage version check
7537 bool can_this_be_combined; //Check if item can be combined
7538 bool m_CanThisBeSplit; //Check if item can be split
7539 bool m_IsStoreLoad = false;
7540 bool m_CanShowQuantity;
7541 bool m_HasQuantityBar;
7542 protected bool m_CanBeDigged;
7543 protected bool m_IsResultOfSplit
7544
7545 string m_SoundAttType;
7546 // items color variables
7551 //-------------------------------------------------------
7552
7553 // light source managing
7555
7559
7560 //==============================================
7561 // agent system
7562 private int m_AttachedAgents;
7563
7565 void TransferModifiers(PlayerBase reciever);
7566
7567
7568 // Weapons & suppressors particle effects
7573 static int m_LastRegisteredWeaponID = 0;
7574
7575 // Overheating effects
7577 float m_OverheatingShots;
7578 ref Timer m_CheckOverheating;
7579 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
7580 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
7581 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
7582 ref array <ref OverheatingParticle> m_OverheatingParticles;
7583
7585 protected bool m_HideSelectionsBySlot;
7586
7587 // Admin Log
7588 PluginAdminLog m_AdminLog;
7589
7590 // misc
7591 ref Timer m_PhysDropTimer;
7592
7593 // Attachment Locking variables
7594 ref array<int> m_CompatibleLocks;
7595 protected int m_LockType;
7596 protected ref EffectSound m_LockingSound;
7597 protected string m_LockSoundSet;
7598
7599 // ItemSoundHandler
7600 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
7601 protected int m_SoundSyncPlay; // id for sound to play
7602 protected int m_SoundSyncStop; // id for sound to stop
7604
7605 //temperature
7606 private float m_TemperaturePerQuantityWeight;
7607
7608 // -------------------------------------------------------------------------
7609 void ItemBase()
7610 {
7611 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
7615
7616 if (!GetGame().IsDedicatedServer())
7617 {
7618 if (HasMuzzle())
7619 {
7621
7623 {
7625 }
7626 }
7627
7629 m_ActionsInitialize = false;
7630 }
7631
7632 m_OldLocation = null;
7633
7634 if (GetGame().IsServer())
7635 {
7636 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
7637 }
7638
7639 if (ConfigIsExisting("headSelectionsToHide"))
7640 {
7642 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
7643 }
7644
7645 m_HideSelectionsBySlot = false;
7646 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7647 {
7648 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
7649 }
7650
7651 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
7652
7653 m_IsResultOfSplit = false;
7654
7656 }
7657
7658 override void InitItemVariables()
7659 {
7660 super.InitItemVariables();
7661
7662 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
7663 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
7664 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
7665 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
7666 m_VarStackMax = ConfigGetFloat("varStackMax");
7667 m_Count = ConfigGetInt("count");
7668
7669 m_CanShowQuantity = ConfigGetBool("quantityShow");
7670 m_HasQuantityBar = ConfigGetBool("quantityBar");
7671
7672 m_CleannessInit = ConfigGetInt("varCleannessInit");
7674 m_CleannessMin = ConfigGetInt("varCleannessMin");
7675 m_CleannessMax = ConfigGetInt("varCleannessMax");
7676
7677 m_WantPlayImpactSound = false;
7678 m_ImpactSpeed = 0.0;
7679
7680 m_VarWetInit = ConfigGetFloat("varWetInit");
7682 m_VarWetMin = ConfigGetFloat("varWetMin");
7683 m_VarWetMax = ConfigGetFloat("varWetMax");
7684
7685 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
7686 if (IsLiquidContainer() && GetQuantity() != 0)
7688 m_IsBeingPlaced = false;
7689 m_IsHologram = false;
7690 m_IsTakeable = true;
7691 m_CanBeMovedOverride = false;
7695 m_CanBeDigged = ConfigGetBool("canBeDigged");
7696
7697 m_CompatibleLocks = new array<int>();
7698 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
7699 m_LockType = ConfigGetInt("lockType");
7700
7701 //Define if item can be split and set ability to be combined accordingly
7702 m_CanThisBeSplit = false;
7703 can_this_be_combined = false;
7704 if (ConfigIsExisting("canBeSplit"))
7705 {
7706 can_this_be_combined = ConfigGetBool("canBeSplit");
7708 }
7709
7710 m_ItemBehaviour = -1;
7711 if (ConfigIsExisting("itemBehaviour"))
7712 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
7713
7714 //RegisterNetSyncVariableInt("m_VariablesMask");
7715 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7716 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
7717 RegisterNetSyncVariableInt("m_VarLiquidType");
7718 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7719
7720 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7721 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7722 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7723
7724 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7725 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7726 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7727 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7728
7729 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7730 RegisterNetSyncVariableBool("m_IsTakeable");
7731 RegisterNetSyncVariableBool("m_IsHologram");
7732
7733 InitItemSounds();
7735 {
7736 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
7737 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
7738 }
7739
7740 m_LockSoundSet = ConfigGetString("lockSoundSet");
7741
7743 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7744 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
7745
7746 }
7747
7748 override int GetQuickBarBonus()
7749 {
7750 return m_QuickBarBonus;
7751 }
7752
7753 void InitializeActions()
7754 {
7756 if (!m_InputActionMap)
7757 {
7759 m_InputActionMap = iam;
7760 SetActions();
7762 }
7763 }
7764
7765 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
7766 {
7768 {
7769 m_ActionsInitialize = true;
7771 }
7772
7773 actions = m_InputActionMap.Get(action_input_type);
7774 }
7775
7776 void SetActions()
7777 {
7778 AddAction(ActionTakeItem);
7779 AddAction(ActionTakeItemToHands);
7780 AddAction(ActionWorldCraft);
7782 AddAction(ActionAttachWithSwitch);
7783 }
7784
7785 void SetActionAnimOverrides(); // Override action animation for specific item
7786
7787 void AddAction(typename actionName)
7788 {
7789 ActionBase action = ActionManagerBase.GetAction(actionName);
7790
7791 if (!action)
7792 {
7793 Debug.LogError("Action " + actionName + " dosn't exist!");
7794 return;
7795 }
7796
7797 typename ai = action.GetInputType();
7798 if (!ai)
7799 {
7800 m_ActionsInitialize = false;
7801 return;
7802 }
7803
7804 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7805 if (!action_array)
7806 {
7807 action_array = new array<ActionBase_Basic>;
7808 m_InputActionMap.Insert(ai, action_array);
7809 }
7810 if (LogManager.IsActionLogEnable())
7811 {
7812 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
7813 }
7814
7815 if (action_array.Find(action) != -1)
7816 {
7817 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
7818 }
7819 else
7820 {
7821 action_array.Insert(action);
7822 }
7823 }
7824
7825 void RemoveAction(typename actionName)
7826 {
7827 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7828 ActionBase action = player.GetActionManager().GetAction(actionName);
7829 typename ai = action.GetInputType();
7830 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7831
7832 if (action_array)
7833 {
7834 action_array.RemoveItem(action);
7835 }
7836 }
7837
7838 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
7839 // Set -1 for params which should stay in default state
7840 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
7841 {
7842 ActionOverrideData overrideData = new ActionOverrideData();
7843 overrideData.m_CommandUID = commandUID;
7844 overrideData.m_CommandUIDProne = commandUIDProne;
7845 overrideData.m_StanceMask = stanceMask;
7846
7847 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
7848 if (!actionMap) // create new map of action > overidables map
7849 {
7850 actionMap = new TActionAnimOverrideMap();
7851 m_ItemActionOverrides.Insert(action, actionMap);
7852 }
7853
7854 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
7855
7856 }
7857
7858 void OnItemInHandsPlayerSwimStart(PlayerBase player);
7859
7860 ScriptedLightBase GetLight();
7861
7862 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7863 void LoadParticleConfigOnFire(int id)
7864 {
7865 if (!m_OnFireEffect)
7867
7870
7871 string config_to_search = "CfgVehicles";
7872 string muzzle_owner_config;
7873
7874 if (!m_OnFireEffect.Contains(id))
7875 {
7876 if (IsInherited(Weapon))
7877 config_to_search = "CfgWeapons";
7878
7879 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7880
7881 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7882
7883 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
7884
7885 if (config_OnFire_subclass_count > 0)
7886 {
7887 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7888
7889 for (int i = 0; i < config_OnFire_subclass_count; i++)
7890 {
7891 string particle_class = "";
7892 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
7893 string config_OnFire_entry = config_OnFire_class + particle_class;
7894 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7895 WPOF_array.Insert(WPOF);
7896 }
7897
7898
7899 m_OnFireEffect.Insert(id, WPOF_array);
7900 }
7901 }
7902
7903 if (!m_OnBulletCasingEjectEffect.Contains(id))
7904 {
7905 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
7906 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7907
7908 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7909
7910 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7911
7912 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7913 {
7914 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7915
7916 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7917 {
7918 string particle_class2 = "";
7919 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7920 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7921 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7922 WPOBE_array.Insert(WPOBE);
7923 }
7924
7925
7926 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
7927 }
7928 }
7929 }
7930
7931 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7933 {
7936
7937 if (!m_OnOverheatingEffect.Contains(id))
7938 {
7939 string config_to_search = "CfgVehicles";
7940
7941 if (IsInherited(Weapon))
7942 config_to_search = "CfgWeapons";
7943
7944 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
7945 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7946
7947 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
7948 {
7949
7950 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
7951
7953 {
7954 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
7955 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7956 Error(error);
7957 return;
7958 }
7959
7960 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
7961 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
7962
7963
7964
7965 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
7966 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7967
7968 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7969 {
7970 string particle_class = "";
7971 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7972 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7973 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
7974
7975 if (entry_type == CT_CLASS)
7976 {
7977 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7978 WPOOH_array.Insert(WPOF);
7979 }
7980 }
7981
7982
7983 m_OnOverheatingEffect.Insert(id, WPOOH_array);
7984 }
7985 }
7986 }
7987
7988 float GetOverheatingValue()
7989 {
7990 return m_OverheatingShots;
7991 }
7992
7993 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
7994 {
7995 if (m_MaxOverheatingValue > 0)
7996 {
7998
7999 if (!m_CheckOverheating)
8001
8003 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8004
8005 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8006 }
8007 }
8008
8009 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8010 {
8012 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8013
8015 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8016
8018 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8019
8021 {
8023 }
8024 }
8025
8027 {
8029 }
8030
8031 void OnOverheatingDecay()
8032 {
8033 if (m_MaxOverheatingValue > 0)
8034 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8035 else
8037
8038 if (m_OverheatingShots <= 0)
8039 {
8042 }
8043 else
8044 {
8045 if (!m_CheckOverheating)
8047
8049 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8050 }
8051
8052 CheckOverheating(this, "", this);
8053 }
8054
8055 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8056 {
8058 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8059 }
8060
8061 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8062 {
8064 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8066 }
8067
8068 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8069 {
8071 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8072 }
8073
8074 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8075 {
8077 m_OverheatingParticles = new array<ref OverheatingParticle>;
8078
8079 OverheatingParticle OP = new OverheatingParticle();
8080 OP.RegisterParticle(p);
8081 OP.SetOverheatingLimitMin(min_heat_coef);
8082 OP.SetOverheatingLimitMax(max_heat_coef);
8083 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8084
8085 m_OverheatingParticles.Insert(OP);
8086 }
8087
8088 float GetOverheatingCoef()
8089 {
8090 if (m_MaxOverheatingValue > 0)
8092
8093 return -1;
8094 }
8095
8097 {
8099 {
8100 float overheat_coef = GetOverheatingCoef();
8101 int count = m_OverheatingParticles.Count();
8102
8103 for (int i = count; i > 0; --i)
8104 {
8105 int id = i - 1;
8106 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8107 Particle p = OP.GetParticle();
8108
8109 float overheat_min = OP.GetOverheatingLimitMin();
8110 float overheat_max = OP.GetOverheatingLimitMax();
8111
8112 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8113 {
8114 if (p)
8115 {
8116 p.Stop();
8117 OP.RegisterParticle(null);
8118 }
8119 }
8120 }
8121 }
8122 }
8123
8125 {
8127 {
8128 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8129 {
8130 int id = i - 1;
8131 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8132
8133 if (OP)
8134 {
8135 Particle p = OP.GetParticle();
8136
8137 if (p)
8138 {
8139 p.Stop();
8140 }
8141
8142 delete OP;
8143 }
8144 }
8145
8146 m_OverheatingParticles.Clear();
8148 }
8149 }
8150
8152 float GetInfectionChance(int system = 0, Param param = null)
8153 {
8154 return 0.0;
8155 }
8156
8157
8158 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8159 {
8160 return 250;//default value
8161 }
8162
8163 float GetFilterDamageRatio()
8164 {
8165 return 0;
8166 }
8167
8169 bool HasMuzzle()
8170 {
8171 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8172 return true;
8173
8174 return false;
8175 }
8176
8178 int GetMuzzleID()
8179 {
8180 if (!m_WeaponTypeToID)
8182
8183 if (m_WeaponTypeToID.Contains(GetType()))
8184 {
8185 return m_WeaponTypeToID.Get(GetType());
8186 }
8187 else
8188 {
8189 // Register new weapon ID
8191 }
8192
8194 }
8195
8202 {
8203 return -1;
8204 }
8205
8206
8207
8208 // -------------------------------------------------------------------------
8209 void ~ItemBase()
8210 {
8211 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
8212 {
8213 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8214 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8215
8216 if (r_index >= 0)
8217 {
8218 InventoryLocation r_il = new InventoryLocation;
8219 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8220
8221 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8222 int r_type = r_il.GetType();
8223 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8224 {
8225 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8226 }
8227 else if (r_type == InventoryLocationType.ATTACHMENT)
8228 {
8229 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8230 }
8231
8232 }
8233
8234 player.GetHumanInventory().ClearUserReservedLocation(this);
8235 }
8236
8237 if (m_LockingSound)
8238 SEffectManager.DestroyEffect(m_LockingSound);
8239 }
8240
8241
8242
8243 // -------------------------------------------------------------------------
8244 static int GetDebugActionsMask()
8245 {
8246 return ItemBase.m_DebugActionsMask;
8247 }
8248
8249 static bool HasDebugActionsMask(int mask)
8250 {
8251 return ItemBase.m_DebugActionsMask & mask;
8252 }
8253
8254 static void SetDebugActionsMask(int mask)
8255 {
8256 ItemBase.m_DebugActionsMask = mask;
8257 }
8258
8259 static void AddDebugActionsMask(int mask)
8260 {
8261 ItemBase.m_DebugActionsMask |= mask;
8262 }
8263
8264 static void RemoveDebugActionsMask(int mask)
8265 {
8266 ItemBase.m_DebugActionsMask &= ~mask;
8267 }
8268
8269 static void ToggleDebugActionsMask(int mask)
8270 {
8271 if (HasDebugActionsMask(mask))
8272 {
8274 }
8275 else
8276 {
8277 AddDebugActionsMask(mask);
8278 }
8279 }
8280
8281 // -------------------------------------------------------------------------
8282 void SetCEBasedQuantity()
8283 {
8284 if (GetEconomyProfile())
8285 {
8286 float q_max = GetEconomyProfile().GetQuantityMax();
8287 if (q_max > 0)
8288 {
8289 float q_min = GetEconomyProfile().GetQuantityMin();
8290 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8291
8292 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
8293 {
8294 ComponentEnergyManager comp = GetCompEM();
8295 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
8296 {
8297 comp.SetEnergy0To1(quantity_randomized);
8298 }
8299 }
8300 else if (HasQuantity())
8301 {
8302 SetQuantityNormalized(quantity_randomized, false);
8303 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
8304 }
8305
8306 }
8307 }
8308 }
8309
8311 void LockToParent()
8312 {
8313 EntityAI parent = GetHierarchyParent();
8314
8315 if (parent)
8316 {
8317 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8318 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8319 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
8320 }
8321 }
8322
8324 void UnlockFromParent()
8325 {
8326 EntityAI parent = GetHierarchyParent();
8327
8328 if (parent)
8329 {
8330 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8331 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8332 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
8333 }
8334 }
8335
8336 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
8337 {
8338 /*
8339 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
8340 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
8341 */
8342 ItemBase item2 = ItemBase.Cast(entity2);
8343
8344 if (GetGame().IsClient())
8345 {
8346 if (ScriptInputUserData.CanStoreInputUserData())
8347 {
8348 ScriptInputUserData ctx = new ScriptInputUserData;
8350 ctx.Write(-1);
8351 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8352 ctx.Write(i1);
8353 ctx.Write(item2);
8354 ctx.Write(use_stack_max);
8355 ctx.Write(-1);
8356 ctx.Send();
8357
8358 if (IsCombineAll(item2, use_stack_max))
8359 {
8360 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8361 }
8362 }
8363 }
8364 else if (!GetGame().IsMultiplayer())
8365 {
8366 CombineItems(item2, use_stack_max);
8367 }
8368 }
8369
8370 bool IsLiquidPresent()
8371 {
8372 return (GetLiquidType() != 0 && HasQuantity());
8373 }
8374
8375 bool IsLiquidContainer()
8376 {
8377 return m_LiquidContainerMask != 0;
8378 }
8379
8381 {
8382 return m_LiquidContainerMask;
8383 }
8384
8385 bool IsBloodContainer()
8386 {
8387 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
8388 return false;
8389 }
8390
8391 bool IsNVG()
8392 {
8393 return false;
8394 }
8395
8398 bool IsExplosive()
8399 {
8400 return false;
8401 }
8402
8404 {
8405 return "";
8406 }
8407
8409
8410 bool IsLightSource()
8411 {
8412 return false;
8413 }
8414
8416 {
8417 return true;
8418 }
8419
8420 //--- ACTION CONDITIONS
8421 //direction
8422 bool IsFacingPlayer(PlayerBase player, string selection)
8423 {
8424 return true;
8425 }
8426
8427 bool IsPlayerInside(PlayerBase player, string selection)
8428 {
8429 return true;
8430 }
8431
8432 override bool CanObstruct()
8433 {
8434 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
8435 return !player || !IsPlayerInside(player, "");
8436 }
8437
8438 override bool IsBeingPlaced()
8439 {
8440 return m_IsBeingPlaced;
8441 }
8442
8443 void SetIsBeingPlaced(bool is_being_placed)
8444 {
8445 m_IsBeingPlaced = is_being_placed;
8446 if (!is_being_placed)
8448 SetSynchDirty();
8449 }
8450
8451 //server-side
8452 void OnEndPlacement() {}
8453
8454 override bool IsHologram()
8455 {
8456 return m_IsHologram;
8457 }
8458
8459 bool CanBeDigged()
8460 {
8461 return m_CanBeDigged;
8462 }
8463
8465 {
8466 return 1;
8467 }
8468
8469 bool CanMakeGardenplot()
8470 {
8471 return false;
8472 }
8473
8474 void SetIsHologram(bool is_hologram)
8475 {
8476 m_IsHologram = is_hologram;
8477 SetSynchDirty();
8478 }
8479 /*
8480 protected float GetNutritionalEnergy()
8481 {
8482 Edible_Base edible = Edible_Base.Cast(this);
8483 return edible.GetFoodEnergy();
8484 }
8485
8486 protected float GetNutritionalWaterContent()
8487 {
8488 Edible_Base edible = Edible_Base.Cast(this);
8489 return edible.GetFoodWater();
8490 }
8491
8492 protected float GetNutritionalIndex()
8493 {
8494 Edible_Base edible = Edible_Base.Cast(this);
8495 return edible.GetFoodNutritionalIndex();
8496 }
8497
8498 protected float GetNutritionalFullnessIndex()
8499 {
8500 Edible_Base edible = Edible_Base.Cast(this);
8501 return edible.GetFoodTotalVolume();
8502 }
8503
8504 protected float GetNutritionalToxicity()
8505 {
8506 Edible_Base edible = Edible_Base.Cast(this);
8507 return edible.GetFoodToxicity();
8508
8509 }
8510 */
8511
8512
8513 // -------------------------------------------------------------------------
8514 override void OnMovedInsideCargo(EntityAI container)
8515 {
8516 super.OnMovedInsideCargo(container);
8517
8518 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8519 }
8520
8521 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8522 {
8523 super.EEItemLocationChanged(oldLoc,newLoc);
8524
8525 PlayerBase new_player = null;
8526 PlayerBase old_player = null;
8527
8528 if (newLoc.GetParent())
8529 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8530
8531 if (oldLoc.GetParent())
8532 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8533
8534 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
8535 {
8536 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8537
8538 if (r_index >= 0)
8539 {
8540 InventoryLocation r_il = new InventoryLocation;
8541 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8542
8543 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8544 int r_type = r_il.GetType();
8545 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8546 {
8547 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8548 }
8549 else if (r_type == InventoryLocationType.ATTACHMENT)
8550 {
8551 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8552 }
8553
8554 }
8555 }
8556
8557 if (newLoc.GetType() == InventoryLocationType.HANDS)
8558 {
8559 if (new_player)
8560 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8561
8562 if (new_player == old_player)
8563 {
8564
8565 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8566 {
8567 if (oldLoc.GetType() == InventoryLocationType.CARGO)
8568 {
8569 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8570 {
8571 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8572 }
8573 }
8574 else
8575 {
8576 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8577 }
8578 }
8579
8580 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8581 {
8582 int type = oldLoc.GetType();
8583 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
8584 {
8585 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8586 }
8587 else if (type == InventoryLocationType.ATTACHMENT)
8588 {
8589 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8590 }
8591 }
8592 if (!m_OldLocation)
8593 {
8594 m_OldLocation = new InventoryLocation;
8595 }
8596 m_OldLocation.Copy(oldLoc);
8597 }
8598 else
8599 {
8600 if (m_OldLocation)
8601 {
8602 m_OldLocation.Reset();
8603 }
8604 }
8605
8607 }
8608 else
8609 {
8610 if (new_player)
8611 {
8612 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8613 if (res_index >= 0)
8614 {
8615 InventoryLocation il = new InventoryLocation;
8616 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8617 ItemBase it = ItemBase.Cast(il.GetItem());
8618 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8619 int rel_type = il.GetType();
8620 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
8621 {
8622 il.GetParent().GetOnReleaseLock().Invoke(it);
8623 }
8624 else if (rel_type == InventoryLocationType.ATTACHMENT)
8625 {
8626 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
8627 }
8628 //it.GetOnReleaseLock().Invoke(it);
8629 }
8630 }
8631 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
8632 {
8633 //ThrowPhysically(old_player, vector.Zero);
8634 m_ThrowItemOnDrop = false;
8635 }
8636
8637 if (m_OldLocation)
8638 {
8639 m_OldLocation.Reset();
8640 }
8641 }
8642 }
8643
8644 override void EOnContact(IEntity other, Contact extra)
8645 {
8647 {
8648 int liquidType = -1;
8649 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
8650 if (impactSpeed > 0.0)
8651 {
8652 m_ImpactSpeed = impactSpeed;
8653 #ifndef SERVER
8654 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8655 #else
8656 m_WantPlayImpactSound = true;
8657 SetSynchDirty();
8658 #endif
8659 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
8660 }
8661 }
8662
8663 #ifdef SERVER
8664 if (GetCompEM() && GetCompEM().IsPlugged())
8665 {
8666 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
8667 GetCompEM().UnplugThis();
8668 }
8669 #endif
8670 }
8671
8672 void RefreshPhysics();
8673
8674 override void OnCreatePhysics()
8675 {
8677 }
8678
8679 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8680 {
8681
8682 }
8683 // -------------------------------------------------------------------------
8684 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
8685 {
8686 super.OnItemLocationChanged(old_owner, new_owner);
8687
8688 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8689 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8690
8691 if (!relatedPlayer && playerNew)
8692 relatedPlayer = playerNew;
8693
8694 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8695 {
8696 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
8697 if (actionMgr)
8698 {
8699 ActionBase currentAction = actionMgr.GetRunningAction();
8700 if (currentAction)
8701 currentAction.OnItemLocationChanged(this);
8702 }
8703 }
8704
8705 Man ownerPlayerOld = null;
8706 Man ownerPlayerNew = null;
8707
8708 if (old_owner)
8709 {
8710 if (old_owner.IsMan())
8711 {
8712 ownerPlayerOld = Man.Cast(old_owner);
8713 }
8714 else
8715 {
8716 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8717 }
8718 }
8719 else
8720 {
8721 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
8722 {
8723 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
8724
8725 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
8726 {
8727 GetCompEM().UnplugThis();
8728 }
8729 }
8730 }
8731
8732 if (new_owner)
8733 {
8734 if (new_owner.IsMan())
8735 {
8736 ownerPlayerNew = Man.Cast(new_owner);
8737 }
8738 else
8739 {
8740 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8741 }
8742 }
8743
8744 if (ownerPlayerOld != ownerPlayerNew)
8745 {
8746 if (ownerPlayerOld)
8747 {
8748 array<EntityAI> subItemsExit = new array<EntityAI>;
8749 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
8750 for (int i = 0; i < subItemsExit.Count(); i++)
8751 {
8752 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
8753 itemExit.OnInventoryExit(ownerPlayerOld);
8754 }
8755 }
8756
8757 if (ownerPlayerNew)
8758 {
8759 array<EntityAI> subItemsEnter = new array<EntityAI>;
8760 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
8761 for (int j = 0; j < subItemsEnter.Count(); j++)
8762 {
8763 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
8764 itemEnter.OnInventoryEnter(ownerPlayerNew);
8765 }
8766 }
8767 }
8768 else if (ownerPlayerNew != null)
8769 {
8770 PlayerBase nplayer;
8771 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8772 {
8773 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8774 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
8775 for (int k = 0; k < subItemsUpdate.Count(); k++)
8776 {
8777 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
8778 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8779 }
8780 }
8781 }
8782
8783 if (old_owner)
8784 old_owner.OnChildItemRemoved(this);
8785 if (new_owner)
8786 new_owner.OnChildItemReceived(this);
8787 }
8788
8789 // -------------------------------------------------------------------------------
8790 override void EEDelete(EntityAI parent)
8791 {
8792 super.EEDelete(parent);
8793 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8794 if (player)
8795 {
8796 OnInventoryExit(player);
8797
8798 if (player.IsAlive())
8799 {
8800 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8801 if (r_index >= 0)
8802 {
8803 InventoryLocation r_il = new InventoryLocation;
8804 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8805
8806 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8807 int r_type = r_il.GetType();
8808 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8809 {
8810 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8811 }
8812 else if (r_type == InventoryLocationType.ATTACHMENT)
8813 {
8814 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8815 }
8816
8817 }
8818
8819 player.RemoveQuickBarEntityShortcut(this);
8820 }
8821 }
8822 }
8823 // -------------------------------------------------------------------------------
8824 override void EEKilled(Object killer)
8825 {
8826 super.EEKilled(killer);
8827
8829 if (killer && killer.IsFireplace() && CanExplodeInFire())
8830 {
8831 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8832 {
8833 if (IsMagazine())
8834 {
8835 if (Magazine.Cast(this).GetAmmoCount() > 0)
8836 {
8837 ExplodeAmmo();
8838 }
8839 }
8840 else
8841 {
8842 Explode(DamageType.EXPLOSION);
8843 }
8844 }
8845 }
8846 }
8847
8848 override void OnWasAttached(EntityAI parent, int slot_id)
8849 {
8850 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8851
8852 super.OnWasAttached(parent, slot_id);
8853
8854 if (HasQuantity())
8855 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8856
8857 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
8858 }
8859
8860 override void OnWasDetached(EntityAI parent, int slot_id)
8861 {
8862 super.OnWasDetached(parent, slot_id);
8863
8864 if (HasQuantity())
8865 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8866 }
8867
8868 override string ChangeIntoOnAttach(string slot)
8869 {
8870 int idx;
8871 TStringArray inventory_slots = new TStringArray;
8872 TStringArray attach_types = new TStringArray;
8873
8874 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8875 if (inventory_slots.Count() < 1) //is string
8876 {
8877 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8878 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8879 }
8880 else //is array
8881 {
8882 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8883 }
8884
8885 idx = inventory_slots.Find(slot);
8886 if (idx < 0)
8887 return "";
8888
8889 return attach_types.Get(idx);
8890 }
8891
8892 override string ChangeIntoOnDetach()
8893 {
8894 int idx = -1;
8895 string slot;
8896
8897 TStringArray inventory_slots = new TStringArray;
8898 TStringArray detach_types = new TStringArray;
8899
8900 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8901 if (inventory_slots.Count() < 1) //is string
8902 {
8903 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8904 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8905 }
8906 else //is array
8907 {
8908 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8909 if (detach_types.Count() < 1)
8910 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8911 }
8912
8913 for (int i = 0; i < inventory_slots.Count(); i++)
8914 {
8915 slot = inventory_slots.Get(i);
8916 }
8917
8918 if (slot != "")
8919 {
8920 if (detach_types.Count() == 1)
8921 idx = 0;
8922 else
8923 idx = inventory_slots.Find(slot);
8924 }
8925 if (idx < 0)
8926 return "";
8927
8928 return detach_types.Get(idx);
8929 }
8930
8931 void ExplodeAmmo()
8932 {
8933 //timer
8934 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
8935
8936 //min/max time
8937 float min_time = 1;
8938 float max_time = 3;
8939 float delay = Math.RandomFloat(min_time, max_time);
8940
8941 explode_timer.Run(delay, this, "DoAmmoExplosion");
8942 }
8943
8944 void DoAmmoExplosion()
8945 {
8946 Magazine magazine = Magazine.Cast(this);
8947 int pop_sounds_count = 6;
8948 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8949
8950 //play sound
8951 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8952 string sound_name = pop_sounds[ sound_idx ];
8953 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
8954
8955 //remove ammo count
8956 magazine.ServerAddAmmoCount(-1);
8957
8958 //if condition then repeat -> ExplodeAmmo
8959 float min_temp_to_explode = 100; //min temperature for item to explode
8960
8961 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
8962 {
8963 ExplodeAmmo();
8964 }
8965 }
8966
8967 // -------------------------------------------------------------------------------
8968 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
8969 {
8970 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
8971
8972 const int CHANCE_DAMAGE_CARGO = 4;
8973 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8974 const int CHANCE_DAMAGE_NOTHING = 2;
8975
8976 if (IsClothing() || IsContainer() || IsItemTent())
8977 {
8978 float dmg = damageResult.GetDamage("","Health") * -0.5;
8979 int chances;
8980 int rnd;
8981
8982 if (GetInventory().GetCargo())
8983 {
8984 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8985 rnd = Math.RandomInt(0,chances);
8986
8987 if (rnd < CHANCE_DAMAGE_CARGO)
8988 {
8989 DamageItemInCargo(dmg);
8990 }
8991 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8992 {
8994 }
8995 }
8996 else
8997 {
8998 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8999 rnd = Math.RandomInt(0,chances);
9000
9001 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9002 {
9004 }
9005 }
9006 }
9007 }
9008
9009 bool DamageItemInCargo(float damage)
9010 {
9011 if (GetInventory().GetCargo())
9012 {
9013 int item_count = GetInventory().GetCargo().GetItemCount();
9014 if (item_count > 0)
9015 {
9016 int random_pick = Math.RandomInt(0, item_count);
9017 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9018 if (!item.IsExplosive())
9019 {
9020 item.AddHealth("","",damage);
9021 return true;
9022 }
9023 }
9024 }
9025 return false;
9026 }
9027
9028 bool DamageItemAttachments(float damage)
9029 {
9030 int attachment_count = GetInventory().AttachmentCount();
9031 if (attachment_count > 0)
9032 {
9033 int random_pick = Math.RandomInt(0, attachment_count);
9034 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9035 if (!attachment.IsExplosive())
9036 {
9037 attachment.AddHealth("","",damage);
9038 return true;
9039 }
9040 }
9041 return false;
9042 }
9043
9044 override bool IsSplitable()
9045 {
9046 return m_CanThisBeSplit;
9047 }
9048 //----------------
9049 override bool CanBeSplit()
9050 {
9051 if (IsSplitable() && (GetQuantity() > 1))
9052 return GetInventory().CanRemoveEntity();
9053
9054 return false;
9055 }
9056
9057 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9058 {
9059 if (!CanBeSplit())
9060 return;
9061
9062 if (GetGame().IsClient())
9063 {
9064 if (ScriptInputUserData.CanStoreInputUserData())
9065 {
9066 ScriptInputUserData ctx = new ScriptInputUserData;
9068 ctx.Write(1);
9069 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9070 ctx.Write(i1);
9071 ctx.Write(destination_entity);
9072 ctx.Write(true);
9073 ctx.Write(slot_id);
9074 ctx.Send();
9075 }
9076 }
9077 else if (!GetGame().IsMultiplayer())
9078 {
9079 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9080 }
9081 }
9082
9083 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9084 {
9085 if (!CanBeSplit())
9086 return;
9087
9088 float split_quantity_new;
9089 ref ItemBase new_item;
9090 float quantity = GetQuantity();
9091 float stack_max = GetTargetQuantityMax(slot_id);
9092 InventoryLocation loc = new InventoryLocation;
9093
9094 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9095 {
9096 if (stack_max <= GetQuantity())
9097 split_quantity_new = stack_max;
9098 else
9099 split_quantity_new = GetQuantity();
9100
9101 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9102 if (new_item)
9103 {
9104 new_item.SetResultOfSplit(true);
9105 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9106 AddQuantity(-split_quantity_new);
9107 new_item.SetQuantity(split_quantity_new);
9108 }
9109 }
9110 else if (destination_entity && slot_id == -1)
9111 {
9112 if (quantity > stack_max)
9113 split_quantity_new = stack_max;
9114 else
9115 split_quantity_new = quantity;
9116
9117 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9118 {
9119 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9120 new_item = ItemBase.Cast(o);
9121 }
9122
9123 if (new_item)
9124 {
9125 new_item.SetResultOfSplit(true);
9126 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9127 AddQuantity(-split_quantity_new);
9128 new_item.SetQuantity(split_quantity_new);
9129 }
9130 }
9131 else
9132 {
9133 if (stack_max != 0)
9134 {
9135 if (stack_max < GetQuantity())
9136 {
9137 split_quantity_new = GetQuantity() - stack_max;
9138 }
9139
9140 if (split_quantity_new == 0)
9141 {
9142 if (!GetGame().IsMultiplayer())
9143 player.PhysicalPredictiveDropItem(this);
9144 else
9145 player.ServerDropEntity(this);
9146 return;
9147 }
9148
9149 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9150
9151 if (new_item)
9152 {
9153 new_item.SetResultOfSplit(true);
9154 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9155 SetQuantity(split_quantity_new);
9156 new_item.SetQuantity(stack_max);
9157 new_item.PlaceOnSurface();
9158 }
9159 }
9160 }
9161 }
9162
9163 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9164 {
9165 if (!CanBeSplit())
9166 return;
9167
9168 float split_quantity_new;
9169 ref ItemBase new_item;
9170 float quantity = GetQuantity();
9171 float stack_max = GetTargetQuantityMax(slot_id);
9172 InventoryLocation loc = new InventoryLocation;
9173
9174 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9175 {
9176 if (stack_max <= GetQuantity())
9177 split_quantity_new = stack_max;
9178 else
9179 split_quantity_new = GetQuantity();
9180
9181 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9182 if (new_item)
9183 {
9184 new_item.SetResultOfSplit(true);
9185 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9186 AddQuantity(-split_quantity_new);
9187 new_item.SetQuantity(split_quantity_new);
9188 }
9189 }
9190 else if (destination_entity && slot_id == -1)
9191 {
9192 if (quantity > stack_max)
9193 split_quantity_new = stack_max;
9194 else
9195 split_quantity_new = quantity;
9196
9197 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9198 {
9199 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9200 new_item = ItemBase.Cast(o);
9201 }
9202
9203 if (new_item)
9204 {
9205 new_item.SetResultOfSplit(true);
9206 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9207 AddQuantity(-split_quantity_new);
9208 new_item.SetQuantity(split_quantity_new);
9209 }
9210 }
9211 else
9212 {
9213 if (stack_max != 0)
9214 {
9215 if (stack_max < GetQuantity())
9216 {
9217 split_quantity_new = GetQuantity() - stack_max;
9218 }
9219
9220 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9221
9222 if (new_item)
9223 {
9224 new_item.SetResultOfSplit(true);
9225 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9226 SetQuantity(split_quantity_new);
9227 new_item.SetQuantity(stack_max);
9228 new_item.PlaceOnSurface();
9229 }
9230 }
9231 }
9232 }
9233
9234 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
9235 {
9236 if (!CanBeSplit())
9237 return;
9238
9239 if (GetGame().IsClient())
9240 {
9241 if (ScriptInputUserData.CanStoreInputUserData())
9242 {
9243 ScriptInputUserData ctx = new ScriptInputUserData;
9245 ctx.Write(4);
9246 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9247 ctx.Write(thiz);
9248 dst.WriteToContext(ctx);
9249 ctx.Send();
9250 }
9251 }
9252 else if (!GetGame().IsMultiplayer())
9253 {
9255 }
9256 }
9257
9258 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
9259 {
9260 if (!CanBeSplit())
9261 return;
9262
9263 if (GetGame().IsClient())
9264 {
9265 if (ScriptInputUserData.CanStoreInputUserData())
9266 {
9267 ScriptInputUserData ctx = new ScriptInputUserData;
9269 ctx.Write(2);
9270 ItemBase dummy = this; // @NOTE: workaround for correct serialization
9271 ctx.Write(dummy);
9272 ctx.Write(destination_entity);
9273 ctx.Write(true);
9274 ctx.Write(idx);
9275 ctx.Write(row);
9276 ctx.Write(col);
9277 ctx.Send();
9278 }
9279 }
9280 else if (!GetGame().IsMultiplayer())
9281 {
9282 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
9283 }
9284 }
9285
9286 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
9287 {
9289 }
9290
9291 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
9292 {
9293 if (!CanBeSplit())
9294 return this;
9295
9296 float quantity = GetQuantity();
9297 float split_quantity_new;
9298 ItemBase new_item;
9299 if (dst.IsValid())
9300 {
9301 int slot_id = dst.GetSlot();
9302 float stack_max = GetTargetQuantityMax(slot_id);
9303
9304 if (quantity > stack_max)
9305 split_quantity_new = stack_max;
9306 else
9307 split_quantity_new = quantity;
9308
9309 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9310
9311 if (new_item)
9312 {
9313 new_item.SetResultOfSplit(true);
9314 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9315 AddQuantity(-split_quantity_new);
9316 new_item.SetQuantity(split_quantity_new);
9317 }
9318
9319 return new_item;
9320 }
9321
9322 return null;
9323 }
9324
9325 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
9326 {
9327 if (!CanBeSplit())
9328 return;
9329
9330 float quantity = GetQuantity();
9331 float split_quantity_new;
9332 ref ItemBase new_item;
9333 if (destination_entity)
9334 {
9335 float stackable = GetTargetQuantityMax();
9336 if (quantity > stackable)
9337 split_quantity_new = stackable;
9338 else
9339 split_quantity_new = quantity;
9340
9341 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
9342 if (new_item)
9343 {
9344 new_item.SetResultOfSplit(true);
9345 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9346 AddQuantity(-split_quantity_new);
9347 new_item.SetQuantity(split_quantity_new);
9348 }
9349 }
9350 }
9351
9352 void SplitIntoStackMaxHandsClient(PlayerBase player)
9353 {
9354 if (!CanBeSplit())
9355 return;
9356
9357 if (GetGame().IsClient())
9358 {
9359 if (ScriptInputUserData.CanStoreInputUserData())
9360 {
9361 ScriptInputUserData ctx = new ScriptInputUserData;
9363 ctx.Write(3);
9364 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9365 ctx.Write(i1);
9366 ItemBase destination_entity = this;
9367 ctx.Write(destination_entity);
9368 ctx.Write(true);
9369 ctx.Write(0);
9370 ctx.Send();
9371 }
9372 }
9373 else if (!GetGame().IsMultiplayer())
9374 {
9375 SplitIntoStackMaxHands(player);
9376 }
9377 }
9378
9379 void SplitIntoStackMaxHands(PlayerBase player)
9380 {
9381 if (!CanBeSplit())
9382 return;
9383
9384 float quantity = GetQuantity();
9385 float split_quantity_new;
9386 ref ItemBase new_item;
9387 if (player)
9388 {
9389 float stackable = GetTargetQuantityMax();
9390 if (quantity > stackable)
9391 split_quantity_new = stackable;
9392 else
9393 split_quantity_new = quantity;
9394
9395 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
9396 new_item = ItemBase.Cast(in_hands);
9397 if (new_item)
9398 {
9399 new_item.SetResultOfSplit(true);
9400 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9401 AddQuantity(-split_quantity_new);
9402 new_item.SetQuantity(split_quantity_new);
9403 }
9404 }
9405 }
9406
9407 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
9408 {
9409 if (!CanBeSplit())
9410 return;
9411
9412 float quantity = GetQuantity();
9413 float split_quantity_new = Math.Floor(quantity * 0.5);
9414
9415 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9416
9417 if (new_item)
9418 {
9419 if (new_item.GetQuantityMax() < split_quantity_new)
9420 {
9421 split_quantity_new = new_item.GetQuantityMax();
9422 }
9423
9424 new_item.SetResultOfSplit(true);
9425 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9426
9427 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9428 {
9429 AddQuantity(-1);
9430 new_item.SetQuantity(1);
9431 }
9432 else
9433 {
9434 AddQuantity(-split_quantity_new);
9435 new_item.SetQuantity(split_quantity_new);
9436 }
9437 }
9438 }
9439
9440 void SplitItem(PlayerBase player)
9441 {
9442 if (!CanBeSplit())
9443 return;
9444
9445 float quantity = GetQuantity();
9446 float split_quantity_new = Math.Floor(quantity / 2);
9447
9448 InventoryLocation invloc = new InventoryLocation;
9449 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
9450
9451 ItemBase new_item;
9452 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9453
9454 if (new_item)
9455 {
9456 if (new_item.GetQuantityMax() < split_quantity_new)
9457 {
9458 split_quantity_new = new_item.GetQuantityMax();
9459 }
9460 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9461 {
9462 AddQuantity(-1);
9463 new_item.SetQuantity(1);
9464 }
9465 else
9466 {
9467 AddQuantity(-split_quantity_new);
9468 new_item.SetQuantity(split_quantity_new);
9469 }
9470 }
9471 }
9472
9474 void OnQuantityChanged(float delta)
9475 {
9476 SetWeightDirty();
9477 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
9478
9479 if (parent)
9480 parent.OnAttachmentQuantityChangedEx(this, delta);
9481
9482 if (IsLiquidContainer())
9483 {
9484 if (GetQuantityNormalized() <= 0.0)
9485 {
9487 }
9488 else if (GetLiquidType() == LIQUID_NONE)
9489 {
9490 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
9492 }
9493 }
9494
9495 }
9496
9499 {
9500 // insert code here
9501 }
9502
9504 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
9505 {
9507 }
9508
9509 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
9510 {
9511 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9512
9513 if (GetGame().IsServer())
9514 {
9515 if (newLevel == GameConstants.STATE_RUINED)
9516 {
9518 EntityAI parent = GetHierarchyParent();
9519 if (parent && parent.IsFireplace())
9520 {
9521 CargoBase cargo = GetInventory().GetCargo();
9522 if (cargo)
9523 {
9524 for (int i = 0; i < cargo.GetItemCount(); ++i)
9525 {
9526 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
9527 }
9528 }
9529 }
9530 }
9531
9532 if (IsResultOfSplit())
9533 {
9534 // reset the splitting result flag, return to normal item behavior
9535 SetResultOfSplit(false);
9536 return;
9537 }
9538
9539 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9540 {
9541 SetCleanness(0);//unclean the item upon damage dealt
9542 }
9543 }
9544 }
9545
9546 // just the split? TODO: verify
9547 override void OnRightClick()
9548 {
9549 super.OnRightClick();
9550
9551 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
9552 {
9553 if (GetGame().IsClient())
9554 {
9555 if (ScriptInputUserData.CanStoreInputUserData())
9556 {
9557 vector m4[4];
9558 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9559
9560 EntityAI root = GetHierarchyRoot();
9561
9562 InventoryLocation dst = new InventoryLocation;
9563 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
9564 {
9565 if (root)
9566 {
9567 root.GetTransform(m4);
9568 dst.SetGround(this, m4);
9569 }
9570 else
9571 GetInventory().GetCurrentInventoryLocation(dst);
9572 }
9573 else
9574 {
9575 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
9576 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
9577 this shouldnt cause issues within this scope*/
9578 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
9579 {
9580 if (root)
9581 {
9582 root.GetTransform(m4);
9583 dst.SetGround(this, m4);
9584 }
9585 else
9586 GetInventory().GetCurrentInventoryLocation(dst);
9587 }
9588 else
9589 {
9590 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9591 }
9592 }
9593
9594 ScriptInputUserData ctx = new ScriptInputUserData;
9596 ctx.Write(4);
9597 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9598 ctx.Write(thiz);
9599 dst.WriteToContext(ctx);
9600 ctx.Write(true); // dummy
9601 ctx.Send();
9602 }
9603 }
9604 else if (!GetGame().IsMultiplayer())
9605 {
9606 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
9607 }
9608 }
9609 }
9610
9611 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
9612 {
9613 //TODO: delete check zero quantity check after fix double posts hands fsm events
9614 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
9615 return false;
9616
9617 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9618 return false;
9619
9620 //can_this_be_combined = ConfigGetBool("canBeSplit");
9622 return false;
9623
9624
9625 Magazine mag = Magazine.Cast(this);
9626 if (mag)
9627 {
9628 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9629 return false;
9630
9631 if (stack_max_limit)
9632 {
9633 Magazine other_mag = Magazine.Cast(other_item);
9634 if (other_item)
9635 {
9636 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9637 return false;
9638 }
9639
9640 }
9641 }
9642 else
9643 {
9644 //TODO: delete check zero quantity check after fix double posts hands fsm events
9645 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
9646 return false;
9647
9648 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
9649 return false;
9650 }
9651
9652 PlayerBase player = null;
9653 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
9654 {
9655 if (player.GetInventory().HasAttachment(this))
9656 return false;
9657
9658 if (player.IsItemsToDelete())
9659 return false;
9660 }
9661
9662 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9663 return false;
9664
9665 int slotID;
9666 string slotName;
9667 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9668 return false;
9669
9670 return true;
9671 }
9672
9673 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
9674 {
9675 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
9676 }
9677
9678 bool IsResultOfSplit()
9679 {
9680 return m_IsResultOfSplit;
9681 }
9682
9683 void SetResultOfSplit(bool value)
9684 {
9685 m_IsResultOfSplit = value;
9686 }
9687
9688 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
9689 {
9690 return ComputeQuantityUsedEx(other_item, use_stack_max);
9691 }
9692
9693 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
9694 {
9695 float other_item_quantity = other_item.GetQuantity();
9696 float this_free_space;
9697
9698 float stack_max = GetQuantityMax();
9699
9700 this_free_space = stack_max - GetQuantity();
9701
9702 if (other_item_quantity > this_free_space)
9703 {
9704 return this_free_space;
9705 }
9706 else
9707 {
9708 return other_item_quantity;
9709 }
9710 }
9711
9712 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
9713 {
9714 CombineItems(ItemBase.Cast(entity2),use_stack_max);
9715 }
9716
9717 void CombineItems(ItemBase other_item, bool use_stack_max = true)
9718 {
9719 if (!CanBeCombined(other_item, false))
9720 return;
9721
9722 if (!IsMagazine() && other_item)
9723 {
9724 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
9725 if (quantity_used != 0)
9726 {
9727 float hp1 = GetHealth01("","");
9728 float hp2 = other_item.GetHealth01("","");
9729 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
9730 hpResult = hpResult / (GetQuantity() + quantity_used);
9731
9732 hpResult *= GetMaxHealth();
9733 Math.Round(hpResult);
9734 SetHealth("", "Health", hpResult);
9735
9736 AddQuantity(quantity_used);
9737 other_item.AddQuantity(-quantity_used);
9738 }
9739 }
9740 OnCombine(other_item);
9741 }
9742
9743 void OnCombine(ItemBase other_item)
9744 {
9745 #ifdef SERVER
9746 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9747 GetHierarchyParent().IncreaseLifetimeUp();
9748 #endif
9749 };
9750
9751 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
9752 {
9753 PlayerBase p = PlayerBase.Cast(player);
9754
9755 array<int> recipesIds = p.m_Recipes;
9756 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9757 if (moduleRecipesManager)
9758 {
9759 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9760 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
9761 }
9762
9763 for (int i = 0;i < recipesIds.Count(); i++)
9764 {
9765 int key = recipesIds.Get(i);
9766 string recipeName = moduleRecipesManager.GetRecipeName(key);
9767 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
9768 }
9769 }
9770
9771 // -------------------------------------------------------------------------
9772 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9773 {
9774 super.GetDebugActions(outputList);
9775
9776 //quantity
9777 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
9778 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
9779 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
9780 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
9781
9782 //health
9783 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
9784 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
9785 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
9786 //temperature
9787 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
9788 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
9789 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
9790
9791 //wet
9792 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
9793 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
9794
9795 //liquidtype
9796 if (IsLiquidContainer())
9797 {
9798 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
9799 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
9800 }
9801
9802 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
9803 // watch
9804 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
9805 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
9806
9807 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
9808 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
9809 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
9810 }
9811
9812 // -------------------------------------------------------------------------
9813 // -------------------------------------------------------------------------
9814 // -------------------------------------------------------------------------
9815 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
9816 {
9817 super.OnAction(action_id, player, ctx);
9818 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
9819 {
9820 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9821 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
9822 PlayerBase p = PlayerBase.Cast(player);
9823 if (EActions.RECIPES_RANGE_START < 1000)
9824 {
9825 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9826 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9827 }
9828 }
9829 #ifndef SERVER
9830 else if (action_id == EActions.WATCH_PLAYER)
9831 {
9832 PluginDeveloper.SetDeveloperItemClientEx(player);
9833 }
9834 #endif
9835 if (GetGame().IsServer())
9836 {
9837 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9838 {
9839 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9840 OnDebugButtonPressServer(id + 1);
9841 }
9842
9843 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9844 {
9845 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9846 InsertAgent(agent_id,100);
9847 }
9848
9849 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9850 {
9851 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9852 RemoveAgent(agent_id2);
9853 }
9854
9855 else if (action_id == EActions.ADD_QUANTITY)
9856 {
9857 if (IsMagazine())
9858 {
9859 Magazine mag = Magazine.Cast(this);
9860 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9861 }
9862 else
9863 {
9864 AddQuantity(GetQuantityMax() * 0.2);
9865 }
9866
9867 if (m_EM)
9868 {
9869 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9870 }
9871 //PrintVariables();
9872 }
9873
9874 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
9875 {
9876 if (IsMagazine())
9877 {
9878 Magazine mag2 = Magazine.Cast(this);
9879 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9880 }
9881 else
9882 {
9883 AddQuantity(- GetQuantityMax() * 0.2);
9884 }
9885 if (m_EM)
9886 {
9887 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9888 }
9889 //PrintVariables();
9890 }
9891
9892 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
9893 {
9894 SetQuantity(0);
9895
9896 if (m_EM)
9897 {
9898 m_EM.SetEnergy(0);
9899 }
9900 }
9901
9902 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
9903 {
9905
9906 if (m_EM)
9907 {
9908 m_EM.SetEnergy(m_EM.GetEnergyMax());
9909 }
9910 }
9911
9912 else if (action_id == EActions.ADD_HEALTH)
9913 {
9914 AddHealth("","",GetMaxHealth("","Health")/5);
9915 }
9916 else if (action_id == EActions.REMOVE_HEALTH)
9917 {
9918 AddHealth("","",-GetMaxHealth("","Health")/5);
9919 }
9920 else if (action_id == EActions.DESTROY_HEALTH)
9921 {
9922 SetHealth01("","",0);
9923 }
9924 else if (action_id == EActions.WATCH_ITEM)
9925 {
9927 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
9928 #ifdef DEVELOPER
9929 SetDebugDeveloper_item(this);
9930 #endif
9931 }
9932
9933 else if (action_id == EActions.ADD_TEMPERATURE)
9934 {
9935 AddTemperature(20);
9936 //PrintVariables();
9937 }
9938
9939 else if (action_id == EActions.REMOVE_TEMPERATURE)
9940 {
9941 AddTemperature(-20);
9942 //PrintVariables();
9943 }
9944
9945 else if (action_id == EActions.FLIP_FROZEN)
9946 {
9947 SetFrozen(!GetIsFrozen());
9948 //PrintVariables();
9949 }
9950
9951 else if (action_id == EActions.ADD_WETNESS)
9952 {
9953 AddWet(GetWetMax()/5);
9954 //PrintVariables();
9955 }
9956
9957 else if (action_id == EActions.REMOVE_WETNESS)
9958 {
9959 AddWet(-GetWetMax()/5);
9960 //PrintVariables();
9961 }
9962
9963 else if (action_id == EActions.LIQUIDTYPE_UP)
9964 {
9965 int curr_type = GetLiquidType();
9966 SetLiquidType(curr_type * 2);
9967 //AddWet(1);
9968 //PrintVariables();
9969 }
9970
9971 else if (action_id == EActions.LIQUIDTYPE_DOWN)
9972 {
9973 int curr_type2 = GetLiquidType();
9974 SetLiquidType(curr_type2 / 2);
9975 }
9976
9977 else if (action_id == EActions.MAKE_SPECIAL)
9978 {
9979 auto debugParams = DebugSpawnParams.WithPlayer(player);
9980 OnDebugSpawnEx(debugParams);
9981 }
9982
9983 else if (action_id == EActions.DELETE)
9984 {
9985 Delete();
9986 }
9987
9988 }
9989
9990
9991 return false;
9992 }
9993
9994 // -------------------------------------------------------------------------
9995
9996
9999 void OnActivatedByTripWire();
10000
10002 void OnActivatedByItem(notnull ItemBase item);
10003
10004 //----------------------------------------------------------------
10005 //returns true if item is able to explode when put in fire
10006 bool CanExplodeInFire()
10007 {
10008 return false;
10009 }
10010
10011 //----------------------------------------------------------------
10012 bool CanEat()
10013 {
10014 return true;
10015 }
10016
10017 //----------------------------------------------------------------
10018 override bool IsIgnoredByConstruction()
10019 {
10020 return true;
10021 }
10022
10023 //----------------------------------------------------------------
10024 //has FoodStages in config?
10025 bool HasFoodStage()
10026 {
10027 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10028 return GetGame().ConfigIsExisting(config_path);
10029 }
10030
10032 FoodStage GetFoodStage()
10033 {
10034 return null;
10035 }
10036
10037 bool CanBeCooked()
10038 {
10039 return false;
10040 }
10041
10042 bool CanBeCookedOnStick()
10043 {
10044 return false;
10045 }
10046
10048 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10050
10051 //----------------------------------------------------------------
10052 bool CanRepair(ItemBase item_repair_kit)
10053 {
10054 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10055 return module_repairing.CanRepair(this, item_repair_kit);
10056 }
10057
10058 //----------------------------------------------------------------
10059 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10060 {
10061 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10062 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10063 }
10064
10065 //----------------------------------------------------------------
10066 int GetItemSize()
10067 {
10068 /*
10069 vector v_size = this.ConfigGetVector("itemSize");
10070 int v_size_x = v_size[0];
10071 int v_size_y = v_size[1];
10072 int size = v_size_x * v_size_y;
10073 return size;
10074 */
10075
10076 return 1;
10077 }
10078
10079 //----------------------------------------------------------------
10080 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10081 bool CanBeMovedOverride()
10082 {
10083 return m_CanBeMovedOverride;
10084 }
10085
10086 //----------------------------------------------------------------
10087 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10088 void SetCanBeMovedOverride(bool setting)
10089 {
10090 m_CanBeMovedOverride = setting;
10091 }
10092
10093 //----------------------------------------------------------------
10101 void MessageToOwnerStatus(string text)
10102 {
10103 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10104
10105 if (player)
10106 {
10107 player.MessageStatus(text);
10108 }
10109 }
10110
10111 //----------------------------------------------------------------
10119 void MessageToOwnerAction(string text)
10120 {
10121 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10122
10123 if (player)
10124 {
10125 player.MessageAction(text);
10126 }
10127 }
10128
10129 //----------------------------------------------------------------
10137 void MessageToOwnerFriendly(string text)
10138 {
10139 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10140
10141 if (player)
10142 {
10143 player.MessageFriendly(text);
10144 }
10145 }
10146
10147 //----------------------------------------------------------------
10155 void MessageToOwnerImportant(string text)
10156 {
10157 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10158
10159 if (player)
10160 {
10161 player.MessageImportant(text);
10162 }
10163 }
10164
10165 override bool IsItemBase()
10166 {
10167 return true;
10168 }
10169
10170 // Checks if item is of questioned kind
10171 override bool KindOf(string tag)
10172 {
10173 bool found = false;
10174 string item_name = this.GetType();
10175 ref TStringArray item_tag_array = new TStringArray;
10176 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
10177
10178 int array_size = item_tag_array.Count();
10179 for (int i = 0; i < array_size; i++)
10180 {
10181 if (item_tag_array.Get(i) == tag)
10182 {
10183 found = true;
10184 break;
10185 }
10186 }
10187 return found;
10188 }
10189
10190
10191 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
10192 {
10193 //Debug.Log("OnRPC called");
10194 super.OnRPC(sender, rpc_type,ctx);
10195
10196 //Play soundset for attachment locking (ActionLockAttachment.c)
10197 switch (rpc_type)
10198 {
10199 #ifndef SERVER
10200 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10201 Param2<bool, string> p = new Param2<bool, string>(false, "");
10202
10203 if (!ctx.Read(p))
10204 return;
10205
10206 bool play = p.param1;
10207 string soundSet = p.param2;
10208
10209 if (play)
10210 {
10211 if (m_LockingSound)
10212 {
10214 {
10215 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10216 }
10217 }
10218 else
10219 {
10220 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10221 }
10222 }
10223 else
10224 {
10225 SEffectManager.DestroyEffect(m_LockingSound);
10226 }
10227
10228 break;
10229 #endif
10230
10231 }
10232
10233 if (GetWrittenNoteData())
10234 {
10235 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
10236 }
10237 }
10238
10239 //-----------------------------
10240 // VARIABLE MANIPULATION SYSTEM
10241 //-----------------------------
10242 int NameToID(string name)
10243 {
10244 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10245 return plugin.GetID(name);
10246 }
10247
10248 string IDToName(int id)
10249 {
10250 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10251 return plugin.GetName(id);
10252 }
10253
10255 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
10256 {
10257 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
10258 //read the flags
10259 int varFlags;
10260 if (!ctx.Read(varFlags))
10261 return;
10262
10263 if (varFlags & ItemVariableFlags.FLOAT)
10264 {
10265 ReadVarsFromCTX(ctx);
10266 }
10267 }
10268
10269 override void SerializeNumericalVars(array<float> floats_out)
10270 {
10271 //some variables handled on EntityAI level already!
10272 super.SerializeNumericalVars(floats_out);
10273
10274 // the order of serialization must be the same as the order of de-serialization
10275 //--------------------------------------------
10276 if (IsVariableSet(VARIABLE_QUANTITY))
10277 {
10278 floats_out.Insert(m_VarQuantity);
10279 }
10280 //--------------------------------------------
10281 if (IsVariableSet(VARIABLE_WET))
10282 {
10283 floats_out.Insert(m_VarWet);
10284 }
10285 //--------------------------------------------
10286 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10287 {
10288 floats_out.Insert(m_VarLiquidType);
10289 }
10290 //--------------------------------------------
10291 if (IsVariableSet(VARIABLE_COLOR))
10292 {
10293 floats_out.Insert(m_ColorComponentR);
10294 floats_out.Insert(m_ColorComponentG);
10295 floats_out.Insert(m_ColorComponentB);
10296 floats_out.Insert(m_ColorComponentA);
10297 }
10298 //--------------------------------------------
10299 if (IsVariableSet(VARIABLE_CLEANNESS))
10300 {
10301 floats_out.Insert(m_Cleanness);
10302 }
10303 }
10304
10305 override void DeSerializeNumericalVars(array<float> floats)
10306 {
10307 //some variables handled on EntityAI level already!
10308 super.DeSerializeNumericalVars(floats);
10309
10310 // the order of serialization must be the same as the order of de-serialization
10311 int index = 0;
10312 int mask = Math.Round(floats.Get(index));
10313
10314 index++;
10315 //--------------------------------------------
10316 if (mask & VARIABLE_QUANTITY)
10317 {
10318 if (m_IsStoreLoad)
10319 {
10320 SetStoreLoadedQuantity(floats.Get(index));
10321 }
10322 else
10323 {
10324 float quantity = floats.Get(index);
10325 SetQuantity(quantity, true, false, false, false);
10326 }
10327 index++;
10328 }
10329 //--------------------------------------------
10330 if (mask & VARIABLE_WET)
10331 {
10332 float wet = floats.Get(index);
10333 SetWet(wet);
10334 index++;
10335 }
10336 //--------------------------------------------
10337 if (mask & VARIABLE_LIQUIDTYPE)
10338 {
10339 int liquidtype = Math.Round(floats.Get(index));
10340 SetLiquidType(liquidtype);
10341 index++;
10342 }
10343 //--------------------------------------------
10344 if (mask & VARIABLE_COLOR)
10345 {
10346 m_ColorComponentR = Math.Round(floats.Get(index));
10347 index++;
10348 m_ColorComponentG = Math.Round(floats.Get(index));
10349 index++;
10350 m_ColorComponentB = Math.Round(floats.Get(index));
10351 index++;
10352 m_ColorComponentA = Math.Round(floats.Get(index));
10353 index++;
10354 }
10355 //--------------------------------------------
10356 if (mask & VARIABLE_CLEANNESS)
10357 {
10358 int cleanness = Math.Round(floats.Get(index));
10359 SetCleanness(cleanness);
10360 index++;
10361 }
10362 }
10363
10364 override void WriteVarsToCTX(ParamsWriteContext ctx)
10365 {
10366 super.WriteVarsToCTX(ctx);
10367
10368 //--------------------------------------------
10369 if (IsVariableSet(VARIABLE_QUANTITY))
10370 {
10371 ctx.Write(GetQuantity());
10372 }
10373 //--------------------------------------------
10374 if (IsVariableSet(VARIABLE_WET))
10375 {
10376 ctx.Write(GetWet());
10377 }
10378 //--------------------------------------------
10379 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10380 {
10381 ctx.Write(GetLiquidType());
10382 }
10383 //--------------------------------------------
10384 if (IsVariableSet(VARIABLE_COLOR))
10385 {
10386 int r,g,b,a;
10387 GetColor(r,g,b,a);
10388 ctx.Write(r);
10389 ctx.Write(g);
10390 ctx.Write(b);
10391 ctx.Write(a);
10392 }
10393 //--------------------------------------------
10394 if (IsVariableSet(VARIABLE_CLEANNESS))
10395 {
10396 ctx.Write(GetCleanness());
10397 }
10398 }
10399
10400 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
10401 {
10402 if (!super.ReadVarsFromCTX(ctx,version))
10403 return false;
10404
10405 int intValue;
10406 float value;
10407
10408 if (version < 140)
10409 {
10410 if (!ctx.Read(intValue))
10411 return false;
10412
10413 m_VariablesMask = intValue;
10414 }
10415
10416 if (m_VariablesMask & VARIABLE_QUANTITY)
10417 {
10418 if (!ctx.Read(value))
10419 return false;
10420
10421 if (IsStoreLoad())
10422 {
10424 }
10425 else
10426 {
10427 SetQuantity(value, true, false, false, false);
10428 }
10429 }
10430 //--------------------------------------------
10431 if (version < 140)
10432 {
10433 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10434 {
10435 if (!ctx.Read(value))
10436 return false;
10437 SetTemperatureDirect(value);
10438 }
10439 }
10440 //--------------------------------------------
10441 if (m_VariablesMask & VARIABLE_WET)
10442 {
10443 if (!ctx.Read(value))
10444 return false;
10445 SetWet(value);
10446 }
10447 //--------------------------------------------
10448 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
10449 {
10450 if (!ctx.Read(intValue))
10451 return false;
10452 SetLiquidType(intValue);
10453 }
10454 //--------------------------------------------
10455 if (m_VariablesMask & VARIABLE_COLOR)
10456 {
10457 int r,g,b,a;
10458 if (!ctx.Read(r))
10459 return false;
10460 if (!ctx.Read(g))
10461 return false;
10462 if (!ctx.Read(b))
10463 return false;
10464 if (!ctx.Read(a))
10465 return false;
10466
10467 SetColor(r,g,b,a);
10468 }
10469 //--------------------------------------------
10470 if (m_VariablesMask & VARIABLE_CLEANNESS)
10471 {
10472 if (!ctx.Read(intValue))
10473 return false;
10474 SetCleanness(intValue);
10475 }
10476 //--------------------------------------------
10477 if (version >= 138 && version < 140)
10478 {
10479 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10480 {
10481 if (!ctx.Read(intValue))
10482 return false;
10483 SetFrozen(intValue);
10484 }
10485 }
10486
10487 return true;
10488 }
10489
10490 //----------------------------------------------------------------
10491 override bool OnStoreLoad(ParamsReadContext ctx, int version)
10492 {
10493 m_IsStoreLoad = true;
10495 {
10496 m_FixDamageSystemInit = true;
10497 }
10498
10499 if (!super.OnStoreLoad(ctx, version))
10500 {
10501 m_IsStoreLoad = false;
10502 return false;
10503 }
10504
10505 if (version >= 114)
10506 {
10507 bool hasQuickBarIndexSaved;
10508
10509 if (!ctx.Read(hasQuickBarIndexSaved))
10510 {
10511 m_IsStoreLoad = false;
10512 return false;
10513 }
10514
10515 if (hasQuickBarIndexSaved)
10516 {
10517 int itmQBIndex;
10518
10519 //Load quickbar item bind
10520 if (!ctx.Read(itmQBIndex))
10521 {
10522 m_IsStoreLoad = false;
10523 return false;
10524 }
10525
10526 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10527 if (itmQBIndex != -1 && parentPlayer)
10528 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10529 }
10530 }
10531 else
10532 {
10533 // Backup of how it used to be
10534 PlayerBase player;
10535 int itemQBIndex;
10536 if (version == int.MAX)
10537 {
10538 if (!ctx.Read(itemQBIndex))
10539 {
10540 m_IsStoreLoad = false;
10541 return false;
10542 }
10543 }
10544 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10545 {
10546 //Load quickbar item bind
10547 if (!ctx.Read(itemQBIndex))
10548 {
10549 m_IsStoreLoad = false;
10550 return false;
10551 }
10552 if (itemQBIndex != -1 && player)
10553 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10554 }
10555 }
10556
10557 if (version < 140)
10558 {
10559 // variable management system
10560 if (!LoadVariables(ctx, version))
10561 {
10562 m_IsStoreLoad = false;
10563 return false;
10564 }
10565 }
10566
10567 //agent trasmission system
10568 if (!LoadAgents(ctx, version))
10569 {
10570 m_IsStoreLoad = false;
10571 return false;
10572 }
10573 if (version >= 132)
10574 {
10575 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10576 if (raib)
10577 {
10578 if (!raib.OnStoreLoad(ctx,version))
10579 {
10580 m_IsStoreLoad = false;
10581 return false;
10582 }
10583 }
10584 }
10585
10586 m_IsStoreLoad = false;
10587 return true;
10588 }
10589
10590 //----------------------------------------------------------------
10591
10592 override void OnStoreSave(ParamsWriteContext ctx)
10593 {
10594 super.OnStoreSave(ctx);
10595
10596 PlayerBase player;
10597 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10598 {
10599 ctx.Write(true); // Keep track of if we should actually read this in or not
10600 //Save quickbar item bind
10601 int itemQBIndex = -1;
10602 itemQBIndex = player.FindQuickBarEntityIndex(this);
10603 ctx.Write(itemQBIndex);
10604 }
10605 else
10606 {
10607 ctx.Write(false); // Keep track of if we should actually read this in or not
10608 }
10609
10610 SaveAgents(ctx);//agent trasmission system
10611
10612 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10613 if (raib)
10614 {
10615 raib.OnStoreSave(ctx);
10616 }
10617 }
10618 //----------------------------------------------------------------
10619
10620 override void AfterStoreLoad()
10621 {
10622 super.AfterStoreLoad();
10623
10625 {
10627 }
10628
10629 if (GetStoreLoadedQuantity() != float.LOWEST)
10630 {
10632 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
10633 }
10634 }
10635
10636 override void EEOnAfterLoad()
10637 {
10638 super.EEOnAfterLoad();
10639
10641 {
10642 m_FixDamageSystemInit = false;
10643 }
10644
10647 }
10648
10649 bool CanBeDisinfected()
10650 {
10651 return false;
10652 }
10653
10654
10655 //----------------------------------------------------------------
10656 override void OnVariablesSynchronized()
10657 {
10658 if (m_Initialized)
10659 {
10660 #ifdef PLATFORM_CONSOLE
10661 //bruteforce it is
10662 if (IsSplitable())
10663 {
10664 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
10665 if (menu)
10666 {
10667 menu.Refresh();
10668 }
10669 }
10670 #endif
10671 }
10672
10674 {
10675 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10676 m_WantPlayImpactSound = false;
10677 }
10678
10680 {
10681 SetWeightDirty();
10683 }
10684 if (m_VarWet != m_VarWetPrev)
10685 {
10688 }
10689
10690 if (m_SoundSyncPlay != 0)
10691 {
10692 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
10693 m_SoundSyncPlay = 0;
10694 }
10695 if (m_SoundSyncStop != 0)
10696 {
10697 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
10698 m_SoundSyncStop = 0;
10699 }
10700
10701 super.OnVariablesSynchronized();
10702 }
10703
10704 //------------------------- Quantity
10705 //----------------------------------------------------------------
10707 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
10708 {
10709 if (!IsServerCheck(allow_client))
10710 return false;
10711
10712 if (!HasQuantity())
10713 return false;
10714
10715 float min = GetQuantityMin();
10716 float max = GetQuantityMax();
10717
10718 if (value <= (min + 0.001))
10719 value = min;
10720
10721 if (value == min)
10722 {
10723 if (destroy_config)
10724 {
10725 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10726 if (dstr)
10727 {
10728 m_VarQuantity = Math.Clamp(value, min, max);
10729 this.Delete();
10730 return true;
10731 }
10732 }
10733 else if (destroy_forced)
10734 {
10735 m_VarQuantity = Math.Clamp(value, min, max);
10736 this.Delete();
10737 return true;
10738 }
10739 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
10740 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
10741 }
10742
10743 float delta = m_VarQuantity;
10744 m_VarQuantity = Math.Clamp(value, min, max);
10745
10746 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
10747 {
10748 delta = m_VarQuantity - delta;
10749
10750 if (delta)
10751 OnQuantityChanged(delta);
10752 }
10753
10754 SetVariableMask(VARIABLE_QUANTITY);
10755
10756 return false;
10757 }
10758
10759 //----------------------------------------------------------------
10761 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
10762 {
10763 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
10764 }
10765 //----------------------------------------------------------------
10766 void SetQuantityMax()
10767 {
10768 float max = GetQuantityMax();
10769 SetQuantity(max);
10770 }
10771
10772 override void SetQuantityToMinimum()
10773 {
10774 float min = GetQuantityMin();
10775 SetQuantity(min);
10776 }
10777 //----------------------------------------------------------------
10779 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
10780 {
10781 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
10782 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
10783 SetQuantity(result, destroy_config, destroy_forced);
10784 }
10785
10786 //----------------------------------------------------------------
10788 override float GetQuantityNormalized()
10789 {
10790 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
10791 }
10792
10794 {
10795 return GetQuantityNormalized();
10796 }
10797
10798 /*void SetAmmoNormalized(float value)
10799 {
10800 float value_clamped = Math.Clamp(value, 0, 1);
10801 Magazine this_mag = Magazine.Cast(this);
10802 int max_rounds = this_mag.GetAmmoMax();
10803 int result = value * max_rounds;//can the rounded if higher precision is required
10804 this_mag.SetAmmoCount(result);
10805 }*/
10806 //----------------------------------------------------------------
10807 override int GetQuantityMax()
10808 {
10809 int slot = -1;
10810 if (GetInventory())
10811 {
10812 InventoryLocation il = new InventoryLocation;
10813 GetInventory().GetCurrentInventoryLocation(il);
10814 slot = il.GetSlot();
10815 }
10816
10817 return GetTargetQuantityMax(slot);
10818 }
10819
10820 override int GetTargetQuantityMax(int attSlotID = -1)
10821 {
10822 float quantity_max = 0;
10823
10824 if (IsSplitable()) //only stackable/splitable items can check for stack size
10825 {
10826 if (attSlotID != -1)
10827 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10828
10829 if (quantity_max <= 0)
10830 quantity_max = m_VarStackMax;
10831 }
10832
10833 if (quantity_max <= 0)
10834 quantity_max = m_VarQuantityMax;
10835
10836 return quantity_max;
10837 }
10838 //----------------------------------------------------------------
10839 override int GetQuantityMin()
10840 {
10841 return m_VarQuantityMin;
10842 }
10843 //----------------------------------------------------------------
10844 int GetQuantityInit()
10845 {
10846 return m_VarQuantityInit;
10847 }
10848
10849 //----------------------------------------------------------------
10850 override bool HasQuantity()
10851 {
10852 return !(GetQuantityMax() - GetQuantityMin() == 0);
10853 }
10854
10855 override float GetQuantity()
10856 {
10857 return m_VarQuantity;
10858 }
10859
10860 bool IsFullQuantity()
10861 {
10862 return GetQuantity() >= GetQuantityMax();
10863 }
10864
10865 //Calculates weight of single item without attachments and cargo
10866 override float GetSingleInventoryItemWeightEx()
10867 {
10868 //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
10869 float weightEx = GetWeightEx();//overall weight of the item
10870 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
10871 return weightEx - special;
10872 }
10873
10874 // Obsolete, use GetSingleInventoryItemWeightEx() instead
10876 {
10878 }
10879
10880 override protected float GetWeightSpecialized(bool forceRecalc = false)
10881 {
10882 if (IsSplitable()) //quantity determines size of the stack
10883 {
10884 #ifdef DEVELOPER
10885 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10886 {
10887 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10888 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
10889 }
10890 #endif
10891
10892 return GetQuantity() * GetConfigWeightModified();
10893 }
10894 else if (HasEnergyManager())// items with energy manager
10895 {
10896 #ifdef DEVELOPER
10897 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10898 {
10899 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10900 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
10901 }
10902 #endif
10903 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10904 }
10905 else//everything else
10906 {
10907 #ifdef DEVELOPER
10908 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10909 {
10910 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10911 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
10912 }
10913 #endif
10914 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10915 }
10916 }
10917
10919 int GetNumberOfItems()
10920 {
10921 int item_count = 0;
10922 ItemBase item;
10923
10924 if (GetInventory().GetCargo() != NULL)
10925 {
10926 item_count = GetInventory().GetCargo().GetItemCount();
10927 }
10928
10929 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10930 {
10931 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10932 if (item)
10933 item_count += item.GetNumberOfItems();
10934 }
10935 return item_count;
10936 }
10937
10939 float GetUnitWeight(bool include_wetness = true)
10940 {
10941 float weight = 0;
10942 float wetness = 1;
10943 if (include_wetness)
10944 wetness += GetWet();
10945 if (IsSplitable()) //quantity determines size of the stack
10946 {
10947 weight = wetness * m_ConfigWeight;
10948 }
10949 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
10950 {
10951 weight = 1;
10952 }
10953 return weight;
10954 }
10955
10956 //-----------------------------------------------------------------
10957
10958 override void ClearInventory()
10959 {
10960 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
10961 {
10962 GameInventory inv = GetInventory();
10963 array<EntityAI> items = new array<EntityAI>;
10964 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
10965 for (int i = 0; i < items.Count(); i++)
10966 {
10967 ItemBase item = ItemBase.Cast(items.Get(i));
10968 if (item)
10969 {
10970 GetGame().ObjectDelete(item);
10971 }
10972 }
10973 }
10974 }
10975
10976 //------------------------- Energy
10977
10978 //----------------------------------------------------------------
10979 float GetEnergy()
10980 {
10981 float energy = 0;
10982 if (HasEnergyManager())
10983 {
10984 energy = GetCompEM().GetEnergy();
10985 }
10986 return energy;
10987 }
10988
10989
10990 override void OnEnergyConsumed()
10991 {
10992 super.OnEnergyConsumed();
10993
10995 }
10996
10997 override void OnEnergyAdded()
10998 {
10999 super.OnEnergyAdded();
11000
11002 }
11003
11004 // Converts energy (from Energy Manager) to quantity, if enabled.
11006 {
11007 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11008 {
11009 if (HasQuantity())
11010 {
11011 float energy_0to1 = GetCompEM().GetEnergy0To1();
11012 SetQuantityNormalized(energy_0to1);
11013 }
11014 }
11015 }
11016
11017 //----------------------------------------------------------------
11018 float GetHeatIsolationInit()
11019 {
11020 return ConfigGetFloat("heatIsolation");
11021 }
11022
11023 float GetHeatIsolation()
11024 {
11025 return m_HeatIsolation;
11026 }
11027
11028 float GetDryingIncrement(string pIncrementName)
11029 {
11030 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11031 if (GetGame().ConfigIsExisting(paramPath))
11032 return GetGame().ConfigGetFloat(paramPath);
11033
11034 return 0.0;
11035 }
11036
11037 float GetSoakingIncrement(string pIncrementName)
11038 {
11039 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11040 if (GetGame().ConfigIsExisting(paramPath))
11041 return GetGame().ConfigGetFloat(paramPath);
11042
11043 return 0.0;
11044 }
11045 //----------------------------------------------------------------
11046 override void SetWet(float value, bool allow_client = false)
11047 {
11048 if (!IsServerCheck(allow_client))
11049 return;
11050
11051 float min = GetWetMin();
11052 float max = GetWetMax();
11053
11054 float previousValue = m_VarWet;
11055
11056 m_VarWet = Math.Clamp(value, min, max);
11057
11058 if (previousValue != m_VarWet)
11059 {
11060 SetVariableMask(VARIABLE_WET);
11061 OnWetChanged(m_VarWet, previousValue);
11062 }
11063 }
11064 //----------------------------------------------------------------
11065 override void AddWet(float value)
11066 {
11067 SetWet(GetWet() + value);
11068 }
11069 //----------------------------------------------------------------
11070 override void SetWetMax()
11071 {
11073 }
11074 //----------------------------------------------------------------
11075 override float GetWet()
11076 {
11077 return m_VarWet;
11078 }
11079 //----------------------------------------------------------------
11080 override float GetWetMax()
11081 {
11082 return m_VarWetMax;
11083 }
11084 //----------------------------------------------------------------
11085 override float GetWetMin()
11086 {
11087 return m_VarWetMin;
11088 }
11089 //----------------------------------------------------------------
11090 override float GetWetInit()
11091 {
11092 return m_VarWetInit;
11093 }
11094 //----------------------------------------------------------------
11095 override void OnWetChanged(float newVal, float oldVal)
11096 {
11097 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11098 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11099 if (newLevel != oldLevel)
11100 {
11101 OnWetLevelChanged(newLevel,oldLevel);
11102 }
11103 }
11104
11105 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11106 {
11107 SetWeightDirty();
11108 }
11109
11110 override EWetnessLevel GetWetLevel()
11111 {
11112 return GetWetLevelInternal(m_VarWet);
11113 }
11114
11115 //----------------------------------------------------------------
11116
11117 override void SetStoreLoad(bool value)
11118 {
11119 m_IsStoreLoad = value;
11120 }
11121
11122 override bool IsStoreLoad()
11123 {
11124 return m_IsStoreLoad;
11125 }
11126
11127 override void SetStoreLoadedQuantity(float value)
11128 {
11129 m_StoreLoadedQuantity = value;
11130 }
11131
11132 override float GetStoreLoadedQuantity()
11133 {
11134 return m_StoreLoadedQuantity;
11135 }
11136
11137 //----------------------------------------------------------------
11138
11139 float GetItemModelLength()
11140 {
11141 if (ConfigIsExisting("itemModelLength"))
11142 {
11143 return ConfigGetFloat("itemModelLength");
11144 }
11145 return 0;
11146 }
11147
11148 float GetItemAttachOffset()
11149 {
11150 if (ConfigIsExisting("itemAttachOffset"))
11151 {
11152 return ConfigGetFloat("itemAttachOffset");
11153 }
11154 return 0;
11155 }
11156
11157 override void SetCleanness(int value, bool allow_client = false)
11158 {
11159 if (!IsServerCheck(allow_client))
11160 return;
11161
11162 int previousValue = m_Cleanness;
11163
11164 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
11165
11166 if (previousValue != m_Cleanness)
11167 SetVariableMask(VARIABLE_CLEANNESS);
11168 }
11169
11170 override int GetCleanness()
11171 {
11172 return m_Cleanness;
11173 }
11174
11176 {
11177 return true;
11178 }
11179
11180 //----------------------------------------------------------------
11181 // ATTACHMENT LOCKING
11182 // Getters relevant to generic ActionLockAttachment
11183 int GetLockType()
11184 {
11185 return m_LockType;
11186 }
11187
11188 string GetLockSoundSet()
11189 {
11190 return m_LockSoundSet;
11191 }
11192
11193 //----------------------------------------------------------------
11194 //------------------------- Color
11195 // sets items color variable given color components
11196 override void SetColor(int r, int g, int b, int a)
11197 {
11202 SetVariableMask(VARIABLE_COLOR);
11203 }
11205 override void GetColor(out int r,out int g,out int b,out int a)
11206 {
11211 }
11212
11213 bool IsColorSet()
11214 {
11215 return IsVariableSet(VARIABLE_COLOR);
11216 }
11217
11219 string GetColorString()
11220 {
11221 int r,g,b,a;
11222 GetColor(r,g,b,a);
11223 r = r/255;
11224 g = g/255;
11225 b = b/255;
11226 a = a/255;
11227 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11228 }
11229 //----------------------------------------------------------------
11230 //------------------------- LiquidType
11231
11232 override void SetLiquidType(int value, bool allow_client = false)
11233 {
11234 if (!IsServerCheck(allow_client))
11235 return;
11236
11237 int old = m_VarLiquidType;
11238 m_VarLiquidType = value;
11239 OnLiquidTypeChanged(old,value);
11240 SetVariableMask(VARIABLE_LIQUIDTYPE);
11241 }
11242
11243 int GetLiquidTypeInit()
11244 {
11245 return ConfigGetInt("varLiquidTypeInit");
11246 }
11247
11248 override int GetLiquidType()
11249 {
11250 return m_VarLiquidType;
11251 }
11252
11253 protected void OnLiquidTypeChanged(int oldType, int newType)
11254 {
11255 if (newType == LIQUID_NONE && GetIsFrozen())
11256 SetFrozen(false);
11257 }
11258
11260 void UpdateQuickbarShortcutVisibility(PlayerBase player)
11261 {
11262 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11263 }
11264
11265 // -------------------------------------------------------------------------
11267 void OnInventoryEnter(Man player)
11268 {
11269 PlayerBase nplayer;
11270 if (PlayerBase.CastTo(nplayer, player))
11271 {
11272 m_CanPlayImpactSound = true;
11273 //nplayer.OnItemInventoryEnter(this);
11274 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11275 }
11276 }
11277
11278 // -------------------------------------------------------------------------
11280 void OnInventoryExit(Man player)
11281 {
11282 PlayerBase nplayer;
11283 if (PlayerBase.CastTo(nplayer,player))
11284 {
11285 //nplayer.OnItemInventoryExit(this);
11286 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11287
11288 }
11289
11290 //if (!GetGame().IsDedicatedServer())
11291 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11292
11293
11294 if (HasEnergyManager())
11295 {
11296 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
11297 }
11298 }
11299
11300 // ADVANCED PLACEMENT EVENTS
11301 override void OnPlacementStarted(Man player)
11302 {
11303 super.OnPlacementStarted(player);
11304
11305 SetTakeable(false);
11306 }
11307
11308 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
11309 {
11310 if (m_AdminLog)
11311 {
11312 m_AdminLog.OnPlacementComplete(player, this);
11313 }
11314
11315 super.OnPlacementComplete(player, position, orientation);
11316 }
11317
11318 //-----------------------------
11319 // AGENT SYSTEM
11320 //-----------------------------
11321 //--------------------------------------------------------------------------
11322 bool ContainsAgent(int agent_id)
11323 {
11324 if (agent_id & m_AttachedAgents)
11325 {
11326 return true;
11327 }
11328 else
11329 {
11330 return false;
11331 }
11332 }
11333
11334 //--------------------------------------------------------------------------
11335 override void RemoveAgent(int agent_id)
11336 {
11337 if (ContainsAgent(agent_id))
11338 {
11339 m_AttachedAgents = ~agent_id & m_AttachedAgents;
11340 }
11341 }
11342
11343 //--------------------------------------------------------------------------
11344 override void RemoveAllAgents()
11345 {
11346 m_AttachedAgents = 0;
11347 }
11348 //--------------------------------------------------------------------------
11349 override void RemoveAllAgentsExcept(int agent_to_keep)
11350 {
11351 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
11352 }
11353 // -------------------------------------------------------------------------
11354 override void InsertAgent(int agent, float count = 1)
11355 {
11356 if (count < 1)
11357 return;
11358 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
11360 }
11361
11363 void TransferAgents(int agents)
11364 {
11366 }
11367
11368 // -------------------------------------------------------------------------
11369 override int GetAgents()
11370 {
11371 return m_AttachedAgents;
11372 }
11373 //----------------------------------------------------------------------
11374
11375 /*int GetContaminationType()
11376 {
11377 int contamination_type;
11378
11379 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
11380 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
11381 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
11382 const int DIRTY_MASK = eAgents.WOUND_AGENT;
11383
11384 Edible_Base edible = Edible_Base.Cast(this);
11385 int agents = GetAgents();
11386 if (edible)
11387 {
11388 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
11389 if (profile)
11390 {
11391 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
11392 }
11393 }
11394 if (agents & CONTAMINATED_MASK)
11395 {
11396 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
11397 }
11398 if (agents & POISONED_MASK)
11399 {
11400 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
11401 }
11402 if (agents & NERVE_GAS_MASK)
11403 {
11404 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
11405 }
11406 if (agents & DIRTY_MASK)
11407 {
11408 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
11409 }
11410
11411 return agents;
11412 }*/
11413
11414 // -------------------------------------------------------------------------
11415 bool LoadAgents(ParamsReadContext ctx, int version)
11416 {
11417 if (!ctx.Read(m_AttachedAgents))
11418 return false;
11419 return true;
11420 }
11421 // -------------------------------------------------------------------------
11423 {
11424
11426 }
11427 // -------------------------------------------------------------------------
11428
11430 override void CheckForRoofLimited(float timeTresholdMS = 3000)
11431 {
11432 super.CheckForRoofLimited(timeTresholdMS);
11433
11434 float time = GetGame().GetTime();
11435 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11436 {
11437 m_PreviousRoofTestTime = time;
11438 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11439 }
11440 }
11441
11442 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
11443 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
11444 {
11445 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
11446 {
11447 return 0;
11448 }
11449
11450 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
11451 {
11452 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
11453 if (filter)
11454 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
11455 else
11456 return 0;//otherwise return 0 when no filter attached
11457 }
11458
11459 string subclassPath, entryName;
11460
11461 switch (type)
11462 {
11463 case DEF_BIOLOGICAL:
11464 entryName = "biological";
11465 break;
11466 case DEF_CHEMICAL:
11467 entryName = "chemical";
11468 break;
11469 default:
11470 entryName = "biological";
11471 break;
11472 }
11473
11474 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
11475
11476 return GetGame().ConfigGetFloat(subclassPath + entryName);
11477 }
11478
11479
11480
11482 override void EEOnCECreate()
11483 {
11484 if (!IsMagazine())
11486
11488 }
11489
11490
11491 //-------------------------
11492 // OPEN/CLOSE USER ACTIONS
11493 //-------------------------
11495 void Open();
11496 void Close();
11497 bool IsOpen()
11498 {
11499 return true;
11500 }
11501
11502 override bool CanDisplayCargo()
11503 {
11504 return IsOpen();
11505 }
11506
11507
11508 // ------------------------------------------------------------
11509 // CONDITIONS
11510 // ------------------------------------------------------------
11511 override bool CanPutInCargo(EntityAI parent)
11512 {
11513 if (parent)
11514 {
11515 if (parent.IsInherited(DayZInfected))
11516 return true;
11517
11518 if (!parent.IsRuined())
11519 return true;
11520 }
11521
11522 return true;
11523 }
11524
11525 override bool CanPutAsAttachment(EntityAI parent)
11526 {
11527 if (!super.CanPutAsAttachment(parent))
11528 {
11529 return false;
11530 }
11531
11532 if (!IsRuined() && !parent.IsRuined())
11533 {
11534 return true;
11535 }
11536
11537 return false;
11538 }
11539
11540 override bool CanReceiveItemIntoCargo(EntityAI item)
11541 {
11542 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11543 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11544 // return false;
11545
11546 return super.CanReceiveItemIntoCargo(item);
11547 }
11548
11549 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
11550 {
11551 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11552 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11553 // return false;
11554
11555 GameInventory attachmentInv = attachment.GetInventory();
11556 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11557 {
11558 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11559 return false;
11560 }
11561
11562 InventoryLocation loc = new InventoryLocation();
11563 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11564 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
11565 return false;
11566
11567 return super.CanReceiveAttachment(attachment, slotId);
11568 }
11569
11570 override bool CanReleaseAttachment(EntityAI attachment)
11571 {
11572 if (!super.CanReleaseAttachment(attachment))
11573 return false;
11574
11575 return GetInventory().AreChildrenAccessible();
11576 }
11577
11578 /*override bool CanLoadAttachment(EntityAI attachment)
11579 {
11580 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11581 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11582 // return false;
11583
11584 GameInventory attachmentInv = attachment.GetInventory();
11585 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11586 {
11587 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
11588 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
11589
11590 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11591 return false;
11592 }
11593
11594 return super.CanLoadAttachment(attachment);
11595 }*/
11596
11597 // Plays muzzle flash particle effects
11598 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11599 {
11600 int id = muzzle_owner.GetMuzzleID();
11601 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
11602
11603 if (WPOF_array)
11604 {
11605 for (int i = 0; i < WPOF_array.Count(); i++)
11606 {
11607 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11608
11609 if (WPOF)
11610 {
11611 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11612 }
11613 }
11614 }
11615 }
11616
11617 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
11618 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11619 {
11620 int id = muzzle_owner.GetMuzzleID();
11621 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
11622
11623 if (WPOBE_array)
11624 {
11625 for (int i = 0; i < WPOBE_array.Count(); i++)
11626 {
11627 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11628
11629 if (WPOBE)
11630 {
11631 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11632 }
11633 }
11634 }
11635 }
11636
11637 // Plays all weapon overheating particles
11638 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11639 {
11640 int id = muzzle_owner.GetMuzzleID();
11641 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11642
11643 if (WPOOH_array)
11644 {
11645 for (int i = 0; i < WPOOH_array.Count(); i++)
11646 {
11647 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11648
11649 if (WPOOH)
11650 {
11651 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11652 }
11653 }
11654 }
11655 }
11656
11657 // Updates all weapon overheating particles
11658 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11659 {
11660 int id = muzzle_owner.GetMuzzleID();
11661 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11662
11663 if (WPOOH_array)
11664 {
11665 for (int i = 0; i < WPOOH_array.Count(); i++)
11666 {
11667 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11668
11669 if (WPOOH)
11670 {
11671 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11672 }
11673 }
11674 }
11675 }
11676
11677 // Stops overheating particles
11678 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11679 {
11680 int id = muzzle_owner.GetMuzzleID();
11681 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11682
11683 if (WPOOH_array)
11684 {
11685 for (int i = 0; i < WPOOH_array.Count(); i++)
11686 {
11687 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11688
11689 if (WPOOH)
11690 {
11691 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11692 }
11693 }
11694 }
11695 }
11696
11697 //----------------------------------------------------------------
11698 //Item Behaviour - unified approach
11699 override bool IsHeavyBehaviour()
11700 {
11701 if (m_ItemBehaviour == 0)
11702 {
11703 return true;
11704 }
11705
11706 return false;
11707 }
11708
11709 override bool IsOneHandedBehaviour()
11710 {
11711 if (m_ItemBehaviour == 1)
11712 {
11713 return true;
11714 }
11715
11716 return false;
11717 }
11718
11719 override bool IsTwoHandedBehaviour()
11720 {
11721 if (m_ItemBehaviour == 2)
11722 {
11723 return true;
11724 }
11725
11726 return false;
11727 }
11728
11729 bool IsDeployable()
11730 {
11731 return false;
11732 }
11733
11735 float GetDeployTime()
11736 {
11737 return UATimeSpent.DEFAULT_DEPLOY;
11738 }
11739
11740
11741 //----------------------------------------------------------------
11742 // Item Targeting (User Actions)
11743 override void SetTakeable(bool pState)
11744 {
11745 m_IsTakeable = pState;
11746 SetSynchDirty();
11747 }
11748
11749 override bool IsTakeable()
11750 {
11751 return m_IsTakeable;
11752 }
11753
11754 // For cases where we want to show object widget which cant be taken to hands
11756 {
11757 return false;
11758 }
11759
11761 protected void PreLoadSoundAttachmentType()
11762 {
11763 string att_type = "None";
11764
11765 if (ConfigIsExisting("soundAttType"))
11766 {
11767 att_type = ConfigGetString("soundAttType");
11768 }
11769
11770 m_SoundAttType = att_type;
11771 }
11772
11773 override string GetAttachmentSoundType()
11774 {
11775 return m_SoundAttType;
11776 }
11777
11778 //----------------------------------------------------------------
11779 //SOUNDS - ItemSoundHandler
11780 //----------------------------------------------------------------
11781
11782 string GetPlaceSoundset(); // played when deploy starts
11783 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
11784 string GetDeploySoundset(); // played when deploy sucessfully finishes
11785
11787 {
11788 if (!m_ItemSoundHandler)
11790
11791 return m_ItemSoundHandler;
11792 }
11793
11794 // override to initialize sounds
11795 protected void InitItemSounds()
11796 {
11797 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
11798 return;
11799
11801
11802 if (GetPlaceSoundset() != string.Empty)
11803 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
11804
11805 if (GetDeploySoundset() != string.Empty)
11806 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
11807
11808 SoundParameters params = new SoundParameters();
11809 params.m_Loop = true;
11810 if (GetLoopDeploySoundset() != string.Empty)
11811 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
11812 }
11813
11814 // Start sound using ItemSoundHandler
11815 void StartItemSoundServer(int id)
11816 {
11817 if (!GetGame().IsServer())
11818 return;
11819
11820 m_SoundSyncPlay = id;
11821 SetSynchDirty();
11822
11823 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
11825 }
11826
11827 // Stop sound using ItemSoundHandler
11828 void StopItemSoundServer(int id)
11829 {
11830 if (!GetGame().IsServer())
11831 return;
11832
11833 m_SoundSyncStop = id;
11834 SetSynchDirty();
11835
11836 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
11838 }
11839
11840 protected void ClearStartItemSoundServer()
11841 {
11842 m_SoundSyncPlay = 0;
11843 }
11844
11845 protected void ClearStopItemSoundServer()
11846 {
11847 m_SoundSyncStop = 0;
11848 }
11849
11851 void PlayAttachSound(string slot_type)
11852 {
11853 if (!GetGame().IsDedicatedServer())
11854 {
11855 if (ConfigIsExisting("attachSoundSet"))
11856 {
11857 string cfg_path = "";
11858 string soundset = "";
11859 string type_name = GetType();
11860
11861 TStringArray cfg_soundset_array = new TStringArray;
11862 TStringArray cfg_slot_array = new TStringArray;
11863 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11864 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11865
11866 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11867 {
11868 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11869 {
11870 if (cfg_slot_array[i] == slot_type)
11871 {
11872 soundset = cfg_soundset_array[i];
11873 break;
11874 }
11875 }
11876 }
11877
11878 if (soundset != "")
11879 {
11880 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
11881 sound.SetAutodestroy(true);
11882 }
11883 }
11884 }
11885 }
11886
11887 void PlayDetachSound(string slot_type)
11888 {
11889 //TODO - evaluate if needed and devise universal config structure if so
11890 }
11891
11892 void OnApply(PlayerBase player);
11893
11895 {
11896 return 1.0;
11897 };
11898 //returns applicable selection
11899 array<string> GetHeadHidingSelection()
11900 {
11902 }
11903
11905 {
11907 }
11908
11909 WrittenNoteData GetWrittenNoteData() {};
11910
11912 {
11913 SetDynamicPhysicsLifeTime(0.01);
11914 m_ItemBeingDroppedPhys = false;
11915 }
11916
11918 {
11919 array<string> zone_names = new array<string>;
11920 GetDamageZones(zone_names);
11921 for (int i = 0; i < zone_names.Count(); i++)
11922 {
11923 SetHealthMax(zone_names.Get(i),"Health");
11924 }
11925 SetHealthMax("","Health");
11926 }
11927
11929 void SetZoneDamageCEInit()
11930 {
11931 float global_health = GetHealth01("","Health");
11932 array<string> zones = new array<string>;
11933 GetDamageZones(zones);
11934 //set damage of all zones to match global health level
11935 for (int i = 0; i < zones.Count(); i++)
11936 {
11937 SetHealth01(zones.Get(i),"Health",global_health);
11938 }
11939 }
11940
11942 bool IsCoverFaceForShave(string slot_name)
11943 {
11944 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11945 }
11946
11947 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11948 {
11949 if (!hasRootAsPlayer)
11950 {
11951 if (refParentIB)
11952 {
11953 // parent is wet
11954 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
11955 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11956 // parent has liquid inside
11957 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
11958 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11959 // drying
11960 else if (m_VarWet > m_VarWetMin)
11961 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
11962 }
11963 else
11964 {
11965 // drying on ground or inside non-itembase (car, ...)
11966 if (m_VarWet > m_VarWetMin)
11967 AddWet(-1 * delta * GetDryingIncrement("ground"));
11968 }
11969 }
11970 }
11971
11972 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11973 {
11975 {
11976 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
11977 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11978 {
11979 float heatPermCoef = 1.0;
11980 EntityAI ent = this;
11981 while (ent)
11982 {
11983 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11984 ent = ent.GetHierarchyParent();
11985 }
11986
11987 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11988 }
11989 }
11990 }
11991
11992 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
11993 {
11994 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
11995 EntityAI parent = GetHierarchyParent();
11996 if (!parent)
11997 {
11998 hasParent = false;
11999 hasRootAsPlayer = false;
12000 }
12001 else
12002 {
12003 hasParent = true;
12004 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12005 refParentIB = ItemBase.Cast(parent);
12006 }
12007 }
12008
12009 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12010 {
12011 // this is stub, implemented on Edible_Base
12012 }
12013
12014 bool CanDecay()
12015 {
12016 // return true used on selected food clases so they can decay
12017 return false;
12018 }
12019
12020 protected bool CanProcessDecay()
12021 {
12022 // this is stub, implemented on Edible_Base class
12023 // used to determine whether it is still necessary for the food to decay
12024 return false;
12025 }
12026
12027 protected bool CanHaveWetness()
12028 {
12029 // return true used on selected items that have a wetness effect
12030 return false;
12031 }
12032
12034 bool CanBeConsumed(ConsumeConditionData data = null)
12035 {
12036 return !GetIsFrozen() && IsOpen();
12037 }
12038
12039 override void ProcessVariables()
12040 {
12041 bool hasParent = false, hasRootAsPlayer = false;
12042 ItemBase refParentIB;
12043
12044 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12045 bool foodDecay = g_Game.IsFoodDecayEnabled();
12046
12047 if (wwtu || foodDecay)
12048 {
12049 bool processWetness = wwtu && CanHaveWetness();
12050 bool processTemperature = wwtu && CanHaveTemperature();
12051 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12052
12053 if (processWetness || processTemperature || processDecay)
12054 {
12055 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12056
12057 if (processWetness)
12058 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12059
12060 if (processTemperature)
12061 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12062
12063 if (processDecay)
12064 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12065 }
12066 }
12067 }
12068
12071 {
12072 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12073 }
12074
12075 override float GetTemperatureFreezeThreshold()
12076 {
12078 return Liquid.GetFreezeThreshold(GetLiquidType());
12079
12080 return super.GetTemperatureFreezeThreshold();
12081 }
12082
12083 override float GetTemperatureThawThreshold()
12084 {
12086 return Liquid.GetThawThreshold(GetLiquidType());
12087
12088 return super.GetTemperatureThawThreshold();
12089 }
12090
12091 override float GetItemOverheatThreshold()
12092 {
12094 return Liquid.GetBoilThreshold(GetLiquidType());
12095
12096 return super.GetItemOverheatThreshold();
12097 }
12098
12099 override float GetTemperatureFreezeTime()
12100 {
12101 if (HasQuantity())
12102 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12103
12104 return super.GetTemperatureFreezeTime();
12105 }
12106
12107 override float GetTemperatureThawTime()
12108 {
12109 if (HasQuantity())
12110 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12111
12112 return super.GetTemperatureThawTime();
12113 }
12114
12116 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12118 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12119
12120 bool IsCargoException4x3(EntityAI item)
12121 {
12122 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12123 }
12124
12126 {
12127 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12128 }
12129
12131 void AddLightSourceItem(ItemBase lightsource)
12132 {
12133 m_LightSourceItem = lightsource;
12134 }
12135
12137 {
12138 m_LightSourceItem = null;
12139 }
12140
12142 {
12143 return m_LightSourceItem;
12144 }
12145
12147 array<int> GetValidFinishers()
12148 {
12149 return null;
12150 }
12151
12153 bool GetActionWidgetOverride(out typename name)
12154 {
12155 return false;
12156 }
12157
12158 bool PairWithDevice(notnull ItemBase otherDevice)
12159 {
12160 if (GetGame().IsServer())
12161 {
12162 ItemBase explosive = otherDevice;
12164 if (!trg)
12165 {
12166 trg = RemoteDetonatorTrigger.Cast(otherDevice);
12167 explosive = this;
12168 }
12169
12170 explosive.PairRemote(trg);
12171 trg.SetControlledDevice(explosive);
12172
12173 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12174 trg.SetPersistentPairID(persistentID);
12175 explosive.SetPersistentPairID(persistentID);
12176
12177 return true;
12178 }
12179 return false;
12180 }
12181
12183 float GetBaitEffectivity()
12184 {
12185 float ret = 1.0;
12186 if (HasQuantity())
12187 ret *= GetQuantityNormalized();
12188 ret *= GetHealth01();
12189
12190 return ret;
12191 }
12192
12193 #ifdef DEVELOPER
12194 override void SetDebugItem()
12195 {
12196 super.SetDebugItem();
12197 _itemBase = this;
12198 }
12199
12200 override string GetDebugText()
12201 {
12202 string text = super.GetDebugText();
12203
12204 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
12205 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
12206
12207 return text;
12208 }
12209 #endif
12210
12211 bool CanBeUsedForSuicide()
12212 {
12213 return true;
12214 }
12215
12217 //DEPRECATED BELOW
12219 // Backwards compatibility
12220 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12221 {
12222 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
12223 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
12224 }
12225
12226 // replaced by ItemSoundHandler
12227 protected EffectSound m_SoundDeployFinish;
12228 protected EffectSound m_SoundPlace;
12229 protected EffectSound m_DeployLoopSoundEx;
12230 protected EffectSound m_SoundDeploy;
12231 bool m_IsPlaceSound;
12232 bool m_IsDeploySound;
12234
12235 string GetDeployFinishSoundset();
12236 void PlayDeploySound();
12237 void PlayDeployFinishSound();
12238 void PlayPlaceSound();
12239 void PlayDeployLoopSoundEx();
12240 void StopDeployLoopSoundEx();
12241 void SoundSynchRemoteReset();
12242 void SoundSynchRemote();
12243 bool UsesGlobalDeploy(){return false;}
12244 bool CanPlayDeployLoopSound(){return false;}
12246 bool IsPlaceSound(){return m_IsPlaceSound;}
12247 bool IsDeploySound(){return m_IsDeploySound;}
12248 void SetIsPlaceSound(bool is_place_sound);
12249 void SetIsDeploySound(bool is_deploy_sound);
12250}
12251
12252EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
12253{
12254 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
12255 if (entity)
12256 {
12257 bool is_item = entity.IsInherited(ItemBase);
12258 if (is_item && full_quantity)
12259 {
12260 ItemBase item = ItemBase.Cast(entity);
12261 item.SetQuantity(item.GetQuantityInit());
12262 }
12263 }
12264 else
12265 {
12266 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
12267 return NULL;
12268 }
12269 return entity;
12270}
12271
12272void SetupSpawnedItem(ItemBase item, float health, float quantity)
12273{
12274 if (item)
12275 {
12276 if (health > 0)
12277 item.SetHealth("", "", health);
12278
12279 if (item.CanHaveTemperature())
12280 {
12281 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
12282 if (item.CanFreeze())
12283 item.SetFrozen(false);
12284 }
12285
12286 if (item.HasEnergyManager())
12287 {
12288 if (quantity >= 0)
12289 {
12290 item.GetCompEM().SetEnergy0To1(quantity);
12291 }
12292 else
12293 {
12294 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
12295 }
12296 }
12297 else if (item.IsMagazine())
12298 {
12299 Magazine mag = Magazine.Cast(item);
12300 if (quantity >= 0)
12301 {
12302 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12303 }
12304 else
12305 {
12306 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
12307 }
12308
12309 }
12310 else
12311 {
12312 if (quantity >= 0)
12313 {
12314 item.SetQuantityNormalized(quantity, false);
12315 }
12316 else
12317 {
12318 item.SetQuantity(Math.AbsFloat(quantity));
12319 }
12320
12321 }
12322 }
12323}
12324
12325#ifdef DEVELOPER
12326ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
12327#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()