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

◆ EEOnAfterLoad()

override void SpawnItemOnLocation::EEOnAfterLoad ( )
private

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

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