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

◆ CanBeCookedOnStick()

bool SpawnItemOnLocation::CanBeCookedOnStick ( )
protected

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

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