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

◆ CanBeDisinfected()

bool SpawnItemOnLocation::CanBeDisinfected ( )
protected

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

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