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

◆ OnRPC()

override void SpawnItemOnLocation::OnRPC ( PlayerIdentity sender,
int rpc_type,
ParamsReadContext ctx )
private

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

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