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

◆ GetAttachmentSoundType()

override string SpawnItemOnLocation::GetAttachmentSoundType ( )
protected

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

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