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

◆ SetQuantityMax()

void SpawnItemOnLocation::SetQuantityMax ( )
private

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

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

Используется в InventoryItem::OnAction(), Barrel_ColorBase::OnDebugSpawn() и OnDebugSpawn().