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

◆ GetQuantityMax()

override int SpawnItemOnLocation::GetQuantityMax ( )
private

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

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

Используется в Bottle_Base::AffectLiquidContainerOnFill(), FilteringBottle::AffectLiquidContainerOnFill(), Bottle_Base::AffectLiquidContainerOnTransfer(), FilteringBottle::AffectLiquidContainerOnTransfer(), CalcAndSetQuantity(), InventoryItem::CanBeCombined(), Capture(), InventoryItem::ComputeQuantityUsedEx(), DisinfectantAlcohol::GetDisinfectQuantity(), DisinfectantSpray::GetDisinfectQuantity(), IodineTincture::GetDisinfectQuantity(), Mask_Base::GetFilterQuantity01(), Mask_Base::GetFilterQuantityMax(), InventoryItem::GetQuantityNormalized(), InventoryItem::HasQuantity(), InventoryItem::IsFullQuantity(), InventoryItem::OnAction(), InventoryItem::SetQuantity(), InventoryItem::SetQuantityMax(), InventoryItem::SetQuantityNormalized(), BroomBase::UpdateParticle() и ItemBase::UpdateSelections().