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

◆ SetResultOfSplit()

void SpawnItemOnLocation::SetResultOfSplit ( bool value)
private

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

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

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