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

◆ CanBeCooked()

bool SpawnItemOnLocation::CanBeCooked ( )
private

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

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