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

◆ IsResultOfSplit()

bool SpawnItemOnLocation::IsResultOfSplit ( )
protected

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

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

Используется в InventoryItem::EEHealthLevelChanged().