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

◆ IsDeployable()

bool SpawnItemOnLocation::IsDeployable ( )
protected

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

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