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

◆ ComputeQuantityUsedEx()

float SpawnItemOnLocation::ComputeQuantityUsedEx ( ItemBase other_item,
bool use_stack_max = true )
private

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

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

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