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

◆ AfterStoreLoad()

override void SpawnItemOnLocation::AfterStoreLoad ( )
private

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

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