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

◆ GetFoodStage()

FoodStage SpawnItemOnLocation::GetFoodStage ( )
private

overridden on Edible_Base; so we don't have to parse configs all the time

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

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