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

◆ PlayOverheatingParticles()

static void SpawnItemOnLocation::PlayOverheatingParticles ( ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search )
staticprotected

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

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