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

◆ HierarchyCheck()

void SpawnItemOnLocation::HierarchyCheck ( out bool hasParent,
out bool hasRootAsPlayer,
out ItemBase refParentIB )
protected

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

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