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

◆ SetQuantity()

override bool SpawnItemOnLocation::SetQuantity ( float value,
bool destroy_config = true,
bool destroy_forced = false,
bool allow_client = false,
bool clamp_to_stack_max = true )
private

Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity reaches varQuantityMin or lower and the item config contains the varQuantityDestroyOnMin = true entry, the item gets destroyed. destroy_forced = true means item gets destroyed when quantity reaches varQuantityMin or lower regardless of config setting, returns true if the item gets deleted.

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

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

Используется в CalcAndSetQuantity(), Capture(), MaskBase::EEHealthLevelChanged() и Release().