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

◆ ConvertEnergyToQuantity()

void SpawnItemOnLocation::ConvertEnergyToQuantity ( )
protected

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

8308{
8309 override bool CanPutAsAttachment(EntityAI parent)
8310 {
8311 return true;
8312 }
8313};
8314
8315//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8316
8317class ItemBase extends InventoryItem
8318{
8322
8324
8325 static int m_DebugActionsMask;
8327 // ============================================
8328 // Variable Manipulation System
8329 // ============================================
8330 // Quantity
8331
8332 float m_VarQuantity;
8333 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8335 int m_VarQuantityMin;
8336 int m_VarQuantityMax;
8337 int m_Count;
8338 float m_VarStackMax;
8339 float m_StoreLoadedQuantity = float.LOWEST;
8340 // Wet
8341 float m_VarWet;
8342 float m_VarWetPrev;//for client to know wetness changed during synchronization
8343 float m_VarWetInit;
8344 float m_VarWetMin;
8345 float m_VarWetMax;
8346 // Cleanness
8347 int m_Cleanness;
8348 int m_CleannessInit;
8349 int m_CleannessMin;
8350 int m_CleannessMax;
8351 // impact sounds
8353 bool m_CanPlayImpactSound = true;
8354 float m_ImpactSpeed;
8356 //
8357 float m_HeatIsolation;
8358 float m_ItemModelLength;
8359 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8361 int m_VarLiquidType;
8362 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8363 int m_QuickBarBonus;
8364 bool m_IsBeingPlaced;
8365 bool m_IsHologram;
8366 bool m_IsTakeable;
8367 bool m_ThrowItemOnDrop;
8370 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8371 bool can_this_be_combined; //Check if item can be combined
8372 bool m_CanThisBeSplit; //Check if item can be split
8373 bool m_IsStoreLoad = false;
8374 bool m_CanShowQuantity;
8375 bool m_HasQuantityBar;
8376 protected bool m_CanBeDigged;
8377 protected bool m_IsResultOfSplit
8378
8379 string m_SoundAttType;
8380 // items color variables
8385 //-------------------------------------------------------
8386
8387 // light source managing
8389
8393
8394 //==============================================
8395 // agent system
8396 private int m_AttachedAgents;
8397
8399 void TransferModifiers(PlayerBase reciever);
8400
8401
8402 // Weapons & suppressors particle effects
8407 static int m_LastRegisteredWeaponID = 0;
8408
8409 // Overheating effects
8411 float m_OverheatingShots;
8412 ref Timer m_CheckOverheating;
8413 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8414 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8415 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8416 ref array <ref OverheatingParticle> m_OverheatingParticles;
8417
8419 protected bool m_HideSelectionsBySlot;
8420
8421 // Admin Log
8422 PluginAdminLog m_AdminLog;
8423
8424 // misc
8425 ref Timer m_PhysDropTimer;
8426
8427 // Attachment Locking variables
8428 ref array<int> m_CompatibleLocks;
8429 protected int m_LockType;
8430 protected ref EffectSound m_LockingSound;
8431 protected string m_LockSoundSet;
8432
8433 // ItemSoundHandler
8434 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8435 protected int m_SoundSyncPlay; // id for sound to play
8436 protected int m_SoundSyncStop; // id for sound to stop
8438
8439 //temperature
8440 private float m_TemperaturePerQuantityWeight;
8441
8442 // -------------------------------------------------------------------------
8443 void ItemBase()
8444 {
8445 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8449
8450 if (!GetGame().IsDedicatedServer())
8451 {
8452 if (HasMuzzle())
8453 {
8455
8457 {
8459 }
8460 }
8461
8463 m_ActionsInitialize = false;
8464 }
8465
8466 m_OldLocation = null;
8467
8468 if (GetGame().IsServer())
8469 {
8470 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8471 }
8472
8473 if (ConfigIsExisting("headSelectionsToHide"))
8474 {
8476 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8477 }
8478
8479 m_HideSelectionsBySlot = false;
8480 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8481 {
8482 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8483 }
8484
8485 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8486
8487 m_IsResultOfSplit = false;
8488
8490 }
8491
8492 override void InitItemVariables()
8493 {
8494 super.InitItemVariables();
8495
8496 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8497 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8498 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8499 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8500 m_VarStackMax = ConfigGetFloat("varStackMax");
8501 m_Count = ConfigGetInt("count");
8502
8503 m_CanShowQuantity = ConfigGetBool("quantityShow");
8504 m_HasQuantityBar = ConfigGetBool("quantityBar");
8505
8506 m_CleannessInit = ConfigGetInt("varCleannessInit");
8508 m_CleannessMin = ConfigGetInt("varCleannessMin");
8509 m_CleannessMax = ConfigGetInt("varCleannessMax");
8510
8511 m_WantPlayImpactSound = false;
8512 m_ImpactSpeed = 0.0;
8513
8514 m_VarWetInit = ConfigGetFloat("varWetInit");
8516 m_VarWetMin = ConfigGetFloat("varWetMin");
8517 m_VarWetMax = ConfigGetFloat("varWetMax");
8518
8519 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8520 if (IsLiquidContainer() && GetQuantity() != 0)
8522 m_IsBeingPlaced = false;
8523 m_IsHologram = false;
8524 m_IsTakeable = true;
8525 m_CanBeMovedOverride = false;
8529 m_CanBeDigged = ConfigGetBool("canBeDigged");
8530
8531 m_CompatibleLocks = new array<int>();
8532 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8533 m_LockType = ConfigGetInt("lockType");
8534
8535 //Define if item can be split and set ability to be combined accordingly
8536 m_CanThisBeSplit = false;
8537 can_this_be_combined = false;
8538 if (ConfigIsExisting("canBeSplit"))
8539 {
8540 can_this_be_combined = ConfigGetBool("canBeSplit");
8542 }
8543
8544 m_ItemBehaviour = -1;
8545 if (ConfigIsExisting("itemBehaviour"))
8546 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8547
8548 //RegisterNetSyncVariableInt("m_VariablesMask");
8549 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8550 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8551 RegisterNetSyncVariableInt("m_VarLiquidType");
8552 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8553
8554 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8555 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8556 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8557
8558 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8559 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8560 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8561 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8562
8563 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8564 RegisterNetSyncVariableBool("m_IsTakeable");
8565 RegisterNetSyncVariableBool("m_IsHologram");
8566
8567 InitItemSounds();
8569 {
8570 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8571 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8572 }
8573
8574 m_LockSoundSet = ConfigGetString("lockSoundSet");
8575
8577 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8578 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8579
8580 }
8581
8582 override int GetQuickBarBonus()
8583 {
8584 return m_QuickBarBonus;
8585 }
8586
8587 void InitializeActions()
8588 {
8590 if (!m_InputActionMap)
8591 {
8593 m_InputActionMap = iam;
8594 SetActions();
8596 }
8597 }
8598
8599 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8600 {
8602 {
8603 m_ActionsInitialize = true;
8605 }
8606
8607 actions = m_InputActionMap.Get(action_input_type);
8608 }
8609
8610 void SetActions()
8611 {
8612 AddAction(ActionTakeItem);
8613 AddAction(ActionTakeItemToHands);
8614 AddAction(ActionWorldCraft);
8616 AddAction(ActionAttachWithSwitch);
8617 }
8618
8619 void SetActionAnimOverrides(); // Override action animation for specific item
8620
8621 void AddAction(typename actionName)
8622 {
8623 ActionBase action = ActionManagerBase.GetAction(actionName);
8624
8625 if (!action)
8626 {
8627 Debug.LogError("Action " + actionName + " dosn't exist!");
8628 return;
8629 }
8630
8631 typename ai = action.GetInputType();
8632 if (!ai)
8633 {
8634 m_ActionsInitialize = false;
8635 return;
8636 }
8637
8638 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8639 if (!action_array)
8640 {
8641 action_array = new array<ActionBase_Basic>;
8642 m_InputActionMap.Insert(ai, action_array);
8643 }
8644 if (LogManager.IsActionLogEnable())
8645 {
8646 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8647 }
8648
8649 if (action_array.Find(action) != -1)
8650 {
8651 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8652 }
8653 else
8654 {
8655 action_array.Insert(action);
8656 }
8657 }
8658
8659 void RemoveAction(typename actionName)
8660 {
8661 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8662 ActionBase action = player.GetActionManager().GetAction(actionName);
8663 typename ai = action.GetInputType();
8664 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8665
8666 if (action_array)
8667 {
8668 action_array.RemoveItem(action);
8669 }
8670 }
8671
8672 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8673 // Set -1 for params which should stay in default state
8674 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8675 {
8676 ActionOverrideData overrideData = new ActionOverrideData();
8677 overrideData.m_CommandUID = commandUID;
8678 overrideData.m_CommandUIDProne = commandUIDProne;
8679 overrideData.m_StanceMask = stanceMask;
8680
8681 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8682 if (!actionMap) // create new map of action > overidables map
8683 {
8684 actionMap = new TActionAnimOverrideMap();
8685 m_ItemActionOverrides.Insert(action, actionMap);
8686 }
8687
8688 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8689
8690 }
8691
8692 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8693
8694 ScriptedLightBase GetLight();
8695
8696 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8697 void LoadParticleConfigOnFire(int id)
8698 {
8699 if (!m_OnFireEffect)
8701
8704
8705 string config_to_search = "CfgVehicles";
8706 string muzzle_owner_config;
8707
8708 if (!m_OnFireEffect.Contains(id))
8709 {
8710 if (IsInherited(Weapon))
8711 config_to_search = "CfgWeapons";
8712
8713 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8714
8715 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8716
8717 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8718
8719 if (config_OnFire_subclass_count > 0)
8720 {
8721 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8722
8723 for (int i = 0; i < config_OnFire_subclass_count; i++)
8724 {
8725 string particle_class = "";
8726 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8727 string config_OnFire_entry = config_OnFire_class + particle_class;
8728 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8729 WPOF_array.Insert(WPOF);
8730 }
8731
8732
8733 m_OnFireEffect.Insert(id, WPOF_array);
8734 }
8735 }
8736
8737 if (!m_OnBulletCasingEjectEffect.Contains(id))
8738 {
8739 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8740 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8741
8742 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8743
8744 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8745
8746 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8747 {
8748 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8749
8750 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8751 {
8752 string particle_class2 = "";
8753 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8754 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8755 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8756 WPOBE_array.Insert(WPOBE);
8757 }
8758
8759
8760 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
8761 }
8762 }
8763 }
8764
8765 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8767 {
8770
8771 if (!m_OnOverheatingEffect.Contains(id))
8772 {
8773 string config_to_search = "CfgVehicles";
8774
8775 if (IsInherited(Weapon))
8776 config_to_search = "CfgWeapons";
8777
8778 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
8779 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8780
8781 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
8782 {
8783
8784 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
8785
8787 {
8788 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
8789 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8790 Error(error);
8791 return;
8792 }
8793
8794 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
8795 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
8796
8797
8798
8799 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
8800 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8801
8802 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8803 {
8804 string particle_class = "";
8805 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8806 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8807 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8808
8809 if (entry_type == CT_CLASS)
8810 {
8811 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8812 WPOOH_array.Insert(WPOF);
8813 }
8814 }
8815
8816
8817 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8818 }
8819 }
8820 }
8821
8822 float GetOverheatingValue()
8823 {
8824 return m_OverheatingShots;
8825 }
8826
8827 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8828 {
8829 if (m_MaxOverheatingValue > 0)
8830 {
8832
8833 if (!m_CheckOverheating)
8835
8837 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8838
8839 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8840 }
8841 }
8842
8843 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8844 {
8846 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8847
8849 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8850
8852 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8853
8855 {
8857 }
8858 }
8859
8861 {
8863 }
8864
8865 void OnOverheatingDecay()
8866 {
8867 if (m_MaxOverheatingValue > 0)
8868 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8869 else
8871
8872 if (m_OverheatingShots <= 0)
8873 {
8876 }
8877 else
8878 {
8879 if (!m_CheckOverheating)
8881
8883 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8884 }
8885
8886 CheckOverheating(this, "", this);
8887 }
8888
8889 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8890 {
8892 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8893 }
8894
8895 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8896 {
8898 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8900 }
8901
8902 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8903 {
8905 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8906 }
8907
8908 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8909 {
8911 m_OverheatingParticles = new array<ref OverheatingParticle>;
8912
8913 OverheatingParticle OP = new OverheatingParticle();
8914 OP.RegisterParticle(p);
8915 OP.SetOverheatingLimitMin(min_heat_coef);
8916 OP.SetOverheatingLimitMax(max_heat_coef);
8917 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8918
8919 m_OverheatingParticles.Insert(OP);
8920 }
8921
8922 float GetOverheatingCoef()
8923 {
8924 if (m_MaxOverheatingValue > 0)
8926
8927 return -1;
8928 }
8929
8931 {
8933 {
8934 float overheat_coef = GetOverheatingCoef();
8935 int count = m_OverheatingParticles.Count();
8936
8937 for (int i = count; i > 0; --i)
8938 {
8939 int id = i - 1;
8940 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8941 Particle p = OP.GetParticle();
8942
8943 float overheat_min = OP.GetOverheatingLimitMin();
8944 float overheat_max = OP.GetOverheatingLimitMax();
8945
8946 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8947 {
8948 if (p)
8949 {
8950 p.Stop();
8951 OP.RegisterParticle(null);
8952 }
8953 }
8954 }
8955 }
8956 }
8957
8959 {
8961 {
8962 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8963 {
8964 int id = i - 1;
8965 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8966
8967 if (OP)
8968 {
8969 Particle p = OP.GetParticle();
8970
8971 if (p)
8972 {
8973 p.Stop();
8974 }
8975
8976 delete OP;
8977 }
8978 }
8979
8980 m_OverheatingParticles.Clear();
8982 }
8983 }
8984
8986 float GetInfectionChance(int system = 0, Param param = null)
8987 {
8988 return 0.0;
8989 }
8990
8991
8992 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8993 {
8994 return 250;//default value
8995 }
8996
8997 float GetFilterDamageRatio()
8998 {
8999 return 0;
9000 }
9001
9003 bool HasMuzzle()
9004 {
9005 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9006 return true;
9007
9008 return false;
9009 }
9010
9012 int GetMuzzleID()
9013 {
9014 if (!m_WeaponTypeToID)
9016
9017 if (m_WeaponTypeToID.Contains(GetType()))
9018 {
9019 return m_WeaponTypeToID.Get(GetType());
9020 }
9021 else
9022 {
9023 // Register new weapon ID
9025 }
9026
9028 }
9029
9036 {
9037 return -1;
9038 }
9039
9040
9041
9042 // -------------------------------------------------------------------------
9043 void ~ItemBase()
9044 {
9045 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9046 {
9047 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9048 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9049
9050 if (r_index >= 0)
9051 {
9052 InventoryLocation r_il = new InventoryLocation;
9053 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9054
9055 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9056 int r_type = r_il.GetType();
9057 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9058 {
9059 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9060 }
9061 else if (r_type == InventoryLocationType.ATTACHMENT)
9062 {
9063 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9064 }
9065
9066 }
9067
9068 player.GetHumanInventory().ClearUserReservedLocation(this);
9069 }
9070
9071 if (m_LockingSound)
9072 SEffectManager.DestroyEffect(m_LockingSound);
9073 }
9074
9075
9076
9077 // -------------------------------------------------------------------------
9078 static int GetDebugActionsMask()
9079 {
9080 return ItemBase.m_DebugActionsMask;
9081 }
9082
9083 static bool HasDebugActionsMask(int mask)
9084 {
9085 return ItemBase.m_DebugActionsMask & mask;
9086 }
9087
9088 static void SetDebugActionsMask(int mask)
9089 {
9090 ItemBase.m_DebugActionsMask = mask;
9091 }
9092
9093 static void AddDebugActionsMask(int mask)
9094 {
9095 ItemBase.m_DebugActionsMask |= mask;
9096 }
9097
9098 static void RemoveDebugActionsMask(int mask)
9099 {
9100 ItemBase.m_DebugActionsMask &= ~mask;
9101 }
9102
9103 static void ToggleDebugActionsMask(int mask)
9104 {
9105 if (HasDebugActionsMask(mask))
9106 {
9108 }
9109 else
9110 {
9111 AddDebugActionsMask(mask);
9112 }
9113 }
9114
9115 // -------------------------------------------------------------------------
9116 void SetCEBasedQuantity()
9117 {
9118 if (GetEconomyProfile())
9119 {
9120 float q_max = GetEconomyProfile().GetQuantityMax();
9121 if (q_max > 0)
9122 {
9123 float q_min = GetEconomyProfile().GetQuantityMin();
9124 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9125
9126 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9127 {
9128 ComponentEnergyManager comp = GetCompEM();
9129 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
9130 {
9131 comp.SetEnergy0To1(quantity_randomized);
9132 }
9133 }
9134 else if (HasQuantity())
9135 {
9136 SetQuantityNormalized(quantity_randomized, false);
9137 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9138 }
9139
9140 }
9141 }
9142 }
9143
9145 void LockToParent()
9146 {
9147 EntityAI parent = GetHierarchyParent();
9148
9149 if (parent)
9150 {
9151 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9152 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9153 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9154 }
9155 }
9156
9158 void UnlockFromParent()
9159 {
9160 EntityAI parent = GetHierarchyParent();
9161
9162 if (parent)
9163 {
9164 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9165 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9166 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9167 }
9168 }
9169
9170 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9171 {
9172 /*
9173 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9174 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9175 */
9176 ItemBase item2 = ItemBase.Cast(entity2);
9177
9178 if (GetGame().IsClient())
9179 {
9180 if (ScriptInputUserData.CanStoreInputUserData())
9181 {
9182 ScriptInputUserData ctx = new ScriptInputUserData;
9184 ctx.Write(-1);
9185 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9186 ctx.Write(i1);
9187 ctx.Write(item2);
9188 ctx.Write(use_stack_max);
9189 ctx.Write(-1);
9190 ctx.Send();
9191
9192 if (IsCombineAll(item2, use_stack_max))
9193 {
9194 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9195 }
9196 }
9197 }
9198 else if (!GetGame().IsMultiplayer())
9199 {
9200 CombineItems(item2, use_stack_max);
9201 }
9202 }
9203
9204 bool IsLiquidPresent()
9205 {
9206 return (GetLiquidType() != 0 && HasQuantity());
9207 }
9208
9209 bool IsLiquidContainer()
9210 {
9211 return m_LiquidContainerMask != 0;
9212 }
9213
9215 {
9216 return m_LiquidContainerMask;
9217 }
9218
9219 bool IsBloodContainer()
9220 {
9221 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9222 return false;
9223 }
9224
9225 bool IsNVG()
9226 {
9227 return false;
9228 }
9229
9232 bool IsExplosive()
9233 {
9234 return false;
9235 }
9236
9238 {
9239 return "";
9240 }
9241
9243
9244 bool IsLightSource()
9245 {
9246 return false;
9247 }
9248
9250 {
9251 return true;
9252 }
9253
9254 //--- ACTION CONDITIONS
9255 //direction
9256 bool IsFacingPlayer(PlayerBase player, string selection)
9257 {
9258 return true;
9259 }
9260
9261 bool IsPlayerInside(PlayerBase player, string selection)
9262 {
9263 return true;
9264 }
9265
9266 override bool CanObstruct()
9267 {
9268 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9269 return !player || !IsPlayerInside(player, "");
9270 }
9271
9272 override bool IsBeingPlaced()
9273 {
9274 return m_IsBeingPlaced;
9275 }
9276
9277 void SetIsBeingPlaced(bool is_being_placed)
9278 {
9279 m_IsBeingPlaced = is_being_placed;
9280 if (!is_being_placed)
9282 SetSynchDirty();
9283 }
9284
9285 //server-side
9286 void OnEndPlacement() {}
9287
9288 override bool IsHologram()
9289 {
9290 return m_IsHologram;
9291 }
9292
9293 bool CanBeDigged()
9294 {
9295 return m_CanBeDigged;
9296 }
9297
9299 {
9300 return 1;
9301 }
9302
9303 bool CanMakeGardenplot()
9304 {
9305 return false;
9306 }
9307
9308 void SetIsHologram(bool is_hologram)
9309 {
9310 m_IsHologram = is_hologram;
9311 SetSynchDirty();
9312 }
9313 /*
9314 protected float GetNutritionalEnergy()
9315 {
9316 Edible_Base edible = Edible_Base.Cast(this);
9317 return edible.GetFoodEnergy();
9318 }
9319
9320 protected float GetNutritionalWaterContent()
9321 {
9322 Edible_Base edible = Edible_Base.Cast(this);
9323 return edible.GetFoodWater();
9324 }
9325
9326 protected float GetNutritionalIndex()
9327 {
9328 Edible_Base edible = Edible_Base.Cast(this);
9329 return edible.GetFoodNutritionalIndex();
9330 }
9331
9332 protected float GetNutritionalFullnessIndex()
9333 {
9334 Edible_Base edible = Edible_Base.Cast(this);
9335 return edible.GetFoodTotalVolume();
9336 }
9337
9338 protected float GetNutritionalToxicity()
9339 {
9340 Edible_Base edible = Edible_Base.Cast(this);
9341 return edible.GetFoodToxicity();
9342
9343 }
9344 */
9345
9346
9347 // -------------------------------------------------------------------------
9348 override void OnMovedInsideCargo(EntityAI container)
9349 {
9350 super.OnMovedInsideCargo(container);
9351
9352 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9353 }
9354
9355 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9356 {
9357 super.EEItemLocationChanged(oldLoc,newLoc);
9358
9359 PlayerBase new_player = null;
9360 PlayerBase old_player = null;
9361
9362 if (newLoc.GetParent())
9363 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9364
9365 if (oldLoc.GetParent())
9366 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9367
9368 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9369 {
9370 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9371
9372 if (r_index >= 0)
9373 {
9374 InventoryLocation r_il = new InventoryLocation;
9375 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9376
9377 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9378 int r_type = r_il.GetType();
9379 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9380 {
9381 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9382 }
9383 else if (r_type == InventoryLocationType.ATTACHMENT)
9384 {
9385 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9386 }
9387
9388 }
9389 }
9390
9391 if (newLoc.GetType() == InventoryLocationType.HANDS)
9392 {
9393 if (new_player)
9394 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9395
9396 if (new_player == old_player)
9397 {
9398
9399 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9400 {
9401 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9402 {
9403 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9404 {
9405 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9406 }
9407 }
9408 else
9409 {
9410 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9411 }
9412 }
9413
9414 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9415 {
9416 int type = oldLoc.GetType();
9417 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9418 {
9419 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9420 }
9421 else if (type == InventoryLocationType.ATTACHMENT)
9422 {
9423 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9424 }
9425 }
9426 if (!m_OldLocation)
9427 {
9428 m_OldLocation = new InventoryLocation;
9429 }
9430 m_OldLocation.Copy(oldLoc);
9431 }
9432 else
9433 {
9434 if (m_OldLocation)
9435 {
9436 m_OldLocation.Reset();
9437 }
9438 }
9439
9441 }
9442 else
9443 {
9444 if (new_player)
9445 {
9446 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9447 if (res_index >= 0)
9448 {
9449 InventoryLocation il = new InventoryLocation;
9450 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9451 ItemBase it = ItemBase.Cast(il.GetItem());
9452 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9453 int rel_type = il.GetType();
9454 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9455 {
9456 il.GetParent().GetOnReleaseLock().Invoke(it);
9457 }
9458 else if (rel_type == InventoryLocationType.ATTACHMENT)
9459 {
9460 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9461 }
9462 //it.GetOnReleaseLock().Invoke(it);
9463 }
9464 }
9465 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9466 {
9467 //ThrowPhysically(old_player, vector.Zero);
9468 m_ThrowItemOnDrop = false;
9469 }
9470
9471 if (m_OldLocation)
9472 {
9473 m_OldLocation.Reset();
9474 }
9475 }
9476 }
9477
9478 override void EOnContact(IEntity other, Contact extra)
9479 {
9481 {
9482 int liquidType = -1;
9483 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9484 if (impactSpeed > 0.0)
9485 {
9486 m_ImpactSpeed = impactSpeed;
9487 #ifndef SERVER
9488 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9489 #else
9490 m_WantPlayImpactSound = true;
9491 SetSynchDirty();
9492 #endif
9493 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9494 }
9495 }
9496
9497 #ifdef SERVER
9498 if (GetCompEM() && GetCompEM().IsPlugged())
9499 {
9500 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9501 GetCompEM().UnplugThis();
9502 }
9503 #endif
9504 }
9505
9506 void RefreshPhysics();
9507
9508 override void OnCreatePhysics()
9509 {
9511 }
9512
9513 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9514 {
9515
9516 }
9517 // -------------------------------------------------------------------------
9518 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9519 {
9520 super.OnItemLocationChanged(old_owner, new_owner);
9521
9522 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9523 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9524
9525 if (!relatedPlayer && playerNew)
9526 relatedPlayer = playerNew;
9527
9528 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9529 {
9530 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9531 if (actionMgr)
9532 {
9533 ActionBase currentAction = actionMgr.GetRunningAction();
9534 if (currentAction)
9535 currentAction.OnItemLocationChanged(this);
9536 }
9537 }
9538
9539 Man ownerPlayerOld = null;
9540 Man ownerPlayerNew = null;
9541
9542 if (old_owner)
9543 {
9544 if (old_owner.IsMan())
9545 {
9546 ownerPlayerOld = Man.Cast(old_owner);
9547 }
9548 else
9549 {
9550 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9551 }
9552 }
9553 else
9554 {
9555 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9556 {
9557 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9558
9559 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9560 {
9561 GetCompEM().UnplugThis();
9562 }
9563 }
9564 }
9565
9566 if (new_owner)
9567 {
9568 if (new_owner.IsMan())
9569 {
9570 ownerPlayerNew = Man.Cast(new_owner);
9571 }
9572 else
9573 {
9574 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9575 }
9576 }
9577
9578 if (ownerPlayerOld != ownerPlayerNew)
9579 {
9580 if (ownerPlayerOld)
9581 {
9582 array<EntityAI> subItemsExit = new array<EntityAI>;
9583 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9584 for (int i = 0; i < subItemsExit.Count(); i++)
9585 {
9586 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9587 itemExit.OnInventoryExit(ownerPlayerOld);
9588 }
9589 }
9590
9591 if (ownerPlayerNew)
9592 {
9593 array<EntityAI> subItemsEnter = new array<EntityAI>;
9594 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9595 for (int j = 0; j < subItemsEnter.Count(); j++)
9596 {
9597 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9598 itemEnter.OnInventoryEnter(ownerPlayerNew);
9599 }
9600 }
9601 }
9602 else if (ownerPlayerNew != null)
9603 {
9604 PlayerBase nplayer;
9605 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9606 {
9607 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9608 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9609 for (int k = 0; k < subItemsUpdate.Count(); k++)
9610 {
9611 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9612 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9613 }
9614 }
9615 }
9616
9617 if (old_owner)
9618 old_owner.OnChildItemRemoved(this);
9619 if (new_owner)
9620 new_owner.OnChildItemReceived(this);
9621 }
9622
9623 // -------------------------------------------------------------------------------
9624 override void EEDelete(EntityAI parent)
9625 {
9626 super.EEDelete(parent);
9627 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9628 if (player)
9629 {
9630 OnInventoryExit(player);
9631
9632 if (player.IsAlive())
9633 {
9634 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9635 if (r_index >= 0)
9636 {
9637 InventoryLocation r_il = new InventoryLocation;
9638 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9639
9640 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9641 int r_type = r_il.GetType();
9642 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9643 {
9644 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9645 }
9646 else if (r_type == InventoryLocationType.ATTACHMENT)
9647 {
9648 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9649 }
9650
9651 }
9652
9653 player.RemoveQuickBarEntityShortcut(this);
9654 }
9655 }
9656 }
9657 // -------------------------------------------------------------------------------
9658 override void EEKilled(Object killer)
9659 {
9660 super.EEKilled(killer);
9661
9663 if (killer && killer.IsFireplace() && CanExplodeInFire())
9664 {
9665 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9666 {
9667 if (IsMagazine())
9668 {
9669 if (Magazine.Cast(this).GetAmmoCount() > 0)
9670 {
9671 ExplodeAmmo();
9672 }
9673 }
9674 else
9675 {
9676 Explode(DamageType.EXPLOSION);
9677 }
9678 }
9679 }
9680 }
9681
9682 override void OnWasAttached(EntityAI parent, int slot_id)
9683 {
9684 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9685
9686 super.OnWasAttached(parent, slot_id);
9687
9688 if (HasQuantity())
9689 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9690
9691 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9692 }
9693
9694 override void OnWasDetached(EntityAI parent, int slot_id)
9695 {
9696 super.OnWasDetached(parent, slot_id);
9697
9698 if (HasQuantity())
9699 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9700 }
9701
9702 override string ChangeIntoOnAttach(string slot)
9703 {
9704 int idx;
9705 TStringArray inventory_slots = new TStringArray;
9706 TStringArray attach_types = new TStringArray;
9707
9708 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9709 if (inventory_slots.Count() < 1) //is string
9710 {
9711 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9712 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9713 }
9714 else //is array
9715 {
9716 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9717 }
9718
9719 idx = inventory_slots.Find(slot);
9720 if (idx < 0)
9721 return "";
9722
9723 return attach_types.Get(idx);
9724 }
9725
9726 override string ChangeIntoOnDetach()
9727 {
9728 int idx = -1;
9729 string slot;
9730
9731 TStringArray inventory_slots = new TStringArray;
9732 TStringArray detach_types = new TStringArray;
9733
9734 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9735 if (inventory_slots.Count() < 1) //is string
9736 {
9737 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9738 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9739 }
9740 else //is array
9741 {
9742 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9743 if (detach_types.Count() < 1)
9744 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9745 }
9746
9747 for (int i = 0; i < inventory_slots.Count(); i++)
9748 {
9749 slot = inventory_slots.Get(i);
9750 }
9751
9752 if (slot != "")
9753 {
9754 if (detach_types.Count() == 1)
9755 idx = 0;
9756 else
9757 idx = inventory_slots.Find(slot);
9758 }
9759 if (idx < 0)
9760 return "";
9761
9762 return detach_types.Get(idx);
9763 }
9764
9765 void ExplodeAmmo()
9766 {
9767 //timer
9768 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
9769
9770 //min/max time
9771 float min_time = 1;
9772 float max_time = 3;
9773 float delay = Math.RandomFloat(min_time, max_time);
9774
9775 explode_timer.Run(delay, this, "DoAmmoExplosion");
9776 }
9777
9778 void DoAmmoExplosion()
9779 {
9780 Magazine magazine = Magazine.Cast(this);
9781 int pop_sounds_count = 6;
9782 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9783
9784 //play sound
9785 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9786 string sound_name = pop_sounds[ sound_idx ];
9787 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
9788
9789 //remove ammo count
9790 magazine.ServerAddAmmoCount(-1);
9791
9792 //if condition then repeat -> ExplodeAmmo
9793 float min_temp_to_explode = 100; //min temperature for item to explode
9794
9795 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
9796 {
9797 ExplodeAmmo();
9798 }
9799 }
9800
9801 // -------------------------------------------------------------------------------
9802 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9803 {
9804 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9805
9806 const int CHANCE_DAMAGE_CARGO = 4;
9807 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9808 const int CHANCE_DAMAGE_NOTHING = 2;
9809
9810 if (IsClothing() || IsContainer() || IsItemTent())
9811 {
9812 float dmg = damageResult.GetDamage("","Health") * -0.5;
9813 int chances;
9814 int rnd;
9815
9816 if (GetInventory().GetCargo())
9817 {
9818 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9819 rnd = Math.RandomInt(0,chances);
9820
9821 if (rnd < CHANCE_DAMAGE_CARGO)
9822 {
9823 DamageItemInCargo(dmg);
9824 }
9825 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9826 {
9828 }
9829 }
9830 else
9831 {
9832 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9833 rnd = Math.RandomInt(0,chances);
9834
9835 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9836 {
9838 }
9839 }
9840 }
9841 }
9842
9843 bool DamageItemInCargo(float damage)
9844 {
9845 if (GetInventory().GetCargo())
9846 {
9847 int item_count = GetInventory().GetCargo().GetItemCount();
9848 if (item_count > 0)
9849 {
9850 int random_pick = Math.RandomInt(0, item_count);
9851 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9852 if (!item.IsExplosive())
9853 {
9854 item.AddHealth("","",damage);
9855 return true;
9856 }
9857 }
9858 }
9859 return false;
9860 }
9861
9862 bool DamageItemAttachments(float damage)
9863 {
9864 int attachment_count = GetInventory().AttachmentCount();
9865 if (attachment_count > 0)
9866 {
9867 int random_pick = Math.RandomInt(0, attachment_count);
9868 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9869 if (!attachment.IsExplosive())
9870 {
9871 attachment.AddHealth("","",damage);
9872 return true;
9873 }
9874 }
9875 return false;
9876 }
9877
9878 override bool IsSplitable()
9879 {
9880 return m_CanThisBeSplit;
9881 }
9882 //----------------
9883 override bool CanBeSplit()
9884 {
9885 if (IsSplitable() && (GetQuantity() > 1))
9886 return GetInventory().CanRemoveEntity();
9887
9888 return false;
9889 }
9890
9891 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9892 {
9893 if (!CanBeSplit())
9894 return;
9895
9896 if (GetGame().IsClient())
9897 {
9898 if (ScriptInputUserData.CanStoreInputUserData())
9899 {
9900 ScriptInputUserData ctx = new ScriptInputUserData;
9902 ctx.Write(1);
9903 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9904 ctx.Write(i1);
9905 ctx.Write(destination_entity);
9906 ctx.Write(true);
9907 ctx.Write(slot_id);
9908 ctx.Send();
9909 }
9910 }
9911 else if (!GetGame().IsMultiplayer())
9912 {
9913 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9914 }
9915 }
9916
9917 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9918 {
9919 if (!CanBeSplit())
9920 return;
9921
9922 float split_quantity_new;
9923 ref ItemBase new_item;
9924 float quantity = GetQuantity();
9925 float stack_max = GetTargetQuantityMax(slot_id);
9926 InventoryLocation loc = new InventoryLocation;
9927
9928 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9929 {
9930 if (stack_max <= GetQuantity())
9931 split_quantity_new = stack_max;
9932 else
9933 split_quantity_new = GetQuantity();
9934
9935 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9936 if (new_item)
9937 {
9938 new_item.SetResultOfSplit(true);
9939 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9940 AddQuantity(-split_quantity_new);
9941 new_item.SetQuantity(split_quantity_new);
9942 }
9943 }
9944 else if (destination_entity && slot_id == -1)
9945 {
9946 if (quantity > stack_max)
9947 split_quantity_new = stack_max;
9948 else
9949 split_quantity_new = quantity;
9950
9951 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9952 {
9953 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9954 new_item = ItemBase.Cast(o);
9955 }
9956
9957 if (new_item)
9958 {
9959 new_item.SetResultOfSplit(true);
9960 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9961 AddQuantity(-split_quantity_new);
9962 new_item.SetQuantity(split_quantity_new);
9963 }
9964 }
9965 else
9966 {
9967 if (stack_max != 0)
9968 {
9969 if (stack_max < GetQuantity())
9970 {
9971 split_quantity_new = GetQuantity() - stack_max;
9972 }
9973
9974 if (split_quantity_new == 0)
9975 {
9976 if (!GetGame().IsMultiplayer())
9977 player.PhysicalPredictiveDropItem(this);
9978 else
9979 player.ServerDropEntity(this);
9980 return;
9981 }
9982
9983 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9984
9985 if (new_item)
9986 {
9987 new_item.SetResultOfSplit(true);
9988 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9989 SetQuantity(split_quantity_new);
9990 new_item.SetQuantity(stack_max);
9991 new_item.PlaceOnSurface();
9992 }
9993 }
9994 }
9995 }
9996
9997 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9998 {
9999 if (!CanBeSplit())
10000 return;
10001
10002 float split_quantity_new;
10003 ref ItemBase new_item;
10004 float quantity = GetQuantity();
10005 float stack_max = GetTargetQuantityMax(slot_id);
10006 InventoryLocation loc = new InventoryLocation;
10007
10008 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10009 {
10010 if (stack_max <= GetQuantity())
10011 split_quantity_new = stack_max;
10012 else
10013 split_quantity_new = GetQuantity();
10014
10015 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10016 if (new_item)
10017 {
10018 new_item.SetResultOfSplit(true);
10019 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10020 AddQuantity(-split_quantity_new);
10021 new_item.SetQuantity(split_quantity_new);
10022 }
10023 }
10024 else if (destination_entity && slot_id == -1)
10025 {
10026 if (quantity > stack_max)
10027 split_quantity_new = stack_max;
10028 else
10029 split_quantity_new = quantity;
10030
10031 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10032 {
10033 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10034 new_item = ItemBase.Cast(o);
10035 }
10036
10037 if (new_item)
10038 {
10039 new_item.SetResultOfSplit(true);
10040 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10041 AddQuantity(-split_quantity_new);
10042 new_item.SetQuantity(split_quantity_new);
10043 }
10044 }
10045 else
10046 {
10047 if (stack_max != 0)
10048 {
10049 if (stack_max < GetQuantity())
10050 {
10051 split_quantity_new = GetQuantity() - stack_max;
10052 }
10053
10054 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10055
10056 if (new_item)
10057 {
10058 new_item.SetResultOfSplit(true);
10059 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10060 SetQuantity(split_quantity_new);
10061 new_item.SetQuantity(stack_max);
10062 new_item.PlaceOnSurface();
10063 }
10064 }
10065 }
10066 }
10067
10068 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10069 {
10070 if (!CanBeSplit())
10071 return;
10072
10073 if (GetGame().IsClient())
10074 {
10075 if (ScriptInputUserData.CanStoreInputUserData())
10076 {
10077 ScriptInputUserData ctx = new ScriptInputUserData;
10079 ctx.Write(4);
10080 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10081 ctx.Write(thiz);
10082 dst.WriteToContext(ctx);
10083 ctx.Send();
10084 }
10085 }
10086 else if (!GetGame().IsMultiplayer())
10087 {
10089 }
10090 }
10091
10092 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10093 {
10094 if (!CanBeSplit())
10095 return;
10096
10097 if (GetGame().IsClient())
10098 {
10099 if (ScriptInputUserData.CanStoreInputUserData())
10100 {
10101 ScriptInputUserData ctx = new ScriptInputUserData;
10103 ctx.Write(2);
10104 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10105 ctx.Write(dummy);
10106 ctx.Write(destination_entity);
10107 ctx.Write(true);
10108 ctx.Write(idx);
10109 ctx.Write(row);
10110 ctx.Write(col);
10111 ctx.Send();
10112 }
10113 }
10114 else if (!GetGame().IsMultiplayer())
10115 {
10116 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10117 }
10118 }
10119
10120 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10121 {
10123 }
10124
10125 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10126 {
10127 if (!CanBeSplit())
10128 return this;
10129
10130 float quantity = GetQuantity();
10131 float split_quantity_new;
10132 ItemBase new_item;
10133 if (dst.IsValid())
10134 {
10135 int slot_id = dst.GetSlot();
10136 float stack_max = GetTargetQuantityMax(slot_id);
10137
10138 if (quantity > stack_max)
10139 split_quantity_new = stack_max;
10140 else
10141 split_quantity_new = quantity;
10142
10143 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10144
10145 if (new_item)
10146 {
10147 new_item.SetResultOfSplit(true);
10148 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10149 AddQuantity(-split_quantity_new);
10150 new_item.SetQuantity(split_quantity_new);
10151 }
10152
10153 return new_item;
10154 }
10155
10156 return null;
10157 }
10158
10159 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10160 {
10161 if (!CanBeSplit())
10162 return;
10163
10164 float quantity = GetQuantity();
10165 float split_quantity_new;
10166 ref ItemBase new_item;
10167 if (destination_entity)
10168 {
10169 float stackable = GetTargetQuantityMax();
10170 if (quantity > stackable)
10171 split_quantity_new = stackable;
10172 else
10173 split_quantity_new = quantity;
10174
10175 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10176 if (new_item)
10177 {
10178 new_item.SetResultOfSplit(true);
10179 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10180 AddQuantity(-split_quantity_new);
10181 new_item.SetQuantity(split_quantity_new);
10182 }
10183 }
10184 }
10185
10186 void SplitIntoStackMaxHandsClient(PlayerBase player)
10187 {
10188 if (!CanBeSplit())
10189 return;
10190
10191 if (GetGame().IsClient())
10192 {
10193 if (ScriptInputUserData.CanStoreInputUserData())
10194 {
10195 ScriptInputUserData ctx = new ScriptInputUserData;
10197 ctx.Write(3);
10198 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10199 ctx.Write(i1);
10200 ItemBase destination_entity = this;
10201 ctx.Write(destination_entity);
10202 ctx.Write(true);
10203 ctx.Write(0);
10204 ctx.Send();
10205 }
10206 }
10207 else if (!GetGame().IsMultiplayer())
10208 {
10209 SplitIntoStackMaxHands(player);
10210 }
10211 }
10212
10213 void SplitIntoStackMaxHands(PlayerBase player)
10214 {
10215 if (!CanBeSplit())
10216 return;
10217
10218 float quantity = GetQuantity();
10219 float split_quantity_new;
10220 ref ItemBase new_item;
10221 if (player)
10222 {
10223 float stackable = GetTargetQuantityMax();
10224 if (quantity > stackable)
10225 split_quantity_new = stackable;
10226 else
10227 split_quantity_new = quantity;
10228
10229 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10230 new_item = ItemBase.Cast(in_hands);
10231 if (new_item)
10232 {
10233 new_item.SetResultOfSplit(true);
10234 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10235 AddQuantity(-split_quantity_new);
10236 new_item.SetQuantity(split_quantity_new);
10237 }
10238 }
10239 }
10240
10241 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10242 {
10243 if (!CanBeSplit())
10244 return;
10245
10246 float quantity = GetQuantity();
10247 float split_quantity_new = Math.Floor(quantity * 0.5);
10248
10249 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10250
10251 if (new_item)
10252 {
10253 if (new_item.GetQuantityMax() < split_quantity_new)
10254 {
10255 split_quantity_new = new_item.GetQuantityMax();
10256 }
10257
10258 new_item.SetResultOfSplit(true);
10259 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10260
10261 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10262 {
10263 AddQuantity(-1);
10264 new_item.SetQuantity(1);
10265 }
10266 else
10267 {
10268 AddQuantity(-split_quantity_new);
10269 new_item.SetQuantity(split_quantity_new);
10270 }
10271 }
10272 }
10273
10274 void SplitItem(PlayerBase player)
10275 {
10276 if (!CanBeSplit())
10277 return;
10278
10279 float quantity = GetQuantity();
10280 float split_quantity_new = Math.Floor(quantity / 2);
10281
10282 InventoryLocation invloc = new InventoryLocation;
10283 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10284
10285 ItemBase new_item;
10286 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10287
10288 if (new_item)
10289 {
10290 if (new_item.GetQuantityMax() < split_quantity_new)
10291 {
10292 split_quantity_new = new_item.GetQuantityMax();
10293 }
10294 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10295 {
10296 AddQuantity(-1);
10297 new_item.SetQuantity(1);
10298 }
10299 else
10300 {
10301 AddQuantity(-split_quantity_new);
10302 new_item.SetQuantity(split_quantity_new);
10303 }
10304 }
10305 }
10306
10308 void OnQuantityChanged(float delta)
10309 {
10310 SetWeightDirty();
10311 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10312
10313 if (parent)
10314 parent.OnAttachmentQuantityChangedEx(this, delta);
10315
10316 if (IsLiquidContainer())
10317 {
10318 if (GetQuantityNormalized() <= 0.0)
10319 {
10321 }
10322 else if (GetLiquidType() == LIQUID_NONE)
10323 {
10324 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10326 }
10327 }
10328
10329 }
10330
10333 {
10334 // insert code here
10335 }
10336
10338 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10339 {
10341 }
10342
10343 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10344 {
10345 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10346
10347 if (GetGame().IsServer())
10348 {
10349 if (newLevel == GameConstants.STATE_RUINED)
10350 {
10352 EntityAI parent = GetHierarchyParent();
10353 if (parent && parent.IsFireplace())
10354 {
10355 CargoBase cargo = GetInventory().GetCargo();
10356 if (cargo)
10357 {
10358 for (int i = 0; i < cargo.GetItemCount(); ++i)
10359 {
10360 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10361 }
10362 }
10363 }
10364 }
10365
10366 if (IsResultOfSplit())
10367 {
10368 // reset the splitting result flag, return to normal item behavior
10369 SetResultOfSplit(false);
10370 return;
10371 }
10372
10373 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10374 {
10375 SetCleanness(0);//unclean the item upon damage dealt
10376 }
10377 }
10378 }
10379
10380 // just the split? TODO: verify
10381 override void OnRightClick()
10382 {
10383 super.OnRightClick();
10384
10385 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10386 {
10387 if (GetGame().IsClient())
10388 {
10389 if (ScriptInputUserData.CanStoreInputUserData())
10390 {
10391 vector m4[4];
10392 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10393
10394 EntityAI root = GetHierarchyRoot();
10395
10396 InventoryLocation dst = new InventoryLocation;
10397 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
10398 {
10399 if (root)
10400 {
10401 root.GetTransform(m4);
10402 dst.SetGround(this, m4);
10403 }
10404 else
10405 GetInventory().GetCurrentInventoryLocation(dst);
10406 }
10407 else
10408 {
10409 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10410 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10411 this shouldnt cause issues within this scope*/
10412 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10413 {
10414 if (root)
10415 {
10416 root.GetTransform(m4);
10417 dst.SetGround(this, m4);
10418 }
10419 else
10420 GetInventory().GetCurrentInventoryLocation(dst);
10421 }
10422 else
10423 {
10424 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10425 }
10426 }
10427
10428 ScriptInputUserData ctx = new ScriptInputUserData;
10430 ctx.Write(4);
10431 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10432 ctx.Write(thiz);
10433 dst.WriteToContext(ctx);
10434 ctx.Write(true); // dummy
10435 ctx.Send();
10436 }
10437 }
10438 else if (!GetGame().IsMultiplayer())
10439 {
10440 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10441 }
10442 }
10443 }
10444
10445 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10446 {
10447 //TODO: delete check zero quantity check after fix double posts hands fsm events
10448 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10449 return false;
10450
10451 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10452 return false;
10453
10454 //can_this_be_combined = ConfigGetBool("canBeSplit");
10456 return false;
10457
10458
10459 Magazine mag = Magazine.Cast(this);
10460 if (mag)
10461 {
10462 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10463 return false;
10464
10465 if (stack_max_limit)
10466 {
10467 Magazine other_mag = Magazine.Cast(other_item);
10468 if (other_item)
10469 {
10470 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10471 return false;
10472 }
10473
10474 }
10475 }
10476 else
10477 {
10478 //TODO: delete check zero quantity check after fix double posts hands fsm events
10479 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10480 return false;
10481
10482 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10483 return false;
10484 }
10485
10486 PlayerBase player = null;
10487 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10488 {
10489 if (player.GetInventory().HasAttachment(this))
10490 return false;
10491
10492 if (player.IsItemsToDelete())
10493 return false;
10494 }
10495
10496 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10497 return false;
10498
10499 int slotID;
10500 string slotName;
10501 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10502 return false;
10503
10504 return true;
10505 }
10506
10507 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10508 {
10509 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10510 }
10511
10512 bool IsResultOfSplit()
10513 {
10514 return m_IsResultOfSplit;
10515 }
10516
10517 void SetResultOfSplit(bool value)
10518 {
10519 m_IsResultOfSplit = value;
10520 }
10521
10522 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10523 {
10524 return ComputeQuantityUsedEx(other_item, use_stack_max);
10525 }
10526
10527 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10528 {
10529 float other_item_quantity = other_item.GetQuantity();
10530 float this_free_space;
10531
10532 float stack_max = GetQuantityMax();
10533
10534 this_free_space = stack_max - GetQuantity();
10535
10536 if (other_item_quantity > this_free_space)
10537 {
10538 return this_free_space;
10539 }
10540 else
10541 {
10542 return other_item_quantity;
10543 }
10544 }
10545
10546 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10547 {
10548 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10549 }
10550
10551 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10552 {
10553 if (!CanBeCombined(other_item, false))
10554 return;
10555
10556 if (!IsMagazine() && other_item)
10557 {
10558 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10559 if (quantity_used != 0)
10560 {
10561 float hp1 = GetHealth01("","");
10562 float hp2 = other_item.GetHealth01("","");
10563 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10564 hpResult = hpResult / (GetQuantity() + quantity_used);
10565
10566 hpResult *= GetMaxHealth();
10567 Math.Round(hpResult);
10568 SetHealth("", "Health", hpResult);
10569
10570 AddQuantity(quantity_used);
10571 other_item.AddQuantity(-quantity_used);
10572 }
10573 }
10574 OnCombine(other_item);
10575 }
10576
10577 void OnCombine(ItemBase other_item)
10578 {
10579 #ifdef SERVER
10580 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10581 GetHierarchyParent().IncreaseLifetimeUp();
10582 #endif
10583 };
10584
10585 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10586 {
10587 PlayerBase p = PlayerBase.Cast(player);
10588
10589 array<int> recipesIds = p.m_Recipes;
10590 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10591 if (moduleRecipesManager)
10592 {
10593 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10594 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10595 }
10596
10597 for (int i = 0;i < recipesIds.Count(); i++)
10598 {
10599 int key = recipesIds.Get(i);
10600 string recipeName = moduleRecipesManager.GetRecipeName(key);
10601 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10602 }
10603 }
10604
10605 // -------------------------------------------------------------------------
10606 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10607 {
10608 super.GetDebugActions(outputList);
10609
10610 //quantity
10611 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10612 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10613 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10614 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10615
10616 //health
10617 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10618 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10619 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10620 //temperature
10621 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10622 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10623 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10624
10625 //wet
10626 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10627 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10628
10629 //liquidtype
10630 if (IsLiquidContainer())
10631 {
10632 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10633 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10634 }
10635
10636 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10637 // watch
10638 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10639 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10640
10641 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10642 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10643 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10644 }
10645
10646 // -------------------------------------------------------------------------
10647 // -------------------------------------------------------------------------
10648 // -------------------------------------------------------------------------
10649 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10650 {
10651 super.OnAction(action_id, player, ctx);
10652 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10653 {
10654 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10655 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10656 PlayerBase p = PlayerBase.Cast(player);
10657 if (EActions.RECIPES_RANGE_START < 1000)
10658 {
10659 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10660 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10661 }
10662 }
10663 #ifndef SERVER
10664 else if (action_id == EActions.WATCH_PLAYER)
10665 {
10666 PluginDeveloper.SetDeveloperItemClientEx(player);
10667 }
10668 #endif
10669 if (GetGame().IsServer())
10670 {
10671 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10672 {
10673 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10674 OnDebugButtonPressServer(id + 1);
10675 }
10676
10677 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10678 {
10679 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10680 InsertAgent(agent_id,100);
10681 }
10682
10683 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10684 {
10685 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10686 RemoveAgent(agent_id2);
10687 }
10688
10689 else if (action_id == EActions.ADD_QUANTITY)
10690 {
10691 if (IsMagazine())
10692 {
10693 Magazine mag = Magazine.Cast(this);
10694 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10695 }
10696 else
10697 {
10698 AddQuantity(GetQuantityMax() * 0.2);
10699 }
10700
10701 if (m_EM)
10702 {
10703 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10704 }
10705 //PrintVariables();
10706 }
10707
10708 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10709 {
10710 if (IsMagazine())
10711 {
10712 Magazine mag2 = Magazine.Cast(this);
10713 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10714 }
10715 else
10716 {
10717 AddQuantity(- GetQuantityMax() * 0.2);
10718 }
10719 if (m_EM)
10720 {
10721 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10722 }
10723 //PrintVariables();
10724 }
10725
10726 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10727 {
10728 SetQuantity(0);
10729
10730 if (m_EM)
10731 {
10732 m_EM.SetEnergy(0);
10733 }
10734 }
10735
10736 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10737 {
10739
10740 if (m_EM)
10741 {
10742 m_EM.SetEnergy(m_EM.GetEnergyMax());
10743 }
10744 }
10745
10746 else if (action_id == EActions.ADD_HEALTH)
10747 {
10748 AddHealth("","",GetMaxHealth("","Health")/5);
10749 }
10750 else if (action_id == EActions.REMOVE_HEALTH)
10751 {
10752 AddHealth("","",-GetMaxHealth("","Health")/5);
10753 }
10754 else if (action_id == EActions.DESTROY_HEALTH)
10755 {
10756 SetHealth01("","",0);
10757 }
10758 else if (action_id == EActions.WATCH_ITEM)
10759 {
10761 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10762 #ifdef DEVELOPER
10763 SetDebugDeveloper_item(this);
10764 #endif
10765 }
10766
10767 else if (action_id == EActions.ADD_TEMPERATURE)
10768 {
10769 AddTemperature(20);
10770 //PrintVariables();
10771 }
10772
10773 else if (action_id == EActions.REMOVE_TEMPERATURE)
10774 {
10775 AddTemperature(-20);
10776 //PrintVariables();
10777 }
10778
10779 else if (action_id == EActions.FLIP_FROZEN)
10780 {
10781 SetFrozen(!GetIsFrozen());
10782 //PrintVariables();
10783 }
10784
10785 else if (action_id == EActions.ADD_WETNESS)
10786 {
10787 AddWet(GetWetMax()/5);
10788 //PrintVariables();
10789 }
10790
10791 else if (action_id == EActions.REMOVE_WETNESS)
10792 {
10793 AddWet(-GetWetMax()/5);
10794 //PrintVariables();
10795 }
10796
10797 else if (action_id == EActions.LIQUIDTYPE_UP)
10798 {
10799 int curr_type = GetLiquidType();
10800 SetLiquidType(curr_type * 2);
10801 //AddWet(1);
10802 //PrintVariables();
10803 }
10804
10805 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10806 {
10807 int curr_type2 = GetLiquidType();
10808 SetLiquidType(curr_type2 / 2);
10809 }
10810
10811 else if (action_id == EActions.MAKE_SPECIAL)
10812 {
10813 auto debugParams = DebugSpawnParams.WithPlayer(player);
10814 OnDebugSpawnEx(debugParams);
10815 }
10816
10817 else if (action_id == EActions.DELETE)
10818 {
10819 Delete();
10820 }
10821
10822 }
10823
10824
10825 return false;
10826 }
10827
10828 // -------------------------------------------------------------------------
10829
10830
10833 void OnActivatedByTripWire();
10834
10836 void OnActivatedByItem(notnull ItemBase item);
10837
10838 //----------------------------------------------------------------
10839 //returns true if item is able to explode when put in fire
10840 bool CanExplodeInFire()
10841 {
10842 return false;
10843 }
10844
10845 //----------------------------------------------------------------
10846 bool CanEat()
10847 {
10848 return true;
10849 }
10850
10851 //----------------------------------------------------------------
10852 override bool IsIgnoredByConstruction()
10853 {
10854 return true;
10855 }
10856
10857 //----------------------------------------------------------------
10858 //has FoodStages in config?
10859 bool HasFoodStage()
10860 {
10861 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10862 return GetGame().ConfigIsExisting(config_path);
10863 }
10864
10866 FoodStage GetFoodStage()
10867 {
10868 return null;
10869 }
10870
10871 bool CanBeCooked()
10872 {
10873 return false;
10874 }
10875
10876 bool CanBeCookedOnStick()
10877 {
10878 return false;
10879 }
10880
10882 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10884
10885 //----------------------------------------------------------------
10886 bool CanRepair(ItemBase item_repair_kit)
10887 {
10888 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10889 return module_repairing.CanRepair(this, item_repair_kit);
10890 }
10891
10892 //----------------------------------------------------------------
10893 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10894 {
10895 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10896 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10897 }
10898
10899 //----------------------------------------------------------------
10900 int GetItemSize()
10901 {
10902 /*
10903 vector v_size = this.ConfigGetVector("itemSize");
10904 int v_size_x = v_size[0];
10905 int v_size_y = v_size[1];
10906 int size = v_size_x * v_size_y;
10907 return size;
10908 */
10909
10910 return 1;
10911 }
10912
10913 //----------------------------------------------------------------
10914 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10915 bool CanBeMovedOverride()
10916 {
10917 return m_CanBeMovedOverride;
10918 }
10919
10920 //----------------------------------------------------------------
10921 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10922 void SetCanBeMovedOverride(bool setting)
10923 {
10924 m_CanBeMovedOverride = setting;
10925 }
10926
10927 //----------------------------------------------------------------
10935 void MessageToOwnerStatus(string text)
10936 {
10937 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10938
10939 if (player)
10940 {
10941 player.MessageStatus(text);
10942 }
10943 }
10944
10945 //----------------------------------------------------------------
10953 void MessageToOwnerAction(string text)
10954 {
10955 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10956
10957 if (player)
10958 {
10959 player.MessageAction(text);
10960 }
10961 }
10962
10963 //----------------------------------------------------------------
10971 void MessageToOwnerFriendly(string text)
10972 {
10973 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10974
10975 if (player)
10976 {
10977 player.MessageFriendly(text);
10978 }
10979 }
10980
10981 //----------------------------------------------------------------
10989 void MessageToOwnerImportant(string text)
10990 {
10991 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10992
10993 if (player)
10994 {
10995 player.MessageImportant(text);
10996 }
10997 }
10998
10999 override bool IsItemBase()
11000 {
11001 return true;
11002 }
11003
11004 // Checks if item is of questioned kind
11005 override bool KindOf(string tag)
11006 {
11007 bool found = false;
11008 string item_name = this.GetType();
11009 ref TStringArray item_tag_array = new TStringArray;
11010 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11011
11012 int array_size = item_tag_array.Count();
11013 for (int i = 0; i < array_size; i++)
11014 {
11015 if (item_tag_array.Get(i) == tag)
11016 {
11017 found = true;
11018 break;
11019 }
11020 }
11021 return found;
11022 }
11023
11024
11025 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11026 {
11027 //Debug.Log("OnRPC called");
11028 super.OnRPC(sender, rpc_type,ctx);
11029
11030 //Play soundset for attachment locking (ActionLockAttachment.c)
11031 switch (rpc_type)
11032 {
11033 #ifndef SERVER
11034 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11035 Param2<bool, string> p = new Param2<bool, string>(false, "");
11036
11037 if (!ctx.Read(p))
11038 return;
11039
11040 bool play = p.param1;
11041 string soundSet = p.param2;
11042
11043 if (play)
11044 {
11045 if (m_LockingSound)
11046 {
11048 {
11049 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11050 }
11051 }
11052 else
11053 {
11054 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11055 }
11056 }
11057 else
11058 {
11059 SEffectManager.DestroyEffect(m_LockingSound);
11060 }
11061
11062 break;
11063 #endif
11064
11065 }
11066
11067 if (GetWrittenNoteData())
11068 {
11069 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11070 }
11071 }
11072
11073 //-----------------------------
11074 // VARIABLE MANIPULATION SYSTEM
11075 //-----------------------------
11076 int NameToID(string name)
11077 {
11078 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11079 return plugin.GetID(name);
11080 }
11081
11082 string IDToName(int id)
11083 {
11084 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11085 return plugin.GetName(id);
11086 }
11087
11089 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11090 {
11091 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11092 //read the flags
11093 int varFlags;
11094 if (!ctx.Read(varFlags))
11095 return;
11096
11097 if (varFlags & ItemVariableFlags.FLOAT)
11098 {
11099 ReadVarsFromCTX(ctx);
11100 }
11101 }
11102
11103 override void SerializeNumericalVars(array<float> floats_out)
11104 {
11105 //some variables handled on EntityAI level already!
11106 super.SerializeNumericalVars(floats_out);
11107
11108 // the order of serialization must be the same as the order of de-serialization
11109 //--------------------------------------------
11110 if (IsVariableSet(VARIABLE_QUANTITY))
11111 {
11112 floats_out.Insert(m_VarQuantity);
11113 }
11114 //--------------------------------------------
11115 if (IsVariableSet(VARIABLE_WET))
11116 {
11117 floats_out.Insert(m_VarWet);
11118 }
11119 //--------------------------------------------
11120 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11121 {
11122 floats_out.Insert(m_VarLiquidType);
11123 }
11124 //--------------------------------------------
11125 if (IsVariableSet(VARIABLE_COLOR))
11126 {
11127 floats_out.Insert(m_ColorComponentR);
11128 floats_out.Insert(m_ColorComponentG);
11129 floats_out.Insert(m_ColorComponentB);
11130 floats_out.Insert(m_ColorComponentA);
11131 }
11132 //--------------------------------------------
11133 if (IsVariableSet(VARIABLE_CLEANNESS))
11134 {
11135 floats_out.Insert(m_Cleanness);
11136 }
11137 }
11138
11139 override void DeSerializeNumericalVars(array<float> floats)
11140 {
11141 //some variables handled on EntityAI level already!
11142 super.DeSerializeNumericalVars(floats);
11143
11144 // the order of serialization must be the same as the order of de-serialization
11145 int index = 0;
11146 int mask = Math.Round(floats.Get(index));
11147
11148 index++;
11149 //--------------------------------------------
11150 if (mask & VARIABLE_QUANTITY)
11151 {
11152 if (m_IsStoreLoad)
11153 {
11154 SetStoreLoadedQuantity(floats.Get(index));
11155 }
11156 else
11157 {
11158 float quantity = floats.Get(index);
11159 SetQuantity(quantity, true, false, false, false);
11160 }
11161 index++;
11162 }
11163 //--------------------------------------------
11164 if (mask & VARIABLE_WET)
11165 {
11166 float wet = floats.Get(index);
11167 SetWet(wet);
11168 index++;
11169 }
11170 //--------------------------------------------
11171 if (mask & VARIABLE_LIQUIDTYPE)
11172 {
11173 int liquidtype = Math.Round(floats.Get(index));
11174 SetLiquidType(liquidtype);
11175 index++;
11176 }
11177 //--------------------------------------------
11178 if (mask & VARIABLE_COLOR)
11179 {
11180 m_ColorComponentR = Math.Round(floats.Get(index));
11181 index++;
11182 m_ColorComponentG = Math.Round(floats.Get(index));
11183 index++;
11184 m_ColorComponentB = Math.Round(floats.Get(index));
11185 index++;
11186 m_ColorComponentA = Math.Round(floats.Get(index));
11187 index++;
11188 }
11189 //--------------------------------------------
11190 if (mask & VARIABLE_CLEANNESS)
11191 {
11192 int cleanness = Math.Round(floats.Get(index));
11193 SetCleanness(cleanness);
11194 index++;
11195 }
11196 }
11197
11198 override void WriteVarsToCTX(ParamsWriteContext ctx)
11199 {
11200 super.WriteVarsToCTX(ctx);
11201
11202 //--------------------------------------------
11203 if (IsVariableSet(VARIABLE_QUANTITY))
11204 {
11205 ctx.Write(GetQuantity());
11206 }
11207 //--------------------------------------------
11208 if (IsVariableSet(VARIABLE_WET))
11209 {
11210 ctx.Write(GetWet());
11211 }
11212 //--------------------------------------------
11213 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11214 {
11215 ctx.Write(GetLiquidType());
11216 }
11217 //--------------------------------------------
11218 if (IsVariableSet(VARIABLE_COLOR))
11219 {
11220 int r,g,b,a;
11221 GetColor(r,g,b,a);
11222 ctx.Write(r);
11223 ctx.Write(g);
11224 ctx.Write(b);
11225 ctx.Write(a);
11226 }
11227 //--------------------------------------------
11228 if (IsVariableSet(VARIABLE_CLEANNESS))
11229 {
11230 ctx.Write(GetCleanness());
11231 }
11232 }
11233
11234 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11235 {
11236 if (!super.ReadVarsFromCTX(ctx,version))
11237 return false;
11238
11239 int intValue;
11240 float value;
11241
11242 if (version < 140)
11243 {
11244 if (!ctx.Read(intValue))
11245 return false;
11246
11247 m_VariablesMask = intValue;
11248 }
11249
11250 if (m_VariablesMask & VARIABLE_QUANTITY)
11251 {
11252 if (!ctx.Read(value))
11253 return false;
11254
11255 if (IsStoreLoad())
11256 {
11258 }
11259 else
11260 {
11261 SetQuantity(value, true, false, false, false);
11262 }
11263 }
11264 //--------------------------------------------
11265 if (version < 140)
11266 {
11267 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11268 {
11269 if (!ctx.Read(value))
11270 return false;
11271 SetTemperatureDirect(value);
11272 }
11273 }
11274 //--------------------------------------------
11275 if (m_VariablesMask & VARIABLE_WET)
11276 {
11277 if (!ctx.Read(value))
11278 return false;
11279 SetWet(value);
11280 }
11281 //--------------------------------------------
11282 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11283 {
11284 if (!ctx.Read(intValue))
11285 return false;
11286 SetLiquidType(intValue);
11287 }
11288 //--------------------------------------------
11289 if (m_VariablesMask & VARIABLE_COLOR)
11290 {
11291 int r,g,b,a;
11292 if (!ctx.Read(r))
11293 return false;
11294 if (!ctx.Read(g))
11295 return false;
11296 if (!ctx.Read(b))
11297 return false;
11298 if (!ctx.Read(a))
11299 return false;
11300
11301 SetColor(r,g,b,a);
11302 }
11303 //--------------------------------------------
11304 if (m_VariablesMask & VARIABLE_CLEANNESS)
11305 {
11306 if (!ctx.Read(intValue))
11307 return false;
11308 SetCleanness(intValue);
11309 }
11310 //--------------------------------------------
11311 if (version >= 138 && version < 140)
11312 {
11313 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11314 {
11315 if (!ctx.Read(intValue))
11316 return false;
11317 SetFrozen(intValue);
11318 }
11319 }
11320
11321 return true;
11322 }
11323
11324 //----------------------------------------------------------------
11325 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11326 {
11327 m_IsStoreLoad = true;
11329 {
11330 m_FixDamageSystemInit = true;
11331 }
11332
11333 if (!super.OnStoreLoad(ctx, version))
11334 {
11335 m_IsStoreLoad = false;
11336 return false;
11337 }
11338
11339 if (version >= 114)
11340 {
11341 bool hasQuickBarIndexSaved;
11342
11343 if (!ctx.Read(hasQuickBarIndexSaved))
11344 {
11345 m_IsStoreLoad = false;
11346 return false;
11347 }
11348
11349 if (hasQuickBarIndexSaved)
11350 {
11351 int itmQBIndex;
11352
11353 //Load quickbar item bind
11354 if (!ctx.Read(itmQBIndex))
11355 {
11356 m_IsStoreLoad = false;
11357 return false;
11358 }
11359
11360 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11361 if (itmQBIndex != -1 && parentPlayer)
11362 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11363 }
11364 }
11365 else
11366 {
11367 // Backup of how it used to be
11368 PlayerBase player;
11369 int itemQBIndex;
11370 if (version == int.MAX)
11371 {
11372 if (!ctx.Read(itemQBIndex))
11373 {
11374 m_IsStoreLoad = false;
11375 return false;
11376 }
11377 }
11378 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11379 {
11380 //Load quickbar item bind
11381 if (!ctx.Read(itemQBIndex))
11382 {
11383 m_IsStoreLoad = false;
11384 return false;
11385 }
11386 if (itemQBIndex != -1 && player)
11387 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11388 }
11389 }
11390
11391 if (version < 140)
11392 {
11393 // variable management system
11394 if (!LoadVariables(ctx, version))
11395 {
11396 m_IsStoreLoad = false;
11397 return false;
11398 }
11399 }
11400
11401 //agent trasmission system
11402 if (!LoadAgents(ctx, version))
11403 {
11404 m_IsStoreLoad = false;
11405 return false;
11406 }
11407 if (version >= 132)
11408 {
11409 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11410 if (raib)
11411 {
11412 if (!raib.OnStoreLoad(ctx,version))
11413 {
11414 m_IsStoreLoad = false;
11415 return false;
11416 }
11417 }
11418 }
11419
11420 m_IsStoreLoad = false;
11421 return true;
11422 }
11423
11424 //----------------------------------------------------------------
11425
11426 override void OnStoreSave(ParamsWriteContext ctx)
11427 {
11428 super.OnStoreSave(ctx);
11429
11430 PlayerBase player;
11431 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11432 {
11433 ctx.Write(true); // Keep track of if we should actually read this in or not
11434 //Save quickbar item bind
11435 int itemQBIndex = -1;
11436 itemQBIndex = player.FindQuickBarEntityIndex(this);
11437 ctx.Write(itemQBIndex);
11438 }
11439 else
11440 {
11441 ctx.Write(false); // Keep track of if we should actually read this in or not
11442 }
11443
11444 SaveAgents(ctx);//agent trasmission system
11445
11446 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11447 if (raib)
11448 {
11449 raib.OnStoreSave(ctx);
11450 }
11451 }
11452 //----------------------------------------------------------------
11453
11454 override void AfterStoreLoad()
11455 {
11456 super.AfterStoreLoad();
11457
11459 {
11461 }
11462
11463 if (GetStoreLoadedQuantity() != float.LOWEST)
11464 {
11466 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
11467 }
11468 }
11469
11470 override void EEOnAfterLoad()
11471 {
11472 super.EEOnAfterLoad();
11473
11475 {
11476 m_FixDamageSystemInit = false;
11477 }
11478
11481 }
11482
11483 bool CanBeDisinfected()
11484 {
11485 return false;
11486 }
11487
11488
11489 //----------------------------------------------------------------
11490 override void OnVariablesSynchronized()
11491 {
11492 if (m_Initialized)
11493 {
11494 #ifdef PLATFORM_CONSOLE
11495 //bruteforce it is
11496 if (IsSplitable())
11497 {
11498 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11499 if (menu)
11500 {
11501 menu.Refresh();
11502 }
11503 }
11504 #endif
11505 }
11506
11508 {
11509 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11510 m_WantPlayImpactSound = false;
11511 }
11512
11514 {
11515 SetWeightDirty();
11517 }
11518 if (m_VarWet != m_VarWetPrev)
11519 {
11522 }
11523
11524 if (m_SoundSyncPlay != 0)
11525 {
11526 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11527 m_SoundSyncPlay = 0;
11528 }
11529 if (m_SoundSyncStop != 0)
11530 {
11531 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11532 m_SoundSyncStop = 0;
11533 }
11534
11535 super.OnVariablesSynchronized();
11536 }
11537
11538 //------------------------- Quantity
11539 //----------------------------------------------------------------
11541 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11542 {
11543 if (!IsServerCheck(allow_client))
11544 return false;
11545
11546 if (!HasQuantity())
11547 return false;
11548
11549 float min = GetQuantityMin();
11550 float max = GetQuantityMax();
11551
11552 if (value <= (min + 0.001))
11553 value = min;
11554
11555 if (value == min)
11556 {
11557 if (destroy_config)
11558 {
11559 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11560 if (dstr)
11561 {
11562 m_VarQuantity = Math.Clamp(value, min, max);
11563 this.Delete();
11564 return true;
11565 }
11566 }
11567 else if (destroy_forced)
11568 {
11569 m_VarQuantity = Math.Clamp(value, min, max);
11570 this.Delete();
11571 return true;
11572 }
11573 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11574 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11575 }
11576
11577 float delta = m_VarQuantity;
11578 m_VarQuantity = Math.Clamp(value, min, max);
11579
11580 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11581 {
11582 delta = m_VarQuantity - delta;
11583
11584 if (delta)
11585 OnQuantityChanged(delta);
11586 }
11587
11588 SetVariableMask(VARIABLE_QUANTITY);
11589
11590 return false;
11591 }
11592
11593 //----------------------------------------------------------------
11595 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11596 {
11597 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11598 }
11599 //----------------------------------------------------------------
11600 void SetQuantityMax()
11601 {
11602 float max = GetQuantityMax();
11603 SetQuantity(max);
11604 }
11605
11606 override void SetQuantityToMinimum()
11607 {
11608 float min = GetQuantityMin();
11609 SetQuantity(min);
11610 }
11611 //----------------------------------------------------------------
11613 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11614 {
11615 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11616 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11617 SetQuantity(result, destroy_config, destroy_forced);
11618 }
11619
11620 //----------------------------------------------------------------
11622 override float GetQuantityNormalized()
11623 {
11624 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11625 }
11626
11628 {
11629 return GetQuantityNormalized();
11630 }
11631
11632 /*void SetAmmoNormalized(float value)
11633 {
11634 float value_clamped = Math.Clamp(value, 0, 1);
11635 Magazine this_mag = Magazine.Cast(this);
11636 int max_rounds = this_mag.GetAmmoMax();
11637 int result = value * max_rounds;//can the rounded if higher precision is required
11638 this_mag.SetAmmoCount(result);
11639 }*/
11640 //----------------------------------------------------------------
11641 override int GetQuantityMax()
11642 {
11643 int slot = -1;
11644 if (GetInventory())
11645 {
11646 InventoryLocation il = new InventoryLocation;
11647 GetInventory().GetCurrentInventoryLocation(il);
11648 slot = il.GetSlot();
11649 }
11650
11651 return GetTargetQuantityMax(slot);
11652 }
11653
11654 override int GetTargetQuantityMax(int attSlotID = -1)
11655 {
11656 float quantity_max = 0;
11657
11658 if (IsSplitable()) //only stackable/splitable items can check for stack size
11659 {
11660 if (attSlotID != -1)
11661 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11662
11663 if (quantity_max <= 0)
11664 quantity_max = m_VarStackMax;
11665 }
11666
11667 if (quantity_max <= 0)
11668 quantity_max = m_VarQuantityMax;
11669
11670 return quantity_max;
11671 }
11672 //----------------------------------------------------------------
11673 override int GetQuantityMin()
11674 {
11675 return m_VarQuantityMin;
11676 }
11677 //----------------------------------------------------------------
11678 int GetQuantityInit()
11679 {
11680 return m_VarQuantityInit;
11681 }
11682
11683 //----------------------------------------------------------------
11684 override bool HasQuantity()
11685 {
11686 return !(GetQuantityMax() - GetQuantityMin() == 0);
11687 }
11688
11689 override float GetQuantity()
11690 {
11691 return m_VarQuantity;
11692 }
11693
11694 bool IsFullQuantity()
11695 {
11696 return GetQuantity() >= GetQuantityMax();
11697 }
11698
11699 //Calculates weight of single item without attachments and cargo
11700 override float GetSingleInventoryItemWeightEx()
11701 {
11702 //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
11703 float weightEx = GetWeightEx();//overall weight of the item
11704 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11705 return weightEx - special;
11706 }
11707
11708 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11710 {
11712 }
11713
11714 override protected float GetWeightSpecialized(bool forceRecalc = false)
11715 {
11716 if (IsSplitable()) //quantity determines size of the stack
11717 {
11718 #ifdef DEVELOPER
11719 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11720 {
11721 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11722 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11723 }
11724 #endif
11725
11726 return GetQuantity() * GetConfigWeightModified();
11727 }
11728 else if (HasEnergyManager())// items with energy manager
11729 {
11730 #ifdef DEVELOPER
11731 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11732 {
11733 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11734 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11735 }
11736 #endif
11737 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11738 }
11739 else//everything else
11740 {
11741 #ifdef DEVELOPER
11742 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11743 {
11744 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11745 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11746 }
11747 #endif
11748 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11749 }
11750 }
11751
11753 int GetNumberOfItems()
11754 {
11755 int item_count = 0;
11756 ItemBase item;
11757
11758 if (GetInventory().GetCargo() != NULL)
11759 {
11760 item_count = GetInventory().GetCargo().GetItemCount();
11761 }
11762
11763 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11764 {
11765 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11766 if (item)
11767 item_count += item.GetNumberOfItems();
11768 }
11769 return item_count;
11770 }
11771
11773 float GetUnitWeight(bool include_wetness = true)
11774 {
11775 float weight = 0;
11776 float wetness = 1;
11777 if (include_wetness)
11778 wetness += GetWet();
11779 if (IsSplitable()) //quantity determines size of the stack
11780 {
11781 weight = wetness * m_ConfigWeight;
11782 }
11783 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11784 {
11785 weight = 1;
11786 }
11787 return weight;
11788 }
11789
11790 //-----------------------------------------------------------------
11791
11792 override void ClearInventory()
11793 {
11794 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11795 {
11796 GameInventory inv = GetInventory();
11797 array<EntityAI> items = new array<EntityAI>;
11798 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11799 for (int i = 0; i < items.Count(); i++)
11800 {
11801 ItemBase item = ItemBase.Cast(items.Get(i));
11802 if (item)
11803 {
11804 GetGame().ObjectDelete(item);
11805 }
11806 }
11807 }
11808 }
11809
11810 //------------------------- Energy
11811
11812 //----------------------------------------------------------------
11813 float GetEnergy()
11814 {
11815 float energy = 0;
11816 if (HasEnergyManager())
11817 {
11818 energy = GetCompEM().GetEnergy();
11819 }
11820 return energy;
11821 }
11822
11823
11824 override void OnEnergyConsumed()
11825 {
11826 super.OnEnergyConsumed();
11827
11829 }
11830
11831 override void OnEnergyAdded()
11832 {
11833 super.OnEnergyAdded();
11834
11836 }
11837
11838 // Converts energy (from Energy Manager) to quantity, if enabled.
11840 {
11841 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11842 {
11843 if (HasQuantity())
11844 {
11845 float energy_0to1 = GetCompEM().GetEnergy0To1();
11846 SetQuantityNormalized(energy_0to1);
11847 }
11848 }
11849 }
11850
11851 //----------------------------------------------------------------
11852 float GetHeatIsolationInit()
11853 {
11854 return ConfigGetFloat("heatIsolation");
11855 }
11856
11857 float GetHeatIsolation()
11858 {
11859 return m_HeatIsolation;
11860 }
11861
11862 float GetDryingIncrement(string pIncrementName)
11863 {
11864 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11865 if (GetGame().ConfigIsExisting(paramPath))
11866 return GetGame().ConfigGetFloat(paramPath);
11867
11868 return 0.0;
11869 }
11870
11871 float GetSoakingIncrement(string pIncrementName)
11872 {
11873 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11874 if (GetGame().ConfigIsExisting(paramPath))
11875 return GetGame().ConfigGetFloat(paramPath);
11876
11877 return 0.0;
11878 }
11879 //----------------------------------------------------------------
11880 override void SetWet(float value, bool allow_client = false)
11881 {
11882 if (!IsServerCheck(allow_client))
11883 return;
11884
11885 float min = GetWetMin();
11886 float max = GetWetMax();
11887
11888 float previousValue = m_VarWet;
11889
11890 m_VarWet = Math.Clamp(value, min, max);
11891
11892 if (previousValue != m_VarWet)
11893 {
11894 SetVariableMask(VARIABLE_WET);
11895 OnWetChanged(m_VarWet, previousValue);
11896 }
11897 }
11898 //----------------------------------------------------------------
11899 override void AddWet(float value)
11900 {
11901 SetWet(GetWet() + value);
11902 }
11903 //----------------------------------------------------------------
11904 override void SetWetMax()
11905 {
11907 }
11908 //----------------------------------------------------------------
11909 override float GetWet()
11910 {
11911 return m_VarWet;
11912 }
11913 //----------------------------------------------------------------
11914 override float GetWetMax()
11915 {
11916 return m_VarWetMax;
11917 }
11918 //----------------------------------------------------------------
11919 override float GetWetMin()
11920 {
11921 return m_VarWetMin;
11922 }
11923 //----------------------------------------------------------------
11924 override float GetWetInit()
11925 {
11926 return m_VarWetInit;
11927 }
11928 //----------------------------------------------------------------
11929 override void OnWetChanged(float newVal, float oldVal)
11930 {
11931 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11932 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11933 if (newLevel != oldLevel)
11934 {
11935 OnWetLevelChanged(newLevel,oldLevel);
11936 }
11937 }
11938
11939 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11940 {
11941 SetWeightDirty();
11942 }
11943
11944 override EWetnessLevel GetWetLevel()
11945 {
11946 return GetWetLevelInternal(m_VarWet);
11947 }
11948
11949 //----------------------------------------------------------------
11950
11951 override void SetStoreLoad(bool value)
11952 {
11953 m_IsStoreLoad = value;
11954 }
11955
11956 override bool IsStoreLoad()
11957 {
11958 return m_IsStoreLoad;
11959 }
11960
11961 override void SetStoreLoadedQuantity(float value)
11962 {
11963 m_StoreLoadedQuantity = value;
11964 }
11965
11966 override float GetStoreLoadedQuantity()
11967 {
11968 return m_StoreLoadedQuantity;
11969 }
11970
11971 //----------------------------------------------------------------
11972
11973 float GetItemModelLength()
11974 {
11975 if (ConfigIsExisting("itemModelLength"))
11976 {
11977 return ConfigGetFloat("itemModelLength");
11978 }
11979 return 0;
11980 }
11981
11982 float GetItemAttachOffset()
11983 {
11984 if (ConfigIsExisting("itemAttachOffset"))
11985 {
11986 return ConfigGetFloat("itemAttachOffset");
11987 }
11988 return 0;
11989 }
11990
11991 override void SetCleanness(int value, bool allow_client = false)
11992 {
11993 if (!IsServerCheck(allow_client))
11994 return;
11995
11996 int previousValue = m_Cleanness;
11997
11998 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
11999
12000 if (previousValue != m_Cleanness)
12001 SetVariableMask(VARIABLE_CLEANNESS);
12002 }
12003
12004 override int GetCleanness()
12005 {
12006 return m_Cleanness;
12007 }
12008
12010 {
12011 return true;
12012 }
12013
12014 //----------------------------------------------------------------
12015 // ATTACHMENT LOCKING
12016 // Getters relevant to generic ActionLockAttachment
12017 int GetLockType()
12018 {
12019 return m_LockType;
12020 }
12021
12022 string GetLockSoundSet()
12023 {
12024 return m_LockSoundSet;
12025 }
12026
12027 //----------------------------------------------------------------
12028 //------------------------- Color
12029 // sets items color variable given color components
12030 override void SetColor(int r, int g, int b, int a)
12031 {
12036 SetVariableMask(VARIABLE_COLOR);
12037 }
12039 override void GetColor(out int r,out int g,out int b,out int a)
12040 {
12045 }
12046
12047 bool IsColorSet()
12048 {
12049 return IsVariableSet(VARIABLE_COLOR);
12050 }
12051
12053 string GetColorString()
12054 {
12055 int r,g,b,a;
12056 GetColor(r,g,b,a);
12057 r = r/255;
12058 g = g/255;
12059 b = b/255;
12060 a = a/255;
12061 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12062 }
12063 //----------------------------------------------------------------
12064 //------------------------- LiquidType
12065
12066 override void SetLiquidType(int value, bool allow_client = false)
12067 {
12068 if (!IsServerCheck(allow_client))
12069 return;
12070
12071 int old = m_VarLiquidType;
12072 m_VarLiquidType = value;
12073 OnLiquidTypeChanged(old,value);
12074 SetVariableMask(VARIABLE_LIQUIDTYPE);
12075 }
12076
12077 int GetLiquidTypeInit()
12078 {
12079 return ConfigGetInt("varLiquidTypeInit");
12080 }
12081
12082 override int GetLiquidType()
12083 {
12084 return m_VarLiquidType;
12085 }
12086
12087 protected void OnLiquidTypeChanged(int oldType, int newType)
12088 {
12089 if (newType == LIQUID_NONE && GetIsFrozen())
12090 SetFrozen(false);
12091 }
12092
12094 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12095 {
12096 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12097 }
12098
12099 // -------------------------------------------------------------------------
12101 void OnInventoryEnter(Man player)
12102 {
12103 PlayerBase nplayer;
12104 if (PlayerBase.CastTo(nplayer, player))
12105 {
12106 m_CanPlayImpactSound = true;
12107 //nplayer.OnItemInventoryEnter(this);
12108 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12109 }
12110 }
12111
12112 // -------------------------------------------------------------------------
12114 void OnInventoryExit(Man player)
12115 {
12116 PlayerBase nplayer;
12117 if (PlayerBase.CastTo(nplayer,player))
12118 {
12119 //nplayer.OnItemInventoryExit(this);
12120 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12121
12122 }
12123
12124 //if (!GetGame().IsDedicatedServer())
12125 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12126
12127
12128 if (HasEnergyManager())
12129 {
12130 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12131 }
12132 }
12133
12134 // ADVANCED PLACEMENT EVENTS
12135 override void OnPlacementStarted(Man player)
12136 {
12137 super.OnPlacementStarted(player);
12138
12139 SetTakeable(false);
12140 }
12141
12142 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12143 {
12144 if (m_AdminLog)
12145 {
12146 m_AdminLog.OnPlacementComplete(player, this);
12147 }
12148
12149 super.OnPlacementComplete(player, position, orientation);
12150 }
12151
12152 //-----------------------------
12153 // AGENT SYSTEM
12154 //-----------------------------
12155 //--------------------------------------------------------------------------
12156 bool ContainsAgent(int agent_id)
12157 {
12158 if (agent_id & m_AttachedAgents)
12159 {
12160 return true;
12161 }
12162 else
12163 {
12164 return false;
12165 }
12166 }
12167
12168 //--------------------------------------------------------------------------
12169 override void RemoveAgent(int agent_id)
12170 {
12171 if (ContainsAgent(agent_id))
12172 {
12173 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12174 }
12175 }
12176
12177 //--------------------------------------------------------------------------
12178 override void RemoveAllAgents()
12179 {
12180 m_AttachedAgents = 0;
12181 }
12182 //--------------------------------------------------------------------------
12183 override void RemoveAllAgentsExcept(int agent_to_keep)
12184 {
12185 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12186 }
12187 // -------------------------------------------------------------------------
12188 override void InsertAgent(int agent, float count = 1)
12189 {
12190 if (count < 1)
12191 return;
12192 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12194 }
12195
12197 void TransferAgents(int agents)
12198 {
12200 }
12201
12202 // -------------------------------------------------------------------------
12203 override int GetAgents()
12204 {
12205 return m_AttachedAgents;
12206 }
12207 //----------------------------------------------------------------------
12208
12209 /*int GetContaminationType()
12210 {
12211 int contamination_type;
12212
12213 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12214 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12215 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12216 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12217
12218 Edible_Base edible = Edible_Base.Cast(this);
12219 int agents = GetAgents();
12220 if (edible)
12221 {
12222 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12223 if (profile)
12224 {
12225 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12226 }
12227 }
12228 if (agents & CONTAMINATED_MASK)
12229 {
12230 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12231 }
12232 if (agents & POISONED_MASK)
12233 {
12234 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12235 }
12236 if (agents & NERVE_GAS_MASK)
12237 {
12238 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12239 }
12240 if (agents & DIRTY_MASK)
12241 {
12242 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12243 }
12244
12245 return agents;
12246 }*/
12247
12248 // -------------------------------------------------------------------------
12249 bool LoadAgents(ParamsReadContext ctx, int version)
12250 {
12251 if (!ctx.Read(m_AttachedAgents))
12252 return false;
12253 return true;
12254 }
12255 // -------------------------------------------------------------------------
12257 {
12258
12260 }
12261 // -------------------------------------------------------------------------
12262
12264 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12265 {
12266 super.CheckForRoofLimited(timeTresholdMS);
12267
12268 float time = GetGame().GetTime();
12269 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12270 {
12271 m_PreviousRoofTestTime = time;
12272 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12273 }
12274 }
12275
12276 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12277 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12278 {
12279 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12280 {
12281 return 0;
12282 }
12283
12284 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12285 {
12286 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12287 if (filter)
12288 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12289 else
12290 return 0;//otherwise return 0 when no filter attached
12291 }
12292
12293 string subclassPath, entryName;
12294
12295 switch (type)
12296 {
12297 case DEF_BIOLOGICAL:
12298 entryName = "biological";
12299 break;
12300 case DEF_CHEMICAL:
12301 entryName = "chemical";
12302 break;
12303 default:
12304 entryName = "biological";
12305 break;
12306 }
12307
12308 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12309
12310 return GetGame().ConfigGetFloat(subclassPath + entryName);
12311 }
12312
12313
12314
12316 override void EEOnCECreate()
12317 {
12318 if (!IsMagazine())
12320
12322 }
12323
12324
12325 //-------------------------
12326 // OPEN/CLOSE USER ACTIONS
12327 //-------------------------
12329 void Open();
12330 void Close();
12331 bool IsOpen()
12332 {
12333 return true;
12334 }
12335
12336 override bool CanDisplayCargo()
12337 {
12338 return IsOpen();
12339 }
12340
12341
12342 // ------------------------------------------------------------
12343 // CONDITIONS
12344 // ------------------------------------------------------------
12345 override bool CanPutInCargo(EntityAI parent)
12346 {
12347 if (parent)
12348 {
12349 if (parent.IsInherited(DayZInfected))
12350 return true;
12351
12352 if (!parent.IsRuined())
12353 return true;
12354 }
12355
12356 return true;
12357 }
12358
12359 override bool CanPutAsAttachment(EntityAI parent)
12360 {
12361 if (!super.CanPutAsAttachment(parent))
12362 {
12363 return false;
12364 }
12365
12366 if (!IsRuined() && !parent.IsRuined())
12367 {
12368 return true;
12369 }
12370
12371 return false;
12372 }
12373
12374 override bool CanReceiveItemIntoCargo(EntityAI item)
12375 {
12376 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12377 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12378 // return false;
12379
12380 return super.CanReceiveItemIntoCargo(item);
12381 }
12382
12383 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12384 {
12385 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12386 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12387 // return false;
12388
12389 GameInventory attachmentInv = attachment.GetInventory();
12390 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12391 {
12392 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12393 return false;
12394 }
12395
12396 InventoryLocation loc = new InventoryLocation();
12397 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12398 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12399 return false;
12400
12401 return super.CanReceiveAttachment(attachment, slotId);
12402 }
12403
12404 override bool CanReleaseAttachment(EntityAI attachment)
12405 {
12406 if (!super.CanReleaseAttachment(attachment))
12407 return false;
12408
12409 return GetInventory().AreChildrenAccessible();
12410 }
12411
12412 /*override bool CanLoadAttachment(EntityAI attachment)
12413 {
12414 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12415 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12416 // return false;
12417
12418 GameInventory attachmentInv = attachment.GetInventory();
12419 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12420 {
12421 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12422 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12423
12424 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12425 return false;
12426 }
12427
12428 return super.CanLoadAttachment(attachment);
12429 }*/
12430
12431 // Plays muzzle flash particle effects
12432 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12433 {
12434 int id = muzzle_owner.GetMuzzleID();
12435 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12436
12437 if (WPOF_array)
12438 {
12439 for (int i = 0; i < WPOF_array.Count(); i++)
12440 {
12441 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12442
12443 if (WPOF)
12444 {
12445 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12446 }
12447 }
12448 }
12449 }
12450
12451 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12452 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12453 {
12454 int id = muzzle_owner.GetMuzzleID();
12455 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12456
12457 if (WPOBE_array)
12458 {
12459 for (int i = 0; i < WPOBE_array.Count(); i++)
12460 {
12461 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12462
12463 if (WPOBE)
12464 {
12465 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12466 }
12467 }
12468 }
12469 }
12470
12471 // Plays all weapon overheating particles
12472 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12473 {
12474 int id = muzzle_owner.GetMuzzleID();
12475 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12476
12477 if (WPOOH_array)
12478 {
12479 for (int i = 0; i < WPOOH_array.Count(); i++)
12480 {
12481 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12482
12483 if (WPOOH)
12484 {
12485 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12486 }
12487 }
12488 }
12489 }
12490
12491 // Updates all weapon overheating particles
12492 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12493 {
12494 int id = muzzle_owner.GetMuzzleID();
12495 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12496
12497 if (WPOOH_array)
12498 {
12499 for (int i = 0; i < WPOOH_array.Count(); i++)
12500 {
12501 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12502
12503 if (WPOOH)
12504 {
12505 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12506 }
12507 }
12508 }
12509 }
12510
12511 // Stops overheating particles
12512 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12513 {
12514 int id = muzzle_owner.GetMuzzleID();
12515 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12516
12517 if (WPOOH_array)
12518 {
12519 for (int i = 0; i < WPOOH_array.Count(); i++)
12520 {
12521 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12522
12523 if (WPOOH)
12524 {
12525 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12526 }
12527 }
12528 }
12529 }
12530
12531 //----------------------------------------------------------------
12532 //Item Behaviour - unified approach
12533 override bool IsHeavyBehaviour()
12534 {
12535 if (m_ItemBehaviour == 0)
12536 {
12537 return true;
12538 }
12539
12540 return false;
12541 }
12542
12543 override bool IsOneHandedBehaviour()
12544 {
12545 if (m_ItemBehaviour == 1)
12546 {
12547 return true;
12548 }
12549
12550 return false;
12551 }
12552
12553 override bool IsTwoHandedBehaviour()
12554 {
12555 if (m_ItemBehaviour == 2)
12556 {
12557 return true;
12558 }
12559
12560 return false;
12561 }
12562
12563 bool IsDeployable()
12564 {
12565 return false;
12566 }
12567
12569 float GetDeployTime()
12570 {
12571 return UATimeSpent.DEFAULT_DEPLOY;
12572 }
12573
12574
12575 //----------------------------------------------------------------
12576 // Item Targeting (User Actions)
12577 override void SetTakeable(bool pState)
12578 {
12579 m_IsTakeable = pState;
12580 SetSynchDirty();
12581 }
12582
12583 override bool IsTakeable()
12584 {
12585 return m_IsTakeable;
12586 }
12587
12588 // For cases where we want to show object widget which cant be taken to hands
12590 {
12591 return false;
12592 }
12593
12595 protected void PreLoadSoundAttachmentType()
12596 {
12597 string att_type = "None";
12598
12599 if (ConfigIsExisting("soundAttType"))
12600 {
12601 att_type = ConfigGetString("soundAttType");
12602 }
12603
12604 m_SoundAttType = att_type;
12605 }
12606
12607 override string GetAttachmentSoundType()
12608 {
12609 return m_SoundAttType;
12610 }
12611
12612 //----------------------------------------------------------------
12613 //SOUNDS - ItemSoundHandler
12614 //----------------------------------------------------------------
12615
12616 string GetPlaceSoundset(); // played when deploy starts
12617 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12618 string GetDeploySoundset(); // played when deploy sucessfully finishes
12619
12621 {
12622 if (!m_ItemSoundHandler)
12624
12625 return m_ItemSoundHandler;
12626 }
12627
12628 // override to initialize sounds
12629 protected void InitItemSounds()
12630 {
12631 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12632 return;
12633
12635
12636 if (GetPlaceSoundset() != string.Empty)
12637 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12638
12639 if (GetDeploySoundset() != string.Empty)
12640 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12641
12642 SoundParameters params = new SoundParameters();
12643 params.m_Loop = true;
12644 if (GetLoopDeploySoundset() != string.Empty)
12645 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12646 }
12647
12648 // Start sound using ItemSoundHandler
12649 void StartItemSoundServer(int id)
12650 {
12651 if (!GetGame().IsServer())
12652 return;
12653
12654 m_SoundSyncPlay = id;
12655 SetSynchDirty();
12656
12657 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12659 }
12660
12661 // Stop sound using ItemSoundHandler
12662 void StopItemSoundServer(int id)
12663 {
12664 if (!GetGame().IsServer())
12665 return;
12666
12667 m_SoundSyncStop = id;
12668 SetSynchDirty();
12669
12670 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12672 }
12673
12674 protected void ClearStartItemSoundServer()
12675 {
12676 m_SoundSyncPlay = 0;
12677 }
12678
12679 protected void ClearStopItemSoundServer()
12680 {
12681 m_SoundSyncStop = 0;
12682 }
12683
12685 void PlayAttachSound(string slot_type)
12686 {
12687 if (!GetGame().IsDedicatedServer())
12688 {
12689 if (ConfigIsExisting("attachSoundSet"))
12690 {
12691 string cfg_path = "";
12692 string soundset = "";
12693 string type_name = GetType();
12694
12695 TStringArray cfg_soundset_array = new TStringArray;
12696 TStringArray cfg_slot_array = new TStringArray;
12697 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12698 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12699
12700 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12701 {
12702 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12703 {
12704 if (cfg_slot_array[i] == slot_type)
12705 {
12706 soundset = cfg_soundset_array[i];
12707 break;
12708 }
12709 }
12710 }
12711
12712 if (soundset != "")
12713 {
12714 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12715 sound.SetAutodestroy(true);
12716 }
12717 }
12718 }
12719 }
12720
12721 void PlayDetachSound(string slot_type)
12722 {
12723 //TODO - evaluate if needed and devise universal config structure if so
12724 }
12725
12726 void OnApply(PlayerBase player);
12727
12729 {
12730 return 1.0;
12731 };
12732 //returns applicable selection
12733 array<string> GetHeadHidingSelection()
12734 {
12736 }
12737
12739 {
12741 }
12742
12743 WrittenNoteData GetWrittenNoteData() {};
12744
12746 {
12747 SetDynamicPhysicsLifeTime(0.01);
12748 m_ItemBeingDroppedPhys = false;
12749 }
12750
12752 {
12753 array<string> zone_names = new array<string>;
12754 GetDamageZones(zone_names);
12755 for (int i = 0; i < zone_names.Count(); i++)
12756 {
12757 SetHealthMax(zone_names.Get(i),"Health");
12758 }
12759 SetHealthMax("","Health");
12760 }
12761
12763 void SetZoneDamageCEInit()
12764 {
12765 float global_health = GetHealth01("","Health");
12766 array<string> zones = new array<string>;
12767 GetDamageZones(zones);
12768 //set damage of all zones to match global health level
12769 for (int i = 0; i < zones.Count(); i++)
12770 {
12771 SetHealth01(zones.Get(i),"Health",global_health);
12772 }
12773 }
12774
12776 bool IsCoverFaceForShave(string slot_name)
12777 {
12778 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12779 }
12780
12781 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12782 {
12783 if (!hasRootAsPlayer)
12784 {
12785 if (refParentIB)
12786 {
12787 // parent is wet
12788 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12789 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12790 // parent has liquid inside
12791 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12792 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12793 // drying
12794 else if (m_VarWet > m_VarWetMin)
12795 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12796 }
12797 else
12798 {
12799 // drying on ground or inside non-itembase (car, ...)
12800 if (m_VarWet > m_VarWetMin)
12801 AddWet(-1 * delta * GetDryingIncrement("ground"));
12802 }
12803 }
12804 }
12805
12806 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12807 {
12809 {
12810 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12811 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12812 {
12813 float heatPermCoef = 1.0;
12814 EntityAI ent = this;
12815 while (ent)
12816 {
12817 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12818 ent = ent.GetHierarchyParent();
12819 }
12820
12821 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12822 }
12823 }
12824 }
12825
12826 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12827 {
12828 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12829 EntityAI parent = GetHierarchyParent();
12830 if (!parent)
12831 {
12832 hasParent = false;
12833 hasRootAsPlayer = false;
12834 }
12835 else
12836 {
12837 hasParent = true;
12838 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12839 refParentIB = ItemBase.Cast(parent);
12840 }
12841 }
12842
12843 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12844 {
12845 // this is stub, implemented on Edible_Base
12846 }
12847
12848 bool CanDecay()
12849 {
12850 // return true used on selected food clases so they can decay
12851 return false;
12852 }
12853
12854 protected bool CanProcessDecay()
12855 {
12856 // this is stub, implemented on Edible_Base class
12857 // used to determine whether it is still necessary for the food to decay
12858 return false;
12859 }
12860
12861 protected bool CanHaveWetness()
12862 {
12863 // return true used on selected items that have a wetness effect
12864 return false;
12865 }
12866
12868 bool CanBeConsumed(ConsumeConditionData data = null)
12869 {
12870 return !GetIsFrozen() && IsOpen();
12871 }
12872
12873 override void ProcessVariables()
12874 {
12875 bool hasParent = false, hasRootAsPlayer = false;
12876 ItemBase refParentIB;
12877
12878 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12879 bool foodDecay = g_Game.IsFoodDecayEnabled();
12880
12881 if (wwtu || foodDecay)
12882 {
12883 bool processWetness = wwtu && CanHaveWetness();
12884 bool processTemperature = wwtu && CanHaveTemperature();
12885 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12886
12887 if (processWetness || processTemperature || processDecay)
12888 {
12889 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12890
12891 if (processWetness)
12892 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12893
12894 if (processTemperature)
12895 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12896
12897 if (processDecay)
12898 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12899 }
12900 }
12901 }
12902
12905 {
12906 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12907 }
12908
12909 override float GetTemperatureFreezeThreshold()
12910 {
12912 return Liquid.GetFreezeThreshold(GetLiquidType());
12913
12914 return super.GetTemperatureFreezeThreshold();
12915 }
12916
12917 override float GetTemperatureThawThreshold()
12918 {
12920 return Liquid.GetThawThreshold(GetLiquidType());
12921
12922 return super.GetTemperatureThawThreshold();
12923 }
12924
12925 override float GetItemOverheatThreshold()
12926 {
12928 return Liquid.GetBoilThreshold(GetLiquidType());
12929
12930 return super.GetItemOverheatThreshold();
12931 }
12932
12933 override float GetTemperatureFreezeTime()
12934 {
12935 if (HasQuantity())
12936 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12937
12938 return super.GetTemperatureFreezeTime();
12939 }
12940
12941 override float GetTemperatureThawTime()
12942 {
12943 if (HasQuantity())
12944 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12945
12946 return super.GetTemperatureThawTime();
12947 }
12948
12950 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12952 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12953
12954 bool IsCargoException4x3(EntityAI item)
12955 {
12956 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12957 }
12958
12960 {
12961 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12962 }
12963
12965 void AddLightSourceItem(ItemBase lightsource)
12966 {
12967 m_LightSourceItem = lightsource;
12968 }
12969
12971 {
12972 m_LightSourceItem = null;
12973 }
12974
12976 {
12977 return m_LightSourceItem;
12978 }
12979
12981 array<int> GetValidFinishers()
12982 {
12983 return null;
12984 }
12985
12987 bool GetActionWidgetOverride(out typename name)
12988 {
12989 return false;
12990 }
12991
12992 bool PairWithDevice(notnull ItemBase otherDevice)
12993 {
12994 if (GetGame().IsServer())
12995 {
12996 ItemBase explosive = otherDevice;
12998 if (!trg)
12999 {
13000 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13001 explosive = this;
13002 }
13003
13004 explosive.PairRemote(trg);
13005 trg.SetControlledDevice(explosive);
13006
13007 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13008 trg.SetPersistentPairID(persistentID);
13009 explosive.SetPersistentPairID(persistentID);
13010
13011 return true;
13012 }
13013 return false;
13014 }
13015
13017 float GetBaitEffectivity()
13018 {
13019 float ret = 1.0;
13020 if (HasQuantity())
13021 ret *= GetQuantityNormalized();
13022 ret *= GetHealth01();
13023
13024 return ret;
13025 }
13026
13027 #ifdef DEVELOPER
13028 override void SetDebugItem()
13029 {
13030 super.SetDebugItem();
13031 _itemBase = this;
13032 }
13033
13034 override string GetDebugText()
13035 {
13036 string text = super.GetDebugText();
13037
13038 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13039 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13040
13041 return text;
13042 }
13043 #endif
13044
13045 bool CanBeUsedForSuicide()
13046 {
13047 return true;
13048 }
13049
13051 //DEPRECATED BELOW
13053 // Backwards compatibility
13054 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13055 {
13056 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13057 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13058 }
13059
13060 // replaced by ItemSoundHandler
13061 protected EffectSound m_SoundDeployFinish;
13062 protected EffectSound m_SoundPlace;
13063 protected EffectSound m_DeployLoopSoundEx;
13064 protected EffectSound m_SoundDeploy;
13065 bool m_IsPlaceSound;
13066 bool m_IsDeploySound;
13068
13069 string GetDeployFinishSoundset();
13070 void PlayDeploySound();
13071 void PlayDeployFinishSound();
13072 void PlayPlaceSound();
13073 void PlayDeployLoopSoundEx();
13074 void StopDeployLoopSoundEx();
13075 void SoundSynchRemoteReset();
13076 void SoundSynchRemote();
13077 bool UsesGlobalDeploy(){return false;}
13078 bool CanPlayDeployLoopSound(){return false;}
13080 bool IsPlaceSound(){return m_IsPlaceSound;}
13081 bool IsDeploySound(){return m_IsDeploySound;}
13082 void SetIsPlaceSound(bool is_place_sound);
13083 void SetIsDeploySound(bool is_deploy_sound);
13084}
13085
13086EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13087{
13088 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13089 if (entity)
13090 {
13091 bool is_item = entity.IsInherited(ItemBase);
13092 if (is_item && full_quantity)
13093 {
13094 ItemBase item = ItemBase.Cast(entity);
13095 item.SetQuantity(item.GetQuantityInit());
13096 }
13097 }
13098 else
13099 {
13100 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13101 return NULL;
13102 }
13103 return entity;
13104}
13105
13106void SetupSpawnedItem(ItemBase item, float health, float quantity)
13107{
13108 if (item)
13109 {
13110 if (health > 0)
13111 item.SetHealth("", "", health);
13112
13113 if (item.CanHaveTemperature())
13114 {
13115 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13116 if (item.CanFreeze())
13117 item.SetFrozen(false);
13118 }
13119
13120 if (item.HasEnergyManager())
13121 {
13122 if (quantity >= 0)
13123 {
13124 item.GetCompEM().SetEnergy0To1(quantity);
13125 }
13126 else
13127 {
13128 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13129 }
13130 }
13131 else if (item.IsMagazine())
13132 {
13133 Magazine mag = Magazine.Cast(item);
13134 if (quantity >= 0)
13135 {
13136 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13137 }
13138 else
13139 {
13140 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13141 }
13142
13143 }
13144 else
13145 {
13146 if (quantity >= 0)
13147 {
13148 item.SetQuantityNormalized(quantity, false);
13149 }
13150 else
13151 {
13152 item.SetQuantity(Math.AbsFloat(quantity));
13153 }
13154
13155 }
13156 }
13157}
13158
13159#ifdef DEVELOPER
13160ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13161#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()

Используется в InventoryItem::OnEnergyAdded() и InventoryItem::OnEnergyConsumed().