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

◆ RemoveAllAgentsExcept()

override void SpawnItemOnLocation::RemoveAllAgentsExcept ( int agent_to_keep)
protected

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

8794{
8795 override bool CanPutAsAttachment(EntityAI parent)
8796 {
8797 return true;
8798 }
8799};
8800
8801//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8802
8803class ItemBase extends InventoryItem
8804{
8808
8810
8811 static int m_DebugActionsMask;
8813 // ============================================
8814 // Variable Manipulation System
8815 // ============================================
8816 // Quantity
8817
8818 float m_VarQuantity;
8819 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8821 int m_VarQuantityMin;
8822 int m_VarQuantityMax;
8823 int m_Count;
8824 float m_VarStackMax;
8825 float m_StoreLoadedQuantity = float.LOWEST;
8826 // Wet
8827 float m_VarWet;
8828 float m_VarWetPrev;//for client to know wetness changed during synchronization
8829 float m_VarWetInit;
8830 float m_VarWetMin;
8831 float m_VarWetMax;
8832 // Cleanness
8833 int m_Cleanness;
8834 int m_CleannessInit;
8835 int m_CleannessMin;
8836 int m_CleannessMax;
8837 // impact sounds
8839 bool m_CanPlayImpactSound = true;
8840 float m_ImpactSpeed;
8842 //
8843 float m_HeatIsolation;
8844 float m_ItemModelLength;
8845 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8847 int m_VarLiquidType;
8848 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8849 int m_QuickBarBonus;
8850 bool m_IsBeingPlaced;
8851 bool m_IsHologram;
8852 bool m_IsTakeable;
8853 bool m_ThrowItemOnDrop;
8856 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8857 bool can_this_be_combined; //Check if item can be combined
8858 bool m_CanThisBeSplit; //Check if item can be split
8859 bool m_IsStoreLoad = false;
8860 bool m_CanShowQuantity;
8861 bool m_HasQuantityBar;
8862 protected bool m_CanBeDigged;
8863 protected bool m_IsResultOfSplit
8864
8865 string m_SoundAttType;
8866 // items color variables
8871 //-------------------------------------------------------
8872
8873 // light source managing
8875
8879
8880 //==============================================
8881 // agent system
8882 private int m_AttachedAgents;
8883
8885 void TransferModifiers(PlayerBase reciever);
8886
8887
8888 // Weapons & suppressors particle effects
8893 static int m_LastRegisteredWeaponID = 0;
8894
8895 // Overheating effects
8897 float m_OverheatingShots;
8898 ref Timer m_CheckOverheating;
8899 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8900 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8901 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8902 ref array <ref OverheatingParticle> m_OverheatingParticles;
8903
8905 protected bool m_HideSelectionsBySlot;
8906
8907 // Admin Log
8908 PluginAdminLog m_AdminLog;
8909
8910 // misc
8911 ref Timer m_PhysDropTimer;
8912
8913 // Attachment Locking variables
8914 ref array<int> m_CompatibleLocks;
8915 protected int m_LockType;
8916 protected ref EffectSound m_LockingSound;
8917 protected string m_LockSoundSet;
8918
8919 // ItemSoundHandler
8920 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8921 protected int m_SoundSyncPlay; // id for sound to play
8922 protected int m_SoundSyncStop; // id for sound to stop
8924
8925 //temperature
8926 private float m_TemperaturePerQuantityWeight;
8927
8928 // -------------------------------------------------------------------------
8929 void ItemBase()
8930 {
8931 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8935
8936 if (!GetGame().IsDedicatedServer())
8937 {
8938 if (HasMuzzle())
8939 {
8941
8943 {
8945 }
8946 }
8947
8949 m_ActionsInitialize = false;
8950 }
8951
8952 m_OldLocation = null;
8953
8954 if (GetGame().IsServer())
8955 {
8956 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8957 }
8958
8959 if (ConfigIsExisting("headSelectionsToHide"))
8960 {
8962 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8963 }
8964
8965 m_HideSelectionsBySlot = false;
8966 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8967 {
8968 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8969 }
8970
8971 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8972
8973 m_IsResultOfSplit = false;
8974
8976 }
8977
8978 override void InitItemVariables()
8979 {
8980 super.InitItemVariables();
8981
8982 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8983 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8984 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8985 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8986 m_VarStackMax = ConfigGetFloat("varStackMax");
8987 m_Count = ConfigGetInt("count");
8988
8989 m_CanShowQuantity = ConfigGetBool("quantityShow");
8990 m_HasQuantityBar = ConfigGetBool("quantityBar");
8991
8992 m_CleannessInit = ConfigGetInt("varCleannessInit");
8994 m_CleannessMin = ConfigGetInt("varCleannessMin");
8995 m_CleannessMax = ConfigGetInt("varCleannessMax");
8996
8997 m_WantPlayImpactSound = false;
8998 m_ImpactSpeed = 0.0;
8999
9000 m_VarWetInit = ConfigGetFloat("varWetInit");
9002 m_VarWetMin = ConfigGetFloat("varWetMin");
9003 m_VarWetMax = ConfigGetFloat("varWetMax");
9004
9005 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
9006 if (IsLiquidContainer() && GetQuantity() != 0)
9008 m_IsBeingPlaced = false;
9009 m_IsHologram = false;
9010 m_IsTakeable = true;
9011 m_CanBeMovedOverride = false;
9015 m_CanBeDigged = ConfigGetBool("canBeDigged");
9016
9017 m_CompatibleLocks = new array<int>();
9018 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
9019 m_LockType = ConfigGetInt("lockType");
9020
9021 //Define if item can be split and set ability to be combined accordingly
9022 m_CanThisBeSplit = false;
9023 can_this_be_combined = false;
9024 if (ConfigIsExisting("canBeSplit"))
9025 {
9026 can_this_be_combined = ConfigGetBool("canBeSplit");
9028 }
9029
9030 m_ItemBehaviour = -1;
9031 if (ConfigIsExisting("itemBehaviour"))
9032 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
9033
9034 //RegisterNetSyncVariableInt("m_VariablesMask");
9035 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9036 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
9037 RegisterNetSyncVariableInt("m_VarLiquidType");
9038 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9039
9040 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9041 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9042 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9043
9044 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9045 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9046 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9047 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9048
9049 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9050 RegisterNetSyncVariableBool("m_IsTakeable");
9051 RegisterNetSyncVariableBool("m_IsHologram");
9052
9053 InitItemSounds();
9055 {
9056 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
9057 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
9058 }
9059
9060 m_LockSoundSet = ConfigGetString("lockSoundSet");
9061
9063 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9064 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
9065
9066 }
9067
9068 override int GetQuickBarBonus()
9069 {
9070 return m_QuickBarBonus;
9071 }
9072
9073 void InitializeActions()
9074 {
9076 if (!m_InputActionMap)
9077 {
9079 m_InputActionMap = iam;
9080 SetActions();
9082 }
9083 }
9084
9085 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9086 {
9088 {
9089 m_ActionsInitialize = true;
9091 }
9092
9093 actions = m_InputActionMap.Get(action_input_type);
9094 }
9095
9096 void SetActions()
9097 {
9098 AddAction(ActionTakeItem);
9099 AddAction(ActionTakeItemToHands);
9100 AddAction(ActionWorldCraft);
9102 AddAction(ActionAttachWithSwitch);
9103 }
9104
9105 void SetActionAnimOverrides(); // Override action animation for specific item
9106
9107 void AddAction(typename actionName)
9108 {
9109 ActionBase action = ActionManagerBase.GetAction(actionName);
9110
9111 if (!action)
9112 {
9113 Debug.LogError("Action " + actionName + " dosn't exist!");
9114 return;
9115 }
9116
9117 typename ai = action.GetInputType();
9118 if (!ai)
9119 {
9120 m_ActionsInitialize = false;
9121 return;
9122 }
9123
9124 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9125 if (!action_array)
9126 {
9127 action_array = new array<ActionBase_Basic>;
9128 m_InputActionMap.Insert(ai, action_array);
9129 }
9130 if (LogManager.IsActionLogEnable())
9131 {
9132 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9133 }
9134
9135 if (action_array.Find(action) != -1)
9136 {
9137 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9138 }
9139 else
9140 {
9141 action_array.Insert(action);
9142 }
9143 }
9144
9145 void RemoveAction(typename actionName)
9146 {
9147 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9148 ActionBase action = player.GetActionManager().GetAction(actionName);
9149 typename ai = action.GetInputType();
9150 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9151
9152 if (action_array)
9153 {
9154 action_array.RemoveItem(action);
9155 }
9156 }
9157
9158 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9159 // Set -1 for params which should stay in default state
9160 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9161 {
9162 ActionOverrideData overrideData = new ActionOverrideData();
9163 overrideData.m_CommandUID = commandUID;
9164 overrideData.m_CommandUIDProne = commandUIDProne;
9165 overrideData.m_StanceMask = stanceMask;
9166
9167 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9168 if (!actionMap) // create new map of action > overidables map
9169 {
9170 actionMap = new TActionAnimOverrideMap();
9171 m_ItemActionOverrides.Insert(action, actionMap);
9172 }
9173
9174 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9175
9176 }
9177
9178 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9179
9180 ScriptedLightBase GetLight();
9181
9182 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9183 void LoadParticleConfigOnFire(int id)
9184 {
9185 if (!m_OnFireEffect)
9187
9190
9191 string config_to_search = "CfgVehicles";
9192 string muzzle_owner_config;
9193
9194 if (!m_OnFireEffect.Contains(id))
9195 {
9196 if (IsInherited(Weapon))
9197 config_to_search = "CfgWeapons";
9198
9199 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9200
9201 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9202
9203 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9204
9205 if (config_OnFire_subclass_count > 0)
9206 {
9207 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9208
9209 for (int i = 0; i < config_OnFire_subclass_count; i++)
9210 {
9211 string particle_class = "";
9212 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9213 string config_OnFire_entry = config_OnFire_class + particle_class;
9214 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9215 WPOF_array.Insert(WPOF);
9216 }
9217
9218
9219 m_OnFireEffect.Insert(id, WPOF_array);
9220 }
9221 }
9222
9223 if (!m_OnBulletCasingEjectEffect.Contains(id))
9224 {
9225 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9226 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9227
9228 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9229
9230 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9231
9232 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9233 {
9234 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9235
9236 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9237 {
9238 string particle_class2 = "";
9239 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9240 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9241 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9242 WPOBE_array.Insert(WPOBE);
9243 }
9244
9245
9246 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9247 }
9248 }
9249 }
9250
9251 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9253 {
9256
9257 if (!m_OnOverheatingEffect.Contains(id))
9258 {
9259 string config_to_search = "CfgVehicles";
9260
9261 if (IsInherited(Weapon))
9262 config_to_search = "CfgWeapons";
9263
9264 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9265 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9266
9267 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9268 {
9269
9270 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9271
9273 {
9274 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9275 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9276 Error(error);
9277 return;
9278 }
9279
9280 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9281 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9282
9283
9284
9285 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9286 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9287
9288 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9289 {
9290 string particle_class = "";
9291 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9292 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9293 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9294
9295 if (entry_type == CT_CLASS)
9296 {
9297 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9298 WPOOH_array.Insert(WPOF);
9299 }
9300 }
9301
9302
9303 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9304 }
9305 }
9306 }
9307
9308 float GetOverheatingValue()
9309 {
9310 return m_OverheatingShots;
9311 }
9312
9313 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9314 {
9315 if (m_MaxOverheatingValue > 0)
9316 {
9318
9319 if (!m_CheckOverheating)
9321
9323 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9324
9325 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9326 }
9327 }
9328
9329 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9330 {
9332 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9333
9335 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9336
9338 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9339
9341 {
9343 }
9344 }
9345
9347 {
9349 }
9350
9351 void OnOverheatingDecay()
9352 {
9353 if (m_MaxOverheatingValue > 0)
9354 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9355 else
9357
9358 if (m_OverheatingShots <= 0)
9359 {
9362 }
9363 else
9364 {
9365 if (!m_CheckOverheating)
9367
9369 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9370 }
9371
9372 CheckOverheating(this, "", this);
9373 }
9374
9375 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9376 {
9378 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9379 }
9380
9381 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9382 {
9384 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9386 }
9387
9388 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9389 {
9391 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9392 }
9393
9394 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
9395 {
9397 m_OverheatingParticles = new array<ref OverheatingParticle>;
9398
9399 OverheatingParticle OP = new OverheatingParticle();
9400 OP.RegisterParticle(p);
9401 OP.SetOverheatingLimitMin(min_heat_coef);
9402 OP.SetOverheatingLimitMax(max_heat_coef);
9403 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
9404
9405 m_OverheatingParticles.Insert(OP);
9406 }
9407
9408 float GetOverheatingCoef()
9409 {
9410 if (m_MaxOverheatingValue > 0)
9412
9413 return -1;
9414 }
9415
9417 {
9419 {
9420 float overheat_coef = GetOverheatingCoef();
9421 int count = m_OverheatingParticles.Count();
9422
9423 for (int i = count; i > 0; --i)
9424 {
9425 int id = i - 1;
9426 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9427 Particle p = OP.GetParticle();
9428
9429 float overheat_min = OP.GetOverheatingLimitMin();
9430 float overheat_max = OP.GetOverheatingLimitMax();
9431
9432 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9433 {
9434 if (p)
9435 {
9436 p.Stop();
9437 OP.RegisterParticle(null);
9438 }
9439 }
9440 }
9441 }
9442 }
9443
9445 {
9447 {
9448 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
9449 {
9450 int id = i - 1;
9451 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9452
9453 if (OP)
9454 {
9455 Particle p = OP.GetParticle();
9456
9457 if (p)
9458 {
9459 p.Stop();
9460 }
9461
9462 delete OP;
9463 }
9464 }
9465
9466 m_OverheatingParticles.Clear();
9468 }
9469 }
9470
9472 float GetInfectionChance(int system = 0, Param param = null)
9473 {
9474 return 0.0;
9475 }
9476
9477
9478 float GetDisinfectQuantity(int system = 0, Param param1 = null)
9479 {
9480 return 250;//default value
9481 }
9482
9483 float GetFilterDamageRatio()
9484 {
9485 return 0;
9486 }
9487
9489 bool HasMuzzle()
9490 {
9491 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9492 return true;
9493
9494 return false;
9495 }
9496
9498 int GetMuzzleID()
9499 {
9500 if (!m_WeaponTypeToID)
9502
9503 if (m_WeaponTypeToID.Contains(GetType()))
9504 {
9505 return m_WeaponTypeToID.Get(GetType());
9506 }
9507 else
9508 {
9509 // Register new weapon ID
9511 }
9512
9514 }
9515
9522 {
9523 return -1;
9524 }
9525
9526
9527
9528 // -------------------------------------------------------------------------
9529 void ~ItemBase()
9530 {
9531 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9532 {
9533 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9534 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9535
9536 if (r_index >= 0)
9537 {
9538 InventoryLocation r_il = new InventoryLocation;
9539 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9540
9541 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9542 int r_type = r_il.GetType();
9543 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9544 {
9545 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9546 }
9547 else if (r_type == InventoryLocationType.ATTACHMENT)
9548 {
9549 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9550 }
9551
9552 }
9553
9554 player.GetHumanInventory().ClearUserReservedLocation(this);
9555 }
9556
9557 if (m_LockingSound)
9558 SEffectManager.DestroyEffect(m_LockingSound);
9559 }
9560
9561
9562
9563 // -------------------------------------------------------------------------
9564 static int GetDebugActionsMask()
9565 {
9566 return ItemBase.m_DebugActionsMask;
9567 }
9568
9569 static bool HasDebugActionsMask(int mask)
9570 {
9571 return ItemBase.m_DebugActionsMask & mask;
9572 }
9573
9574 static void SetDebugActionsMask(int mask)
9575 {
9576 ItemBase.m_DebugActionsMask = mask;
9577 }
9578
9579 static void AddDebugActionsMask(int mask)
9580 {
9581 ItemBase.m_DebugActionsMask |= mask;
9582 }
9583
9584 static void RemoveDebugActionsMask(int mask)
9585 {
9586 ItemBase.m_DebugActionsMask &= ~mask;
9587 }
9588
9589 static void ToggleDebugActionsMask(int mask)
9590 {
9591 if (HasDebugActionsMask(mask))
9592 {
9594 }
9595 else
9596 {
9597 AddDebugActionsMask(mask);
9598 }
9599 }
9600
9601 // -------------------------------------------------------------------------
9602 void SetCEBasedQuantity()
9603 {
9604 if (GetEconomyProfile())
9605 {
9606 float q_max = GetEconomyProfile().GetQuantityMax();
9607 if (q_max > 0)
9608 {
9609 float q_min = GetEconomyProfile().GetQuantityMin();
9610 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9611
9612 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9613 {
9614 ComponentEnergyManager comp = GetCompEM();
9615 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
9616 {
9617 comp.SetEnergy0To1(quantity_randomized);
9618 }
9619 }
9620 else if (HasQuantity())
9621 {
9622 SetQuantityNormalized(quantity_randomized, false);
9623 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9624 }
9625
9626 }
9627 }
9628 }
9629
9631 void LockToParent()
9632 {
9633 EntityAI parent = GetHierarchyParent();
9634
9635 if (parent)
9636 {
9637 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9638 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9639 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9640 }
9641 }
9642
9644 void UnlockFromParent()
9645 {
9646 EntityAI parent = GetHierarchyParent();
9647
9648 if (parent)
9649 {
9650 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9651 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9652 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9653 }
9654 }
9655
9656 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9657 {
9658 /*
9659 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9660 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9661 */
9662 ItemBase item2 = ItemBase.Cast(entity2);
9663
9664 if (GetGame().IsClient())
9665 {
9666 if (ScriptInputUserData.CanStoreInputUserData())
9667 {
9668 ScriptInputUserData ctx = new ScriptInputUserData;
9670 ctx.Write(-1);
9671 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9672 ctx.Write(i1);
9673 ctx.Write(item2);
9674 ctx.Write(use_stack_max);
9675 ctx.Write(-1);
9676 ctx.Send();
9677
9678 if (IsCombineAll(item2, use_stack_max))
9679 {
9680 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9681 }
9682 }
9683 }
9684 else if (!GetGame().IsMultiplayer())
9685 {
9686 CombineItems(item2, use_stack_max);
9687 }
9688 }
9689
9690 bool IsLiquidPresent()
9691 {
9692 return (GetLiquidType() != 0 && HasQuantity());
9693 }
9694
9695 bool IsLiquidContainer()
9696 {
9697 return m_LiquidContainerMask != 0;
9698 }
9699
9701 {
9702 return m_LiquidContainerMask;
9703 }
9704
9705 bool IsBloodContainer()
9706 {
9707 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9708 return false;
9709 }
9710
9711 bool IsNVG()
9712 {
9713 return false;
9714 }
9715
9718 bool IsExplosive()
9719 {
9720 return false;
9721 }
9722
9724 {
9725 return "";
9726 }
9727
9729
9730 bool IsLightSource()
9731 {
9732 return false;
9733 }
9734
9736 {
9737 return true;
9738 }
9739
9740 //--- ACTION CONDITIONS
9741 //direction
9742 bool IsFacingPlayer(PlayerBase player, string selection)
9743 {
9744 return true;
9745 }
9746
9747 bool IsPlayerInside(PlayerBase player, string selection)
9748 {
9749 return true;
9750 }
9751
9752 override bool CanObstruct()
9753 {
9754 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9755 return !player || !IsPlayerInside(player, "");
9756 }
9757
9758 override bool IsBeingPlaced()
9759 {
9760 return m_IsBeingPlaced;
9761 }
9762
9763 void SetIsBeingPlaced(bool is_being_placed)
9764 {
9765 m_IsBeingPlaced = is_being_placed;
9766 if (!is_being_placed)
9768 SetSynchDirty();
9769 }
9770
9771 //server-side
9772 void OnEndPlacement() {}
9773
9774 override bool IsHologram()
9775 {
9776 return m_IsHologram;
9777 }
9778
9779 bool CanBeDigged()
9780 {
9781 return m_CanBeDigged;
9782 }
9783
9785 {
9786 return 1;
9787 }
9788
9789 bool CanMakeGardenplot()
9790 {
9791 return false;
9792 }
9793
9794 void SetIsHologram(bool is_hologram)
9795 {
9796 m_IsHologram = is_hologram;
9797 SetSynchDirty();
9798 }
9799 /*
9800 protected float GetNutritionalEnergy()
9801 {
9802 Edible_Base edible = Edible_Base.Cast(this);
9803 return edible.GetFoodEnergy();
9804 }
9805
9806 protected float GetNutritionalWaterContent()
9807 {
9808 Edible_Base edible = Edible_Base.Cast(this);
9809 return edible.GetFoodWater();
9810 }
9811
9812 protected float GetNutritionalIndex()
9813 {
9814 Edible_Base edible = Edible_Base.Cast(this);
9815 return edible.GetFoodNutritionalIndex();
9816 }
9817
9818 protected float GetNutritionalFullnessIndex()
9819 {
9820 Edible_Base edible = Edible_Base.Cast(this);
9821 return edible.GetFoodTotalVolume();
9822 }
9823
9824 protected float GetNutritionalToxicity()
9825 {
9826 Edible_Base edible = Edible_Base.Cast(this);
9827 return edible.GetFoodToxicity();
9828
9829 }
9830 */
9831
9832
9833 // -------------------------------------------------------------------------
9834 override void OnMovedInsideCargo(EntityAI container)
9835 {
9836 super.OnMovedInsideCargo(container);
9837
9838 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9839 }
9840
9841 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9842 {
9843 super.EEItemLocationChanged(oldLoc,newLoc);
9844
9845 PlayerBase new_player = null;
9846 PlayerBase old_player = null;
9847
9848 if (newLoc.GetParent())
9849 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9850
9851 if (oldLoc.GetParent())
9852 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9853
9854 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9855 {
9856 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9857
9858 if (r_index >= 0)
9859 {
9860 InventoryLocation r_il = new InventoryLocation;
9861 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9862
9863 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9864 int r_type = r_il.GetType();
9865 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9866 {
9867 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9868 }
9869 else if (r_type == InventoryLocationType.ATTACHMENT)
9870 {
9871 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9872 }
9873
9874 }
9875 }
9876
9877 if (newLoc.GetType() == InventoryLocationType.HANDS)
9878 {
9879 if (new_player)
9880 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9881
9882 if (new_player == old_player)
9883 {
9884
9885 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9886 {
9887 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9888 {
9889 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9890 {
9891 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9892 }
9893 }
9894 else
9895 {
9896 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9897 }
9898 }
9899
9900 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9901 {
9902 int type = oldLoc.GetType();
9903 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9904 {
9905 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9906 }
9907 else if (type == InventoryLocationType.ATTACHMENT)
9908 {
9909 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9910 }
9911 }
9912 if (!m_OldLocation)
9913 {
9914 m_OldLocation = new InventoryLocation;
9915 }
9916 m_OldLocation.Copy(oldLoc);
9917 }
9918 else
9919 {
9920 if (m_OldLocation)
9921 {
9922 m_OldLocation.Reset();
9923 }
9924 }
9925
9927 }
9928 else
9929 {
9930 if (new_player)
9931 {
9932 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9933 if (res_index >= 0)
9934 {
9935 InventoryLocation il = new InventoryLocation;
9936 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9937 ItemBase it = ItemBase.Cast(il.GetItem());
9938 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9939 int rel_type = il.GetType();
9940 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9941 {
9942 il.GetParent().GetOnReleaseLock().Invoke(it);
9943 }
9944 else if (rel_type == InventoryLocationType.ATTACHMENT)
9945 {
9946 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9947 }
9948 //it.GetOnReleaseLock().Invoke(it);
9949 }
9950 }
9951 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9952 {
9953 //ThrowPhysically(old_player, vector.Zero);
9954 m_ThrowItemOnDrop = false;
9955 }
9956
9957 if (m_OldLocation)
9958 {
9959 m_OldLocation.Reset();
9960 }
9961 }
9962 }
9963
9964 override void EOnContact(IEntity other, Contact extra)
9965 {
9967 {
9968 int liquidType = -1;
9969 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9970 if (impactSpeed > 0.0)
9971 {
9972 m_ImpactSpeed = impactSpeed;
9973 #ifndef SERVER
9974 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9975 #else
9976 m_WantPlayImpactSound = true;
9977 SetSynchDirty();
9978 #endif
9979 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9980 }
9981 }
9982
9983 #ifdef SERVER
9984 if (GetCompEM() && GetCompEM().IsPlugged())
9985 {
9986 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9987 GetCompEM().UnplugThis();
9988 }
9989 #endif
9990 }
9991
9992 void RefreshPhysics();
9993
9994 override void OnCreatePhysics()
9995 {
9997 }
9998
9999 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10000 {
10001
10002 }
10003 // -------------------------------------------------------------------------
10004 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
10005 {
10006 super.OnItemLocationChanged(old_owner, new_owner);
10007
10008 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10009 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10010
10011 if (!relatedPlayer && playerNew)
10012 relatedPlayer = playerNew;
10013
10014 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10015 {
10016 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
10017 if (actionMgr)
10018 {
10019 ActionBase currentAction = actionMgr.GetRunningAction();
10020 if (currentAction)
10021 currentAction.OnItemLocationChanged(this);
10022 }
10023 }
10024
10025 Man ownerPlayerOld = null;
10026 Man ownerPlayerNew = null;
10027
10028 if (old_owner)
10029 {
10030 if (old_owner.IsMan())
10031 {
10032 ownerPlayerOld = Man.Cast(old_owner);
10033 }
10034 else
10035 {
10036 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10037 }
10038 }
10039 else
10040 {
10041 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
10042 {
10043 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
10044
10045 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
10046 {
10047 GetCompEM().UnplugThis();
10048 }
10049 }
10050 }
10051
10052 if (new_owner)
10053 {
10054 if (new_owner.IsMan())
10055 {
10056 ownerPlayerNew = Man.Cast(new_owner);
10057 }
10058 else
10059 {
10060 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10061 }
10062 }
10063
10064 if (ownerPlayerOld != ownerPlayerNew)
10065 {
10066 if (ownerPlayerOld)
10067 {
10068 array<EntityAI> subItemsExit = new array<EntityAI>;
10069 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
10070 for (int i = 0; i < subItemsExit.Count(); i++)
10071 {
10072 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
10073 itemExit.OnInventoryExit(ownerPlayerOld);
10074 }
10075 }
10076
10077 if (ownerPlayerNew)
10078 {
10079 array<EntityAI> subItemsEnter = new array<EntityAI>;
10080 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10081 for (int j = 0; j < subItemsEnter.Count(); j++)
10082 {
10083 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10084 itemEnter.OnInventoryEnter(ownerPlayerNew);
10085 }
10086 }
10087 }
10088 else if (ownerPlayerNew != null)
10089 {
10090 PlayerBase nplayer;
10091 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10092 {
10093 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10094 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10095 for (int k = 0; k < subItemsUpdate.Count(); k++)
10096 {
10097 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10098 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10099 }
10100 }
10101 }
10102
10103 if (old_owner)
10104 old_owner.OnChildItemRemoved(this);
10105 if (new_owner)
10106 new_owner.OnChildItemReceived(this);
10107 }
10108
10109 // -------------------------------------------------------------------------------
10110 override void EEDelete(EntityAI parent)
10111 {
10112 super.EEDelete(parent);
10113 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10114 if (player)
10115 {
10116 OnInventoryExit(player);
10117
10118 if (player.IsAlive())
10119 {
10120 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10121 if (r_index >= 0)
10122 {
10123 InventoryLocation r_il = new InventoryLocation;
10124 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10125
10126 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10127 int r_type = r_il.GetType();
10128 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10129 {
10130 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10131 }
10132 else if (r_type == InventoryLocationType.ATTACHMENT)
10133 {
10134 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10135 }
10136
10137 }
10138
10139 player.RemoveQuickBarEntityShortcut(this);
10140 }
10141 }
10142 }
10143 // -------------------------------------------------------------------------------
10144 override void EEKilled(Object killer)
10145 {
10146 super.EEKilled(killer);
10147
10149 if (killer && killer.IsFireplace() && CanExplodeInFire())
10150 {
10151 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10152 {
10153 if (IsMagazine())
10154 {
10155 if (Magazine.Cast(this).GetAmmoCount() > 0)
10156 {
10157 ExplodeAmmo();
10158 }
10159 }
10160 else
10161 {
10162 Explode(DamageType.EXPLOSION);
10163 }
10164 }
10165 }
10166 }
10167
10168 override void OnWasAttached(EntityAI parent, int slot_id)
10169 {
10170 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10171
10172 super.OnWasAttached(parent, slot_id);
10173
10174 if (HasQuantity())
10175 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10176
10177 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10178 }
10179
10180 override void OnWasDetached(EntityAI parent, int slot_id)
10181 {
10182 super.OnWasDetached(parent, slot_id);
10183
10184 if (HasQuantity())
10185 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10186 }
10187
10188 override string ChangeIntoOnAttach(string slot)
10189 {
10190 int idx;
10191 TStringArray inventory_slots = new TStringArray;
10192 TStringArray attach_types = new TStringArray;
10193
10194 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10195 if (inventory_slots.Count() < 1) //is string
10196 {
10197 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10198 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10199 }
10200 else //is array
10201 {
10202 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10203 }
10204
10205 idx = inventory_slots.Find(slot);
10206 if (idx < 0)
10207 return "";
10208
10209 return attach_types.Get(idx);
10210 }
10211
10212 override string ChangeIntoOnDetach()
10213 {
10214 int idx = -1;
10215 string slot;
10216
10217 TStringArray inventory_slots = new TStringArray;
10218 TStringArray detach_types = new TStringArray;
10219
10220 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10221 if (inventory_slots.Count() < 1) //is string
10222 {
10223 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10224 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10225 }
10226 else //is array
10227 {
10228 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10229 if (detach_types.Count() < 1)
10230 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10231 }
10232
10233 for (int i = 0; i < inventory_slots.Count(); i++)
10234 {
10235 slot = inventory_slots.Get(i);
10236 }
10237
10238 if (slot != "")
10239 {
10240 if (detach_types.Count() == 1)
10241 idx = 0;
10242 else
10243 idx = inventory_slots.Find(slot);
10244 }
10245 if (idx < 0)
10246 return "";
10247
10248 return detach_types.Get(idx);
10249 }
10250
10251 void ExplodeAmmo()
10252 {
10253 //timer
10254 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10255
10256 //min/max time
10257 float min_time = 1;
10258 float max_time = 3;
10259 float delay = Math.RandomFloat(min_time, max_time);
10260
10261 explode_timer.Run(delay, this, "DoAmmoExplosion");
10262 }
10263
10264 void DoAmmoExplosion()
10265 {
10266 Magazine magazine = Magazine.Cast(this);
10267 int pop_sounds_count = 6;
10268 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10269
10270 //play sound
10271 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10272 string sound_name = pop_sounds[ sound_idx ];
10273 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10274
10275 //remove ammo count
10276 magazine.ServerAddAmmoCount(-1);
10277
10278 //if condition then repeat -> ExplodeAmmo
10279 float min_temp_to_explode = 100; //min temperature for item to explode
10280
10281 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10282 {
10283 ExplodeAmmo();
10284 }
10285 }
10286
10287 // -------------------------------------------------------------------------------
10288 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10289 {
10290 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10291
10292 const int CHANCE_DAMAGE_CARGO = 4;
10293 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10294 const int CHANCE_DAMAGE_NOTHING = 2;
10295
10296 if (IsClothing() || IsContainer() || IsItemTent())
10297 {
10298 float dmg = damageResult.GetDamage("","Health") * -0.5;
10299 int chances;
10300 int rnd;
10301
10302 if (GetInventory().GetCargo())
10303 {
10304 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10305 rnd = Math.RandomInt(0,chances);
10306
10307 if (rnd < CHANCE_DAMAGE_CARGO)
10308 {
10309 DamageItemInCargo(dmg);
10310 }
10311 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10312 {
10314 }
10315 }
10316 else
10317 {
10318 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10319 rnd = Math.RandomInt(0,chances);
10320
10321 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10322 {
10324 }
10325 }
10326 }
10327 }
10328
10329 bool DamageItemInCargo(float damage)
10330 {
10331 if (GetInventory().GetCargo())
10332 {
10333 int item_count = GetInventory().GetCargo().GetItemCount();
10334 if (item_count > 0)
10335 {
10336 int random_pick = Math.RandomInt(0, item_count);
10337 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10338 if (!item.IsExplosive())
10339 {
10340 item.AddHealth("","",damage);
10341 return true;
10342 }
10343 }
10344 }
10345 return false;
10346 }
10347
10348 bool DamageItemAttachments(float damage)
10349 {
10350 int attachment_count = GetInventory().AttachmentCount();
10351 if (attachment_count > 0)
10352 {
10353 int random_pick = Math.RandomInt(0, attachment_count);
10354 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10355 if (!attachment.IsExplosive())
10356 {
10357 attachment.AddHealth("","",damage);
10358 return true;
10359 }
10360 }
10361 return false;
10362 }
10363
10364 override bool IsSplitable()
10365 {
10366 return m_CanThisBeSplit;
10367 }
10368 //----------------
10369 override bool CanBeSplit()
10370 {
10371 if (IsSplitable() && (GetQuantity() > 1))
10372 return GetInventory().CanRemoveEntity();
10373
10374 return false;
10375 }
10376
10377 protected bool ShouldSplitQuantity(float quantity)
10378 {
10379 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
10380 if (!IsSplitable())
10381 return false;
10382
10383 // nothing to split?
10384 if (GetQuantity() <= 1)
10385 return false;
10386
10387 // check if we should re-use the item instead of creating a new copy?
10388 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
10389 int delta = GetQuantity() - quantity;
10390 if (delta == 0)
10391 return false;
10392
10393 // valid to split
10394 return true;
10395 }
10396
10397 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10398 {
10399 if (GetGame().IsClient())
10400 {
10401 if (ScriptInputUserData.CanStoreInputUserData())
10402 {
10403 ScriptInputUserData ctx = new ScriptInputUserData;
10405 ctx.Write(1);
10406 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10407 ctx.Write(i1);
10408 ctx.Write(destination_entity);
10409 ctx.Write(true);
10410 ctx.Write(slot_id);
10411 ctx.Send();
10412 }
10413 }
10414 else if (!GetGame().IsMultiplayer())
10415 {
10416 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
10417 }
10418 }
10419
10420 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
10421 {
10422 float split_quantity_new;
10423 ItemBase new_item;
10424 float quantity = GetQuantity();
10425 float stack_max = GetTargetQuantityMax(slot_id);
10426 InventoryLocation loc = new InventoryLocation;
10427
10428 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10429 {
10430 if (stack_max <= GetQuantity())
10431 split_quantity_new = stack_max;
10432 else
10433 split_quantity_new = GetQuantity();
10434
10435 if (ShouldSplitQuantity(split_quantity_new))
10436 {
10437 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10438 if (new_item)
10439 {
10440 new_item.SetResultOfSplit(true);
10441 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10442 AddQuantity(-split_quantity_new, false, true);
10443 new_item.SetQuantity(split_quantity_new, false, true);
10444 }
10445 }
10446 }
10447 else if (destination_entity && slot_id == -1)
10448 {
10449 if (quantity > stack_max)
10450 split_quantity_new = stack_max;
10451 else
10452 split_quantity_new = quantity;
10453
10454 if (ShouldSplitQuantity(split_quantity_new))
10455 {
10456 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10457 {
10458 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10459 new_item = ItemBase.Cast(o);
10460 }
10461
10462 if (new_item)
10463 {
10464 new_item.SetResultOfSplit(true);
10465 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10466 AddQuantity(-split_quantity_new, false, true);
10467 new_item.SetQuantity(split_quantity_new, false, true);
10468 }
10469 }
10470 }
10471 else
10472 {
10473 if (stack_max != 0)
10474 {
10475 if (stack_max < GetQuantity())
10476 {
10477 split_quantity_new = GetQuantity() - stack_max;
10478 }
10479
10480 if (split_quantity_new == 0)
10481 {
10482 if (!GetGame().IsMultiplayer())
10483 player.PhysicalPredictiveDropItem(this);
10484 else
10485 player.ServerDropEntity(this);
10486 return;
10487 }
10488
10489 if (ShouldSplitQuantity(split_quantity_new))
10490 {
10491 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10492
10493 if (new_item)
10494 {
10495 new_item.SetResultOfSplit(true);
10496 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10497 SetQuantity(split_quantity_new, false, true);
10498 new_item.SetQuantity(stack_max, false, true);
10499 new_item.PlaceOnSurface();
10500 }
10501 }
10502 }
10503 }
10504 }
10505
10506 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
10507 {
10508 float split_quantity_new;
10509 ItemBase new_item;
10510 float quantity = GetQuantity();
10511 float stack_max = GetTargetQuantityMax(slot_id);
10512 InventoryLocation loc = new InventoryLocation;
10513
10514 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10515 {
10516 if (stack_max <= GetQuantity())
10517 split_quantity_new = stack_max;
10518 else
10519 split_quantity_new = GetQuantity();
10520
10521 if (ShouldSplitQuantity(split_quantity_new))
10522 {
10523 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10524 if (new_item)
10525 {
10526 new_item.SetResultOfSplit(true);
10527 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10528 AddQuantity(-split_quantity_new, false, true);
10529 new_item.SetQuantity(split_quantity_new, false, true);
10530 }
10531 }
10532 }
10533 else if (destination_entity && slot_id == -1)
10534 {
10535 if (quantity > stack_max)
10536 split_quantity_new = stack_max;
10537 else
10538 split_quantity_new = quantity;
10539
10540 if (ShouldSplitQuantity(split_quantity_new))
10541 {
10542 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10543 {
10544 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10545 new_item = ItemBase.Cast(o);
10546 }
10547
10548 if (new_item)
10549 {
10550 new_item.SetResultOfSplit(true);
10551 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10552 AddQuantity(-split_quantity_new, false, true);
10553 new_item.SetQuantity(split_quantity_new, false, true);
10554 }
10555 }
10556 }
10557 else
10558 {
10559 if (stack_max != 0)
10560 {
10561 if (stack_max < GetQuantity())
10562 {
10563 split_quantity_new = GetQuantity() - stack_max;
10564 }
10565
10566 if (ShouldSplitQuantity(split_quantity_new))
10567 {
10568 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10569
10570 if (new_item)
10571 {
10572 new_item.SetResultOfSplit(true);
10573 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10574 SetQuantity(split_quantity_new, false, true);
10575 new_item.SetQuantity(stack_max, false, true);
10576 new_item.PlaceOnSurface();
10577 }
10578 }
10579 }
10580 }
10581 }
10582
10583 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10584 {
10585 if (GetGame().IsClient())
10586 {
10587 if (ScriptInputUserData.CanStoreInputUserData())
10588 {
10589 ScriptInputUserData ctx = new ScriptInputUserData;
10591 ctx.Write(4);
10592 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10593 ctx.Write(thiz);
10594 dst.WriteToContext(ctx);
10595 ctx.Send();
10596 }
10597 }
10598 else if (!GetGame().IsMultiplayer())
10599 {
10601 }
10602 }
10603
10604 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10605 {
10606 if (GetGame().IsClient())
10607 {
10608 if (ScriptInputUserData.CanStoreInputUserData())
10609 {
10610 ScriptInputUserData ctx = new ScriptInputUserData;
10612 ctx.Write(2);
10613 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10614 ctx.Write(dummy);
10615 ctx.Write(destination_entity);
10616 ctx.Write(true);
10617 ctx.Write(idx);
10618 ctx.Write(row);
10619 ctx.Write(col);
10620 ctx.Send();
10621 }
10622 }
10623 else if (!GetGame().IsMultiplayer())
10624 {
10625 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10626 }
10627 }
10628
10629 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10630 {
10632 }
10633
10634 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10635 {
10636 float quantity = GetQuantity();
10637 float split_quantity_new;
10638 ItemBase new_item;
10639 if (dst.IsValid())
10640 {
10641 int slot_id = dst.GetSlot();
10642 float stack_max = GetTargetQuantityMax(slot_id);
10643
10644 if (quantity > stack_max)
10645 split_quantity_new = stack_max;
10646 else
10647 split_quantity_new = quantity;
10648
10649 if (ShouldSplitQuantity(split_quantity_new))
10650 {
10651 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10652
10653 if (new_item)
10654 {
10655 new_item.SetResultOfSplit(true);
10656 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10657 AddQuantity(-split_quantity_new, false, true);
10658 new_item.SetQuantity(split_quantity_new, false, true);
10659 }
10660
10661 return new_item;
10662 }
10663 }
10664
10665 return null;
10666 }
10667
10668 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10669 {
10670 float quantity = GetQuantity();
10671 float split_quantity_new;
10672 ItemBase new_item;
10673 if (destination_entity)
10674 {
10675 float stackable = GetTargetQuantityMax();
10676 if (quantity > stackable)
10677 split_quantity_new = stackable;
10678 else
10679 split_quantity_new = quantity;
10680
10681 if (ShouldSplitQuantity(split_quantity_new))
10682 {
10683 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10684 if (new_item)
10685 {
10686 new_item.SetResultOfSplit(true);
10687 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10688 AddQuantity(-split_quantity_new, false, true);
10689 new_item.SetQuantity(split_quantity_new, false, true);
10690 }
10691 }
10692 }
10693 }
10694
10695 void SplitIntoStackMaxHandsClient(PlayerBase player)
10696 {
10697 if (GetGame().IsClient())
10698 {
10699 if (ScriptInputUserData.CanStoreInputUserData())
10700 {
10701 ScriptInputUserData ctx = new ScriptInputUserData;
10703 ctx.Write(3);
10704 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10705 ctx.Write(i1);
10706 ItemBase destination_entity = this;
10707 ctx.Write(destination_entity);
10708 ctx.Write(true);
10709 ctx.Write(0);
10710 ctx.Send();
10711 }
10712 }
10713 else if (!GetGame().IsMultiplayer())
10714 {
10715 SplitIntoStackMaxHands(player);
10716 }
10717 }
10718
10719 void SplitIntoStackMaxHands(PlayerBase player)
10720 {
10721 float quantity = GetQuantity();
10722 float split_quantity_new;
10723 ref ItemBase new_item;
10724 if (player)
10725 {
10726 float stackable = GetTargetQuantityMax();
10727 if (quantity > stackable)
10728 split_quantity_new = stackable;
10729 else
10730 split_quantity_new = quantity;
10731
10732 if (ShouldSplitQuantity(split_quantity_new))
10733 {
10734 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10735 new_item = ItemBase.Cast(in_hands);
10736 if (new_item)
10737 {
10738 new_item.SetResultOfSplit(true);
10739 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10740 AddQuantity(-split_quantity_new, false, true);
10741 new_item.SetQuantity(split_quantity_new, false, true);
10742 }
10743 }
10744 }
10745 }
10746
10747 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10748 {
10749 float quantity = GetQuantity();
10750 float split_quantity_new = Math.Floor(quantity * 0.5);
10751
10752 if (!ShouldSplitQuantity(split_quantity_new))
10753 return;
10754
10755 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10756
10757 if (new_item)
10758 {
10759 if (new_item.GetQuantityMax() < split_quantity_new)
10760 {
10761 split_quantity_new = new_item.GetQuantityMax();
10762 }
10763
10764 new_item.SetResultOfSplit(true);
10765 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10766
10767 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10768 {
10769 AddQuantity(-1, false, true);
10770 new_item.SetQuantity(1, false, true);
10771 }
10772 else
10773 {
10774 AddQuantity(-split_quantity_new, false, true);
10775 new_item.SetQuantity(split_quantity_new, false, true);
10776 }
10777 }
10778 }
10779
10780 void SplitItem(PlayerBase player)
10781 {
10782 float quantity = GetQuantity();
10783 float split_quantity_new = Math.Floor(quantity / 2);
10784
10785 if (!ShouldSplitQuantity(split_quantity_new))
10786 return;
10787
10788 InventoryLocation invloc = new InventoryLocation;
10789 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10790
10791 ItemBase new_item;
10792 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10793
10794 if (new_item)
10795 {
10796 if (new_item.GetQuantityMax() < split_quantity_new)
10797 {
10798 split_quantity_new = new_item.GetQuantityMax();
10799 }
10800 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10801 {
10802 AddQuantity(-1, false, true);
10803 new_item.SetQuantity(1, false, true);
10804 }
10805 else if (split_quantity_new > 1)
10806 {
10807 AddQuantity(-split_quantity_new, false, true);
10808 new_item.SetQuantity(split_quantity_new, false, true);
10809 }
10810 }
10811 }
10812
10814 void OnQuantityChanged(float delta)
10815 {
10816 SetWeightDirty();
10817 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10818
10819 if (parent)
10820 parent.OnAttachmentQuantityChangedEx(this, delta);
10821
10822 if (IsLiquidContainer())
10823 {
10824 if (GetQuantityNormalized() <= 0.0)
10825 {
10827 }
10828 else if (GetLiquidType() == LIQUID_NONE)
10829 {
10830 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10832 }
10833 }
10834
10835 }
10836
10839 {
10840 // insert code here
10841 }
10842
10844 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10845 {
10847 }
10848
10849 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10850 {
10851 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10852
10853 if (GetGame().IsServer())
10854 {
10855 if (newLevel == GameConstants.STATE_RUINED)
10856 {
10858 EntityAI parent = GetHierarchyParent();
10859 if (parent && parent.IsFireplace())
10860 {
10861 CargoBase cargo = GetInventory().GetCargo();
10862 if (cargo)
10863 {
10864 for (int i = 0; i < cargo.GetItemCount(); ++i)
10865 {
10866 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10867 }
10868 }
10869 }
10870 }
10871
10872 if (IsResultOfSplit())
10873 {
10874 // reset the splitting result flag, return to normal item behavior
10875 SetResultOfSplit(false);
10876 return;
10877 }
10878
10879 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10880 {
10881 SetCleanness(0);//unclean the item upon damage dealt
10882 }
10883 }
10884 }
10885
10886 // just the split? TODO: verify
10887 override void OnRightClick()
10888 {
10889 super.OnRightClick();
10890
10891 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10892 {
10893 if (GetGame().IsClient())
10894 {
10895 if (ScriptInputUserData.CanStoreInputUserData())
10896 {
10897 EntityAI root = GetHierarchyRoot();
10898 Man playerOwner = GetHierarchyRootPlayer();
10899 InventoryLocation dst = new InventoryLocation;
10900
10901 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
10902 if (!playerOwner && root && root == this)
10903 {
10905 }
10906 else
10907 {
10908 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
10909 GetInventory().GetCurrentInventoryLocation(dst);
10910 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
10911 {
10912 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10913 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
10914 {
10916 }
10917 else
10918 {
10919 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10920 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10921 this shouldnt cause issues within this scope*/
10922 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10923 {
10925 }
10926 else
10927 {
10928 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10929 }
10930 }
10931 }
10932 }
10933
10934 ScriptInputUserData ctx = new ScriptInputUserData;
10936 ctx.Write(4);
10937 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10938 ctx.Write(thiz);
10939 dst.WriteToContext(ctx);
10940 ctx.Write(true); // dummy
10941 ctx.Send();
10942 }
10943 }
10944 else if (!GetGame().IsMultiplayer())
10945 {
10946 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10947 }
10948 }
10949 }
10950
10951 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
10952 {
10953 if (root)
10954 {
10955 vector m4[4];
10956 root.GetTransform(m4);
10957 dst.SetGround(this, m4);
10958 }
10959 else
10960 {
10961 GetInventory().GetCurrentInventoryLocation(dst);
10962 }
10963 }
10964
10965 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10966 {
10967 //TODO: delete check zero quantity check after fix double posts hands fsm events
10968 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10969 return false;
10970
10971 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10972 return false;
10973
10974 //can_this_be_combined = ConfigGetBool("canBeSplit");
10976 return false;
10977
10978
10979 Magazine mag = Magazine.Cast(this);
10980 if (mag)
10981 {
10982 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10983 return false;
10984
10985 if (stack_max_limit)
10986 {
10987 Magazine other_mag = Magazine.Cast(other_item);
10988 if (other_item)
10989 {
10990 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10991 return false;
10992 }
10993
10994 }
10995 }
10996 else
10997 {
10998 //TODO: delete check zero quantity check after fix double posts hands fsm events
10999 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
11000 return false;
11001
11002 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
11003 return false;
11004 }
11005
11006 PlayerBase player = null;
11007 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
11008 {
11009 if (player.GetInventory().HasAttachment(this))
11010 return false;
11011
11012 if (player.IsItemsToDelete())
11013 return false;
11014 }
11015
11016 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11017 return false;
11018
11019 int slotID;
11020 string slotName;
11021 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11022 return false;
11023
11024 return true;
11025 }
11026
11027 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
11028 {
11029 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
11030 }
11031
11032 bool IsResultOfSplit()
11033 {
11034 return m_IsResultOfSplit;
11035 }
11036
11037 void SetResultOfSplit(bool value)
11038 {
11039 m_IsResultOfSplit = value;
11040 }
11041
11042 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
11043 {
11044 return ComputeQuantityUsedEx(other_item, use_stack_max);
11045 }
11046
11047 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
11048 {
11049 float other_item_quantity = other_item.GetQuantity();
11050 float this_free_space;
11051
11052 float stack_max = GetQuantityMax();
11053
11054 this_free_space = stack_max - GetQuantity();
11055
11056 if (other_item_quantity > this_free_space)
11057 {
11058 return this_free_space;
11059 }
11060 else
11061 {
11062 return other_item_quantity;
11063 }
11064 }
11065
11066 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
11067 {
11068 CombineItems(ItemBase.Cast(entity2),use_stack_max);
11069 }
11070
11071 void CombineItems(ItemBase other_item, bool use_stack_max = true)
11072 {
11073 if (!CanBeCombined(other_item, false))
11074 return;
11075
11076 if (!IsMagazine() && other_item)
11077 {
11078 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
11079 if (quantity_used != 0)
11080 {
11081 float hp1 = GetHealth01("","");
11082 float hp2 = other_item.GetHealth01("","");
11083 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
11084 hpResult = hpResult / (GetQuantity() + quantity_used);
11085
11086 hpResult *= GetMaxHealth();
11087 Math.Round(hpResult);
11088 SetHealth("", "Health", hpResult);
11089
11090 AddQuantity(quantity_used);
11091 other_item.AddQuantity(-quantity_used);
11092 }
11093 }
11094 OnCombine(other_item);
11095 }
11096
11097 void OnCombine(ItemBase other_item)
11098 {
11099 #ifdef SERVER
11100 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11101 GetHierarchyParent().IncreaseLifetimeUp();
11102 #endif
11103 };
11104
11105 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
11106 {
11107 PlayerBase p = PlayerBase.Cast(player);
11108
11109 array<int> recipesIds = p.m_Recipes;
11110 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11111 if (moduleRecipesManager)
11112 {
11113 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11114 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11115 }
11116
11117 for (int i = 0;i < recipesIds.Count(); i++)
11118 {
11119 int key = recipesIds.Get(i);
11120 string recipeName = moduleRecipesManager.GetRecipeName(key);
11121 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11122 }
11123 }
11124
11125 // -------------------------------------------------------------------------
11126 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11127 {
11128 super.GetDebugActions(outputList);
11129
11130 //quantity
11131 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11132 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11133 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11134 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11135 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11136
11137 //health
11138 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11139 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11140 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11141 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11142 //temperature
11143 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11144 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11145 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11146 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11147
11148 //wet
11149 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11150 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11151 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11152
11153 //liquidtype
11154 if (IsLiquidContainer())
11155 {
11156 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11157 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11158 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11159 }
11160
11161 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11162 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11163
11164 // watch
11165 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11166 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11167 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11168
11169 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11170
11171 InventoryLocation loc = new InventoryLocation();
11172 GetInventory().GetCurrentInventoryLocation(loc);
11173 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
11174 {
11175 if (Gizmo_IsSupported())
11176 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
11177 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
11178 }
11179
11180 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11181 }
11182
11183 // -------------------------------------------------------------------------
11184 // -------------------------------------------------------------------------
11185 // -------------------------------------------------------------------------
11186 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11187 {
11188 super.OnAction(action_id, player, ctx);
11189
11190 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
11191 {
11192 switch (action_id)
11193 {
11194 case EActions.GIZMO_OBJECT:
11195 GetGame().GizmoSelectObject(this);
11196 return true;
11197 case EActions.GIZMO_PHYSICS:
11198 GetGame().GizmoSelectPhysics(GetPhysics());
11199 return true;
11200 }
11201 }
11202
11203 if (GetGame().IsServer())
11204 {
11205 switch (action_id)
11206 {
11207 case EActions.DELETE:
11208 Delete();
11209 return true;
11210 }
11211 }
11212
11213 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11214 {
11215 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11216 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11217 PlayerBase p = PlayerBase.Cast(player);
11218 if (EActions.RECIPES_RANGE_START < 1000)
11219 {
11220 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11221 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11222 }
11223 }
11224 #ifndef SERVER
11225 else if (action_id == EActions.WATCH_PLAYER)
11226 {
11227 PluginDeveloper.SetDeveloperItemClientEx(player);
11228 }
11229 #endif
11230 if (GetGame().IsServer())
11231 {
11232 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11233 {
11234 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11235 OnDebugButtonPressServer(id + 1);
11236 }
11237
11238 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11239 {
11240 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11241 InsertAgent(agent_id,100);
11242 }
11243
11244 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11245 {
11246 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11247 RemoveAgent(agent_id2);
11248 }
11249
11250 else if (action_id == EActions.ADD_QUANTITY)
11251 {
11252 if (IsMagazine())
11253 {
11254 Magazine mag = Magazine.Cast(this);
11255 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11256 }
11257 else
11258 {
11259 AddQuantity(GetQuantityMax() * 0.2);
11260 }
11261
11262 if (m_EM)
11263 {
11264 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11265 }
11266 //PrintVariables();
11267 }
11268
11269 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
11270 {
11271 if (IsMagazine())
11272 {
11273 Magazine mag2 = Magazine.Cast(this);
11274 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11275 }
11276 else
11277 {
11278 AddQuantity(- GetQuantityMax() * 0.2);
11279 }
11280 if (m_EM)
11281 {
11282 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11283 }
11284 //PrintVariables();
11285 }
11286
11287 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
11288 {
11289 SetQuantity(0);
11290
11291 if (m_EM)
11292 {
11293 m_EM.SetEnergy(0);
11294 }
11295 }
11296
11297 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
11298 {
11300
11301 if (m_EM)
11302 {
11303 m_EM.SetEnergy(m_EM.GetEnergyMax());
11304 }
11305 }
11306
11307 else if (action_id == EActions.ADD_HEALTH)
11308 {
11309 AddHealth("","",GetMaxHealth("","Health")/5);
11310 }
11311 else if (action_id == EActions.REMOVE_HEALTH)
11312 {
11313 AddHealth("","",-GetMaxHealth("","Health")/5);
11314 }
11315 else if (action_id == EActions.DESTROY_HEALTH)
11316 {
11317 SetHealth01("","",0);
11318 }
11319 else if (action_id == EActions.WATCH_ITEM)
11320 {
11322 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11323 #ifdef DEVELOPER
11324 SetDebugDeveloper_item(this);
11325 #endif
11326 }
11327
11328 else if (action_id == EActions.ADD_TEMPERATURE)
11329 {
11330 AddTemperature(20);
11331 //PrintVariables();
11332 }
11333
11334 else if (action_id == EActions.REMOVE_TEMPERATURE)
11335 {
11336 AddTemperature(-20);
11337 //PrintVariables();
11338 }
11339
11340 else if (action_id == EActions.FLIP_FROZEN)
11341 {
11342 SetFrozen(!GetIsFrozen());
11343 //PrintVariables();
11344 }
11345
11346 else if (action_id == EActions.ADD_WETNESS)
11347 {
11348 AddWet(GetWetMax()/5);
11349 //PrintVariables();
11350 }
11351
11352 else if (action_id == EActions.REMOVE_WETNESS)
11353 {
11354 AddWet(-GetWetMax()/5);
11355 //PrintVariables();
11356 }
11357
11358 else if (action_id == EActions.LIQUIDTYPE_UP)
11359 {
11360 int curr_type = GetLiquidType();
11361 SetLiquidType(curr_type * 2);
11362 //AddWet(1);
11363 //PrintVariables();
11364 }
11365
11366 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11367 {
11368 int curr_type2 = GetLiquidType();
11369 SetLiquidType(curr_type2 / 2);
11370 }
11371
11372 else if (action_id == EActions.MAKE_SPECIAL)
11373 {
11374 auto debugParams = DebugSpawnParams.WithPlayer(player);
11375 OnDebugSpawnEx(debugParams);
11376 }
11377
11378 }
11379
11380
11381 return false;
11382 }
11383
11384 // -------------------------------------------------------------------------
11385
11386
11389 void OnActivatedByTripWire();
11390
11392 void OnActivatedByItem(notnull ItemBase item);
11393
11394 //----------------------------------------------------------------
11395 //returns true if item is able to explode when put in fire
11396 bool CanExplodeInFire()
11397 {
11398 return false;
11399 }
11400
11401 //----------------------------------------------------------------
11402 bool CanEat()
11403 {
11404 return true;
11405 }
11406
11407 //----------------------------------------------------------------
11408 override bool IsIgnoredByConstruction()
11409 {
11410 return true;
11411 }
11412
11413 //----------------------------------------------------------------
11414 //has FoodStages in config?
11415 bool HasFoodStage()
11416 {
11417 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11418 return GetGame().ConfigIsExisting(config_path);
11419 }
11420
11422 FoodStage GetFoodStage()
11423 {
11424 return null;
11425 }
11426
11427 bool CanBeCooked()
11428 {
11429 return false;
11430 }
11431
11432 bool CanBeCookedOnStick()
11433 {
11434 return false;
11435 }
11436
11438 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11440
11441 //----------------------------------------------------------------
11442 bool CanRepair(ItemBase item_repair_kit)
11443 {
11444 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11445 return module_repairing.CanRepair(this, item_repair_kit);
11446 }
11447
11448 //----------------------------------------------------------------
11449 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11450 {
11451 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11452 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11453 }
11454
11455 //----------------------------------------------------------------
11456 int GetItemSize()
11457 {
11458 /*
11459 vector v_size = this.ConfigGetVector("itemSize");
11460 int v_size_x = v_size[0];
11461 int v_size_y = v_size[1];
11462 int size = v_size_x * v_size_y;
11463 return size;
11464 */
11465
11466 return 1;
11467 }
11468
11469 //----------------------------------------------------------------
11470 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11471 bool CanBeMovedOverride()
11472 {
11473 return m_CanBeMovedOverride;
11474 }
11475
11476 //----------------------------------------------------------------
11477 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11478 void SetCanBeMovedOverride(bool setting)
11479 {
11480 m_CanBeMovedOverride = setting;
11481 }
11482
11483 //----------------------------------------------------------------
11491 void MessageToOwnerStatus(string text)
11492 {
11493 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11494
11495 if (player)
11496 {
11497 player.MessageStatus(text);
11498 }
11499 }
11500
11501 //----------------------------------------------------------------
11509 void MessageToOwnerAction(string text)
11510 {
11511 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11512
11513 if (player)
11514 {
11515 player.MessageAction(text);
11516 }
11517 }
11518
11519 //----------------------------------------------------------------
11527 void MessageToOwnerFriendly(string text)
11528 {
11529 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11530
11531 if (player)
11532 {
11533 player.MessageFriendly(text);
11534 }
11535 }
11536
11537 //----------------------------------------------------------------
11545 void MessageToOwnerImportant(string text)
11546 {
11547 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11548
11549 if (player)
11550 {
11551 player.MessageImportant(text);
11552 }
11553 }
11554
11555 override bool IsItemBase()
11556 {
11557 return true;
11558 }
11559
11560 // Checks if item is of questioned kind
11561 override bool KindOf(string tag)
11562 {
11563 bool found = false;
11564 string item_name = this.GetType();
11565 ref TStringArray item_tag_array = new TStringArray;
11566 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11567
11568 int array_size = item_tag_array.Count();
11569 for (int i = 0; i < array_size; i++)
11570 {
11571 if (item_tag_array.Get(i) == tag)
11572 {
11573 found = true;
11574 break;
11575 }
11576 }
11577 return found;
11578 }
11579
11580
11581 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11582 {
11583 //Debug.Log("OnRPC called");
11584 super.OnRPC(sender, rpc_type,ctx);
11585
11586 //Play soundset for attachment locking (ActionLockAttachment.c)
11587 switch (rpc_type)
11588 {
11589 #ifndef SERVER
11590 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11591 Param2<bool, string> p = new Param2<bool, string>(false, "");
11592
11593 if (!ctx.Read(p))
11594 return;
11595
11596 bool play = p.param1;
11597 string soundSet = p.param2;
11598
11599 if (play)
11600 {
11601 if (m_LockingSound)
11602 {
11604 {
11605 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11606 }
11607 }
11608 else
11609 {
11610 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11611 }
11612 }
11613 else
11614 {
11615 SEffectManager.DestroyEffect(m_LockingSound);
11616 }
11617
11618 break;
11619 #endif
11620
11621 }
11622
11623 if (GetWrittenNoteData())
11624 {
11625 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11626 }
11627 }
11628
11629 //-----------------------------
11630 // VARIABLE MANIPULATION SYSTEM
11631 //-----------------------------
11632 int NameToID(string name)
11633 {
11634 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11635 return plugin.GetID(name);
11636 }
11637
11638 string IDToName(int id)
11639 {
11640 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11641 return plugin.GetName(id);
11642 }
11643
11645 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11646 {
11647 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11648 //read the flags
11649 int varFlags;
11650 if (!ctx.Read(varFlags))
11651 return;
11652
11653 if (varFlags & ItemVariableFlags.FLOAT)
11654 {
11655 ReadVarsFromCTX(ctx);
11656 }
11657 }
11658
11659 override void SerializeNumericalVars(array<float> floats_out)
11660 {
11661 //some variables handled on EntityAI level already!
11662 super.SerializeNumericalVars(floats_out);
11663
11664 // the order of serialization must be the same as the order of de-serialization
11665 //--------------------------------------------
11666 if (IsVariableSet(VARIABLE_QUANTITY))
11667 {
11668 floats_out.Insert(m_VarQuantity);
11669 }
11670 //--------------------------------------------
11671 if (IsVariableSet(VARIABLE_WET))
11672 {
11673 floats_out.Insert(m_VarWet);
11674 }
11675 //--------------------------------------------
11676 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11677 {
11678 floats_out.Insert(m_VarLiquidType);
11679 }
11680 //--------------------------------------------
11681 if (IsVariableSet(VARIABLE_COLOR))
11682 {
11683 floats_out.Insert(m_ColorComponentR);
11684 floats_out.Insert(m_ColorComponentG);
11685 floats_out.Insert(m_ColorComponentB);
11686 floats_out.Insert(m_ColorComponentA);
11687 }
11688 //--------------------------------------------
11689 if (IsVariableSet(VARIABLE_CLEANNESS))
11690 {
11691 floats_out.Insert(m_Cleanness);
11692 }
11693 }
11694
11695 override void DeSerializeNumericalVars(array<float> floats)
11696 {
11697 //some variables handled on EntityAI level already!
11698 super.DeSerializeNumericalVars(floats);
11699
11700 // the order of serialization must be the same as the order of de-serialization
11701 int index = 0;
11702 int mask = Math.Round(floats.Get(index));
11703
11704 index++;
11705 //--------------------------------------------
11706 if (mask & VARIABLE_QUANTITY)
11707 {
11708 if (m_IsStoreLoad)
11709 {
11710 SetStoreLoadedQuantity(floats.Get(index));
11711 }
11712 else
11713 {
11714 float quantity = floats.Get(index);
11715 SetQuantity(quantity, true, false, false, false);
11716 }
11717 index++;
11718 }
11719 //--------------------------------------------
11720 if (mask & VARIABLE_WET)
11721 {
11722 float wet = floats.Get(index);
11723 SetWet(wet);
11724 index++;
11725 }
11726 //--------------------------------------------
11727 if (mask & VARIABLE_LIQUIDTYPE)
11728 {
11729 int liquidtype = Math.Round(floats.Get(index));
11730 SetLiquidType(liquidtype);
11731 index++;
11732 }
11733 //--------------------------------------------
11734 if (mask & VARIABLE_COLOR)
11735 {
11736 m_ColorComponentR = Math.Round(floats.Get(index));
11737 index++;
11738 m_ColorComponentG = Math.Round(floats.Get(index));
11739 index++;
11740 m_ColorComponentB = Math.Round(floats.Get(index));
11741 index++;
11742 m_ColorComponentA = Math.Round(floats.Get(index));
11743 index++;
11744 }
11745 //--------------------------------------------
11746 if (mask & VARIABLE_CLEANNESS)
11747 {
11748 int cleanness = Math.Round(floats.Get(index));
11749 SetCleanness(cleanness);
11750 index++;
11751 }
11752 }
11753
11754 override void WriteVarsToCTX(ParamsWriteContext ctx)
11755 {
11756 super.WriteVarsToCTX(ctx);
11757
11758 //--------------------------------------------
11759 if (IsVariableSet(VARIABLE_QUANTITY))
11760 {
11761 ctx.Write(GetQuantity());
11762 }
11763 //--------------------------------------------
11764 if (IsVariableSet(VARIABLE_WET))
11765 {
11766 ctx.Write(GetWet());
11767 }
11768 //--------------------------------------------
11769 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11770 {
11771 ctx.Write(GetLiquidType());
11772 }
11773 //--------------------------------------------
11774 if (IsVariableSet(VARIABLE_COLOR))
11775 {
11776 int r,g,b,a;
11777 GetColor(r,g,b,a);
11778 ctx.Write(r);
11779 ctx.Write(g);
11780 ctx.Write(b);
11781 ctx.Write(a);
11782 }
11783 //--------------------------------------------
11784 if (IsVariableSet(VARIABLE_CLEANNESS))
11785 {
11786 ctx.Write(GetCleanness());
11787 }
11788 }
11789
11790 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11791 {
11792 if (!super.ReadVarsFromCTX(ctx,version))
11793 return false;
11794
11795 int intValue;
11796 float value;
11797
11798 if (version < 140)
11799 {
11800 if (!ctx.Read(intValue))
11801 return false;
11802
11803 m_VariablesMask = intValue;
11804 }
11805
11806 if (m_VariablesMask & VARIABLE_QUANTITY)
11807 {
11808 if (!ctx.Read(value))
11809 return false;
11810
11811 if (IsStoreLoad())
11812 {
11814 }
11815 else
11816 {
11817 SetQuantity(value, true, false, false, false);
11818 }
11819 }
11820 //--------------------------------------------
11821 if (version < 140)
11822 {
11823 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11824 {
11825 if (!ctx.Read(value))
11826 return false;
11827 SetTemperatureDirect(value);
11828 }
11829 }
11830 //--------------------------------------------
11831 if (m_VariablesMask & VARIABLE_WET)
11832 {
11833 if (!ctx.Read(value))
11834 return false;
11835 SetWet(value);
11836 }
11837 //--------------------------------------------
11838 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11839 {
11840 if (!ctx.Read(intValue))
11841 return false;
11842 SetLiquidType(intValue);
11843 }
11844 //--------------------------------------------
11845 if (m_VariablesMask & VARIABLE_COLOR)
11846 {
11847 int r,g,b,a;
11848 if (!ctx.Read(r))
11849 return false;
11850 if (!ctx.Read(g))
11851 return false;
11852 if (!ctx.Read(b))
11853 return false;
11854 if (!ctx.Read(a))
11855 return false;
11856
11857 SetColor(r,g,b,a);
11858 }
11859 //--------------------------------------------
11860 if (m_VariablesMask & VARIABLE_CLEANNESS)
11861 {
11862 if (!ctx.Read(intValue))
11863 return false;
11864 SetCleanness(intValue);
11865 }
11866 //--------------------------------------------
11867 if (version >= 138 && version < 140)
11868 {
11869 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11870 {
11871 if (!ctx.Read(intValue))
11872 return false;
11873 SetFrozen(intValue);
11874 }
11875 }
11876
11877 return true;
11878 }
11879
11880 //----------------------------------------------------------------
11881 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11882 {
11883 m_IsStoreLoad = true;
11885 {
11886 m_FixDamageSystemInit = true;
11887 }
11888
11889 if (!super.OnStoreLoad(ctx, version))
11890 {
11891 m_IsStoreLoad = false;
11892 return false;
11893 }
11894
11895 if (version >= 114)
11896 {
11897 bool hasQuickBarIndexSaved;
11898
11899 if (!ctx.Read(hasQuickBarIndexSaved))
11900 {
11901 m_IsStoreLoad = false;
11902 return false;
11903 }
11904
11905 if (hasQuickBarIndexSaved)
11906 {
11907 int itmQBIndex;
11908
11909 //Load quickbar item bind
11910 if (!ctx.Read(itmQBIndex))
11911 {
11912 m_IsStoreLoad = false;
11913 return false;
11914 }
11915
11916 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11917 if (itmQBIndex != -1 && parentPlayer)
11918 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11919 }
11920 }
11921 else
11922 {
11923 // Backup of how it used to be
11924 PlayerBase player;
11925 int itemQBIndex;
11926 if (version == int.MAX)
11927 {
11928 if (!ctx.Read(itemQBIndex))
11929 {
11930 m_IsStoreLoad = false;
11931 return false;
11932 }
11933 }
11934 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11935 {
11936 //Load quickbar item bind
11937 if (!ctx.Read(itemQBIndex))
11938 {
11939 m_IsStoreLoad = false;
11940 return false;
11941 }
11942 if (itemQBIndex != -1 && player)
11943 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11944 }
11945 }
11946
11947 if (version < 140)
11948 {
11949 // variable management system
11950 if (!LoadVariables(ctx, version))
11951 {
11952 m_IsStoreLoad = false;
11953 return false;
11954 }
11955 }
11956
11957 //agent trasmission system
11958 if (!LoadAgents(ctx, version))
11959 {
11960 m_IsStoreLoad = false;
11961 return false;
11962 }
11963 if (version >= 132)
11964 {
11965 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11966 if (raib)
11967 {
11968 if (!raib.OnStoreLoad(ctx,version))
11969 {
11970 m_IsStoreLoad = false;
11971 return false;
11972 }
11973 }
11974 }
11975
11976 m_IsStoreLoad = false;
11977 return true;
11978 }
11979
11980 //----------------------------------------------------------------
11981
11982 override void OnStoreSave(ParamsWriteContext ctx)
11983 {
11984 super.OnStoreSave(ctx);
11985
11986 PlayerBase player;
11987 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11988 {
11989 ctx.Write(true); // Keep track of if we should actually read this in or not
11990 //Save quickbar item bind
11991 int itemQBIndex = -1;
11992 itemQBIndex = player.FindQuickBarEntityIndex(this);
11993 ctx.Write(itemQBIndex);
11994 }
11995 else
11996 {
11997 ctx.Write(false); // Keep track of if we should actually read this in or not
11998 }
11999
12000 SaveAgents(ctx);//agent trasmission system
12001
12002 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12003 if (raib)
12004 {
12005 raib.OnStoreSave(ctx);
12006 }
12007 }
12008 //----------------------------------------------------------------
12009
12010 override void AfterStoreLoad()
12011 {
12012 super.AfterStoreLoad();
12013
12015 {
12017 }
12018
12019 if (GetStoreLoadedQuantity() != float.LOWEST)
12020 {
12022 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
12023 }
12024 }
12025
12026 override void EEOnAfterLoad()
12027 {
12028 super.EEOnAfterLoad();
12029
12031 {
12032 m_FixDamageSystemInit = false;
12033 }
12034
12037 }
12038
12039 bool CanBeDisinfected()
12040 {
12041 return false;
12042 }
12043
12044
12045 //----------------------------------------------------------------
12046 override void OnVariablesSynchronized()
12047 {
12048 if (m_Initialized)
12049 {
12050 #ifdef PLATFORM_CONSOLE
12051 //bruteforce it is
12052 if (IsSplitable())
12053 {
12054 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
12055 if (menu)
12056 {
12057 menu.Refresh();
12058 }
12059 }
12060 #endif
12061 }
12062
12064 {
12065 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
12066 m_WantPlayImpactSound = false;
12067 }
12068
12070 {
12071 SetWeightDirty();
12073 }
12074 if (m_VarWet != m_VarWetPrev)
12075 {
12078 }
12079
12080 if (m_SoundSyncPlay != 0)
12081 {
12082 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
12083 m_SoundSyncPlay = 0;
12084 }
12085 if (m_SoundSyncStop != 0)
12086 {
12087 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
12088 m_SoundSyncStop = 0;
12089 }
12090
12091 super.OnVariablesSynchronized();
12092 }
12093
12094 //------------------------- Quantity
12095 //----------------------------------------------------------------
12097 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
12098 {
12099 if (!IsServerCheck(allow_client))
12100 return false;
12101
12102 if (!HasQuantity())
12103 return false;
12104
12105 float min = GetQuantityMin();
12106 float max = GetQuantityMax();
12107
12108 if (value <= (min + 0.001))
12109 value = min;
12110
12111 if (value == min)
12112 {
12113 if (destroy_config)
12114 {
12115 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12116 if (dstr)
12117 {
12118 m_VarQuantity = Math.Clamp(value, min, max);
12119 this.Delete();
12120 return true;
12121 }
12122 }
12123 else if (destroy_forced)
12124 {
12125 m_VarQuantity = Math.Clamp(value, min, max);
12126 this.Delete();
12127 return true;
12128 }
12129 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
12130 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
12131 }
12132
12133 float delta = m_VarQuantity;
12134 m_VarQuantity = Math.Clamp(value, min, max);
12135
12136 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
12137 {
12138 delta = m_VarQuantity - delta;
12139
12140 if (delta)
12141 OnQuantityChanged(delta);
12142 }
12143
12144 SetVariableMask(VARIABLE_QUANTITY);
12145
12146 return false;
12147 }
12148
12149 //----------------------------------------------------------------
12151 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12152 {
12153 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12154 }
12155 //----------------------------------------------------------------
12156 void SetQuantityMax()
12157 {
12158 float max = GetQuantityMax();
12159 SetQuantity(max);
12160 }
12161
12162 override void SetQuantityToMinimum()
12163 {
12164 float min = GetQuantityMin();
12165 SetQuantity(min);
12166 }
12167 //----------------------------------------------------------------
12169 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12170 {
12171 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12172 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12173 SetQuantity(result, destroy_config, destroy_forced);
12174 }
12175
12176 //----------------------------------------------------------------
12178 override float GetQuantityNormalized()
12179 {
12180 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12181 }
12182
12184 {
12185 return GetQuantityNormalized();
12186 }
12187
12188 /*void SetAmmoNormalized(float value)
12189 {
12190 float value_clamped = Math.Clamp(value, 0, 1);
12191 Magazine this_mag = Magazine.Cast(this);
12192 int max_rounds = this_mag.GetAmmoMax();
12193 int result = value * max_rounds;//can the rounded if higher precision is required
12194 this_mag.SetAmmoCount(result);
12195 }*/
12196 //----------------------------------------------------------------
12197 override int GetQuantityMax()
12198 {
12199 int slot = -1;
12200 if (GetInventory())
12201 {
12202 InventoryLocation il = new InventoryLocation;
12203 GetInventory().GetCurrentInventoryLocation(il);
12204 slot = il.GetSlot();
12205 }
12206
12207 return GetTargetQuantityMax(slot);
12208 }
12209
12210 override int GetTargetQuantityMax(int attSlotID = -1)
12211 {
12212 float quantity_max = 0;
12213
12214 if (IsSplitable()) //only stackable/splitable items can check for stack size
12215 {
12216 if (attSlotID != -1)
12217 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12218
12219 if (quantity_max <= 0)
12220 quantity_max = m_VarStackMax;
12221 }
12222
12223 if (quantity_max <= 0)
12224 quantity_max = m_VarQuantityMax;
12225
12226 return quantity_max;
12227 }
12228 //----------------------------------------------------------------
12229 override int GetQuantityMin()
12230 {
12231 return m_VarQuantityMin;
12232 }
12233 //----------------------------------------------------------------
12234 int GetQuantityInit()
12235 {
12236 return m_VarQuantityInit;
12237 }
12238
12239 //----------------------------------------------------------------
12240 override bool HasQuantity()
12241 {
12242 return !(GetQuantityMax() - GetQuantityMin() == 0);
12243 }
12244
12245 override float GetQuantity()
12246 {
12247 return m_VarQuantity;
12248 }
12249
12250 bool IsFullQuantity()
12251 {
12252 return GetQuantity() >= GetQuantityMax();
12253 }
12254
12255 //Calculates weight of single item without attachments and cargo
12256 override float GetSingleInventoryItemWeightEx()
12257 {
12258 //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
12259 float weightEx = GetWeightEx();//overall weight of the item
12260 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
12261 return weightEx - special;
12262 }
12263
12264 // Obsolete, use GetSingleInventoryItemWeightEx() instead
12266 {
12268 }
12269
12270 override protected float GetWeightSpecialized(bool forceRecalc = false)
12271 {
12272 if (IsSplitable()) //quantity determines size of the stack
12273 {
12274 #ifdef DEVELOPER
12275 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12276 {
12277 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12278 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
12279 }
12280 #endif
12281
12282 return GetQuantity() * GetConfigWeightModified();
12283 }
12284 else if (HasEnergyManager())// items with energy manager
12285 {
12286 #ifdef DEVELOPER
12287 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12288 {
12289 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12290 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
12291 }
12292 #endif
12293 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12294 }
12295 else//everything else
12296 {
12297 #ifdef DEVELOPER
12298 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12299 {
12300 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12301 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12302 }
12303 #endif
12304 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12305 }
12306 }
12307
12309 int GetNumberOfItems()
12310 {
12311 int item_count = 0;
12312 ItemBase item;
12313
12314 if (GetInventory().GetCargo() != NULL)
12315 {
12316 item_count = GetInventory().GetCargo().GetItemCount();
12317 }
12318
12319 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12320 {
12321 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12322 if (item)
12323 item_count += item.GetNumberOfItems();
12324 }
12325 return item_count;
12326 }
12327
12329 float GetUnitWeight(bool include_wetness = true)
12330 {
12331 float weight = 0;
12332 float wetness = 1;
12333 if (include_wetness)
12334 wetness += GetWet();
12335 if (IsSplitable()) //quantity determines size of the stack
12336 {
12337 weight = wetness * m_ConfigWeight;
12338 }
12339 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12340 {
12341 weight = 1;
12342 }
12343 return weight;
12344 }
12345
12346 //-----------------------------------------------------------------
12347
12348 override void ClearInventory()
12349 {
12350 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12351 {
12352 GameInventory inv = GetInventory();
12353 array<EntityAI> items = new array<EntityAI>;
12354 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12355 for (int i = 0; i < items.Count(); i++)
12356 {
12357 ItemBase item = ItemBase.Cast(items.Get(i));
12358 if (item)
12359 {
12360 GetGame().ObjectDelete(item);
12361 }
12362 }
12363 }
12364 }
12365
12366 //------------------------- Energy
12367
12368 //----------------------------------------------------------------
12369 float GetEnergy()
12370 {
12371 float energy = 0;
12372 if (HasEnergyManager())
12373 {
12374 energy = GetCompEM().GetEnergy();
12375 }
12376 return energy;
12377 }
12378
12379
12380 override void OnEnergyConsumed()
12381 {
12382 super.OnEnergyConsumed();
12383
12385 }
12386
12387 override void OnEnergyAdded()
12388 {
12389 super.OnEnergyAdded();
12390
12392 }
12393
12394 // Converts energy (from Energy Manager) to quantity, if enabled.
12396 {
12397 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12398 {
12399 if (HasQuantity())
12400 {
12401 float energy_0to1 = GetCompEM().GetEnergy0To1();
12402 SetQuantityNormalized(energy_0to1);
12403 }
12404 }
12405 }
12406
12407 //----------------------------------------------------------------
12408 float GetHeatIsolationInit()
12409 {
12410 return ConfigGetFloat("heatIsolation");
12411 }
12412
12413 float GetHeatIsolation()
12414 {
12415 return m_HeatIsolation;
12416 }
12417
12418 float GetDryingIncrement(string pIncrementName)
12419 {
12420 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12421 if (GetGame().ConfigIsExisting(paramPath))
12422 return GetGame().ConfigGetFloat(paramPath);
12423
12424 return 0.0;
12425 }
12426
12427 float GetSoakingIncrement(string pIncrementName)
12428 {
12429 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12430 if (GetGame().ConfigIsExisting(paramPath))
12431 return GetGame().ConfigGetFloat(paramPath);
12432
12433 return 0.0;
12434 }
12435 //----------------------------------------------------------------
12436 override void SetWet(float value, bool allow_client = false)
12437 {
12438 if (!IsServerCheck(allow_client))
12439 return;
12440
12441 float min = GetWetMin();
12442 float max = GetWetMax();
12443
12444 float previousValue = m_VarWet;
12445
12446 m_VarWet = Math.Clamp(value, min, max);
12447
12448 if (previousValue != m_VarWet)
12449 {
12450 SetVariableMask(VARIABLE_WET);
12451 OnWetChanged(m_VarWet, previousValue);
12452 }
12453 }
12454 //----------------------------------------------------------------
12455 override void AddWet(float value)
12456 {
12457 SetWet(GetWet() + value);
12458 }
12459 //----------------------------------------------------------------
12460 override void SetWetMax()
12461 {
12463 }
12464 //----------------------------------------------------------------
12465 override float GetWet()
12466 {
12467 return m_VarWet;
12468 }
12469 //----------------------------------------------------------------
12470 override float GetWetMax()
12471 {
12472 return m_VarWetMax;
12473 }
12474 //----------------------------------------------------------------
12475 override float GetWetMin()
12476 {
12477 return m_VarWetMin;
12478 }
12479 //----------------------------------------------------------------
12480 override float GetWetInit()
12481 {
12482 return m_VarWetInit;
12483 }
12484 //----------------------------------------------------------------
12485 override void OnWetChanged(float newVal, float oldVal)
12486 {
12487 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
12488 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
12489 if (newLevel != oldLevel)
12490 {
12491 OnWetLevelChanged(newLevel,oldLevel);
12492 }
12493 }
12494
12495 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
12496 {
12497 SetWeightDirty();
12498 }
12499
12500 override EWetnessLevel GetWetLevel()
12501 {
12502 return GetWetLevelInternal(m_VarWet);
12503 }
12504
12505 //----------------------------------------------------------------
12506
12507 override void SetStoreLoad(bool value)
12508 {
12509 m_IsStoreLoad = value;
12510 }
12511
12512 override bool IsStoreLoad()
12513 {
12514 return m_IsStoreLoad;
12515 }
12516
12517 override void SetStoreLoadedQuantity(float value)
12518 {
12519 m_StoreLoadedQuantity = value;
12520 }
12521
12522 override float GetStoreLoadedQuantity()
12523 {
12524 return m_StoreLoadedQuantity;
12525 }
12526
12527 //----------------------------------------------------------------
12528
12529 float GetItemModelLength()
12530 {
12531 if (ConfigIsExisting("itemModelLength"))
12532 {
12533 return ConfigGetFloat("itemModelLength");
12534 }
12535 return 0;
12536 }
12537
12538 float GetItemAttachOffset()
12539 {
12540 if (ConfigIsExisting("itemAttachOffset"))
12541 {
12542 return ConfigGetFloat("itemAttachOffset");
12543 }
12544 return 0;
12545 }
12546
12547 override void SetCleanness(int value, bool allow_client = false)
12548 {
12549 if (!IsServerCheck(allow_client))
12550 return;
12551
12552 int previousValue = m_Cleanness;
12553
12554 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12555
12556 if (previousValue != m_Cleanness)
12557 SetVariableMask(VARIABLE_CLEANNESS);
12558 }
12559
12560 override int GetCleanness()
12561 {
12562 return m_Cleanness;
12563 }
12564
12566 {
12567 return true;
12568 }
12569
12570 //----------------------------------------------------------------
12571 // ATTACHMENT LOCKING
12572 // Getters relevant to generic ActionLockAttachment
12573 int GetLockType()
12574 {
12575 return m_LockType;
12576 }
12577
12578 string GetLockSoundSet()
12579 {
12580 return m_LockSoundSet;
12581 }
12582
12583 //----------------------------------------------------------------
12584 //------------------------- Color
12585 // sets items color variable given color components
12586 override void SetColor(int r, int g, int b, int a)
12587 {
12592 SetVariableMask(VARIABLE_COLOR);
12593 }
12595 override void GetColor(out int r,out int g,out int b,out int a)
12596 {
12601 }
12602
12603 bool IsColorSet()
12604 {
12605 return IsVariableSet(VARIABLE_COLOR);
12606 }
12607
12609 string GetColorString()
12610 {
12611 int r,g,b,a;
12612 GetColor(r,g,b,a);
12613 r = r/255;
12614 g = g/255;
12615 b = b/255;
12616 a = a/255;
12617 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12618 }
12619 //----------------------------------------------------------------
12620 //------------------------- LiquidType
12621
12622 override void SetLiquidType(int value, bool allow_client = false)
12623 {
12624 if (!IsServerCheck(allow_client))
12625 return;
12626
12627 int old = m_VarLiquidType;
12628 m_VarLiquidType = value;
12629 OnLiquidTypeChanged(old,value);
12630 SetVariableMask(VARIABLE_LIQUIDTYPE);
12631 }
12632
12633 int GetLiquidTypeInit()
12634 {
12635 return ConfigGetInt("varLiquidTypeInit");
12636 }
12637
12638 override int GetLiquidType()
12639 {
12640 return m_VarLiquidType;
12641 }
12642
12643 protected void OnLiquidTypeChanged(int oldType, int newType)
12644 {
12645 if (newType == LIQUID_NONE && GetIsFrozen())
12646 SetFrozen(false);
12647 }
12648
12650 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12651 {
12652 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12653 }
12654
12655 // -------------------------------------------------------------------------
12657 void OnInventoryEnter(Man player)
12658 {
12659 PlayerBase nplayer;
12660 if (PlayerBase.CastTo(nplayer, player))
12661 {
12662 m_CanPlayImpactSound = true;
12663 //nplayer.OnItemInventoryEnter(this);
12664 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12665 }
12666 }
12667
12668 // -------------------------------------------------------------------------
12670 void OnInventoryExit(Man player)
12671 {
12672 PlayerBase nplayer;
12673 if (PlayerBase.CastTo(nplayer,player))
12674 {
12675 //nplayer.OnItemInventoryExit(this);
12676 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12677
12678 }
12679
12680 //if (!GetGame().IsDedicatedServer())
12681 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12682
12683
12684 if (HasEnergyManager())
12685 {
12686 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12687 }
12688 }
12689
12690 // ADVANCED PLACEMENT EVENTS
12691 override void OnPlacementStarted(Man player)
12692 {
12693 super.OnPlacementStarted(player);
12694
12695 SetTakeable(false);
12696 }
12697
12698 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12699 {
12700 if (m_AdminLog)
12701 {
12702 m_AdminLog.OnPlacementComplete(player, this);
12703 }
12704
12705 super.OnPlacementComplete(player, position, orientation);
12706 }
12707
12708 //-----------------------------
12709 // AGENT SYSTEM
12710 //-----------------------------
12711 //--------------------------------------------------------------------------
12712 bool ContainsAgent(int agent_id)
12713 {
12714 if (agent_id & m_AttachedAgents)
12715 {
12716 return true;
12717 }
12718 else
12719 {
12720 return false;
12721 }
12722 }
12723
12724 //--------------------------------------------------------------------------
12725 override void RemoveAgent(int agent_id)
12726 {
12727 if (ContainsAgent(agent_id))
12728 {
12729 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12730 }
12731 }
12732
12733 //--------------------------------------------------------------------------
12734 override void RemoveAllAgents()
12735 {
12736 m_AttachedAgents = 0;
12737 }
12738 //--------------------------------------------------------------------------
12739 override void RemoveAllAgentsExcept(int agent_to_keep)
12740 {
12741 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12742 }
12743 // -------------------------------------------------------------------------
12744 override void InsertAgent(int agent, float count = 1)
12745 {
12746 if (count < 1)
12747 return;
12748 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12750 }
12751
12753 void TransferAgents(int agents)
12754 {
12756 }
12757
12758 // -------------------------------------------------------------------------
12759 override int GetAgents()
12760 {
12761 return m_AttachedAgents;
12762 }
12763 //----------------------------------------------------------------------
12764
12765 /*int GetContaminationType()
12766 {
12767 int contamination_type;
12768
12769 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12770 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12771 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12772 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12773
12774 Edible_Base edible = Edible_Base.Cast(this);
12775 int agents = GetAgents();
12776 if (edible)
12777 {
12778 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12779 if (profile)
12780 {
12781 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12782 }
12783 }
12784 if (agents & CONTAMINATED_MASK)
12785 {
12786 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12787 }
12788 if (agents & POISONED_MASK)
12789 {
12790 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12791 }
12792 if (agents & NERVE_GAS_MASK)
12793 {
12794 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12795 }
12796 if (agents & DIRTY_MASK)
12797 {
12798 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12799 }
12800
12801 return agents;
12802 }*/
12803
12804 // -------------------------------------------------------------------------
12805 bool LoadAgents(ParamsReadContext ctx, int version)
12806 {
12807 if (!ctx.Read(m_AttachedAgents))
12808 return false;
12809 return true;
12810 }
12811 // -------------------------------------------------------------------------
12813 {
12814
12816 }
12817 // -------------------------------------------------------------------------
12818
12820 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12821 {
12822 super.CheckForRoofLimited(timeTresholdMS);
12823
12824 float time = GetGame().GetTime();
12825 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12826 {
12827 m_PreviousRoofTestTime = time;
12828 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12829 }
12830 }
12831
12832 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12833 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12834 {
12835 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12836 {
12837 return 0;
12838 }
12839
12840 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12841 {
12842 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12843 if (filter)
12844 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12845 else
12846 return 0;//otherwise return 0 when no filter attached
12847 }
12848
12849 string subclassPath, entryName;
12850
12851 switch (type)
12852 {
12853 case DEF_BIOLOGICAL:
12854 entryName = "biological";
12855 break;
12856 case DEF_CHEMICAL:
12857 entryName = "chemical";
12858 break;
12859 default:
12860 entryName = "biological";
12861 break;
12862 }
12863
12864 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12865
12866 return GetGame().ConfigGetFloat(subclassPath + entryName);
12867 }
12868
12869
12870
12872 override void EEOnCECreate()
12873 {
12874 if (!IsMagazine())
12876
12878 }
12879
12880
12881 //-------------------------
12882 // OPEN/CLOSE USER ACTIONS
12883 //-------------------------
12885 void Open();
12886 void Close();
12887 bool IsOpen()
12888 {
12889 return true;
12890 }
12891
12892 override bool CanDisplayCargo()
12893 {
12894 return IsOpen();
12895 }
12896
12897
12898 // ------------------------------------------------------------
12899 // CONDITIONS
12900 // ------------------------------------------------------------
12901 override bool CanPutInCargo(EntityAI parent)
12902 {
12903 if (parent)
12904 {
12905 if (parent.IsInherited(DayZInfected))
12906 return true;
12907
12908 if (!parent.IsRuined())
12909 return true;
12910 }
12911
12912 return true;
12913 }
12914
12915 override bool CanPutAsAttachment(EntityAI parent)
12916 {
12917 if (!super.CanPutAsAttachment(parent))
12918 {
12919 return false;
12920 }
12921
12922 if (!IsRuined() && !parent.IsRuined())
12923 {
12924 return true;
12925 }
12926
12927 return false;
12928 }
12929
12930 override bool CanReceiveItemIntoCargo(EntityAI item)
12931 {
12932 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12933 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12934 // return false;
12935
12936 return super.CanReceiveItemIntoCargo(item);
12937 }
12938
12939 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12940 {
12941 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12942 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12943 // return false;
12944
12945 GameInventory attachmentInv = attachment.GetInventory();
12946 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12947 {
12948 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12949 return false;
12950 }
12951
12952 InventoryLocation loc = new InventoryLocation();
12953 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12954 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12955 return false;
12956
12957 return super.CanReceiveAttachment(attachment, slotId);
12958 }
12959
12960 override bool CanReleaseAttachment(EntityAI attachment)
12961 {
12962 if (!super.CanReleaseAttachment(attachment))
12963 return false;
12964
12965 return GetInventory().AreChildrenAccessible();
12966 }
12967
12968 /*override bool CanLoadAttachment(EntityAI attachment)
12969 {
12970 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12971 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12972 // return false;
12973
12974 GameInventory attachmentInv = attachment.GetInventory();
12975 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12976 {
12977 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12978 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12979
12980 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12981 return false;
12982 }
12983
12984 return super.CanLoadAttachment(attachment);
12985 }*/
12986
12987 // Plays muzzle flash particle effects
12988 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12989 {
12990 int id = muzzle_owner.GetMuzzleID();
12991 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12992
12993 if (WPOF_array)
12994 {
12995 for (int i = 0; i < WPOF_array.Count(); i++)
12996 {
12997 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12998
12999 if (WPOF)
13000 {
13001 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13002 }
13003 }
13004 }
13005 }
13006
13007 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
13008 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13009 {
13010 int id = muzzle_owner.GetMuzzleID();
13011 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
13012
13013 if (WPOBE_array)
13014 {
13015 for (int i = 0; i < WPOBE_array.Count(); i++)
13016 {
13017 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13018
13019 if (WPOBE)
13020 {
13021 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13022 }
13023 }
13024 }
13025 }
13026
13027 // Plays all weapon overheating particles
13028 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13029 {
13030 int id = muzzle_owner.GetMuzzleID();
13031 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13032
13033 if (WPOOH_array)
13034 {
13035 for (int i = 0; i < WPOOH_array.Count(); i++)
13036 {
13037 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13038
13039 if (WPOOH)
13040 {
13041 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13042 }
13043 }
13044 }
13045 }
13046
13047 // Updates all weapon overheating particles
13048 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13049 {
13050 int id = muzzle_owner.GetMuzzleID();
13051 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13052
13053 if (WPOOH_array)
13054 {
13055 for (int i = 0; i < WPOOH_array.Count(); i++)
13056 {
13057 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13058
13059 if (WPOOH)
13060 {
13061 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13062 }
13063 }
13064 }
13065 }
13066
13067 // Stops overheating particles
13068 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13069 {
13070 int id = muzzle_owner.GetMuzzleID();
13071 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13072
13073 if (WPOOH_array)
13074 {
13075 for (int i = 0; i < WPOOH_array.Count(); i++)
13076 {
13077 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13078
13079 if (WPOOH)
13080 {
13081 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13082 }
13083 }
13084 }
13085 }
13086
13087 //----------------------------------------------------------------
13088 //Item Behaviour - unified approach
13089 override bool IsHeavyBehaviour()
13090 {
13091 if (m_ItemBehaviour == 0)
13092 {
13093 return true;
13094 }
13095
13096 return false;
13097 }
13098
13099 override bool IsOneHandedBehaviour()
13100 {
13101 if (m_ItemBehaviour == 1)
13102 {
13103 return true;
13104 }
13105
13106 return false;
13107 }
13108
13109 override bool IsTwoHandedBehaviour()
13110 {
13111 if (m_ItemBehaviour == 2)
13112 {
13113 return true;
13114 }
13115
13116 return false;
13117 }
13118
13119 bool IsDeployable()
13120 {
13121 return false;
13122 }
13123
13125 float GetDeployTime()
13126 {
13127 return UATimeSpent.DEFAULT_DEPLOY;
13128 }
13129
13130
13131 //----------------------------------------------------------------
13132 // Item Targeting (User Actions)
13133 override void SetTakeable(bool pState)
13134 {
13135 m_IsTakeable = pState;
13136 SetSynchDirty();
13137 }
13138
13139 override bool IsTakeable()
13140 {
13141 return m_IsTakeable;
13142 }
13143
13144 // For cases where we want to show object widget which cant be taken to hands
13146 {
13147 return false;
13148 }
13149
13151 protected void PreLoadSoundAttachmentType()
13152 {
13153 string att_type = "None";
13154
13155 if (ConfigIsExisting("soundAttType"))
13156 {
13157 att_type = ConfigGetString("soundAttType");
13158 }
13159
13160 m_SoundAttType = att_type;
13161 }
13162
13163 override string GetAttachmentSoundType()
13164 {
13165 return m_SoundAttType;
13166 }
13167
13168 //----------------------------------------------------------------
13169 //SOUNDS - ItemSoundHandler
13170 //----------------------------------------------------------------
13171
13172 string GetPlaceSoundset(); // played when deploy starts
13173 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13174 string GetDeploySoundset(); // played when deploy sucessfully finishes
13175 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
13176 string GetFoldSoundset(); // played when fold sucessfully finishes
13177
13179 {
13180 if (!m_ItemSoundHandler)
13182
13183 return m_ItemSoundHandler;
13184 }
13185
13186 // override to initialize sounds
13187 protected void InitItemSounds()
13188 {
13189 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13190 return;
13191
13193
13194 if (GetPlaceSoundset() != string.Empty)
13195 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13196
13197 if (GetDeploySoundset() != string.Empty)
13198 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13199
13200 SoundParameters params = new SoundParameters();
13201 params.m_Loop = true;
13202 if (GetLoopDeploySoundset() != string.Empty)
13203 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13204 }
13205
13206 // Start sound using ItemSoundHandler
13207 void StartItemSoundServer(int id)
13208 {
13209 if (!GetGame().IsServer())
13210 return;
13211
13212 m_SoundSyncPlay = id;
13213 SetSynchDirty();
13214
13215 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13217 }
13218
13219 // Stop sound using ItemSoundHandler
13220 void StopItemSoundServer(int id)
13221 {
13222 if (!GetGame().IsServer())
13223 return;
13224
13225 m_SoundSyncStop = id;
13226 SetSynchDirty();
13227
13228 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
13230 }
13231
13232 protected void ClearStartItemSoundServer()
13233 {
13234 m_SoundSyncPlay = 0;
13235 }
13236
13237 protected void ClearStopItemSoundServer()
13238 {
13239 m_SoundSyncStop = 0;
13240 }
13241
13243 void PlayAttachSound(string slot_type)
13244 {
13245 if (!GetGame().IsDedicatedServer())
13246 {
13247 if (ConfigIsExisting("attachSoundSet"))
13248 {
13249 string cfg_path = "";
13250 string soundset = "";
13251 string type_name = GetType();
13252
13253 TStringArray cfg_soundset_array = new TStringArray;
13254 TStringArray cfg_slot_array = new TStringArray;
13255 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13256 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13257
13258 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13259 {
13260 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13261 {
13262 if (cfg_slot_array[i] == slot_type)
13263 {
13264 soundset = cfg_soundset_array[i];
13265 break;
13266 }
13267 }
13268 }
13269
13270 if (soundset != "")
13271 {
13272 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
13273 sound.SetAutodestroy(true);
13274 }
13275 }
13276 }
13277 }
13278
13279 void PlayDetachSound(string slot_type)
13280 {
13281 //TODO - evaluate if needed and devise universal config structure if so
13282 }
13283
13284 void OnApply(PlayerBase player);
13285
13287 {
13288 return 1.0;
13289 };
13290 //returns applicable selection
13291 array<string> GetHeadHidingSelection()
13292 {
13294 }
13295
13297 {
13299 }
13300
13301 WrittenNoteData GetWrittenNoteData() {};
13302
13304 {
13305 SetDynamicPhysicsLifeTime(0.01);
13306 m_ItemBeingDroppedPhys = false;
13307 }
13308
13310 {
13311 array<string> zone_names = new array<string>;
13312 GetDamageZones(zone_names);
13313 for (int i = 0; i < zone_names.Count(); i++)
13314 {
13315 SetHealthMax(zone_names.Get(i),"Health");
13316 }
13317 SetHealthMax("","Health");
13318 }
13319
13321 void SetZoneDamageCEInit()
13322 {
13323 float global_health = GetHealth01("","Health");
13324 array<string> zones = new array<string>;
13325 GetDamageZones(zones);
13326 //set damage of all zones to match global health level
13327 for (int i = 0; i < zones.Count(); i++)
13328 {
13329 SetHealth01(zones.Get(i),"Health",global_health);
13330 }
13331 }
13332
13334 bool IsCoverFaceForShave(string slot_name)
13335 {
13336 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13337 }
13338
13339 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13340 {
13341 if (!hasRootAsPlayer)
13342 {
13343 if (refParentIB)
13344 {
13345 // parent is wet
13346 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13347 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13348 // parent has liquid inside
13349 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13350 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13351 // drying
13352 else if (m_VarWet > m_VarWetMin)
13353 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13354 }
13355 else
13356 {
13357 // drying on ground or inside non-itembase (car, ...)
13358 if (m_VarWet > m_VarWetMin)
13359 AddWet(-1 * delta * GetDryingIncrement("ground"));
13360 }
13361 }
13362 }
13363
13364 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13365 {
13367 {
13368 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13369 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13370 {
13371 float heatPermCoef = 1.0;
13372 EntityAI ent = this;
13373 while (ent)
13374 {
13375 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13376 ent = ent.GetHierarchyParent();
13377 }
13378
13379 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13380 }
13381 }
13382 }
13383
13384 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13385 {
13386 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13387 EntityAI parent = GetHierarchyParent();
13388 if (!parent)
13389 {
13390 hasParent = false;
13391 hasRootAsPlayer = false;
13392 }
13393 else
13394 {
13395 hasParent = true;
13396 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13397 refParentIB = ItemBase.Cast(parent);
13398 }
13399 }
13400
13401 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13402 {
13403 // this is stub, implemented on Edible_Base
13404 }
13405
13406 bool CanDecay()
13407 {
13408 // return true used on selected food clases so they can decay
13409 return false;
13410 }
13411
13412 protected bool CanProcessDecay()
13413 {
13414 // this is stub, implemented on Edible_Base class
13415 // used to determine whether it is still necessary for the food to decay
13416 return false;
13417 }
13418
13419 protected bool CanHaveWetness()
13420 {
13421 // return true used on selected items that have a wetness effect
13422 return false;
13423 }
13424
13426 bool CanBeConsumed(ConsumeConditionData data = null)
13427 {
13428 return !GetIsFrozen() && IsOpen();
13429 }
13430
13431 override void ProcessVariables()
13432 {
13433 bool hasParent = false, hasRootAsPlayer = false;
13434 ItemBase refParentIB;
13435
13436 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13437 bool foodDecay = g_Game.IsFoodDecayEnabled();
13438
13439 if (wwtu || foodDecay)
13440 {
13441 bool processWetness = wwtu && CanHaveWetness();
13442 bool processTemperature = wwtu && CanHaveTemperature();
13443 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13444
13445 if (processWetness || processTemperature || processDecay)
13446 {
13447 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13448
13449 if (processWetness)
13450 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13451
13452 if (processTemperature)
13453 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13454
13455 if (processDecay)
13456 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13457 }
13458 }
13459 }
13460
13463 {
13464 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
13465 }
13466
13467 override float GetTemperatureFreezeThreshold()
13468 {
13470 return Liquid.GetFreezeThreshold(GetLiquidType());
13471
13472 return super.GetTemperatureFreezeThreshold();
13473 }
13474
13475 override float GetTemperatureThawThreshold()
13476 {
13478 return Liquid.GetThawThreshold(GetLiquidType());
13479
13480 return super.GetTemperatureThawThreshold();
13481 }
13482
13483 override float GetItemOverheatThreshold()
13484 {
13486 return Liquid.GetBoilThreshold(GetLiquidType());
13487
13488 return super.GetItemOverheatThreshold();
13489 }
13490
13491 override float GetTemperatureFreezeTime()
13492 {
13493 if (HasQuantity())
13494 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
13495
13496 return super.GetTemperatureFreezeTime();
13497 }
13498
13499 override float GetTemperatureThawTime()
13500 {
13501 if (HasQuantity())
13502 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
13503
13504 return super.GetTemperatureThawTime();
13505 }
13506
13508 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13510 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13511
13512 bool IsCargoException4x3(EntityAI item)
13513 {
13514 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13515 }
13516
13518 {
13519 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13520 }
13521
13523 void AddLightSourceItem(ItemBase lightsource)
13524 {
13525 m_LightSourceItem = lightsource;
13526 }
13527
13529 {
13530 m_LightSourceItem = null;
13531 }
13532
13534 {
13535 return m_LightSourceItem;
13536 }
13537
13539 array<int> GetValidFinishers()
13540 {
13541 return null;
13542 }
13543
13545 bool GetActionWidgetOverride(out typename name)
13546 {
13547 return false;
13548 }
13549
13550 bool PairWithDevice(notnull ItemBase otherDevice)
13551 {
13552 if (GetGame().IsServer())
13553 {
13554 ItemBase explosive = otherDevice;
13556 if (!trg)
13557 {
13558 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13559 explosive = this;
13560 }
13561
13562 explosive.PairRemote(trg);
13563 trg.SetControlledDevice(explosive);
13564
13565 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13566 trg.SetPersistentPairID(persistentID);
13567 explosive.SetPersistentPairID(persistentID);
13568
13569 return true;
13570 }
13571 return false;
13572 }
13573
13575 float GetBaitEffectivity()
13576 {
13577 float ret = 1.0;
13578 if (HasQuantity())
13579 ret *= GetQuantityNormalized();
13580 ret *= GetHealth01();
13581
13582 return ret;
13583 }
13584
13585 #ifdef DEVELOPER
13586 override void SetDebugItem()
13587 {
13588 super.SetDebugItem();
13589 _itemBase = this;
13590 }
13591
13592 override string GetDebugText()
13593 {
13594 string text = super.GetDebugText();
13595
13596 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13597 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13598
13599 return text;
13600 }
13601 #endif
13602
13603 bool CanBeUsedForSuicide()
13604 {
13605 return true;
13606 }
13607
13609 //DEPRECATED BELOW
13611 // Backwards compatibility
13612 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13613 {
13614 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13615 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13616 }
13617
13618 // replaced by ItemSoundHandler
13619 protected EffectSound m_SoundDeployFinish;
13620 protected EffectSound m_SoundPlace;
13621 protected EffectSound m_DeployLoopSoundEx;
13622 protected EffectSound m_SoundDeploy;
13623 bool m_IsPlaceSound;
13624 bool m_IsDeploySound;
13626
13627 string GetDeployFinishSoundset();
13628 void PlayDeploySound();
13629 void PlayDeployFinishSound();
13630 void PlayPlaceSound();
13631 void PlayDeployLoopSoundEx();
13632 void StopDeployLoopSoundEx();
13633 void SoundSynchRemoteReset();
13634 void SoundSynchRemote();
13635 bool UsesGlobalDeploy(){return false;}
13636 bool CanPlayDeployLoopSound(){return false;}
13638 bool IsPlaceSound(){return m_IsPlaceSound;}
13639 bool IsDeploySound(){return m_IsDeploySound;}
13640 void SetIsPlaceSound(bool is_place_sound);
13641 void SetIsDeploySound(bool is_deploy_sound);
13642}
13643
13644EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13645{
13646 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13647 if (entity)
13648 {
13649 bool is_item = entity.IsInherited(ItemBase);
13650 if (is_item && full_quantity)
13651 {
13652 ItemBase item = ItemBase.Cast(entity);
13653 item.SetQuantity(item.GetQuantityInit());
13654 }
13655 }
13656 else
13657 {
13658 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13659 return NULL;
13660 }
13661 return entity;
13662}
13663
13664void SetupSpawnedItem(ItemBase item, float health, float quantity)
13665{
13666 if (item)
13667 {
13668 if (health > 0)
13669 item.SetHealth("", "", health);
13670
13671 if (item.CanHaveTemperature())
13672 {
13673 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13674 if (item.CanFreeze())
13675 item.SetFrozen(false);
13676 }
13677
13678 if (item.HasEnergyManager())
13679 {
13680 if (quantity >= 0)
13681 {
13682 item.GetCompEM().SetEnergy0To1(quantity);
13683 }
13684 else
13685 {
13686 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13687 }
13688 }
13689 else if (item.IsMagazine())
13690 {
13691 Magazine mag = Magazine.Cast(item);
13692 if (quantity >= 0)
13693 {
13694 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13695 }
13696 else
13697 {
13698 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13699 }
13700
13701 }
13702 else
13703 {
13704 if (quantity >= 0)
13705 {
13706 item.SetQuantityNormalized(quantity, false);
13707 }
13708 else
13709 {
13710 item.SetQuantity(Math.AbsFloat(quantity));
13711 }
13712
13713 }
13714 }
13715}
13716
13717#ifdef DEVELOPER
13718ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13719#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
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
int GetLiquidType()
Определения CCTWaterSurface.c:129
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
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
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
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
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:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
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:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
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:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
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:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override 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:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
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:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
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:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
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:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
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()
Определения 3_Game/Entities/Man.c:44
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
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 string GetFoldSoundset()
Определения BaseBuildingBase.c:108
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:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
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()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
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:1238
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:489
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:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
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:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
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:1032
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()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
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
Определения 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)
Определения 3_Game/tools/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
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
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:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
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
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()

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