If we need a different (handheld)item action widget displayed, the logic goes in here.
9667{
9669 {
9670 return true;
9671 }
9672};
9673
9675{
9676
9677};
9678
9679
9680
9682{
9686
9688
9691
9692
9693
9694
9695
9704
9710
9715
9720
9741 protected bool m_IsResultOfSplit
9742
9744
9749
9750
9751
9753
9757
9758
9759
9761
9764
9765
9766
9772
9773
9781
9784
9785
9787
9788
9790
9791
9796
9797
9802
9804
9805
9807
9808
9810 {
9815
9816 if (!
g_Game.IsDedicatedServer())
9817 {
9819 {
9821
9823 {
9825 }
9826 }
9827
9830 }
9831
9832 m_OldLocation = null;
9833
9835 {
9837 }
9838
9839 if (ConfigIsExisting("headSelectionsToHide"))
9840 {
9843 }
9844
9846 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9847 {
9849 }
9850
9852
9853 m_IsResultOfSplit = false;
9854
9856 }
9857
9859 {
9860 super.InitItemVariables();
9861
9867 m_Count = ConfigGetInt(
"count");
9868
9871
9876
9879
9884
9896
9900
9901
9904 if (ConfigIsExisting("canBeSplit"))
9905 {
9908 }
9909
9911 if (ConfigIsExisting("itemBehaviour"))
9913
9914
9917 RegisterNetSyncVariableInt("m_VarLiquidType");
9918 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9919
9920 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9921 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9922 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9923
9924 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9925 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9926 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9927 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9928
9929 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9930 RegisterNetSyncVariableBool("m_IsTakeable");
9931 RegisterNetSyncVariableBool("m_IsHologram");
9932
9935 {
9938 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9939 }
9940
9942
9944 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9946
9948 }
9949
9951 {
9953 }
9954
9956 {
9959 {
9964 }
9965 }
9966
9967 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9968 {
9970 {
9973 }
9974
9976 }
9977
9979 {
9985 }
9986
9988
9990 {
9992
9993 if (!action)
9994 {
9995 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9996 return;
9997 }
9998
10000 if (!ai)
10001 {
10003 return;
10004 }
10005
10007 if (!action_array)
10008 {
10009 action_array = new array<ActionBase_Basic>;
10011 }
10012 if (LogManager.IsActionLogEnable())
10013 {
10014 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10015 }
10016
10017 if (action_array.Find(action) != -1)
10018 {
10019 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10020 }
10021 else
10022 {
10023 action_array.Insert(action);
10024 }
10025 }
10026
10028 {
10029 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10030 ActionBase action = player.GetActionManager().GetAction(actionName);
10033
10034 if (action_array)
10035 {
10036 action_array.RemoveItem(action);
10037 }
10038 }
10039
10040
10041
10043 {
10044 ActionOverrideData overrideData = new ActionOverrideData();
10048
10050 if (!actionMap)
10051 {
10054 }
10055
10056 actionMap.Insert(this.
Type(), overrideData);
10057
10058 }
10059
10061
10063
10064
10066 {
10069
10072
10073 string config_to_search = "CfgVehicles";
10074 string muzzle_owner_config;
10075
10077 {
10078 if (IsInherited(Weapon))
10079 config_to_search = "CfgWeapons";
10080
10081 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10082
10083 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10084
10085 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10086
10087 if (config_OnFire_subclass_count > 0)
10088 {
10089 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10090
10091 for (int i = 0; i < config_OnFire_subclass_count; i++)
10092 {
10093 string particle_class = "";
10094 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10095 string config_OnFire_entry = config_OnFire_class + particle_class;
10096 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10097 WPOF_array.Insert(WPOF);
10098 }
10099
10100
10102 }
10103 }
10104
10106 {
10107 config_to_search = "CfgWeapons";
10108 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10109
10110 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10111
10112 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10113
10114 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10115 {
10116 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10117
10118 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10119 {
10120 string particle_class2 = "";
10121 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10122 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10123 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10124 WPOBE_array.Insert(WPOBE);
10125 }
10126
10127
10129 }
10130 }
10131 }
10132
10133
10135 {
10138
10140 {
10141 string config_to_search = "CfgVehicles";
10142
10143 if (IsInherited(Weapon))
10144 config_to_search = "CfgWeapons";
10145
10146 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10147 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10148
10149 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10150 {
10151
10153
10155 {
10157 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10159 return;
10160 }
10161
10164
10165
10166
10167 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10168 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10169
10170 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10171 {
10172 string particle_class = "";
10173 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10174 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10175 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10176
10177 if (entry_type == CT_CLASS)
10178 {
10179 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10180 WPOOH_array.Insert(WPOF);
10181 }
10182 }
10183
10184
10186 }
10187 }
10188 }
10189
10191 {
10193 }
10194
10196 {
10198 {
10200
10203
10206
10207 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10208 }
10209 }
10210
10212 {
10214 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10215
10217 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10218
10220 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10221
10223 {
10225 }
10226 }
10227
10229 {
10231 }
10232
10234 {
10237 else
10239
10241 {
10244 }
10245 else
10246 {
10249
10252 }
10253
10255 }
10256
10258 {
10260 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10261 }
10262
10264 {
10266 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10268 }
10269
10271 {
10273 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10274 }
10275
10277 {
10280
10281 OverheatingParticle OP = new OverheatingParticle();
10286
10288 }
10289
10291 {
10294
10295 return -1;
10296 }
10297
10299 {
10301 {
10304
10305 for (int i = count; i > 0; --i)
10306 {
10307 int id = i - 1;
10310
10313
10314 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10315 {
10316 if (p)
10317 {
10320 }
10321 }
10322 }
10323 }
10324 }
10325
10327 {
10329 {
10331 {
10332 int id = i - 1;
10334
10335 if (OP)
10336 {
10338
10339 if (p)
10340 {
10342 }
10343
10344 delete OP;
10345 }
10346 }
10347
10350 }
10351 }
10352
10355 {
10356 return 0.0;
10357 }
10358
10359
10361 {
10362 return 250;
10363 }
10364
10366 {
10367 return 0;
10368 }
10369
10372 {
10374 return true;
10375
10376 return false;
10377 }
10378
10381 {
10384
10386 {
10388 }
10389 else
10390 {
10391
10393 }
10394
10396 }
10397
10404 {
10405 return -1;
10406 }
10407
10408
10409
10410
10412 {
10414 {
10415 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10416 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10417
10418 if (r_index >= 0)
10419 {
10420 InventoryLocation r_il = new InventoryLocation;
10421 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10422
10423 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10426 {
10427 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10428 }
10430 {
10431 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10432 }
10433
10434 }
10435
10436 player.GetHumanInventory().ClearUserReservedLocation(this);
10437 }
10438
10441 }
10442
10443
10444
10445
10447 {
10448 return ItemBase.m_DebugActionsMask;
10449 }
10450
10452 {
10453 return ItemBase.m_DebugActionsMask & mask;
10454 }
10455
10457 {
10458 ItemBase.m_DebugActionsMask = mask;
10459 }
10460
10462 {
10463 ItemBase.m_DebugActionsMask |= mask;
10464 }
10465
10467 {
10468 ItemBase.m_DebugActionsMask &= ~mask;
10469 }
10470
10472 {
10474 {
10476 }
10477 else
10478 {
10480 }
10481 }
10482
10483
10485 {
10486 if (GetEconomyProfile())
10487 {
10488 float q_max = GetEconomyProfile().GetQuantityMax();
10489 if (q_max > 0)
10490 {
10491 float q_min = GetEconomyProfile().GetQuantityMin();
10492 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10493
10495 {
10496 ComponentEnergyManager comp = GetCompEM();
10498 {
10500 }
10501 }
10503 {
10505
10506 }
10507
10508 }
10509 }
10510 }
10511
10514 {
10515 EntityAI parent = GetHierarchyParent();
10516
10517 if (parent)
10518 {
10519 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10520 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10521 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10522 }
10523 }
10524
10527 {
10528 EntityAI parent = GetHierarchyParent();
10529
10530 if (parent)
10531 {
10532 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10533 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10534 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10535 }
10536 }
10537
10539 {
10540
10541
10542
10543
10545
10547 {
10548 if (ScriptInputUserData.CanStoreInputUserData())
10549 {
10550 ScriptInputUserData ctx = new ScriptInputUserData;
10556 ctx.
Write(use_stack_max);
10559
10561 {
10562 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10563 }
10564 }
10565 }
10566 else if (!
g_Game.IsMultiplayer())
10567 {
10569 }
10570 }
10571
10573 {
10575 }
10576
10578 {
10580 }
10581
10583 {
10585 }
10586
10588 {
10589
10590 return false;
10591 }
10592
10594 {
10595 return false;
10596 }
10597
10601 {
10602 return false;
10603 }
10604
10606 {
10607 return "";
10608 }
10609
10611
10613 {
10614 return false;
10615 }
10616
10618 {
10619 return true;
10620 }
10621
10622
10623
10625 {
10626 return true;
10627 }
10628
10630 {
10631 return true;
10632 }
10633
10635 {
10636 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10638 }
10639
10641 {
10643 }
10644
10646 {
10648 if (!is_being_placed)
10650 SetSynchDirty();
10651 }
10652
10653
10655
10657 {
10659 }
10660
10662 {
10664 }
10665
10667 {
10668 return 1;
10669 }
10670
10672 {
10673 return false;
10674 }
10675
10677 {
10679 SetSynchDirty();
10680 }
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10717 {
10718 super.OnMovedInsideCargo(container);
10719
10720 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10721 }
10722
10723 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10724 {
10725 super.EEItemLocationChanged(oldLoc, newLoc);
10726
10727 PlayerBase newPlayer = null;
10728 PlayerBase oldPlayer = null;
10729
10730 if (newLoc.GetParent())
10731 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10732
10733 if (oldLoc.GetParent())
10734 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10735
10737 {
10738 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10739
10740 if (rIndex >= 0)
10741 {
10742 InventoryLocation rIl = new InventoryLocation;
10743 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10744
10745 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10748 {
10749 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10750 }
10752 {
10754 }
10755
10756 }
10757 }
10758
10760 {
10761 if (newPlayer)
10762 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10763
10764 if (newPlayer == oldPlayer)
10765 {
10766 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10767 {
10769 {
10770 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10771 {
10772 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10773 }
10774 }
10775 else
10776 {
10777 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10778 }
10779 }
10780
10781 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10782 {
10783 int type = oldLoc.GetType();
10785 {
10786 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10787 }
10789 {
10790 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10791 }
10792 }
10793 if (!m_OldLocation)
10794 {
10795 m_OldLocation = new InventoryLocation;
10796 }
10797 m_OldLocation.Copy(oldLoc);
10798 }
10799 else
10800 {
10801 if (m_OldLocation)
10802 {
10803 m_OldLocation.Reset();
10804 }
10805 }
10806
10807 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10808 }
10809 else
10810 {
10811 if (newPlayer)
10812 {
10813 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10814 if (resIndex >= 0)
10815 {
10816 InventoryLocation il = new InventoryLocation;
10817 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10819 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10822 {
10823 il.
GetParent().GetOnReleaseLock().Invoke(it);
10824 }
10826 {
10828 }
10829
10830 }
10831 }
10833 {
10834
10836 }
10837
10838 if (m_OldLocation)
10839 {
10840 m_OldLocation.Reset();
10841 }
10842 }
10843
10845 {
10846 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10847 }
10848
10850 {
10851 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10852 }
10853 }
10854
10855 override void EOnContact(IEntity other, Contact extra)
10856 {
10858 {
10859 int liquidType = -1;
10861 if (impactSpeed > 0.0)
10862 {
10864 #ifndef SERVER
10866 #else
10868 SetSynchDirty();
10869 #endif
10871 }
10872 }
10873
10874 #ifdef SERVER
10875 if (GetCompEM() && GetCompEM().IsPlugged())
10876 {
10877 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10878 GetCompEM().UnplugThis();
10879 }
10880 #endif
10881 }
10882
10884
10886 {
10888 }
10889
10891 {
10892
10893 }
10894
10896 {
10897 super.OnItemLocationChanged(old_owner, new_owner);
10898
10899 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10900 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10901
10902 if (!relatedPlayer && playerNew)
10903 relatedPlayer = playerNew;
10904
10905 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10906 {
10908 if (actionMgr)
10909 {
10910 ActionBase currentAction = actionMgr.GetRunningAction();
10911 if (currentAction)
10913 }
10914 }
10915
10916 Man ownerPlayerOld = null;
10917 Man ownerPlayerNew = null;
10918
10919 if (old_owner)
10920 {
10921 if (old_owner.
IsMan())
10922 {
10923 ownerPlayerOld = Man.Cast(old_owner);
10924 }
10925 else
10926 {
10927 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10928 }
10929 }
10930 else
10931 {
10933 {
10935
10936 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10937 {
10938 GetCompEM().UnplugThis();
10939 }
10940 }
10941 }
10942
10943 if (new_owner)
10944 {
10945 if (new_owner.
IsMan())
10946 {
10947 ownerPlayerNew = Man.Cast(new_owner);
10948 }
10949 else
10950 {
10951 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10952 }
10953 }
10954
10955 if (ownerPlayerOld != ownerPlayerNew)
10956 {
10957 if (ownerPlayerOld)
10958 {
10959 array<EntityAI> subItemsExit = new array<EntityAI>;
10961 for (int i = 0; i < subItemsExit.Count(); i++)
10962 {
10965 }
10966 }
10967
10968 if (ownerPlayerNew)
10969 {
10970 array<EntityAI> subItemsEnter = new array<EntityAI>;
10972 for (int j = 0; j < subItemsEnter.Count(); j++)
10973 {
10976 }
10977 }
10978 }
10979 else if (ownerPlayerNew != null)
10980 {
10981 PlayerBase nplayer;
10982 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10983 {
10984 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10986 for (int k = 0; k < subItemsUpdate.Count(); k++)
10987 {
10989 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10990 }
10991 }
10992 }
10993
10994 if (old_owner)
10995 old_owner.OnChildItemRemoved(this);
10996 if (new_owner)
10997 new_owner.OnChildItemReceived(this);
10998 }
10999
11000
11002 {
11003 super.EEDelete(parent);
11004 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11005 if (player)
11006 {
11008
11009 if (player.IsAlive())
11010 {
11011 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11012 if (r_index >= 0)
11013 {
11014 InventoryLocation r_il = new InventoryLocation;
11015 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11016
11017 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11020 {
11021 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11022 }
11024 {
11025 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11026 }
11027
11028 }
11029
11030 player.RemoveQuickBarEntityShortcut(this);
11031 }
11032 }
11033 }
11034
11036 {
11037 super.EEKilled(killer);
11038
11041 {
11042 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11043 {
11044 if (IsMagazine())
11045 {
11046 if (Magazine.Cast(this).GetAmmoCount() > 0)
11047 {
11049 }
11050 }
11051 else
11052 {
11054 }
11055 }
11056 }
11057 }
11058
11060 {
11061 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11062
11063 super.OnWasAttached(parent, slot_id);
11064
11067
11070 }
11071
11073 {
11074 super.OnWasDetached(parent, slot_id);
11075
11078
11081 }
11082
11084 {
11085 int idx;
11088
11089 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11090 if (inventory_slots.Count() < 1)
11091 {
11092 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11093 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11094 }
11095 else
11096 {
11097 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11098 }
11099
11100 idx = inventory_slots.Find(slot);
11101 if (idx < 0)
11102 return "";
11103
11104 return attach_types.Get(idx);
11105 }
11106
11108 {
11109 int idx = -1;
11110 string slot;
11111
11114
11115 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11116 if (inventory_slots.Count() < 1)
11117 {
11118 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11119 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11120 }
11121 else
11122 {
11123 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11124 if (detach_types.Count() < 1)
11125 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11126 }
11127
11128 for (int i = 0; i < inventory_slots.Count(); i++)
11129 {
11130 slot = inventory_slots.Get(i);
11131 }
11132
11133 if (slot != "")
11134 {
11135 if (detach_types.Count() == 1)
11136 idx = 0;
11137 else
11138 idx = inventory_slots.Find(slot);
11139 }
11140 if (idx < 0)
11141 return "";
11142
11143 return detach_types.Get(idx);
11144 }
11145
11147 {
11148
11150
11151
11152 float min_time = 1;
11153 float max_time = 3;
11154 float delay = Math.RandomFloat(min_time, max_time);
11155
11156 explode_timer.Run(delay, this, "DoAmmoExplosion");
11157 }
11158
11160 {
11161 Magazine magazine = Magazine.Cast(this);
11162 int pop_sounds_count = 6;
11163 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11164
11165
11166 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11167 string sound_name = pop_sounds[ sound_idx ];
11168 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11169
11170
11171 magazine.ServerAddAmmoCount(-1);
11172
11173
11174 float min_temp_to_explode = 100;
11175
11176 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11177 {
11179 }
11180 }
11181
11182
11183 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11184 {
11185 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11186
11187 const int CHANCE_DAMAGE_CARGO = 4;
11188 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11189 const int CHANCE_DAMAGE_NOTHING = 2;
11190
11192 {
11193 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11194 int chances;
11195 int rnd;
11196
11197 if (GetInventory().GetCargo())
11198 {
11199 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11200 rnd = Math.RandomInt(0,chances);
11201
11202 if (rnd < CHANCE_DAMAGE_CARGO)
11203 {
11205 }
11206 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11207 {
11209 }
11210 }
11211 else
11212 {
11213 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11214 rnd = Math.RandomInt(0,chances);
11215
11216 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11217 {
11219 }
11220 }
11221 }
11222 }
11223
11225 {
11226 CargoBase cargo = GetInventory().GetCargo();
11227 if (cargo)
11228 {
11230 if (item_count > 0)
11231 {
11232 int random_pick = Math.RandomInt(0, item_count);
11234 if (!item.IsExplosive())
11235 {
11236 item.AddHealth("","",damage);
11237 return true;
11238 }
11239 }
11240 }
11241 return false;
11242 }
11243
11245 {
11246 GameInventory inventory = GetInventory();
11248 if (attachment_count > 0)
11249 {
11250 int random_pick = Math.RandomInt(0, attachment_count);
11252 if (!attachment.IsExplosive())
11253 {
11254 attachment.AddHealth("","",damage);
11255 return true;
11256 }
11257 }
11258 return false;
11259 }
11260
11262 {
11264 }
11265
11267 {
11269 return GetInventory().CanRemoveEntity();
11270
11271 return false;
11272 }
11273
11275 {
11276
11278 return false;
11279
11280
11282 return false;
11283
11284
11285
11287 if (delta == 0)
11288 return false;
11289
11290
11291 return true;
11292 }
11293
11295 {
11297 {
11298 if (ScriptInputUserData.CanStoreInputUserData())
11299 {
11300 ScriptInputUserData ctx = new ScriptInputUserData;
11305 ctx.
Write(destination_entity);
11307 ctx.
Write(slot_id);
11309 }
11310 }
11311 else if (!
g_Game.IsMultiplayer())
11312 {
11314 }
11315 }
11316
11318 {
11319 float split_quantity_new;
11323 InventoryLocation loc = new InventoryLocation;
11324
11325 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11326 {
11328 split_quantity_new = stack_max;
11329 else
11331
11333 {
11334 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11335 if (new_item)
11336 {
11337 new_item.SetResultOfSplit(true);
11338 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11340 new_item.
SetQuantity(split_quantity_new,
false,
true);
11341 }
11342 }
11343 }
11344 else if (destination_entity && slot_id == -1)
11345 {
11346 if (quantity > stack_max)
11347 split_quantity_new = stack_max;
11348 else
11349 split_quantity_new = quantity;
11350
11352 {
11353 GameInventory destinationInventory = destination_entity.GetInventory();
11355 {
11358 }
11359
11360 if (new_item)
11361 {
11362 new_item.SetResultOfSplit(true);
11363 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11365 new_item.
SetQuantity(split_quantity_new,
false,
true);
11366 }
11367 }
11368 }
11369 else
11370 {
11371 if (stack_max != 0)
11372 {
11374 {
11376 }
11377
11378 if (split_quantity_new == 0)
11379 {
11380 if (!
g_Game.IsMultiplayer())
11381 player.PhysicalPredictiveDropItem(this);
11382 else
11383 player.ServerDropEntity(this);
11384 return;
11385 }
11386
11388 {
11390
11391 if (new_item)
11392 {
11393 new_item.SetResultOfSplit(true);
11394 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11397 new_item.PlaceOnSurface();
11398 }
11399 }
11400 }
11401 }
11402 }
11403
11405 {
11406 float split_quantity_new;
11410 InventoryLocation loc = new InventoryLocation;
11411
11412 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11413 {
11415 split_quantity_new = stack_max;
11416 else
11418
11420 {
11421 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11422 if (new_item)
11423 {
11424 new_item.SetResultOfSplit(true);
11425 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11427 new_item.
SetQuantity(split_quantity_new,
false,
true);
11428 }
11429 }
11430 }
11431 else if (destination_entity && slot_id == -1)
11432 {
11433 if (quantity > stack_max)
11434 split_quantity_new = stack_max;
11435 else
11436 split_quantity_new = quantity;
11437
11439 {
11440 GameInventory destinationInventory = destination_entity.GetInventory();
11442 {
11445 }
11446
11447 if (new_item)
11448 {
11449 new_item.SetResultOfSplit(true);
11450 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11452 new_item.
SetQuantity(split_quantity_new,
false,
true);
11453 }
11454 }
11455 }
11456 else
11457 {
11458 if (stack_max != 0)
11459 {
11461 {
11463 }
11464
11466 {
11468
11469 if (new_item)
11470 {
11471 new_item.SetResultOfSplit(true);
11472 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11475 new_item.PlaceOnSurface();
11476 }
11477 }
11478 }
11479 }
11480 }
11481
11483 {
11485 {
11486 if (ScriptInputUserData.CanStoreInputUserData())
11487 {
11488 ScriptInputUserData ctx = new ScriptInputUserData;
11493 dst.WriteToContext(ctx);
11495 }
11496 }
11497 else if (!
g_Game.IsMultiplayer())
11498 {
11500 }
11501 }
11502
11504 {
11506 {
11507 if (ScriptInputUserData.CanStoreInputUserData())
11508 {
11509 ScriptInputUserData ctx = new ScriptInputUserData;
11514 ctx.
Write(destination_entity);
11520 }
11521 }
11522 else if (!
g_Game.IsMultiplayer())
11523 {
11525 }
11526 }
11527
11529 {
11531 }
11532
11534 {
11536 float split_quantity_new;
11538 if (dst.IsValid())
11539 {
11540 int slot_id = dst.GetSlot();
11542
11543 if (quantity > stack_max)
11544 split_quantity_new = stack_max;
11545 else
11546 split_quantity_new = quantity;
11547
11549 {
11551
11552 if (new_item)
11553 {
11554 new_item.SetResultOfSplit(true);
11555 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11557 new_item.
SetQuantity(split_quantity_new,
false,
true);
11558 }
11559
11560 return new_item;
11561 }
11562 }
11563
11564 return null;
11565 }
11566
11568 {
11570 float split_quantity_new;
11572 if (destination_entity)
11573 {
11575 if (quantity > stackable)
11576 split_quantity_new = stackable;
11577 else
11578 split_quantity_new = quantity;
11579
11581 {
11582 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11583 if (new_item)
11584 {
11585 new_item.SetResultOfSplit(true);
11586 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11588 new_item.
SetQuantity(split_quantity_new,
false,
true);
11589 }
11590 }
11591 }
11592 }
11593
11595 {
11597 {
11598 if (ScriptInputUserData.CanStoreInputUserData())
11599 {
11600 ScriptInputUserData ctx = new ScriptInputUserData;
11605 ItemBase destination_entity =
this;
11606 ctx.
Write(destination_entity);
11610 }
11611 }
11612 else if (!
g_Game.IsMultiplayer())
11613 {
11615 }
11616 }
11617
11619 {
11621 float split_quantity_new;
11623 if (player)
11624 {
11626 if (quantity > stackable)
11627 split_quantity_new = stackable;
11628 else
11629 split_quantity_new = quantity;
11630
11632 {
11633 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11634 new_item =
ItemBase.Cast(in_hands);
11635 if (new_item)
11636 {
11637 new_item.SetResultOfSplit(true);
11638 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11640 new_item.SetQuantity(split_quantity_new, false, true);
11641 }
11642 }
11643 }
11644 }
11645
11647 {
11649 float split_quantity_new = Math.Floor(quantity * 0.5);
11650
11652 return;
11653
11655
11656 if (new_item)
11657 {
11658 if (new_item.GetQuantityMax() < split_quantity_new)
11659 {
11660 split_quantity_new = new_item.GetQuantityMax();
11661 }
11662
11663 new_item.SetResultOfSplit(true);
11664 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11665
11667 {
11670 }
11671 else
11672 {
11674 new_item.
SetQuantity(split_quantity_new,
false,
true);
11675 }
11676 }
11677 }
11678
11680 {
11682 float split_quantity_new = Math.Floor(quantity / 2);
11683
11685 return;
11686
11687 InventoryLocation invloc = new InventoryLocation;
11689
11691 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11692
11693 if (new_item)
11694 {
11695 if (new_item.GetQuantityMax() < split_quantity_new)
11696 {
11697 split_quantity_new = new_item.GetQuantityMax();
11698 }
11700 {
11703 }
11704 else if (split_quantity_new > 1)
11705 {
11707 new_item.
SetQuantity(split_quantity_new,
false,
true);
11708 }
11709 }
11710 }
11711
11714 {
11715 SetWeightDirty();
11717
11718 if (parent)
11719 parent.OnAttachmentQuantityChangedEx(this, delta);
11720
11722 {
11724 {
11726 }
11728 {
11729 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11731 }
11732 }
11733 }
11734
11737 {
11738
11739 }
11740
11743 {
11745 }
11746
11748 {
11749 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11750
11752 {
11753 if (newLevel == GameConstants.STATE_RUINED)
11754 {
11756 EntityAI parent = GetHierarchyParent();
11757 if (parent && parent.IsFireplace())
11758 {
11759 CargoBase cargo = GetInventory().GetCargo();
11760 if (cargo)
11761 {
11763 {
11765 }
11766 }
11767 }
11768 }
11769
11771 {
11772
11774 return;
11775 }
11776
11777 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11778 {
11780 }
11781 }
11782 }
11783
11784
11786 {
11787 super.OnRightClick();
11788
11790 {
11792 {
11793 if (ScriptInputUserData.CanStoreInputUserData())
11794 {
11795 EntityAI root = GetHierarchyRoot();
11796 Man playerOwner = GetHierarchyRootPlayer();
11797 InventoryLocation dst = new InventoryLocation;
11798
11799
11800 if (!playerOwner && root && root == this)
11801 {
11803 }
11804 else
11805 {
11806
11807 GetInventory().GetCurrentInventoryLocation(dst);
11809 {
11810 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11812 {
11814 }
11815 else
11816 {
11818
11819
11820 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11821 {
11823 }
11824 else
11825 {
11826 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11827 }
11828 }
11829 }
11830 }
11831
11832 ScriptInputUserData ctx = new ScriptInputUserData;
11840 }
11841 }
11842 else if (!
g_Game.IsMultiplayer())
11843 {
11845 }
11846 }
11847 }
11848
11850 {
11851 if (root)
11852 {
11853 vector m4[4];
11854 root.GetTransform(m4);
11855 dst.SetGround(this, m4);
11856 }
11857 else
11858 {
11859 GetInventory().GetCurrentInventoryLocation(dst);
11860 }
11861 }
11862
11863 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11864 {
11865
11866 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11867 return false;
11868
11869 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11870 return false;
11871
11872
11874 return false;
11875
11876
11877 Magazine mag = Magazine.Cast(this);
11878 if (mag)
11879 {
11880 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11881 return false;
11882
11883 if (stack_max_limit)
11884 {
11885 Magazine other_mag = Magazine.Cast(other_item);
11886 if (other_item)
11887 {
11888 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11889 return false;
11890 }
11891
11892 }
11893 }
11894 else
11895 {
11896
11898 return false;
11899
11901 return false;
11902 }
11903
11904 PlayerBase player = null;
11905 if (CastTo(player, GetHierarchyRootPlayer()))
11906 {
11907 if (player.GetInventory().HasAttachment(this))
11908 return false;
11909
11910 if (player.IsItemsToDelete())
11911 return false;
11912 }
11913
11914 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11915 return false;
11916
11917 int slotID;
11919 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11920 return false;
11921
11922 return true;
11923 }
11924
11926 {
11928 }
11929
11931 {
11932 return m_IsResultOfSplit;
11933 }
11934
11936 {
11937 m_IsResultOfSplit = value;
11938 }
11939
11941 {
11943 }
11944
11946 {
11947 float other_item_quantity = other_item.GetQuantity();
11948 float this_free_space;
11949
11951
11953
11954 if (other_item_quantity > this_free_space)
11955 {
11956 return this_free_space;
11957 }
11958 else
11959 {
11960 return other_item_quantity;
11961 }
11962 }
11963
11965 {
11967 }
11968
11970 {
11972 return;
11973
11974 if (!IsMagazine() && other_item)
11975 {
11977 if (quantity_used != 0)
11978 {
11979 float hp1 = GetHealth01("","");
11980 float hp2 = other_item.GetHealth01("","");
11981 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11982 hpResult = hpResult / (
GetQuantity() + quantity_used);
11983
11984 hpResult *= GetMaxHealth();
11985 Math.Round(hpResult);
11986 SetHealth("", "Health", hpResult);
11987
11989 other_item.AddQuantity(-quantity_used);
11990 }
11991 }
11993 }
11994
11996 {
11997 #ifdef SERVER
11998 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11999 GetHierarchyParent().IncreaseLifetimeUp();
12000 #endif
12001 };
12002
12004 {
12005 PlayerBase p = PlayerBase.Cast(player);
12006
12007 array<int> recipesIds = p.m_Recipes;
12008 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12009 if (moduleRecipesManager)
12010 {
12011 EntityAI itemInHands = player.GetEntityInHands();
12012 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12013 }
12014
12015 for (int i = 0;i < recipesIds.Count(); i++)
12016 {
12017 int key = recipesIds.Get(i);
12018 string recipeName = moduleRecipesManager.GetRecipeName(key);
12020 }
12021 }
12022
12023
12024 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12025 {
12026 super.GetDebugActions(outputList);
12027
12028
12034
12035
12040
12045
12046
12050
12051
12053 {
12057 }
12058
12061
12062
12066
12068
12069 InventoryLocation loc = new InventoryLocation();
12070 GetInventory().GetCurrentInventoryLocation(loc);
12072 {
12073 if (Gizmo_IsSupported())
12076 }
12077
12079 }
12080
12081
12082
12083
12085 {
12086 super.OnAction(action_id, player, ctx);
12087
12089 {
12090 switch (action_id)
12091 {
12095 return true;
12099 return true;
12100 }
12101 }
12102
12104 {
12105 switch (action_id)
12106 {
12108 Delete();
12109 return true;
12110 }
12111 }
12112
12113 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12114 {
12115 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12116 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12117 PlayerBase p = PlayerBase.Cast(player);
12118 if (
EActions.RECIPES_RANGE_START < 1000)
12119 {
12120 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12121 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12122 }
12123 }
12124 #ifndef SERVER
12125 else if (action_id ==
EActions.WATCH_PLAYER)
12126 {
12127 PluginDeveloper.SetDeveloperItemClientEx(player);
12128 }
12129 #endif
12131 {
12132 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12133 {
12134 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12135 OnDebugButtonPressServer(id + 1);
12136 }
12137
12138 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12139 {
12140 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12142 }
12143
12144 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12145 {
12146 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12148 }
12149
12150 else if (action_id ==
EActions.ADD_QUANTITY)
12151 {
12152 if (IsMagazine())
12153 {
12154 Magazine mag = Magazine.Cast(this);
12155 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12156 }
12157 else
12158 {
12160 }
12161
12162 if (m_EM)
12163 {
12164 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12165 }
12166
12167 }
12168
12169 else if (action_id ==
EActions.REMOVE_QUANTITY)
12170 {
12171 if (IsMagazine())
12172 {
12173 Magazine mag2 = Magazine.Cast(this);
12174 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12175 }
12176 else
12177 {
12179 }
12180 if (m_EM)
12181 {
12182 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12183 }
12184
12185 }
12186
12187 else if (action_id ==
EActions.SET_QUANTITY_0)
12188 {
12190
12191 if (m_EM)
12192 {
12193 m_EM.SetEnergy(0);
12194 }
12195 }
12196
12197 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12198 {
12200
12201 if (m_EM)
12202 {
12203 m_EM.SetEnergy(m_EM.GetEnergyMax());
12204 }
12205 }
12206
12207 else if (action_id ==
EActions.ADD_HEALTH)
12208 {
12209 AddHealth("","",GetMaxHealth("","Health")/5);
12210 }
12211 else if (action_id ==
EActions.REMOVE_HEALTH)
12212 {
12213 AddHealth("","",-GetMaxHealth("","Health")/5);
12214 }
12215 else if (action_id ==
EActions.DESTROY_HEALTH)
12216 {
12217 SetHealth01("","",0);
12218 }
12219 else if (action_id ==
EActions.WATCH_ITEM)
12220 {
12222 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12223 #ifdef DEVELOPER
12224 SetDebugDeveloper_item(this);
12225 #endif
12226 }
12227
12228 else if (action_id ==
EActions.ADD_TEMPERATURE)
12229 {
12230 AddTemperature(20);
12231
12232 }
12233
12234 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12235 {
12236 AddTemperature(-20);
12237
12238 }
12239
12240 else if (action_id ==
EActions.FLIP_FROZEN)
12241 {
12242 SetFrozen(!GetIsFrozen());
12243
12244 }
12245
12246 else if (action_id ==
EActions.ADD_WETNESS)
12247 {
12249
12250 }
12251
12252 else if (action_id ==
EActions.REMOVE_WETNESS)
12253 {
12255
12256 }
12257
12258 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12259 {
12262
12263
12264 }
12265
12266 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12267 {
12270 }
12271
12272 else if (action_id ==
EActions.MAKE_SPECIAL)
12273 {
12274 auto debugParams = DebugSpawnParams.WithPlayer(player);
12275 OnDebugSpawnEx(debugParams);
12276 }
12277
12278 }
12279
12280
12281 return false;
12282 }
12283
12284
12285
12286
12290
12293
12294
12295
12297 {
12298 return false;
12299 }
12300
12301
12303 {
12304 return true;
12305 }
12306
12307
12309 {
12310 return true;
12311 }
12312
12313
12314
12316 {
12317 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12318 return g_Game.ConfigIsExisting(config_path);
12319 }
12320
12323 {
12324 return null;
12325 }
12326
12328 {
12329 return false;
12330 }
12331
12333 {
12334 return false;
12335 }
12336
12340
12341
12343 {
12344 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12345 return module_repairing.CanRepair(this, item_repair_kit);
12346 }
12347
12348
12349 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12350 {
12351 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12352 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12353 }
12354
12355
12357 {
12358
12359
12360
12361
12362
12363
12364
12365
12366 return 1;
12367 }
12368
12369
12370
12372 {
12374 }
12375
12376
12377
12379 {
12381 }
12382
12383
12392 {
12393 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12394
12395 if (player)
12396 {
12397 player.MessageStatus(text);
12398 }
12399 }
12400
12401
12410 {
12411 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12412
12413 if (player)
12414 {
12415 player.MessageAction(text);
12416 }
12417 }
12418
12419
12428 {
12429 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12430
12431 if (player)
12432 {
12433 player.MessageFriendly(text);
12434 }
12435 }
12436
12437
12446 {
12447 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12448
12449 if (player)
12450 {
12451 player.MessageImportant(text);
12452 }
12453 }
12454
12456 {
12457 return true;
12458 }
12459
12460
12461 override bool KindOf(
string tag)
12462 {
12463 bool found = false;
12464 string item_name = this.
GetType();
12466 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12467
12468 int array_size = item_tag_array.Count();
12469 for (int i = 0; i < array_size; i++)
12470 {
12471 if (item_tag_array.Get(i) == tag)
12472 {
12473 found = true;
12474 break;
12475 }
12476 }
12477 return found;
12478 }
12479
12480
12482 {
12483
12484 super.OnRPC(sender, rpc_type,ctx);
12485
12486
12487 switch (rpc_type)
12488 {
12489 #ifndef SERVER
12490 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12491 Param2<bool, string> p = new Param2<bool, string>(false, "");
12492
12494 return;
12495
12496 bool play = p.param1;
12497 string soundSet = p.param2;
12498
12499 if (play)
12500 {
12502 {
12504 {
12506 }
12507 }
12508 else
12509 {
12511 }
12512 }
12513 else
12514 {
12516 }
12517
12518 break;
12519 #endif
12520
12521 }
12522
12524 {
12526 }
12527 }
12528
12529
12530
12531
12533 {
12534 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12535 return plugin.GetID(
name);
12536 }
12537
12539 {
12540 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12541 return plugin.GetName(id);
12542 }
12543
12546 {
12547
12548
12549 int varFlags;
12550 if (!ctx.
Read(varFlags))
12551 return;
12552
12553 if (varFlags & ItemVariableFlags.FLOAT)
12554 {
12556 }
12557 }
12558
12560 {
12561
12562 super.SerializeNumericalVars(floats_out);
12563
12564
12565
12567 {
12569 }
12570
12572 {
12574 }
12575
12577 {
12579 }
12580
12582 {
12587 }
12588
12590 {
12592 }
12593 }
12594
12596 {
12597
12598 super.DeSerializeNumericalVars(floats);
12599
12600
12601 int index = 0;
12602 int mask = Math.Round(floats.Get(index));
12603
12604 index++;
12605
12607 {
12609 {
12611 }
12612 else
12613 {
12614 float quantity = floats.Get(index);
12615 SetQuantity(quantity,
true,
false,
false,
false);
12616 }
12617 index++;
12618 }
12619
12621 {
12622 float wet = floats.Get(index);
12624 index++;
12625 }
12626
12628 {
12629 int liquidtype = Math.Round(floats.Get(index));
12631 index++;
12632 }
12633
12635 {
12637 index++;
12639 index++;
12641 index++;
12643 index++;
12644 }
12645
12647 {
12648 int cleanness = Math.Round(floats.Get(index));
12650 index++;
12651 }
12652 }
12653
12655 {
12656 super.WriteVarsToCTX(ctx);
12657
12658
12660 {
12662 }
12663
12665 {
12667 }
12668
12670 {
12672 }
12673
12675 {
12676 int r,g,b,a;
12682 }
12683
12685 {
12687 }
12688 }
12689
12691 {
12692 if (!super.ReadVarsFromCTX(ctx,version))
12693 return false;
12694
12695 int intValue;
12696 float value;
12697
12698 if (version < 140)
12699 {
12700 if (!ctx.
Read(intValue))
12701 return false;
12702
12703 m_VariablesMask = intValue;
12704 }
12705
12707 {
12708 if (!ctx.
Read(value))
12709 return false;
12710
12712 {
12714 }
12715 else
12716 {
12718 }
12719 }
12720
12721 if (version < 140)
12722 {
12724 {
12725 if (!ctx.
Read(value))
12726 return false;
12727 SetTemperatureDirect(value);
12728 }
12729 }
12730
12732 {
12733 if (!ctx.
Read(value))
12734 return false;
12736 }
12737
12739 {
12740 if (!ctx.
Read(intValue))
12741 return false;
12743 }
12744
12746 {
12747 int r,g,b,a;
12749 return false;
12751 return false;
12753 return false;
12755 return false;
12756
12758 }
12759
12761 {
12762 if (!ctx.
Read(intValue))
12763 return false;
12765 }
12766
12767 if (version >= 138 && version < 140)
12768 {
12770 {
12771 if (!ctx.
Read(intValue))
12772 return false;
12773 SetFrozen(intValue);
12774 }
12775 }
12776
12777 return true;
12778 }
12779
12780
12782 {
12785 {
12787 }
12788
12789 if (!super.OnStoreLoad(ctx, version))
12790 {
12792 return false;
12793 }
12794
12795 if (version >= 114)
12796 {
12797 bool hasQuickBarIndexSaved;
12798
12799 if (!ctx.
Read(hasQuickBarIndexSaved))
12800 {
12802 return false;
12803 }
12804
12805 if (hasQuickBarIndexSaved)
12806 {
12807 int itmQBIndex;
12808
12809
12810 if (!ctx.
Read(itmQBIndex))
12811 {
12813 return false;
12814 }
12815
12816 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12817 if (itmQBIndex != -1 && parentPlayer)
12818 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12819 }
12820 }
12821 else
12822 {
12823
12824 PlayerBase player;
12825 int itemQBIndex;
12826 if (version ==
int.
MAX)
12827 {
12828 if (!ctx.
Read(itemQBIndex))
12829 {
12831 return false;
12832 }
12833 }
12834 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12835 {
12836
12837 if (!ctx.
Read(itemQBIndex))
12838 {
12840 return false;
12841 }
12842 if (itemQBIndex != -1 && player)
12843 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12844 }
12845 }
12846
12847 if (version < 140)
12848 {
12849
12850 if (!LoadVariables(ctx, version))
12851 {
12853 return false;
12854 }
12855 }
12856
12857
12859 {
12861 return false;
12862 }
12863 if (version >= 132)
12864 {
12866 if (raib)
12867 {
12869 {
12871 return false;
12872 }
12873 }
12874 }
12875
12877 return true;
12878 }
12879
12880
12881
12883 {
12884 super.OnStoreSave(ctx);
12885
12886 PlayerBase player;
12887 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12888 {
12890
12891 int itemQBIndex = -1;
12892 itemQBIndex = player.FindQuickBarEntityIndex(this);
12893 ctx.
Write(itemQBIndex);
12894 }
12895 else
12896 {
12898 }
12899
12901
12903 if (raib)
12904 {
12906 }
12907 }
12908
12909
12911 {
12912 super.AfterStoreLoad();
12913
12915 {
12917 }
12918
12920 {
12923 }
12924 }
12925
12927 {
12928 super.EEOnAfterLoad();
12929
12931 {
12933 }
12934
12937 }
12938
12940 {
12941 return false;
12942 }
12943
12944
12945
12947 {
12949 {
12950 #ifdef PLATFORM_CONSOLE
12951
12953 {
12955 if (menu)
12956 {
12958 }
12959 }
12960 #endif
12961 }
12962
12964 {
12967 }
12968
12970 {
12971 SetWeightDirty();
12973 }
12975 {
12978 }
12979
12981 {
12984
12987 }
12989 {
12993 }
12994
12995 super.OnVariablesSynchronized();
12996 }
12997
12998
12999
13001 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13002 {
13003 if (!IsServerCheck(allow_client))
13004 return false;
13005
13007 return false;
13008
13011
13012 if (value <= (min + 0.001))
13013 value = min;
13014
13015 if (value == min)
13016 {
13017 if (destroy_config)
13018 {
13019 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13020 if (dstr)
13021 {
13023 this.Delete();
13024 return true;
13025 }
13026 }
13027 else if (destroy_forced)
13028 {
13030 this.Delete();
13031 return true;
13032 }
13033
13035 }
13036
13039
13041 {
13042 EntityAI parent = GetHierarchyRoot();
13043 InventoryLocation iLoc = new InventoryLocation();
13044 GetInventory().GetCurrentInventoryLocation(iLoc);
13046 {
13047 int iLocSlot = iLoc.
GetSlot();
13049 {
13051 }
13053 {
13055 }
13056 }
13057 }
13058
13060 {
13062
13063 if (delta)
13065 }
13066
13068
13069 return false;
13070 }
13071
13072
13074 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13075 {
13077 }
13078
13080 {
13083 }
13084
13086 {
13089 }
13090
13092 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13093 {
13094 float value_clamped = Math.Clamp(value, 0, 1);
13096 SetQuantity(result, destroy_config, destroy_forced);
13097 }
13098
13099
13102 {
13104 }
13105
13107 {
13109 }
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13121 {
13122 int slot = -1;
13123 GameInventory inventory = GetInventory();
13124 if (inventory)
13125 {
13126 InventoryLocation il = new InventoryLocation;
13129 }
13130
13132 }
13133
13135 {
13136 float quantity_max = 0;
13137
13139 {
13140 if (attSlotID != -1)
13141 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13142
13143 if (quantity_max <= 0)
13145 }
13146
13147 if (quantity_max <= 0)
13149
13150 return quantity_max;
13151 }
13152
13154 {
13156 }
13157
13159 {
13161 }
13162
13163
13165 {
13167 }
13168
13170 {
13172 }
13173
13175 {
13177 }
13178
13179
13181 {
13182
13183 float weightEx = GetWeightEx();
13184 float special = GetInventoryAndCargoWeight();
13185 return weightEx - special;
13186 }
13187
13188
13190 {
13192 }
13193
13195 {
13197 {
13198 #ifdef DEVELOPER
13199 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13200 {
13201 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13203 }
13204 #endif
13205
13206 return GetQuantity() * GetConfigWeightModified();
13207 }
13208 else if (HasEnergyManager())
13209 {
13210 #ifdef DEVELOPER
13211 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13212 {
13213 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13214 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13215 }
13216 #endif
13217 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13218 }
13219 else
13220 {
13221 #ifdef DEVELOPER
13222 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13223 {
13224 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13225 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13226 }
13227 #endif
13228 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13229 }
13230 }
13231
13234 {
13235 int item_count = 0;
13237
13238 GameInventory inventory = GetInventory();
13239 CargoBase cargo = inventory.
GetCargo();
13240 if (cargo != NULL)
13241 {
13243 }
13244
13246 for (int i = 0; i < nAttachments; ++i)
13247 {
13249 if (item)
13250 item_count += item.GetNumberOfItems();
13251 }
13252 return item_count;
13253 }
13254
13257 {
13258 float weight = 0;
13259 float wetness = 1;
13260 if (include_wetness)
13263 {
13264 weight = wetness * m_ConfigWeight;
13265 }
13267 {
13268 weight = 1;
13269 }
13270 return weight;
13271 }
13272
13273
13274
13276 {
13277 GameInventory inventory = GetInventory();
13278 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13279 {
13280 array<EntityAI> items = new array<EntityAI>;
13282 for (int i = 0; i < items.Count(); ++i)
13283 {
13285 if (item)
13286 {
13287 g_Game.ObjectDelete(item);
13288 }
13289 }
13290 }
13291 }
13292
13293
13294
13295
13297 {
13298 float energy = 0;
13299 if (HasEnergyManager())
13300 {
13301 energy = GetCompEM().GetEnergy();
13302 }
13303 return energy;
13304 }
13305
13306
13308 {
13309 super.OnEnergyConsumed();
13310
13312 }
13313
13315 {
13316 super.OnEnergyAdded();
13317
13319 }
13320
13321
13323 {
13324 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13325 {
13327 {
13328 float energy_0to1 = GetCompEM().GetEnergy0To1();
13330 }
13331 }
13332 }
13333
13334
13336 {
13337 return ConfigGetFloat("heatIsolation");
13338 }
13339
13341 {
13343 }
13344
13346 {
13347 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13348 if (
g_Game.ConfigIsExisting(paramPath))
13349 return g_Game.ConfigGetFloat(paramPath);
13350
13351 return 0.0;
13352 }
13353
13355 {
13356 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13357 if (
g_Game.ConfigIsExisting(paramPath))
13358 return g_Game.ConfigGetFloat(paramPath);
13359
13360 return 0.0;
13361 }
13362
13363 override void SetWet(
float value,
bool allow_client =
false)
13364 {
13365 if (!IsServerCheck(allow_client))
13366 return;
13367
13370
13372
13373 m_VarWet = Math.Clamp(value, min, max);
13374
13376 {
13379 }
13380 }
13381
13382 override void AddWet(
float value)
13383 {
13385 }
13386
13388 {
13390 }
13391
13393 {
13395 }
13396
13398 {
13400 }
13401
13403 {
13405 }
13406
13408 {
13410 }
13411
13412 override void OnWetChanged(
float newVal,
float oldVal)
13413 {
13416 if (newLevel != oldLevel)
13417 {
13419 }
13420 }
13421
13423 {
13424 SetWeightDirty();
13425 }
13426
13428 {
13429 return GetWetLevelInternal(
m_VarWet);
13430 }
13431
13432
13433
13435 {
13437 }
13438
13440 {
13442 }
13443
13445 {
13447 }
13448
13450 {
13452 }
13453
13454
13455
13457 {
13458 if (ConfigIsExisting("itemModelLength"))
13459 {
13460 return ConfigGetFloat("itemModelLength");
13461 }
13462 return 0;
13463 }
13464
13466 {
13467 if (ConfigIsExisting("itemAttachOffset"))
13468 {
13469 return ConfigGetFloat("itemAttachOffset");
13470 }
13471 return 0;
13472 }
13473
13474 override void SetCleanness(
int value,
bool allow_client =
false)
13475 {
13476 if (!IsServerCheck(allow_client))
13477 return;
13478
13480
13482
13485 }
13486
13488 {
13490 }
13491
13493 {
13494 return true;
13495 }
13496
13497
13498
13499
13501 {
13503 }
13504
13506 {
13508 }
13509
13510
13511
13512
13513 override void SetColor(
int r,
int g,
int b,
int a)
13514 {
13520 }
13522 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13523 {
13528 }
13529
13531 {
13533 }
13534
13537 {
13538 int r,g,b,a;
13540 r = r/255;
13541 g = g/255;
13542 b = b/255;
13543 a = a/255;
13544 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13545 }
13546
13547
13548
13549 override void SetLiquidType(
int value,
bool allow_client =
false)
13550 {
13551 if (!IsServerCheck(allow_client))
13552 return;
13553
13558 }
13559
13561 {
13562 return ConfigGetInt("varLiquidTypeInit");
13563 }
13564
13566 {
13568 }
13569
13571 {
13573 SetFrozen(false);
13574 }
13575
13578 {
13579 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13580 }
13581
13582
13585 {
13586 PlayerBase nplayer;
13587 if (PlayerBase.CastTo(nplayer, player))
13588 {
13590 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13591 }
13592 }
13593
13594
13597 {
13598 PlayerBase nplayer;
13599 if (PlayerBase.CastTo(nplayer,player))
13600 {
13601 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13602 }
13603
13604 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13605
13606 if (HasEnergyManager())
13607 {
13608 GetCompEM().UpdatePlugState();
13609 }
13610 }
13611
13612
13614 {
13615 super.OnPlacementStarted(player);
13616
13618 }
13619
13620 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13621 {
13623 {
13624 m_AdminLog.OnPlacementComplete(player,
this);
13625 }
13626
13627 super.OnPlacementComplete(player, position, orientation);
13628 }
13629
13630
13631
13632
13633
13635 {
13637 {
13638 return true;
13639 }
13640 else
13641 {
13642 return false;
13643 }
13644 }
13645
13646
13648 {
13650 {
13652 }
13653 }
13654
13655
13657 {
13659 }
13660
13662 {
13664 }
13665
13666 override void InsertAgent(
int agent,
float count = 1)
13667 {
13668 if (count < 1)
13669 return;
13670
13672 }
13673
13676 {
13678 }
13679
13680
13682 {
13684 }
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13728 {
13730 return false;
13731 return true;
13732 }
13733
13735 {
13736
13738 }
13739
13740
13743 {
13744 super.CheckForRoofLimited(timeTresholdMS);
13745
13746 float time =
g_Game.GetTime();
13747 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13748 {
13749 m_PreviousRoofTestTime = time;
13750 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13751 }
13752 }
13753
13754
13756 {
13758 {
13759 return 0;
13760 }
13761
13762 if (GetInventory().GetAttachmentSlotsCount() != 0)
13763 {
13764 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13765 if (filter)
13766 return filter.GetProtectionLevel(type, false, system);
13767 else
13768 return 0;
13769 }
13770
13771 string subclassPath, entryName;
13772
13773 switch (type)
13774 {
13776 entryName = "biological";
13777 break;
13779 entryName = "chemical";
13780 break;
13781 default:
13782 entryName = "biological";
13783 break;
13784 }
13785
13786 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13787
13788 return g_Game.ConfigGetFloat(subclassPath + entryName);
13789 }
13790
13791
13792
13795 {
13796 if (!IsMagazine())
13798
13800 }
13801
13802
13803
13804
13805
13810 {
13811 return true;
13812 }
13813
13815 {
13817 }
13818
13819
13820
13821
13822
13824 {
13825 if (parent)
13826 {
13827 if (parent.IsInherited(DayZInfected))
13828 return true;
13829
13830 if (!parent.IsRuined())
13831 return true;
13832 }
13833
13834 return true;
13835 }
13836
13838 {
13839 if (!super.CanPutAsAttachment(parent))
13840 {
13841 return false;
13842 }
13843
13844 if (!IsRuined() && !parent.IsRuined())
13845 {
13846 return true;
13847 }
13848
13849 return false;
13850 }
13851
13853 {
13854
13855
13856
13857
13858 return super.CanReceiveItemIntoCargo(item);
13859 }
13860
13862 {
13863
13864
13865
13866
13867 GameInventory attachmentInv = attachment.GetInventory();
13869 {
13870 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13871 return false;
13872 }
13873
13874 InventoryLocation loc = new InventoryLocation();
13875 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13876 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13877 return false;
13878
13879 return super.CanReceiveAttachment(attachment, slotId);
13880 }
13881
13883 {
13884 if (!super.CanReleaseAttachment(attachment))
13885 return false;
13886
13887 return GetInventory().AreChildrenAccessible();
13888 }
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13911 {
13912 int id = muzzle_owner.GetMuzzleID();
13913 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13914
13915 if (WPOF_array)
13916 {
13917 for (int i = 0; i < WPOF_array.Count(); i++)
13918 {
13919 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13920
13921 if (WPOF)
13922 {
13923 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13924 }
13925 }
13926 }
13927 }
13928
13929
13931 {
13932 int id = muzzle_owner.GetMuzzleID();
13934
13935 if (WPOBE_array)
13936 {
13937 for (int i = 0; i < WPOBE_array.Count(); i++)
13938 {
13939 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13940
13941 if (WPOBE)
13942 {
13943 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13944 }
13945 }
13946 }
13947 }
13948
13949
13951 {
13952 int id = muzzle_owner.GetMuzzleID();
13953 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13954
13955 if (WPOOH_array)
13956 {
13957 for (int i = 0; i < WPOOH_array.Count(); i++)
13958 {
13959 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13960
13961 if (WPOOH)
13962 {
13963 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13964 }
13965 }
13966 }
13967 }
13968
13969
13971 {
13972 int id = muzzle_owner.GetMuzzleID();
13973 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13974
13975 if (WPOOH_array)
13976 {
13977 for (int i = 0; i < WPOOH_array.Count(); i++)
13978 {
13979 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13980
13981 if (WPOOH)
13982 {
13983 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13984 }
13985 }
13986 }
13987 }
13988
13989
13991 {
13992 int id = muzzle_owner.GetMuzzleID();
13993 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13994
13995 if (WPOOH_array)
13996 {
13997 for (int i = 0; i < WPOOH_array.Count(); i++)
13998 {
13999 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14000
14001 if (WPOOH)
14002 {
14003 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14004 }
14005 }
14006 }
14007 }
14008
14009
14010
14012 {
14014 {
14015 return true;
14016 }
14017
14018 return false;
14019 }
14020
14022 {
14024 {
14025 return true;
14026 }
14027
14028 return false;
14029 }
14030
14032 {
14034 {
14035 return true;
14036 }
14037
14038 return false;
14039 }
14040
14042 {
14043 return false;
14044 }
14045
14048 {
14049 return UATimeSpent.DEFAULT_DEPLOY;
14050 }
14051
14052
14053
14054
14056 {
14058 SetSynchDirty();
14059 }
14060
14062 {
14064 }
14065
14066
14068 {
14069 return false;
14070 }
14071
14074 {
14075 string att_type = "None";
14076
14077 if (ConfigIsExisting("soundAttType"))
14078 {
14079 att_type = ConfigGetString("soundAttType");
14080 }
14081
14083 }
14084
14086 {
14088 }
14089
14090
14091
14092
14093
14099
14101 {
14104
14106 }
14107
14108
14110 {
14112 return;
14113
14115
14118
14121
14122 SoundParameters params = new SoundParameters();
14126 }
14127
14128
14130 {
14132 {
14135
14136 SetSynchDirty();
14137
14140 }
14141 }
14142
14144 {
14146 }
14147
14148
14150 {
14152 return;
14153
14155 SetSynchDirty();
14156
14159 }
14160
14162 {
14165 }
14166
14168 {
14170 }
14171
14172 void OnApply(PlayerBase player);
14173
14175 {
14176 return 1.0;
14177 };
14178
14180 {
14182 }
14183
14185 {
14187 }
14188
14190
14192 {
14193 SetDynamicPhysicsLifeTime(0.01);
14195 }
14196
14198 {
14199 array<string> zone_names = new array<string>;
14200 GetDamageZones(zone_names);
14201 for (int i = 0; i < zone_names.Count(); i++)
14202 {
14203 SetHealthMax(zone_names.Get(i),"Health");
14204 }
14205 SetHealthMax("","Health");
14206 }
14207
14210 {
14211 float global_health = GetHealth01("","Health");
14212 array<string> zones = new array<string>;
14213 GetDamageZones(zones);
14214
14215 for (int i = 0; i < zones.Count(); i++)
14216 {
14217 SetHealth01(zones.Get(i),"Health",global_health);
14218 }
14219 }
14220
14223 {
14224 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14225 }
14226
14228 {
14229 if (!hasRootAsPlayer)
14230 {
14231 if (refParentIB)
14232 {
14233
14234 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14235 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14236
14237 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14238 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14239
14242 }
14243 else
14244 {
14245
14248 }
14249 }
14250 }
14251
14253 {
14255 {
14256 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14257 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14258 {
14259 float heatPermCoef = 1.0;
14261 while (ent)
14262 {
14263 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14264 ent = ent.GetHierarchyParent();
14265 }
14266
14267 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14268 }
14269 }
14270 }
14271
14273 {
14274
14275 EntityAI parent = GetHierarchyParent();
14276 if (!parent)
14277 {
14278 hasParent = false;
14279 hasRootAsPlayer = false;
14280 }
14281 else
14282 {
14283 hasParent = true;
14284 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14285 refParentIB =
ItemBase.Cast(parent);
14286 }
14287 }
14288
14289 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14290 {
14291
14292 }
14293
14295 {
14296
14297 return false;
14298 }
14299
14301 {
14302
14303
14304 return false;
14305 }
14306
14308 {
14309
14310 return false;
14311 }
14312
14315 {
14316 return !GetIsFrozen() &&
IsOpen();
14317 }
14318
14320 {
14321 bool hasParent = false, hasRootAsPlayer = false;
14323
14324 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14325 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14326
14327 if (wwtu || foodDecay)
14328 {
14332
14333 if (processWetness || processTemperature || processDecay)
14334 {
14336
14337 if (processWetness)
14338 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14339
14340 if (processTemperature)
14342
14343 if (processDecay)
14344 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14345 }
14346 }
14347 }
14348
14351 {
14353 }
14354
14356 {
14359
14360 return super.GetTemperatureFreezeThreshold();
14361 }
14362
14364 {
14367
14368 return super.GetTemperatureThawThreshold();
14369 }
14370
14372 {
14375
14376 return super.GetItemOverheatThreshold();
14377 }
14378
14380 {
14382 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14383
14384 return super.GetTemperatureFreezeTime();
14385 }
14386
14388 {
14390 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14391
14392 return super.GetTemperatureThawTime();
14393 }
14394
14399
14401 {
14402 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14403 }
14404
14406 {
14407 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14408 }
14409
14412 {
14414 }
14415
14417 {
14419 }
14420
14422 {
14424 }
14425
14428 {
14429 return null;
14430 }
14431
14434 {
14435 return false;
14436 }
14437
14439 {
14441 {
14444 if (!trg)
14445 {
14447 explosive = this;
14448 }
14449
14450 explosive.PairRemote(trg);
14452
14453 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14454 trg.SetPersistentPairID(persistentID);
14455 explosive.SetPersistentPairID(persistentID);
14456
14457 return true;
14458 }
14459 return false;
14460 }
14461
14464 {
14465 float ret = 1.0;
14468 ret *= GetHealth01();
14469
14470 return ret;
14471 }
14472
14473 #ifdef DEVELOPER
14474 override void SetDebugItem()
14475 {
14476 super.SetDebugItem();
14477 _itemBase = this;
14478 }
14479
14481 {
14482 string text = super.GetDebugText();
14483
14485 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14486
14487 return text;
14488 }
14489 #endif
14490
14492 {
14493 return true;
14494 }
14495
14497
14499
14501 {
14504 }
14505
14506
14514
14530
14531 [
Obsolete(
"Use ItemSoundHandler instead")]
14534 {
14535 if (!
g_Game.IsDedicatedServer())
14536 {
14537 if (ConfigIsExisting("attachSoundSet"))
14538 {
14539 string cfg_path = "";
14540 string soundset = "";
14541 string type_name =
GetType();
14542
14545 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14546 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14547
14548 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14549 {
14550 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14551 {
14552 if (cfg_slot_array[i] == slot_type)
14553 {
14554 soundset = cfg_soundset_array[i];
14555 break;
14556 }
14557 }
14558 }
14559
14560 if (soundset != "")
14561 {
14562 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14564 }
14565 }
14566 }
14567 }
14568
14570}
14571
14573{
14575 if (entity)
14576 {
14577 bool is_item = entity.IsInherited(
ItemBase);
14578 if (is_item && full_quantity)
14579 {
14582 }
14583 }
14584 else
14585 {
14587 return NULL;
14588 }
14589 return entity;
14590}
14591
14593{
14594 if (item)
14595 {
14596 if (health > 0)
14597 item.SetHealth("", "", health);
14598
14599 if (item.CanHaveTemperature())
14600 {
14602 if (item.CanFreeze())
14603 item.SetFrozen(false);
14604 }
14605
14606 if (item.HasEnergyManager())
14607 {
14608 if (quantity >= 0)
14609 {
14610 item.GetCompEM().SetEnergy0To1(quantity);
14611 }
14612 else
14613 {
14615 }
14616 }
14617 else if (item.IsMagazine())
14618 {
14619 Magazine mag = Magazine.Cast(item);
14620 if (quantity >= 0)
14621 {
14622 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14623 }
14624 else
14625 {
14627 }
14628
14629 }
14630 else
14631 {
14632 if (quantity >= 0)
14633 {
14634 item.SetQuantityNormalized(quantity, false);
14635 }
14636 else
14637 {
14639 }
14640
14641 }
14642 }
14643}
14644
14645#ifdef DEVELOPER
14647#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.