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

◆ ClearStopItemSoundServer()

void SpawnItemOnLocation::ClearStopItemSoundServer ( )
protected

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

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