Adds a light source child.
9645{
9647 {
9648 return true;
9649 }
9650};
9651
9653{
9654
9655};
9656
9657
9658
9660{
9664
9666
9669
9670
9671
9672
9673
9682
9688
9693
9698
9719 protected bool m_IsResultOfSplit
9720
9722
9727
9728
9729
9731
9735
9736
9737
9739
9742
9743
9744
9750
9751
9759
9762
9763
9765
9766
9768
9769
9774
9775
9780
9782
9783
9785
9786
9788 {
9793
9794 if (!
g_Game.IsDedicatedServer())
9795 {
9797 {
9799
9801 {
9803 }
9804 }
9805
9808 }
9809
9810 m_OldLocation = null;
9811
9813 {
9815 }
9816
9817 if (ConfigIsExisting("headSelectionsToHide"))
9818 {
9821 }
9822
9824 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9825 {
9827 }
9828
9830
9831 m_IsResultOfSplit = false;
9832
9834 }
9835
9837 {
9838 super.InitItemVariables();
9839
9845 m_Count = ConfigGetInt(
"count");
9846
9849
9854
9857
9862
9874
9878
9879
9882 if (ConfigIsExisting("canBeSplit"))
9883 {
9886 }
9887
9889 if (ConfigIsExisting("itemBehaviour"))
9891
9892
9895 RegisterNetSyncVariableInt("m_VarLiquidType");
9896 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9897
9898 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9899 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9900 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9901
9902 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9903 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9904 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9905 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9906
9907 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9908 RegisterNetSyncVariableBool("m_IsTakeable");
9909 RegisterNetSyncVariableBool("m_IsHologram");
9910
9913 {
9916 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9917 }
9918
9920
9922 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9924
9926 }
9927
9929 {
9931 }
9932
9934 {
9937 {
9942 }
9943 }
9944
9945 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9946 {
9948 {
9951 }
9952
9954 }
9955
9957 {
9963 }
9964
9966
9968 {
9970
9971 if (!action)
9972 {
9973 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9974 return;
9975 }
9976
9978 if (!ai)
9979 {
9981 return;
9982 }
9983
9985 if (!action_array)
9986 {
9987 action_array = new array<ActionBase_Basic>;
9989 }
9990 if (LogManager.IsActionLogEnable())
9991 {
9992 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9993 }
9994
9995 if (action_array.Find(action) != -1)
9996 {
9997 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9998 }
9999 else
10000 {
10001 action_array.Insert(action);
10002 }
10003 }
10004
10006 {
10007 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10008 ActionBase action = player.GetActionManager().GetAction(actionName);
10011
10012 if (action_array)
10013 {
10014 action_array.RemoveItem(action);
10015 }
10016 }
10017
10018
10019
10021 {
10022 ActionOverrideData overrideData = new ActionOverrideData();
10026
10028 if (!actionMap)
10029 {
10032 }
10033
10034 actionMap.Insert(this.
Type(), overrideData);
10035
10036 }
10037
10039
10041
10042
10044 {
10047
10050
10051 string config_to_search = "CfgVehicles";
10052 string muzzle_owner_config;
10053
10055 {
10056 if (IsInherited(Weapon))
10057 config_to_search = "CfgWeapons";
10058
10059 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10060
10061 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10062
10063 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10064
10065 if (config_OnFire_subclass_count > 0)
10066 {
10067 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10068
10069 for (int i = 0; i < config_OnFire_subclass_count; i++)
10070 {
10071 string particle_class = "";
10072 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10073 string config_OnFire_entry = config_OnFire_class + particle_class;
10074 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10075 WPOF_array.Insert(WPOF);
10076 }
10077
10078
10080 }
10081 }
10082
10084 {
10085 config_to_search = "CfgWeapons";
10086 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10087
10088 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10089
10090 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10091
10092 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10093 {
10094 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10095
10096 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10097 {
10098 string particle_class2 = "";
10099 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10100 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10101 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10102 WPOBE_array.Insert(WPOBE);
10103 }
10104
10105
10107 }
10108 }
10109 }
10110
10111
10113 {
10116
10118 {
10119 string config_to_search = "CfgVehicles";
10120
10121 if (IsInherited(Weapon))
10122 config_to_search = "CfgWeapons";
10123
10124 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10125 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10126
10127 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10128 {
10129
10131
10133 {
10135 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10137 return;
10138 }
10139
10142
10143
10144
10145 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10146 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10147
10148 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10149 {
10150 string particle_class = "";
10151 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10152 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10153 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10154
10155 if (entry_type == CT_CLASS)
10156 {
10157 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10158 WPOOH_array.Insert(WPOF);
10159 }
10160 }
10161
10162
10164 }
10165 }
10166 }
10167
10169 {
10171 }
10172
10174 {
10176 {
10178
10181
10184
10185 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10186 }
10187 }
10188
10190 {
10192 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10193
10195 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10196
10198 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10199
10201 {
10203 }
10204 }
10205
10207 {
10209 }
10210
10212 {
10215 else
10217
10219 {
10222 }
10223 else
10224 {
10227
10230 }
10231
10233 }
10234
10236 {
10238 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10239 }
10240
10242 {
10244 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10246 }
10247
10249 {
10251 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10252 }
10253
10255 {
10258
10259 OverheatingParticle OP = new OverheatingParticle();
10264
10266 }
10267
10269 {
10272
10273 return -1;
10274 }
10275
10277 {
10279 {
10282
10283 for (int i = count; i > 0; --i)
10284 {
10285 int id = i - 1;
10288
10291
10292 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10293 {
10294 if (p)
10295 {
10298 }
10299 }
10300 }
10301 }
10302 }
10303
10305 {
10307 {
10309 {
10310 int id = i - 1;
10312
10313 if (OP)
10314 {
10316
10317 if (p)
10318 {
10320 }
10321
10322 delete OP;
10323 }
10324 }
10325
10328 }
10329 }
10330
10333 {
10334 return 0.0;
10335 }
10336
10337
10339 {
10340 return 250;
10341 }
10342
10344 {
10345 return 0;
10346 }
10347
10350 {
10352 return true;
10353
10354 return false;
10355 }
10356
10359 {
10362
10364 {
10366 }
10367 else
10368 {
10369
10371 }
10372
10374 }
10375
10382 {
10383 return -1;
10384 }
10385
10386
10387
10388
10390 {
10392 {
10393 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10394 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10395
10396 if (r_index >= 0)
10397 {
10398 InventoryLocation r_il = new InventoryLocation;
10399 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10400
10401 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10404 {
10405 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10406 }
10408 {
10409 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10410 }
10411
10412 }
10413
10414 player.GetHumanInventory().ClearUserReservedLocation(this);
10415 }
10416
10419 }
10420
10421
10422
10423
10425 {
10426 return ItemBase.m_DebugActionsMask;
10427 }
10428
10430 {
10431 return ItemBase.m_DebugActionsMask & mask;
10432 }
10433
10435 {
10436 ItemBase.m_DebugActionsMask = mask;
10437 }
10438
10440 {
10441 ItemBase.m_DebugActionsMask |= mask;
10442 }
10443
10445 {
10446 ItemBase.m_DebugActionsMask &= ~mask;
10447 }
10448
10450 {
10452 {
10454 }
10455 else
10456 {
10458 }
10459 }
10460
10461
10463 {
10464 if (GetEconomyProfile())
10465 {
10466 float q_max = GetEconomyProfile().GetQuantityMax();
10467 if (q_max > 0)
10468 {
10469 float q_min = GetEconomyProfile().GetQuantityMin();
10470 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10471
10473 {
10474 ComponentEnergyManager comp = GetCompEM();
10476 {
10478 }
10479 }
10481 {
10483
10484 }
10485
10486 }
10487 }
10488 }
10489
10492 {
10493 EntityAI parent = GetHierarchyParent();
10494
10495 if (parent)
10496 {
10497 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10498 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10499 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10500 }
10501 }
10502
10505 {
10506 EntityAI parent = GetHierarchyParent();
10507
10508 if (parent)
10509 {
10510 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10511 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10512 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10513 }
10514 }
10515
10517 {
10518
10519
10520
10521
10523
10525 {
10526 if (ScriptInputUserData.CanStoreInputUserData())
10527 {
10528 ScriptInputUserData ctx = new ScriptInputUserData;
10534 ctx.
Write(use_stack_max);
10537
10539 {
10540 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10541 }
10542 }
10543 }
10544 else if (!
g_Game.IsMultiplayer())
10545 {
10547 }
10548 }
10549
10551 {
10553 }
10554
10556 {
10558 }
10559
10561 {
10563 }
10564
10566 {
10567
10568 return false;
10569 }
10570
10572 {
10573 return false;
10574 }
10575
10579 {
10580 return false;
10581 }
10582
10584 {
10585 return "";
10586 }
10587
10589
10591 {
10592 return false;
10593 }
10594
10596 {
10597 return true;
10598 }
10599
10600
10601
10603 {
10604 return true;
10605 }
10606
10608 {
10609 return true;
10610 }
10611
10613 {
10614 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10616 }
10617
10619 {
10621 }
10622
10624 {
10626 if (!is_being_placed)
10628 SetSynchDirty();
10629 }
10630
10631
10633
10635 {
10637 }
10638
10640 {
10642 }
10643
10645 {
10646 return 1;
10647 }
10648
10650 {
10651 return false;
10652 }
10653
10655 {
10657 SetSynchDirty();
10658 }
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10695 {
10696 super.OnMovedInsideCargo(container);
10697
10698 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10699 }
10700
10701 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10702 {
10703 super.EEItemLocationChanged(oldLoc, newLoc);
10704
10705 PlayerBase newPlayer = null;
10706 PlayerBase oldPlayer = null;
10707
10708 if (newLoc.GetParent())
10709 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10710
10711 if (oldLoc.GetParent())
10712 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10713
10715 {
10716 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10717
10718 if (rIndex >= 0)
10719 {
10720 InventoryLocation rIl = new InventoryLocation;
10721 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10722
10723 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10726 {
10727 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10728 }
10730 {
10732 }
10733
10734 }
10735 }
10736
10738 {
10739 if (newPlayer)
10740 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10741
10742 if (newPlayer == oldPlayer)
10743 {
10744 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10745 {
10747 {
10748 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10749 {
10750 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10751 }
10752 }
10753 else
10754 {
10755 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10756 }
10757 }
10758
10759 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10760 {
10761 int type = oldLoc.GetType();
10763 {
10764 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10765 }
10767 {
10768 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10769 }
10770 }
10771 if (!m_OldLocation)
10772 {
10773 m_OldLocation = new InventoryLocation;
10774 }
10775 m_OldLocation.Copy(oldLoc);
10776 }
10777 else
10778 {
10779 if (m_OldLocation)
10780 {
10781 m_OldLocation.Reset();
10782 }
10783 }
10784
10785 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10786 }
10787 else
10788 {
10789 if (newPlayer)
10790 {
10791 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10792 if (resIndex >= 0)
10793 {
10794 InventoryLocation il = new InventoryLocation;
10795 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10797 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10800 {
10801 il.
GetParent().GetOnReleaseLock().Invoke(it);
10802 }
10804 {
10806 }
10807
10808 }
10809 }
10811 {
10812
10814 }
10815
10816 if (m_OldLocation)
10817 {
10818 m_OldLocation.Reset();
10819 }
10820 }
10821
10823 {
10824 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10825 }
10826
10828 {
10829 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10830 }
10831 }
10832
10833 override void EOnContact(IEntity other, Contact extra)
10834 {
10836 {
10837 int liquidType = -1;
10839 if (impactSpeed > 0.0)
10840 {
10842 #ifndef SERVER
10844 #else
10846 SetSynchDirty();
10847 #endif
10849 }
10850 }
10851
10852 #ifdef SERVER
10853 if (GetCompEM() && GetCompEM().IsPlugged())
10854 {
10855 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10856 GetCompEM().UnplugThis();
10857 }
10858 #endif
10859 }
10860
10862
10864 {
10866 }
10867
10869 {
10870
10871 }
10872
10874 {
10875 super.OnItemLocationChanged(old_owner, new_owner);
10876
10877 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10878 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10879
10880 if (!relatedPlayer && playerNew)
10881 relatedPlayer = playerNew;
10882
10883 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10884 {
10886 if (actionMgr)
10887 {
10888 ActionBase currentAction = actionMgr.GetRunningAction();
10889 if (currentAction)
10891 }
10892 }
10893
10894 Man ownerPlayerOld = null;
10895 Man ownerPlayerNew = null;
10896
10897 if (old_owner)
10898 {
10899 if (old_owner.
IsMan())
10900 {
10901 ownerPlayerOld = Man.Cast(old_owner);
10902 }
10903 else
10904 {
10905 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10906 }
10907 }
10908 else
10909 {
10911 {
10913
10914 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10915 {
10916 GetCompEM().UnplugThis();
10917 }
10918 }
10919 }
10920
10921 if (new_owner)
10922 {
10923 if (new_owner.
IsMan())
10924 {
10925 ownerPlayerNew = Man.Cast(new_owner);
10926 }
10927 else
10928 {
10929 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10930 }
10931 }
10932
10933 if (ownerPlayerOld != ownerPlayerNew)
10934 {
10935 if (ownerPlayerOld)
10936 {
10937 array<EntityAI> subItemsExit = new array<EntityAI>;
10939 for (int i = 0; i < subItemsExit.Count(); i++)
10940 {
10943 }
10944 }
10945
10946 if (ownerPlayerNew)
10947 {
10948 array<EntityAI> subItemsEnter = new array<EntityAI>;
10950 for (int j = 0; j < subItemsEnter.Count(); j++)
10951 {
10954 }
10955 }
10956 }
10957 else if (ownerPlayerNew != null)
10958 {
10959 PlayerBase nplayer;
10960 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10961 {
10962 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10964 for (int k = 0; k < subItemsUpdate.Count(); k++)
10965 {
10967 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10968 }
10969 }
10970 }
10971
10972 if (old_owner)
10973 old_owner.OnChildItemRemoved(this);
10974 if (new_owner)
10975 new_owner.OnChildItemReceived(this);
10976 }
10977
10978
10980 {
10981 super.EEDelete(parent);
10982 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10983 if (player)
10984 {
10986
10987 if (player.IsAlive())
10988 {
10989 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10990 if (r_index >= 0)
10991 {
10992 InventoryLocation r_il = new InventoryLocation;
10993 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10994
10995 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10998 {
10999 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11000 }
11002 {
11003 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11004 }
11005
11006 }
11007
11008 player.RemoveQuickBarEntityShortcut(this);
11009 }
11010 }
11011 }
11012
11014 {
11015 super.EEKilled(killer);
11016
11019 {
11020 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11021 {
11022 if (IsMagazine())
11023 {
11024 if (Magazine.Cast(this).GetAmmoCount() > 0)
11025 {
11027 }
11028 }
11029 else
11030 {
11032 }
11033 }
11034 }
11035 }
11036
11038 {
11039 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11040
11041 super.OnWasAttached(parent, slot_id);
11042
11045
11048 }
11049
11051 {
11052 super.OnWasDetached(parent, slot_id);
11053
11056
11059 }
11060
11062 {
11063 int idx;
11066
11067 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11068 if (inventory_slots.Count() < 1)
11069 {
11070 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11071 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11072 }
11073 else
11074 {
11075 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11076 }
11077
11078 idx = inventory_slots.Find(slot);
11079 if (idx < 0)
11080 return "";
11081
11082 return attach_types.Get(idx);
11083 }
11084
11086 {
11087 int idx = -1;
11088 string slot;
11089
11092
11093 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11094 if (inventory_slots.Count() < 1)
11095 {
11096 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11097 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11098 }
11099 else
11100 {
11101 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11102 if (detach_types.Count() < 1)
11103 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11104 }
11105
11106 for (int i = 0; i < inventory_slots.Count(); i++)
11107 {
11108 slot = inventory_slots.Get(i);
11109 }
11110
11111 if (slot != "")
11112 {
11113 if (detach_types.Count() == 1)
11114 idx = 0;
11115 else
11116 idx = inventory_slots.Find(slot);
11117 }
11118 if (idx < 0)
11119 return "";
11120
11121 return detach_types.Get(idx);
11122 }
11123
11125 {
11126
11128
11129
11130 float min_time = 1;
11131 float max_time = 3;
11132 float delay = Math.RandomFloat(min_time, max_time);
11133
11134 explode_timer.Run(delay, this, "DoAmmoExplosion");
11135 }
11136
11138 {
11139 Magazine magazine = Magazine.Cast(this);
11140 int pop_sounds_count = 6;
11141 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11142
11143
11144 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11145 string sound_name = pop_sounds[ sound_idx ];
11146 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11147
11148
11149 magazine.ServerAddAmmoCount(-1);
11150
11151
11152 float min_temp_to_explode = 100;
11153
11154 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11155 {
11157 }
11158 }
11159
11160
11161 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11162 {
11163 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11164
11165 const int CHANCE_DAMAGE_CARGO = 4;
11166 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11167 const int CHANCE_DAMAGE_NOTHING = 2;
11168
11170 {
11171 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11172 int chances;
11173 int rnd;
11174
11175 if (GetInventory().GetCargo())
11176 {
11177 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11178 rnd = Math.RandomInt(0,chances);
11179
11180 if (rnd < CHANCE_DAMAGE_CARGO)
11181 {
11183 }
11184 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11185 {
11187 }
11188 }
11189 else
11190 {
11191 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11192 rnd = Math.RandomInt(0,chances);
11193
11194 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11195 {
11197 }
11198 }
11199 }
11200 }
11201
11203 {
11204 CargoBase cargo = GetInventory().GetCargo();
11205 if (cargo)
11206 {
11208 if (item_count > 0)
11209 {
11210 int random_pick = Math.RandomInt(0, item_count);
11212 if (!item.IsExplosive())
11213 {
11214 item.AddHealth("","",damage);
11215 return true;
11216 }
11217 }
11218 }
11219 return false;
11220 }
11221
11223 {
11224 GameInventory inventory = GetInventory();
11226 if (attachment_count > 0)
11227 {
11228 int random_pick = Math.RandomInt(0, attachment_count);
11230 if (!attachment.IsExplosive())
11231 {
11232 attachment.AddHealth("","",damage);
11233 return true;
11234 }
11235 }
11236 return false;
11237 }
11238
11240 {
11242 }
11243
11245 {
11247 return GetInventory().CanRemoveEntity();
11248
11249 return false;
11250 }
11251
11253 {
11254
11256 return false;
11257
11258
11260 return false;
11261
11262
11263
11265 if (delta == 0)
11266 return false;
11267
11268
11269 return true;
11270 }
11271
11273 {
11275 {
11276 if (ScriptInputUserData.CanStoreInputUserData())
11277 {
11278 ScriptInputUserData ctx = new ScriptInputUserData;
11283 ctx.
Write(destination_entity);
11285 ctx.
Write(slot_id);
11287 }
11288 }
11289 else if (!
g_Game.IsMultiplayer())
11290 {
11292 }
11293 }
11294
11296 {
11297 float split_quantity_new;
11301 InventoryLocation loc = new InventoryLocation;
11302
11303 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11304 {
11306 split_quantity_new = stack_max;
11307 else
11309
11311 {
11312 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11313 if (new_item)
11314 {
11315 new_item.SetResultOfSplit(true);
11316 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11318 new_item.
SetQuantity(split_quantity_new,
false,
true);
11319 }
11320 }
11321 }
11322 else if (destination_entity && slot_id == -1)
11323 {
11324 if (quantity > stack_max)
11325 split_quantity_new = stack_max;
11326 else
11327 split_quantity_new = quantity;
11328
11330 {
11331 GameInventory destinationInventory = destination_entity.GetInventory();
11333 {
11336 }
11337
11338 if (new_item)
11339 {
11340 new_item.SetResultOfSplit(true);
11341 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11343 new_item.
SetQuantity(split_quantity_new,
false,
true);
11344 }
11345 }
11346 }
11347 else
11348 {
11349 if (stack_max != 0)
11350 {
11352 {
11354 }
11355
11356 if (split_quantity_new == 0)
11357 {
11358 if (!
g_Game.IsMultiplayer())
11359 player.PhysicalPredictiveDropItem(this);
11360 else
11361 player.ServerDropEntity(this);
11362 return;
11363 }
11364
11366 {
11368
11369 if (new_item)
11370 {
11371 new_item.SetResultOfSplit(true);
11372 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11375 new_item.PlaceOnSurface();
11376 }
11377 }
11378 }
11379 }
11380 }
11381
11383 {
11384 float split_quantity_new;
11388 InventoryLocation loc = new InventoryLocation;
11389
11390 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11391 {
11393 split_quantity_new = stack_max;
11394 else
11396
11398 {
11399 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11400 if (new_item)
11401 {
11402 new_item.SetResultOfSplit(true);
11403 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11405 new_item.
SetQuantity(split_quantity_new,
false,
true);
11406 }
11407 }
11408 }
11409 else if (destination_entity && slot_id == -1)
11410 {
11411 if (quantity > stack_max)
11412 split_quantity_new = stack_max;
11413 else
11414 split_quantity_new = quantity;
11415
11417 {
11418 GameInventory destinationInventory = destination_entity.GetInventory();
11420 {
11423 }
11424
11425 if (new_item)
11426 {
11427 new_item.SetResultOfSplit(true);
11428 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11430 new_item.
SetQuantity(split_quantity_new,
false,
true);
11431 }
11432 }
11433 }
11434 else
11435 {
11436 if (stack_max != 0)
11437 {
11439 {
11441 }
11442
11444 {
11446
11447 if (new_item)
11448 {
11449 new_item.SetResultOfSplit(true);
11450 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11453 new_item.PlaceOnSurface();
11454 }
11455 }
11456 }
11457 }
11458 }
11459
11461 {
11463 {
11464 if (ScriptInputUserData.CanStoreInputUserData())
11465 {
11466 ScriptInputUserData ctx = new ScriptInputUserData;
11471 dst.WriteToContext(ctx);
11473 }
11474 }
11475 else if (!
g_Game.IsMultiplayer())
11476 {
11478 }
11479 }
11480
11482 {
11484 {
11485 if (ScriptInputUserData.CanStoreInputUserData())
11486 {
11487 ScriptInputUserData ctx = new ScriptInputUserData;
11492 ctx.
Write(destination_entity);
11498 }
11499 }
11500 else if (!
g_Game.IsMultiplayer())
11501 {
11503 }
11504 }
11505
11507 {
11509 }
11510
11512 {
11514 float split_quantity_new;
11516 if (dst.IsValid())
11517 {
11518 int slot_id = dst.GetSlot();
11520
11521 if (quantity > stack_max)
11522 split_quantity_new = stack_max;
11523 else
11524 split_quantity_new = quantity;
11525
11527 {
11529
11530 if (new_item)
11531 {
11532 new_item.SetResultOfSplit(true);
11533 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11535 new_item.
SetQuantity(split_quantity_new,
false,
true);
11536 }
11537
11538 return new_item;
11539 }
11540 }
11541
11542 return null;
11543 }
11544
11546 {
11548 float split_quantity_new;
11550 if (destination_entity)
11551 {
11553 if (quantity > stackable)
11554 split_quantity_new = stackable;
11555 else
11556 split_quantity_new = quantity;
11557
11559 {
11560 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11561 if (new_item)
11562 {
11563 new_item.SetResultOfSplit(true);
11564 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11566 new_item.
SetQuantity(split_quantity_new,
false,
true);
11567 }
11568 }
11569 }
11570 }
11571
11573 {
11575 {
11576 if (ScriptInputUserData.CanStoreInputUserData())
11577 {
11578 ScriptInputUserData ctx = new ScriptInputUserData;
11583 ItemBase destination_entity =
this;
11584 ctx.
Write(destination_entity);
11588 }
11589 }
11590 else if (!
g_Game.IsMultiplayer())
11591 {
11593 }
11594 }
11595
11597 {
11599 float split_quantity_new;
11601 if (player)
11602 {
11604 if (quantity > stackable)
11605 split_quantity_new = stackable;
11606 else
11607 split_quantity_new = quantity;
11608
11610 {
11611 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11612 new_item =
ItemBase.Cast(in_hands);
11613 if (new_item)
11614 {
11615 new_item.SetResultOfSplit(true);
11616 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11618 new_item.SetQuantity(split_quantity_new, false, true);
11619 }
11620 }
11621 }
11622 }
11623
11625 {
11627 float split_quantity_new = Math.Floor(quantity * 0.5);
11628
11630 return;
11631
11633
11634 if (new_item)
11635 {
11636 if (new_item.GetQuantityMax() < split_quantity_new)
11637 {
11638 split_quantity_new = new_item.GetQuantityMax();
11639 }
11640
11641 new_item.SetResultOfSplit(true);
11642 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11643
11645 {
11648 }
11649 else
11650 {
11652 new_item.
SetQuantity(split_quantity_new,
false,
true);
11653 }
11654 }
11655 }
11656
11658 {
11660 float split_quantity_new = Math.Floor(quantity / 2);
11661
11663 return;
11664
11665 InventoryLocation invloc = new InventoryLocation;
11667
11669 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11670
11671 if (new_item)
11672 {
11673 if (new_item.GetQuantityMax() < split_quantity_new)
11674 {
11675 split_quantity_new = new_item.GetQuantityMax();
11676 }
11678 {
11681 }
11682 else if (split_quantity_new > 1)
11683 {
11685 new_item.
SetQuantity(split_quantity_new,
false,
true);
11686 }
11687 }
11688 }
11689
11692 {
11693 SetWeightDirty();
11695
11696 if (parent)
11697 parent.OnAttachmentQuantityChangedEx(this, delta);
11698
11700 {
11702 {
11704 }
11706 {
11707 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11709 }
11710 }
11711 }
11712
11715 {
11716
11717 }
11718
11721 {
11723 }
11724
11726 {
11727 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11728
11730 {
11731 if (newLevel == GameConstants.STATE_RUINED)
11732 {
11734 EntityAI parent = GetHierarchyParent();
11735 if (parent && parent.IsFireplace())
11736 {
11737 CargoBase cargo = GetInventory().GetCargo();
11738 if (cargo)
11739 {
11741 {
11743 }
11744 }
11745 }
11746 }
11747
11749 {
11750
11752 return;
11753 }
11754
11755 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11756 {
11758 }
11759 }
11760 }
11761
11762
11764 {
11765 super.OnRightClick();
11766
11768 {
11770 {
11771 if (ScriptInputUserData.CanStoreInputUserData())
11772 {
11773 EntityAI root = GetHierarchyRoot();
11774 Man playerOwner = GetHierarchyRootPlayer();
11775 InventoryLocation dst = new InventoryLocation;
11776
11777
11778 if (!playerOwner && root && root == this)
11779 {
11781 }
11782 else
11783 {
11784
11785 GetInventory().GetCurrentInventoryLocation(dst);
11787 {
11788 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11790 {
11792 }
11793 else
11794 {
11796
11797
11798 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11799 {
11801 }
11802 else
11803 {
11804 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11805 }
11806 }
11807 }
11808 }
11809
11810 ScriptInputUserData ctx = new ScriptInputUserData;
11818 }
11819 }
11820 else if (!
g_Game.IsMultiplayer())
11821 {
11823 }
11824 }
11825 }
11826
11828 {
11829 if (root)
11830 {
11831 vector m4[4];
11832 root.GetTransform(m4);
11833 dst.SetGround(this, m4);
11834 }
11835 else
11836 {
11837 GetInventory().GetCurrentInventoryLocation(dst);
11838 }
11839 }
11840
11841 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11842 {
11843
11844 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11845 return false;
11846
11847 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11848 return false;
11849
11850
11852 return false;
11853
11854
11855 Magazine mag = Magazine.Cast(this);
11856 if (mag)
11857 {
11858 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11859 return false;
11860
11861 if (stack_max_limit)
11862 {
11863 Magazine other_mag = Magazine.Cast(other_item);
11864 if (other_item)
11865 {
11866 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11867 return false;
11868 }
11869
11870 }
11871 }
11872 else
11873 {
11874
11876 return false;
11877
11879 return false;
11880 }
11881
11882 PlayerBase player = null;
11883 if (CastTo(player, GetHierarchyRootPlayer()))
11884 {
11885 if (player.GetInventory().HasAttachment(this))
11886 return false;
11887
11888 if (player.IsItemsToDelete())
11889 return false;
11890 }
11891
11892 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11893 return false;
11894
11895 int slotID;
11897 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11898 return false;
11899
11900 return true;
11901 }
11902
11904 {
11906 }
11907
11909 {
11910 return m_IsResultOfSplit;
11911 }
11912
11914 {
11915 m_IsResultOfSplit = value;
11916 }
11917
11919 {
11921 }
11922
11924 {
11925 float other_item_quantity = other_item.GetQuantity();
11926 float this_free_space;
11927
11929
11931
11932 if (other_item_quantity > this_free_space)
11933 {
11934 return this_free_space;
11935 }
11936 else
11937 {
11938 return other_item_quantity;
11939 }
11940 }
11941
11943 {
11945 }
11946
11948 {
11950 return;
11951
11952 if (!IsMagazine() && other_item)
11953 {
11955 if (quantity_used != 0)
11956 {
11957 float hp1 = GetHealth01("","");
11958 float hp2 = other_item.GetHealth01("","");
11959 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11960 hpResult = hpResult / (
GetQuantity() + quantity_used);
11961
11962 hpResult *= GetMaxHealth();
11963 Math.Round(hpResult);
11964 SetHealth("", "Health", hpResult);
11965
11967 other_item.AddQuantity(-quantity_used);
11968 }
11969 }
11971 }
11972
11974 {
11975 #ifdef SERVER
11976 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11977 GetHierarchyParent().IncreaseLifetimeUp();
11978 #endif
11979 };
11980
11982 {
11983 PlayerBase p = PlayerBase.Cast(player);
11984
11985 array<int> recipesIds = p.m_Recipes;
11986 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11987 if (moduleRecipesManager)
11988 {
11989 EntityAI itemInHands = player.GetEntityInHands();
11990 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11991 }
11992
11993 for (int i = 0;i < recipesIds.Count(); i++)
11994 {
11995 int key = recipesIds.Get(i);
11996 string recipeName = moduleRecipesManager.GetRecipeName(key);
11998 }
11999 }
12000
12001
12002 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12003 {
12004 super.GetDebugActions(outputList);
12005
12006
12012
12013
12018
12023
12024
12028
12029
12031 {
12035 }
12036
12039
12040
12044
12046
12047 InventoryLocation loc = new InventoryLocation();
12048 GetInventory().GetCurrentInventoryLocation(loc);
12050 {
12051 if (Gizmo_IsSupported())
12054 }
12055
12057 }
12058
12059
12060
12061
12063 {
12064 super.OnAction(action_id, player, ctx);
12065
12067 {
12068 switch (action_id)
12069 {
12073 return true;
12077 return true;
12078 }
12079 }
12080
12082 {
12083 switch (action_id)
12084 {
12086 Delete();
12087 return true;
12088 }
12089 }
12090
12091 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12092 {
12093 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12094 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12095 PlayerBase p = PlayerBase.Cast(player);
12096 if (
EActions.RECIPES_RANGE_START < 1000)
12097 {
12098 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12099 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12100 }
12101 }
12102 #ifndef SERVER
12103 else if (action_id ==
EActions.WATCH_PLAYER)
12104 {
12105 PluginDeveloper.SetDeveloperItemClientEx(player);
12106 }
12107 #endif
12109 {
12110 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12111 {
12112 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12113 OnDebugButtonPressServer(id + 1);
12114 }
12115
12116 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12117 {
12118 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12120 }
12121
12122 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12123 {
12124 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12126 }
12127
12128 else if (action_id ==
EActions.ADD_QUANTITY)
12129 {
12130 if (IsMagazine())
12131 {
12132 Magazine mag = Magazine.Cast(this);
12133 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12134 }
12135 else
12136 {
12138 }
12139
12140 if (m_EM)
12141 {
12142 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12143 }
12144
12145 }
12146
12147 else if (action_id ==
EActions.REMOVE_QUANTITY)
12148 {
12149 if (IsMagazine())
12150 {
12151 Magazine mag2 = Magazine.Cast(this);
12152 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12153 }
12154 else
12155 {
12157 }
12158 if (m_EM)
12159 {
12160 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12161 }
12162
12163 }
12164
12165 else if (action_id ==
EActions.SET_QUANTITY_0)
12166 {
12168
12169 if (m_EM)
12170 {
12171 m_EM.SetEnergy(0);
12172 }
12173 }
12174
12175 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12176 {
12178
12179 if (m_EM)
12180 {
12181 m_EM.SetEnergy(m_EM.GetEnergyMax());
12182 }
12183 }
12184
12185 else if (action_id ==
EActions.ADD_HEALTH)
12186 {
12187 AddHealth("","",GetMaxHealth("","Health")/5);
12188 }
12189 else if (action_id ==
EActions.REMOVE_HEALTH)
12190 {
12191 AddHealth("","",-GetMaxHealth("","Health")/5);
12192 }
12193 else if (action_id ==
EActions.DESTROY_HEALTH)
12194 {
12195 SetHealth01("","",0);
12196 }
12197 else if (action_id ==
EActions.WATCH_ITEM)
12198 {
12200 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12201 #ifdef DEVELOPER
12202 SetDebugDeveloper_item(this);
12203 #endif
12204 }
12205
12206 else if (action_id ==
EActions.ADD_TEMPERATURE)
12207 {
12208 AddTemperature(20);
12209
12210 }
12211
12212 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12213 {
12214 AddTemperature(-20);
12215
12216 }
12217
12218 else if (action_id ==
EActions.FLIP_FROZEN)
12219 {
12220 SetFrozen(!GetIsFrozen());
12221
12222 }
12223
12224 else if (action_id ==
EActions.ADD_WETNESS)
12225 {
12227
12228 }
12229
12230 else if (action_id ==
EActions.REMOVE_WETNESS)
12231 {
12233
12234 }
12235
12236 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12237 {
12240
12241
12242 }
12243
12244 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12245 {
12248 }
12249
12250 else if (action_id ==
EActions.MAKE_SPECIAL)
12251 {
12252 auto debugParams = DebugSpawnParams.WithPlayer(player);
12253 OnDebugSpawnEx(debugParams);
12254 }
12255
12256 }
12257
12258
12259 return false;
12260 }
12261
12262
12263
12264
12268
12271
12272
12273
12275 {
12276 return false;
12277 }
12278
12279
12281 {
12282 return true;
12283 }
12284
12285
12287 {
12288 return true;
12289 }
12290
12291
12292
12294 {
12295 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12296 return g_Game.ConfigIsExisting(config_path);
12297 }
12298
12301 {
12302 return null;
12303 }
12304
12306 {
12307 return false;
12308 }
12309
12311 {
12312 return false;
12313 }
12314
12318
12319
12321 {
12322 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12323 return module_repairing.CanRepair(this, item_repair_kit);
12324 }
12325
12326
12327 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12328 {
12329 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12330 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12331 }
12332
12333
12335 {
12336
12337
12338
12339
12340
12341
12342
12343
12344 return 1;
12345 }
12346
12347
12348
12350 {
12352 }
12353
12354
12355
12357 {
12359 }
12360
12361
12370 {
12371 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12372
12373 if (player)
12374 {
12375 player.MessageStatus(text);
12376 }
12377 }
12378
12379
12388 {
12389 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12390
12391 if (player)
12392 {
12393 player.MessageAction(text);
12394 }
12395 }
12396
12397
12406 {
12407 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12408
12409 if (player)
12410 {
12411 player.MessageFriendly(text);
12412 }
12413 }
12414
12415
12424 {
12425 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12426
12427 if (player)
12428 {
12429 player.MessageImportant(text);
12430 }
12431 }
12432
12434 {
12435 return true;
12436 }
12437
12438
12439 override bool KindOf(
string tag)
12440 {
12441 bool found = false;
12442 string item_name = this.
GetType();
12444 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12445
12446 int array_size = item_tag_array.Count();
12447 for (int i = 0; i < array_size; i++)
12448 {
12449 if (item_tag_array.Get(i) == tag)
12450 {
12451 found = true;
12452 break;
12453 }
12454 }
12455 return found;
12456 }
12457
12458
12460 {
12461
12462 super.OnRPC(sender, rpc_type,ctx);
12463
12464
12465 switch (rpc_type)
12466 {
12467 #ifndef SERVER
12468 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12469 Param2<bool, string> p = new Param2<bool, string>(false, "");
12470
12472 return;
12473
12474 bool play = p.param1;
12475 string soundSet = p.param2;
12476
12477 if (play)
12478 {
12480 {
12482 {
12484 }
12485 }
12486 else
12487 {
12489 }
12490 }
12491 else
12492 {
12494 }
12495
12496 break;
12497 #endif
12498
12499 }
12500
12502 {
12504 }
12505 }
12506
12507
12508
12509
12511 {
12512 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12513 return plugin.GetID(
name);
12514 }
12515
12517 {
12518 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12519 return plugin.GetName(id);
12520 }
12521
12524 {
12525
12526
12527 int varFlags;
12528 if (!ctx.
Read(varFlags))
12529 return;
12530
12531 if (varFlags & ItemVariableFlags.FLOAT)
12532 {
12534 }
12535 }
12536
12538 {
12539
12540 super.SerializeNumericalVars(floats_out);
12541
12542
12543
12545 {
12547 }
12548
12550 {
12552 }
12553
12555 {
12557 }
12558
12560 {
12565 }
12566
12568 {
12570 }
12571 }
12572
12574 {
12575
12576 super.DeSerializeNumericalVars(floats);
12577
12578
12579 int index = 0;
12580 int mask = Math.Round(floats.Get(index));
12581
12582 index++;
12583
12585 {
12587 {
12589 }
12590 else
12591 {
12592 float quantity = floats.Get(index);
12593 SetQuantity(quantity,
true,
false,
false,
false);
12594 }
12595 index++;
12596 }
12597
12599 {
12600 float wet = floats.Get(index);
12602 index++;
12603 }
12604
12606 {
12607 int liquidtype = Math.Round(floats.Get(index));
12609 index++;
12610 }
12611
12613 {
12615 index++;
12617 index++;
12619 index++;
12621 index++;
12622 }
12623
12625 {
12626 int cleanness = Math.Round(floats.Get(index));
12628 index++;
12629 }
12630 }
12631
12633 {
12634 super.WriteVarsToCTX(ctx);
12635
12636
12638 {
12640 }
12641
12643 {
12645 }
12646
12648 {
12650 }
12651
12653 {
12654 int r,g,b,a;
12660 }
12661
12663 {
12665 }
12666 }
12667
12669 {
12670 if (!super.ReadVarsFromCTX(ctx,version))
12671 return false;
12672
12673 int intValue;
12674 float value;
12675
12676 if (version < 140)
12677 {
12678 if (!ctx.
Read(intValue))
12679 return false;
12680
12681 m_VariablesMask = intValue;
12682 }
12683
12685 {
12686 if (!ctx.
Read(value))
12687 return false;
12688
12690 {
12692 }
12693 else
12694 {
12696 }
12697 }
12698
12699 if (version < 140)
12700 {
12702 {
12703 if (!ctx.
Read(value))
12704 return false;
12705 SetTemperatureDirect(value);
12706 }
12707 }
12708
12710 {
12711 if (!ctx.
Read(value))
12712 return false;
12714 }
12715
12717 {
12718 if (!ctx.
Read(intValue))
12719 return false;
12721 }
12722
12724 {
12725 int r,g,b,a;
12727 return false;
12729 return false;
12731 return false;
12733 return false;
12734
12736 }
12737
12739 {
12740 if (!ctx.
Read(intValue))
12741 return false;
12743 }
12744
12745 if (version >= 138 && version < 140)
12746 {
12748 {
12749 if (!ctx.
Read(intValue))
12750 return false;
12751 SetFrozen(intValue);
12752 }
12753 }
12754
12755 return true;
12756 }
12757
12758
12760 {
12763 {
12765 }
12766
12767 if (!super.OnStoreLoad(ctx, version))
12768 {
12770 return false;
12771 }
12772
12773 if (version >= 114)
12774 {
12775 bool hasQuickBarIndexSaved;
12776
12777 if (!ctx.
Read(hasQuickBarIndexSaved))
12778 {
12780 return false;
12781 }
12782
12783 if (hasQuickBarIndexSaved)
12784 {
12785 int itmQBIndex;
12786
12787
12788 if (!ctx.
Read(itmQBIndex))
12789 {
12791 return false;
12792 }
12793
12794 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12795 if (itmQBIndex != -1 && parentPlayer)
12796 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12797 }
12798 }
12799 else
12800 {
12801
12802 PlayerBase player;
12803 int itemQBIndex;
12804 if (version ==
int.
MAX)
12805 {
12806 if (!ctx.
Read(itemQBIndex))
12807 {
12809 return false;
12810 }
12811 }
12812 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12813 {
12814
12815 if (!ctx.
Read(itemQBIndex))
12816 {
12818 return false;
12819 }
12820 if (itemQBIndex != -1 && player)
12821 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12822 }
12823 }
12824
12825 if (version < 140)
12826 {
12827
12828 if (!LoadVariables(ctx, version))
12829 {
12831 return false;
12832 }
12833 }
12834
12835
12837 {
12839 return false;
12840 }
12841 if (version >= 132)
12842 {
12844 if (raib)
12845 {
12847 {
12849 return false;
12850 }
12851 }
12852 }
12853
12855 return true;
12856 }
12857
12858
12859
12861 {
12862 super.OnStoreSave(ctx);
12863
12864 PlayerBase player;
12865 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12866 {
12868
12869 int itemQBIndex = -1;
12870 itemQBIndex = player.FindQuickBarEntityIndex(this);
12871 ctx.
Write(itemQBIndex);
12872 }
12873 else
12874 {
12876 }
12877
12879
12881 if (raib)
12882 {
12884 }
12885 }
12886
12887
12889 {
12890 super.AfterStoreLoad();
12891
12893 {
12895 }
12896
12898 {
12901 }
12902 }
12903
12905 {
12906 super.EEOnAfterLoad();
12907
12909 {
12911 }
12912
12915 }
12916
12918 {
12919 return false;
12920 }
12921
12922
12923
12925 {
12927 {
12928 #ifdef PLATFORM_CONSOLE
12929
12931 {
12933 if (menu)
12934 {
12936 }
12937 }
12938 #endif
12939 }
12940
12942 {
12945 }
12946
12948 {
12949 SetWeightDirty();
12951 }
12953 {
12956 }
12957
12959 {
12962
12965 }
12967 {
12971 }
12972
12973 super.OnVariablesSynchronized();
12974 }
12975
12976
12977
12979 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12980 {
12981 if (!IsServerCheck(allow_client))
12982 return false;
12983
12985 return false;
12986
12989
12990 if (value <= (min + 0.001))
12991 value = min;
12992
12993 if (value == min)
12994 {
12995 if (destroy_config)
12996 {
12997 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12998 if (dstr)
12999 {
13001 this.Delete();
13002 return true;
13003 }
13004 }
13005 else if (destroy_forced)
13006 {
13008 this.Delete();
13009 return true;
13010 }
13011
13013 }
13014
13017
13019 {
13020 EntityAI parent = GetHierarchyRoot();
13021 InventoryLocation iLoc = new InventoryLocation();
13022 GetInventory().GetCurrentInventoryLocation(iLoc);
13024 {
13025 int iLocSlot = iLoc.
GetSlot();
13027 {
13029 }
13031 {
13033 }
13034 }
13035 }
13036
13038 {
13040
13041 if (delta)
13043 }
13044
13046
13047 return false;
13048 }
13049
13050
13052 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13053 {
13055 }
13056
13058 {
13061 }
13062
13064 {
13067 }
13068
13070 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13071 {
13072 float value_clamped = Math.Clamp(value, 0, 1);
13074 SetQuantity(result, destroy_config, destroy_forced);
13075 }
13076
13077
13080 {
13082 }
13083
13085 {
13087 }
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13099 {
13100 int slot = -1;
13101 GameInventory inventory = GetInventory();
13102 if (inventory)
13103 {
13104 InventoryLocation il = new InventoryLocation;
13107 }
13108
13110 }
13111
13113 {
13114 float quantity_max = 0;
13115
13117 {
13118 if (attSlotID != -1)
13119 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13120
13121 if (quantity_max <= 0)
13123 }
13124
13125 if (quantity_max <= 0)
13127
13128 return quantity_max;
13129 }
13130
13132 {
13134 }
13135
13137 {
13139 }
13140
13141
13143 {
13145 }
13146
13148 {
13150 }
13151
13153 {
13155 }
13156
13157
13159 {
13160
13161 float weightEx = GetWeightEx();
13162 float special = GetInventoryAndCargoWeight();
13163 return weightEx - special;
13164 }
13165
13166
13168 {
13170 }
13171
13173 {
13175 {
13176 #ifdef DEVELOPER
13177 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13178 {
13179 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13181 }
13182 #endif
13183
13184 return GetQuantity() * GetConfigWeightModified();
13185 }
13186 else if (HasEnergyManager())
13187 {
13188 #ifdef DEVELOPER
13189 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13190 {
13191 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13192 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13193 }
13194 #endif
13195 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13196 }
13197 else
13198 {
13199 #ifdef DEVELOPER
13200 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13201 {
13202 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13203 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13204 }
13205 #endif
13206 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13207 }
13208 }
13209
13212 {
13213 int item_count = 0;
13215
13216 GameInventory inventory = GetInventory();
13217 CargoBase cargo = inventory.
GetCargo();
13218 if (cargo != NULL)
13219 {
13221 }
13222
13224 for (int i = 0; i < nAttachments; ++i)
13225 {
13227 if (item)
13228 item_count += item.GetNumberOfItems();
13229 }
13230 return item_count;
13231 }
13232
13235 {
13236 float weight = 0;
13237 float wetness = 1;
13238 if (include_wetness)
13241 {
13242 weight = wetness * m_ConfigWeight;
13243 }
13245 {
13246 weight = 1;
13247 }
13248 return weight;
13249 }
13250
13251
13252
13254 {
13255 GameInventory inventory = GetInventory();
13256 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13257 {
13258 array<EntityAI> items = new array<EntityAI>;
13260 for (int i = 0; i < items.Count(); ++i)
13261 {
13263 if (item)
13264 {
13265 g_Game.ObjectDelete(item);
13266 }
13267 }
13268 }
13269 }
13270
13271
13272
13273
13275 {
13276 float energy = 0;
13277 if (HasEnergyManager())
13278 {
13279 energy = GetCompEM().GetEnergy();
13280 }
13281 return energy;
13282 }
13283
13284
13286 {
13287 super.OnEnergyConsumed();
13288
13290 }
13291
13293 {
13294 super.OnEnergyAdded();
13295
13297 }
13298
13299
13301 {
13302 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13303 {
13305 {
13306 float energy_0to1 = GetCompEM().GetEnergy0To1();
13308 }
13309 }
13310 }
13311
13312
13314 {
13315 return ConfigGetFloat("heatIsolation");
13316 }
13317
13319 {
13321 }
13322
13324 {
13325 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13326 if (
g_Game.ConfigIsExisting(paramPath))
13327 return g_Game.ConfigGetFloat(paramPath);
13328
13329 return 0.0;
13330 }
13331
13333 {
13334 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13335 if (
g_Game.ConfigIsExisting(paramPath))
13336 return g_Game.ConfigGetFloat(paramPath);
13337
13338 return 0.0;
13339 }
13340
13341 override void SetWet(
float value,
bool allow_client =
false)
13342 {
13343 if (!IsServerCheck(allow_client))
13344 return;
13345
13348
13350
13351 m_VarWet = Math.Clamp(value, min, max);
13352
13354 {
13357 }
13358 }
13359
13360 override void AddWet(
float value)
13361 {
13363 }
13364
13366 {
13368 }
13369
13371 {
13373 }
13374
13376 {
13378 }
13379
13381 {
13383 }
13384
13386 {
13388 }
13389
13390 override void OnWetChanged(
float newVal,
float oldVal)
13391 {
13394 if (newLevel != oldLevel)
13395 {
13397 }
13398 }
13399
13401 {
13402 SetWeightDirty();
13403 }
13404
13406 {
13407 return GetWetLevelInternal(
m_VarWet);
13408 }
13409
13410
13411
13413 {
13415 }
13416
13418 {
13420 }
13421
13423 {
13425 }
13426
13428 {
13430 }
13431
13432
13433
13435 {
13436 if (ConfigIsExisting("itemModelLength"))
13437 {
13438 return ConfigGetFloat("itemModelLength");
13439 }
13440 return 0;
13441 }
13442
13444 {
13445 if (ConfigIsExisting("itemAttachOffset"))
13446 {
13447 return ConfigGetFloat("itemAttachOffset");
13448 }
13449 return 0;
13450 }
13451
13452 override void SetCleanness(
int value,
bool allow_client =
false)
13453 {
13454 if (!IsServerCheck(allow_client))
13455 return;
13456
13458
13460
13463 }
13464
13466 {
13468 }
13469
13471 {
13472 return true;
13473 }
13474
13475
13476
13477
13479 {
13481 }
13482
13484 {
13486 }
13487
13488
13489
13490
13491 override void SetColor(
int r,
int g,
int b,
int a)
13492 {
13498 }
13500 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13501 {
13506 }
13507
13509 {
13511 }
13512
13515 {
13516 int r,g,b,a;
13518 r = r/255;
13519 g = g/255;
13520 b = b/255;
13521 a = a/255;
13522 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13523 }
13524
13525
13526
13527 override void SetLiquidType(
int value,
bool allow_client =
false)
13528 {
13529 if (!IsServerCheck(allow_client))
13530 return;
13531
13536 }
13537
13539 {
13540 return ConfigGetInt("varLiquidTypeInit");
13541 }
13542
13544 {
13546 }
13547
13549 {
13551 SetFrozen(false);
13552 }
13553
13556 {
13557 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13558 }
13559
13560
13563 {
13564 PlayerBase nplayer;
13565 if (PlayerBase.CastTo(nplayer, player))
13566 {
13568 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13569 }
13570 }
13571
13572
13575 {
13576 PlayerBase nplayer;
13577 if (PlayerBase.CastTo(nplayer,player))
13578 {
13579 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13580 }
13581
13582 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13583
13584 if (HasEnergyManager())
13585 {
13586 GetCompEM().UpdatePlugState();
13587 }
13588 }
13589
13590
13592 {
13593 super.OnPlacementStarted(player);
13594
13596 }
13597
13598 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13599 {
13601 {
13602 m_AdminLog.OnPlacementComplete(player,
this);
13603 }
13604
13605 super.OnPlacementComplete(player, position, orientation);
13606 }
13607
13608
13609
13610
13611
13613 {
13615 {
13616 return true;
13617 }
13618 else
13619 {
13620 return false;
13621 }
13622 }
13623
13624
13626 {
13628 {
13630 }
13631 }
13632
13633
13635 {
13637 }
13638
13640 {
13642 }
13643
13644 override void InsertAgent(
int agent,
float count = 1)
13645 {
13646 if (count < 1)
13647 return;
13648
13650 }
13651
13654 {
13656 }
13657
13658
13660 {
13662 }
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13706 {
13708 return false;
13709 return true;
13710 }
13711
13713 {
13714
13716 }
13717
13718
13721 {
13722 super.CheckForRoofLimited(timeTresholdMS);
13723
13724 float time =
g_Game.GetTime();
13725 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13726 {
13727 m_PreviousRoofTestTime = time;
13728 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13729 }
13730 }
13731
13732
13734 {
13736 {
13737 return 0;
13738 }
13739
13740 if (GetInventory().GetAttachmentSlotsCount() != 0)
13741 {
13742 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13743 if (filter)
13744 return filter.GetProtectionLevel(type, false, system);
13745 else
13746 return 0;
13747 }
13748
13749 string subclassPath, entryName;
13750
13751 switch (type)
13752 {
13754 entryName = "biological";
13755 break;
13757 entryName = "chemical";
13758 break;
13759 default:
13760 entryName = "biological";
13761 break;
13762 }
13763
13764 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13765
13766 return g_Game.ConfigGetFloat(subclassPath + entryName);
13767 }
13768
13769
13770
13773 {
13774 if (!IsMagazine())
13776
13778 }
13779
13780
13781
13782
13783
13788 {
13789 return true;
13790 }
13791
13793 {
13795 }
13796
13797
13798
13799
13800
13802 {
13803 if (parent)
13804 {
13805 if (parent.IsInherited(DayZInfected))
13806 return true;
13807
13808 if (!parent.IsRuined())
13809 return true;
13810 }
13811
13812 return true;
13813 }
13814
13816 {
13817 if (!super.CanPutAsAttachment(parent))
13818 {
13819 return false;
13820 }
13821
13822 if (!IsRuined() && !parent.IsRuined())
13823 {
13824 return true;
13825 }
13826
13827 return false;
13828 }
13829
13831 {
13832
13833
13834
13835
13836 return super.CanReceiveItemIntoCargo(item);
13837 }
13838
13840 {
13841
13842
13843
13844
13845 GameInventory attachmentInv = attachment.GetInventory();
13847 {
13848 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13849 return false;
13850 }
13851
13852 InventoryLocation loc = new InventoryLocation();
13853 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13854 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13855 return false;
13856
13857 return super.CanReceiveAttachment(attachment, slotId);
13858 }
13859
13861 {
13862 if (!super.CanReleaseAttachment(attachment))
13863 return false;
13864
13865 return GetInventory().AreChildrenAccessible();
13866 }
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13889 {
13890 int id = muzzle_owner.GetMuzzleID();
13891 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13892
13893 if (WPOF_array)
13894 {
13895 for (int i = 0; i < WPOF_array.Count(); i++)
13896 {
13897 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13898
13899 if (WPOF)
13900 {
13901 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13902 }
13903 }
13904 }
13905 }
13906
13907
13909 {
13910 int id = muzzle_owner.GetMuzzleID();
13912
13913 if (WPOBE_array)
13914 {
13915 for (int i = 0; i < WPOBE_array.Count(); i++)
13916 {
13917 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13918
13919 if (WPOBE)
13920 {
13921 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13922 }
13923 }
13924 }
13925 }
13926
13927
13929 {
13930 int id = muzzle_owner.GetMuzzleID();
13931 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13932
13933 if (WPOOH_array)
13934 {
13935 for (int i = 0; i < WPOOH_array.Count(); i++)
13936 {
13937 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13938
13939 if (WPOOH)
13940 {
13941 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13942 }
13943 }
13944 }
13945 }
13946
13947
13949 {
13950 int id = muzzle_owner.GetMuzzleID();
13951 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13952
13953 if (WPOOH_array)
13954 {
13955 for (int i = 0; i < WPOOH_array.Count(); i++)
13956 {
13957 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13958
13959 if (WPOOH)
13960 {
13961 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13962 }
13963 }
13964 }
13965 }
13966
13967
13969 {
13970 int id = muzzle_owner.GetMuzzleID();
13971 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13972
13973 if (WPOOH_array)
13974 {
13975 for (int i = 0; i < WPOOH_array.Count(); i++)
13976 {
13977 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13978
13979 if (WPOOH)
13980 {
13981 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13982 }
13983 }
13984 }
13985 }
13986
13987
13988
13990 {
13992 {
13993 return true;
13994 }
13995
13996 return false;
13997 }
13998
14000 {
14002 {
14003 return true;
14004 }
14005
14006 return false;
14007 }
14008
14010 {
14012 {
14013 return true;
14014 }
14015
14016 return false;
14017 }
14018
14020 {
14021 return false;
14022 }
14023
14026 {
14027 return UATimeSpent.DEFAULT_DEPLOY;
14028 }
14029
14030
14031
14032
14034 {
14036 SetSynchDirty();
14037 }
14038
14040 {
14042 }
14043
14044
14046 {
14047 return false;
14048 }
14049
14052 {
14053 string att_type = "None";
14054
14055 if (ConfigIsExisting("soundAttType"))
14056 {
14057 att_type = ConfigGetString("soundAttType");
14058 }
14059
14061 }
14062
14064 {
14066 }
14067
14068
14069
14070
14071
14077
14079 {
14082
14084 }
14085
14086
14088 {
14090 return;
14091
14093
14096
14099
14100 SoundParameters params = new SoundParameters();
14104 }
14105
14106
14108 {
14110 {
14113
14114 SetSynchDirty();
14115
14118 }
14119 }
14120
14122 {
14124 }
14125
14126
14128 {
14130 return;
14131
14133 SetSynchDirty();
14134
14137 }
14138
14140 {
14143 }
14144
14146 {
14148 }
14149
14150 void OnApply(PlayerBase player);
14151
14153 {
14154 return 1.0;
14155 };
14156
14158 {
14160 }
14161
14163 {
14165 }
14166
14168
14170 {
14171 SetDynamicPhysicsLifeTime(0.01);
14173 }
14174
14176 {
14177 array<string> zone_names = new array<string>;
14178 GetDamageZones(zone_names);
14179 for (int i = 0; i < zone_names.Count(); i++)
14180 {
14181 SetHealthMax(zone_names.Get(i),"Health");
14182 }
14183 SetHealthMax("","Health");
14184 }
14185
14188 {
14189 float global_health = GetHealth01("","Health");
14190 array<string> zones = new array<string>;
14191 GetDamageZones(zones);
14192
14193 for (int i = 0; i < zones.Count(); i++)
14194 {
14195 SetHealth01(zones.Get(i),"Health",global_health);
14196 }
14197 }
14198
14201 {
14202 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14203 }
14204
14206 {
14207 if (!hasRootAsPlayer)
14208 {
14209 if (refParentIB)
14210 {
14211
14212 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14213 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14214
14215 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14216 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14217
14220 }
14221 else
14222 {
14223
14226 }
14227 }
14228 }
14229
14231 {
14233 {
14234 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14235 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14236 {
14237 float heatPermCoef = 1.0;
14239 while (ent)
14240 {
14241 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14242 ent = ent.GetHierarchyParent();
14243 }
14244
14245 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14246 }
14247 }
14248 }
14249
14251 {
14252
14253 EntityAI parent = GetHierarchyParent();
14254 if (!parent)
14255 {
14256 hasParent = false;
14257 hasRootAsPlayer = false;
14258 }
14259 else
14260 {
14261 hasParent = true;
14262 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14263 refParentIB =
ItemBase.Cast(parent);
14264 }
14265 }
14266
14267 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14268 {
14269
14270 }
14271
14273 {
14274
14275 return false;
14276 }
14277
14279 {
14280
14281
14282 return false;
14283 }
14284
14286 {
14287
14288 return false;
14289 }
14290
14293 {
14294 return !GetIsFrozen() &&
IsOpen();
14295 }
14296
14298 {
14299 bool hasParent = false, hasRootAsPlayer = false;
14301
14302 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14303 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14304
14305 if (wwtu || foodDecay)
14306 {
14310
14311 if (processWetness || processTemperature || processDecay)
14312 {
14314
14315 if (processWetness)
14316 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14317
14318 if (processTemperature)
14320
14321 if (processDecay)
14322 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14323 }
14324 }
14325 }
14326
14329 {
14331 }
14332
14334 {
14337
14338 return super.GetTemperatureFreezeThreshold();
14339 }
14340
14342 {
14345
14346 return super.GetTemperatureThawThreshold();
14347 }
14348
14350 {
14353
14354 return super.GetItemOverheatThreshold();
14355 }
14356
14358 {
14360 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14361
14362 return super.GetTemperatureFreezeTime();
14363 }
14364
14366 {
14368 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14369
14370 return super.GetTemperatureThawTime();
14371 }
14372
14377
14379 {
14380 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14381 }
14382
14384 {
14385 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14386 }
14387
14390 {
14392 }
14393
14395 {
14397 }
14398
14400 {
14402 }
14403
14406 {
14407 return null;
14408 }
14409
14412 {
14413 return false;
14414 }
14415
14417 {
14419 {
14422 if (!trg)
14423 {
14425 explosive = this;
14426 }
14427
14428 explosive.PairRemote(trg);
14430
14431 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14432 trg.SetPersistentPairID(persistentID);
14433 explosive.SetPersistentPairID(persistentID);
14434
14435 return true;
14436 }
14437 return false;
14438 }
14439
14442 {
14443 float ret = 1.0;
14446 ret *= GetHealth01();
14447
14448 return ret;
14449 }
14450
14451 #ifdef DEVELOPER
14452 override void SetDebugItem()
14453 {
14454 super.SetDebugItem();
14455 _itemBase = this;
14456 }
14457
14459 {
14460 string text = super.GetDebugText();
14461
14463 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14464
14465 return text;
14466 }
14467 #endif
14468
14470 {
14471 return true;
14472 }
14473
14475
14477
14479 {
14482 }
14483
14484
14492
14508
14509 [
Obsolete(
"Use ItemSoundHandler instead")]
14512 {
14513 if (!
g_Game.IsDedicatedServer())
14514 {
14515 if (ConfigIsExisting("attachSoundSet"))
14516 {
14517 string cfg_path = "";
14518 string soundset = "";
14519 string type_name =
GetType();
14520
14523 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14524 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14525
14526 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14527 {
14528 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14529 {
14530 if (cfg_slot_array[i] == slot_type)
14531 {
14532 soundset = cfg_soundset_array[i];
14533 break;
14534 }
14535 }
14536 }
14537
14538 if (soundset != "")
14539 {
14540 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14542 }
14543 }
14544 }
14545 }
14546
14548}
14549
14551{
14553 if (entity)
14554 {
14555 bool is_item = entity.IsInherited(
ItemBase);
14556 if (is_item && full_quantity)
14557 {
14560 }
14561 }
14562 else
14563 {
14565 return NULL;
14566 }
14567 return entity;
14568}
14569
14571{
14572 if (item)
14573 {
14574 if (health > 0)
14575 item.SetHealth("", "", health);
14576
14577 if (item.CanHaveTemperature())
14578 {
14580 if (item.CanFreeze())
14581 item.SetFrozen(false);
14582 }
14583
14584 if (item.HasEnergyManager())
14585 {
14586 if (quantity >= 0)
14587 {
14588 item.GetCompEM().SetEnergy0To1(quantity);
14589 }
14590 else
14591 {
14593 }
14594 }
14595 else if (item.IsMagazine())
14596 {
14597 Magazine mag = Magazine.Cast(item);
14598 if (quantity >= 0)
14599 {
14600 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14601 }
14602 else
14603 {
14605 }
14606
14607 }
14608 else
14609 {
14610 if (quantity >= 0)
14611 {
14612 item.SetQuantityNormalized(quantity, false);
14613 }
14614 else
14615 {
14617 }
14618
14619 }
14620 }
14621}
14622
14623#ifdef DEVELOPER
14625#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
override int GetLiquidType()
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.