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

◆ GetHeadHidingSelection()

array< string > SpawnItemOnLocation::GetHeadHidingSelection ( )
protected

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

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