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

◆ IsCombineAll()

bool SpawnItemOnLocation::IsCombineAll ( ItemBase other_item,
bool use_stack_max = false )
private

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

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