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

◆ SetQuantityToMinimum()

override void SpawnItemOnLocation::SetQuantityToMinimum ( )
private

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

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