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

◆ OnAttachmentQuantityChangedEx()

void SpawnItemOnLocation::OnAttachmentQuantityChangedEx ( ItemBase item,
float delta )
private

Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChanged(item); first when overriding this event.

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

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