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

◆ IsCargoException4x3()

bool SpawnItemOnLocation::IsCargoException4x3 ( EntityAI item)
protected

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

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

Используется в Cauldron::CanLoadItemIntoCargo(), FryingPan::CanLoadItemIntoCargo(), Pot::CanLoadItemIntoCargo(), Cauldron::CanPutInCargo(), FryingPan::CanPutInCargo(), Pot::CanPutInCargo(), Cauldron::CanReceiveItemIntoCargo(), FryingPan::CanReceiveItemIntoCargo() и Pot::CanReceiveItemIntoCargo().