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

◆ CanHaveWetness()

bool SpawnItemOnLocation::CanHaveWetness ( )
protected

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

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

Используется в InventoryItem::ProcessVariables().