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

◆ RemoveAllAgents()

override void SpawnItemOnLocation::RemoveAllAgents ( )
protected

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

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

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