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

◆ GetDebugActions()

override void SpawnItemOnLocation::GetDebugActions ( out TSelectableActionInfoArrayEx outputList)
private

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

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