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

◆ GetRecipesActions()

void SpawnItemOnLocation::GetRecipesActions ( Man player,
out TSelectableActionInfoArray outputList )
private

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

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