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

◆ CanExplodeInFire()

bool SpawnItemOnLocation::CanExplodeInFire ( )
private

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

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