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

◆ GetQuantityInit()

int SpawnItemOnLocation::GetQuantityInit ( )
private

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

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