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

◆ HasFoodStage()

bool SpawnItemOnLocation::HasFoodStage ( )
private

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

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

Используется в Edible_Base::Edible_Base().