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

◆ CombineItemsEx()

override void SpawnItemOnLocation::CombineItemsEx ( EntityAI entity2,
bool use_stack_max = true )
private

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

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