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

◆ CanBeDisinfected()

bool SpawnItemOnLocation::CanBeDisinfected ( )
private

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

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