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

◆ RemoveLightSourceItem()

void SpawnItemOnLocation::RemoveLightSourceItem ( )
protected

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

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