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

◆ OnStoreSave()

override void SpawnItemOnLocation::OnStoreSave ( ParamsWriteContext ctx)
private

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

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