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

◆ StartItemSoundServer()

void SpawnItemOnLocation::StartItemSoundServer ( int id)
protected

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

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

Используется в ShippingContainerKeys_ColorBase::DestroyKeyServer() и ItemBase::ToggleAnimation().