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

◆ OnVariablesSynchronized()

override void SpawnItemOnLocation::OnVariablesSynchronized ( )
private

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

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