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

◆ OnCombine()

void SpawnItemOnLocation::OnCombine ( ItemBase other_item)
private

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

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