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

◆ OnStoreLoad()

override bool SpawnItemOnLocation::OnStoreLoad ( ParamsReadContext ctx,
int version )
private

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

7794{
7795 override bool CanPutAsAttachment(EntityAI parent)
7796 {
7797 return true;
7798 }
7799};
7800
7801//const bool QUANTITY_DEBUG_REMOVE_ME = false;
7802
7803class ItemBase extends InventoryItem
7804{
7808
7810
7811 static int m_DebugActionsMask;
7813 // ============================================
7814 // Variable Manipulation System
7815 // ============================================
7816 // Quantity
7817
7818 float m_VarQuantity;
7819 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
7821 int m_VarQuantityMin;
7822 int m_VarQuantityMax;
7823 int m_Count;
7824 float m_VarStackMax;
7825 float m_StoreLoadedQuantity = float.LOWEST;
7826 // Wet
7827 float m_VarWet;
7828 float m_VarWetPrev;//for client to know wetness changed during synchronization
7829 float m_VarWetInit;
7830 float m_VarWetMin;
7831 float m_VarWetMax;
7832 // Cleanness
7833 int m_Cleanness;
7834 int m_CleannessInit;
7835 int m_CleannessMin;
7836 int m_CleannessMax;
7837 // impact sounds
7839 bool m_CanPlayImpactSound = true;
7840 float m_ImpactSpeed;
7842 //
7843 float m_HeatIsolation;
7844 float m_ItemModelLength;
7845 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
7847 int m_VarLiquidType;
7848 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
7849 int m_QuickBarBonus;
7850 bool m_IsBeingPlaced;
7851 bool m_IsHologram;
7852 bool m_IsTakeable;
7853 bool m_ThrowItemOnDrop;
7856 bool m_FixDamageSystemInit = false; //can be changed on storage version check
7857 bool can_this_be_combined; //Check if item can be combined
7858 bool m_CanThisBeSplit; //Check if item can be split
7859 bool m_IsStoreLoad = false;
7860 bool m_CanShowQuantity;
7861 bool m_HasQuantityBar;
7862 protected bool m_CanBeDigged;
7863 protected bool m_IsResultOfSplit
7864
7865 string m_SoundAttType;
7866 // items color variables
7871 //-------------------------------------------------------
7872
7873 // light source managing
7875
7879
7880 //==============================================
7881 // agent system
7882 private int m_AttachedAgents;
7883
7885 void TransferModifiers(PlayerBase reciever);
7886
7887
7888 // Weapons & suppressors particle effects
7893 static int m_LastRegisteredWeaponID = 0;
7894
7895 // Overheating effects
7897 float m_OverheatingShots;
7898 ref Timer m_CheckOverheating;
7899 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
7900 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
7901 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
7902 ref array <ref OverheatingParticle> m_OverheatingParticles;
7903
7905 protected bool m_HideSelectionsBySlot;
7906
7907 // Admin Log
7908 PluginAdminLog m_AdminLog;
7909
7910 // misc
7911 ref Timer m_PhysDropTimer;
7912
7913 // Attachment Locking variables
7914 ref array<int> m_CompatibleLocks;
7915 protected int m_LockType;
7916 protected ref EffectSound m_LockingSound;
7917 protected string m_LockSoundSet;
7918
7919 // ItemSoundHandler
7920 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
7921 protected int m_SoundSyncPlay; // id for sound to play
7922 protected int m_SoundSyncStop; // id for sound to stop
7924
7925 //temperature
7926 private float m_TemperaturePerQuantityWeight;
7927
7928 // -------------------------------------------------------------------------
7929 void ItemBase()
7930 {
7931 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
7935
7936 if (!GetGame().IsDedicatedServer())
7937 {
7938 if (HasMuzzle())
7939 {
7941
7943 {
7945 }
7946 }
7947
7949 m_ActionsInitialize = false;
7950 }
7951
7952 m_OldLocation = null;
7953
7954 if (GetGame().IsServer())
7955 {
7956 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
7957 }
7958
7959 if (ConfigIsExisting("headSelectionsToHide"))
7960 {
7962 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
7963 }
7964
7965 m_HideSelectionsBySlot = false;
7966 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7967 {
7968 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
7969 }
7970
7971 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
7972
7973 m_IsResultOfSplit = false;
7974
7976 }
7977
7978 override void InitItemVariables()
7979 {
7980 super.InitItemVariables();
7981
7982 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
7983 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
7984 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
7985 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
7986 m_VarStackMax = ConfigGetFloat("varStackMax");
7987 m_Count = ConfigGetInt("count");
7988
7989 m_CanShowQuantity = ConfigGetBool("quantityShow");
7990 m_HasQuantityBar = ConfigGetBool("quantityBar");
7991
7992 m_CleannessInit = ConfigGetInt("varCleannessInit");
7994 m_CleannessMin = ConfigGetInt("varCleannessMin");
7995 m_CleannessMax = ConfigGetInt("varCleannessMax");
7996
7997 m_WantPlayImpactSound = false;
7998 m_ImpactSpeed = 0.0;
7999
8000 m_VarWetInit = ConfigGetFloat("varWetInit");
8002 m_VarWetMin = ConfigGetFloat("varWetMin");
8003 m_VarWetMax = ConfigGetFloat("varWetMax");
8004
8005 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8006 if (IsLiquidContainer() && GetQuantity() != 0)
8008 m_IsBeingPlaced = false;
8009 m_IsHologram = false;
8010 m_IsTakeable = true;
8011 m_CanBeMovedOverride = false;
8015 m_CanBeDigged = ConfigGetBool("canBeDigged");
8016
8017 m_CompatibleLocks = new array<int>();
8018 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8019 m_LockType = ConfigGetInt("lockType");
8020
8021 //Define if item can be split and set ability to be combined accordingly
8022 m_CanThisBeSplit = false;
8023 can_this_be_combined = false;
8024 if (ConfigIsExisting("canBeSplit"))
8025 {
8026 can_this_be_combined = ConfigGetBool("canBeSplit");
8028 }
8029
8030 m_ItemBehaviour = -1;
8031 if (ConfigIsExisting("itemBehaviour"))
8032 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8033
8034 //RegisterNetSyncVariableInt("m_VariablesMask");
8035 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8036 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8037 RegisterNetSyncVariableInt("m_VarLiquidType");
8038 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8039
8040 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8041 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8042 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8043
8044 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8045 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8046 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8047 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8048
8049 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8050 RegisterNetSyncVariableBool("m_IsTakeable");
8051 RegisterNetSyncVariableBool("m_IsHologram");
8052
8053 InitItemSounds();
8055 {
8056 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8057 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8058 }
8059
8060 m_LockSoundSet = ConfigGetString("lockSoundSet");
8061
8063 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8064 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8065
8066 }
8067
8068 override int GetQuickBarBonus()
8069 {
8070 return m_QuickBarBonus;
8071 }
8072
8073 void InitializeActions()
8074 {
8076 if (!m_InputActionMap)
8077 {
8079 m_InputActionMap = iam;
8080 SetActions();
8082 }
8083 }
8084
8085 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8086 {
8088 {
8089 m_ActionsInitialize = true;
8091 }
8092
8093 actions = m_InputActionMap.Get(action_input_type);
8094 }
8095
8096 void SetActions()
8097 {
8098 AddAction(ActionTakeItem);
8099 AddAction(ActionTakeItemToHands);
8100 AddAction(ActionWorldCraft);
8102 AddAction(ActionAttachWithSwitch);
8103 }
8104
8105 void SetActionAnimOverrides(); // Override action animation for specific item
8106
8107 void AddAction(typename actionName)
8108 {
8109 ActionBase action = ActionManagerBase.GetAction(actionName);
8110
8111 if (!action)
8112 {
8113 Debug.LogError("Action " + actionName + " dosn't exist!");
8114 return;
8115 }
8116
8117 typename ai = action.GetInputType();
8118 if (!ai)
8119 {
8120 m_ActionsInitialize = false;
8121 return;
8122 }
8123
8124 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8125 if (!action_array)
8126 {
8127 action_array = new array<ActionBase_Basic>;
8128 m_InputActionMap.Insert(ai, action_array);
8129 }
8130 if (LogManager.IsActionLogEnable())
8131 {
8132 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8133 }
8134
8135 if (action_array.Find(action) != -1)
8136 {
8137 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8138 }
8139 else
8140 {
8141 action_array.Insert(action);
8142 }
8143 }
8144
8145 void RemoveAction(typename actionName)
8146 {
8147 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8148 ActionBase action = player.GetActionManager().GetAction(actionName);
8149 typename ai = action.GetInputType();
8150 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8151
8152 if (action_array)
8153 {
8154 action_array.RemoveItem(action);
8155 }
8156 }
8157
8158 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8159 // Set -1 for params which should stay in default state
8160 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8161 {
8162 ActionOverrideData overrideData = new ActionOverrideData();
8163 overrideData.m_CommandUID = commandUID;
8164 overrideData.m_CommandUIDProne = commandUIDProne;
8165 overrideData.m_StanceMask = stanceMask;
8166
8167 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8168 if (!actionMap) // create new map of action > overidables map
8169 {
8170 actionMap = new TActionAnimOverrideMap();
8171 m_ItemActionOverrides.Insert(action, actionMap);
8172 }
8173
8174 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8175
8176 }
8177
8178 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8179
8180 ScriptedLightBase GetLight();
8181
8182 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8183 void LoadParticleConfigOnFire(int id)
8184 {
8185 if (!m_OnFireEffect)
8187
8190
8191 string config_to_search = "CfgVehicles";
8192 string muzzle_owner_config;
8193
8194 if (!m_OnFireEffect.Contains(id))
8195 {
8196 if (IsInherited(Weapon))
8197 config_to_search = "CfgWeapons";
8198
8199 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8200
8201 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8202
8203 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8204
8205 if (config_OnFire_subclass_count > 0)
8206 {
8207 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8208
8209 for (int i = 0; i < config_OnFire_subclass_count; i++)
8210 {
8211 string particle_class = "";
8212 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8213 string config_OnFire_entry = config_OnFire_class + particle_class;
8214 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8215 WPOF_array.Insert(WPOF);
8216 }
8217
8218
8219 m_OnFireEffect.Insert(id, WPOF_array);
8220 }
8221 }
8222
8223 if (!m_OnBulletCasingEjectEffect.Contains(id))
8224 {
8225 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8226 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8227
8228 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8229
8230 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8231
8232 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8233 {
8234 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8235
8236 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8237 {
8238 string particle_class2 = "";
8239 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8240 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8241 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8242 WPOBE_array.Insert(WPOBE);
8243 }
8244
8245
8246 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
8247 }
8248 }
8249 }
8250
8251 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8253 {
8256
8257 if (!m_OnOverheatingEffect.Contains(id))
8258 {
8259 string config_to_search = "CfgVehicles";
8260
8261 if (IsInherited(Weapon))
8262 config_to_search = "CfgWeapons";
8263
8264 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
8265 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8266
8267 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
8268 {
8269
8270 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
8271
8273 {
8274 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
8275 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8276 Error(error);
8277 return;
8278 }
8279
8280 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
8281 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
8282
8283
8284
8285 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
8286 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8287
8288 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8289 {
8290 string particle_class = "";
8291 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8292 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8293 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8294
8295 if (entry_type == CT_CLASS)
8296 {
8297 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8298 WPOOH_array.Insert(WPOF);
8299 }
8300 }
8301
8302
8303 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8304 }
8305 }
8306 }
8307
8308 float GetOverheatingValue()
8309 {
8310 return m_OverheatingShots;
8311 }
8312
8313 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8314 {
8315 if (m_MaxOverheatingValue > 0)
8316 {
8318
8319 if (!m_CheckOverheating)
8321
8323 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8324
8325 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8326 }
8327 }
8328
8329 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8330 {
8332 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8333
8335 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8336
8338 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8339
8341 {
8343 }
8344 }
8345
8347 {
8349 }
8350
8351 void OnOverheatingDecay()
8352 {
8353 if (m_MaxOverheatingValue > 0)
8354 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8355 else
8357
8358 if (m_OverheatingShots <= 0)
8359 {
8362 }
8363 else
8364 {
8365 if (!m_CheckOverheating)
8367
8369 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8370 }
8371
8372 CheckOverheating(this, "", this);
8373 }
8374
8375 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8376 {
8378 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8379 }
8380
8381 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8382 {
8384 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8386 }
8387
8388 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8389 {
8391 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8392 }
8393
8394 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8395 {
8397 m_OverheatingParticles = new array<ref OverheatingParticle>;
8398
8399 OverheatingParticle OP = new OverheatingParticle();
8400 OP.RegisterParticle(p);
8401 OP.SetOverheatingLimitMin(min_heat_coef);
8402 OP.SetOverheatingLimitMax(max_heat_coef);
8403 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8404
8405 m_OverheatingParticles.Insert(OP);
8406 }
8407
8408 float GetOverheatingCoef()
8409 {
8410 if (m_MaxOverheatingValue > 0)
8412
8413 return -1;
8414 }
8415
8417 {
8419 {
8420 float overheat_coef = GetOverheatingCoef();
8421 int count = m_OverheatingParticles.Count();
8422
8423 for (int i = count; i > 0; --i)
8424 {
8425 int id = i - 1;
8426 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8427 Particle p = OP.GetParticle();
8428
8429 float overheat_min = OP.GetOverheatingLimitMin();
8430 float overheat_max = OP.GetOverheatingLimitMax();
8431
8432 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8433 {
8434 if (p)
8435 {
8436 p.Stop();
8437 OP.RegisterParticle(null);
8438 }
8439 }
8440 }
8441 }
8442 }
8443
8445 {
8447 {
8448 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8449 {
8450 int id = i - 1;
8451 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8452
8453 if (OP)
8454 {
8455 Particle p = OP.GetParticle();
8456
8457 if (p)
8458 {
8459 p.Stop();
8460 }
8461
8462 delete OP;
8463 }
8464 }
8465
8466 m_OverheatingParticles.Clear();
8468 }
8469 }
8470
8472 float GetInfectionChance(int system = 0, Param param = null)
8473 {
8474 return 0.0;
8475 }
8476
8477
8478 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8479 {
8480 return 250;//default value
8481 }
8482
8483 float GetFilterDamageRatio()
8484 {
8485 return 0;
8486 }
8487
8489 bool HasMuzzle()
8490 {
8491 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8492 return true;
8493
8494 return false;
8495 }
8496
8498 int GetMuzzleID()
8499 {
8500 if (!m_WeaponTypeToID)
8502
8503 if (m_WeaponTypeToID.Contains(GetType()))
8504 {
8505 return m_WeaponTypeToID.Get(GetType());
8506 }
8507 else
8508 {
8509 // Register new weapon ID
8511 }
8512
8514 }
8515
8522 {
8523 return -1;
8524 }
8525
8526
8527
8528 // -------------------------------------------------------------------------
8529 void ~ItemBase()
8530 {
8531 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
8532 {
8533 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8534 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8535
8536 if (r_index >= 0)
8537 {
8538 InventoryLocation r_il = new InventoryLocation;
8539 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8540
8541 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8542 int r_type = r_il.GetType();
8543 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8544 {
8545 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8546 }
8547 else if (r_type == InventoryLocationType.ATTACHMENT)
8548 {
8549 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8550 }
8551
8552 }
8553
8554 player.GetHumanInventory().ClearUserReservedLocation(this);
8555 }
8556
8557 if (m_LockingSound)
8558 SEffectManager.DestroyEffect(m_LockingSound);
8559 }
8560
8561
8562
8563 // -------------------------------------------------------------------------
8564 static int GetDebugActionsMask()
8565 {
8566 return ItemBase.m_DebugActionsMask;
8567 }
8568
8569 static bool HasDebugActionsMask(int mask)
8570 {
8571 return ItemBase.m_DebugActionsMask & mask;
8572 }
8573
8574 static void SetDebugActionsMask(int mask)
8575 {
8576 ItemBase.m_DebugActionsMask = mask;
8577 }
8578
8579 static void AddDebugActionsMask(int mask)
8580 {
8581 ItemBase.m_DebugActionsMask |= mask;
8582 }
8583
8584 static void RemoveDebugActionsMask(int mask)
8585 {
8586 ItemBase.m_DebugActionsMask &= ~mask;
8587 }
8588
8589 static void ToggleDebugActionsMask(int mask)
8590 {
8591 if (HasDebugActionsMask(mask))
8592 {
8594 }
8595 else
8596 {
8597 AddDebugActionsMask(mask);
8598 }
8599 }
8600
8601 // -------------------------------------------------------------------------
8602 void SetCEBasedQuantity()
8603 {
8604 if (GetEconomyProfile())
8605 {
8606 float q_max = GetEconomyProfile().GetQuantityMax();
8607 if (q_max > 0)
8608 {
8609 float q_min = GetEconomyProfile().GetQuantityMin();
8610 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8611
8612 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
8613 {
8614 ComponentEnergyManager comp = GetCompEM();
8615 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
8616 {
8617 comp.SetEnergy0To1(quantity_randomized);
8618 }
8619 }
8620 else if (HasQuantity())
8621 {
8622 SetQuantityNormalized(quantity_randomized, false);
8623 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
8624 }
8625
8626 }
8627 }
8628 }
8629
8631 void LockToParent()
8632 {
8633 EntityAI parent = GetHierarchyParent();
8634
8635 if (parent)
8636 {
8637 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8638 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8639 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
8640 }
8641 }
8642
8644 void UnlockFromParent()
8645 {
8646 EntityAI parent = GetHierarchyParent();
8647
8648 if (parent)
8649 {
8650 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8651 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8652 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
8653 }
8654 }
8655
8656 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
8657 {
8658 /*
8659 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
8660 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
8661 */
8662 ItemBase item2 = ItemBase.Cast(entity2);
8663
8664 if (GetGame().IsClient())
8665 {
8666 if (ScriptInputUserData.CanStoreInputUserData())
8667 {
8668 ScriptInputUserData ctx = new ScriptInputUserData;
8670 ctx.Write(-1);
8671 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8672 ctx.Write(i1);
8673 ctx.Write(item2);
8674 ctx.Write(use_stack_max);
8675 ctx.Write(-1);
8676 ctx.Send();
8677
8678 if (IsCombineAll(item2, use_stack_max))
8679 {
8680 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8681 }
8682 }
8683 }
8684 else if (!GetGame().IsMultiplayer())
8685 {
8686 CombineItems(item2, use_stack_max);
8687 }
8688 }
8689
8690 bool IsLiquidPresent()
8691 {
8692 return (GetLiquidType() != 0 && HasQuantity());
8693 }
8694
8695 bool IsLiquidContainer()
8696 {
8697 return m_LiquidContainerMask != 0;
8698 }
8699
8701 {
8702 return m_LiquidContainerMask;
8703 }
8704
8705 bool IsBloodContainer()
8706 {
8707 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
8708 return false;
8709 }
8710
8711 bool IsNVG()
8712 {
8713 return false;
8714 }
8715
8718 bool IsExplosive()
8719 {
8720 return false;
8721 }
8722
8724 {
8725 return "";
8726 }
8727
8729
8730 bool IsLightSource()
8731 {
8732 return false;
8733 }
8734
8736 {
8737 return true;
8738 }
8739
8740 //--- ACTION CONDITIONS
8741 //direction
8742 bool IsFacingPlayer(PlayerBase player, string selection)
8743 {
8744 return true;
8745 }
8746
8747 bool IsPlayerInside(PlayerBase player, string selection)
8748 {
8749 return true;
8750 }
8751
8752 override bool CanObstruct()
8753 {
8754 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
8755 return !player || !IsPlayerInside(player, "");
8756 }
8757
8758 override bool IsBeingPlaced()
8759 {
8760 return m_IsBeingPlaced;
8761 }
8762
8763 void SetIsBeingPlaced(bool is_being_placed)
8764 {
8765 m_IsBeingPlaced = is_being_placed;
8766 if (!is_being_placed)
8768 SetSynchDirty();
8769 }
8770
8771 //server-side
8772 void OnEndPlacement() {}
8773
8774 override bool IsHologram()
8775 {
8776 return m_IsHologram;
8777 }
8778
8779 bool CanBeDigged()
8780 {
8781 return m_CanBeDigged;
8782 }
8783
8785 {
8786 return 1;
8787 }
8788
8789 bool CanMakeGardenplot()
8790 {
8791 return false;
8792 }
8793
8794 void SetIsHologram(bool is_hologram)
8795 {
8796 m_IsHologram = is_hologram;
8797 SetSynchDirty();
8798 }
8799 /*
8800 protected float GetNutritionalEnergy()
8801 {
8802 Edible_Base edible = Edible_Base.Cast(this);
8803 return edible.GetFoodEnergy();
8804 }
8805
8806 protected float GetNutritionalWaterContent()
8807 {
8808 Edible_Base edible = Edible_Base.Cast(this);
8809 return edible.GetFoodWater();
8810 }
8811
8812 protected float GetNutritionalIndex()
8813 {
8814 Edible_Base edible = Edible_Base.Cast(this);
8815 return edible.GetFoodNutritionalIndex();
8816 }
8817
8818 protected float GetNutritionalFullnessIndex()
8819 {
8820 Edible_Base edible = Edible_Base.Cast(this);
8821 return edible.GetFoodTotalVolume();
8822 }
8823
8824 protected float GetNutritionalToxicity()
8825 {
8826 Edible_Base edible = Edible_Base.Cast(this);
8827 return edible.GetFoodToxicity();
8828
8829 }
8830 */
8831
8832
8833 // -------------------------------------------------------------------------
8834 override void OnMovedInsideCargo(EntityAI container)
8835 {
8836 super.OnMovedInsideCargo(container);
8837
8838 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8839 }
8840
8841 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8842 {
8843 super.EEItemLocationChanged(oldLoc,newLoc);
8844
8845 PlayerBase new_player = null;
8846 PlayerBase old_player = null;
8847
8848 if (newLoc.GetParent())
8849 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8850
8851 if (oldLoc.GetParent())
8852 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8853
8854 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
8855 {
8856 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8857
8858 if (r_index >= 0)
8859 {
8860 InventoryLocation r_il = new InventoryLocation;
8861 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8862
8863 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8864 int r_type = r_il.GetType();
8865 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8866 {
8867 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8868 }
8869 else if (r_type == InventoryLocationType.ATTACHMENT)
8870 {
8871 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8872 }
8873
8874 }
8875 }
8876
8877 if (newLoc.GetType() == InventoryLocationType.HANDS)
8878 {
8879 if (new_player)
8880 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8881
8882 if (new_player == old_player)
8883 {
8884
8885 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8886 {
8887 if (oldLoc.GetType() == InventoryLocationType.CARGO)
8888 {
8889 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8890 {
8891 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8892 }
8893 }
8894 else
8895 {
8896 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8897 }
8898 }
8899
8900 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8901 {
8902 int type = oldLoc.GetType();
8903 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
8904 {
8905 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8906 }
8907 else if (type == InventoryLocationType.ATTACHMENT)
8908 {
8909 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8910 }
8911 }
8912 if (!m_OldLocation)
8913 {
8914 m_OldLocation = new InventoryLocation;
8915 }
8916 m_OldLocation.Copy(oldLoc);
8917 }
8918 else
8919 {
8920 if (m_OldLocation)
8921 {
8922 m_OldLocation.Reset();
8923 }
8924 }
8925
8927 }
8928 else
8929 {
8930 if (new_player)
8931 {
8932 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8933 if (res_index >= 0)
8934 {
8935 InventoryLocation il = new InventoryLocation;
8936 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8937 ItemBase it = ItemBase.Cast(il.GetItem());
8938 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8939 int rel_type = il.GetType();
8940 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
8941 {
8942 il.GetParent().GetOnReleaseLock().Invoke(it);
8943 }
8944 else if (rel_type == InventoryLocationType.ATTACHMENT)
8945 {
8946 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
8947 }
8948 //it.GetOnReleaseLock().Invoke(it);
8949 }
8950 }
8951 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
8952 {
8953 //ThrowPhysically(old_player, vector.Zero);
8954 m_ThrowItemOnDrop = false;
8955 }
8956
8957 if (m_OldLocation)
8958 {
8959 m_OldLocation.Reset();
8960 }
8961 }
8962 }
8963
8964 override void EOnContact(IEntity other, Contact extra)
8965 {
8967 {
8968 int liquidType = -1;
8969 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
8970 if (impactSpeed > 0.0)
8971 {
8972 m_ImpactSpeed = impactSpeed;
8973 #ifndef SERVER
8974 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8975 #else
8976 m_WantPlayImpactSound = true;
8977 SetSynchDirty();
8978 #endif
8979 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
8980 }
8981 }
8982
8983 #ifdef SERVER
8984 if (GetCompEM() && GetCompEM().IsPlugged())
8985 {
8986 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
8987 GetCompEM().UnplugThis();
8988 }
8989 #endif
8990 }
8991
8992 void RefreshPhysics();
8993
8994 override void OnCreatePhysics()
8995 {
8997 }
8998
8999 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9000 {
9001
9002 }
9003 // -------------------------------------------------------------------------
9004 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9005 {
9006 super.OnItemLocationChanged(old_owner, new_owner);
9007
9008 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9009 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9010
9011 if (!relatedPlayer && playerNew)
9012 relatedPlayer = playerNew;
9013
9014 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9015 {
9016 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9017 if (actionMgr)
9018 {
9019 ActionBase currentAction = actionMgr.GetRunningAction();
9020 if (currentAction)
9021 currentAction.OnItemLocationChanged(this);
9022 }
9023 }
9024
9025 Man ownerPlayerOld = null;
9026 Man ownerPlayerNew = null;
9027
9028 if (old_owner)
9029 {
9030 if (old_owner.IsMan())
9031 {
9032 ownerPlayerOld = Man.Cast(old_owner);
9033 }
9034 else
9035 {
9036 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9037 }
9038 }
9039 else
9040 {
9041 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9042 {
9043 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9044
9045 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9046 {
9047 GetCompEM().UnplugThis();
9048 }
9049 }
9050 }
9051
9052 if (new_owner)
9053 {
9054 if (new_owner.IsMan())
9055 {
9056 ownerPlayerNew = Man.Cast(new_owner);
9057 }
9058 else
9059 {
9060 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9061 }
9062 }
9063
9064 if (ownerPlayerOld != ownerPlayerNew)
9065 {
9066 if (ownerPlayerOld)
9067 {
9068 array<EntityAI> subItemsExit = new array<EntityAI>;
9069 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9070 for (int i = 0; i < subItemsExit.Count(); i++)
9071 {
9072 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9073 itemExit.OnInventoryExit(ownerPlayerOld);
9074 }
9075 }
9076
9077 if (ownerPlayerNew)
9078 {
9079 array<EntityAI> subItemsEnter = new array<EntityAI>;
9080 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9081 for (int j = 0; j < subItemsEnter.Count(); j++)
9082 {
9083 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9084 itemEnter.OnInventoryEnter(ownerPlayerNew);
9085 }
9086 }
9087 }
9088 else if (ownerPlayerNew != null)
9089 {
9090 PlayerBase nplayer;
9091 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9092 {
9093 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9094 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9095 for (int k = 0; k < subItemsUpdate.Count(); k++)
9096 {
9097 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9098 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9099 }
9100 }
9101 }
9102
9103 if (old_owner)
9104 old_owner.OnChildItemRemoved(this);
9105 if (new_owner)
9106 new_owner.OnChildItemReceived(this);
9107 }
9108
9109 // -------------------------------------------------------------------------------
9110 override void EEDelete(EntityAI parent)
9111 {
9112 super.EEDelete(parent);
9113 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9114 if (player)
9115 {
9116 OnInventoryExit(player);
9117
9118 if (player.IsAlive())
9119 {
9120 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9121 if (r_index >= 0)
9122 {
9123 InventoryLocation r_il = new InventoryLocation;
9124 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9125
9126 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9127 int r_type = r_il.GetType();
9128 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9129 {
9130 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9131 }
9132 else if (r_type == InventoryLocationType.ATTACHMENT)
9133 {
9134 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9135 }
9136
9137 }
9138
9139 player.RemoveQuickBarEntityShortcut(this);
9140 }
9141 }
9142 }
9143 // -------------------------------------------------------------------------------
9144 override void EEKilled(Object killer)
9145 {
9146 super.EEKilled(killer);
9147
9149 if (killer && killer.IsFireplace() && CanExplodeInFire())
9150 {
9151 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9152 {
9153 if (IsMagazine())
9154 {
9155 if (Magazine.Cast(this).GetAmmoCount() > 0)
9156 {
9157 ExplodeAmmo();
9158 }
9159 }
9160 else
9161 {
9162 Explode(DamageType.EXPLOSION);
9163 }
9164 }
9165 }
9166 }
9167
9168 override void OnWasAttached(EntityAI parent, int slot_id)
9169 {
9170 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9171
9172 super.OnWasAttached(parent, slot_id);
9173
9174 if (HasQuantity())
9175 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9176
9177 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9178 }
9179
9180 override void OnWasDetached(EntityAI parent, int slot_id)
9181 {
9182 super.OnWasDetached(parent, slot_id);
9183
9184 if (HasQuantity())
9185 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9186 }
9187
9188 override string ChangeIntoOnAttach(string slot)
9189 {
9190 int idx;
9191 TStringArray inventory_slots = new TStringArray;
9192 TStringArray attach_types = new TStringArray;
9193
9194 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9195 if (inventory_slots.Count() < 1) //is string
9196 {
9197 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9198 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9199 }
9200 else //is array
9201 {
9202 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9203 }
9204
9205 idx = inventory_slots.Find(slot);
9206 if (idx < 0)
9207 return "";
9208
9209 return attach_types.Get(idx);
9210 }
9211
9212 override string ChangeIntoOnDetach()
9213 {
9214 int idx = -1;
9215 string slot;
9216
9217 TStringArray inventory_slots = new TStringArray;
9218 TStringArray detach_types = new TStringArray;
9219
9220 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9221 if (inventory_slots.Count() < 1) //is string
9222 {
9223 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9224 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9225 }
9226 else //is array
9227 {
9228 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9229 if (detach_types.Count() < 1)
9230 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9231 }
9232
9233 for (int i = 0; i < inventory_slots.Count(); i++)
9234 {
9235 slot = inventory_slots.Get(i);
9236 }
9237
9238 if (slot != "")
9239 {
9240 if (detach_types.Count() == 1)
9241 idx = 0;
9242 else
9243 idx = inventory_slots.Find(slot);
9244 }
9245 if (idx < 0)
9246 return "";
9247
9248 return detach_types.Get(idx);
9249 }
9250
9251 void ExplodeAmmo()
9252 {
9253 //timer
9254 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
9255
9256 //min/max time
9257 float min_time = 1;
9258 float max_time = 3;
9259 float delay = Math.RandomFloat(min_time, max_time);
9260
9261 explode_timer.Run(delay, this, "DoAmmoExplosion");
9262 }
9263
9264 void DoAmmoExplosion()
9265 {
9266 Magazine magazine = Magazine.Cast(this);
9267 int pop_sounds_count = 6;
9268 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9269
9270 //play sound
9271 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9272 string sound_name = pop_sounds[ sound_idx ];
9273 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
9274
9275 //remove ammo count
9276 magazine.ServerAddAmmoCount(-1);
9277
9278 //if condition then repeat -> ExplodeAmmo
9279 float min_temp_to_explode = 100; //min temperature for item to explode
9280
9281 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
9282 {
9283 ExplodeAmmo();
9284 }
9285 }
9286
9287 // -------------------------------------------------------------------------------
9288 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9289 {
9290 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9291
9292 const int CHANCE_DAMAGE_CARGO = 4;
9293 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9294 const int CHANCE_DAMAGE_NOTHING = 2;
9295
9296 if (IsClothing() || IsContainer() || IsItemTent())
9297 {
9298 float dmg = damageResult.GetDamage("","Health") * -0.5;
9299 int chances;
9300 int rnd;
9301
9302 if (GetInventory().GetCargo())
9303 {
9304 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9305 rnd = Math.RandomInt(0,chances);
9306
9307 if (rnd < CHANCE_DAMAGE_CARGO)
9308 {
9309 DamageItemInCargo(dmg);
9310 }
9311 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9312 {
9314 }
9315 }
9316 else
9317 {
9318 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9319 rnd = Math.RandomInt(0,chances);
9320
9321 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9322 {
9324 }
9325 }
9326 }
9327 }
9328
9329 bool DamageItemInCargo(float damage)
9330 {
9331 if (GetInventory().GetCargo())
9332 {
9333 int item_count = GetInventory().GetCargo().GetItemCount();
9334 if (item_count > 0)
9335 {
9336 int random_pick = Math.RandomInt(0, item_count);
9337 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9338 if (!item.IsExplosive())
9339 {
9340 item.AddHealth("","",damage);
9341 return true;
9342 }
9343 }
9344 }
9345 return false;
9346 }
9347
9348 bool DamageItemAttachments(float damage)
9349 {
9350 int attachment_count = GetInventory().AttachmentCount();
9351 if (attachment_count > 0)
9352 {
9353 int random_pick = Math.RandomInt(0, attachment_count);
9354 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9355 if (!attachment.IsExplosive())
9356 {
9357 attachment.AddHealth("","",damage);
9358 return true;
9359 }
9360 }
9361 return false;
9362 }
9363
9364 override bool IsSplitable()
9365 {
9366 return m_CanThisBeSplit;
9367 }
9368 //----------------
9369 override bool CanBeSplit()
9370 {
9371 if (IsSplitable() && (GetQuantity() > 1))
9372 return GetInventory().CanRemoveEntity();
9373
9374 return false;
9375 }
9376
9377 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9378 {
9379 if (!CanBeSplit())
9380 return;
9381
9382 if (GetGame().IsClient())
9383 {
9384 if (ScriptInputUserData.CanStoreInputUserData())
9385 {
9386 ScriptInputUserData ctx = new ScriptInputUserData;
9388 ctx.Write(1);
9389 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9390 ctx.Write(i1);
9391 ctx.Write(destination_entity);
9392 ctx.Write(true);
9393 ctx.Write(slot_id);
9394 ctx.Send();
9395 }
9396 }
9397 else if (!GetGame().IsMultiplayer())
9398 {
9399 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9400 }
9401 }
9402
9403 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9404 {
9405 if (!CanBeSplit())
9406 return;
9407
9408 float split_quantity_new;
9409 ref ItemBase new_item;
9410 float quantity = GetQuantity();
9411 float stack_max = GetTargetQuantityMax(slot_id);
9412 InventoryLocation loc = new InventoryLocation;
9413
9414 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9415 {
9416 if (stack_max <= GetQuantity())
9417 split_quantity_new = stack_max;
9418 else
9419 split_quantity_new = GetQuantity();
9420
9421 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9422 if (new_item)
9423 {
9424 new_item.SetResultOfSplit(true);
9425 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9426 AddQuantity(-split_quantity_new);
9427 new_item.SetQuantity(split_quantity_new);
9428 }
9429 }
9430 else if (destination_entity && slot_id == -1)
9431 {
9432 if (quantity > stack_max)
9433 split_quantity_new = stack_max;
9434 else
9435 split_quantity_new = quantity;
9436
9437 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9438 {
9439 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9440 new_item = ItemBase.Cast(o);
9441 }
9442
9443 if (new_item)
9444 {
9445 new_item.SetResultOfSplit(true);
9446 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9447 AddQuantity(-split_quantity_new);
9448 new_item.SetQuantity(split_quantity_new);
9449 }
9450 }
9451 else
9452 {
9453 if (stack_max != 0)
9454 {
9455 if (stack_max < GetQuantity())
9456 {
9457 split_quantity_new = GetQuantity() - stack_max;
9458 }
9459
9460 if (split_quantity_new == 0)
9461 {
9462 if (!GetGame().IsMultiplayer())
9463 player.PhysicalPredictiveDropItem(this);
9464 else
9465 player.ServerDropEntity(this);
9466 return;
9467 }
9468
9469 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9470
9471 if (new_item)
9472 {
9473 new_item.SetResultOfSplit(true);
9474 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9475 SetQuantity(split_quantity_new);
9476 new_item.SetQuantity(stack_max);
9477 new_item.PlaceOnSurface();
9478 }
9479 }
9480 }
9481 }
9482
9483 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9484 {
9485 if (!CanBeSplit())
9486 return;
9487
9488 float split_quantity_new;
9489 ref ItemBase new_item;
9490 float quantity = GetQuantity();
9491 float stack_max = GetTargetQuantityMax(slot_id);
9492 InventoryLocation loc = new InventoryLocation;
9493
9494 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9495 {
9496 if (stack_max <= GetQuantity())
9497 split_quantity_new = stack_max;
9498 else
9499 split_quantity_new = GetQuantity();
9500
9501 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9502 if (new_item)
9503 {
9504 new_item.SetResultOfSplit(true);
9505 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9506 AddQuantity(-split_quantity_new);
9507 new_item.SetQuantity(split_quantity_new);
9508 }
9509 }
9510 else if (destination_entity && slot_id == -1)
9511 {
9512 if (quantity > stack_max)
9513 split_quantity_new = stack_max;
9514 else
9515 split_quantity_new = quantity;
9516
9517 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9518 {
9519 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9520 new_item = ItemBase.Cast(o);
9521 }
9522
9523 if (new_item)
9524 {
9525 new_item.SetResultOfSplit(true);
9526 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9527 AddQuantity(-split_quantity_new);
9528 new_item.SetQuantity(split_quantity_new);
9529 }
9530 }
9531 else
9532 {
9533 if (stack_max != 0)
9534 {
9535 if (stack_max < GetQuantity())
9536 {
9537 split_quantity_new = GetQuantity() - stack_max;
9538 }
9539
9540 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9541
9542 if (new_item)
9543 {
9544 new_item.SetResultOfSplit(true);
9545 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9546 SetQuantity(split_quantity_new);
9547 new_item.SetQuantity(stack_max);
9548 new_item.PlaceOnSurface();
9549 }
9550 }
9551 }
9552 }
9553
9554 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
9555 {
9556 if (!CanBeSplit())
9557 return;
9558
9559 if (GetGame().IsClient())
9560 {
9561 if (ScriptInputUserData.CanStoreInputUserData())
9562 {
9563 ScriptInputUserData ctx = new ScriptInputUserData;
9565 ctx.Write(4);
9566 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9567 ctx.Write(thiz);
9568 dst.WriteToContext(ctx);
9569 ctx.Send();
9570 }
9571 }
9572 else if (!GetGame().IsMultiplayer())
9573 {
9575 }
9576 }
9577
9578 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
9579 {
9580 if (!CanBeSplit())
9581 return;
9582
9583 if (GetGame().IsClient())
9584 {
9585 if (ScriptInputUserData.CanStoreInputUserData())
9586 {
9587 ScriptInputUserData ctx = new ScriptInputUserData;
9589 ctx.Write(2);
9590 ItemBase dummy = this; // @NOTE: workaround for correct serialization
9591 ctx.Write(dummy);
9592 ctx.Write(destination_entity);
9593 ctx.Write(true);
9594 ctx.Write(idx);
9595 ctx.Write(row);
9596 ctx.Write(col);
9597 ctx.Send();
9598 }
9599 }
9600 else if (!GetGame().IsMultiplayer())
9601 {
9602 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
9603 }
9604 }
9605
9606 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
9607 {
9609 }
9610
9611 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
9612 {
9613 if (!CanBeSplit())
9614 return this;
9615
9616 float quantity = GetQuantity();
9617 float split_quantity_new;
9618 ItemBase new_item;
9619 if (dst.IsValid())
9620 {
9621 int slot_id = dst.GetSlot();
9622 float stack_max = GetTargetQuantityMax(slot_id);
9623
9624 if (quantity > stack_max)
9625 split_quantity_new = stack_max;
9626 else
9627 split_quantity_new = quantity;
9628
9629 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9630
9631 if (new_item)
9632 {
9633 new_item.SetResultOfSplit(true);
9634 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9635 AddQuantity(-split_quantity_new);
9636 new_item.SetQuantity(split_quantity_new);
9637 }
9638
9639 return new_item;
9640 }
9641
9642 return null;
9643 }
9644
9645 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
9646 {
9647 if (!CanBeSplit())
9648 return;
9649
9650 float quantity = GetQuantity();
9651 float split_quantity_new;
9652 ref ItemBase new_item;
9653 if (destination_entity)
9654 {
9655 float stackable = GetTargetQuantityMax();
9656 if (quantity > stackable)
9657 split_quantity_new = stackable;
9658 else
9659 split_quantity_new = quantity;
9660
9661 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
9662 if (new_item)
9663 {
9664 new_item.SetResultOfSplit(true);
9665 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9666 AddQuantity(-split_quantity_new);
9667 new_item.SetQuantity(split_quantity_new);
9668 }
9669 }
9670 }
9671
9672 void SplitIntoStackMaxHandsClient(PlayerBase player)
9673 {
9674 if (!CanBeSplit())
9675 return;
9676
9677 if (GetGame().IsClient())
9678 {
9679 if (ScriptInputUserData.CanStoreInputUserData())
9680 {
9681 ScriptInputUserData ctx = new ScriptInputUserData;
9683 ctx.Write(3);
9684 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9685 ctx.Write(i1);
9686 ItemBase destination_entity = this;
9687 ctx.Write(destination_entity);
9688 ctx.Write(true);
9689 ctx.Write(0);
9690 ctx.Send();
9691 }
9692 }
9693 else if (!GetGame().IsMultiplayer())
9694 {
9695 SplitIntoStackMaxHands(player);
9696 }
9697 }
9698
9699 void SplitIntoStackMaxHands(PlayerBase player)
9700 {
9701 if (!CanBeSplit())
9702 return;
9703
9704 float quantity = GetQuantity();
9705 float split_quantity_new;
9706 ref ItemBase new_item;
9707 if (player)
9708 {
9709 float stackable = GetTargetQuantityMax();
9710 if (quantity > stackable)
9711 split_quantity_new = stackable;
9712 else
9713 split_quantity_new = quantity;
9714
9715 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
9716 new_item = ItemBase.Cast(in_hands);
9717 if (new_item)
9718 {
9719 new_item.SetResultOfSplit(true);
9720 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9721 AddQuantity(-split_quantity_new);
9722 new_item.SetQuantity(split_quantity_new);
9723 }
9724 }
9725 }
9726
9727 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
9728 {
9729 if (!CanBeSplit())
9730 return;
9731
9732 float quantity = GetQuantity();
9733 float split_quantity_new = Math.Floor(quantity * 0.5);
9734
9735 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9736
9737 if (new_item)
9738 {
9739 if (new_item.GetQuantityMax() < split_quantity_new)
9740 {
9741 split_quantity_new = new_item.GetQuantityMax();
9742 }
9743
9744 new_item.SetResultOfSplit(true);
9745 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9746
9747 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9748 {
9749 AddQuantity(-1);
9750 new_item.SetQuantity(1);
9751 }
9752 else
9753 {
9754 AddQuantity(-split_quantity_new);
9755 new_item.SetQuantity(split_quantity_new);
9756 }
9757 }
9758 }
9759
9760 void SplitItem(PlayerBase player)
9761 {
9762 if (!CanBeSplit())
9763 return;
9764
9765 float quantity = GetQuantity();
9766 float split_quantity_new = Math.Floor(quantity / 2);
9767
9768 InventoryLocation invloc = new InventoryLocation;
9769 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
9770
9771 ItemBase new_item;
9772 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9773
9774 if (new_item)
9775 {
9776 if (new_item.GetQuantityMax() < split_quantity_new)
9777 {
9778 split_quantity_new = new_item.GetQuantityMax();
9779 }
9780 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9781 {
9782 AddQuantity(-1);
9783 new_item.SetQuantity(1);
9784 }
9785 else
9786 {
9787 AddQuantity(-split_quantity_new);
9788 new_item.SetQuantity(split_quantity_new);
9789 }
9790 }
9791 }
9792
9794 void OnQuantityChanged(float delta)
9795 {
9796 SetWeightDirty();
9797 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
9798
9799 if (parent)
9800 parent.OnAttachmentQuantityChangedEx(this, delta);
9801
9802 if (IsLiquidContainer())
9803 {
9804 if (GetQuantityNormalized() <= 0.0)
9805 {
9807 }
9808 else if (GetLiquidType() == LIQUID_NONE)
9809 {
9810 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
9812 }
9813 }
9814
9815 }
9816
9819 {
9820 // insert code here
9821 }
9822
9824 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
9825 {
9827 }
9828
9829 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
9830 {
9831 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9832
9833 if (GetGame().IsServer())
9834 {
9835 if (newLevel == GameConstants.STATE_RUINED)
9836 {
9838 EntityAI parent = GetHierarchyParent();
9839 if (parent && parent.IsFireplace())
9840 {
9841 CargoBase cargo = GetInventory().GetCargo();
9842 if (cargo)
9843 {
9844 for (int i = 0; i < cargo.GetItemCount(); ++i)
9845 {
9846 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
9847 }
9848 }
9849 }
9850 }
9851
9852 if (IsResultOfSplit())
9853 {
9854 // reset the splitting result flag, return to normal item behavior
9855 SetResultOfSplit(false);
9856 return;
9857 }
9858
9859 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9860 {
9861 SetCleanness(0);//unclean the item upon damage dealt
9862 }
9863 }
9864 }
9865
9866 // just the split? TODO: verify
9867 override void OnRightClick()
9868 {
9869 super.OnRightClick();
9870
9871 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
9872 {
9873 if (GetGame().IsClient())
9874 {
9875 if (ScriptInputUserData.CanStoreInputUserData())
9876 {
9877 vector m4[4];
9878 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9879
9880 EntityAI root = GetHierarchyRoot();
9881
9882 InventoryLocation dst = new InventoryLocation;
9883 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
9884 {
9885 if (root)
9886 {
9887 root.GetTransform(m4);
9888 dst.SetGround(this, m4);
9889 }
9890 else
9891 GetInventory().GetCurrentInventoryLocation(dst);
9892 }
9893 else
9894 {
9895 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
9896 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
9897 this shouldnt cause issues within this scope*/
9898 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
9899 {
9900 if (root)
9901 {
9902 root.GetTransform(m4);
9903 dst.SetGround(this, m4);
9904 }
9905 else
9906 GetInventory().GetCurrentInventoryLocation(dst);
9907 }
9908 else
9909 {
9910 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9911 }
9912 }
9913
9914 ScriptInputUserData ctx = new ScriptInputUserData;
9916 ctx.Write(4);
9917 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9918 ctx.Write(thiz);
9919 dst.WriteToContext(ctx);
9920 ctx.Write(true); // dummy
9921 ctx.Send();
9922 }
9923 }
9924 else if (!GetGame().IsMultiplayer())
9925 {
9926 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
9927 }
9928 }
9929 }
9930
9931 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
9932 {
9933 //TODO: delete check zero quantity check after fix double posts hands fsm events
9934 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
9935 return false;
9936
9937 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9938 return false;
9939
9940 //can_this_be_combined = ConfigGetBool("canBeSplit");
9942 return false;
9943
9944
9945 Magazine mag = Magazine.Cast(this);
9946 if (mag)
9947 {
9948 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9949 return false;
9950
9951 if (stack_max_limit)
9952 {
9953 Magazine other_mag = Magazine.Cast(other_item);
9954 if (other_item)
9955 {
9956 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9957 return false;
9958 }
9959
9960 }
9961 }
9962 else
9963 {
9964 //TODO: delete check zero quantity check after fix double posts hands fsm events
9965 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
9966 return false;
9967
9968 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
9969 return false;
9970 }
9971
9972 PlayerBase player = null;
9973 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
9974 {
9975 if (player.GetInventory().HasAttachment(this))
9976 return false;
9977
9978 if (player.IsItemsToDelete())
9979 return false;
9980 }
9981
9982 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9983 return false;
9984
9985 int slotID;
9986 string slotName;
9987 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9988 return false;
9989
9990 return true;
9991 }
9992
9993 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
9994 {
9995 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
9996 }
9997
9998 bool IsResultOfSplit()
9999 {
10000 return m_IsResultOfSplit;
10001 }
10002
10003 void SetResultOfSplit(bool value)
10004 {
10005 m_IsResultOfSplit = value;
10006 }
10007
10008 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10009 {
10010 return ComputeQuantityUsedEx(other_item, use_stack_max);
10011 }
10012
10013 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10014 {
10015 float other_item_quantity = other_item.GetQuantity();
10016 float this_free_space;
10017
10018 float stack_max = GetQuantityMax();
10019
10020 this_free_space = stack_max - GetQuantity();
10021
10022 if (other_item_quantity > this_free_space)
10023 {
10024 return this_free_space;
10025 }
10026 else
10027 {
10028 return other_item_quantity;
10029 }
10030 }
10031
10032 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10033 {
10034 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10035 }
10036
10037 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10038 {
10039 if (!CanBeCombined(other_item, false))
10040 return;
10041
10042 if (!IsMagazine() && other_item)
10043 {
10044 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10045 if (quantity_used != 0)
10046 {
10047 float hp1 = GetHealth01("","");
10048 float hp2 = other_item.GetHealth01("","");
10049 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10050 hpResult = hpResult / (GetQuantity() + quantity_used);
10051
10052 hpResult *= GetMaxHealth();
10053 Math.Round(hpResult);
10054 SetHealth("", "Health", hpResult);
10055
10056 AddQuantity(quantity_used);
10057 other_item.AddQuantity(-quantity_used);
10058 }
10059 }
10060 OnCombine(other_item);
10061 }
10062
10063 void OnCombine(ItemBase other_item)
10064 {
10065 #ifdef SERVER
10066 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10067 GetHierarchyParent().IncreaseLifetimeUp();
10068 #endif
10069 };
10070
10071 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10072 {
10073 PlayerBase p = PlayerBase.Cast(player);
10074
10075 array<int> recipesIds = p.m_Recipes;
10076 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10077 if (moduleRecipesManager)
10078 {
10079 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10080 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10081 }
10082
10083 for (int i = 0;i < recipesIds.Count(); i++)
10084 {
10085 int key = recipesIds.Get(i);
10086 string recipeName = moduleRecipesManager.GetRecipeName(key);
10087 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10088 }
10089 }
10090
10091 // -------------------------------------------------------------------------
10092 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10093 {
10094 super.GetDebugActions(outputList);
10095
10096 //quantity
10097 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10098 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10099 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10100 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10101
10102 //health
10103 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10104 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10105 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10106 //temperature
10107 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10108 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10109 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10110
10111 //wet
10112 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10113 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10114
10115 //liquidtype
10116 if (IsLiquidContainer())
10117 {
10118 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10119 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10120 }
10121
10122 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10123 // watch
10124 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10125 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10126
10127 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10128 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10129 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10130 }
10131
10132 // -------------------------------------------------------------------------
10133 // -------------------------------------------------------------------------
10134 // -------------------------------------------------------------------------
10135 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10136 {
10137 super.OnAction(action_id, player, ctx);
10138 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10139 {
10140 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10141 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10142 PlayerBase p = PlayerBase.Cast(player);
10143 if (EActions.RECIPES_RANGE_START < 1000)
10144 {
10145 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10146 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10147 }
10148 }
10149 #ifndef SERVER
10150 else if (action_id == EActions.WATCH_PLAYER)
10151 {
10152 PluginDeveloper.SetDeveloperItemClientEx(player);
10153 }
10154 #endif
10155 if (GetGame().IsServer())
10156 {
10157 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10158 {
10159 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10160 OnDebugButtonPressServer(id + 1);
10161 }
10162
10163 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10164 {
10165 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10166 InsertAgent(agent_id,100);
10167 }
10168
10169 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10170 {
10171 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10172 RemoveAgent(agent_id2);
10173 }
10174
10175 else if (action_id == EActions.ADD_QUANTITY)
10176 {
10177 if (IsMagazine())
10178 {
10179 Magazine mag = Magazine.Cast(this);
10180 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10181 }
10182 else
10183 {
10184 AddQuantity(GetQuantityMax() * 0.2);
10185 }
10186
10187 if (m_EM)
10188 {
10189 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10190 }
10191 //PrintVariables();
10192 }
10193
10194 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10195 {
10196 if (IsMagazine())
10197 {
10198 Magazine mag2 = Magazine.Cast(this);
10199 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10200 }
10201 else
10202 {
10203 AddQuantity(- GetQuantityMax() * 0.2);
10204 }
10205 if (m_EM)
10206 {
10207 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10208 }
10209 //PrintVariables();
10210 }
10211
10212 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10213 {
10214 SetQuantity(0);
10215
10216 if (m_EM)
10217 {
10218 m_EM.SetEnergy(0);
10219 }
10220 }
10221
10222 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10223 {
10225
10226 if (m_EM)
10227 {
10228 m_EM.SetEnergy(m_EM.GetEnergyMax());
10229 }
10230 }
10231
10232 else if (action_id == EActions.ADD_HEALTH)
10233 {
10234 AddHealth("","",GetMaxHealth("","Health")/5);
10235 }
10236 else if (action_id == EActions.REMOVE_HEALTH)
10237 {
10238 AddHealth("","",-GetMaxHealth("","Health")/5);
10239 }
10240 else if (action_id == EActions.DESTROY_HEALTH)
10241 {
10242 SetHealth01("","",0);
10243 }
10244 else if (action_id == EActions.WATCH_ITEM)
10245 {
10247 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10248 #ifdef DEVELOPER
10249 SetDebugDeveloper_item(this);
10250 #endif
10251 }
10252
10253 else if (action_id == EActions.ADD_TEMPERATURE)
10254 {
10255 AddTemperature(20);
10256 //PrintVariables();
10257 }
10258
10259 else if (action_id == EActions.REMOVE_TEMPERATURE)
10260 {
10261 AddTemperature(-20);
10262 //PrintVariables();
10263 }
10264
10265 else if (action_id == EActions.FLIP_FROZEN)
10266 {
10267 SetFrozen(!GetIsFrozen());
10268 //PrintVariables();
10269 }
10270
10271 else if (action_id == EActions.ADD_WETNESS)
10272 {
10273 AddWet(GetWetMax()/5);
10274 //PrintVariables();
10275 }
10276
10277 else if (action_id == EActions.REMOVE_WETNESS)
10278 {
10279 AddWet(-GetWetMax()/5);
10280 //PrintVariables();
10281 }
10282
10283 else if (action_id == EActions.LIQUIDTYPE_UP)
10284 {
10285 int curr_type = GetLiquidType();
10286 SetLiquidType(curr_type * 2);
10287 //AddWet(1);
10288 //PrintVariables();
10289 }
10290
10291 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10292 {
10293 int curr_type2 = GetLiquidType();
10294 SetLiquidType(curr_type2 / 2);
10295 }
10296
10297 else if (action_id == EActions.MAKE_SPECIAL)
10298 {
10299 auto debugParams = DebugSpawnParams.WithPlayer(player);
10300 OnDebugSpawnEx(debugParams);
10301 }
10302
10303 else if (action_id == EActions.DELETE)
10304 {
10305 Delete();
10306 }
10307
10308 }
10309
10310
10311 return false;
10312 }
10313
10314 // -------------------------------------------------------------------------
10315
10316
10319 void OnActivatedByTripWire();
10320
10322 void OnActivatedByItem(notnull ItemBase item);
10323
10324 //----------------------------------------------------------------
10325 //returns true if item is able to explode when put in fire
10326 bool CanExplodeInFire()
10327 {
10328 return false;
10329 }
10330
10331 //----------------------------------------------------------------
10332 bool CanEat()
10333 {
10334 return true;
10335 }
10336
10337 //----------------------------------------------------------------
10338 override bool IsIgnoredByConstruction()
10339 {
10340 return true;
10341 }
10342
10343 //----------------------------------------------------------------
10344 //has FoodStages in config?
10345 bool HasFoodStage()
10346 {
10347 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10348 return GetGame().ConfigIsExisting(config_path);
10349 }
10350
10352 FoodStage GetFoodStage()
10353 {
10354 return null;
10355 }
10356
10357 bool CanBeCooked()
10358 {
10359 return false;
10360 }
10361
10362 bool CanBeCookedOnStick()
10363 {
10364 return false;
10365 }
10366
10368 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10370
10371 //----------------------------------------------------------------
10372 bool CanRepair(ItemBase item_repair_kit)
10373 {
10374 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10375 return module_repairing.CanRepair(this, item_repair_kit);
10376 }
10377
10378 //----------------------------------------------------------------
10379 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10380 {
10381 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10382 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10383 }
10384
10385 //----------------------------------------------------------------
10386 int GetItemSize()
10387 {
10388 /*
10389 vector v_size = this.ConfigGetVector("itemSize");
10390 int v_size_x = v_size[0];
10391 int v_size_y = v_size[1];
10392 int size = v_size_x * v_size_y;
10393 return size;
10394 */
10395
10396 return 1;
10397 }
10398
10399 //----------------------------------------------------------------
10400 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10401 bool CanBeMovedOverride()
10402 {
10403 return m_CanBeMovedOverride;
10404 }
10405
10406 //----------------------------------------------------------------
10407 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10408 void SetCanBeMovedOverride(bool setting)
10409 {
10410 m_CanBeMovedOverride = setting;
10411 }
10412
10413 //----------------------------------------------------------------
10421 void MessageToOwnerStatus(string text)
10422 {
10423 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10424
10425 if (player)
10426 {
10427 player.MessageStatus(text);
10428 }
10429 }
10430
10431 //----------------------------------------------------------------
10439 void MessageToOwnerAction(string text)
10440 {
10441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10442
10443 if (player)
10444 {
10445 player.MessageAction(text);
10446 }
10447 }
10448
10449 //----------------------------------------------------------------
10457 void MessageToOwnerFriendly(string text)
10458 {
10459 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10460
10461 if (player)
10462 {
10463 player.MessageFriendly(text);
10464 }
10465 }
10466
10467 //----------------------------------------------------------------
10475 void MessageToOwnerImportant(string text)
10476 {
10477 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10478
10479 if (player)
10480 {
10481 player.MessageImportant(text);
10482 }
10483 }
10484
10485 override bool IsItemBase()
10486 {
10487 return true;
10488 }
10489
10490 // Checks if item is of questioned kind
10491 override bool KindOf(string tag)
10492 {
10493 bool found = false;
10494 string item_name = this.GetType();
10495 ref TStringArray item_tag_array = new TStringArray;
10496 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
10497
10498 int array_size = item_tag_array.Count();
10499 for (int i = 0; i < array_size; i++)
10500 {
10501 if (item_tag_array.Get(i) == tag)
10502 {
10503 found = true;
10504 break;
10505 }
10506 }
10507 return found;
10508 }
10509
10510
10511 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
10512 {
10513 //Debug.Log("OnRPC called");
10514 super.OnRPC(sender, rpc_type,ctx);
10515
10516 //Play soundset for attachment locking (ActionLockAttachment.c)
10517 switch (rpc_type)
10518 {
10519 #ifndef SERVER
10520 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10521 Param2<bool, string> p = new Param2<bool, string>(false, "");
10522
10523 if (!ctx.Read(p))
10524 return;
10525
10526 bool play = p.param1;
10527 string soundSet = p.param2;
10528
10529 if (play)
10530 {
10531 if (m_LockingSound)
10532 {
10534 {
10535 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10536 }
10537 }
10538 else
10539 {
10540 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10541 }
10542 }
10543 else
10544 {
10545 SEffectManager.DestroyEffect(m_LockingSound);
10546 }
10547
10548 break;
10549 #endif
10550
10551 }
10552
10553 if (GetWrittenNoteData())
10554 {
10555 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
10556 }
10557 }
10558
10559 //-----------------------------
10560 // VARIABLE MANIPULATION SYSTEM
10561 //-----------------------------
10562 int NameToID(string name)
10563 {
10564 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10565 return plugin.GetID(name);
10566 }
10567
10568 string IDToName(int id)
10569 {
10570 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10571 return plugin.GetName(id);
10572 }
10573
10575 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
10576 {
10577 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
10578 //read the flags
10579 int varFlags;
10580 if (!ctx.Read(varFlags))
10581 return;
10582
10583 if (varFlags & ItemVariableFlags.FLOAT)
10584 {
10585 ReadVarsFromCTX(ctx);
10586 }
10587 }
10588
10589 override void SerializeNumericalVars(array<float> floats_out)
10590 {
10591 //some variables handled on EntityAI level already!
10592 super.SerializeNumericalVars(floats_out);
10593
10594 // the order of serialization must be the same as the order of de-serialization
10595 //--------------------------------------------
10596 if (IsVariableSet(VARIABLE_QUANTITY))
10597 {
10598 floats_out.Insert(m_VarQuantity);
10599 }
10600 //--------------------------------------------
10601 if (IsVariableSet(VARIABLE_WET))
10602 {
10603 floats_out.Insert(m_VarWet);
10604 }
10605 //--------------------------------------------
10606 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10607 {
10608 floats_out.Insert(m_VarLiquidType);
10609 }
10610 //--------------------------------------------
10611 if (IsVariableSet(VARIABLE_COLOR))
10612 {
10613 floats_out.Insert(m_ColorComponentR);
10614 floats_out.Insert(m_ColorComponentG);
10615 floats_out.Insert(m_ColorComponentB);
10616 floats_out.Insert(m_ColorComponentA);
10617 }
10618 //--------------------------------------------
10619 if (IsVariableSet(VARIABLE_CLEANNESS))
10620 {
10621 floats_out.Insert(m_Cleanness);
10622 }
10623 }
10624
10625 override void DeSerializeNumericalVars(array<float> floats)
10626 {
10627 //some variables handled on EntityAI level already!
10628 super.DeSerializeNumericalVars(floats);
10629
10630 // the order of serialization must be the same as the order of de-serialization
10631 int index = 0;
10632 int mask = Math.Round(floats.Get(index));
10633
10634 index++;
10635 //--------------------------------------------
10636 if (mask & VARIABLE_QUANTITY)
10637 {
10638 if (m_IsStoreLoad)
10639 {
10640 SetStoreLoadedQuantity(floats.Get(index));
10641 }
10642 else
10643 {
10644 float quantity = floats.Get(index);
10645 SetQuantity(quantity, true, false, false, false);
10646 }
10647 index++;
10648 }
10649 //--------------------------------------------
10650 if (mask & VARIABLE_WET)
10651 {
10652 float wet = floats.Get(index);
10653 SetWet(wet);
10654 index++;
10655 }
10656 //--------------------------------------------
10657 if (mask & VARIABLE_LIQUIDTYPE)
10658 {
10659 int liquidtype = Math.Round(floats.Get(index));
10660 SetLiquidType(liquidtype);
10661 index++;
10662 }
10663 //--------------------------------------------
10664 if (mask & VARIABLE_COLOR)
10665 {
10666 m_ColorComponentR = Math.Round(floats.Get(index));
10667 index++;
10668 m_ColorComponentG = Math.Round(floats.Get(index));
10669 index++;
10670 m_ColorComponentB = Math.Round(floats.Get(index));
10671 index++;
10672 m_ColorComponentA = Math.Round(floats.Get(index));
10673 index++;
10674 }
10675 //--------------------------------------------
10676 if (mask & VARIABLE_CLEANNESS)
10677 {
10678 int cleanness = Math.Round(floats.Get(index));
10679 SetCleanness(cleanness);
10680 index++;
10681 }
10682 }
10683
10684 override void WriteVarsToCTX(ParamsWriteContext ctx)
10685 {
10686 super.WriteVarsToCTX(ctx);
10687
10688 //--------------------------------------------
10689 if (IsVariableSet(VARIABLE_QUANTITY))
10690 {
10691 ctx.Write(GetQuantity());
10692 }
10693 //--------------------------------------------
10694 if (IsVariableSet(VARIABLE_WET))
10695 {
10696 ctx.Write(GetWet());
10697 }
10698 //--------------------------------------------
10699 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10700 {
10701 ctx.Write(GetLiquidType());
10702 }
10703 //--------------------------------------------
10704 if (IsVariableSet(VARIABLE_COLOR))
10705 {
10706 int r,g,b,a;
10707 GetColor(r,g,b,a);
10708 ctx.Write(r);
10709 ctx.Write(g);
10710 ctx.Write(b);
10711 ctx.Write(a);
10712 }
10713 //--------------------------------------------
10714 if (IsVariableSet(VARIABLE_CLEANNESS))
10715 {
10716 ctx.Write(GetCleanness());
10717 }
10718 }
10719
10720 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
10721 {
10722 if (!super.ReadVarsFromCTX(ctx,version))
10723 return false;
10724
10725 int intValue;
10726 float value;
10727
10728 if (version < 140)
10729 {
10730 if (!ctx.Read(intValue))
10731 return false;
10732
10733 m_VariablesMask = intValue;
10734 }
10735
10736 if (m_VariablesMask & VARIABLE_QUANTITY)
10737 {
10738 if (!ctx.Read(value))
10739 return false;
10740
10741 if (IsStoreLoad())
10742 {
10744 }
10745 else
10746 {
10747 SetQuantity(value, true, false, false, false);
10748 }
10749 }
10750 //--------------------------------------------
10751 if (version < 140)
10752 {
10753 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10754 {
10755 if (!ctx.Read(value))
10756 return false;
10757 SetTemperatureDirect(value);
10758 }
10759 }
10760 //--------------------------------------------
10761 if (m_VariablesMask & VARIABLE_WET)
10762 {
10763 if (!ctx.Read(value))
10764 return false;
10765 SetWet(value);
10766 }
10767 //--------------------------------------------
10768 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
10769 {
10770 if (!ctx.Read(intValue))
10771 return false;
10772 SetLiquidType(intValue);
10773 }
10774 //--------------------------------------------
10775 if (m_VariablesMask & VARIABLE_COLOR)
10776 {
10777 int r,g,b,a;
10778 if (!ctx.Read(r))
10779 return false;
10780 if (!ctx.Read(g))
10781 return false;
10782 if (!ctx.Read(b))
10783 return false;
10784 if (!ctx.Read(a))
10785 return false;
10786
10787 SetColor(r,g,b,a);
10788 }
10789 //--------------------------------------------
10790 if (m_VariablesMask & VARIABLE_CLEANNESS)
10791 {
10792 if (!ctx.Read(intValue))
10793 return false;
10794 SetCleanness(intValue);
10795 }
10796 //--------------------------------------------
10797 if (version >= 138 && version < 140)
10798 {
10799 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10800 {
10801 if (!ctx.Read(intValue))
10802 return false;
10803 SetFrozen(intValue);
10804 }
10805 }
10806
10807 return true;
10808 }
10809
10810 //----------------------------------------------------------------
10811 override bool OnStoreLoad(ParamsReadContext ctx, int version)
10812 {
10813 m_IsStoreLoad = true;
10815 {
10816 m_FixDamageSystemInit = true;
10817 }
10818
10819 if (!super.OnStoreLoad(ctx, version))
10820 {
10821 m_IsStoreLoad = false;
10822 return false;
10823 }
10824
10825 if (version >= 114)
10826 {
10827 bool hasQuickBarIndexSaved;
10828
10829 if (!ctx.Read(hasQuickBarIndexSaved))
10830 {
10831 m_IsStoreLoad = false;
10832 return false;
10833 }
10834
10835 if (hasQuickBarIndexSaved)
10836 {
10837 int itmQBIndex;
10838
10839 //Load quickbar item bind
10840 if (!ctx.Read(itmQBIndex))
10841 {
10842 m_IsStoreLoad = false;
10843 return false;
10844 }
10845
10846 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10847 if (itmQBIndex != -1 && parentPlayer)
10848 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10849 }
10850 }
10851 else
10852 {
10853 // Backup of how it used to be
10854 PlayerBase player;
10855 int itemQBIndex;
10856 if (version == int.MAX)
10857 {
10858 if (!ctx.Read(itemQBIndex))
10859 {
10860 m_IsStoreLoad = false;
10861 return false;
10862 }
10863 }
10864 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10865 {
10866 //Load quickbar item bind
10867 if (!ctx.Read(itemQBIndex))
10868 {
10869 m_IsStoreLoad = false;
10870 return false;
10871 }
10872 if (itemQBIndex != -1 && player)
10873 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10874 }
10875 }
10876
10877 if (version < 140)
10878 {
10879 // variable management system
10880 if (!LoadVariables(ctx, version))
10881 {
10882 m_IsStoreLoad = false;
10883 return false;
10884 }
10885 }
10886
10887 //agent trasmission system
10888 if (!LoadAgents(ctx, version))
10889 {
10890 m_IsStoreLoad = false;
10891 return false;
10892 }
10893 if (version >= 132)
10894 {
10895 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10896 if (raib)
10897 {
10898 if (!raib.OnStoreLoad(ctx,version))
10899 {
10900 m_IsStoreLoad = false;
10901 return false;
10902 }
10903 }
10904 }
10905
10906 m_IsStoreLoad = false;
10907 return true;
10908 }
10909
10910 //----------------------------------------------------------------
10911
10912 override void OnStoreSave(ParamsWriteContext ctx)
10913 {
10914 super.OnStoreSave(ctx);
10915
10916 PlayerBase player;
10917 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10918 {
10919 ctx.Write(true); // Keep track of if we should actually read this in or not
10920 //Save quickbar item bind
10921 int itemQBIndex = -1;
10922 itemQBIndex = player.FindQuickBarEntityIndex(this);
10923 ctx.Write(itemQBIndex);
10924 }
10925 else
10926 {
10927 ctx.Write(false); // Keep track of if we should actually read this in or not
10928 }
10929
10930 SaveAgents(ctx);//agent trasmission system
10931
10932 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10933 if (raib)
10934 {
10935 raib.OnStoreSave(ctx);
10936 }
10937 }
10938 //----------------------------------------------------------------
10939
10940 override void AfterStoreLoad()
10941 {
10942 super.AfterStoreLoad();
10943
10945 {
10947 }
10948
10949 if (GetStoreLoadedQuantity() != float.LOWEST)
10950 {
10952 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
10953 }
10954 }
10955
10956 override void EEOnAfterLoad()
10957 {
10958 super.EEOnAfterLoad();
10959
10961 {
10962 m_FixDamageSystemInit = false;
10963 }
10964
10967 }
10968
10969 bool CanBeDisinfected()
10970 {
10971 return false;
10972 }
10973
10974
10975 //----------------------------------------------------------------
10976 override void OnVariablesSynchronized()
10977 {
10978 if (m_Initialized)
10979 {
10980 #ifdef PLATFORM_CONSOLE
10981 //bruteforce it is
10982 if (IsSplitable())
10983 {
10984 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
10985 if (menu)
10986 {
10987 menu.Refresh();
10988 }
10989 }
10990 #endif
10991 }
10992
10994 {
10995 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10996 m_WantPlayImpactSound = false;
10997 }
10998
11000 {
11001 SetWeightDirty();
11003 }
11004 if (m_VarWet != m_VarWetPrev)
11005 {
11008 }
11009
11010 if (m_SoundSyncPlay != 0)
11011 {
11012 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11013 m_SoundSyncPlay = 0;
11014 }
11015 if (m_SoundSyncStop != 0)
11016 {
11017 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11018 m_SoundSyncStop = 0;
11019 }
11020
11021 super.OnVariablesSynchronized();
11022 }
11023
11024 //------------------------- Quantity
11025 //----------------------------------------------------------------
11027 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11028 {
11029 if (!IsServerCheck(allow_client))
11030 return false;
11031
11032 if (!HasQuantity())
11033 return false;
11034
11035 float min = GetQuantityMin();
11036 float max = GetQuantityMax();
11037
11038 if (value <= (min + 0.001))
11039 value = min;
11040
11041 if (value == min)
11042 {
11043 if (destroy_config)
11044 {
11045 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11046 if (dstr)
11047 {
11048 m_VarQuantity = Math.Clamp(value, min, max);
11049 this.Delete();
11050 return true;
11051 }
11052 }
11053 else if (destroy_forced)
11054 {
11055 m_VarQuantity = Math.Clamp(value, min, max);
11056 this.Delete();
11057 return true;
11058 }
11059 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11060 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11061 }
11062
11063 float delta = m_VarQuantity;
11064 m_VarQuantity = Math.Clamp(value, min, max);
11065
11066 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11067 {
11068 delta = m_VarQuantity - delta;
11069
11070 if (delta)
11071 OnQuantityChanged(delta);
11072 }
11073
11074 SetVariableMask(VARIABLE_QUANTITY);
11075
11076 return false;
11077 }
11078
11079 //----------------------------------------------------------------
11081 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11082 {
11083 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11084 }
11085 //----------------------------------------------------------------
11086 void SetQuantityMax()
11087 {
11088 float max = GetQuantityMax();
11089 SetQuantity(max);
11090 }
11091
11092 override void SetQuantityToMinimum()
11093 {
11094 float min = GetQuantityMin();
11095 SetQuantity(min);
11096 }
11097 //----------------------------------------------------------------
11099 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11100 {
11101 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11102 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11103 SetQuantity(result, destroy_config, destroy_forced);
11104 }
11105
11106 //----------------------------------------------------------------
11108 override float GetQuantityNormalized()
11109 {
11110 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11111 }
11112
11114 {
11115 return GetQuantityNormalized();
11116 }
11117
11118 /*void SetAmmoNormalized(float value)
11119 {
11120 float value_clamped = Math.Clamp(value, 0, 1);
11121 Magazine this_mag = Magazine.Cast(this);
11122 int max_rounds = this_mag.GetAmmoMax();
11123 int result = value * max_rounds;//can the rounded if higher precision is required
11124 this_mag.SetAmmoCount(result);
11125 }*/
11126 //----------------------------------------------------------------
11127 override int GetQuantityMax()
11128 {
11129 int slot = -1;
11130 if (GetInventory())
11131 {
11132 InventoryLocation il = new InventoryLocation;
11133 GetInventory().GetCurrentInventoryLocation(il);
11134 slot = il.GetSlot();
11135 }
11136
11137 return GetTargetQuantityMax(slot);
11138 }
11139
11140 override int GetTargetQuantityMax(int attSlotID = -1)
11141 {
11142 float quantity_max = 0;
11143
11144 if (IsSplitable()) //only stackable/splitable items can check for stack size
11145 {
11146 if (attSlotID != -1)
11147 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11148
11149 if (quantity_max <= 0)
11150 quantity_max = m_VarStackMax;
11151 }
11152
11153 if (quantity_max <= 0)
11154 quantity_max = m_VarQuantityMax;
11155
11156 return quantity_max;
11157 }
11158 //----------------------------------------------------------------
11159 override int GetQuantityMin()
11160 {
11161 return m_VarQuantityMin;
11162 }
11163 //----------------------------------------------------------------
11164 int GetQuantityInit()
11165 {
11166 return m_VarQuantityInit;
11167 }
11168
11169 //----------------------------------------------------------------
11170 override bool HasQuantity()
11171 {
11172 return !(GetQuantityMax() - GetQuantityMin() == 0);
11173 }
11174
11175 override float GetQuantity()
11176 {
11177 return m_VarQuantity;
11178 }
11179
11180 bool IsFullQuantity()
11181 {
11182 return GetQuantity() >= GetQuantityMax();
11183 }
11184
11185 //Calculates weight of single item without attachments and cargo
11186 override float GetSingleInventoryItemWeightEx()
11187 {
11188 //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
11189 float weightEx = GetWeightEx();//overall weight of the item
11190 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11191 return weightEx - special;
11192 }
11193
11194 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11196 {
11198 }
11199
11200 override protected float GetWeightSpecialized(bool forceRecalc = false)
11201 {
11202 if (IsSplitable()) //quantity determines size of the stack
11203 {
11204 #ifdef DEVELOPER
11205 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11206 {
11207 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11208 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11209 }
11210 #endif
11211
11212 return GetQuantity() * GetConfigWeightModified();
11213 }
11214 else if (HasEnergyManager())// items with energy manager
11215 {
11216 #ifdef DEVELOPER
11217 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11218 {
11219 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11220 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11221 }
11222 #endif
11223 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11224 }
11225 else//everything else
11226 {
11227 #ifdef DEVELOPER
11228 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11229 {
11230 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11231 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11232 }
11233 #endif
11234 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11235 }
11236 }
11237
11239 int GetNumberOfItems()
11240 {
11241 int item_count = 0;
11242 ItemBase item;
11243
11244 if (GetInventory().GetCargo() != NULL)
11245 {
11246 item_count = GetInventory().GetCargo().GetItemCount();
11247 }
11248
11249 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11250 {
11251 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11252 if (item)
11253 item_count += item.GetNumberOfItems();
11254 }
11255 return item_count;
11256 }
11257
11259 float GetUnitWeight(bool include_wetness = true)
11260 {
11261 float weight = 0;
11262 float wetness = 1;
11263 if (include_wetness)
11264 wetness += GetWet();
11265 if (IsSplitable()) //quantity determines size of the stack
11266 {
11267 weight = wetness * m_ConfigWeight;
11268 }
11269 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11270 {
11271 weight = 1;
11272 }
11273 return weight;
11274 }
11275
11276 //-----------------------------------------------------------------
11277
11278 override void ClearInventory()
11279 {
11280 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11281 {
11282 GameInventory inv = GetInventory();
11283 array<EntityAI> items = new array<EntityAI>;
11284 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11285 for (int i = 0; i < items.Count(); i++)
11286 {
11287 ItemBase item = ItemBase.Cast(items.Get(i));
11288 if (item)
11289 {
11290 GetGame().ObjectDelete(item);
11291 }
11292 }
11293 }
11294 }
11295
11296 //------------------------- Energy
11297
11298 //----------------------------------------------------------------
11299 float GetEnergy()
11300 {
11301 float energy = 0;
11302 if (HasEnergyManager())
11303 {
11304 energy = GetCompEM().GetEnergy();
11305 }
11306 return energy;
11307 }
11308
11309
11310 override void OnEnergyConsumed()
11311 {
11312 super.OnEnergyConsumed();
11313
11315 }
11316
11317 override void OnEnergyAdded()
11318 {
11319 super.OnEnergyAdded();
11320
11322 }
11323
11324 // Converts energy (from Energy Manager) to quantity, if enabled.
11326 {
11327 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11328 {
11329 if (HasQuantity())
11330 {
11331 float energy_0to1 = GetCompEM().GetEnergy0To1();
11332 SetQuantityNormalized(energy_0to1);
11333 }
11334 }
11335 }
11336
11337 //----------------------------------------------------------------
11338 float GetHeatIsolationInit()
11339 {
11340 return ConfigGetFloat("heatIsolation");
11341 }
11342
11343 float GetHeatIsolation()
11344 {
11345 return m_HeatIsolation;
11346 }
11347
11348 float GetDryingIncrement(string pIncrementName)
11349 {
11350 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11351 if (GetGame().ConfigIsExisting(paramPath))
11352 return GetGame().ConfigGetFloat(paramPath);
11353
11354 return 0.0;
11355 }
11356
11357 float GetSoakingIncrement(string pIncrementName)
11358 {
11359 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11360 if (GetGame().ConfigIsExisting(paramPath))
11361 return GetGame().ConfigGetFloat(paramPath);
11362
11363 return 0.0;
11364 }
11365 //----------------------------------------------------------------
11366 override void SetWet(float value, bool allow_client = false)
11367 {
11368 if (!IsServerCheck(allow_client))
11369 return;
11370
11371 float min = GetWetMin();
11372 float max = GetWetMax();
11373
11374 float previousValue = m_VarWet;
11375
11376 m_VarWet = Math.Clamp(value, min, max);
11377
11378 if (previousValue != m_VarWet)
11379 {
11380 SetVariableMask(VARIABLE_WET);
11381 OnWetChanged(m_VarWet, previousValue);
11382 }
11383 }
11384 //----------------------------------------------------------------
11385 override void AddWet(float value)
11386 {
11387 SetWet(GetWet() + value);
11388 }
11389 //----------------------------------------------------------------
11390 override void SetWetMax()
11391 {
11393 }
11394 //----------------------------------------------------------------
11395 override float GetWet()
11396 {
11397 return m_VarWet;
11398 }
11399 //----------------------------------------------------------------
11400 override float GetWetMax()
11401 {
11402 return m_VarWetMax;
11403 }
11404 //----------------------------------------------------------------
11405 override float GetWetMin()
11406 {
11407 return m_VarWetMin;
11408 }
11409 //----------------------------------------------------------------
11410 override float GetWetInit()
11411 {
11412 return m_VarWetInit;
11413 }
11414 //----------------------------------------------------------------
11415 override void OnWetChanged(float newVal, float oldVal)
11416 {
11417 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11418 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11419 if (newLevel != oldLevel)
11420 {
11421 OnWetLevelChanged(newLevel,oldLevel);
11422 }
11423 }
11424
11425 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11426 {
11427 SetWeightDirty();
11428 }
11429
11430 override EWetnessLevel GetWetLevel()
11431 {
11432 return GetWetLevelInternal(m_VarWet);
11433 }
11434
11435 //----------------------------------------------------------------
11436
11437 override void SetStoreLoad(bool value)
11438 {
11439 m_IsStoreLoad = value;
11440 }
11441
11442 override bool IsStoreLoad()
11443 {
11444 return m_IsStoreLoad;
11445 }
11446
11447 override void SetStoreLoadedQuantity(float value)
11448 {
11449 m_StoreLoadedQuantity = value;
11450 }
11451
11452 override float GetStoreLoadedQuantity()
11453 {
11454 return m_StoreLoadedQuantity;
11455 }
11456
11457 //----------------------------------------------------------------
11458
11459 float GetItemModelLength()
11460 {
11461 if (ConfigIsExisting("itemModelLength"))
11462 {
11463 return ConfigGetFloat("itemModelLength");
11464 }
11465 return 0;
11466 }
11467
11468 float GetItemAttachOffset()
11469 {
11470 if (ConfigIsExisting("itemAttachOffset"))
11471 {
11472 return ConfigGetFloat("itemAttachOffset");
11473 }
11474 return 0;
11475 }
11476
11477 override void SetCleanness(int value, bool allow_client = false)
11478 {
11479 if (!IsServerCheck(allow_client))
11480 return;
11481
11482 int previousValue = m_Cleanness;
11483
11484 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
11485
11486 if (previousValue != m_Cleanness)
11487 SetVariableMask(VARIABLE_CLEANNESS);
11488 }
11489
11490 override int GetCleanness()
11491 {
11492 return m_Cleanness;
11493 }
11494
11496 {
11497 return true;
11498 }
11499
11500 //----------------------------------------------------------------
11501 // ATTACHMENT LOCKING
11502 // Getters relevant to generic ActionLockAttachment
11503 int GetLockType()
11504 {
11505 return m_LockType;
11506 }
11507
11508 string GetLockSoundSet()
11509 {
11510 return m_LockSoundSet;
11511 }
11512
11513 //----------------------------------------------------------------
11514 //------------------------- Color
11515 // sets items color variable given color components
11516 override void SetColor(int r, int g, int b, int a)
11517 {
11522 SetVariableMask(VARIABLE_COLOR);
11523 }
11525 override void GetColor(out int r,out int g,out int b,out int a)
11526 {
11531 }
11532
11533 bool IsColorSet()
11534 {
11535 return IsVariableSet(VARIABLE_COLOR);
11536 }
11537
11539 string GetColorString()
11540 {
11541 int r,g,b,a;
11542 GetColor(r,g,b,a);
11543 r = r/255;
11544 g = g/255;
11545 b = b/255;
11546 a = a/255;
11547 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11548 }
11549 //----------------------------------------------------------------
11550 //------------------------- LiquidType
11551
11552 override void SetLiquidType(int value, bool allow_client = false)
11553 {
11554 if (!IsServerCheck(allow_client))
11555 return;
11556
11557 int old = m_VarLiquidType;
11558 m_VarLiquidType = value;
11559 OnLiquidTypeChanged(old,value);
11560 SetVariableMask(VARIABLE_LIQUIDTYPE);
11561 }
11562
11563 int GetLiquidTypeInit()
11564 {
11565 return ConfigGetInt("varLiquidTypeInit");
11566 }
11567
11568 override int GetLiquidType()
11569 {
11570 return m_VarLiquidType;
11571 }
11572
11573 protected void OnLiquidTypeChanged(int oldType, int newType)
11574 {
11575 if (newType == LIQUID_NONE && GetIsFrozen())
11576 SetFrozen(false);
11577 }
11578
11580 void UpdateQuickbarShortcutVisibility(PlayerBase player)
11581 {
11582 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11583 }
11584
11585 // -------------------------------------------------------------------------
11587 void OnInventoryEnter(Man player)
11588 {
11589 PlayerBase nplayer;
11590 if (PlayerBase.CastTo(nplayer, player))
11591 {
11592 m_CanPlayImpactSound = true;
11593 //nplayer.OnItemInventoryEnter(this);
11594 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11595 }
11596 }
11597
11598 // -------------------------------------------------------------------------
11600 void OnInventoryExit(Man player)
11601 {
11602 PlayerBase nplayer;
11603 if (PlayerBase.CastTo(nplayer,player))
11604 {
11605 //nplayer.OnItemInventoryExit(this);
11606 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11607
11608 }
11609
11610 //if (!GetGame().IsDedicatedServer())
11611 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11612
11613
11614 if (HasEnergyManager())
11615 {
11616 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
11617 }
11618 }
11619
11620 // ADVANCED PLACEMENT EVENTS
11621 override void OnPlacementStarted(Man player)
11622 {
11623 super.OnPlacementStarted(player);
11624
11625 SetTakeable(false);
11626 }
11627
11628 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
11629 {
11630 if (m_AdminLog)
11631 {
11632 m_AdminLog.OnPlacementComplete(player, this);
11633 }
11634
11635 super.OnPlacementComplete(player, position, orientation);
11636 }
11637
11638 //-----------------------------
11639 // AGENT SYSTEM
11640 //-----------------------------
11641 //--------------------------------------------------------------------------
11642 bool ContainsAgent(int agent_id)
11643 {
11644 if (agent_id & m_AttachedAgents)
11645 {
11646 return true;
11647 }
11648 else
11649 {
11650 return false;
11651 }
11652 }
11653
11654 //--------------------------------------------------------------------------
11655 override void RemoveAgent(int agent_id)
11656 {
11657 if (ContainsAgent(agent_id))
11658 {
11659 m_AttachedAgents = ~agent_id & m_AttachedAgents;
11660 }
11661 }
11662
11663 //--------------------------------------------------------------------------
11664 override void RemoveAllAgents()
11665 {
11666 m_AttachedAgents = 0;
11667 }
11668 //--------------------------------------------------------------------------
11669 override void RemoveAllAgentsExcept(int agent_to_keep)
11670 {
11671 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
11672 }
11673 // -------------------------------------------------------------------------
11674 override void InsertAgent(int agent, float count = 1)
11675 {
11676 if (count < 1)
11677 return;
11678 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
11680 }
11681
11683 void TransferAgents(int agents)
11684 {
11686 }
11687
11688 // -------------------------------------------------------------------------
11689 override int GetAgents()
11690 {
11691 return m_AttachedAgents;
11692 }
11693 //----------------------------------------------------------------------
11694
11695 /*int GetContaminationType()
11696 {
11697 int contamination_type;
11698
11699 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
11700 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
11701 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
11702 const int DIRTY_MASK = eAgents.WOUND_AGENT;
11703
11704 Edible_Base edible = Edible_Base.Cast(this);
11705 int agents = GetAgents();
11706 if (edible)
11707 {
11708 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
11709 if (profile)
11710 {
11711 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
11712 }
11713 }
11714 if (agents & CONTAMINATED_MASK)
11715 {
11716 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
11717 }
11718 if (agents & POISONED_MASK)
11719 {
11720 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
11721 }
11722 if (agents & NERVE_GAS_MASK)
11723 {
11724 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
11725 }
11726 if (agents & DIRTY_MASK)
11727 {
11728 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
11729 }
11730
11731 return agents;
11732 }*/
11733
11734 // -------------------------------------------------------------------------
11735 bool LoadAgents(ParamsReadContext ctx, int version)
11736 {
11737 if (!ctx.Read(m_AttachedAgents))
11738 return false;
11739 return true;
11740 }
11741 // -------------------------------------------------------------------------
11743 {
11744
11746 }
11747 // -------------------------------------------------------------------------
11748
11750 override void CheckForRoofLimited(float timeTresholdMS = 3000)
11751 {
11752 super.CheckForRoofLimited(timeTresholdMS);
11753
11754 float time = GetGame().GetTime();
11755 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11756 {
11757 m_PreviousRoofTestTime = time;
11758 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11759 }
11760 }
11761
11762 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
11763 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
11764 {
11765 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
11766 {
11767 return 0;
11768 }
11769
11770 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
11771 {
11772 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
11773 if (filter)
11774 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
11775 else
11776 return 0;//otherwise return 0 when no filter attached
11777 }
11778
11779 string subclassPath, entryName;
11780
11781 switch (type)
11782 {
11783 case DEF_BIOLOGICAL:
11784 entryName = "biological";
11785 break;
11786 case DEF_CHEMICAL:
11787 entryName = "chemical";
11788 break;
11789 default:
11790 entryName = "biological";
11791 break;
11792 }
11793
11794 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
11795
11796 return GetGame().ConfigGetFloat(subclassPath + entryName);
11797 }
11798
11799
11800
11802 override void EEOnCECreate()
11803 {
11804 if (!IsMagazine())
11806
11808 }
11809
11810
11811 //-------------------------
11812 // OPEN/CLOSE USER ACTIONS
11813 //-------------------------
11815 void Open();
11816 void Close();
11817 bool IsOpen()
11818 {
11819 return true;
11820 }
11821
11822 override bool CanDisplayCargo()
11823 {
11824 return IsOpen();
11825 }
11826
11827
11828 // ------------------------------------------------------------
11829 // CONDITIONS
11830 // ------------------------------------------------------------
11831 override bool CanPutInCargo(EntityAI parent)
11832 {
11833 if (parent)
11834 {
11835 if (parent.IsInherited(DayZInfected))
11836 return true;
11837
11838 if (!parent.IsRuined())
11839 return true;
11840 }
11841
11842 return true;
11843 }
11844
11845 override bool CanPutAsAttachment(EntityAI parent)
11846 {
11847 if (!super.CanPutAsAttachment(parent))
11848 {
11849 return false;
11850 }
11851
11852 if (!IsRuined() && !parent.IsRuined())
11853 {
11854 return true;
11855 }
11856
11857 return false;
11858 }
11859
11860 override bool CanReceiveItemIntoCargo(EntityAI item)
11861 {
11862 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11863 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11864 // return false;
11865
11866 return super.CanReceiveItemIntoCargo(item);
11867 }
11868
11869 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
11870 {
11871 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11872 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11873 // return false;
11874
11875 GameInventory attachmentInv = attachment.GetInventory();
11876 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11877 {
11878 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11879 return false;
11880 }
11881
11882 InventoryLocation loc = new InventoryLocation();
11883 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11884 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
11885 return false;
11886
11887 return super.CanReceiveAttachment(attachment, slotId);
11888 }
11889
11890 override bool CanReleaseAttachment(EntityAI attachment)
11891 {
11892 if (!super.CanReleaseAttachment(attachment))
11893 return false;
11894
11895 return GetInventory().AreChildrenAccessible();
11896 }
11897
11898 /*override bool CanLoadAttachment(EntityAI attachment)
11899 {
11900 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11901 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11902 // return false;
11903
11904 GameInventory attachmentInv = attachment.GetInventory();
11905 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11906 {
11907 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
11908 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
11909
11910 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11911 return false;
11912 }
11913
11914 return super.CanLoadAttachment(attachment);
11915 }*/
11916
11917 // Plays muzzle flash particle effects
11918 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11919 {
11920 int id = muzzle_owner.GetMuzzleID();
11921 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
11922
11923 if (WPOF_array)
11924 {
11925 for (int i = 0; i < WPOF_array.Count(); i++)
11926 {
11927 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11928
11929 if (WPOF)
11930 {
11931 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11932 }
11933 }
11934 }
11935 }
11936
11937 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
11938 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11939 {
11940 int id = muzzle_owner.GetMuzzleID();
11941 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
11942
11943 if (WPOBE_array)
11944 {
11945 for (int i = 0; i < WPOBE_array.Count(); i++)
11946 {
11947 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11948
11949 if (WPOBE)
11950 {
11951 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11952 }
11953 }
11954 }
11955 }
11956
11957 // Plays all weapon overheating particles
11958 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11959 {
11960 int id = muzzle_owner.GetMuzzleID();
11961 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11962
11963 if (WPOOH_array)
11964 {
11965 for (int i = 0; i < WPOOH_array.Count(); i++)
11966 {
11967 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11968
11969 if (WPOOH)
11970 {
11971 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11972 }
11973 }
11974 }
11975 }
11976
11977 // Updates all weapon overheating particles
11978 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11979 {
11980 int id = muzzle_owner.GetMuzzleID();
11981 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11982
11983 if (WPOOH_array)
11984 {
11985 for (int i = 0; i < WPOOH_array.Count(); i++)
11986 {
11987 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11988
11989 if (WPOOH)
11990 {
11991 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11992 }
11993 }
11994 }
11995 }
11996
11997 // Stops overheating particles
11998 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11999 {
12000 int id = muzzle_owner.GetMuzzleID();
12001 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12002
12003 if (WPOOH_array)
12004 {
12005 for (int i = 0; i < WPOOH_array.Count(); i++)
12006 {
12007 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12008
12009 if (WPOOH)
12010 {
12011 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12012 }
12013 }
12014 }
12015 }
12016
12017 //----------------------------------------------------------------
12018 //Item Behaviour - unified approach
12019 override bool IsHeavyBehaviour()
12020 {
12021 if (m_ItemBehaviour == 0)
12022 {
12023 return true;
12024 }
12025
12026 return false;
12027 }
12028
12029 override bool IsOneHandedBehaviour()
12030 {
12031 if (m_ItemBehaviour == 1)
12032 {
12033 return true;
12034 }
12035
12036 return false;
12037 }
12038
12039 override bool IsTwoHandedBehaviour()
12040 {
12041 if (m_ItemBehaviour == 2)
12042 {
12043 return true;
12044 }
12045
12046 return false;
12047 }
12048
12049 bool IsDeployable()
12050 {
12051 return false;
12052 }
12053
12055 float GetDeployTime()
12056 {
12057 return UATimeSpent.DEFAULT_DEPLOY;
12058 }
12059
12060
12061 //----------------------------------------------------------------
12062 // Item Targeting (User Actions)
12063 override void SetTakeable(bool pState)
12064 {
12065 m_IsTakeable = pState;
12066 SetSynchDirty();
12067 }
12068
12069 override bool IsTakeable()
12070 {
12071 return m_IsTakeable;
12072 }
12073
12074 // For cases where we want to show object widget which cant be taken to hands
12076 {
12077 return false;
12078 }
12079
12081 protected void PreLoadSoundAttachmentType()
12082 {
12083 string att_type = "None";
12084
12085 if (ConfigIsExisting("soundAttType"))
12086 {
12087 att_type = ConfigGetString("soundAttType");
12088 }
12089
12090 m_SoundAttType = att_type;
12091 }
12092
12093 override string GetAttachmentSoundType()
12094 {
12095 return m_SoundAttType;
12096 }
12097
12098 //----------------------------------------------------------------
12099 //SOUNDS - ItemSoundHandler
12100 //----------------------------------------------------------------
12101
12102 string GetPlaceSoundset(); // played when deploy starts
12103 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12104 string GetDeploySoundset(); // played when deploy sucessfully finishes
12105
12107 {
12108 if (!m_ItemSoundHandler)
12110
12111 return m_ItemSoundHandler;
12112 }
12113
12114 // override to initialize sounds
12115 protected void InitItemSounds()
12116 {
12117 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12118 return;
12119
12121
12122 if (GetPlaceSoundset() != string.Empty)
12123 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12124
12125 if (GetDeploySoundset() != string.Empty)
12126 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12127
12128 SoundParameters params = new SoundParameters();
12129 params.m_Loop = true;
12130 if (GetLoopDeploySoundset() != string.Empty)
12131 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12132 }
12133
12134 // Start sound using ItemSoundHandler
12135 void StartItemSoundServer(int id)
12136 {
12137 if (!GetGame().IsServer())
12138 return;
12139
12140 m_SoundSyncPlay = id;
12141 SetSynchDirty();
12142
12143 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12145 }
12146
12147 // Stop sound using ItemSoundHandler
12148 void StopItemSoundServer(int id)
12149 {
12150 if (!GetGame().IsServer())
12151 return;
12152
12153 m_SoundSyncStop = id;
12154 SetSynchDirty();
12155
12156 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12158 }
12159
12160 protected void ClearStartItemSoundServer()
12161 {
12162 m_SoundSyncPlay = 0;
12163 }
12164
12165 protected void ClearStopItemSoundServer()
12166 {
12167 m_SoundSyncStop = 0;
12168 }
12169
12171 void PlayAttachSound(string slot_type)
12172 {
12173 if (!GetGame().IsDedicatedServer())
12174 {
12175 if (ConfigIsExisting("attachSoundSet"))
12176 {
12177 string cfg_path = "";
12178 string soundset = "";
12179 string type_name = GetType();
12180
12181 TStringArray cfg_soundset_array = new TStringArray;
12182 TStringArray cfg_slot_array = new TStringArray;
12183 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12184 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12185
12186 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12187 {
12188 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12189 {
12190 if (cfg_slot_array[i] == slot_type)
12191 {
12192 soundset = cfg_soundset_array[i];
12193 break;
12194 }
12195 }
12196 }
12197
12198 if (soundset != "")
12199 {
12200 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12201 sound.SetAutodestroy(true);
12202 }
12203 }
12204 }
12205 }
12206
12207 void PlayDetachSound(string slot_type)
12208 {
12209 //TODO - evaluate if needed and devise universal config structure if so
12210 }
12211
12212 void OnApply(PlayerBase player);
12213
12215 {
12216 return 1.0;
12217 };
12218 //returns applicable selection
12219 array<string> GetHeadHidingSelection()
12220 {
12222 }
12223
12225 {
12227 }
12228
12229 WrittenNoteData GetWrittenNoteData() {};
12230
12232 {
12233 SetDynamicPhysicsLifeTime(0.01);
12234 m_ItemBeingDroppedPhys = false;
12235 }
12236
12238 {
12239 array<string> zone_names = new array<string>;
12240 GetDamageZones(zone_names);
12241 for (int i = 0; i < zone_names.Count(); i++)
12242 {
12243 SetHealthMax(zone_names.Get(i),"Health");
12244 }
12245 SetHealthMax("","Health");
12246 }
12247
12249 void SetZoneDamageCEInit()
12250 {
12251 float global_health = GetHealth01("","Health");
12252 array<string> zones = new array<string>;
12253 GetDamageZones(zones);
12254 //set damage of all zones to match global health level
12255 for (int i = 0; i < zones.Count(); i++)
12256 {
12257 SetHealth01(zones.Get(i),"Health",global_health);
12258 }
12259 }
12260
12262 bool IsCoverFaceForShave(string slot_name)
12263 {
12264 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12265 }
12266
12267 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12268 {
12269 if (!hasRootAsPlayer)
12270 {
12271 if (refParentIB)
12272 {
12273 // parent is wet
12274 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12275 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12276 // parent has liquid inside
12277 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12278 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12279 // drying
12280 else if (m_VarWet > m_VarWetMin)
12281 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12282 }
12283 else
12284 {
12285 // drying on ground or inside non-itembase (car, ...)
12286 if (m_VarWet > m_VarWetMin)
12287 AddWet(-1 * delta * GetDryingIncrement("ground"));
12288 }
12289 }
12290 }
12291
12292 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12293 {
12295 {
12296 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12297 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12298 {
12299 float heatPermCoef = 1.0;
12300 EntityAI ent = this;
12301 while (ent)
12302 {
12303 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12304 ent = ent.GetHierarchyParent();
12305 }
12306
12307 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12308 }
12309 }
12310 }
12311
12312 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12313 {
12314 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12315 EntityAI parent = GetHierarchyParent();
12316 if (!parent)
12317 {
12318 hasParent = false;
12319 hasRootAsPlayer = false;
12320 }
12321 else
12322 {
12323 hasParent = true;
12324 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12325 refParentIB = ItemBase.Cast(parent);
12326 }
12327 }
12328
12329 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12330 {
12331 // this is stub, implemented on Edible_Base
12332 }
12333
12334 bool CanDecay()
12335 {
12336 // return true used on selected food clases so they can decay
12337 return false;
12338 }
12339
12340 protected bool CanProcessDecay()
12341 {
12342 // this is stub, implemented on Edible_Base class
12343 // used to determine whether it is still necessary for the food to decay
12344 return false;
12345 }
12346
12347 protected bool CanHaveWetness()
12348 {
12349 // return true used on selected items that have a wetness effect
12350 return false;
12351 }
12352
12354 bool CanBeConsumed(ConsumeConditionData data = null)
12355 {
12356 return !GetIsFrozen() && IsOpen();
12357 }
12358
12359 override void ProcessVariables()
12360 {
12361 bool hasParent = false, hasRootAsPlayer = false;
12362 ItemBase refParentIB;
12363
12364 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12365 bool foodDecay = g_Game.IsFoodDecayEnabled();
12366
12367 if (wwtu || foodDecay)
12368 {
12369 bool processWetness = wwtu && CanHaveWetness();
12370 bool processTemperature = wwtu && CanHaveTemperature();
12371 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12372
12373 if (processWetness || processTemperature || processDecay)
12374 {
12375 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12376
12377 if (processWetness)
12378 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12379
12380 if (processTemperature)
12381 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12382
12383 if (processDecay)
12384 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12385 }
12386 }
12387 }
12388
12391 {
12392 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12393 }
12394
12395 override float GetTemperatureFreezeThreshold()
12396 {
12398 return Liquid.GetFreezeThreshold(GetLiquidType());
12399
12400 return super.GetTemperatureFreezeThreshold();
12401 }
12402
12403 override float GetTemperatureThawThreshold()
12404 {
12406 return Liquid.GetThawThreshold(GetLiquidType());
12407
12408 return super.GetTemperatureThawThreshold();
12409 }
12410
12411 override float GetItemOverheatThreshold()
12412 {
12414 return Liquid.GetBoilThreshold(GetLiquidType());
12415
12416 return super.GetItemOverheatThreshold();
12417 }
12418
12419 override float GetTemperatureFreezeTime()
12420 {
12421 if (HasQuantity())
12422 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12423
12424 return super.GetTemperatureFreezeTime();
12425 }
12426
12427 override float GetTemperatureThawTime()
12428 {
12429 if (HasQuantity())
12430 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12431
12432 return super.GetTemperatureThawTime();
12433 }
12434
12436 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12438 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12439
12440 bool IsCargoException4x3(EntityAI item)
12441 {
12442 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12443 }
12444
12446 {
12447 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12448 }
12449
12451 void AddLightSourceItem(ItemBase lightsource)
12452 {
12453 m_LightSourceItem = lightsource;
12454 }
12455
12457 {
12458 m_LightSourceItem = null;
12459 }
12460
12462 {
12463 return m_LightSourceItem;
12464 }
12465
12467 array<int> GetValidFinishers()
12468 {
12469 return null;
12470 }
12471
12473 bool GetActionWidgetOverride(out typename name)
12474 {
12475 return false;
12476 }
12477
12478 bool PairWithDevice(notnull ItemBase otherDevice)
12479 {
12480 if (GetGame().IsServer())
12481 {
12482 ItemBase explosive = otherDevice;
12484 if (!trg)
12485 {
12486 trg = RemoteDetonatorTrigger.Cast(otherDevice);
12487 explosive = this;
12488 }
12489
12490 explosive.PairRemote(trg);
12491 trg.SetControlledDevice(explosive);
12492
12493 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12494 trg.SetPersistentPairID(persistentID);
12495 explosive.SetPersistentPairID(persistentID);
12496
12497 return true;
12498 }
12499 return false;
12500 }
12501
12503 float GetBaitEffectivity()
12504 {
12505 float ret = 1.0;
12506 if (HasQuantity())
12507 ret *= GetQuantityNormalized();
12508 ret *= GetHealth01();
12509
12510 return ret;
12511 }
12512
12513 #ifdef DEVELOPER
12514 override void SetDebugItem()
12515 {
12516 super.SetDebugItem();
12517 _itemBase = this;
12518 }
12519
12520 override string GetDebugText()
12521 {
12522 string text = super.GetDebugText();
12523
12524 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
12525 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
12526
12527 return text;
12528 }
12529 #endif
12530
12531 bool CanBeUsedForSuicide()
12532 {
12533 return true;
12534 }
12535
12537 //DEPRECATED BELOW
12539 // Backwards compatibility
12540 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12541 {
12542 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
12543 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
12544 }
12545
12546 // replaced by ItemSoundHandler
12547 protected EffectSound m_SoundDeployFinish;
12548 protected EffectSound m_SoundPlace;
12549 protected EffectSound m_DeployLoopSoundEx;
12550 protected EffectSound m_SoundDeploy;
12551 bool m_IsPlaceSound;
12552 bool m_IsDeploySound;
12554
12555 string GetDeployFinishSoundset();
12556 void PlayDeploySound();
12557 void PlayDeployFinishSound();
12558 void PlayPlaceSound();
12559 void PlayDeployLoopSoundEx();
12560 void StopDeployLoopSoundEx();
12561 void SoundSynchRemoteReset();
12562 void SoundSynchRemote();
12563 bool UsesGlobalDeploy(){return false;}
12564 bool CanPlayDeployLoopSound(){return false;}
12566 bool IsPlaceSound(){return m_IsPlaceSound;}
12567 bool IsDeploySound(){return m_IsDeploySound;}
12568 void SetIsPlaceSound(bool is_place_sound);
12569 void SetIsDeploySound(bool is_deploy_sound);
12570}
12571
12572EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
12573{
12574 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
12575 if (entity)
12576 {
12577 bool is_item = entity.IsInherited(ItemBase);
12578 if (is_item && full_quantity)
12579 {
12580 ItemBase item = ItemBase.Cast(entity);
12581 item.SetQuantity(item.GetQuantityInit());
12582 }
12583 }
12584 else
12585 {
12586 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
12587 return NULL;
12588 }
12589 return entity;
12590}
12591
12592void SetupSpawnedItem(ItemBase item, float health, float quantity)
12593{
12594 if (item)
12595 {
12596 if (health > 0)
12597 item.SetHealth("", "", health);
12598
12599 if (item.CanHaveTemperature())
12600 {
12601 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
12602 if (item.CanFreeze())
12603 item.SetFrozen(false);
12604 }
12605
12606 if (item.HasEnergyManager())
12607 {
12608 if (quantity >= 0)
12609 {
12610 item.GetCompEM().SetEnergy0To1(quantity);
12611 }
12612 else
12613 {
12614 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
12615 }
12616 }
12617 else if (item.IsMagazine())
12618 {
12619 Magazine mag = Magazine.Cast(item);
12620 if (quantity >= 0)
12621 {
12622 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12623 }
12624 else
12625 {
12626 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
12627 }
12628
12629 }
12630 else
12631 {
12632 if (quantity >= 0)
12633 {
12634 item.SetQuantityNormalized(quantity, false);
12635 }
12636 else
12637 {
12638 item.SetQuantity(Math.AbsFloat(quantity));
12639 }
12640
12641 }
12642 }
12643}
12644
12645#ifdef DEVELOPER
12646ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
12647#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()