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

◆ IsResultOfSplit()

bool SpawnItemOnLocation::IsResultOfSplit ( )
private

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

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