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

◆ InitItemSounds()

void SpawnItemOnLocation::InitItemSounds ( )
protected

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

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