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

◆ IsIgnoredByConstruction()

override bool SpawnItemOnLocation::IsIgnoredByConstruction ( )
private

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

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