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

◆ HidesSelectionBySlot()

bool SpawnItemOnLocation::HidesSelectionBySlot ( )
protected

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

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