Items cannot be consumed if frozen by default. Override for exceptions.
9481{
9483 {
9484 return true;
9485 }
9486};
9487
9488
9489
9491{
9495
9497
9500
9501
9502
9503
9504
9513
9519
9524
9529
9550 protected bool m_IsResultOfSplit
9551
9553
9558
9559
9560
9562
9566
9567
9568
9570
9573
9574
9575
9581
9582
9590
9593
9594
9596
9597
9599
9600
9605
9606
9611
9612
9614
9615
9617 {
9622
9623 if (!
GetGame().IsDedicatedServer())
9624 {
9626 {
9628
9630 {
9632 }
9633 }
9634
9637 }
9638
9639 m_OldLocation = null;
9640
9642 {
9644 }
9645
9646 if (ConfigIsExisting("headSelectionsToHide"))
9647 {
9650 }
9651
9653 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9654 {
9656 }
9657
9659
9660 m_IsResultOfSplit = false;
9661
9663 }
9664
9666 {
9667 super.InitItemVariables();
9668
9674 m_Count = ConfigGetInt(
"count");
9675
9678
9683
9686
9691
9703
9707
9708
9711 if (ConfigIsExisting("canBeSplit"))
9712 {
9715 }
9716
9718 if (ConfigIsExisting("itemBehaviour"))
9720
9721
9724 RegisterNetSyncVariableInt("m_VarLiquidType");
9725 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9726
9727 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9728 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9729 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9730
9731 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9732 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9733 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9734 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9735
9736 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9737 RegisterNetSyncVariableBool("m_IsTakeable");
9738 RegisterNetSyncVariableBool("m_IsHologram");
9739
9742 {
9745 }
9746
9748
9750 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9752
9753 }
9754
9756 {
9758 }
9759
9761 {
9764 {
9769 }
9770 }
9771
9772 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9773 {
9775 {
9778 }
9779
9781 }
9782
9784 {
9790 }
9791
9793
9795 {
9797
9798 if (!action)
9799 {
9800 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9801 return;
9802 }
9803
9805 if (!ai)
9806 {
9808 return;
9809 }
9810
9812 if (!action_array)
9813 {
9814 action_array = new array<ActionBase_Basic>;
9816 }
9817 if (LogManager.IsActionLogEnable())
9818 {
9819 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9820 }
9821
9822 if (action_array.Find(action) != -1)
9823 {
9824 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9825 }
9826 else
9827 {
9828 action_array.Insert(action);
9829 }
9830 }
9831
9833 {
9835 ActionBase action = player.GetActionManager().GetAction(actionName);
9838
9839 if (action_array)
9840 {
9841 action_array.RemoveItem(action);
9842 }
9843 }
9844
9845
9846
9848 {
9849 ActionOverrideData overrideData = new ActionOverrideData();
9853
9855 if (!actionMap)
9856 {
9859 }
9860
9861 actionMap.Insert(this.
Type(), overrideData);
9862
9863 }
9864
9866
9868
9869
9871 {
9874
9877
9878 string config_to_search = "CfgVehicles";
9879 string muzzle_owner_config;
9880
9882 {
9883 if (IsInherited(Weapon))
9884 config_to_search = "CfgWeapons";
9885
9886 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9887
9888 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9889
9891
9892 if (config_OnFire_subclass_count > 0)
9893 {
9894 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9895
9896 for (int i = 0; i < config_OnFire_subclass_count; i++)
9897 {
9898 string particle_class = "";
9900 string config_OnFire_entry = config_OnFire_class + particle_class;
9901 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9902 WPOF_array.Insert(WPOF);
9903 }
9904
9905
9907 }
9908 }
9909
9911 {
9912 config_to_search = "CfgWeapons";
9913 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9914
9915 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9916
9918
9919 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9920 {
9921 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9922
9923 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9924 {
9925 string particle_class2 = "";
9927 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9928 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9929 WPOBE_array.Insert(WPOBE);
9930 }
9931
9932
9934 }
9935 }
9936 }
9937
9938
9940 {
9943
9945 {
9946 string config_to_search = "CfgVehicles";
9947
9948 if (IsInherited(Weapon))
9949 config_to_search = "CfgWeapons";
9950
9951 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9952 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9953
9954 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9955 {
9956
9958
9960 {
9962 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9964 return;
9965 }
9966
9969
9970
9971
9973 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9974
9975 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9976 {
9977 string particle_class = "";
9979 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9981
9982 if (entry_type == CT_CLASS)
9983 {
9984 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9985 WPOOH_array.Insert(WPOF);
9986 }
9987 }
9988
9989
9991 }
9992 }
9993 }
9994
9996 {
9998 }
9999
10001 {
10003 {
10005
10008
10011
10012 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10013 }
10014 }
10015
10017 {
10019 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10020
10022 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10023
10025 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10026
10028 {
10030 }
10031 }
10032
10034 {
10036 }
10037
10039 {
10042 else
10044
10046 {
10049 }
10050 else
10051 {
10054
10057 }
10058
10060 }
10061
10063 {
10065 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10066 }
10067
10069 {
10071 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10073 }
10074
10076 {
10078 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10079 }
10080
10082 {
10085
10086 OverheatingParticle OP = new OverheatingParticle();
10091
10093 }
10094
10096 {
10099
10100 return -1;
10101 }
10102
10104 {
10106 {
10109
10110 for (int i = count; i > 0; --i)
10111 {
10112 int id = i - 1;
10115
10118
10119 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10120 {
10121 if (p)
10122 {
10125 }
10126 }
10127 }
10128 }
10129 }
10130
10132 {
10134 {
10136 {
10137 int id = i - 1;
10139
10140 if (OP)
10141 {
10143
10144 if (p)
10145 {
10147 }
10148
10149 delete OP;
10150 }
10151 }
10152
10155 }
10156 }
10157
10160 {
10161 return 0.0;
10162 }
10163
10164
10166 {
10167 return 250;
10168 }
10169
10171 {
10172 return 0;
10173 }
10174
10177 {
10179 return true;
10180
10181 return false;
10182 }
10183
10186 {
10189
10191 {
10193 }
10194 else
10195 {
10196
10198 }
10199
10201 }
10202
10209 {
10210 return -1;
10211 }
10212
10213
10214
10215
10217 {
10219 {
10221 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10222
10223 if (r_index >= 0)
10224 {
10225 InventoryLocation r_il = new InventoryLocation;
10226 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10227
10228 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10231 {
10232 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10233 }
10235 {
10236 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10237 }
10238
10239 }
10240
10241 player.GetHumanInventory().ClearUserReservedLocation(this);
10242 }
10243
10246 }
10247
10248
10249
10250
10252 {
10253 return ItemBase.m_DebugActionsMask;
10254 }
10255
10257 {
10258 return ItemBase.m_DebugActionsMask & mask;
10259 }
10260
10262 {
10263 ItemBase.m_DebugActionsMask = mask;
10264 }
10265
10267 {
10268 ItemBase.m_DebugActionsMask |= mask;
10269 }
10270
10272 {
10273 ItemBase.m_DebugActionsMask &= ~mask;
10274 }
10275
10277 {
10279 {
10281 }
10282 else
10283 {
10285 }
10286 }
10287
10288
10290 {
10291 if (GetEconomyProfile())
10292 {
10293 float q_max = GetEconomyProfile().GetQuantityMax();
10294 if (q_max > 0)
10295 {
10296 float q_min = GetEconomyProfile().GetQuantityMin();
10297 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10298
10300 {
10301 ComponentEnergyManager comp = GetCompEM();
10303 {
10305 }
10306 }
10308 {
10310
10311 }
10312
10313 }
10314 }
10315 }
10316
10319 {
10320 EntityAI parent = GetHierarchyParent();
10321
10322 if (parent)
10323 {
10324 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10325 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10326 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10327 }
10328 }
10329
10332 {
10333 EntityAI parent = GetHierarchyParent();
10334
10335 if (parent)
10336 {
10337 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10338 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10339 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10340 }
10341 }
10342
10344 {
10345
10346
10347
10348
10350
10352 {
10353 if (ScriptInputUserData.CanStoreInputUserData())
10354 {
10355 ScriptInputUserData ctx = new ScriptInputUserData;
10361 ctx.
Write(use_stack_max);
10364
10366 {
10367 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10368 }
10369 }
10370 }
10371 else if (!
GetGame().IsMultiplayer())
10372 {
10374 }
10375 }
10376
10378 {
10380 }
10381
10383 {
10385 }
10386
10388 {
10390 }
10391
10393 {
10394
10395 return false;
10396 }
10397
10399 {
10400 return false;
10401 }
10402
10406 {
10407 return false;
10408 }
10409
10411 {
10412 return "";
10413 }
10414
10416
10418 {
10419 return false;
10420 }
10421
10423 {
10424 return true;
10425 }
10426
10427
10428
10430 {
10431 return true;
10432 }
10433
10435 {
10436 return true;
10437 }
10438
10440 {
10441 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10443 }
10444
10446 {
10448 }
10449
10451 {
10453 if (!is_being_placed)
10455 SetSynchDirty();
10456 }
10457
10458
10460
10462 {
10464 }
10465
10467 {
10469 }
10470
10472 {
10473 return 1;
10474 }
10475
10477 {
10478 return false;
10479 }
10480
10482 {
10484 SetSynchDirty();
10485 }
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10522 {
10523 super.OnMovedInsideCargo(container);
10524
10525 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10526 }
10527
10528 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10529 {
10530 super.EEItemLocationChanged(oldLoc,newLoc);
10531
10532 PlayerBase new_player = null;
10533 PlayerBase old_player = null;
10534
10535 if (newLoc.GetParent())
10536 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10537
10538 if (oldLoc.GetParent())
10539 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10540
10542 {
10543 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10544
10545 if (r_index >= 0)
10546 {
10547 InventoryLocation r_il = new InventoryLocation;
10548 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10549
10550 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10553 {
10554 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10555 }
10557 {
10558 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10559 }
10560
10561 }
10562 }
10563
10565 {
10566 if (new_player)
10567 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10568
10569 if (new_player == old_player)
10570 {
10571
10572 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10573 {
10575 {
10576 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10577 {
10578 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10579 }
10580 }
10581 else
10582 {
10583 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10584 }
10585 }
10586
10587 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10588 {
10589 int type = oldLoc.GetType();
10591 {
10592 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10593 }
10595 {
10596 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10597 }
10598 }
10599 if (!m_OldLocation)
10600 {
10601 m_OldLocation = new InventoryLocation;
10602 }
10603 m_OldLocation.Copy(oldLoc);
10604 }
10605 else
10606 {
10607 if (m_OldLocation)
10608 {
10609 m_OldLocation.Reset();
10610 }
10611 }
10612
10614 }
10615 else
10616 {
10617 if (new_player)
10618 {
10619 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10620 if (res_index >= 0)
10621 {
10622 InventoryLocation il = new InventoryLocation;
10623 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10625 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10628 {
10629 il.
GetParent().GetOnReleaseLock().Invoke(it);
10630 }
10632 {
10634 }
10635
10636 }
10637 }
10639 {
10640
10642 }
10643
10644 if (m_OldLocation)
10645 {
10646 m_OldLocation.Reset();
10647 }
10648 }
10649 }
10650
10651 override void EOnContact(IEntity other, Contact extra)
10652 {
10654 {
10655 int liquidType = -1;
10657 if (impactSpeed > 0.0)
10658 {
10660 #ifndef SERVER
10662 #else
10664 SetSynchDirty();
10665 #endif
10667 }
10668 }
10669
10670 #ifdef SERVER
10671 if (GetCompEM() && GetCompEM().IsPlugged())
10672 {
10673 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10674 GetCompEM().UnplugThis();
10675 }
10676 #endif
10677 }
10678
10680
10682 {
10684 }
10685
10687 {
10688
10689 }
10690
10692 {
10693 super.OnItemLocationChanged(old_owner, new_owner);
10694
10695 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10696 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10697
10698 if (!relatedPlayer && playerNew)
10699 relatedPlayer = playerNew;
10700
10701 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10702 {
10704 if (actionMgr)
10705 {
10706 ActionBase currentAction = actionMgr.GetRunningAction();
10707 if (currentAction)
10709 }
10710 }
10711
10712 Man ownerPlayerOld = null;
10713 Man ownerPlayerNew = null;
10714
10715 if (old_owner)
10716 {
10717 if (old_owner.
IsMan())
10718 {
10719 ownerPlayerOld = Man.Cast(old_owner);
10720 }
10721 else
10722 {
10723 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10724 }
10725 }
10726 else
10727 {
10729 {
10731
10732 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10733 {
10734 GetCompEM().UnplugThis();
10735 }
10736 }
10737 }
10738
10739 if (new_owner)
10740 {
10741 if (new_owner.
IsMan())
10742 {
10743 ownerPlayerNew = Man.Cast(new_owner);
10744 }
10745 else
10746 {
10747 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10748 }
10749 }
10750
10751 if (ownerPlayerOld != ownerPlayerNew)
10752 {
10753 if (ownerPlayerOld)
10754 {
10755 array<EntityAI> subItemsExit = new array<EntityAI>;
10757 for (int i = 0; i < subItemsExit.Count(); i++)
10758 {
10761 }
10762 }
10763
10764 if (ownerPlayerNew)
10765 {
10766 array<EntityAI> subItemsEnter = new array<EntityAI>;
10768 for (int j = 0; j < subItemsEnter.Count(); j++)
10769 {
10772 }
10773 }
10774 }
10775 else if (ownerPlayerNew != null)
10776 {
10777 PlayerBase nplayer;
10778 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10779 {
10780 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10782 for (int k = 0; k < subItemsUpdate.Count(); k++)
10783 {
10785 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10786 }
10787 }
10788 }
10789
10790 if (old_owner)
10791 old_owner.OnChildItemRemoved(this);
10792 if (new_owner)
10793 new_owner.OnChildItemReceived(this);
10794 }
10795
10796
10798 {
10799 super.EEDelete(parent);
10800 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10801 if (player)
10802 {
10804
10805 if (player.IsAlive())
10806 {
10807 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10808 if (r_index >= 0)
10809 {
10810 InventoryLocation r_il = new InventoryLocation;
10811 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10812
10813 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10816 {
10817 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10818 }
10820 {
10821 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10822 }
10823
10824 }
10825
10826 player.RemoveQuickBarEntityShortcut(this);
10827 }
10828 }
10829 }
10830
10832 {
10833 super.EEKilled(killer);
10834
10837 {
10838 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10839 {
10840 if (IsMagazine())
10841 {
10842 if (Magazine.Cast(this).GetAmmoCount() > 0)
10843 {
10845 }
10846 }
10847 else
10848 {
10850 }
10851 }
10852 }
10853 }
10854
10856 {
10857 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10858
10859 super.OnWasAttached(parent, slot_id);
10860
10863
10865 }
10866
10868 {
10869 super.OnWasDetached(parent, slot_id);
10870
10873 }
10874
10876 {
10877 int idx;
10880
10881 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10882 if (inventory_slots.Count() < 1)
10883 {
10884 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10885 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10886 }
10887 else
10888 {
10889 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10890 }
10891
10892 idx = inventory_slots.Find(slot);
10893 if (idx < 0)
10894 return "";
10895
10896 return attach_types.Get(idx);
10897 }
10898
10900 {
10901 int idx = -1;
10902 string slot;
10903
10906
10907 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10908 if (inventory_slots.Count() < 1)
10909 {
10910 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10911 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10912 }
10913 else
10914 {
10915 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10916 if (detach_types.Count() < 1)
10917 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10918 }
10919
10920 for (int i = 0; i < inventory_slots.Count(); i++)
10921 {
10922 slot = inventory_slots.Get(i);
10923 }
10924
10925 if (slot != "")
10926 {
10927 if (detach_types.Count() == 1)
10928 idx = 0;
10929 else
10930 idx = inventory_slots.Find(slot);
10931 }
10932 if (idx < 0)
10933 return "";
10934
10935 return detach_types.Get(idx);
10936 }
10937
10939 {
10940
10942
10943
10944 float min_time = 1;
10945 float max_time = 3;
10946 float delay = Math.RandomFloat(min_time, max_time);
10947
10948 explode_timer.Run(delay, this, "DoAmmoExplosion");
10949 }
10950
10952 {
10953 Magazine magazine = Magazine.Cast(this);
10954 int pop_sounds_count = 6;
10955 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10956
10957
10958 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10959 string sound_name = pop_sounds[ sound_idx ];
10961
10962
10963 magazine.ServerAddAmmoCount(-1);
10964
10965
10966 float min_temp_to_explode = 100;
10967
10968 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10969 {
10971 }
10972 }
10973
10974
10975 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10976 {
10977 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10978
10979 const int CHANCE_DAMAGE_CARGO = 4;
10980 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10981 const int CHANCE_DAMAGE_NOTHING = 2;
10982
10984 {
10985 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10986 int chances;
10987 int rnd;
10988
10989 if (GetInventory().GetCargo())
10990 {
10991 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10992 rnd = Math.RandomInt(0,chances);
10993
10994 if (rnd < CHANCE_DAMAGE_CARGO)
10995 {
10997 }
10998 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10999 {
11001 }
11002 }
11003 else
11004 {
11005 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11006 rnd = Math.RandomInt(0,chances);
11007
11008 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11009 {
11011 }
11012 }
11013 }
11014 }
11015
11017 {
11018 if (GetInventory().GetCargo())
11019 {
11020 int item_count = GetInventory().GetCargo().GetItemCount();
11021 if (item_count > 0)
11022 {
11023 int random_pick = Math.RandomInt(0, item_count);
11025 if (!item.IsExplosive())
11026 {
11027 item.AddHealth("","",damage);
11028 return true;
11029 }
11030 }
11031 }
11032 return false;
11033 }
11034
11036 {
11037 int attachment_count = GetInventory().AttachmentCount();
11038 if (attachment_count > 0)
11039 {
11040 int random_pick = Math.RandomInt(0, attachment_count);
11041 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
11042 if (!attachment.IsExplosive())
11043 {
11044 attachment.AddHealth("","",damage);
11045 return true;
11046 }
11047 }
11048 return false;
11049 }
11050
11052 {
11054 }
11055
11057 {
11059 return GetInventory().CanRemoveEntity();
11060
11061 return false;
11062 }
11063
11065 {
11066
11068 return false;
11069
11070
11072 return false;
11073
11074
11075
11077 if (delta == 0)
11078 return false;
11079
11080
11081 return true;
11082 }
11083
11085 {
11087 {
11088 if (ScriptInputUserData.CanStoreInputUserData())
11089 {
11090 ScriptInputUserData ctx = new ScriptInputUserData;
11095 ctx.
Write(destination_entity);
11097 ctx.
Write(slot_id);
11099 }
11100 }
11101 else if (!
GetGame().IsMultiplayer())
11102 {
11104 }
11105 }
11106
11108 {
11109 float split_quantity_new;
11113 InventoryLocation loc = new InventoryLocation;
11114
11115 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11116 {
11118 split_quantity_new = stack_max;
11119 else
11121
11123 {
11124 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11125 if (new_item)
11126 {
11127 new_item.SetResultOfSplit(true);
11128 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11130 new_item.
SetQuantity(split_quantity_new,
false,
true);
11131 }
11132 }
11133 }
11134 else if (destination_entity && slot_id == -1)
11135 {
11136 if (quantity > stack_max)
11137 split_quantity_new = stack_max;
11138 else
11139 split_quantity_new = quantity;
11140
11142 {
11144 {
11147 }
11148
11149 if (new_item)
11150 {
11151 new_item.SetResultOfSplit(true);
11152 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11154 new_item.
SetQuantity(split_quantity_new,
false,
true);
11155 }
11156 }
11157 }
11158 else
11159 {
11160 if (stack_max != 0)
11161 {
11163 {
11165 }
11166
11167 if (split_quantity_new == 0)
11168 {
11169 if (!
GetGame().IsMultiplayer())
11170 player.PhysicalPredictiveDropItem(this);
11171 else
11172 player.ServerDropEntity(this);
11173 return;
11174 }
11175
11177 {
11179
11180 if (new_item)
11181 {
11182 new_item.SetResultOfSplit(true);
11183 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11186 new_item.PlaceOnSurface();
11187 }
11188 }
11189 }
11190 }
11191 }
11192
11194 {
11195 float split_quantity_new;
11199 InventoryLocation loc = new InventoryLocation;
11200
11201 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11202 {
11204 split_quantity_new = stack_max;
11205 else
11207
11209 {
11210 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11211 if (new_item)
11212 {
11213 new_item.SetResultOfSplit(true);
11214 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11216 new_item.
SetQuantity(split_quantity_new,
false,
true);
11217 }
11218 }
11219 }
11220 else if (destination_entity && slot_id == -1)
11221 {
11222 if (quantity > stack_max)
11223 split_quantity_new = stack_max;
11224 else
11225 split_quantity_new = quantity;
11226
11228 {
11230 {
11233 }
11234
11235 if (new_item)
11236 {
11237 new_item.SetResultOfSplit(true);
11238 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11240 new_item.
SetQuantity(split_quantity_new,
false,
true);
11241 }
11242 }
11243 }
11244 else
11245 {
11246 if (stack_max != 0)
11247 {
11249 {
11251 }
11252
11254 {
11256
11257 if (new_item)
11258 {
11259 new_item.SetResultOfSplit(true);
11260 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11263 new_item.PlaceOnSurface();
11264 }
11265 }
11266 }
11267 }
11268 }
11269
11271 {
11273 {
11274 if (ScriptInputUserData.CanStoreInputUserData())
11275 {
11276 ScriptInputUserData ctx = new ScriptInputUserData;
11281 dst.WriteToContext(ctx);
11283 }
11284 }
11285 else if (!
GetGame().IsMultiplayer())
11286 {
11288 }
11289 }
11290
11292 {
11294 {
11295 if (ScriptInputUserData.CanStoreInputUserData())
11296 {
11297 ScriptInputUserData ctx = new ScriptInputUserData;
11302 ctx.
Write(destination_entity);
11308 }
11309 }
11310 else if (!
GetGame().IsMultiplayer())
11311 {
11313 }
11314 }
11315
11317 {
11319 }
11320
11322 {
11324 float split_quantity_new;
11326 if (dst.IsValid())
11327 {
11328 int slot_id = dst.GetSlot();
11330
11331 if (quantity > stack_max)
11332 split_quantity_new = stack_max;
11333 else
11334 split_quantity_new = quantity;
11335
11337 {
11339
11340 if (new_item)
11341 {
11342 new_item.SetResultOfSplit(true);
11343 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11345 new_item.
SetQuantity(split_quantity_new,
false,
true);
11346 }
11347
11348 return new_item;
11349 }
11350 }
11351
11352 return null;
11353 }
11354
11356 {
11358 float split_quantity_new;
11360 if (destination_entity)
11361 {
11363 if (quantity > stackable)
11364 split_quantity_new = stackable;
11365 else
11366 split_quantity_new = quantity;
11367
11369 {
11370 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11371 if (new_item)
11372 {
11373 new_item.SetResultOfSplit(true);
11374 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11376 new_item.
SetQuantity(split_quantity_new,
false,
true);
11377 }
11378 }
11379 }
11380 }
11381
11383 {
11385 {
11386 if (ScriptInputUserData.CanStoreInputUserData())
11387 {
11388 ScriptInputUserData ctx = new ScriptInputUserData;
11393 ItemBase destination_entity =
this;
11394 ctx.
Write(destination_entity);
11398 }
11399 }
11400 else if (!
GetGame().IsMultiplayer())
11401 {
11403 }
11404 }
11405
11407 {
11409 float split_quantity_new;
11411 if (player)
11412 {
11414 if (quantity > stackable)
11415 split_quantity_new = stackable;
11416 else
11417 split_quantity_new = quantity;
11418
11420 {
11421 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11422 new_item =
ItemBase.Cast(in_hands);
11423 if (new_item)
11424 {
11425 new_item.SetResultOfSplit(true);
11426 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11428 new_item.SetQuantity(split_quantity_new, false, true);
11429 }
11430 }
11431 }
11432 }
11433
11435 {
11437 float split_quantity_new = Math.Floor(quantity * 0.5);
11438
11440 return;
11441
11443
11444 if (new_item)
11445 {
11446 if (new_item.GetQuantityMax() < split_quantity_new)
11447 {
11448 split_quantity_new = new_item.GetQuantityMax();
11449 }
11450
11451 new_item.SetResultOfSplit(true);
11452 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11453
11455 {
11458 }
11459 else
11460 {
11462 new_item.
SetQuantity(split_quantity_new,
false,
true);
11463 }
11464 }
11465 }
11466
11468 {
11470 float split_quantity_new = Math.Floor(quantity / 2);
11471
11473 return;
11474
11475 InventoryLocation invloc = new InventoryLocation;
11477
11479 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11480
11481 if (new_item)
11482 {
11483 if (new_item.GetQuantityMax() < split_quantity_new)
11484 {
11485 split_quantity_new = new_item.GetQuantityMax();
11486 }
11488 {
11491 }
11492 else if (split_quantity_new > 1)
11493 {
11495 new_item.
SetQuantity(split_quantity_new,
false,
true);
11496 }
11497 }
11498 }
11499
11502 {
11503 SetWeightDirty();
11505
11506 if (parent)
11507 parent.OnAttachmentQuantityChangedEx(this, delta);
11508
11510 {
11512 {
11514 }
11516 {
11517 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11519 }
11520 }
11521
11522 }
11523
11526 {
11527
11528 }
11529
11532 {
11534 }
11535
11537 {
11538 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11539
11541 {
11542 if (newLevel == GameConstants.STATE_RUINED)
11543 {
11545 EntityAI parent = GetHierarchyParent();
11546 if (parent && parent.IsFireplace())
11547 {
11548 CargoBase cargo = GetInventory().GetCargo();
11549 if (cargo)
11550 {
11552 {
11554 }
11555 }
11556 }
11557 }
11558
11560 {
11561
11563 return;
11564 }
11565
11566 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11567 {
11569 }
11570 }
11571 }
11572
11573
11575 {
11576 super.OnRightClick();
11577
11579 {
11581 {
11582 if (ScriptInputUserData.CanStoreInputUserData())
11583 {
11584 EntityAI root = GetHierarchyRoot();
11585 Man playerOwner = GetHierarchyRootPlayer();
11586 InventoryLocation dst = new InventoryLocation;
11587
11588
11589 if (!playerOwner && root && root == this)
11590 {
11592 }
11593 else
11594 {
11595
11596 GetInventory().GetCurrentInventoryLocation(dst);
11598 {
11601 {
11603 }
11604 else
11605 {
11607
11608
11609 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11610 {
11612 }
11613 else
11614 {
11615 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11616 }
11617 }
11618 }
11619 }
11620
11621 ScriptInputUserData ctx = new ScriptInputUserData;
11629 }
11630 }
11631 else if (!
GetGame().IsMultiplayer())
11632 {
11634 }
11635 }
11636 }
11637
11639 {
11640 if (root)
11641 {
11642 vector m4[4];
11643 root.GetTransform(m4);
11644 dst.SetGround(this, m4);
11645 }
11646 else
11647 {
11648 GetInventory().GetCurrentInventoryLocation(dst);
11649 }
11650 }
11651
11652 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11653 {
11654
11655 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11656 return false;
11657
11658 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11659 return false;
11660
11661
11663 return false;
11664
11665
11666 Magazine mag = Magazine.Cast(this);
11667 if (mag)
11668 {
11669 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11670 return false;
11671
11672 if (stack_max_limit)
11673 {
11674 Magazine other_mag = Magazine.Cast(other_item);
11675 if (other_item)
11676 {
11677 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11678 return false;
11679 }
11680
11681 }
11682 }
11683 else
11684 {
11685
11687 return false;
11688
11690 return false;
11691 }
11692
11693 PlayerBase player = null;
11694 if (CastTo(player, GetHierarchyRootPlayer()))
11695 {
11696 if (player.GetInventory().HasAttachment(this))
11697 return false;
11698
11699 if (player.IsItemsToDelete())
11700 return false;
11701 }
11702
11703 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11704 return false;
11705
11706 int slotID;
11708 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11709 return false;
11710
11711 return true;
11712 }
11713
11715 {
11717 }
11718
11720 {
11721 return m_IsResultOfSplit;
11722 }
11723
11725 {
11726 m_IsResultOfSplit = value;
11727 }
11728
11730 {
11732 }
11733
11735 {
11736 float other_item_quantity = other_item.GetQuantity();
11737 float this_free_space;
11738
11740
11742
11743 if (other_item_quantity > this_free_space)
11744 {
11745 return this_free_space;
11746 }
11747 else
11748 {
11749 return other_item_quantity;
11750 }
11751 }
11752
11754 {
11756 }
11757
11759 {
11761 return;
11762
11763 if (!IsMagazine() && other_item)
11764 {
11766 if (quantity_used != 0)
11767 {
11768 float hp1 = GetHealth01("","");
11769 float hp2 = other_item.GetHealth01("","");
11770 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11771 hpResult = hpResult / (
GetQuantity() + quantity_used);
11772
11773 hpResult *= GetMaxHealth();
11774 Math.Round(hpResult);
11775 SetHealth("", "Health", hpResult);
11776
11778 other_item.AddQuantity(-quantity_used);
11779 }
11780 }
11782 }
11783
11785 {
11786 #ifdef SERVER
11787 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11788 GetHierarchyParent().IncreaseLifetimeUp();
11789 #endif
11790 };
11791
11793 {
11794 PlayerBase p = PlayerBase.Cast(player);
11795
11796 array<int> recipesIds = p.m_Recipes;
11797 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11798 if (moduleRecipesManager)
11799 {
11800 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11801 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11802 }
11803
11804 for (int i = 0;i < recipesIds.Count(); i++)
11805 {
11806 int key = recipesIds.Get(i);
11807 string recipeName = moduleRecipesManager.GetRecipeName(key);
11809 }
11810 }
11811
11812
11813 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11814 {
11815 super.GetDebugActions(outputList);
11816
11817
11823
11824
11829
11834
11835
11839
11840
11842 {
11846 }
11847
11850
11851
11855
11857
11858 InventoryLocation loc = new InventoryLocation();
11859 GetInventory().GetCurrentInventoryLocation(loc);
11861 {
11862 if (Gizmo_IsSupported())
11865 }
11866
11868 }
11869
11870
11871
11872
11874 {
11875 super.OnAction(action_id, player, ctx);
11876
11878 {
11879 switch (action_id)
11880 {
11883 return true;
11886 return true;
11887 }
11888 }
11889
11891 {
11892 switch (action_id)
11893 {
11895 Delete();
11896 return true;
11897 }
11898 }
11899
11900 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11901 {
11902 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11903 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11904 PlayerBase p = PlayerBase.Cast(player);
11905 if (
EActions.RECIPES_RANGE_START < 1000)
11906 {
11907 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11908 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11909 }
11910 }
11911 #ifndef SERVER
11912 else if (action_id ==
EActions.WATCH_PLAYER)
11913 {
11914 PluginDeveloper.SetDeveloperItemClientEx(player);
11915 }
11916 #endif
11918 {
11919 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11920 {
11921 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11922 OnDebugButtonPressServer(id + 1);
11923 }
11924
11925 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11926 {
11927 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11929 }
11930
11931 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11932 {
11933 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11935 }
11936
11937 else if (action_id ==
EActions.ADD_QUANTITY)
11938 {
11939 if (IsMagazine())
11940 {
11941 Magazine mag = Magazine.Cast(this);
11942 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11943 }
11944 else
11945 {
11947 }
11948
11949 if (m_EM)
11950 {
11951 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11952 }
11953
11954 }
11955
11956 else if (action_id ==
EActions.REMOVE_QUANTITY)
11957 {
11958 if (IsMagazine())
11959 {
11960 Magazine mag2 = Magazine.Cast(this);
11961 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11962 }
11963 else
11964 {
11966 }
11967 if (m_EM)
11968 {
11969 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11970 }
11971
11972 }
11973
11974 else if (action_id ==
EActions.SET_QUANTITY_0)
11975 {
11977
11978 if (m_EM)
11979 {
11980 m_EM.SetEnergy(0);
11981 }
11982 }
11983
11984 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11985 {
11987
11988 if (m_EM)
11989 {
11990 m_EM.SetEnergy(m_EM.GetEnergyMax());
11991 }
11992 }
11993
11994 else if (action_id ==
EActions.ADD_HEALTH)
11995 {
11996 AddHealth("","",GetMaxHealth("","Health")/5);
11997 }
11998 else if (action_id ==
EActions.REMOVE_HEALTH)
11999 {
12000 AddHealth("","",-GetMaxHealth("","Health")/5);
12001 }
12002 else if (action_id ==
EActions.DESTROY_HEALTH)
12003 {
12004 SetHealth01("","",0);
12005 }
12006 else if (action_id ==
EActions.WATCH_ITEM)
12007 {
12009 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12010 #ifdef DEVELOPER
12011 SetDebugDeveloper_item(this);
12012 #endif
12013 }
12014
12015 else if (action_id ==
EActions.ADD_TEMPERATURE)
12016 {
12017 AddTemperature(20);
12018
12019 }
12020
12021 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12022 {
12023 AddTemperature(-20);
12024
12025 }
12026
12027 else if (action_id ==
EActions.FLIP_FROZEN)
12028 {
12029 SetFrozen(!GetIsFrozen());
12030
12031 }
12032
12033 else if (action_id ==
EActions.ADD_WETNESS)
12034 {
12036
12037 }
12038
12039 else if (action_id ==
EActions.REMOVE_WETNESS)
12040 {
12042
12043 }
12044
12045 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12046 {
12049
12050
12051 }
12052
12053 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12054 {
12057 }
12058
12059 else if (action_id ==
EActions.MAKE_SPECIAL)
12060 {
12061 auto debugParams = DebugSpawnParams.WithPlayer(player);
12062 OnDebugSpawnEx(debugParams);
12063 }
12064
12065 }
12066
12067
12068 return false;
12069 }
12070
12071
12072
12073
12077
12080
12081
12082
12084 {
12085 return false;
12086 }
12087
12088
12090 {
12091 return true;
12092 }
12093
12094
12096 {
12097 return true;
12098 }
12099
12100
12101
12103 {
12104 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12106 }
12107
12110 {
12111 return null;
12112 }
12113
12115 {
12116 return false;
12117 }
12118
12120 {
12121 return false;
12122 }
12123
12127
12128
12130 {
12131 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12132 return module_repairing.CanRepair(this, item_repair_kit);
12133 }
12134
12135
12136 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12137 {
12138 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12139 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12140 }
12141
12142
12144 {
12145
12146
12147
12148
12149
12150
12151
12152
12153 return 1;
12154 }
12155
12156
12157
12159 {
12161 }
12162
12163
12164
12166 {
12168 }
12169
12170
12179 {
12180 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12181
12182 if (player)
12183 {
12184 player.MessageStatus(text);
12185 }
12186 }
12187
12188
12197 {
12198 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12199
12200 if (player)
12201 {
12202 player.MessageAction(text);
12203 }
12204 }
12205
12206
12215 {
12216 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12217
12218 if (player)
12219 {
12220 player.MessageFriendly(text);
12221 }
12222 }
12223
12224
12233 {
12234 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12235
12236 if (player)
12237 {
12238 player.MessageImportant(text);
12239 }
12240 }
12241
12243 {
12244 return true;
12245 }
12246
12247
12248 override bool KindOf(
string tag)
12249 {
12250 bool found = false;
12251 string item_name = this.
GetType();
12254
12255 int array_size = item_tag_array.Count();
12256 for (int i = 0; i < array_size; i++)
12257 {
12258 if (item_tag_array.Get(i) == tag)
12259 {
12260 found = true;
12261 break;
12262 }
12263 }
12264 return found;
12265 }
12266
12267
12269 {
12270
12271 super.OnRPC(sender, rpc_type,ctx);
12272
12273
12274 switch (rpc_type)
12275 {
12276 #ifndef SERVER
12277 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12278 Param2<bool, string> p = new Param2<bool, string>(false, "");
12279
12281 return;
12282
12283 bool play = p.param1;
12284 string soundSet = p.param2;
12285
12286 if (play)
12287 {
12289 {
12291 {
12293 }
12294 }
12295 else
12296 {
12298 }
12299 }
12300 else
12301 {
12303 }
12304
12305 break;
12306 #endif
12307
12308 }
12309
12311 {
12313 }
12314 }
12315
12316
12317
12318
12320 {
12321 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12322 return plugin.GetID(
name);
12323 }
12324
12326 {
12327 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12328 return plugin.GetName(id);
12329 }
12330
12333 {
12334
12335
12336 int varFlags;
12337 if (!ctx.
Read(varFlags))
12338 return;
12339
12340 if (varFlags & ItemVariableFlags.FLOAT)
12341 {
12343 }
12344 }
12345
12347 {
12348
12349 super.SerializeNumericalVars(floats_out);
12350
12351
12352
12354 {
12356 }
12357
12359 {
12361 }
12362
12364 {
12366 }
12367
12369 {
12374 }
12375
12377 {
12379 }
12380 }
12381
12383 {
12384
12385 super.DeSerializeNumericalVars(floats);
12386
12387
12388 int index = 0;
12389 int mask = Math.Round(floats.Get(index));
12390
12391 index++;
12392
12394 {
12396 {
12398 }
12399 else
12400 {
12401 float quantity = floats.Get(index);
12402 SetQuantity(quantity,
true,
false,
false,
false);
12403 }
12404 index++;
12405 }
12406
12408 {
12409 float wet = floats.Get(index);
12411 index++;
12412 }
12413
12415 {
12416 int liquidtype = Math.Round(floats.Get(index));
12418 index++;
12419 }
12420
12422 {
12424 index++;
12426 index++;
12428 index++;
12430 index++;
12431 }
12432
12434 {
12435 int cleanness = Math.Round(floats.Get(index));
12437 index++;
12438 }
12439 }
12440
12442 {
12443 super.WriteVarsToCTX(ctx);
12444
12445
12447 {
12449 }
12450
12452 {
12454 }
12455
12457 {
12459 }
12460
12462 {
12463 int r,g,b,a;
12469 }
12470
12472 {
12474 }
12475 }
12476
12478 {
12479 if (!super.ReadVarsFromCTX(ctx,version))
12480 return false;
12481
12482 int intValue;
12483 float value;
12484
12485 if (version < 140)
12486 {
12487 if (!ctx.
Read(intValue))
12488 return false;
12489
12490 m_VariablesMask = intValue;
12491 }
12492
12494 {
12495 if (!ctx.
Read(value))
12496 return false;
12497
12499 {
12501 }
12502 else
12503 {
12505 }
12506 }
12507
12508 if (version < 140)
12509 {
12511 {
12512 if (!ctx.
Read(value))
12513 return false;
12514 SetTemperatureDirect(value);
12515 }
12516 }
12517
12519 {
12520 if (!ctx.
Read(value))
12521 return false;
12523 }
12524
12526 {
12527 if (!ctx.
Read(intValue))
12528 return false;
12530 }
12531
12533 {
12534 int r,g,b,a;
12536 return false;
12538 return false;
12540 return false;
12542 return false;
12543
12545 }
12546
12548 {
12549 if (!ctx.
Read(intValue))
12550 return false;
12552 }
12553
12554 if (version >= 138 && version < 140)
12555 {
12557 {
12558 if (!ctx.
Read(intValue))
12559 return false;
12560 SetFrozen(intValue);
12561 }
12562 }
12563
12564 return true;
12565 }
12566
12567
12569 {
12572 {
12574 }
12575
12576 if (!super.OnStoreLoad(ctx, version))
12577 {
12579 return false;
12580 }
12581
12582 if (version >= 114)
12583 {
12584 bool hasQuickBarIndexSaved;
12585
12586 if (!ctx.
Read(hasQuickBarIndexSaved))
12587 {
12589 return false;
12590 }
12591
12592 if (hasQuickBarIndexSaved)
12593 {
12594 int itmQBIndex;
12595
12596
12597 if (!ctx.
Read(itmQBIndex))
12598 {
12600 return false;
12601 }
12602
12603 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12604 if (itmQBIndex != -1 && parentPlayer)
12605 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12606 }
12607 }
12608 else
12609 {
12610
12611 PlayerBase player;
12612 int itemQBIndex;
12613 if (version ==
int.
MAX)
12614 {
12615 if (!ctx.
Read(itemQBIndex))
12616 {
12618 return false;
12619 }
12620 }
12621 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12622 {
12623
12624 if (!ctx.
Read(itemQBIndex))
12625 {
12627 return false;
12628 }
12629 if (itemQBIndex != -1 && player)
12630 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12631 }
12632 }
12633
12634 if (version < 140)
12635 {
12636
12637 if (!LoadVariables(ctx, version))
12638 {
12640 return false;
12641 }
12642 }
12643
12644
12646 {
12648 return false;
12649 }
12650 if (version >= 132)
12651 {
12653 if (raib)
12654 {
12656 {
12658 return false;
12659 }
12660 }
12661 }
12662
12664 return true;
12665 }
12666
12667
12668
12670 {
12671 super.OnStoreSave(ctx);
12672
12673 PlayerBase player;
12674 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12675 {
12677
12678 int itemQBIndex = -1;
12679 itemQBIndex = player.FindQuickBarEntityIndex(this);
12680 ctx.
Write(itemQBIndex);
12681 }
12682 else
12683 {
12685 }
12686
12688
12690 if (raib)
12691 {
12693 }
12694 }
12695
12696
12698 {
12699 super.AfterStoreLoad();
12700
12702 {
12704 }
12705
12707 {
12710 }
12711 }
12712
12714 {
12715 super.EEOnAfterLoad();
12716
12718 {
12720 }
12721
12724 }
12725
12727 {
12728 return false;
12729 }
12730
12731
12732
12734 {
12736 {
12737 #ifdef PLATFORM_CONSOLE
12738
12740 {
12742 if (menu)
12743 {
12745 }
12746 }
12747 #endif
12748 }
12749
12751 {
12754 }
12755
12757 {
12758 SetWeightDirty();
12760 }
12762 {
12765 }
12766
12768 {
12771 }
12773 {
12776 }
12777
12778 super.OnVariablesSynchronized();
12779 }
12780
12781
12782
12784 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12785 {
12786 if (!IsServerCheck(allow_client))
12787 return false;
12788
12790 return false;
12791
12794
12795 if (value <= (min + 0.001))
12796 value = min;
12797
12798 if (value == min)
12799 {
12800 if (destroy_config)
12801 {
12802 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12803 if (dstr)
12804 {
12806 this.Delete();
12807 return true;
12808 }
12809 }
12810 else if (destroy_forced)
12811 {
12813 this.Delete();
12814 return true;
12815 }
12816
12818 }
12819
12822
12824 {
12826
12827 if (delta)
12829 }
12830
12832
12833 return false;
12834 }
12835
12836
12838 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12839 {
12841 }
12842
12844 {
12847 }
12848
12850 {
12853 }
12854
12856 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12857 {
12858 float value_clamped = Math.Clamp(value, 0, 1);
12860 SetQuantity(result, destroy_config, destroy_forced);
12861 }
12862
12863
12866 {
12868 }
12869
12871 {
12873 }
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12885 {
12886 int slot = -1;
12887 if (GetInventory())
12888 {
12889 InventoryLocation il = new InventoryLocation;
12890 GetInventory().GetCurrentInventoryLocation(il);
12892 }
12893
12895 }
12896
12898 {
12899 float quantity_max = 0;
12900
12902 {
12903 if (attSlotID != -1)
12904 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12905
12906 if (quantity_max <= 0)
12908 }
12909
12910 if (quantity_max <= 0)
12912
12913 return quantity_max;
12914 }
12915
12917 {
12919 }
12920
12922 {
12924 }
12925
12926
12928 {
12930 }
12931
12933 {
12935 }
12936
12938 {
12940 }
12941
12942
12944 {
12945
12946 float weightEx = GetWeightEx();
12947 float special = GetInventoryAndCargoWeight();
12948 return weightEx - special;
12949 }
12950
12951
12953 {
12955 }
12956
12958 {
12960 {
12961 #ifdef DEVELOPER
12962 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12963 {
12964 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12966 }
12967 #endif
12968
12969 return GetQuantity() * GetConfigWeightModified();
12970 }
12971 else if (HasEnergyManager())
12972 {
12973 #ifdef DEVELOPER
12974 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12975 {
12976 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12977 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12978 }
12979 #endif
12980 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12981 }
12982 else
12983 {
12984 #ifdef DEVELOPER
12985 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12986 {
12987 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12988 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12989 }
12990 #endif
12991 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12992 }
12993 }
12994
12997 {
12998 int item_count = 0;
13000
13001 if (GetInventory().GetCargo() != NULL)
13002 {
13003 item_count = GetInventory().GetCargo().GetItemCount();
13004 }
13005
13006 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
13007 {
13008 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
13009 if (item)
13010 item_count += item.GetNumberOfItems();
13011 }
13012 return item_count;
13013 }
13014
13017 {
13018 float weight = 0;
13019 float wetness = 1;
13020 if (include_wetness)
13023 {
13024 weight = wetness * m_ConfigWeight;
13025 }
13027 {
13028 weight = 1;
13029 }
13030 return weight;
13031 }
13032
13033
13034
13036 {
13037 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
13038 {
13039 GameInventory inv = GetInventory();
13040 array<EntityAI> items = new array<EntityAI>;
13042 for (int i = 0; i < items.Count(); i++)
13043 {
13045 if (item)
13046 {
13048 }
13049 }
13050 }
13051 }
13052
13053
13054
13055
13057 {
13058 float energy = 0;
13059 if (HasEnergyManager())
13060 {
13061 energy = GetCompEM().GetEnergy();
13062 }
13063 return energy;
13064 }
13065
13066
13068 {
13069 super.OnEnergyConsumed();
13070
13072 }
13073
13075 {
13076 super.OnEnergyAdded();
13077
13079 }
13080
13081
13083 {
13084 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13085 {
13087 {
13088 float energy_0to1 = GetCompEM().GetEnergy0To1();
13090 }
13091 }
13092 }
13093
13094
13096 {
13097 return ConfigGetFloat("heatIsolation");
13098 }
13099
13101 {
13103 }
13104
13106 {
13107 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13108 if (
GetGame().ConfigIsExisting(paramPath))
13110
13111 return 0.0;
13112 }
13113
13115 {
13116 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13117 if (
GetGame().ConfigIsExisting(paramPath))
13119
13120 return 0.0;
13121 }
13122
13123 override void SetWet(
float value,
bool allow_client =
false)
13124 {
13125 if (!IsServerCheck(allow_client))
13126 return;
13127
13130
13132
13133 m_VarWet = Math.Clamp(value, min, max);
13134
13136 {
13139 }
13140 }
13141
13142 override void AddWet(
float value)
13143 {
13145 }
13146
13148 {
13150 }
13151
13153 {
13155 }
13156
13158 {
13160 }
13161
13163 {
13165 }
13166
13168 {
13170 }
13171
13172 override void OnWetChanged(
float newVal,
float oldVal)
13173 {
13176 if (newLevel != oldLevel)
13177 {
13179 }
13180 }
13181
13183 {
13184 SetWeightDirty();
13185 }
13186
13188 {
13189 return GetWetLevelInternal(
m_VarWet);
13190 }
13191
13192
13193
13195 {
13197 }
13198
13200 {
13202 }
13203
13205 {
13207 }
13208
13210 {
13212 }
13213
13214
13215
13217 {
13218 if (ConfigIsExisting("itemModelLength"))
13219 {
13220 return ConfigGetFloat("itemModelLength");
13221 }
13222 return 0;
13223 }
13224
13226 {
13227 if (ConfigIsExisting("itemAttachOffset"))
13228 {
13229 return ConfigGetFloat("itemAttachOffset");
13230 }
13231 return 0;
13232 }
13233
13234 override void SetCleanness(
int value,
bool allow_client =
false)
13235 {
13236 if (!IsServerCheck(allow_client))
13237 return;
13238
13240
13242
13245 }
13246
13248 {
13250 }
13251
13253 {
13254 return true;
13255 }
13256
13257
13258
13259
13261 {
13263 }
13264
13266 {
13268 }
13269
13270
13271
13272
13273 override void SetColor(
int r,
int g,
int b,
int a)
13274 {
13280 }
13282 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13283 {
13288 }
13289
13291 {
13293 }
13294
13297 {
13298 int r,g,b,a;
13300 r = r/255;
13301 g = g/255;
13302 b = b/255;
13303 a = a/255;
13304 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13305 }
13306
13307
13308
13309 override void SetLiquidType(
int value,
bool allow_client =
false)
13310 {
13311 if (!IsServerCheck(allow_client))
13312 return;
13313
13318 }
13319
13321 {
13322 return ConfigGetInt("varLiquidTypeInit");
13323 }
13324
13326 {
13328 }
13329
13331 {
13333 SetFrozen(false);
13334 }
13335
13338 {
13339 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13340 }
13341
13342
13345 {
13346 PlayerBase nplayer;
13347 if (PlayerBase.CastTo(nplayer, player))
13348 {
13350
13351 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13352 }
13353 }
13354
13355
13358 {
13359 PlayerBase nplayer;
13360 if (PlayerBase.CastTo(nplayer,player))
13361 {
13362
13363 nplayer.SetEnableQuickBarEntityShortcut(this,false);
13364
13365 }
13366
13367
13368 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13369
13370
13371 if (HasEnergyManager())
13372 {
13373 GetCompEM().UpdatePlugState();
13374 }
13375 }
13376
13377
13379 {
13380 super.OnPlacementStarted(player);
13381
13383 }
13384
13385 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13386 {
13388 {
13389 m_AdminLog.OnPlacementComplete(player,
this);
13390 }
13391
13392 super.OnPlacementComplete(player, position, orientation);
13393 }
13394
13395
13396
13397
13398
13400 {
13402 {
13403 return true;
13404 }
13405 else
13406 {
13407 return false;
13408 }
13409 }
13410
13411
13413 {
13415 {
13417 }
13418 }
13419
13420
13422 {
13424 }
13425
13427 {
13429 }
13430
13431 override void InsertAgent(
int agent,
float count = 1)
13432 {
13433 if (count < 1)
13434 return;
13435
13437 }
13438
13441 {
13443 }
13444
13445
13447 {
13449 }
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13493 {
13495 return false;
13496 return true;
13497 }
13498
13500 {
13501
13503 }
13504
13505
13508 {
13509 super.CheckForRoofLimited(timeTresholdMS);
13510
13512 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13513 {
13514 m_PreviousRoofTestTime = time;
13515 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13516 }
13517 }
13518
13519
13521 {
13523 {
13524 return 0;
13525 }
13526
13527 if (GetInventory().GetAttachmentSlotsCount() != 0)
13528 {
13529 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13530 if (filter)
13531 return filter.GetProtectionLevel(type, false, system);
13532 else
13533 return 0;
13534 }
13535
13536 string subclassPath, entryName;
13537
13538 switch (type)
13539 {
13541 entryName = "biological";
13542 break;
13544 entryName = "chemical";
13545 break;
13546 default:
13547 entryName = "biological";
13548 break;
13549 }
13550
13551 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13552
13554 }
13555
13556
13557
13560 {
13561 if (!IsMagazine())
13563
13565 }
13566
13567
13568
13569
13570
13575 {
13576 return true;
13577 }
13578
13580 {
13582 }
13583
13584
13585
13586
13587
13589 {
13590 if (parent)
13591 {
13592 if (parent.IsInherited(DayZInfected))
13593 return true;
13594
13595 if (!parent.IsRuined())
13596 return true;
13597 }
13598
13599 return true;
13600 }
13601
13603 {
13604 if (!super.CanPutAsAttachment(parent))
13605 {
13606 return false;
13607 }
13608
13609 if (!IsRuined() && !parent.IsRuined())
13610 {
13611 return true;
13612 }
13613
13614 return false;
13615 }
13616
13618 {
13619
13620
13621
13622
13623 return super.CanReceiveItemIntoCargo(item);
13624 }
13625
13627 {
13628
13629
13630
13631
13632 GameInventory attachmentInv = attachment.GetInventory();
13634 {
13635 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13636 return false;
13637 }
13638
13639 InventoryLocation loc = new InventoryLocation();
13640 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13641 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13642 return false;
13643
13644 return super.CanReceiveAttachment(attachment, slotId);
13645 }
13646
13648 {
13649 if (!super.CanReleaseAttachment(attachment))
13650 return false;
13651
13652 return GetInventory().AreChildrenAccessible();
13653 }
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13676 {
13677 int id = muzzle_owner.GetMuzzleID();
13678 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13679
13680 if (WPOF_array)
13681 {
13682 for (int i = 0; i < WPOF_array.Count(); i++)
13683 {
13684 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13685
13686 if (WPOF)
13687 {
13688 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13689 }
13690 }
13691 }
13692 }
13693
13694
13696 {
13697 int id = muzzle_owner.GetMuzzleID();
13699
13700 if (WPOBE_array)
13701 {
13702 for (int i = 0; i < WPOBE_array.Count(); i++)
13703 {
13704 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13705
13706 if (WPOBE)
13707 {
13708 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13709 }
13710 }
13711 }
13712 }
13713
13714
13716 {
13717 int id = muzzle_owner.GetMuzzleID();
13718 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13719
13720 if (WPOOH_array)
13721 {
13722 for (int i = 0; i < WPOOH_array.Count(); i++)
13723 {
13724 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13725
13726 if (WPOOH)
13727 {
13728 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13729 }
13730 }
13731 }
13732 }
13733
13734
13736 {
13737 int id = muzzle_owner.GetMuzzleID();
13738 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13739
13740 if (WPOOH_array)
13741 {
13742 for (int i = 0; i < WPOOH_array.Count(); i++)
13743 {
13744 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13745
13746 if (WPOOH)
13747 {
13748 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13749 }
13750 }
13751 }
13752 }
13753
13754
13756 {
13757 int id = muzzle_owner.GetMuzzleID();
13758 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13759
13760 if (WPOOH_array)
13761 {
13762 for (int i = 0; i < WPOOH_array.Count(); i++)
13763 {
13764 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13765
13766 if (WPOOH)
13767 {
13768 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13769 }
13770 }
13771 }
13772 }
13773
13774
13775
13777 {
13779 {
13780 return true;
13781 }
13782
13783 return false;
13784 }
13785
13787 {
13789 {
13790 return true;
13791 }
13792
13793 return false;
13794 }
13795
13797 {
13799 {
13800 return true;
13801 }
13802
13803 return false;
13804 }
13805
13807 {
13808 return false;
13809 }
13810
13813 {
13814 return UATimeSpent.DEFAULT_DEPLOY;
13815 }
13816
13817
13818
13819
13821 {
13823 SetSynchDirty();
13824 }
13825
13827 {
13829 }
13830
13831
13833 {
13834 return false;
13835 }
13836
13839 {
13840 string att_type = "None";
13841
13842 if (ConfigIsExisting("soundAttType"))
13843 {
13844 att_type = ConfigGetString("soundAttType");
13845 }
13846
13848 }
13849
13851 {
13853 }
13854
13855
13856
13857
13858
13864
13866 {
13869
13871 }
13872
13873
13875 {
13877 return;
13878
13880
13883
13886
13887 SoundParameters params = new SoundParameters();
13891 }
13892
13893
13895 {
13897 return;
13898
13900 SetSynchDirty();
13901
13904 }
13905
13906
13908 {
13910 return;
13911
13913 SetSynchDirty();
13914
13917 }
13918
13920 {
13922 }
13923
13925 {
13927 }
13928
13931 {
13932 if (!
GetGame().IsDedicatedServer())
13933 {
13934 if (ConfigIsExisting("attachSoundSet"))
13935 {
13936 string cfg_path = "";
13937 string soundset = "";
13938 string type_name =
GetType();
13939
13942 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13943 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13944
13945 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13946 {
13947 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13948 {
13949 if (cfg_slot_array[i] == slot_type)
13950 {
13951 soundset = cfg_soundset_array[i];
13952 break;
13953 }
13954 }
13955 }
13956
13957 if (soundset != "")
13958 {
13959 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13961 }
13962 }
13963 }
13964 }
13965
13967 {
13968
13969 }
13970
13971 void OnApply(PlayerBase player);
13972
13974 {
13975 return 1.0;
13976 };
13977
13979 {
13981 }
13982
13984 {
13986 }
13987
13989
13991 {
13992 SetDynamicPhysicsLifeTime(0.01);
13994 }
13995
13997 {
13998 array<string> zone_names = new array<string>;
13999 GetDamageZones(zone_names);
14000 for (int i = 0; i < zone_names.Count(); i++)
14001 {
14002 SetHealthMax(zone_names.Get(i),"Health");
14003 }
14004 SetHealthMax("","Health");
14005 }
14006
14009 {
14010 float global_health = GetHealth01("","Health");
14011 array<string> zones = new array<string>;
14012 GetDamageZones(zones);
14013
14014 for (int i = 0; i < zones.Count(); i++)
14015 {
14016 SetHealth01(zones.Get(i),"Health",global_health);
14017 }
14018 }
14019
14022 {
14023 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14024 }
14025
14027 {
14028 if (!hasRootAsPlayer)
14029 {
14030 if (refParentIB)
14031 {
14032
14033 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14034 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14035
14036 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14037 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14038
14041 }
14042 else
14043 {
14044
14047 }
14048 }
14049 }
14050
14052 {
14054 {
14055 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14056 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14057 {
14058 float heatPermCoef = 1.0;
14060 while (ent)
14061 {
14062 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14063 ent = ent.GetHierarchyParent();
14064 }
14065
14066 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14067 }
14068 }
14069 }
14070
14072 {
14073
14074 EntityAI parent = GetHierarchyParent();
14075 if (!parent)
14076 {
14077 hasParent = false;
14078 hasRootAsPlayer = false;
14079 }
14080 else
14081 {
14082 hasParent = true;
14083 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14084 refParentIB =
ItemBase.Cast(parent);
14085 }
14086 }
14087
14088 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14089 {
14090
14091 }
14092
14094 {
14095
14096 return false;
14097 }
14098
14100 {
14101
14102
14103 return false;
14104 }
14105
14107 {
14108
14109 return false;
14110 }
14111
14114 {
14115 return !GetIsFrozen() &&
IsOpen();
14116 }
14117
14119 {
14120 bool hasParent = false, hasRootAsPlayer = false;
14122
14123 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14124 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14125
14126 if (wwtu || foodDecay)
14127 {
14131
14132 if (processWetness || processTemperature || processDecay)
14133 {
14135
14136 if (processWetness)
14137 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14138
14139 if (processTemperature)
14141
14142 if (processDecay)
14143 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14144 }
14145 }
14146 }
14147
14150 {
14152 }
14153
14155 {
14158
14159 return super.GetTemperatureFreezeThreshold();
14160 }
14161
14163 {
14166
14167 return super.GetTemperatureThawThreshold();
14168 }
14169
14171 {
14174
14175 return super.GetItemOverheatThreshold();
14176 }
14177
14179 {
14181 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14182
14183 return super.GetTemperatureFreezeTime();
14184 }
14185
14187 {
14189 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14190
14191 return super.GetTemperatureThawTime();
14192 }
14193
14198
14200 {
14201 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14202 }
14203
14205 {
14206 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14207 }
14208
14211 {
14213 }
14214
14216 {
14218 }
14219
14221 {
14223 }
14224
14227 {
14228 return null;
14229 }
14230
14233 {
14234 return false;
14235 }
14236
14238 {
14240 {
14243 if (!trg)
14244 {
14246 explosive = this;
14247 }
14248
14249 explosive.PairRemote(trg);
14251
14252 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14253 trg.SetPersistentPairID(persistentID);
14254 explosive.SetPersistentPairID(persistentID);
14255
14256 return true;
14257 }
14258 return false;
14259 }
14260
14263 {
14264 float ret = 1.0;
14267 ret *= GetHealth01();
14268
14269 return ret;
14270 }
14271
14272 #ifdef DEVELOPER
14273 override void SetDebugItem()
14274 {
14275 super.SetDebugItem();
14276 _itemBase = this;
14277 }
14278
14280 {
14281 string text = super.GetDebugText();
14282
14284 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14285
14286 return text;
14287 }
14288 #endif
14289
14291 {
14292 return true;
14293 }
14294
14296
14298
14300 {
14303 }
14304
14305
14313
14329}
14330
14332{
14334 if (entity)
14335 {
14336 bool is_item = entity.IsInherited(
ItemBase);
14337 if (is_item && full_quantity)
14338 {
14341 }
14342 }
14343 else
14344 {
14346 return NULL;
14347 }
14348 return entity;
14349}
14350
14352{
14353 if (item)
14354 {
14355 if (health > 0)
14356 item.SetHealth("", "", health);
14357
14358 if (item.CanHaveTemperature())
14359 {
14361 if (item.CanFreeze())
14362 item.SetFrozen(false);
14363 }
14364
14365 if (item.HasEnergyManager())
14366 {
14367 if (quantity >= 0)
14368 {
14369 item.GetCompEM().SetEnergy0To1(quantity);
14370 }
14371 else
14372 {
14374 }
14375 }
14376 else if (item.IsMagazine())
14377 {
14378 Magazine mag = Magazine.Cast(item);
14379 if (quantity >= 0)
14380 {
14381 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14382 }
14383 else
14384 {
14386 }
14387
14388 }
14389 else
14390 {
14391 if (quantity >= 0)
14392 {
14393 item.SetQuantityNormalized(quantity, false);
14394 }
14395 else
14396 {
14398 }
14399
14400 }
14401 }
14402}
14403
14404#ifdef DEVELOPER
14406#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
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...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
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...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
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()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
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)
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()
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)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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)
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
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
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.