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

◆ GetWrittenNoteData()

WrittenNoteData SpawnItemOnLocation::GetWrittenNoteData ( )
protected

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

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