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

◆ CanExplodeInFire()

bool SpawnItemOnLocation::CanExplodeInFire ( )
protected

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

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