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

◆ IsCoverFaceForShave()

bool SpawnItemOnLocation::IsCoverFaceForShave ( string slot_name)
protected

DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.

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

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