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

◆ CanRepair()

bool SpawnItemOnLocation::CanRepair ( ItemBase item_repair_kit)
private

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

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