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

◆ GetRecipesActions()

void SpawnItemOnLocation::GetRecipesActions ( Man player,
out TSelectableActionInfoArray outputList )
protected

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

7160{
7161 override bool CanPutAsAttachment(EntityAI parent)
7162 {
7163 return true;
7164 }
7165};
7166
7167//const bool QUANTITY_DEBUG_REMOVE_ME = false;
7168
7169class ItemBase extends InventoryItem
7170{
7174
7176
7177 static int m_DebugActionsMask;
7179 // ============================================
7180 // Variable Manipulation System
7181 // ============================================
7182 // Quantity
7183
7184 float m_VarQuantity;
7185 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
7187 int m_VarQuantityMin;
7188 int m_VarQuantityMax;
7189 int m_Count;
7190 float m_VarStackMax;
7191 float m_StoreLoadedQuantity = float.LOWEST;
7192 // Wet
7193 float m_VarWet;
7194 float m_VarWetPrev;//for client to know wetness changed during synchronization
7195 float m_VarWetInit;
7196 float m_VarWetMin;
7197 float m_VarWetMax;
7198 // Cleanness
7199 int m_Cleanness;
7200 int m_CleannessInit;
7201 int m_CleannessMin;
7202 int m_CleannessMax;
7203 // impact sounds
7205 bool m_CanPlayImpactSound = true;
7206 float m_ImpactSpeed;
7208 //
7209 float m_HeatIsolation;
7210 float m_ItemModelLength;
7211 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
7213 int m_VarLiquidType;
7214 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
7215 int m_QuickBarBonus;
7216 bool m_IsBeingPlaced;
7217 bool m_IsHologram;
7218 bool m_IsTakeable;
7219 bool m_ThrowItemOnDrop;
7222 bool m_FixDamageSystemInit = false; //can be changed on storage version check
7223 bool can_this_be_combined; //Check if item can be combined
7224 bool m_CanThisBeSplit; //Check if item can be split
7225 bool m_IsStoreLoad = false;
7226 bool m_CanShowQuantity;
7227 bool m_HasQuantityBar;
7228 protected bool m_CanBeDigged;
7229 protected bool m_IsResultOfSplit
7230
7231 string m_SoundAttType;
7232 // items color variables
7237 //-------------------------------------------------------
7238
7239 // light source managing
7241
7245
7246 //==============================================
7247 // agent system
7248 private int m_AttachedAgents;
7249
7251 void TransferModifiers(PlayerBase reciever);
7252
7253
7254 // Weapons & suppressors particle effects
7259 static int m_LastRegisteredWeaponID = 0;
7260
7261 // Overheating effects
7263 float m_OverheatingShots;
7264 ref Timer m_CheckOverheating;
7265 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
7266 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
7267 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
7268 ref array <ref OverheatingParticle> m_OverheatingParticles;
7269
7271 protected bool m_HideSelectionsBySlot;
7272
7273 // Admin Log
7274 PluginAdminLog m_AdminLog;
7275
7276 // misc
7277 ref Timer m_PhysDropTimer;
7278
7279 // Attachment Locking variables
7280 ref array<int> m_CompatibleLocks;
7281 protected int m_LockType;
7282 protected ref EffectSound m_LockingSound;
7283 protected string m_LockSoundSet;
7284
7285 // ItemSoundHandler
7286 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
7287 protected int m_SoundSyncPlay; // id for sound to play
7288 protected int m_SoundSyncStop; // id for sound to stop
7290
7291 //temperature
7292 private float m_TemperaturePerQuantityWeight;
7293
7294 // -------------------------------------------------------------------------
7295 void ItemBase()
7296 {
7297 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
7301
7302 if (!GetGame().IsDedicatedServer())
7303 {
7304 if (HasMuzzle())
7305 {
7307
7309 {
7311 }
7312 }
7313
7315 m_ActionsInitialize = false;
7316 }
7317
7318 m_OldLocation = null;
7319
7320 if (GetGame().IsServer())
7321 {
7322 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
7323 }
7324
7325 if (ConfigIsExisting("headSelectionsToHide"))
7326 {
7328 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
7329 }
7330
7331 m_HideSelectionsBySlot = false;
7332 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7333 {
7334 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
7335 }
7336
7337 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
7338
7339 m_IsResultOfSplit = false;
7340
7342 }
7343
7344 override void InitItemVariables()
7345 {
7346 super.InitItemVariables();
7347
7348 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
7349 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
7350 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
7351 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
7352 m_VarStackMax = ConfigGetFloat("varStackMax");
7353 m_Count = ConfigGetInt("count");
7354
7355 m_CanShowQuantity = ConfigGetBool("quantityShow");
7356 m_HasQuantityBar = ConfigGetBool("quantityBar");
7357
7358 m_CleannessInit = ConfigGetInt("varCleannessInit");
7360 m_CleannessMin = ConfigGetInt("varCleannessMin");
7361 m_CleannessMax = ConfigGetInt("varCleannessMax");
7362
7363 m_WantPlayImpactSound = false;
7364 m_ImpactSpeed = 0.0;
7365
7366 m_VarWetInit = ConfigGetFloat("varWetInit");
7368 m_VarWetMin = ConfigGetFloat("varWetMin");
7369 m_VarWetMax = ConfigGetFloat("varWetMax");
7370
7371 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
7372 if (IsLiquidContainer() && GetQuantity() != 0)
7374 m_IsBeingPlaced = false;
7375 m_IsHologram = false;
7376 m_IsTakeable = true;
7377 m_CanBeMovedOverride = false;
7381 m_CanBeDigged = ConfigGetBool("canBeDigged");
7382
7383 m_CompatibleLocks = new array<int>();
7384 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
7385 m_LockType = ConfigGetInt("lockType");
7386
7387 //Define if item can be split and set ability to be combined accordingly
7388 m_CanThisBeSplit = false;
7389 can_this_be_combined = false;
7390 if (ConfigIsExisting("canBeSplit"))
7391 {
7392 can_this_be_combined = ConfigGetBool("canBeSplit");
7394 }
7395
7396 m_ItemBehaviour = -1;
7397 if (ConfigIsExisting("itemBehaviour"))
7398 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
7399
7400 //RegisterNetSyncVariableInt("m_VariablesMask");
7401 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7402 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
7403 RegisterNetSyncVariableInt("m_VarLiquidType");
7404 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7405
7406 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7407 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7408 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7409
7410 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7411 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7412 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7413 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7414
7415 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7416 RegisterNetSyncVariableBool("m_IsTakeable");
7417 RegisterNetSyncVariableBool("m_IsHologram");
7418
7419 InitItemSounds();
7421 {
7422 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
7423 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
7424 }
7425
7426 m_LockSoundSet = ConfigGetString("lockSoundSet");
7427
7429 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7430 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
7431
7432 }
7433
7434 override int GetQuickBarBonus()
7435 {
7436 return m_QuickBarBonus;
7437 }
7438
7439 void InitializeActions()
7440 {
7442 if (!m_InputActionMap)
7443 {
7445 m_InputActionMap = iam;
7446 SetActions();
7448 }
7449 }
7450
7451 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
7452 {
7454 {
7455 m_ActionsInitialize = true;
7457 }
7458
7459 actions = m_InputActionMap.Get(action_input_type);
7460 }
7461
7462 void SetActions()
7463 {
7464 AddAction(ActionTakeItem);
7465 AddAction(ActionTakeItemToHands);
7466 AddAction(ActionWorldCraft);
7468 AddAction(ActionAttachWithSwitch);
7469 }
7470
7471 void SetActionAnimOverrides(); // Override action animation for specific item
7472
7473 void AddAction(typename actionName)
7474 {
7475 ActionBase action = ActionManagerBase.GetAction(actionName);
7476
7477 if (!action)
7478 {
7479 Debug.LogError("Action " + actionName + " dosn't exist!");
7480 return;
7481 }
7482
7483 typename ai = action.GetInputType();
7484 if (!ai)
7485 {
7486 m_ActionsInitialize = false;
7487 return;
7488 }
7489
7490 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7491 if (!action_array)
7492 {
7493 action_array = new array<ActionBase_Basic>;
7494 m_InputActionMap.Insert(ai, action_array);
7495 }
7496 if (LogManager.IsActionLogEnable())
7497 {
7498 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
7499 }
7500
7501 if (action_array.Find(action) != -1)
7502 {
7503 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
7504 }
7505 else
7506 {
7507 action_array.Insert(action);
7508 }
7509 }
7510
7511 void RemoveAction(typename actionName)
7512 {
7513 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7514 ActionBase action = player.GetActionManager().GetAction(actionName);
7515 typename ai = action.GetInputType();
7516 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7517
7518 if (action_array)
7519 {
7520 action_array.RemoveItem(action);
7521 }
7522 }
7523
7524 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
7525 // Set -1 for params which should stay in default state
7526 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
7527 {
7528 ActionOverrideData overrideData = new ActionOverrideData();
7529 overrideData.m_CommandUID = commandUID;
7530 overrideData.m_CommandUIDProne = commandUIDProne;
7531 overrideData.m_StanceMask = stanceMask;
7532
7533 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
7534 if (!actionMap) // create new map of action > overidables map
7535 {
7536 actionMap = new TActionAnimOverrideMap();
7537 m_ItemActionOverrides.Insert(action, actionMap);
7538 }
7539
7540 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
7541
7542 }
7543
7544 void OnItemInHandsPlayerSwimStart(PlayerBase player);
7545
7546 ScriptedLightBase GetLight();
7547
7548 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7549 void LoadParticleConfigOnFire(int id)
7550 {
7551 if (!m_OnFireEffect)
7553
7556
7557 string config_to_search = "CfgVehicles";
7558 string muzzle_owner_config;
7559
7560 if (!m_OnFireEffect.Contains(id))
7561 {
7562 if (IsInherited(Weapon))
7563 config_to_search = "CfgWeapons";
7564
7565 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7566
7567 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7568
7569 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
7570
7571 if (config_OnFire_subclass_count > 0)
7572 {
7573 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7574
7575 for (int i = 0; i < config_OnFire_subclass_count; i++)
7576 {
7577 string particle_class = "";
7578 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
7579 string config_OnFire_entry = config_OnFire_class + particle_class;
7580 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7581 WPOF_array.Insert(WPOF);
7582 }
7583
7584
7585 m_OnFireEffect.Insert(id, WPOF_array);
7586 }
7587 }
7588
7589 if (!m_OnBulletCasingEjectEffect.Contains(id))
7590 {
7591 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
7592 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7593
7594 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7595
7596 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7597
7598 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7599 {
7600 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7601
7602 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7603 {
7604 string particle_class2 = "";
7605 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7606 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7607 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7608 WPOBE_array.Insert(WPOBE);
7609 }
7610
7611
7612 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
7613 }
7614 }
7615 }
7616
7617 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7619 {
7622
7623 if (!m_OnOverheatingEffect.Contains(id))
7624 {
7625 string config_to_search = "CfgVehicles";
7626
7627 if (IsInherited(Weapon))
7628 config_to_search = "CfgWeapons";
7629
7630 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
7631 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7632
7633 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
7634 {
7635
7636 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
7637
7639 {
7640 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
7641 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7642 Error(error);
7643 return;
7644 }
7645
7646 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
7647 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
7648
7649
7650
7651 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
7652 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7653
7654 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7655 {
7656 string particle_class = "";
7657 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7658 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7659 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
7660
7661 if (entry_type == CT_CLASS)
7662 {
7663 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7664 WPOOH_array.Insert(WPOF);
7665 }
7666 }
7667
7668
7669 m_OnOverheatingEffect.Insert(id, WPOOH_array);
7670 }
7671 }
7672 }
7673
7674 float GetOverheatingValue()
7675 {
7676 return m_OverheatingShots;
7677 }
7678
7679 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
7680 {
7681 if (m_MaxOverheatingValue > 0)
7682 {
7684
7685 if (!m_CheckOverheating)
7687
7689 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
7690
7691 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7692 }
7693 }
7694
7695 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7696 {
7698 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7699
7701 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7702
7704 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7705
7707 {
7709 }
7710 }
7711
7713 {
7715 }
7716
7717 void OnOverheatingDecay()
7718 {
7719 if (m_MaxOverheatingValue > 0)
7720 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
7721 else
7723
7724 if (m_OverheatingShots <= 0)
7725 {
7728 }
7729 else
7730 {
7731 if (!m_CheckOverheating)
7733
7735 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
7736 }
7737
7738 CheckOverheating(this, "", this);
7739 }
7740
7741 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7742 {
7744 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
7745 }
7746
7747 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7748 {
7750 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
7752 }
7753
7754 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7755 {
7757 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7758 }
7759
7760 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
7761 {
7763 m_OverheatingParticles = new array<ref OverheatingParticle>;
7764
7765 OverheatingParticle OP = new OverheatingParticle();
7766 OP.RegisterParticle(p);
7767 OP.SetOverheatingLimitMin(min_heat_coef);
7768 OP.SetOverheatingLimitMax(max_heat_coef);
7769 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
7770
7771 m_OverheatingParticles.Insert(OP);
7772 }
7773
7774 float GetOverheatingCoef()
7775 {
7776 if (m_MaxOverheatingValue > 0)
7778
7779 return -1;
7780 }
7781
7783 {
7785 {
7786 float overheat_coef = GetOverheatingCoef();
7787 int count = m_OverheatingParticles.Count();
7788
7789 for (int i = count; i > 0; --i)
7790 {
7791 int id = i - 1;
7792 OverheatingParticle OP = m_OverheatingParticles.Get(id);
7793 Particle p = OP.GetParticle();
7794
7795 float overheat_min = OP.GetOverheatingLimitMin();
7796 float overheat_max = OP.GetOverheatingLimitMax();
7797
7798 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7799 {
7800 if (p)
7801 {
7802 p.Stop();
7803 OP.RegisterParticle(null);
7804 }
7805 }
7806 }
7807 }
7808 }
7809
7811 {
7813 {
7814 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
7815 {
7816 int id = i - 1;
7817 OverheatingParticle OP = m_OverheatingParticles.Get(id);
7818
7819 if (OP)
7820 {
7821 Particle p = OP.GetParticle();
7822
7823 if (p)
7824 {
7825 p.Stop();
7826 }
7827
7828 delete OP;
7829 }
7830 }
7831
7832 m_OverheatingParticles.Clear();
7834 }
7835 }
7836
7838 float GetInfectionChance(int system = 0, Param param = null)
7839 {
7840 return 0.0;
7841 }
7842
7843
7844 float GetDisinfectQuantity(int system = 0, Param param1 = null)
7845 {
7846 return 250;//default value
7847 }
7848
7849 float GetFilterDamageRatio()
7850 {
7851 return 0;
7852 }
7853
7855 bool HasMuzzle()
7856 {
7857 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
7858 return true;
7859
7860 return false;
7861 }
7862
7864 int GetMuzzleID()
7865 {
7866 if (!m_WeaponTypeToID)
7868
7869 if (m_WeaponTypeToID.Contains(GetType()))
7870 {
7871 return m_WeaponTypeToID.Get(GetType());
7872 }
7873 else
7874 {
7875 // Register new weapon ID
7877 }
7878
7880 }
7881
7888 {
7889 return -1;
7890 }
7891
7892
7893
7894 // -------------------------------------------------------------------------
7895 void ~ItemBase()
7896 {
7897 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
7898 {
7899 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7900 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7901
7902 if (r_index >= 0)
7903 {
7904 InventoryLocation r_il = new InventoryLocation;
7905 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7906
7907 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7908 int r_type = r_il.GetType();
7909 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7910 {
7911 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7912 }
7913 else if (r_type == InventoryLocationType.ATTACHMENT)
7914 {
7915 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7916 }
7917
7918 }
7919
7920 player.GetHumanInventory().ClearUserReservedLocation(this);
7921 }
7922
7923 if (m_LockingSound)
7924 SEffectManager.DestroyEffect(m_LockingSound);
7925 }
7926
7927
7928
7929 // -------------------------------------------------------------------------
7930 static int GetDebugActionsMask()
7931 {
7932 return ItemBase.m_DebugActionsMask;
7933 }
7934
7935 static bool HasDebugActionsMask(int mask)
7936 {
7937 return ItemBase.m_DebugActionsMask & mask;
7938 }
7939
7940 static void SetDebugActionsMask(int mask)
7941 {
7942 ItemBase.m_DebugActionsMask = mask;
7943 }
7944
7945 static void AddDebugActionsMask(int mask)
7946 {
7947 ItemBase.m_DebugActionsMask |= mask;
7948 }
7949
7950 static void RemoveDebugActionsMask(int mask)
7951 {
7952 ItemBase.m_DebugActionsMask &= ~mask;
7953 }
7954
7955 static void ToggleDebugActionsMask(int mask)
7956 {
7957 if (HasDebugActionsMask(mask))
7958 {
7960 }
7961 else
7962 {
7963 AddDebugActionsMask(mask);
7964 }
7965 }
7966
7967 // -------------------------------------------------------------------------
7968 void SetCEBasedQuantity()
7969 {
7970 if (GetEconomyProfile())
7971 {
7972 float q_max = GetEconomyProfile().GetQuantityMax();
7973 if (q_max > 0)
7974 {
7975 float q_min = GetEconomyProfile().GetQuantityMin();
7976 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7977
7978 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
7979 {
7980 ComponentEnergyManager comp = GetCompEM();
7981 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
7982 {
7983 comp.SetEnergy0To1(quantity_randomized);
7984 }
7985 }
7986 else if (HasQuantity())
7987 {
7988 SetQuantityNormalized(quantity_randomized, false);
7989 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
7990 }
7991
7992 }
7993 }
7994 }
7995
7997 void LockToParent()
7998 {
7999 EntityAI parent = GetHierarchyParent();
8000
8001 if (parent)
8002 {
8003 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8004 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8005 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
8006 }
8007 }
8008
8010 void UnlockFromParent()
8011 {
8012 EntityAI parent = GetHierarchyParent();
8013
8014 if (parent)
8015 {
8016 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8017 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8018 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
8019 }
8020 }
8021
8022 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
8023 {
8024 /*
8025 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
8026 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
8027 */
8028 ItemBase item2 = ItemBase.Cast(entity2);
8029
8030 if (GetGame().IsClient())
8031 {
8032 if (ScriptInputUserData.CanStoreInputUserData())
8033 {
8034 ScriptInputUserData ctx = new ScriptInputUserData;
8036 ctx.Write(-1);
8037 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8038 ctx.Write(i1);
8039 ctx.Write(item2);
8040 ctx.Write(use_stack_max);
8041 ctx.Write(-1);
8042 ctx.Send();
8043
8044 if (IsCombineAll(item2, use_stack_max))
8045 {
8046 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8047 }
8048 }
8049 }
8050 else if (!GetGame().IsMultiplayer())
8051 {
8052 CombineItems(item2, use_stack_max);
8053 }
8054 }
8055
8056 bool IsLiquidPresent()
8057 {
8058 return (GetLiquidType() != 0 && HasQuantity());
8059 }
8060
8061 bool IsLiquidContainer()
8062 {
8063 return m_LiquidContainerMask != 0;
8064 }
8065
8067 {
8068 return m_LiquidContainerMask;
8069 }
8070
8071 bool IsBloodContainer()
8072 {
8073 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
8074 return false;
8075 }
8076
8077 bool IsNVG()
8078 {
8079 return false;
8080 }
8081
8084 bool IsExplosive()
8085 {
8086 return false;
8087 }
8088
8090 {
8091 return "";
8092 }
8093
8095
8096 bool IsLightSource()
8097 {
8098 return false;
8099 }
8100
8102 {
8103 return true;
8104 }
8105
8106 //--- ACTION CONDITIONS
8107 //direction
8108 bool IsFacingPlayer(PlayerBase player, string selection)
8109 {
8110 return true;
8111 }
8112
8113 bool IsPlayerInside(PlayerBase player, string selection)
8114 {
8115 return true;
8116 }
8117
8118 override bool CanObstruct()
8119 {
8120 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
8121 return !player || !IsPlayerInside(player, "");
8122 }
8123
8124 override bool IsBeingPlaced()
8125 {
8126 return m_IsBeingPlaced;
8127 }
8128
8129 void SetIsBeingPlaced(bool is_being_placed)
8130 {
8131 m_IsBeingPlaced = is_being_placed;
8132 if (!is_being_placed)
8134 SetSynchDirty();
8135 }
8136
8137 //server-side
8138 void OnEndPlacement() {}
8139
8140 override bool IsHologram()
8141 {
8142 return m_IsHologram;
8143 }
8144
8145 bool CanBeDigged()
8146 {
8147 return m_CanBeDigged;
8148 }
8149
8151 {
8152 return 1;
8153 }
8154
8155 bool CanMakeGardenplot()
8156 {
8157 return false;
8158 }
8159
8160 void SetIsHologram(bool is_hologram)
8161 {
8162 m_IsHologram = is_hologram;
8163 SetSynchDirty();
8164 }
8165 /*
8166 protected float GetNutritionalEnergy()
8167 {
8168 Edible_Base edible = Edible_Base.Cast(this);
8169 return edible.GetFoodEnergy();
8170 }
8171
8172 protected float GetNutritionalWaterContent()
8173 {
8174 Edible_Base edible = Edible_Base.Cast(this);
8175 return edible.GetFoodWater();
8176 }
8177
8178 protected float GetNutritionalIndex()
8179 {
8180 Edible_Base edible = Edible_Base.Cast(this);
8181 return edible.GetFoodNutritionalIndex();
8182 }
8183
8184 protected float GetNutritionalFullnessIndex()
8185 {
8186 Edible_Base edible = Edible_Base.Cast(this);
8187 return edible.GetFoodTotalVolume();
8188 }
8189
8190 protected float GetNutritionalToxicity()
8191 {
8192 Edible_Base edible = Edible_Base.Cast(this);
8193 return edible.GetFoodToxicity();
8194
8195 }
8196 */
8197
8198
8199 // -------------------------------------------------------------------------
8200 override void OnMovedInsideCargo(EntityAI container)
8201 {
8202 super.OnMovedInsideCargo(container);
8203
8204 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8205 }
8206
8207 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8208 {
8209 super.EEItemLocationChanged(oldLoc,newLoc);
8210
8211 PlayerBase new_player = null;
8212 PlayerBase old_player = null;
8213
8214 if (newLoc.GetParent())
8215 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8216
8217 if (oldLoc.GetParent())
8218 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8219
8220 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
8221 {
8222 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8223
8224 if (r_index >= 0)
8225 {
8226 InventoryLocation r_il = new InventoryLocation;
8227 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8228
8229 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8230 int r_type = r_il.GetType();
8231 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8232 {
8233 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8234 }
8235 else if (r_type == InventoryLocationType.ATTACHMENT)
8236 {
8237 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8238 }
8239
8240 }
8241 }
8242
8243 if (newLoc.GetType() == InventoryLocationType.HANDS)
8244 {
8245 if (new_player)
8246 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8247
8248 if (new_player == old_player)
8249 {
8250
8251 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8252 {
8253 if (oldLoc.GetType() == InventoryLocationType.CARGO)
8254 {
8255 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8256 {
8257 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8258 }
8259 }
8260 else
8261 {
8262 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8263 }
8264 }
8265
8266 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8267 {
8268 int type = oldLoc.GetType();
8269 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
8270 {
8271 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8272 }
8273 else if (type == InventoryLocationType.ATTACHMENT)
8274 {
8275 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8276 }
8277 }
8278 if (!m_OldLocation)
8279 {
8280 m_OldLocation = new InventoryLocation;
8281 }
8282 m_OldLocation.Copy(oldLoc);
8283 }
8284 else
8285 {
8286 if (m_OldLocation)
8287 {
8288 m_OldLocation.Reset();
8289 }
8290 }
8291
8293 }
8294 else
8295 {
8296 if (new_player)
8297 {
8298 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8299 if (res_index >= 0)
8300 {
8301 InventoryLocation il = new InventoryLocation;
8302 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8303 ItemBase it = ItemBase.Cast(il.GetItem());
8304 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8305 int rel_type = il.GetType();
8306 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
8307 {
8308 il.GetParent().GetOnReleaseLock().Invoke(it);
8309 }
8310 else if (rel_type == InventoryLocationType.ATTACHMENT)
8311 {
8312 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
8313 }
8314 //it.GetOnReleaseLock().Invoke(it);
8315 }
8316 }
8317 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
8318 {
8319 //ThrowPhysically(old_player, vector.Zero);
8320 m_ThrowItemOnDrop = false;
8321 }
8322
8323 if (m_OldLocation)
8324 {
8325 m_OldLocation.Reset();
8326 }
8327 }
8328 }
8329
8330 override void EOnContact(IEntity other, Contact extra)
8331 {
8333 {
8334 int liquidType = -1;
8335 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
8336 if (impactSpeed > 0.0)
8337 {
8338 m_ImpactSpeed = impactSpeed;
8339 #ifndef SERVER
8340 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8341 #else
8342 m_WantPlayImpactSound = true;
8343 SetSynchDirty();
8344 #endif
8345 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
8346 }
8347 }
8348
8349 #ifdef SERVER
8350 if (GetCompEM() && GetCompEM().IsPlugged())
8351 {
8352 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
8353 GetCompEM().UnplugThis();
8354 }
8355 #endif
8356 }
8357
8358 void RefreshPhysics();
8359
8360 override void OnCreatePhysics()
8361 {
8363 }
8364
8365 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8366 {
8367
8368 }
8369 // -------------------------------------------------------------------------
8370 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
8371 {
8372 super.OnItemLocationChanged(old_owner, new_owner);
8373
8374 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8375 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8376
8377 if (!relatedPlayer && playerNew)
8378 relatedPlayer = playerNew;
8379
8380 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8381 {
8382 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
8383 if (actionMgr)
8384 {
8385 ActionBase currentAction = actionMgr.GetRunningAction();
8386 if (currentAction)
8387 currentAction.OnItemLocationChanged(this);
8388 }
8389 }
8390
8391 Man ownerPlayerOld = null;
8392 Man ownerPlayerNew = null;
8393
8394 if (old_owner)
8395 {
8396 if (old_owner.IsMan())
8397 {
8398 ownerPlayerOld = Man.Cast(old_owner);
8399 }
8400 else
8401 {
8402 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8403 }
8404 }
8405 else
8406 {
8407 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
8408 {
8409 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
8410
8411 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
8412 {
8413 GetCompEM().UnplugThis();
8414 }
8415 }
8416 }
8417
8418 if (new_owner)
8419 {
8420 if (new_owner.IsMan())
8421 {
8422 ownerPlayerNew = Man.Cast(new_owner);
8423 }
8424 else
8425 {
8426 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8427 }
8428 }
8429
8430 if (ownerPlayerOld != ownerPlayerNew)
8431 {
8432 if (ownerPlayerOld)
8433 {
8434 array<EntityAI> subItemsExit = new array<EntityAI>;
8435 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
8436 for (int i = 0; i < subItemsExit.Count(); i++)
8437 {
8438 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
8439 itemExit.OnInventoryExit(ownerPlayerOld);
8440 }
8441 }
8442
8443 if (ownerPlayerNew)
8444 {
8445 array<EntityAI> subItemsEnter = new array<EntityAI>;
8446 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
8447 for (int j = 0; j < subItemsEnter.Count(); j++)
8448 {
8449 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
8450 itemEnter.OnInventoryEnter(ownerPlayerNew);
8451 }
8452 }
8453 }
8454 else if (ownerPlayerNew != null)
8455 {
8456 PlayerBase nplayer;
8457 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8458 {
8459 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8460 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
8461 for (int k = 0; k < subItemsUpdate.Count(); k++)
8462 {
8463 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
8464 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8465 }
8466 }
8467 }
8468
8469 if (old_owner)
8470 old_owner.OnChildItemRemoved(this);
8471 if (new_owner)
8472 new_owner.OnChildItemReceived(this);
8473 }
8474
8475 // -------------------------------------------------------------------------------
8476 override void EEDelete(EntityAI parent)
8477 {
8478 super.EEDelete(parent);
8479 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8480 if (player)
8481 {
8482 OnInventoryExit(player);
8483
8484 if (player.IsAlive())
8485 {
8486 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8487 if (r_index >= 0)
8488 {
8489 InventoryLocation r_il = new InventoryLocation;
8490 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8491
8492 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8493 int r_type = r_il.GetType();
8494 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8495 {
8496 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8497 }
8498 else if (r_type == InventoryLocationType.ATTACHMENT)
8499 {
8500 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8501 }
8502
8503 }
8504
8505 player.RemoveQuickBarEntityShortcut(this);
8506 }
8507 }
8508 }
8509 // -------------------------------------------------------------------------------
8510 override void EEKilled(Object killer)
8511 {
8512 super.EEKilled(killer);
8513
8515 if (killer && killer.IsFireplace() && CanExplodeInFire())
8516 {
8517 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8518 {
8519 if (IsMagazine())
8520 {
8521 if (Magazine.Cast(this).GetAmmoCount() > 0)
8522 {
8523 ExplodeAmmo();
8524 }
8525 }
8526 else
8527 {
8528 Explode(DamageType.EXPLOSION);
8529 }
8530 }
8531 }
8532 }
8533
8534 override void OnWasAttached(EntityAI parent, int slot_id)
8535 {
8536 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8537
8538 super.OnWasAttached(parent, slot_id);
8539
8540 if (HasQuantity())
8541 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8542
8543 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
8544 }
8545
8546 override void OnWasDetached(EntityAI parent, int slot_id)
8547 {
8548 super.OnWasDetached(parent, slot_id);
8549
8550 if (HasQuantity())
8551 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8552 }
8553
8554 override string ChangeIntoOnAttach(string slot)
8555 {
8556 int idx;
8557 TStringArray inventory_slots = new TStringArray;
8558 TStringArray attach_types = new TStringArray;
8559
8560 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8561 if (inventory_slots.Count() < 1) //is string
8562 {
8563 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8564 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8565 }
8566 else //is array
8567 {
8568 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8569 }
8570
8571 idx = inventory_slots.Find(slot);
8572 if (idx < 0)
8573 return "";
8574
8575 return attach_types.Get(idx);
8576 }
8577
8578 override string ChangeIntoOnDetach()
8579 {
8580 int idx = -1;
8581 string slot;
8582
8583 TStringArray inventory_slots = new TStringArray;
8584 TStringArray detach_types = new TStringArray;
8585
8586 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8587 if (inventory_slots.Count() < 1) //is string
8588 {
8589 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8590 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8591 }
8592 else //is array
8593 {
8594 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8595 if (detach_types.Count() < 1)
8596 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8597 }
8598
8599 for (int i = 0; i < inventory_slots.Count(); i++)
8600 {
8601 slot = inventory_slots.Get(i);
8602 }
8603
8604 if (slot != "")
8605 {
8606 if (detach_types.Count() == 1)
8607 idx = 0;
8608 else
8609 idx = inventory_slots.Find(slot);
8610 }
8611 if (idx < 0)
8612 return "";
8613
8614 return detach_types.Get(idx);
8615 }
8616
8617 void ExplodeAmmo()
8618 {
8619 //timer
8620 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
8621
8622 //min/max time
8623 float min_time = 1;
8624 float max_time = 3;
8625 float delay = Math.RandomFloat(min_time, max_time);
8626
8627 explode_timer.Run(delay, this, "DoAmmoExplosion");
8628 }
8629
8630 void DoAmmoExplosion()
8631 {
8632 Magazine magazine = Magazine.Cast(this);
8633 int pop_sounds_count = 6;
8634 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8635
8636 //play sound
8637 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8638 string sound_name = pop_sounds[ sound_idx ];
8639 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
8640
8641 //remove ammo count
8642 magazine.ServerAddAmmoCount(-1);
8643
8644 //if condition then repeat -> ExplodeAmmo
8645 float min_temp_to_explode = 100; //min temperature for item to explode
8646
8647 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
8648 {
8649 ExplodeAmmo();
8650 }
8651 }
8652
8653 // -------------------------------------------------------------------------------
8654 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
8655 {
8656 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
8657
8658 const int CHANCE_DAMAGE_CARGO = 4;
8659 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8660 const int CHANCE_DAMAGE_NOTHING = 2;
8661
8662 if (IsClothing() || IsContainer() || IsItemTent())
8663 {
8664 float dmg = damageResult.GetDamage("","Health") * -0.5;
8665 int chances;
8666 int rnd;
8667
8668 if (GetInventory().GetCargo())
8669 {
8670 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8671 rnd = Math.RandomInt(0,chances);
8672
8673 if (rnd < CHANCE_DAMAGE_CARGO)
8674 {
8675 DamageItemInCargo(dmg);
8676 }
8677 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8678 {
8680 }
8681 }
8682 else
8683 {
8684 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8685 rnd = Math.RandomInt(0,chances);
8686
8687 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8688 {
8690 }
8691 }
8692 }
8693 }
8694
8695 bool DamageItemInCargo(float damage)
8696 {
8697 if (GetInventory().GetCargo())
8698 {
8699 int item_count = GetInventory().GetCargo().GetItemCount();
8700 if (item_count > 0)
8701 {
8702 int random_pick = Math.RandomInt(0, item_count);
8703 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
8704 if (!item.IsExplosive())
8705 {
8706 item.AddHealth("","",damage);
8707 return true;
8708 }
8709 }
8710 }
8711 return false;
8712 }
8713
8714 bool DamageItemAttachments(float damage)
8715 {
8716 int attachment_count = GetInventory().AttachmentCount();
8717 if (attachment_count > 0)
8718 {
8719 int random_pick = Math.RandomInt(0, attachment_count);
8720 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8721 if (!attachment.IsExplosive())
8722 {
8723 attachment.AddHealth("","",damage);
8724 return true;
8725 }
8726 }
8727 return false;
8728 }
8729
8730 override bool IsSplitable()
8731 {
8732 return m_CanThisBeSplit;
8733 }
8734 //----------------
8735 override bool CanBeSplit()
8736 {
8737 if (IsSplitable() && (GetQuantity() > 1))
8738 return GetInventory().CanRemoveEntity();
8739
8740 return false;
8741 }
8742
8743 protected bool ShouldSplitQuantity(float quantity)
8744 {
8745 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
8746 if (!IsSplitable())
8747 return false;
8748
8749 // nothing to split?
8750 if (GetQuantity() <= 1)
8751 return false;
8752
8753 // check if we should re-use the item instead of creating a new copy?
8754 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
8755 int delta = GetQuantity() - quantity;
8756 if (delta == 0)
8757 return false;
8758
8759 // valid to split
8760 return true;
8761 }
8762
8763 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
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(destination_entity);
8775 ctx.Write(true);
8776 ctx.Write(slot_id);
8777 ctx.Send();
8778 }
8779 }
8780 else if (!GetGame().IsMultiplayer())
8781 {
8782 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
8783 }
8784 }
8785
8786 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
8787 {
8788 float split_quantity_new;
8789 ItemBase new_item;
8790 float quantity = GetQuantity();
8791 float stack_max = GetTargetQuantityMax(slot_id);
8792 InventoryLocation loc = new InventoryLocation;
8793
8794 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8795 {
8796 if (stack_max <= GetQuantity())
8797 split_quantity_new = stack_max;
8798 else
8799 split_quantity_new = GetQuantity();
8800
8801 if (ShouldSplitQuantity(split_quantity_new))
8802 {
8803 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
8804 if (new_item)
8805 {
8806 new_item.SetResultOfSplit(true);
8807 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8808 AddQuantity(-split_quantity_new, false, true);
8809 new_item.SetQuantity(split_quantity_new, false, true);
8810 }
8811 }
8812 }
8813 else if (destination_entity && slot_id == -1)
8814 {
8815 if (quantity > stack_max)
8816 split_quantity_new = stack_max;
8817 else
8818 split_quantity_new = quantity;
8819
8820 if (ShouldSplitQuantity(split_quantity_new))
8821 {
8822 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
8823 {
8824 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
8825 new_item = ItemBase.Cast(o);
8826 }
8827
8828 if (new_item)
8829 {
8830 new_item.SetResultOfSplit(true);
8831 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8832 AddQuantity(-split_quantity_new, false, true);
8833 new_item.SetQuantity(split_quantity_new, false, true);
8834 }
8835 }
8836 }
8837 else
8838 {
8839 if (stack_max != 0)
8840 {
8841 if (stack_max < GetQuantity())
8842 {
8843 split_quantity_new = GetQuantity() - stack_max;
8844 }
8845
8846 if (split_quantity_new == 0)
8847 {
8848 if (!GetGame().IsMultiplayer())
8849 player.PhysicalPredictiveDropItem(this);
8850 else
8851 player.ServerDropEntity(this);
8852 return;
8853 }
8854
8855 if (ShouldSplitQuantity(split_quantity_new))
8856 {
8857 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
8858
8859 if (new_item)
8860 {
8861 new_item.SetResultOfSplit(true);
8862 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8863 SetQuantity(split_quantity_new, false, true);
8864 new_item.SetQuantity(stack_max, false, true);
8865 new_item.PlaceOnSurface();
8866 }
8867 }
8868 }
8869 }
8870 }
8871
8872 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
8873 {
8874 float split_quantity_new;
8875 ItemBase new_item;
8876 float quantity = GetQuantity();
8877 float stack_max = GetTargetQuantityMax(slot_id);
8878 InventoryLocation loc = new InventoryLocation;
8879
8880 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8881 {
8882 if (stack_max <= GetQuantity())
8883 split_quantity_new = stack_max;
8884 else
8885 split_quantity_new = GetQuantity();
8886
8887 if (ShouldSplitQuantity(split_quantity_new))
8888 {
8889 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
8890 if (new_item)
8891 {
8892 new_item.SetResultOfSplit(true);
8893 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8894 AddQuantity(-split_quantity_new, false, true);
8895 new_item.SetQuantity(split_quantity_new, false, true);
8896 }
8897 }
8898 }
8899 else if (destination_entity && slot_id == -1)
8900 {
8901 if (quantity > stack_max)
8902 split_quantity_new = stack_max;
8903 else
8904 split_quantity_new = quantity;
8905
8906 if (ShouldSplitQuantity(split_quantity_new))
8907 {
8908 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
8909 {
8910 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
8911 new_item = ItemBase.Cast(o);
8912 }
8913
8914 if (new_item)
8915 {
8916 new_item.SetResultOfSplit(true);
8917 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8918 AddQuantity(-split_quantity_new, false, true);
8919 new_item.SetQuantity(split_quantity_new, false, true);
8920 }
8921 }
8922 }
8923 else
8924 {
8925 if (stack_max != 0)
8926 {
8927 if (stack_max < GetQuantity())
8928 {
8929 split_quantity_new = GetQuantity() - stack_max;
8930 }
8931
8932 if (ShouldSplitQuantity(split_quantity_new))
8933 {
8934 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
8935
8936 if (new_item)
8937 {
8938 new_item.SetResultOfSplit(true);
8939 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8940 SetQuantity(split_quantity_new, false, true);
8941 new_item.SetQuantity(stack_max, false, true);
8942 new_item.PlaceOnSurface();
8943 }
8944 }
8945 }
8946 }
8947 }
8948
8949 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
8950 {
8951 if (GetGame().IsClient())
8952 {
8953 if (ScriptInputUserData.CanStoreInputUserData())
8954 {
8955 ScriptInputUserData ctx = new ScriptInputUserData;
8957 ctx.Write(4);
8958 ItemBase thiz = this; // @NOTE: workaround for correct serialization
8959 ctx.Write(thiz);
8960 dst.WriteToContext(ctx);
8961 ctx.Send();
8962 }
8963 }
8964 else if (!GetGame().IsMultiplayer())
8965 {
8967 }
8968 }
8969
8970 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
8971 {
8972 if (GetGame().IsClient())
8973 {
8974 if (ScriptInputUserData.CanStoreInputUserData())
8975 {
8976 ScriptInputUserData ctx = new ScriptInputUserData;
8978 ctx.Write(2);
8979 ItemBase dummy = this; // @NOTE: workaround for correct serialization
8980 ctx.Write(dummy);
8981 ctx.Write(destination_entity);
8982 ctx.Write(true);
8983 ctx.Write(idx);
8984 ctx.Write(row);
8985 ctx.Write(col);
8986 ctx.Send();
8987 }
8988 }
8989 else if (!GetGame().IsMultiplayer())
8990 {
8991 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
8992 }
8993 }
8994
8995 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
8996 {
8998 }
8999
9000 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
9001 {
9002 float quantity = GetQuantity();
9003 float split_quantity_new;
9004 ItemBase new_item;
9005 if (dst.IsValid())
9006 {
9007 int slot_id = dst.GetSlot();
9008 float stack_max = GetTargetQuantityMax(slot_id);
9009
9010 if (quantity > stack_max)
9011 split_quantity_new = stack_max;
9012 else
9013 split_quantity_new = quantity;
9014
9015 if (ShouldSplitQuantity(split_quantity_new))
9016 {
9017 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9018
9019 if (new_item)
9020 {
9021 new_item.SetResultOfSplit(true);
9022 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9023 AddQuantity(-split_quantity_new, false, true);
9024 new_item.SetQuantity(split_quantity_new, false, true);
9025 }
9026
9027 return new_item;
9028 }
9029 }
9030
9031 return null;
9032 }
9033
9034 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
9035 {
9036 float quantity = GetQuantity();
9037 float split_quantity_new;
9038 ItemBase new_item;
9039 if (destination_entity)
9040 {
9041 float stackable = GetTargetQuantityMax();
9042 if (quantity > stackable)
9043 split_quantity_new = stackable;
9044 else
9045 split_quantity_new = quantity;
9046
9047 if (ShouldSplitQuantity(split_quantity_new))
9048 {
9049 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
9050 if (new_item)
9051 {
9052 new_item.SetResultOfSplit(true);
9053 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9054 AddQuantity(-split_quantity_new, false, true);
9055 new_item.SetQuantity(split_quantity_new, false, true);
9056 }
9057 }
9058 }
9059 }
9060
9061 void SplitIntoStackMaxHandsClient(PlayerBase player)
9062 {
9063 if (GetGame().IsClient())
9064 {
9065 if (ScriptInputUserData.CanStoreInputUserData())
9066 {
9067 ScriptInputUserData ctx = new ScriptInputUserData;
9069 ctx.Write(3);
9070 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9071 ctx.Write(i1);
9072 ItemBase destination_entity = this;
9073 ctx.Write(destination_entity);
9074 ctx.Write(true);
9075 ctx.Write(0);
9076 ctx.Send();
9077 }
9078 }
9079 else if (!GetGame().IsMultiplayer())
9080 {
9081 SplitIntoStackMaxHands(player);
9082 }
9083 }
9084
9085 void SplitIntoStackMaxHands(PlayerBase player)
9086 {
9087 float quantity = GetQuantity();
9088 float split_quantity_new;
9089 ref ItemBase new_item;
9090 if (player)
9091 {
9092 float stackable = GetTargetQuantityMax();
9093 if (quantity > stackable)
9094 split_quantity_new = stackable;
9095 else
9096 split_quantity_new = quantity;
9097
9098 if (ShouldSplitQuantity(split_quantity_new))
9099 {
9100 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
9101 new_item = ItemBase.Cast(in_hands);
9102 if (new_item)
9103 {
9104 new_item.SetResultOfSplit(true);
9105 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9106 AddQuantity(-split_quantity_new, false, true);
9107 new_item.SetQuantity(split_quantity_new, false, true);
9108 }
9109 }
9110 }
9111 }
9112
9113 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
9114 {
9115 float quantity = GetQuantity();
9116 float split_quantity_new = Math.Floor(quantity * 0.5);
9117
9118 if (!ShouldSplitQuantity(split_quantity_new))
9119 return;
9120
9121 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9122
9123 if (new_item)
9124 {
9125 if (new_item.GetQuantityMax() < split_quantity_new)
9126 {
9127 split_quantity_new = new_item.GetQuantityMax();
9128 }
9129
9130 new_item.SetResultOfSplit(true);
9131 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9132
9133 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9134 {
9135 AddQuantity(-1, false, true);
9136 new_item.SetQuantity(1, false, true);
9137 }
9138 else
9139 {
9140 AddQuantity(-split_quantity_new, false, true);
9141 new_item.SetQuantity(split_quantity_new, false, true);
9142 }
9143 }
9144 }
9145
9146 void SplitItem(PlayerBase player)
9147 {
9148 float quantity = GetQuantity();
9149 float split_quantity_new = Math.Floor(quantity / 2);
9150
9151 if (!ShouldSplitQuantity(split_quantity_new))
9152 return;
9153
9154 InventoryLocation invloc = new InventoryLocation;
9155 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
9156
9157 ItemBase new_item;
9158 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9159
9160 if (new_item)
9161 {
9162 if (new_item.GetQuantityMax() < split_quantity_new)
9163 {
9164 split_quantity_new = new_item.GetQuantityMax();
9165 }
9166 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9167 {
9168 AddQuantity(-1, false, true);
9169 new_item.SetQuantity(1, false, true);
9170 }
9171 else if (split_quantity_new > 1)
9172 {
9173 AddQuantity(-split_quantity_new, false, true);
9174 new_item.SetQuantity(split_quantity_new, false, true);
9175 }
9176 }
9177 }
9178
9180 void OnQuantityChanged(float delta)
9181 {
9182 SetWeightDirty();
9183 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
9184
9185 if (parent)
9186 parent.OnAttachmentQuantityChangedEx(this, delta);
9187
9188 if (IsLiquidContainer())
9189 {
9190 if (GetQuantityNormalized() <= 0.0)
9191 {
9193 }
9194 else if (GetLiquidType() == LIQUID_NONE)
9195 {
9196 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
9198 }
9199 }
9200
9201 }
9202
9205 {
9206 // insert code here
9207 }
9208
9210 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
9211 {
9213 }
9214
9215 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
9216 {
9217 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9218
9219 if (GetGame().IsServer())
9220 {
9221 if (newLevel == GameConstants.STATE_RUINED)
9222 {
9224 EntityAI parent = GetHierarchyParent();
9225 if (parent && parent.IsFireplace())
9226 {
9227 CargoBase cargo = GetInventory().GetCargo();
9228 if (cargo)
9229 {
9230 for (int i = 0; i < cargo.GetItemCount(); ++i)
9231 {
9232 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
9233 }
9234 }
9235 }
9236 }
9237
9238 if (IsResultOfSplit())
9239 {
9240 // reset the splitting result flag, return to normal item behavior
9241 SetResultOfSplit(false);
9242 return;
9243 }
9244
9245 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9246 {
9247 SetCleanness(0);//unclean the item upon damage dealt
9248 }
9249 }
9250 }
9251
9252 // just the split? TODO: verify
9253 override void OnRightClick()
9254 {
9255 super.OnRightClick();
9256
9257 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
9258 {
9259 if (GetGame().IsClient())
9260 {
9261 if (ScriptInputUserData.CanStoreInputUserData())
9262 {
9263 EntityAI root = GetHierarchyRoot();
9264 Man playerOwner = GetHierarchyRootPlayer();
9265 InventoryLocation dst = new InventoryLocation;
9266
9267 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
9268 if (!playerOwner && root && root == this)
9269 {
9271 }
9272 else
9273 {
9274 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
9275 GetInventory().GetCurrentInventoryLocation(dst);
9276 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
9277 {
9278 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9279 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
9280 {
9282 }
9283 else
9284 {
9285 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
9286 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
9287 this shouldnt cause issues within this scope*/
9288 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
9289 {
9291 }
9292 else
9293 {
9294 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9295 }
9296 }
9297 }
9298 }
9299
9300 ScriptInputUserData ctx = new ScriptInputUserData;
9302 ctx.Write(4);
9303 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9304 ctx.Write(thiz);
9305 dst.WriteToContext(ctx);
9306 ctx.Write(true); // dummy
9307 ctx.Send();
9308 }
9309 }
9310 else if (!GetGame().IsMultiplayer())
9311 {
9312 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
9313 }
9314 }
9315 }
9316
9317 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
9318 {
9319 if (root)
9320 {
9321 vector m4[4];
9322 root.GetTransform(m4);
9323 dst.SetGround(this, m4);
9324 }
9325 else
9326 {
9327 GetInventory().GetCurrentInventoryLocation(dst);
9328 }
9329 }
9330
9331 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
9332 {
9333 //TODO: delete check zero quantity check after fix double posts hands fsm events
9334 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
9335 return false;
9336
9337 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9338 return false;
9339
9340 //can_this_be_combined = ConfigGetBool("canBeSplit");
9342 return false;
9343
9344
9345 Magazine mag = Magazine.Cast(this);
9346 if (mag)
9347 {
9348 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9349 return false;
9350
9351 if (stack_max_limit)
9352 {
9353 Magazine other_mag = Magazine.Cast(other_item);
9354 if (other_item)
9355 {
9356 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9357 return false;
9358 }
9359
9360 }
9361 }
9362 else
9363 {
9364 //TODO: delete check zero quantity check after fix double posts hands fsm events
9365 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
9366 return false;
9367
9368 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
9369 return false;
9370 }
9371
9372 PlayerBase player = null;
9373 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
9374 {
9375 if (player.GetInventory().HasAttachment(this))
9376 return false;
9377
9378 if (player.IsItemsToDelete())
9379 return false;
9380 }
9381
9382 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9383 return false;
9384
9385 int slotID;
9386 string slotName;
9387 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9388 return false;
9389
9390 return true;
9391 }
9392
9393 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
9394 {
9395 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
9396 }
9397
9398 bool IsResultOfSplit()
9399 {
9400 return m_IsResultOfSplit;
9401 }
9402
9403 void SetResultOfSplit(bool value)
9404 {
9405 m_IsResultOfSplit = value;
9406 }
9407
9408 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
9409 {
9410 return ComputeQuantityUsedEx(other_item, use_stack_max);
9411 }
9412
9413 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
9414 {
9415 float other_item_quantity = other_item.GetQuantity();
9416 float this_free_space;
9417
9418 float stack_max = GetQuantityMax();
9419
9420 this_free_space = stack_max - GetQuantity();
9421
9422 if (other_item_quantity > this_free_space)
9423 {
9424 return this_free_space;
9425 }
9426 else
9427 {
9428 return other_item_quantity;
9429 }
9430 }
9431
9432 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
9433 {
9434 CombineItems(ItemBase.Cast(entity2),use_stack_max);
9435 }
9436
9437 void CombineItems(ItemBase other_item, bool use_stack_max = true)
9438 {
9439 if (!CanBeCombined(other_item, false))
9440 return;
9441
9442 if (!IsMagazine() && other_item)
9443 {
9444 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
9445 if (quantity_used != 0)
9446 {
9447 float hp1 = GetHealth01("","");
9448 float hp2 = other_item.GetHealth01("","");
9449 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
9450 hpResult = hpResult / (GetQuantity() + quantity_used);
9451
9452 hpResult *= GetMaxHealth();
9453 Math.Round(hpResult);
9454 SetHealth("", "Health", hpResult);
9455
9456 AddQuantity(quantity_used);
9457 other_item.AddQuantity(-quantity_used);
9458 }
9459 }
9460 OnCombine(other_item);
9461 }
9462
9463 void OnCombine(ItemBase other_item)
9464 {
9465 #ifdef SERVER
9466 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9467 GetHierarchyParent().IncreaseLifetimeUp();
9468 #endif
9469 };
9470
9471 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
9472 {
9473 PlayerBase p = PlayerBase.Cast(player);
9474
9475 array<int> recipesIds = p.m_Recipes;
9476 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9477 if (moduleRecipesManager)
9478 {
9479 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9480 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
9481 }
9482
9483 for (int i = 0;i < recipesIds.Count(); i++)
9484 {
9485 int key = recipesIds.Get(i);
9486 string recipeName = moduleRecipesManager.GetRecipeName(key);
9487 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
9488 }
9489 }
9490
9491 // -------------------------------------------------------------------------
9492 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9493 {
9494 super.GetDebugActions(outputList);
9495
9496 //quantity
9497 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
9498 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
9499 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
9500 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
9501 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9502
9503 //health
9504 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
9505 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
9506 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
9507 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9508 //temperature
9509 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
9510 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
9511 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
9512 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9513
9514 //wet
9515 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
9516 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
9517 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9518
9519 //liquidtype
9520 if (IsLiquidContainer())
9521 {
9522 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
9523 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
9524 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9525 }
9526
9527 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
9528 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9529
9530 // watch
9531 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
9532 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
9533 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9534
9535 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
9536
9537 InventoryLocation loc = new InventoryLocation();
9538 GetInventory().GetCurrentInventoryLocation(loc);
9539 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
9540 {
9541 if (Gizmo_IsSupported())
9542 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
9543 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
9544 }
9545
9546 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9547 }
9548
9549 // -------------------------------------------------------------------------
9550 // -------------------------------------------------------------------------
9551 // -------------------------------------------------------------------------
9552 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
9553 {
9554 super.OnAction(action_id, player, ctx);
9555
9556 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
9557 {
9558 switch (action_id)
9559 {
9560 case EActions.GIZMO_OBJECT:
9561 GetGame().GizmoSelectObject(this);
9562 return true;
9563 case EActions.GIZMO_PHYSICS:
9564 GetGame().GizmoSelectPhysics(GetPhysics());
9565 return true;
9566 }
9567 }
9568
9569 if (GetGame().IsServer())
9570 {
9571 switch (action_id)
9572 {
9573 case EActions.DELETE:
9574 Delete();
9575 return true;
9576 }
9577 }
9578
9579 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
9580 {
9581 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9582 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
9583 PlayerBase p = PlayerBase.Cast(player);
9584 if (EActions.RECIPES_RANGE_START < 1000)
9585 {
9586 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9587 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9588 }
9589 }
9590 #ifndef SERVER
9591 else if (action_id == EActions.WATCH_PLAYER)
9592 {
9593 PluginDeveloper.SetDeveloperItemClientEx(player);
9594 }
9595 #endif
9596 if (GetGame().IsServer())
9597 {
9598 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9599 {
9600 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9601 OnDebugButtonPressServer(id + 1);
9602 }
9603
9604 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9605 {
9606 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9607 InsertAgent(agent_id,100);
9608 }
9609
9610 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9611 {
9612 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9613 RemoveAgent(agent_id2);
9614 }
9615
9616 else if (action_id == EActions.ADD_QUANTITY)
9617 {
9618 if (IsMagazine())
9619 {
9620 Magazine mag = Magazine.Cast(this);
9621 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9622 }
9623 else
9624 {
9625 AddQuantity(GetQuantityMax() * 0.2);
9626 }
9627
9628 if (m_EM)
9629 {
9630 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9631 }
9632 //PrintVariables();
9633 }
9634
9635 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
9636 {
9637 if (IsMagazine())
9638 {
9639 Magazine mag2 = Magazine.Cast(this);
9640 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9641 }
9642 else
9643 {
9644 AddQuantity(- GetQuantityMax() * 0.2);
9645 }
9646 if (m_EM)
9647 {
9648 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9649 }
9650 //PrintVariables();
9651 }
9652
9653 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
9654 {
9655 SetQuantity(0);
9656
9657 if (m_EM)
9658 {
9659 m_EM.SetEnergy(0);
9660 }
9661 }
9662
9663 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
9664 {
9666
9667 if (m_EM)
9668 {
9669 m_EM.SetEnergy(m_EM.GetEnergyMax());
9670 }
9671 }
9672
9673 else if (action_id == EActions.ADD_HEALTH)
9674 {
9675 AddHealth("","",GetMaxHealth("","Health")/5);
9676 }
9677 else if (action_id == EActions.REMOVE_HEALTH)
9678 {
9679 AddHealth("","",-GetMaxHealth("","Health")/5);
9680 }
9681 else if (action_id == EActions.DESTROY_HEALTH)
9682 {
9683 SetHealth01("","",0);
9684 }
9685 else if (action_id == EActions.WATCH_ITEM)
9686 {
9688 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
9689 #ifdef DEVELOPER
9690 SetDebugDeveloper_item(this);
9691 #endif
9692 }
9693
9694 else if (action_id == EActions.ADD_TEMPERATURE)
9695 {
9696 AddTemperature(20);
9697 //PrintVariables();
9698 }
9699
9700 else if (action_id == EActions.REMOVE_TEMPERATURE)
9701 {
9702 AddTemperature(-20);
9703 //PrintVariables();
9704 }
9705
9706 else if (action_id == EActions.FLIP_FROZEN)
9707 {
9708 SetFrozen(!GetIsFrozen());
9709 //PrintVariables();
9710 }
9711
9712 else if (action_id == EActions.ADD_WETNESS)
9713 {
9714 AddWet(GetWetMax()/5);
9715 //PrintVariables();
9716 }
9717
9718 else if (action_id == EActions.REMOVE_WETNESS)
9719 {
9720 AddWet(-GetWetMax()/5);
9721 //PrintVariables();
9722 }
9723
9724 else if (action_id == EActions.LIQUIDTYPE_UP)
9725 {
9726 int curr_type = GetLiquidType();
9727 SetLiquidType(curr_type * 2);
9728 //AddWet(1);
9729 //PrintVariables();
9730 }
9731
9732 else if (action_id == EActions.LIQUIDTYPE_DOWN)
9733 {
9734 int curr_type2 = GetLiquidType();
9735 SetLiquidType(curr_type2 / 2);
9736 }
9737
9738 else if (action_id == EActions.MAKE_SPECIAL)
9739 {
9740 auto debugParams = DebugSpawnParams.WithPlayer(player);
9741 OnDebugSpawnEx(debugParams);
9742 }
9743
9744 }
9745
9746
9747 return false;
9748 }
9749
9750 // -------------------------------------------------------------------------
9751
9752
9755 void OnActivatedByTripWire();
9756
9758 void OnActivatedByItem(notnull ItemBase item);
9759
9760 //----------------------------------------------------------------
9761 //returns true if item is able to explode when put in fire
9762 bool CanExplodeInFire()
9763 {
9764 return false;
9765 }
9766
9767 //----------------------------------------------------------------
9768 bool CanEat()
9769 {
9770 return true;
9771 }
9772
9773 //----------------------------------------------------------------
9774 override bool IsIgnoredByConstruction()
9775 {
9776 return true;
9777 }
9778
9779 //----------------------------------------------------------------
9780 //has FoodStages in config?
9781 bool HasFoodStage()
9782 {
9783 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
9784 return GetGame().ConfigIsExisting(config_path);
9785 }
9786
9788 FoodStage GetFoodStage()
9789 {
9790 return null;
9791 }
9792
9793 bool CanBeCooked()
9794 {
9795 return false;
9796 }
9797
9798 bool CanBeCookedOnStick()
9799 {
9800 return false;
9801 }
9802
9804 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
9806
9807 //----------------------------------------------------------------
9808 bool CanRepair(ItemBase item_repair_kit)
9809 {
9810 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
9811 return module_repairing.CanRepair(this, item_repair_kit);
9812 }
9813
9814 //----------------------------------------------------------------
9815 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
9816 {
9817 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
9818 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9819 }
9820
9821 //----------------------------------------------------------------
9822 int GetItemSize()
9823 {
9824 /*
9825 vector v_size = this.ConfigGetVector("itemSize");
9826 int v_size_x = v_size[0];
9827 int v_size_y = v_size[1];
9828 int size = v_size_x * v_size_y;
9829 return size;
9830 */
9831
9832 return 1;
9833 }
9834
9835 //----------------------------------------------------------------
9836 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
9837 bool CanBeMovedOverride()
9838 {
9839 return m_CanBeMovedOverride;
9840 }
9841
9842 //----------------------------------------------------------------
9843 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
9844 void SetCanBeMovedOverride(bool setting)
9845 {
9846 m_CanBeMovedOverride = setting;
9847 }
9848
9849 //----------------------------------------------------------------
9857 void MessageToOwnerStatus(string text)
9858 {
9859 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9860
9861 if (player)
9862 {
9863 player.MessageStatus(text);
9864 }
9865 }
9866
9867 //----------------------------------------------------------------
9875 void MessageToOwnerAction(string text)
9876 {
9877 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9878
9879 if (player)
9880 {
9881 player.MessageAction(text);
9882 }
9883 }
9884
9885 //----------------------------------------------------------------
9893 void MessageToOwnerFriendly(string text)
9894 {
9895 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9896
9897 if (player)
9898 {
9899 player.MessageFriendly(text);
9900 }
9901 }
9902
9903 //----------------------------------------------------------------
9911 void MessageToOwnerImportant(string text)
9912 {
9913 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9914
9915 if (player)
9916 {
9917 player.MessageImportant(text);
9918 }
9919 }
9920
9921 override bool IsItemBase()
9922 {
9923 return true;
9924 }
9925
9926 // Checks if item is of questioned kind
9927 override bool KindOf(string tag)
9928 {
9929 bool found = false;
9930 string item_name = this.GetType();
9931 ref TStringArray item_tag_array = new TStringArray;
9932 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
9933
9934 int array_size = item_tag_array.Count();
9935 for (int i = 0; i < array_size; i++)
9936 {
9937 if (item_tag_array.Get(i) == tag)
9938 {
9939 found = true;
9940 break;
9941 }
9942 }
9943 return found;
9944 }
9945
9946
9947 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
9948 {
9949 //Debug.Log("OnRPC called");
9950 super.OnRPC(sender, rpc_type,ctx);
9951
9952 //Play soundset for attachment locking (ActionLockAttachment.c)
9953 switch (rpc_type)
9954 {
9955 #ifndef SERVER
9956 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9957 Param2<bool, string> p = new Param2<bool, string>(false, "");
9958
9959 if (!ctx.Read(p))
9960 return;
9961
9962 bool play = p.param1;
9963 string soundSet = p.param2;
9964
9965 if (play)
9966 {
9967 if (m_LockingSound)
9968 {
9970 {
9971 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
9972 }
9973 }
9974 else
9975 {
9976 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
9977 }
9978 }
9979 else
9980 {
9981 SEffectManager.DestroyEffect(m_LockingSound);
9982 }
9983
9984 break;
9985 #endif
9986
9987 }
9988
9989 if (GetWrittenNoteData())
9990 {
9991 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
9992 }
9993 }
9994
9995 //-----------------------------
9996 // VARIABLE MANIPULATION SYSTEM
9997 //-----------------------------
9998 int NameToID(string name)
9999 {
10000 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10001 return plugin.GetID(name);
10002 }
10003
10004 string IDToName(int id)
10005 {
10006 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10007 return plugin.GetName(id);
10008 }
10009
10011 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
10012 {
10013 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
10014 //read the flags
10015 int varFlags;
10016 if (!ctx.Read(varFlags))
10017 return;
10018
10019 if (varFlags & ItemVariableFlags.FLOAT)
10020 {
10021 ReadVarsFromCTX(ctx);
10022 }
10023 }
10024
10025 override void SerializeNumericalVars(array<float> floats_out)
10026 {
10027 //some variables handled on EntityAI level already!
10028 super.SerializeNumericalVars(floats_out);
10029
10030 // the order of serialization must be the same as the order of de-serialization
10031 //--------------------------------------------
10032 if (IsVariableSet(VARIABLE_QUANTITY))
10033 {
10034 floats_out.Insert(m_VarQuantity);
10035 }
10036 //--------------------------------------------
10037 if (IsVariableSet(VARIABLE_WET))
10038 {
10039 floats_out.Insert(m_VarWet);
10040 }
10041 //--------------------------------------------
10042 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10043 {
10044 floats_out.Insert(m_VarLiquidType);
10045 }
10046 //--------------------------------------------
10047 if (IsVariableSet(VARIABLE_COLOR))
10048 {
10049 floats_out.Insert(m_ColorComponentR);
10050 floats_out.Insert(m_ColorComponentG);
10051 floats_out.Insert(m_ColorComponentB);
10052 floats_out.Insert(m_ColorComponentA);
10053 }
10054 //--------------------------------------------
10055 if (IsVariableSet(VARIABLE_CLEANNESS))
10056 {
10057 floats_out.Insert(m_Cleanness);
10058 }
10059 }
10060
10061 override void DeSerializeNumericalVars(array<float> floats)
10062 {
10063 //some variables handled on EntityAI level already!
10064 super.DeSerializeNumericalVars(floats);
10065
10066 // the order of serialization must be the same as the order of de-serialization
10067 int index = 0;
10068 int mask = Math.Round(floats.Get(index));
10069
10070 index++;
10071 //--------------------------------------------
10072 if (mask & VARIABLE_QUANTITY)
10073 {
10074 if (m_IsStoreLoad)
10075 {
10076 SetStoreLoadedQuantity(floats.Get(index));
10077 }
10078 else
10079 {
10080 float quantity = floats.Get(index);
10081 SetQuantity(quantity, true, false, false, false);
10082 }
10083 index++;
10084 }
10085 //--------------------------------------------
10086 if (mask & VARIABLE_WET)
10087 {
10088 float wet = floats.Get(index);
10089 SetWet(wet);
10090 index++;
10091 }
10092 //--------------------------------------------
10093 if (mask & VARIABLE_LIQUIDTYPE)
10094 {
10095 int liquidtype = Math.Round(floats.Get(index));
10096 SetLiquidType(liquidtype);
10097 index++;
10098 }
10099 //--------------------------------------------
10100 if (mask & VARIABLE_COLOR)
10101 {
10102 m_ColorComponentR = Math.Round(floats.Get(index));
10103 index++;
10104 m_ColorComponentG = Math.Round(floats.Get(index));
10105 index++;
10106 m_ColorComponentB = Math.Round(floats.Get(index));
10107 index++;
10108 m_ColorComponentA = Math.Round(floats.Get(index));
10109 index++;
10110 }
10111 //--------------------------------------------
10112 if (mask & VARIABLE_CLEANNESS)
10113 {
10114 int cleanness = Math.Round(floats.Get(index));
10115 SetCleanness(cleanness);
10116 index++;
10117 }
10118 }
10119
10120 override void WriteVarsToCTX(ParamsWriteContext ctx)
10121 {
10122 super.WriteVarsToCTX(ctx);
10123
10124 //--------------------------------------------
10125 if (IsVariableSet(VARIABLE_QUANTITY))
10126 {
10127 ctx.Write(GetQuantity());
10128 }
10129 //--------------------------------------------
10130 if (IsVariableSet(VARIABLE_WET))
10131 {
10132 ctx.Write(GetWet());
10133 }
10134 //--------------------------------------------
10135 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10136 {
10137 ctx.Write(GetLiquidType());
10138 }
10139 //--------------------------------------------
10140 if (IsVariableSet(VARIABLE_COLOR))
10141 {
10142 int r,g,b,a;
10143 GetColor(r,g,b,a);
10144 ctx.Write(r);
10145 ctx.Write(g);
10146 ctx.Write(b);
10147 ctx.Write(a);
10148 }
10149 //--------------------------------------------
10150 if (IsVariableSet(VARIABLE_CLEANNESS))
10151 {
10152 ctx.Write(GetCleanness());
10153 }
10154 }
10155
10156 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
10157 {
10158 if (!super.ReadVarsFromCTX(ctx,version))
10159 return false;
10160
10161 int intValue;
10162 float value;
10163
10164 if (version < 140)
10165 {
10166 if (!ctx.Read(intValue))
10167 return false;
10168
10169 m_VariablesMask = intValue;
10170 }
10171
10172 if (m_VariablesMask & VARIABLE_QUANTITY)
10173 {
10174 if (!ctx.Read(value))
10175 return false;
10176
10177 if (IsStoreLoad())
10178 {
10180 }
10181 else
10182 {
10183 SetQuantity(value, true, false, false, false);
10184 }
10185 }
10186 //--------------------------------------------
10187 if (version < 140)
10188 {
10189 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10190 {
10191 if (!ctx.Read(value))
10192 return false;
10193 SetTemperatureDirect(value);
10194 }
10195 }
10196 //--------------------------------------------
10197 if (m_VariablesMask & VARIABLE_WET)
10198 {
10199 if (!ctx.Read(value))
10200 return false;
10201 SetWet(value);
10202 }
10203 //--------------------------------------------
10204 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
10205 {
10206 if (!ctx.Read(intValue))
10207 return false;
10208 SetLiquidType(intValue);
10209 }
10210 //--------------------------------------------
10211 if (m_VariablesMask & VARIABLE_COLOR)
10212 {
10213 int r,g,b,a;
10214 if (!ctx.Read(r))
10215 return false;
10216 if (!ctx.Read(g))
10217 return false;
10218 if (!ctx.Read(b))
10219 return false;
10220 if (!ctx.Read(a))
10221 return false;
10222
10223 SetColor(r,g,b,a);
10224 }
10225 //--------------------------------------------
10226 if (m_VariablesMask & VARIABLE_CLEANNESS)
10227 {
10228 if (!ctx.Read(intValue))
10229 return false;
10230 SetCleanness(intValue);
10231 }
10232 //--------------------------------------------
10233 if (version >= 138 && version < 140)
10234 {
10235 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10236 {
10237 if (!ctx.Read(intValue))
10238 return false;
10239 SetFrozen(intValue);
10240 }
10241 }
10242
10243 return true;
10244 }
10245
10246 //----------------------------------------------------------------
10247 override bool OnStoreLoad(ParamsReadContext ctx, int version)
10248 {
10249 m_IsStoreLoad = true;
10251 {
10252 m_FixDamageSystemInit = true;
10253 }
10254
10255 if (!super.OnStoreLoad(ctx, version))
10256 {
10257 m_IsStoreLoad = false;
10258 return false;
10259 }
10260
10261 if (version >= 114)
10262 {
10263 bool hasQuickBarIndexSaved;
10264
10265 if (!ctx.Read(hasQuickBarIndexSaved))
10266 {
10267 m_IsStoreLoad = false;
10268 return false;
10269 }
10270
10271 if (hasQuickBarIndexSaved)
10272 {
10273 int itmQBIndex;
10274
10275 //Load quickbar item bind
10276 if (!ctx.Read(itmQBIndex))
10277 {
10278 m_IsStoreLoad = false;
10279 return false;
10280 }
10281
10282 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10283 if (itmQBIndex != -1 && parentPlayer)
10284 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10285 }
10286 }
10287 else
10288 {
10289 // Backup of how it used to be
10290 PlayerBase player;
10291 int itemQBIndex;
10292 if (version == int.MAX)
10293 {
10294 if (!ctx.Read(itemQBIndex))
10295 {
10296 m_IsStoreLoad = false;
10297 return false;
10298 }
10299 }
10300 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10301 {
10302 //Load quickbar item bind
10303 if (!ctx.Read(itemQBIndex))
10304 {
10305 m_IsStoreLoad = false;
10306 return false;
10307 }
10308 if (itemQBIndex != -1 && player)
10309 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10310 }
10311 }
10312
10313 if (version < 140)
10314 {
10315 // variable management system
10316 if (!LoadVariables(ctx, version))
10317 {
10318 m_IsStoreLoad = false;
10319 return false;
10320 }
10321 }
10322
10323 //agent trasmission system
10324 if (!LoadAgents(ctx, version))
10325 {
10326 m_IsStoreLoad = false;
10327 return false;
10328 }
10329 if (version >= 132)
10330 {
10331 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10332 if (raib)
10333 {
10334 if (!raib.OnStoreLoad(ctx,version))
10335 {
10336 m_IsStoreLoad = false;
10337 return false;
10338 }
10339 }
10340 }
10341
10342 m_IsStoreLoad = false;
10343 return true;
10344 }
10345
10346 //----------------------------------------------------------------
10347
10348 override void OnStoreSave(ParamsWriteContext ctx)
10349 {
10350 super.OnStoreSave(ctx);
10351
10352 PlayerBase player;
10353 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10354 {
10355 ctx.Write(true); // Keep track of if we should actually read this in or not
10356 //Save quickbar item bind
10357 int itemQBIndex = -1;
10358 itemQBIndex = player.FindQuickBarEntityIndex(this);
10359 ctx.Write(itemQBIndex);
10360 }
10361 else
10362 {
10363 ctx.Write(false); // Keep track of if we should actually read this in or not
10364 }
10365
10366 SaveAgents(ctx);//agent trasmission system
10367
10368 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10369 if (raib)
10370 {
10371 raib.OnStoreSave(ctx);
10372 }
10373 }
10374 //----------------------------------------------------------------
10375
10376 override void AfterStoreLoad()
10377 {
10378 super.AfterStoreLoad();
10379
10381 {
10383 }
10384
10385 if (GetStoreLoadedQuantity() != float.LOWEST)
10386 {
10388 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
10389 }
10390 }
10391
10392 override void EEOnAfterLoad()
10393 {
10394 super.EEOnAfterLoad();
10395
10397 {
10398 m_FixDamageSystemInit = false;
10399 }
10400
10403 }
10404
10405 bool CanBeDisinfected()
10406 {
10407 return false;
10408 }
10409
10410
10411 //----------------------------------------------------------------
10412 override void OnVariablesSynchronized()
10413 {
10414 if (m_Initialized)
10415 {
10416 #ifdef PLATFORM_CONSOLE
10417 //bruteforce it is
10418 if (IsSplitable())
10419 {
10420 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
10421 if (menu)
10422 {
10423 menu.Refresh();
10424 }
10425 }
10426 #endif
10427 }
10428
10430 {
10431 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10432 m_WantPlayImpactSound = false;
10433 }
10434
10436 {
10437 SetWeightDirty();
10439 }
10440 if (m_VarWet != m_VarWetPrev)
10441 {
10444 }
10445
10446 if (m_SoundSyncPlay != 0)
10447 {
10448 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
10449 m_SoundSyncPlay = 0;
10450 }
10451 if (m_SoundSyncStop != 0)
10452 {
10453 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
10454 m_SoundSyncStop = 0;
10455 }
10456
10457 super.OnVariablesSynchronized();
10458 }
10459
10460 //------------------------- Quantity
10461 //----------------------------------------------------------------
10463 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
10464 {
10465 if (!IsServerCheck(allow_client))
10466 return false;
10467
10468 if (!HasQuantity())
10469 return false;
10470
10471 float min = GetQuantityMin();
10472 float max = GetQuantityMax();
10473
10474 if (value <= (min + 0.001))
10475 value = min;
10476
10477 if (value == min)
10478 {
10479 if (destroy_config)
10480 {
10481 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10482 if (dstr)
10483 {
10484 m_VarQuantity = Math.Clamp(value, min, max);
10485 this.Delete();
10486 return true;
10487 }
10488 }
10489 else if (destroy_forced)
10490 {
10491 m_VarQuantity = Math.Clamp(value, min, max);
10492 this.Delete();
10493 return true;
10494 }
10495 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
10496 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
10497 }
10498
10499 float delta = m_VarQuantity;
10500 m_VarQuantity = Math.Clamp(value, min, max);
10501
10502 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
10503 {
10504 delta = m_VarQuantity - delta;
10505
10506 if (delta)
10507 OnQuantityChanged(delta);
10508 }
10509
10510 SetVariableMask(VARIABLE_QUANTITY);
10511
10512 return false;
10513 }
10514
10515 //----------------------------------------------------------------
10517 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
10518 {
10519 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
10520 }
10521 //----------------------------------------------------------------
10522 void SetQuantityMax()
10523 {
10524 float max = GetQuantityMax();
10525 SetQuantity(max);
10526 }
10527
10528 override void SetQuantityToMinimum()
10529 {
10530 float min = GetQuantityMin();
10531 SetQuantity(min);
10532 }
10533 //----------------------------------------------------------------
10535 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
10536 {
10537 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
10538 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
10539 SetQuantity(result, destroy_config, destroy_forced);
10540 }
10541
10542 //----------------------------------------------------------------
10544 override float GetQuantityNormalized()
10545 {
10546 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
10547 }
10548
10550 {
10551 return GetQuantityNormalized();
10552 }
10553
10554 /*void SetAmmoNormalized(float value)
10555 {
10556 float value_clamped = Math.Clamp(value, 0, 1);
10557 Magazine this_mag = Magazine.Cast(this);
10558 int max_rounds = this_mag.GetAmmoMax();
10559 int result = value * max_rounds;//can the rounded if higher precision is required
10560 this_mag.SetAmmoCount(result);
10561 }*/
10562 //----------------------------------------------------------------
10563 override int GetQuantityMax()
10564 {
10565 int slot = -1;
10566 if (GetInventory())
10567 {
10568 InventoryLocation il = new InventoryLocation;
10569 GetInventory().GetCurrentInventoryLocation(il);
10570 slot = il.GetSlot();
10571 }
10572
10573 return GetTargetQuantityMax(slot);
10574 }
10575
10576 override int GetTargetQuantityMax(int attSlotID = -1)
10577 {
10578 float quantity_max = 0;
10579
10580 if (IsSplitable()) //only stackable/splitable items can check for stack size
10581 {
10582 if (attSlotID != -1)
10583 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10584
10585 if (quantity_max <= 0)
10586 quantity_max = m_VarStackMax;
10587 }
10588
10589 if (quantity_max <= 0)
10590 quantity_max = m_VarQuantityMax;
10591
10592 return quantity_max;
10593 }
10594 //----------------------------------------------------------------
10595 override int GetQuantityMin()
10596 {
10597 return m_VarQuantityMin;
10598 }
10599 //----------------------------------------------------------------
10600 int GetQuantityInit()
10601 {
10602 return m_VarQuantityInit;
10603 }
10604
10605 //----------------------------------------------------------------
10606 override bool HasQuantity()
10607 {
10608 return !(GetQuantityMax() - GetQuantityMin() == 0);
10609 }
10610
10611 override float GetQuantity()
10612 {
10613 return m_VarQuantity;
10614 }
10615
10616 bool IsFullQuantity()
10617 {
10618 return GetQuantity() >= GetQuantityMax();
10619 }
10620
10621 //Calculates weight of single item without attachments and cargo
10622 override float GetSingleInventoryItemWeightEx()
10623 {
10624 //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
10625 float weightEx = GetWeightEx();//overall weight of the item
10626 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
10627 return weightEx - special;
10628 }
10629
10630 // Obsolete, use GetSingleInventoryItemWeightEx() instead
10632 {
10634 }
10635
10636 override protected float GetWeightSpecialized(bool forceRecalc = false)
10637 {
10638 if (IsSplitable()) //quantity determines size of the stack
10639 {
10640 #ifdef DEVELOPER
10641 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10642 {
10643 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10644 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
10645 }
10646 #endif
10647
10648 return GetQuantity() * GetConfigWeightModified();
10649 }
10650 else if (HasEnergyManager())// items with energy manager
10651 {
10652 #ifdef DEVELOPER
10653 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10654 {
10655 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10656 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
10657 }
10658 #endif
10659 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10660 }
10661 else//everything else
10662 {
10663 #ifdef DEVELOPER
10664 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10665 {
10666 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10667 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
10668 }
10669 #endif
10670 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10671 }
10672 }
10673
10675 int GetNumberOfItems()
10676 {
10677 int item_count = 0;
10678 ItemBase item;
10679
10680 if (GetInventory().GetCargo() != NULL)
10681 {
10682 item_count = GetInventory().GetCargo().GetItemCount();
10683 }
10684
10685 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10686 {
10687 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10688 if (item)
10689 item_count += item.GetNumberOfItems();
10690 }
10691 return item_count;
10692 }
10693
10695 float GetUnitWeight(bool include_wetness = true)
10696 {
10697 float weight = 0;
10698 float wetness = 1;
10699 if (include_wetness)
10700 wetness += GetWet();
10701 if (IsSplitable()) //quantity determines size of the stack
10702 {
10703 weight = wetness * m_ConfigWeight;
10704 }
10705 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
10706 {
10707 weight = 1;
10708 }
10709 return weight;
10710 }
10711
10712 //-----------------------------------------------------------------
10713
10714 override void ClearInventory()
10715 {
10716 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
10717 {
10718 GameInventory inv = GetInventory();
10719 array<EntityAI> items = new array<EntityAI>;
10720 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
10721 for (int i = 0; i < items.Count(); i++)
10722 {
10723 ItemBase item = ItemBase.Cast(items.Get(i));
10724 if (item)
10725 {
10726 GetGame().ObjectDelete(item);
10727 }
10728 }
10729 }
10730 }
10731
10732 //------------------------- Energy
10733
10734 //----------------------------------------------------------------
10735 float GetEnergy()
10736 {
10737 float energy = 0;
10738 if (HasEnergyManager())
10739 {
10740 energy = GetCompEM().GetEnergy();
10741 }
10742 return energy;
10743 }
10744
10745
10746 override void OnEnergyConsumed()
10747 {
10748 super.OnEnergyConsumed();
10749
10751 }
10752
10753 override void OnEnergyAdded()
10754 {
10755 super.OnEnergyAdded();
10756
10758 }
10759
10760 // Converts energy (from Energy Manager) to quantity, if enabled.
10762 {
10763 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10764 {
10765 if (HasQuantity())
10766 {
10767 float energy_0to1 = GetCompEM().GetEnergy0To1();
10768 SetQuantityNormalized(energy_0to1);
10769 }
10770 }
10771 }
10772
10773 //----------------------------------------------------------------
10774 float GetHeatIsolationInit()
10775 {
10776 return ConfigGetFloat("heatIsolation");
10777 }
10778
10779 float GetHeatIsolation()
10780 {
10781 return m_HeatIsolation;
10782 }
10783
10784 float GetDryingIncrement(string pIncrementName)
10785 {
10786 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
10787 if (GetGame().ConfigIsExisting(paramPath))
10788 return GetGame().ConfigGetFloat(paramPath);
10789
10790 return 0.0;
10791 }
10792
10793 float GetSoakingIncrement(string pIncrementName)
10794 {
10795 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
10796 if (GetGame().ConfigIsExisting(paramPath))
10797 return GetGame().ConfigGetFloat(paramPath);
10798
10799 return 0.0;
10800 }
10801 //----------------------------------------------------------------
10802 override void SetWet(float value, bool allow_client = false)
10803 {
10804 if (!IsServerCheck(allow_client))
10805 return;
10806
10807 float min = GetWetMin();
10808 float max = GetWetMax();
10809
10810 float previousValue = m_VarWet;
10811
10812 m_VarWet = Math.Clamp(value, min, max);
10813
10814 if (previousValue != m_VarWet)
10815 {
10816 SetVariableMask(VARIABLE_WET);
10817 OnWetChanged(m_VarWet, previousValue);
10818 }
10819 }
10820 //----------------------------------------------------------------
10821 override void AddWet(float value)
10822 {
10823 SetWet(GetWet() + value);
10824 }
10825 //----------------------------------------------------------------
10826 override void SetWetMax()
10827 {
10829 }
10830 //----------------------------------------------------------------
10831 override float GetWet()
10832 {
10833 return m_VarWet;
10834 }
10835 //----------------------------------------------------------------
10836 override float GetWetMax()
10837 {
10838 return m_VarWetMax;
10839 }
10840 //----------------------------------------------------------------
10841 override float GetWetMin()
10842 {
10843 return m_VarWetMin;
10844 }
10845 //----------------------------------------------------------------
10846 override float GetWetInit()
10847 {
10848 return m_VarWetInit;
10849 }
10850 //----------------------------------------------------------------
10851 override void OnWetChanged(float newVal, float oldVal)
10852 {
10853 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
10854 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
10855 if (newLevel != oldLevel)
10856 {
10857 OnWetLevelChanged(newLevel,oldLevel);
10858 }
10859 }
10860
10861 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
10862 {
10863 SetWeightDirty();
10864 }
10865
10866 override EWetnessLevel GetWetLevel()
10867 {
10868 return GetWetLevelInternal(m_VarWet);
10869 }
10870
10871 //----------------------------------------------------------------
10872
10873 override void SetStoreLoad(bool value)
10874 {
10875 m_IsStoreLoad = value;
10876 }
10877
10878 override bool IsStoreLoad()
10879 {
10880 return m_IsStoreLoad;
10881 }
10882
10883 override void SetStoreLoadedQuantity(float value)
10884 {
10885 m_StoreLoadedQuantity = value;
10886 }
10887
10888 override float GetStoreLoadedQuantity()
10889 {
10890 return m_StoreLoadedQuantity;
10891 }
10892
10893 //----------------------------------------------------------------
10894
10895 float GetItemModelLength()
10896 {
10897 if (ConfigIsExisting("itemModelLength"))
10898 {
10899 return ConfigGetFloat("itemModelLength");
10900 }
10901 return 0;
10902 }
10903
10904 float GetItemAttachOffset()
10905 {
10906 if (ConfigIsExisting("itemAttachOffset"))
10907 {
10908 return ConfigGetFloat("itemAttachOffset");
10909 }
10910 return 0;
10911 }
10912
10913 override void SetCleanness(int value, bool allow_client = false)
10914 {
10915 if (!IsServerCheck(allow_client))
10916 return;
10917
10918 int previousValue = m_Cleanness;
10919
10920 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
10921
10922 if (previousValue != m_Cleanness)
10923 SetVariableMask(VARIABLE_CLEANNESS);
10924 }
10925
10926 override int GetCleanness()
10927 {
10928 return m_Cleanness;
10929 }
10930
10932 {
10933 return true;
10934 }
10935
10936 //----------------------------------------------------------------
10937 // ATTACHMENT LOCKING
10938 // Getters relevant to generic ActionLockAttachment
10939 int GetLockType()
10940 {
10941 return m_LockType;
10942 }
10943
10944 string GetLockSoundSet()
10945 {
10946 return m_LockSoundSet;
10947 }
10948
10949 //----------------------------------------------------------------
10950 //------------------------- Color
10951 // sets items color variable given color components
10952 override void SetColor(int r, int g, int b, int a)
10953 {
10958 SetVariableMask(VARIABLE_COLOR);
10959 }
10961 override void GetColor(out int r,out int g,out int b,out int a)
10962 {
10967 }
10968
10969 bool IsColorSet()
10970 {
10971 return IsVariableSet(VARIABLE_COLOR);
10972 }
10973
10975 string GetColorString()
10976 {
10977 int r,g,b,a;
10978 GetColor(r,g,b,a);
10979 r = r/255;
10980 g = g/255;
10981 b = b/255;
10982 a = a/255;
10983 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10984 }
10985 //----------------------------------------------------------------
10986 //------------------------- LiquidType
10987
10988 override void SetLiquidType(int value, bool allow_client = false)
10989 {
10990 if (!IsServerCheck(allow_client))
10991 return;
10992
10993 int old = m_VarLiquidType;
10994 m_VarLiquidType = value;
10995 OnLiquidTypeChanged(old,value);
10996 SetVariableMask(VARIABLE_LIQUIDTYPE);
10997 }
10998
10999 int GetLiquidTypeInit()
11000 {
11001 return ConfigGetInt("varLiquidTypeInit");
11002 }
11003
11004 override int GetLiquidType()
11005 {
11006 return m_VarLiquidType;
11007 }
11008
11009 protected void OnLiquidTypeChanged(int oldType, int newType)
11010 {
11011 if (newType == LIQUID_NONE && GetIsFrozen())
11012 SetFrozen(false);
11013 }
11014
11016 void UpdateQuickbarShortcutVisibility(PlayerBase player)
11017 {
11018 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11019 }
11020
11021 // -------------------------------------------------------------------------
11023 void OnInventoryEnter(Man player)
11024 {
11025 PlayerBase nplayer;
11026 if (PlayerBase.CastTo(nplayer, player))
11027 {
11028 m_CanPlayImpactSound = true;
11029 //nplayer.OnItemInventoryEnter(this);
11030 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11031 }
11032 }
11033
11034 // -------------------------------------------------------------------------
11036 void OnInventoryExit(Man player)
11037 {
11038 PlayerBase nplayer;
11039 if (PlayerBase.CastTo(nplayer,player))
11040 {
11041 //nplayer.OnItemInventoryExit(this);
11042 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11043
11044 }
11045
11046 //if (!GetGame().IsDedicatedServer())
11047 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11048
11049
11050 if (HasEnergyManager())
11051 {
11052 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
11053 }
11054 }
11055
11056 // ADVANCED PLACEMENT EVENTS
11057 override void OnPlacementStarted(Man player)
11058 {
11059 super.OnPlacementStarted(player);
11060
11061 SetTakeable(false);
11062 }
11063
11064 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
11065 {
11066 if (m_AdminLog)
11067 {
11068 m_AdminLog.OnPlacementComplete(player, this);
11069 }
11070
11071 super.OnPlacementComplete(player, position, orientation);
11072 }
11073
11074 //-----------------------------
11075 // AGENT SYSTEM
11076 //-----------------------------
11077 //--------------------------------------------------------------------------
11078 bool ContainsAgent(int agent_id)
11079 {
11080 if (agent_id & m_AttachedAgents)
11081 {
11082 return true;
11083 }
11084 else
11085 {
11086 return false;
11087 }
11088 }
11089
11090 //--------------------------------------------------------------------------
11091 override void RemoveAgent(int agent_id)
11092 {
11093 if (ContainsAgent(agent_id))
11094 {
11095 m_AttachedAgents = ~agent_id & m_AttachedAgents;
11096 }
11097 }
11098
11099 //--------------------------------------------------------------------------
11100 override void RemoveAllAgents()
11101 {
11102 m_AttachedAgents = 0;
11103 }
11104 //--------------------------------------------------------------------------
11105 override void RemoveAllAgentsExcept(int agent_to_keep)
11106 {
11107 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
11108 }
11109 // -------------------------------------------------------------------------
11110 override void InsertAgent(int agent, float count = 1)
11111 {
11112 if (count < 1)
11113 return;
11114 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
11116 }
11117
11119 void TransferAgents(int agents)
11120 {
11122 }
11123
11124 // -------------------------------------------------------------------------
11125 override int GetAgents()
11126 {
11127 return m_AttachedAgents;
11128 }
11129 //----------------------------------------------------------------------
11130
11131 /*int GetContaminationType()
11132 {
11133 int contamination_type;
11134
11135 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
11136 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
11137 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
11138 const int DIRTY_MASK = eAgents.WOUND_AGENT;
11139
11140 Edible_Base edible = Edible_Base.Cast(this);
11141 int agents = GetAgents();
11142 if (edible)
11143 {
11144 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
11145 if (profile)
11146 {
11147 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
11148 }
11149 }
11150 if (agents & CONTAMINATED_MASK)
11151 {
11152 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
11153 }
11154 if (agents & POISONED_MASK)
11155 {
11156 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
11157 }
11158 if (agents & NERVE_GAS_MASK)
11159 {
11160 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
11161 }
11162 if (agents & DIRTY_MASK)
11163 {
11164 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
11165 }
11166
11167 return agents;
11168 }*/
11169
11170 // -------------------------------------------------------------------------
11171 bool LoadAgents(ParamsReadContext ctx, int version)
11172 {
11173 if (!ctx.Read(m_AttachedAgents))
11174 return false;
11175 return true;
11176 }
11177 // -------------------------------------------------------------------------
11179 {
11180
11182 }
11183 // -------------------------------------------------------------------------
11184
11186 override void CheckForRoofLimited(float timeTresholdMS = 3000)
11187 {
11188 super.CheckForRoofLimited(timeTresholdMS);
11189
11190 float time = GetGame().GetTime();
11191 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11192 {
11193 m_PreviousRoofTestTime = time;
11194 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11195 }
11196 }
11197
11198 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
11199 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
11200 {
11201 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
11202 {
11203 return 0;
11204 }
11205
11206 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
11207 {
11208 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
11209 if (filter)
11210 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
11211 else
11212 return 0;//otherwise return 0 when no filter attached
11213 }
11214
11215 string subclassPath, entryName;
11216
11217 switch (type)
11218 {
11219 case DEF_BIOLOGICAL:
11220 entryName = "biological";
11221 break;
11222 case DEF_CHEMICAL:
11223 entryName = "chemical";
11224 break;
11225 default:
11226 entryName = "biological";
11227 break;
11228 }
11229
11230 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
11231
11232 return GetGame().ConfigGetFloat(subclassPath + entryName);
11233 }
11234
11235
11236
11238 override void EEOnCECreate()
11239 {
11240 if (!IsMagazine())
11242
11244 }
11245
11246
11247 //-------------------------
11248 // OPEN/CLOSE USER ACTIONS
11249 //-------------------------
11251 void Open();
11252 void Close();
11253 bool IsOpen()
11254 {
11255 return true;
11256 }
11257
11258 override bool CanDisplayCargo()
11259 {
11260 return IsOpen();
11261 }
11262
11263
11264 // ------------------------------------------------------------
11265 // CONDITIONS
11266 // ------------------------------------------------------------
11267 override bool CanPutInCargo(EntityAI parent)
11268 {
11269 if (parent)
11270 {
11271 if (parent.IsInherited(DayZInfected))
11272 return true;
11273
11274 if (!parent.IsRuined())
11275 return true;
11276 }
11277
11278 return true;
11279 }
11280
11281 override bool CanPutAsAttachment(EntityAI parent)
11282 {
11283 if (!super.CanPutAsAttachment(parent))
11284 {
11285 return false;
11286 }
11287
11288 if (!IsRuined() && !parent.IsRuined())
11289 {
11290 return true;
11291 }
11292
11293 return false;
11294 }
11295
11296 override bool CanReceiveItemIntoCargo(EntityAI item)
11297 {
11298 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11299 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11300 // return false;
11301
11302 return super.CanReceiveItemIntoCargo(item);
11303 }
11304
11305 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
11306 {
11307 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11308 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11309 // return false;
11310
11311 GameInventory attachmentInv = attachment.GetInventory();
11312 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11313 {
11314 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11315 return false;
11316 }
11317
11318 InventoryLocation loc = new InventoryLocation();
11319 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11320 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
11321 return false;
11322
11323 return super.CanReceiveAttachment(attachment, slotId);
11324 }
11325
11326 override bool CanReleaseAttachment(EntityAI attachment)
11327 {
11328 if (!super.CanReleaseAttachment(attachment))
11329 return false;
11330
11331 return GetInventory().AreChildrenAccessible();
11332 }
11333
11334 /*override bool CanLoadAttachment(EntityAI attachment)
11335 {
11336 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11337 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11338 // return false;
11339
11340 GameInventory attachmentInv = attachment.GetInventory();
11341 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11342 {
11343 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
11344 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
11345
11346 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11347 return false;
11348 }
11349
11350 return super.CanLoadAttachment(attachment);
11351 }*/
11352
11353 // Plays muzzle flash particle effects
11354 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11355 {
11356 int id = muzzle_owner.GetMuzzleID();
11357 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
11358
11359 if (WPOF_array)
11360 {
11361 for (int i = 0; i < WPOF_array.Count(); i++)
11362 {
11363 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11364
11365 if (WPOF)
11366 {
11367 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11368 }
11369 }
11370 }
11371 }
11372
11373 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
11374 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11375 {
11376 int id = muzzle_owner.GetMuzzleID();
11377 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
11378
11379 if (WPOBE_array)
11380 {
11381 for (int i = 0; i < WPOBE_array.Count(); i++)
11382 {
11383 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11384
11385 if (WPOBE)
11386 {
11387 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11388 }
11389 }
11390 }
11391 }
11392
11393 // Plays all weapon overheating particles
11394 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11395 {
11396 int id = muzzle_owner.GetMuzzleID();
11397 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11398
11399 if (WPOOH_array)
11400 {
11401 for (int i = 0; i < WPOOH_array.Count(); i++)
11402 {
11403 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11404
11405 if (WPOOH)
11406 {
11407 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11408 }
11409 }
11410 }
11411 }
11412
11413 // Updates all weapon overheating particles
11414 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11415 {
11416 int id = muzzle_owner.GetMuzzleID();
11417 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11418
11419 if (WPOOH_array)
11420 {
11421 for (int i = 0; i < WPOOH_array.Count(); i++)
11422 {
11423 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11424
11425 if (WPOOH)
11426 {
11427 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11428 }
11429 }
11430 }
11431 }
11432
11433 // Stops overheating particles
11434 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11435 {
11436 int id = muzzle_owner.GetMuzzleID();
11437 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11438
11439 if (WPOOH_array)
11440 {
11441 for (int i = 0; i < WPOOH_array.Count(); i++)
11442 {
11443 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11444
11445 if (WPOOH)
11446 {
11447 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11448 }
11449 }
11450 }
11451 }
11452
11453 //----------------------------------------------------------------
11454 //Item Behaviour - unified approach
11455 override bool IsHeavyBehaviour()
11456 {
11457 if (m_ItemBehaviour == 0)
11458 {
11459 return true;
11460 }
11461
11462 return false;
11463 }
11464
11465 override bool IsOneHandedBehaviour()
11466 {
11467 if (m_ItemBehaviour == 1)
11468 {
11469 return true;
11470 }
11471
11472 return false;
11473 }
11474
11475 override bool IsTwoHandedBehaviour()
11476 {
11477 if (m_ItemBehaviour == 2)
11478 {
11479 return true;
11480 }
11481
11482 return false;
11483 }
11484
11485 bool IsDeployable()
11486 {
11487 return false;
11488 }
11489
11491 float GetDeployTime()
11492 {
11493 return UATimeSpent.DEFAULT_DEPLOY;
11494 }
11495
11496
11497 //----------------------------------------------------------------
11498 // Item Targeting (User Actions)
11499 override void SetTakeable(bool pState)
11500 {
11501 m_IsTakeable = pState;
11502 SetSynchDirty();
11503 }
11504
11505 override bool IsTakeable()
11506 {
11507 return m_IsTakeable;
11508 }
11509
11510 // For cases where we want to show object widget which cant be taken to hands
11512 {
11513 return false;
11514 }
11515
11517 protected void PreLoadSoundAttachmentType()
11518 {
11519 string att_type = "None";
11520
11521 if (ConfigIsExisting("soundAttType"))
11522 {
11523 att_type = ConfigGetString("soundAttType");
11524 }
11525
11526 m_SoundAttType = att_type;
11527 }
11528
11529 override string GetAttachmentSoundType()
11530 {
11531 return m_SoundAttType;
11532 }
11533
11534 //----------------------------------------------------------------
11535 //SOUNDS - ItemSoundHandler
11536 //----------------------------------------------------------------
11537
11538 string GetPlaceSoundset(); // played when deploy starts
11539 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
11540 string GetDeploySoundset(); // played when deploy sucessfully finishes
11541 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
11542 string GetFoldSoundset(); // played when fold sucessfully finishes
11543
11545 {
11546 if (!m_ItemSoundHandler)
11548
11549 return m_ItemSoundHandler;
11550 }
11551
11552 // override to initialize sounds
11553 protected void InitItemSounds()
11554 {
11555 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
11556 return;
11557
11559
11560 if (GetPlaceSoundset() != string.Empty)
11561 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
11562
11563 if (GetDeploySoundset() != string.Empty)
11564 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
11565
11566 SoundParameters params = new SoundParameters();
11567 params.m_Loop = true;
11568 if (GetLoopDeploySoundset() != string.Empty)
11569 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
11570 }
11571
11572 // Start sound using ItemSoundHandler
11573 void StartItemSoundServer(int id)
11574 {
11575 if (!GetGame().IsServer())
11576 return;
11577
11578 m_SoundSyncPlay = id;
11579 SetSynchDirty();
11580
11581 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
11583 }
11584
11585 // Stop sound using ItemSoundHandler
11586 void StopItemSoundServer(int id)
11587 {
11588 if (!GetGame().IsServer())
11589 return;
11590
11591 m_SoundSyncStop = id;
11592 SetSynchDirty();
11593
11594 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
11596 }
11597
11598 protected void ClearStartItemSoundServer()
11599 {
11600 m_SoundSyncPlay = 0;
11601 }
11602
11603 protected void ClearStopItemSoundServer()
11604 {
11605 m_SoundSyncStop = 0;
11606 }
11607
11609 void PlayAttachSound(string slot_type)
11610 {
11611 if (!GetGame().IsDedicatedServer())
11612 {
11613 if (ConfigIsExisting("attachSoundSet"))
11614 {
11615 string cfg_path = "";
11616 string soundset = "";
11617 string type_name = GetType();
11618
11619 TStringArray cfg_soundset_array = new TStringArray;
11620 TStringArray cfg_slot_array = new TStringArray;
11621 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11622 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11623
11624 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11625 {
11626 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11627 {
11628 if (cfg_slot_array[i] == slot_type)
11629 {
11630 soundset = cfg_soundset_array[i];
11631 break;
11632 }
11633 }
11634 }
11635
11636 if (soundset != "")
11637 {
11638 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
11639 sound.SetAutodestroy(true);
11640 }
11641 }
11642 }
11643 }
11644
11645 void PlayDetachSound(string slot_type)
11646 {
11647 //TODO - evaluate if needed and devise universal config structure if so
11648 }
11649
11650 void OnApply(PlayerBase player);
11651
11653 {
11654 return 1.0;
11655 };
11656 //returns applicable selection
11657 array<string> GetHeadHidingSelection()
11658 {
11660 }
11661
11663 {
11665 }
11666
11667 WrittenNoteData GetWrittenNoteData() {};
11668
11670 {
11671 SetDynamicPhysicsLifeTime(0.01);
11672 m_ItemBeingDroppedPhys = false;
11673 }
11674
11676 {
11677 array<string> zone_names = new array<string>;
11678 GetDamageZones(zone_names);
11679 for (int i = 0; i < zone_names.Count(); i++)
11680 {
11681 SetHealthMax(zone_names.Get(i),"Health");
11682 }
11683 SetHealthMax("","Health");
11684 }
11685
11687 void SetZoneDamageCEInit()
11688 {
11689 float global_health = GetHealth01("","Health");
11690 array<string> zones = new array<string>;
11691 GetDamageZones(zones);
11692 //set damage of all zones to match global health level
11693 for (int i = 0; i < zones.Count(); i++)
11694 {
11695 SetHealth01(zones.Get(i),"Health",global_health);
11696 }
11697 }
11698
11700 bool IsCoverFaceForShave(string slot_name)
11701 {
11702 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11703 }
11704
11705 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11706 {
11707 if (!hasRootAsPlayer)
11708 {
11709 if (refParentIB)
11710 {
11711 // parent is wet
11712 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
11713 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11714 // parent has liquid inside
11715 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
11716 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11717 // drying
11718 else if (m_VarWet > m_VarWetMin)
11719 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
11720 }
11721 else
11722 {
11723 // drying on ground or inside non-itembase (car, ...)
11724 if (m_VarWet > m_VarWetMin)
11725 AddWet(-1 * delta * GetDryingIncrement("ground"));
11726 }
11727 }
11728 }
11729
11730 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11731 {
11733 {
11734 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
11735 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11736 {
11737 float heatPermCoef = 1.0;
11738 EntityAI ent = this;
11739 while (ent)
11740 {
11741 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11742 ent = ent.GetHierarchyParent();
11743 }
11744
11745 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11746 }
11747 }
11748 }
11749
11750 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
11751 {
11752 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
11753 EntityAI parent = GetHierarchyParent();
11754 if (!parent)
11755 {
11756 hasParent = false;
11757 hasRootAsPlayer = false;
11758 }
11759 else
11760 {
11761 hasParent = true;
11762 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11763 refParentIB = ItemBase.Cast(parent);
11764 }
11765 }
11766
11767 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
11768 {
11769 // this is stub, implemented on Edible_Base
11770 }
11771
11772 bool CanDecay()
11773 {
11774 // return true used on selected food clases so they can decay
11775 return false;
11776 }
11777
11778 protected bool CanProcessDecay()
11779 {
11780 // this is stub, implemented on Edible_Base class
11781 // used to determine whether it is still necessary for the food to decay
11782 return false;
11783 }
11784
11785 protected bool CanHaveWetness()
11786 {
11787 // return true used on selected items that have a wetness effect
11788 return false;
11789 }
11790
11792 bool CanBeConsumed(ConsumeConditionData data = null)
11793 {
11794 return !GetIsFrozen() && IsOpen();
11795 }
11796
11797 override void ProcessVariables()
11798 {
11799 bool hasParent = false, hasRootAsPlayer = false;
11800 ItemBase refParentIB;
11801
11802 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
11803 bool foodDecay = g_Game.IsFoodDecayEnabled();
11804
11805 if (wwtu || foodDecay)
11806 {
11807 bool processWetness = wwtu && CanHaveWetness();
11808 bool processTemperature = wwtu && CanHaveTemperature();
11809 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
11810
11811 if (processWetness || processTemperature || processDecay)
11812 {
11813 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
11814
11815 if (processWetness)
11816 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11817
11818 if (processTemperature)
11819 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11820
11821 if (processDecay)
11822 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11823 }
11824 }
11825 }
11826
11829 {
11830 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
11831 }
11832
11833 override float GetTemperatureFreezeThreshold()
11834 {
11836 return Liquid.GetFreezeThreshold(GetLiquidType());
11837
11838 return super.GetTemperatureFreezeThreshold();
11839 }
11840
11841 override float GetTemperatureThawThreshold()
11842 {
11844 return Liquid.GetThawThreshold(GetLiquidType());
11845
11846 return super.GetTemperatureThawThreshold();
11847 }
11848
11849 override float GetItemOverheatThreshold()
11850 {
11852 return Liquid.GetBoilThreshold(GetLiquidType());
11853
11854 return super.GetItemOverheatThreshold();
11855 }
11856
11857 override float GetTemperatureFreezeTime()
11858 {
11859 if (HasQuantity())
11860 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
11861
11862 return super.GetTemperatureFreezeTime();
11863 }
11864
11865 override float GetTemperatureThawTime()
11866 {
11867 if (HasQuantity())
11868 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
11869
11870 return super.GetTemperatureThawTime();
11871 }
11872
11874 void AffectLiquidContainerOnFill(int liquid_type, float amount);
11876 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
11877
11878 bool IsCargoException4x3(EntityAI item)
11879 {
11880 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11881 }
11882
11884 {
11885 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11886 }
11887
11889 void AddLightSourceItem(ItemBase lightsource)
11890 {
11891 m_LightSourceItem = lightsource;
11892 }
11893
11895 {
11896 m_LightSourceItem = null;
11897 }
11898
11900 {
11901 return m_LightSourceItem;
11902 }
11903
11905 array<int> GetValidFinishers()
11906 {
11907 return null;
11908 }
11909
11911 bool GetActionWidgetOverride(out typename name)
11912 {
11913 return false;
11914 }
11915
11916 bool PairWithDevice(notnull ItemBase otherDevice)
11917 {
11918 if (GetGame().IsServer())
11919 {
11920 ItemBase explosive = otherDevice;
11922 if (!trg)
11923 {
11924 trg = RemoteDetonatorTrigger.Cast(otherDevice);
11925 explosive = this;
11926 }
11927
11928 explosive.PairRemote(trg);
11929 trg.SetControlledDevice(explosive);
11930
11931 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11932 trg.SetPersistentPairID(persistentID);
11933 explosive.SetPersistentPairID(persistentID);
11934
11935 return true;
11936 }
11937 return false;
11938 }
11939
11941 float GetBaitEffectivity()
11942 {
11943 float ret = 1.0;
11944 if (HasQuantity())
11945 ret *= GetQuantityNormalized();
11946 ret *= GetHealth01();
11947
11948 return ret;
11949 }
11950
11951 #ifdef DEVELOPER
11952 override void SetDebugItem()
11953 {
11954 super.SetDebugItem();
11955 _itemBase = this;
11956 }
11957
11958 override string GetDebugText()
11959 {
11960 string text = super.GetDebugText();
11961
11962 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
11963 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
11964
11965 return text;
11966 }
11967 #endif
11968
11969 bool CanBeUsedForSuicide()
11970 {
11971 return true;
11972 }
11973
11975 //DEPRECATED BELOW
11977 // Backwards compatibility
11978 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11979 {
11980 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
11981 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
11982 }
11983
11984 // replaced by ItemSoundHandler
11985 protected EffectSound m_SoundDeployFinish;
11986 protected EffectSound m_SoundPlace;
11987 protected EffectSound m_DeployLoopSoundEx;
11988 protected EffectSound m_SoundDeploy;
11989 bool m_IsPlaceSound;
11990 bool m_IsDeploySound;
11992
11993 string GetDeployFinishSoundset();
11994 void PlayDeploySound();
11995 void PlayDeployFinishSound();
11996 void PlayPlaceSound();
11997 void PlayDeployLoopSoundEx();
11998 void StopDeployLoopSoundEx();
11999 void SoundSynchRemoteReset();
12000 void SoundSynchRemote();
12001 bool UsesGlobalDeploy(){return false;}
12002 bool CanPlayDeployLoopSound(){return false;}
12004 bool IsPlaceSound(){return m_IsPlaceSound;}
12005 bool IsDeploySound(){return m_IsDeploySound;}
12006 void SetIsPlaceSound(bool is_place_sound);
12007 void SetIsDeploySound(bool is_deploy_sound);
12008}
12009
12010EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
12011{
12012 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
12013 if (entity)
12014 {
12015 bool is_item = entity.IsInherited(ItemBase);
12016 if (is_item && full_quantity)
12017 {
12018 ItemBase item = ItemBase.Cast(entity);
12019 item.SetQuantity(item.GetQuantityInit());
12020 }
12021 }
12022 else
12023 {
12024 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
12025 return NULL;
12026 }
12027 return entity;
12028}
12029
12030void SetupSpawnedItem(ItemBase item, float health, float quantity)
12031{
12032 if (item)
12033 {
12034 if (health > 0)
12035 item.SetHealth("", "", health);
12036
12037 if (item.CanHaveTemperature())
12038 {
12039 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
12040 if (item.CanFreeze())
12041 item.SetFrozen(false);
12042 }
12043
12044 if (item.HasEnergyManager())
12045 {
12046 if (quantity >= 0)
12047 {
12048 item.GetCompEM().SetEnergy0To1(quantity);
12049 }
12050 else
12051 {
12052 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
12053 }
12054 }
12055 else if (item.IsMagazine())
12056 {
12057 Magazine mag = Magazine.Cast(item);
12058 if (quantity >= 0)
12059 {
12060 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12061 }
12062 else
12063 {
12064 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
12065 }
12066
12067 }
12068 else
12069 {
12070 if (quantity >= 0)
12071 {
12072 item.SetQuantityNormalized(quantity, false);
12073 }
12074 else
12075 {
12076 item.SetQuantity(Math.AbsFloat(quantity));
12077 }
12078
12079 }
12080 }
12081}
12082
12083#ifdef DEVELOPER
12084ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
12085#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
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
int GetLiquidType()
Определения CCTWaterSurface.c:129
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
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
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
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
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:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
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:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
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:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
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:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override 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:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
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:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
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:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
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:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
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()
Определения 3_Game/Entities/Man.c:44
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
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 string GetFoldSoundset()
Определения BaseBuildingBase.c:108
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:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
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()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
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:1238
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:489
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:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
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:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
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:1032
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()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
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
Определения 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)
Определения 3_Game/tools/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
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
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:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
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
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()