Plays sound on item attach. Be advised, the config structure may slightly change in 1.11 update to allow for more complex use.
9767{
9769 {
9770 return true;
9771 }
9772};
9773
9775{
9776
9777};
9778
9779
9780
9782{
9786
9788
9791
9792
9793
9794
9795
9804
9810
9815
9820
9841 protected bool m_IsResultOfSplit
9842
9844
9849
9850
9851
9853
9857
9858
9859
9861
9864
9865
9866
9872
9873
9881
9884
9885
9887
9888
9890
9891
9896
9897
9902
9904
9905
9907
9908
9910 {
9915
9916 if (!
g_Game.IsDedicatedServer())
9917 {
9919 {
9921
9923 {
9925 }
9926 }
9927
9930 }
9931
9932 m_OldLocation = null;
9933
9935 {
9937 }
9938
9939 if (ConfigIsExisting("headSelectionsToHide"))
9940 {
9943 }
9944
9946 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9947 {
9949 }
9950
9952
9953 m_IsResultOfSplit = false;
9954
9956 }
9957
9959 {
9960 super.InitItemVariables();
9961
9967 m_Count = ConfigGetInt(
"count");
9968
9971
9976
9979
9984
9996
10000
10001
10004 if (ConfigIsExisting("canBeSplit"))
10005 {
10008 }
10009
10011 if (ConfigIsExisting("itemBehaviour"))
10013
10014
10017 RegisterNetSyncVariableInt("m_VarLiquidType");
10018 RegisterNetSyncVariableInt("m_Cleanness",0,1);
10019
10020 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
10021 RegisterNetSyncVariableFloat("m_ImpactSpeed");
10022 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
10023
10024 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
10025 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
10026 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
10027 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
10028
10029 RegisterNetSyncVariableBool("m_IsBeingPlaced");
10030 RegisterNetSyncVariableBool("m_IsTakeable");
10031 RegisterNetSyncVariableBool("m_IsHologram");
10032
10035 {
10038 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10039 }
10040
10042
10044 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10046
10048 }
10049
10051 {
10053 }
10054
10056 {
10059 {
10064 }
10065 }
10066
10067 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10068 {
10070 {
10073 }
10074
10076 }
10077
10079 {
10085 }
10086
10088
10090 {
10092
10093 if (!action)
10094 {
10095 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10096 return;
10097 }
10098
10100 if (!ai)
10101 {
10103 return;
10104 }
10105
10107 if (!action_array)
10108 {
10109 action_array = new array<ActionBase_Basic>;
10111 }
10112 if (LogManager.IsActionLogEnable())
10113 {
10114 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10115 }
10116
10117 if (action_array.Find(action) != -1)
10118 {
10119 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10120 }
10121 else
10122 {
10123 action_array.Insert(action);
10124 }
10125 }
10126
10128 {
10129 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10130 ActionBase action = player.GetActionManager().GetAction(actionName);
10133
10134 if (action_array)
10135 {
10136 action_array.RemoveItem(action);
10137 }
10138 }
10139
10140
10141
10143 {
10144 ActionOverrideData overrideData = new ActionOverrideData();
10148
10150 if (!actionMap)
10151 {
10154 }
10155
10156 actionMap.Insert(this.
Type(), overrideData);
10157
10158 }
10159
10161
10163
10164
10166 {
10169
10172
10173 string config_to_search = "CfgVehicles";
10174 string muzzle_owner_config;
10175
10177 {
10178 if (IsInherited(Weapon))
10179 config_to_search = "CfgWeapons";
10180
10181 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10182
10183 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10184
10185 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10186
10187 if (config_OnFire_subclass_count > 0)
10188 {
10189 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10190
10191 for (int i = 0; i < config_OnFire_subclass_count; i++)
10192 {
10193 string particle_class = "";
10194 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10195 string config_OnFire_entry = config_OnFire_class + particle_class;
10196 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10197 WPOF_array.Insert(WPOF);
10198 }
10199
10200
10202 }
10203 }
10204
10206 {
10207 config_to_search = "CfgWeapons";
10208 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10209
10210 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10211
10212 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10213
10214 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10215 {
10216 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10217
10218 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10219 {
10220 string particle_class2 = "";
10221 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10222 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10223 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10224 WPOBE_array.Insert(WPOBE);
10225 }
10226
10227
10229 }
10230 }
10231 }
10232
10233
10235 {
10238
10240 {
10241 string config_to_search = "CfgVehicles";
10242
10243 if (IsInherited(Weapon))
10244 config_to_search = "CfgWeapons";
10245
10246 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10247 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10248
10249 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10250 {
10251
10253
10255 {
10257 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10259 return;
10260 }
10261
10264
10265
10266
10267 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10268 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10269
10270 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10271 {
10272 string particle_class = "";
10273 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10274 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10275 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10276
10277 if (entry_type == CT_CLASS)
10278 {
10279 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10280 WPOOH_array.Insert(WPOF);
10281 }
10282 }
10283
10284
10286 }
10287 }
10288 }
10289
10291 {
10293 }
10294
10296 {
10298 {
10300
10303
10306
10307 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10308 }
10309 }
10310
10312 {
10314 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10315
10317 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10318
10320 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10321
10323 {
10325 }
10326 }
10327
10329 {
10331 }
10332
10334 {
10337 else
10339
10341 {
10344 }
10345 else
10346 {
10349
10352 }
10353
10355 }
10356
10358 {
10360 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10361 }
10362
10364 {
10366 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10368 }
10369
10371 {
10373 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10374 }
10375
10377 {
10380
10381 OverheatingParticle OP = new OverheatingParticle();
10386
10388 }
10389
10391 {
10394
10395 return -1;
10396 }
10397
10399 {
10401 {
10404
10405 for (int i = count; i > 0; --i)
10406 {
10407 int id = i - 1;
10410
10413
10414 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10415 {
10416 if (p)
10417 {
10420 }
10421 }
10422 }
10423 }
10424 }
10425
10427 {
10429 {
10431 {
10432 int id = i - 1;
10434
10435 if (OP)
10436 {
10438
10439 if (p)
10440 {
10442 }
10443
10444 delete OP;
10445 }
10446 }
10447
10450 }
10451 }
10452
10455 {
10456 return 0.0;
10457 }
10458
10459
10461 {
10462 return 250;
10463 }
10464
10466 {
10467 return 0;
10468 }
10469
10472 {
10474 return true;
10475
10476 return false;
10477 }
10478
10481 {
10484
10486 {
10488 }
10489 else
10490 {
10491
10493 }
10494
10496 }
10497
10504 {
10505 return -1;
10506 }
10507
10508
10509
10510
10512 {
10514 {
10515 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10516 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10517
10518 if (r_index >= 0)
10519 {
10520 InventoryLocation r_il = new InventoryLocation;
10521 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10522
10523 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10526 {
10527 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10528 }
10530 {
10531 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10532 }
10533
10534 }
10535
10536 player.GetHumanInventory().ClearUserReservedLocation(this);
10537 }
10538
10541 }
10542
10543
10544
10545
10547 {
10548 return ItemBase.m_DebugActionsMask;
10549 }
10550
10552 {
10553 return ItemBase.m_DebugActionsMask & mask;
10554 }
10555
10557 {
10558 ItemBase.m_DebugActionsMask = mask;
10559 }
10560
10562 {
10563 ItemBase.m_DebugActionsMask |= mask;
10564 }
10565
10567 {
10568 ItemBase.m_DebugActionsMask &= ~mask;
10569 }
10570
10572 {
10574 {
10576 }
10577 else
10578 {
10580 }
10581 }
10582
10583
10585 {
10586 if (GetEconomyProfile())
10587 {
10588 float q_max = GetEconomyProfile().GetQuantityMax();
10589 if (q_max > 0)
10590 {
10591 float q_min = GetEconomyProfile().GetQuantityMin();
10592 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10593
10595 {
10596 ComponentEnergyManager comp = GetCompEM();
10598 {
10600 }
10601 }
10603 {
10605
10606 }
10607
10608 }
10609 }
10610 }
10611
10614 {
10615 EntityAI parent = GetHierarchyParent();
10616
10617 if (parent)
10618 {
10619 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10620 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10621 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10622 }
10623 }
10624
10627 {
10628 EntityAI parent = GetHierarchyParent();
10629
10630 if (parent)
10631 {
10632 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10633 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10634 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10635 }
10636 }
10637
10639 {
10640
10641
10642
10643
10645
10647 {
10648 if (ScriptInputUserData.CanStoreInputUserData())
10649 {
10650 ScriptInputUserData ctx = new ScriptInputUserData;
10656 ctx.
Write(use_stack_max);
10659
10661 {
10662 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10663 }
10664 }
10665 }
10666 else if (!
g_Game.IsMultiplayer())
10667 {
10669 }
10670 }
10671
10673 {
10675 }
10676
10678 {
10680 }
10681
10683 {
10685 }
10686
10688 {
10689
10690 return false;
10691 }
10692
10694 {
10695 return false;
10696 }
10697
10701 {
10702 return false;
10703 }
10704
10706 {
10707 return "";
10708 }
10709
10711
10713 {
10714 return false;
10715 }
10716
10718 {
10719 return true;
10720 }
10721
10722
10723
10725 {
10726 return true;
10727 }
10728
10730 {
10731 return true;
10732 }
10733
10735 {
10736 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10738 }
10739
10741 {
10743 }
10744
10746 {
10748 if (!is_being_placed)
10750 SetSynchDirty();
10751 }
10752
10753
10755
10757 {
10759 }
10760
10762 {
10764 }
10765
10767 {
10768 return 1;
10769 }
10770
10772 {
10773 return false;
10774 }
10775
10777 {
10779 SetSynchDirty();
10780 }
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10817 {
10818 super.OnMovedInsideCargo(container);
10819
10820 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10821 }
10822
10823 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10824 {
10825 super.EEItemLocationChanged(oldLoc, newLoc);
10826
10827 PlayerBase newPlayer = null;
10828 PlayerBase oldPlayer = null;
10829
10830 if (newLoc.GetParent())
10831 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10832
10833 if (oldLoc.GetParent())
10834 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10835
10837 {
10838 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10839
10840 if (rIndex >= 0)
10841 {
10842 InventoryLocation rIl = new InventoryLocation;
10843 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10844
10845 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10848 {
10849 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10850 }
10852 {
10854 }
10855
10856 }
10857 }
10858
10860 {
10861 if (newPlayer)
10862 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10863
10864 if (newPlayer == oldPlayer)
10865 {
10866 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10867 {
10869 {
10870 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10871 {
10872 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10873 }
10874 }
10875 else
10876 {
10877 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10878 }
10879 }
10880
10881 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10882 {
10883 int type = oldLoc.GetType();
10885 {
10886 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10887 }
10889 {
10890 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10891 }
10892 }
10893 if (!m_OldLocation)
10894 {
10895 m_OldLocation = new InventoryLocation;
10896 }
10897 m_OldLocation.Copy(oldLoc);
10898 }
10899 else
10900 {
10901 if (m_OldLocation)
10902 {
10903 m_OldLocation.Reset();
10904 }
10905 }
10906
10907 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10908 }
10909 else
10910 {
10911 if (newPlayer)
10912 {
10913 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10914 if (resIndex >= 0)
10915 {
10916 InventoryLocation il = new InventoryLocation;
10917 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10919 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10922 {
10923 il.
GetParent().GetOnReleaseLock().Invoke(it);
10924 }
10926 {
10928 }
10929
10930 }
10931 }
10933 {
10934
10936 }
10937
10938 if (m_OldLocation)
10939 {
10940 m_OldLocation.Reset();
10941 }
10942 }
10943
10945 {
10946 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10947 }
10948
10950 {
10951 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10952 }
10953 }
10954
10955 override void EOnContact(IEntity other, Contact extra)
10956 {
10958 {
10959 int liquidType = -1;
10961 if (impactSpeed > 0.0)
10962 {
10964 #ifndef SERVER
10966 #else
10968 SetSynchDirty();
10969 #endif
10971 }
10972 }
10973
10974 #ifdef SERVER
10975 if (GetCompEM() && GetCompEM().IsPlugged())
10976 {
10977 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10978 GetCompEM().UnplugThis();
10979 }
10980 #endif
10981 }
10982
10984
10986 {
10988 }
10989
10991 {
10992
10993 }
10994
10996 {
10997 super.OnItemLocationChanged(old_owner, new_owner);
10998
10999 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
11000 PlayerBase playerNew = PlayerBase.Cast(new_owner);
11001
11002 if (!relatedPlayer && playerNew)
11003 relatedPlayer = playerNew;
11004
11005 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
11006 {
11008 if (actionMgr)
11009 {
11010 ActionBase currentAction = actionMgr.GetRunningAction();
11011 if (currentAction)
11013 }
11014 }
11015
11016 Man ownerPlayerOld = null;
11017 Man ownerPlayerNew = null;
11018
11019 if (old_owner)
11020 {
11021 if (old_owner.
IsMan())
11022 {
11023 ownerPlayerOld = Man.Cast(old_owner);
11024 }
11025 else
11026 {
11027 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
11028 }
11029 }
11030 else
11031 {
11033 {
11035
11036 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11037 {
11038 GetCompEM().UnplugThis();
11039 }
11040 }
11041 }
11042
11043 if (new_owner)
11044 {
11045 if (new_owner.
IsMan())
11046 {
11047 ownerPlayerNew = Man.Cast(new_owner);
11048 }
11049 else
11050 {
11051 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11052 }
11053 }
11054
11055 if (ownerPlayerOld != ownerPlayerNew)
11056 {
11057 if (ownerPlayerOld)
11058 {
11059 array<EntityAI> subItemsExit = new array<EntityAI>;
11061 for (int i = 0; i < subItemsExit.Count(); i++)
11062 {
11065 }
11066 }
11067
11068 if (ownerPlayerNew)
11069 {
11070 array<EntityAI> subItemsEnter = new array<EntityAI>;
11072 for (int j = 0; j < subItemsEnter.Count(); j++)
11073 {
11076 }
11077 }
11078 }
11079 else if (ownerPlayerNew != null)
11080 {
11081 PlayerBase nplayer;
11082 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11083 {
11084 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11086 for (int k = 0; k < subItemsUpdate.Count(); k++)
11087 {
11089 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11090 }
11091 }
11092 }
11093
11094 if (old_owner)
11095 old_owner.OnChildItemRemoved(this);
11096 if (new_owner)
11097 new_owner.OnChildItemReceived(this);
11098 }
11099
11100
11102 {
11103 super.EEDelete(parent);
11104 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11105 if (player)
11106 {
11108
11109 if (player.IsAlive())
11110 {
11111 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11112 if (r_index >= 0)
11113 {
11114 InventoryLocation r_il = new InventoryLocation;
11115 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11116
11117 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11120 {
11121 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11122 }
11124 {
11125 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11126 }
11127
11128 }
11129
11130 player.RemoveQuickBarEntityShortcut(this);
11131 }
11132 }
11133 }
11134
11136 {
11137 super.EEKilled(killer);
11138
11141 {
11142 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11143 {
11144 if (IsMagazine())
11145 {
11146 if (Magazine.Cast(this).GetAmmoCount() > 0)
11147 {
11149 }
11150 }
11151 else
11152 {
11154 }
11155 }
11156 }
11157 }
11158
11160 {
11161 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11162
11163 super.OnWasAttached(parent, slot_id);
11164
11167
11170 }
11171
11173 {
11174 super.OnWasDetached(parent, slot_id);
11175
11178
11181 }
11182
11184 {
11185 int idx;
11188
11189 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11190 if (inventory_slots.Count() < 1)
11191 {
11192 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11193 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11194 }
11195 else
11196 {
11197 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11198 }
11199
11200 idx = inventory_slots.Find(slot);
11201 if (idx < 0)
11202 return "";
11203
11204 return attach_types.Get(idx);
11205 }
11206
11208 {
11209 int idx = -1;
11210 string slot;
11211
11214
11215 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11216 if (inventory_slots.Count() < 1)
11217 {
11218 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11219 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11220 }
11221 else
11222 {
11223 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11224 if (detach_types.Count() < 1)
11225 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11226 }
11227
11228 for (int i = 0; i < inventory_slots.Count(); i++)
11229 {
11230 slot = inventory_slots.Get(i);
11231 }
11232
11233 if (slot != "")
11234 {
11235 if (detach_types.Count() == 1)
11236 idx = 0;
11237 else
11238 idx = inventory_slots.Find(slot);
11239 }
11240 if (idx < 0)
11241 return "";
11242
11243 return detach_types.Get(idx);
11244 }
11245
11247 {
11248
11250
11251
11252 float min_time = 1;
11253 float max_time = 3;
11254 float delay = Math.RandomFloat(min_time, max_time);
11255
11256 explode_timer.Run(delay, this, "DoAmmoExplosion");
11257 }
11258
11260 {
11261 Magazine magazine = Magazine.Cast(this);
11262 int pop_sounds_count = 6;
11263 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11264
11265
11266 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11267 string sound_name = pop_sounds[ sound_idx ];
11268 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11269
11270
11271 magazine.ServerAddAmmoCount(-1);
11272
11273
11274 float min_temp_to_explode = 100;
11275
11276 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11277 {
11279 }
11280 }
11281
11282
11283 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11284 {
11285 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11286
11287 const int CHANCE_DAMAGE_CARGO = 4;
11288 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11289 const int CHANCE_DAMAGE_NOTHING = 2;
11290
11292 {
11293 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11294 int chances;
11295 int rnd;
11296
11297 if (GetInventory().GetCargo())
11298 {
11299 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11300 rnd = Math.RandomInt(0,chances);
11301
11302 if (rnd < CHANCE_DAMAGE_CARGO)
11303 {
11305 }
11306 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11307 {
11309 }
11310 }
11311 else
11312 {
11313 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11314 rnd = Math.RandomInt(0,chances);
11315
11316 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11317 {
11319 }
11320 }
11321 }
11322 }
11323
11325 {
11326 CargoBase cargo = GetInventory().GetCargo();
11327 if (cargo)
11328 {
11330 if (item_count > 0)
11331 {
11332 int random_pick = Math.RandomInt(0, item_count);
11334 if (!item.IsExplosive())
11335 {
11336 item.AddHealth("","",damage);
11337 return true;
11338 }
11339 }
11340 }
11341 return false;
11342 }
11343
11345 {
11346 GameInventory inventory = GetInventory();
11348 if (attachment_count > 0)
11349 {
11350 int random_pick = Math.RandomInt(0, attachment_count);
11352 if (!attachment.IsExplosive())
11353 {
11354 attachment.AddHealth("","",damage);
11355 return true;
11356 }
11357 }
11358 return false;
11359 }
11360
11362 {
11364 }
11365
11367 {
11369 return GetInventory().CanRemoveEntity();
11370
11371 return false;
11372 }
11373
11375 {
11376
11378 return false;
11379
11380
11382 return false;
11383
11384
11385
11387 if (delta == 0)
11388 return false;
11389
11390
11391 return true;
11392 }
11393
11395 {
11397 {
11398 if (ScriptInputUserData.CanStoreInputUserData())
11399 {
11400 ScriptInputUserData ctx = new ScriptInputUserData;
11405 ctx.
Write(destination_entity);
11407 ctx.
Write(slot_id);
11409 }
11410 }
11411 else if (!
g_Game.IsMultiplayer())
11412 {
11414 }
11415 }
11416
11418 {
11419 float split_quantity_new;
11423 InventoryLocation loc = new InventoryLocation;
11424
11425 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11426 {
11428 split_quantity_new = stack_max;
11429 else
11431
11433 {
11434 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11435 if (new_item)
11436 {
11437 new_item.SetResultOfSplit(true);
11438 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11440 new_item.
SetQuantity(split_quantity_new,
false,
true);
11441 }
11442 }
11443 }
11444 else if (destination_entity && slot_id == -1)
11445 {
11446 if (quantity > stack_max)
11447 split_quantity_new = stack_max;
11448 else
11449 split_quantity_new = quantity;
11450
11452 {
11453 GameInventory destinationInventory = destination_entity.GetInventory();
11455 {
11458 }
11459
11460 if (new_item)
11461 {
11462 new_item.SetResultOfSplit(true);
11463 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11465 new_item.
SetQuantity(split_quantity_new,
false,
true);
11466 }
11467 }
11468 }
11469 else
11470 {
11471 if (stack_max != 0)
11472 {
11474 {
11476 }
11477
11478 if (split_quantity_new == 0)
11479 {
11480 if (!
g_Game.IsMultiplayer())
11481 player.PhysicalPredictiveDropItem(this);
11482 else
11483 player.ServerDropEntity(this);
11484 return;
11485 }
11486
11488 {
11490
11491 if (new_item)
11492 {
11493 new_item.SetResultOfSplit(true);
11494 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11497 new_item.PlaceOnSurface();
11498 }
11499 }
11500 }
11501 }
11502 }
11503
11505 {
11506 float split_quantity_new;
11510 InventoryLocation loc = new InventoryLocation;
11511
11512 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11513 {
11515 split_quantity_new = stack_max;
11516 else
11518
11520 {
11521 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11522 if (new_item)
11523 {
11524 new_item.SetResultOfSplit(true);
11525 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11527 new_item.
SetQuantity(split_quantity_new,
false,
true);
11528 }
11529 }
11530 }
11531 else if (destination_entity && slot_id == -1)
11532 {
11533 if (quantity > stack_max)
11534 split_quantity_new = stack_max;
11535 else
11536 split_quantity_new = quantity;
11537
11539 {
11540 GameInventory destinationInventory = destination_entity.GetInventory();
11542 {
11545 }
11546
11547 if (new_item)
11548 {
11549 new_item.SetResultOfSplit(true);
11550 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11552 new_item.
SetQuantity(split_quantity_new,
false,
true);
11553 }
11554 }
11555 }
11556 else
11557 {
11558 if (stack_max != 0)
11559 {
11561 {
11563 }
11564
11566 {
11568
11569 if (new_item)
11570 {
11571 new_item.SetResultOfSplit(true);
11572 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11575 new_item.PlaceOnSurface();
11576 }
11577 }
11578 }
11579 }
11580 }
11581
11583 {
11585 {
11586 if (ScriptInputUserData.CanStoreInputUserData())
11587 {
11588 ScriptInputUserData ctx = new ScriptInputUserData;
11593 dst.WriteToContext(ctx);
11595 }
11596 }
11597 else if (!
g_Game.IsMultiplayer())
11598 {
11600 }
11601 }
11602
11604 {
11606 {
11607 if (ScriptInputUserData.CanStoreInputUserData())
11608 {
11609 ScriptInputUserData ctx = new ScriptInputUserData;
11614 ctx.
Write(destination_entity);
11620 }
11621 }
11622 else if (!
g_Game.IsMultiplayer())
11623 {
11625 }
11626 }
11627
11629 {
11631 }
11632
11634 {
11636 float split_quantity_new;
11638 if (dst.IsValid())
11639 {
11640 int slot_id = dst.GetSlot();
11642
11643 if (quantity > stack_max)
11644 split_quantity_new = stack_max;
11645 else
11646 split_quantity_new = quantity;
11647
11649 {
11651
11652 if (new_item)
11653 {
11654 new_item.SetResultOfSplit(true);
11655 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11657 new_item.
SetQuantity(split_quantity_new,
false,
true);
11658 }
11659
11660 return new_item;
11661 }
11662 }
11663
11664 return null;
11665 }
11666
11668 {
11670 float split_quantity_new;
11672 if (destination_entity)
11673 {
11675 if (quantity > stackable)
11676 split_quantity_new = stackable;
11677 else
11678 split_quantity_new = quantity;
11679
11681 {
11682 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11683 if (new_item)
11684 {
11685 new_item.SetResultOfSplit(true);
11686 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11688 new_item.
SetQuantity(split_quantity_new,
false,
true);
11689 }
11690 }
11691 }
11692 }
11693
11695 {
11697 {
11698 if (ScriptInputUserData.CanStoreInputUserData())
11699 {
11700 ScriptInputUserData ctx = new ScriptInputUserData;
11705 ItemBase destination_entity =
this;
11706 ctx.
Write(destination_entity);
11710 }
11711 }
11712 else if (!
g_Game.IsMultiplayer())
11713 {
11715 }
11716 }
11717
11719 {
11721 float split_quantity_new;
11723 if (player)
11724 {
11726 if (quantity > stackable)
11727 split_quantity_new = stackable;
11728 else
11729 split_quantity_new = quantity;
11730
11732 {
11733 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11734 new_item =
ItemBase.Cast(in_hands);
11735 if (new_item)
11736 {
11737 new_item.SetResultOfSplit(true);
11738 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11740 new_item.SetQuantity(split_quantity_new, false, true);
11741 }
11742 }
11743 }
11744 }
11745
11747 {
11749 float split_quantity_new = Math.Floor(quantity * 0.5);
11750
11752 return;
11753
11755
11756 if (new_item)
11757 {
11758 if (new_item.GetQuantityMax() < split_quantity_new)
11759 {
11760 split_quantity_new = new_item.GetQuantityMax();
11761 }
11762
11763 new_item.SetResultOfSplit(true);
11764 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11765
11767 {
11770 }
11771 else
11772 {
11774 new_item.
SetQuantity(split_quantity_new,
false,
true);
11775 }
11776 }
11777 }
11778
11780 {
11782 float split_quantity_new = Math.Floor(quantity / 2);
11783
11785 return;
11786
11787 InventoryLocation invloc = new InventoryLocation;
11789
11791 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11792
11793 if (new_item)
11794 {
11795 if (new_item.GetQuantityMax() < split_quantity_new)
11796 {
11797 split_quantity_new = new_item.GetQuantityMax();
11798 }
11800 {
11803 }
11804 else if (split_quantity_new > 1)
11805 {
11807 new_item.
SetQuantity(split_quantity_new,
false,
true);
11808 }
11809 }
11810 }
11811
11814 {
11815 SetWeightDirty();
11817
11818 if (parent)
11819 parent.OnAttachmentQuantityChangedEx(this, delta);
11820
11822 {
11824 {
11826 }
11828 {
11829 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11831 }
11832 }
11833 }
11834
11837 {
11838
11839 }
11840
11843 {
11845 }
11846
11848 {
11849 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11850
11852 {
11853 if (newLevel == GameConstants.STATE_RUINED)
11854 {
11856 EntityAI parent = GetHierarchyParent();
11857 if (parent && parent.IsFireplace())
11858 {
11859 CargoBase cargo = GetInventory().GetCargo();
11860 if (cargo)
11861 {
11863 {
11865 }
11866 }
11867 }
11868 }
11869
11871 {
11872
11874 return;
11875 }
11876
11877 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11878 {
11880 }
11881 }
11882 }
11883
11884
11886 {
11887 super.OnRightClick();
11888
11890 {
11892 {
11893 if (ScriptInputUserData.CanStoreInputUserData())
11894 {
11895 EntityAI root = GetHierarchyRoot();
11896 Man playerOwner = GetHierarchyRootPlayer();
11897 InventoryLocation dst = new InventoryLocation;
11898
11899
11900 if (!playerOwner && root && root == this)
11901 {
11903 }
11904 else
11905 {
11906
11907 GetInventory().GetCurrentInventoryLocation(dst);
11909 {
11910 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11912 {
11914 }
11915 else
11916 {
11918
11919
11920 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11921 {
11923 }
11924 else
11925 {
11926 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11927 }
11928 }
11929 }
11930 }
11931
11932 ScriptInputUserData ctx = new ScriptInputUserData;
11940 }
11941 }
11942 else if (!
g_Game.IsMultiplayer())
11943 {
11945 }
11946 }
11947 }
11948
11950 {
11951 if (root)
11952 {
11953 vector m4[4];
11954 root.GetTransform(m4);
11955 dst.SetGround(this, m4);
11956 }
11957 else
11958 {
11959 GetInventory().GetCurrentInventoryLocation(dst);
11960 }
11961 }
11962
11963 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11964 {
11965
11966 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11967 return false;
11968
11969 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11970 return false;
11971
11972
11974 return false;
11975
11976
11977 Magazine mag = Magazine.Cast(this);
11978 if (mag)
11979 {
11980 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11981 return false;
11982
11983 if (stack_max_limit)
11984 {
11985 Magazine other_mag = Magazine.Cast(other_item);
11986 if (other_item)
11987 {
11988 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11989 return false;
11990 }
11991
11992 }
11993 }
11994 else
11995 {
11996
11998 return false;
11999
12001 return false;
12002 }
12003
12004 PlayerBase player = null;
12005 if (CastTo(player, GetHierarchyRootPlayer()))
12006 {
12007 if (player.GetInventory().HasAttachment(this))
12008 return false;
12009
12010 if (player.IsItemsToDelete())
12011 return false;
12012 }
12013
12014 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
12015 return false;
12016
12017 int slotID;
12019 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
12020 return false;
12021
12022 return true;
12023 }
12024
12026 {
12028 }
12029
12031 {
12032 return m_IsResultOfSplit;
12033 }
12034
12036 {
12037 m_IsResultOfSplit = value;
12038 }
12039
12041 {
12043 }
12044
12046 {
12047 float other_item_quantity = other_item.GetQuantity();
12048 float this_free_space;
12049
12051
12053
12054 if (other_item_quantity > this_free_space)
12055 {
12056 return this_free_space;
12057 }
12058 else
12059 {
12060 return other_item_quantity;
12061 }
12062 }
12063
12065 {
12067 }
12068
12070 {
12072 return;
12073
12074 if (!IsMagazine() && other_item)
12075 {
12077 if (quantity_used != 0)
12078 {
12079 float hp1 = GetHealth01("","");
12080 float hp2 = other_item.GetHealth01("","");
12081 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12082 hpResult = hpResult / (
GetQuantity() + quantity_used);
12083
12084 hpResult *= GetMaxHealth();
12085 Math.Round(hpResult);
12086 SetHealth("", "Health", hpResult);
12087
12089 other_item.AddQuantity(-quantity_used);
12090 }
12091 }
12093 }
12094
12096 {
12097 #ifdef SERVER
12098 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12099 GetHierarchyParent().IncreaseLifetimeUp();
12100 #endif
12101 };
12102
12104 {
12105 PlayerBase p = PlayerBase.Cast(player);
12106
12107 array<int> recipesIds = p.m_Recipes;
12108 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12109 if (moduleRecipesManager)
12110 {
12111 EntityAI itemInHands = player.GetEntityInHands();
12112 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12113 }
12114
12115 for (int i = 0;i < recipesIds.Count(); i++)
12116 {
12117 int key = recipesIds.Get(i);
12118 string recipeName = moduleRecipesManager.GetRecipeName(key);
12120 }
12121 }
12122
12123
12124 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12125 {
12126 super.GetDebugActions(outputList);
12127
12128
12134
12135
12140
12145
12146
12150
12151
12153 {
12157 }
12158
12161
12162
12166
12168
12169 InventoryLocation loc = new InventoryLocation();
12170 GetInventory().GetCurrentInventoryLocation(loc);
12172 {
12173 if (Gizmo_IsSupported())
12176 }
12177
12179 }
12180
12181
12182
12183
12185 {
12186 super.OnAction(action_id, player, ctx);
12187
12189 {
12190 switch (action_id)
12191 {
12195 return true;
12199 return true;
12200 }
12201 }
12202
12204 {
12205 switch (action_id)
12206 {
12208 Delete();
12209 return true;
12210 }
12211 }
12212
12213 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12214 {
12215 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12216 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12217 PlayerBase p = PlayerBase.Cast(player);
12218 if (
EActions.RECIPES_RANGE_START < 1000)
12219 {
12220 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12221 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12222 }
12223 }
12224 #ifndef SERVER
12225 else if (action_id ==
EActions.WATCH_PLAYER)
12226 {
12227 PluginDeveloper.SetDeveloperItemClientEx(player);
12228 }
12229 #endif
12231 {
12232 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12233 {
12234 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12235 OnDebugButtonPressServer(id + 1);
12236 }
12237
12238 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12239 {
12240 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12242 }
12243
12244 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12245 {
12246 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12248 }
12249
12250 else if (action_id ==
EActions.ADD_QUANTITY)
12251 {
12252 if (IsMagazine())
12253 {
12254 Magazine mag = Magazine.Cast(this);
12255 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12256 }
12257 else
12258 {
12260 }
12261
12262 if (m_EM)
12263 {
12264 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12265 }
12266
12267 }
12268
12269 else if (action_id ==
EActions.REMOVE_QUANTITY)
12270 {
12271 if (IsMagazine())
12272 {
12273 Magazine mag2 = Magazine.Cast(this);
12274 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12275 }
12276 else
12277 {
12279 }
12280 if (m_EM)
12281 {
12282 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12283 }
12284
12285 }
12286
12287 else if (action_id ==
EActions.SET_QUANTITY_0)
12288 {
12290
12291 if (m_EM)
12292 {
12293 m_EM.SetEnergy(0);
12294 }
12295 }
12296
12297 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12298 {
12300
12301 if (m_EM)
12302 {
12303 m_EM.SetEnergy(m_EM.GetEnergyMax());
12304 }
12305 }
12306
12307 else if (action_id ==
EActions.ADD_HEALTH)
12308 {
12309 AddHealth("","",GetMaxHealth("","Health")/5);
12310 }
12311 else if (action_id ==
EActions.REMOVE_HEALTH)
12312 {
12313 AddHealth("","",-GetMaxHealth("","Health")/5);
12314 }
12315 else if (action_id ==
EActions.DESTROY_HEALTH)
12316 {
12317 SetHealth01("","",0);
12318 }
12319 else if (action_id ==
EActions.WATCH_ITEM)
12320 {
12322 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12323 #ifdef DEVELOPER
12324 SetDebugDeveloper_item(this);
12325 #endif
12326 }
12327
12328 else if (action_id ==
EActions.ADD_TEMPERATURE)
12329 {
12330 AddTemperature(20);
12331
12332 }
12333
12334 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12335 {
12336 AddTemperature(-20);
12337
12338 }
12339
12340 else if (action_id ==
EActions.FLIP_FROZEN)
12341 {
12342 SetFrozen(!GetIsFrozen());
12343
12344 }
12345
12346 else if (action_id ==
EActions.ADD_WETNESS)
12347 {
12349
12350 }
12351
12352 else if (action_id ==
EActions.REMOVE_WETNESS)
12353 {
12355
12356 }
12357
12358 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12359 {
12362
12363
12364 }
12365
12366 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12367 {
12370 }
12371
12372 else if (action_id ==
EActions.MAKE_SPECIAL)
12373 {
12374 auto debugParams = DebugSpawnParams.WithPlayer(player);
12375 OnDebugSpawnEx(debugParams);
12376 }
12377
12378 }
12379
12380
12381 return false;
12382 }
12383
12384
12385
12386
12390
12393
12394
12395
12397 {
12398 return false;
12399 }
12400
12401
12403 {
12404 return true;
12405 }
12406
12407
12409 {
12410 return true;
12411 }
12412
12413
12414
12416 {
12417 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12418 return g_Game.ConfigIsExisting(config_path);
12419 }
12420
12423 {
12424 return null;
12425 }
12426
12428 {
12429 return false;
12430 }
12431
12433 {
12434 return false;
12435 }
12436
12440
12441
12443 {
12444 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12445 return module_repairing.CanRepair(this, item_repair_kit);
12446 }
12447
12448
12449 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12450 {
12451 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12452 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12453 }
12454
12455
12457 {
12458
12459
12460
12461
12462
12463
12464
12465
12466 return 1;
12467 }
12468
12469
12470
12472 {
12474 }
12475
12476
12477
12479 {
12481 }
12482
12483
12492 {
12493 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12494
12495 if (player)
12496 {
12497 player.MessageStatus(text);
12498 }
12499 }
12500
12501
12510 {
12511 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12512
12513 if (player)
12514 {
12515 player.MessageAction(text);
12516 }
12517 }
12518
12519
12528 {
12529 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12530
12531 if (player)
12532 {
12533 player.MessageFriendly(text);
12534 }
12535 }
12536
12537
12546 {
12547 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12548
12549 if (player)
12550 {
12551 player.MessageImportant(text);
12552 }
12553 }
12554
12556 {
12557 return true;
12558 }
12559
12560
12561 override bool KindOf(
string tag)
12562 {
12563 bool found = false;
12564 string item_name = this.
GetType();
12566 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12567
12568 int array_size = item_tag_array.Count();
12569 for (int i = 0; i < array_size; i++)
12570 {
12571 if (item_tag_array.Get(i) == tag)
12572 {
12573 found = true;
12574 break;
12575 }
12576 }
12577 return found;
12578 }
12579
12580
12582 {
12583
12584 super.OnRPC(sender, rpc_type,ctx);
12585
12586
12587 switch (rpc_type)
12588 {
12589 #ifndef SERVER
12590 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12591 Param2<bool, string> p = new Param2<bool, string>(false, "");
12592
12594 return;
12595
12596 bool play = p.param1;
12597 string soundSet = p.param2;
12598
12599 if (play)
12600 {
12602 {
12604 {
12606 }
12607 }
12608 else
12609 {
12611 }
12612 }
12613 else
12614 {
12616 }
12617
12618 break;
12619 #endif
12620
12621 }
12622
12624 {
12626 }
12627 }
12628
12629
12630
12631
12633 {
12634 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12635 return plugin.GetID(
name);
12636 }
12637
12639 {
12640 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12641 return plugin.GetName(id);
12642 }
12643
12646 {
12647
12648
12649 int varFlags;
12650 if (!ctx.
Read(varFlags))
12651 return;
12652
12653 if (varFlags & ItemVariableFlags.FLOAT)
12654 {
12656 }
12657 }
12658
12660 {
12661
12662 super.SerializeNumericalVars(floats_out);
12663
12664
12665
12667 {
12669 }
12670
12672 {
12674 }
12675
12677 {
12679 }
12680
12682 {
12687 }
12688
12690 {
12692 }
12693 }
12694
12696 {
12697
12698 super.DeSerializeNumericalVars(floats);
12699
12700
12701 int index = 0;
12702 int mask = Math.Round(floats.Get(index));
12703
12704 index++;
12705
12707 {
12709 {
12711 }
12712 else
12713 {
12714 float quantity = floats.Get(index);
12715 SetQuantity(quantity,
true,
false,
false,
false);
12716 }
12717 index++;
12718 }
12719
12721 {
12722 float wet = floats.Get(index);
12724 index++;
12725 }
12726
12728 {
12729 int liquidtype = Math.Round(floats.Get(index));
12731 index++;
12732 }
12733
12735 {
12737 index++;
12739 index++;
12741 index++;
12743 index++;
12744 }
12745
12747 {
12748 int cleanness = Math.Round(floats.Get(index));
12750 index++;
12751 }
12752 }
12753
12755 {
12756 super.WriteVarsToCTX(ctx);
12757
12758
12760 {
12762 }
12763
12765 {
12767 }
12768
12770 {
12772 }
12773
12775 {
12776 int r,g,b,a;
12782 }
12783
12785 {
12787 }
12788 }
12789
12791 {
12792 if (!super.ReadVarsFromCTX(ctx,version))
12793 return false;
12794
12795 int intValue;
12796 float value;
12797
12798 if (version < 140)
12799 {
12800 if (!ctx.
Read(intValue))
12801 return false;
12802
12803 m_VariablesMask = intValue;
12804 }
12805
12807 {
12808 if (!ctx.
Read(value))
12809 return false;
12810
12812 {
12814 }
12815 else
12816 {
12818 }
12819 }
12820
12821 if (version < 140)
12822 {
12824 {
12825 if (!ctx.
Read(value))
12826 return false;
12827 SetTemperatureDirect(value);
12828 }
12829 }
12830
12832 {
12833 if (!ctx.
Read(value))
12834 return false;
12836 }
12837
12839 {
12840 if (!ctx.
Read(intValue))
12841 return false;
12843 }
12844
12846 {
12847 int r,g,b,a;
12849 return false;
12851 return false;
12853 return false;
12855 return false;
12856
12858 }
12859
12861 {
12862 if (!ctx.
Read(intValue))
12863 return false;
12865 }
12866
12867 if (version >= 138 && version < 140)
12868 {
12870 {
12871 if (!ctx.
Read(intValue))
12872 return false;
12873 SetFrozen(intValue);
12874 }
12875 }
12876
12877 return true;
12878 }
12879
12880
12882 {
12885 {
12887 }
12888
12889 if (!super.OnStoreLoad(ctx, version))
12890 {
12892 return false;
12893 }
12894
12895 if (version >= 114)
12896 {
12897 bool hasQuickBarIndexSaved;
12898
12899 if (!ctx.
Read(hasQuickBarIndexSaved))
12900 {
12902 return false;
12903 }
12904
12905 if (hasQuickBarIndexSaved)
12906 {
12907 int itmQBIndex;
12908
12909
12910 if (!ctx.
Read(itmQBIndex))
12911 {
12913 return false;
12914 }
12915
12916 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12917 if (itmQBIndex != -1 && parentPlayer)
12918 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12919 }
12920 }
12921 else
12922 {
12923
12924 PlayerBase player;
12925 int itemQBIndex;
12926 if (version ==
int.
MAX)
12927 {
12928 if (!ctx.
Read(itemQBIndex))
12929 {
12931 return false;
12932 }
12933 }
12934 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12935 {
12936
12937 if (!ctx.
Read(itemQBIndex))
12938 {
12940 return false;
12941 }
12942 if (itemQBIndex != -1 && player)
12943 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12944 }
12945 }
12946
12947 if (version < 140)
12948 {
12949
12950 if (!LoadVariables(ctx, version))
12951 {
12953 return false;
12954 }
12955 }
12956
12957
12959 {
12961 return false;
12962 }
12963 if (version >= 132)
12964 {
12966 if (raib)
12967 {
12969 {
12971 return false;
12972 }
12973 }
12974 }
12975
12977 return true;
12978 }
12979
12980
12981
12983 {
12984 super.OnStoreSave(ctx);
12985
12986 PlayerBase player;
12987 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12988 {
12990
12991 int itemQBIndex = -1;
12992 itemQBIndex = player.FindQuickBarEntityIndex(this);
12993 ctx.
Write(itemQBIndex);
12994 }
12995 else
12996 {
12998 }
12999
13001
13003 if (raib)
13004 {
13006 }
13007 }
13008
13009
13011 {
13012 super.AfterStoreLoad();
13013
13015 {
13017 }
13018
13020 {
13023 }
13024 }
13025
13027 {
13028 super.EEOnAfterLoad();
13029
13031 {
13033 }
13034
13037 }
13038
13040 {
13041 return false;
13042 }
13043
13044
13045
13047 {
13049 {
13050 #ifdef PLATFORM_CONSOLE
13051
13053 {
13055 if (menu)
13056 {
13058 }
13059 }
13060 #endif
13061 }
13062
13064 {
13067 }
13068
13070 {
13071 SetWeightDirty();
13073 }
13075 {
13078 }
13079
13081 {
13084
13087 }
13089 {
13093 }
13094
13095 super.OnVariablesSynchronized();
13096 }
13097
13098
13099
13101 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13102 {
13103 if (!IsServerCheck(allow_client))
13104 return false;
13105
13107 return false;
13108
13111
13112 if (value <= (min + 0.001))
13113 value = min;
13114
13115 if (value == min)
13116 {
13117 if (destroy_config)
13118 {
13119 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13120 if (dstr)
13121 {
13123 this.Delete();
13124 return true;
13125 }
13126 }
13127 else if (destroy_forced)
13128 {
13130 this.Delete();
13131 return true;
13132 }
13133
13135 }
13136
13139
13141 {
13142 EntityAI parent = GetHierarchyRoot();
13143 InventoryLocation iLoc = new InventoryLocation();
13144 GetInventory().GetCurrentInventoryLocation(iLoc);
13146 {
13147 int iLocSlot = iLoc.
GetSlot();
13149 {
13151 }
13153 {
13155 }
13156 }
13157 }
13158
13160 {
13162
13163 if (delta)
13165 }
13166
13168
13169 return false;
13170 }
13171
13172
13174 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13175 {
13177 }
13178
13180 {
13183 }
13184
13186 {
13189 }
13190
13192 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13193 {
13194 float value_clamped = Math.Clamp(value, 0, 1);
13196 SetQuantity(result, destroy_config, destroy_forced);
13197 }
13198
13199
13202 {
13204 }
13205
13207 {
13209 }
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13221 {
13222 int slot = -1;
13223 GameInventory inventory = GetInventory();
13224 if (inventory)
13225 {
13226 InventoryLocation il = new InventoryLocation;
13229 }
13230
13232 }
13233
13235 {
13236 float quantity_max = 0;
13237
13239 {
13240 if (attSlotID != -1)
13241 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13242
13243 if (quantity_max <= 0)
13245 }
13246
13247 if (quantity_max <= 0)
13249
13250 return quantity_max;
13251 }
13252
13254 {
13256 }
13257
13259 {
13261 }
13262
13263
13265 {
13267 }
13268
13270 {
13272 }
13273
13275 {
13277 }
13278
13279
13281 {
13282
13283 float weightEx = GetWeightEx();
13284 float special = GetInventoryAndCargoWeight();
13285 return weightEx - special;
13286 }
13287
13288
13290 {
13292 }
13293
13295 {
13297 {
13298 #ifdef DEVELOPER
13299 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13300 {
13301 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13303 }
13304 #endif
13305
13306 return GetQuantity() * GetConfigWeightModified();
13307 }
13308 else if (HasEnergyManager())
13309 {
13310 #ifdef DEVELOPER
13311 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13312 {
13313 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13314 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13315 }
13316 #endif
13317 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13318 }
13319 else
13320 {
13321 #ifdef DEVELOPER
13322 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13323 {
13324 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13325 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13326 }
13327 #endif
13328 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13329 }
13330 }
13331
13334 {
13335 int item_count = 0;
13337
13338 GameInventory inventory = GetInventory();
13339 CargoBase cargo = inventory.
GetCargo();
13340 if (cargo != NULL)
13341 {
13343 }
13344
13346 for (int i = 0; i < nAttachments; ++i)
13347 {
13349 if (item)
13350 item_count += item.GetNumberOfItems();
13351 }
13352 return item_count;
13353 }
13354
13357 {
13358 float weight = 0;
13359 float wetness = 1;
13360 if (include_wetness)
13363 {
13364 weight = wetness * m_ConfigWeight;
13365 }
13367 {
13368 weight = 1;
13369 }
13370 return weight;
13371 }
13372
13373
13374
13376 {
13377 GameInventory inventory = GetInventory();
13378 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13379 {
13380 array<EntityAI> items = new array<EntityAI>;
13382 for (int i = 0; i < items.Count(); ++i)
13383 {
13385 if (item)
13386 {
13387 g_Game.ObjectDelete(item);
13388 }
13389 }
13390 }
13391 }
13392
13393
13394
13395
13397 {
13398 float energy = 0;
13399 if (HasEnergyManager())
13400 {
13401 energy = GetCompEM().GetEnergy();
13402 }
13403 return energy;
13404 }
13405
13406
13408 {
13409 super.OnEnergyConsumed();
13410
13412 }
13413
13415 {
13416 super.OnEnergyAdded();
13417
13419 }
13420
13421
13423 {
13424 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13425 {
13427 {
13428 float energy_0to1 = GetCompEM().GetEnergy0To1();
13430 }
13431 }
13432 }
13433
13434
13436 {
13437 return ConfigGetFloat("heatIsolation");
13438 }
13439
13441 {
13443 }
13444
13446 {
13447 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13448 if (
g_Game.ConfigIsExisting(paramPath))
13449 return g_Game.ConfigGetFloat(paramPath);
13450
13451 return 0.0;
13452 }
13453
13455 {
13456 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13457 if (
g_Game.ConfigIsExisting(paramPath))
13458 return g_Game.ConfigGetFloat(paramPath);
13459
13460 return 0.0;
13461 }
13462
13463 override void SetWet(
float value,
bool allow_client =
false)
13464 {
13465 if (!IsServerCheck(allow_client))
13466 return;
13467
13470
13472
13473 m_VarWet = Math.Clamp(value, min, max);
13474
13476 {
13479 }
13480 }
13481
13482 override void AddWet(
float value)
13483 {
13485 }
13486
13488 {
13490 }
13491
13493 {
13495 }
13496
13498 {
13500 }
13501
13503 {
13505 }
13506
13508 {
13510 }
13511
13512 override void OnWetChanged(
float newVal,
float oldVal)
13513 {
13516 if (newLevel != oldLevel)
13517 {
13519 }
13520 }
13521
13523 {
13524 SetWeightDirty();
13525 }
13526
13528 {
13529 return GetWetLevelInternal(
m_VarWet);
13530 }
13531
13532
13533
13535 {
13537 }
13538
13540 {
13542 }
13543
13545 {
13547 }
13548
13550 {
13552 }
13553
13554
13555
13557 {
13558 if (ConfigIsExisting("itemModelLength"))
13559 {
13560 return ConfigGetFloat("itemModelLength");
13561 }
13562 return 0;
13563 }
13564
13566 {
13567 if (ConfigIsExisting("itemAttachOffset"))
13568 {
13569 return ConfigGetFloat("itemAttachOffset");
13570 }
13571 return 0;
13572 }
13573
13574 override void SetCleanness(
int value,
bool allow_client =
false)
13575 {
13576 if (!IsServerCheck(allow_client))
13577 return;
13578
13580
13582
13585 }
13586
13588 {
13590 }
13591
13593 {
13594 return true;
13595 }
13596
13597
13598
13599
13601 {
13603 }
13604
13606 {
13608 }
13609
13610
13611
13612
13613 override void SetColor(
int r,
int g,
int b,
int a)
13614 {
13620 }
13622 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13623 {
13628 }
13629
13631 {
13633 }
13634
13637 {
13638 int r,g,b,a;
13640 r = r/255;
13641 g = g/255;
13642 b = b/255;
13643 a = a/255;
13644 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13645 }
13646
13647
13648
13649 override void SetLiquidType(
int value,
bool allow_client =
false)
13650 {
13651 if (!IsServerCheck(allow_client))
13652 return;
13653
13658 }
13659
13661 {
13662 return ConfigGetInt("varLiquidTypeInit");
13663 }
13664
13666 {
13668 }
13669
13671 {
13673 SetFrozen(false);
13674 }
13675
13678 {
13679 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13680 }
13681
13682
13685 {
13686 PlayerBase nplayer;
13687 if (PlayerBase.CastTo(nplayer, player))
13688 {
13690 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13691 }
13692 }
13693
13694
13697 {
13698 PlayerBase nplayer;
13699 if (PlayerBase.CastTo(nplayer,player))
13700 {
13701 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13702 }
13703
13704 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13705
13706 if (HasEnergyManager())
13707 {
13708 GetCompEM().UpdatePlugState();
13709 }
13710 }
13711
13712
13714 {
13715 super.OnPlacementStarted(player);
13716
13718 }
13719
13720 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13721 {
13723 {
13724 m_AdminLog.OnPlacementComplete(player,
this);
13725 }
13726
13727 super.OnPlacementComplete(player, position, orientation);
13728 }
13729
13730
13731
13732
13733
13735 {
13737 {
13738 return true;
13739 }
13740 else
13741 {
13742 return false;
13743 }
13744 }
13745
13746
13748 {
13750 {
13752 }
13753 }
13754
13755
13757 {
13759 }
13760
13762 {
13764 }
13765
13766 override void InsertAgent(
int agent,
float count = 1)
13767 {
13768 if (count < 1)
13769 return;
13770
13772 }
13773
13776 {
13778 }
13779
13780
13782 {
13784 }
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13828 {
13830 return false;
13831 return true;
13832 }
13833
13835 {
13836
13838 }
13839
13840
13843 {
13844 super.CheckForRoofLimited(timeTresholdMS);
13845
13846 float time =
g_Game.GetTime();
13847 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13848 {
13849 m_PreviousRoofTestTime = time;
13850 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13851 }
13852 }
13853
13854
13856 {
13858 {
13859 return 0;
13860 }
13861
13862 if (GetInventory().GetAttachmentSlotsCount() != 0)
13863 {
13864 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13865 if (filter)
13866 return filter.GetProtectionLevel(type, false, system);
13867 else
13868 return 0;
13869 }
13870
13871 string subclassPath, entryName;
13872
13873 switch (type)
13874 {
13876 entryName = "biological";
13877 break;
13879 entryName = "chemical";
13880 break;
13881 default:
13882 entryName = "biological";
13883 break;
13884 }
13885
13886 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13887
13888 return g_Game.ConfigGetFloat(subclassPath + entryName);
13889 }
13890
13891
13892
13895 {
13896 if (!IsMagazine())
13898
13900 }
13901
13902
13903
13904
13905
13910 {
13911 return true;
13912 }
13913
13915 {
13917 }
13918
13919
13920
13921
13922
13924 {
13925 if (parent)
13926 {
13927 if (parent.IsInherited(DayZInfected))
13928 return true;
13929
13930 if (!parent.IsRuined())
13931 return true;
13932 }
13933
13934 return true;
13935 }
13936
13938 {
13939 if (!super.CanPutAsAttachment(parent))
13940 {
13941 return false;
13942 }
13943
13944 if (!IsRuined() && !parent.IsRuined())
13945 {
13946 return true;
13947 }
13948
13949 return false;
13950 }
13951
13953 {
13954
13955
13956
13957
13958 return super.CanReceiveItemIntoCargo(item);
13959 }
13960
13962 {
13963
13964
13965
13966
13967 GameInventory attachmentInv = attachment.GetInventory();
13969 {
13970 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13971 return false;
13972 }
13973
13974 InventoryLocation loc = new InventoryLocation();
13975 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13976 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13977 return false;
13978
13979 return super.CanReceiveAttachment(attachment, slotId);
13980 }
13981
13983 {
13984 if (!super.CanReleaseAttachment(attachment))
13985 return false;
13986
13987 return GetInventory().AreChildrenAccessible();
13988 }
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14011 {
14012 int id = muzzle_owner.GetMuzzleID();
14013 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
14014
14015 if (WPOF_array)
14016 {
14017 for (int i = 0; i < WPOF_array.Count(); i++)
14018 {
14019 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
14020
14021 if (WPOF)
14022 {
14023 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
14024 }
14025 }
14026 }
14027 }
14028
14029
14031 {
14032 int id = muzzle_owner.GetMuzzleID();
14034
14035 if (WPOBE_array)
14036 {
14037 for (int i = 0; i < WPOBE_array.Count(); i++)
14038 {
14039 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14040
14041 if (WPOBE)
14042 {
14043 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14044 }
14045 }
14046 }
14047 }
14048
14049
14051 {
14052 int id = muzzle_owner.GetMuzzleID();
14053 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14054
14055 if (WPOOH_array)
14056 {
14057 for (int i = 0; i < WPOOH_array.Count(); i++)
14058 {
14059 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14060
14061 if (WPOOH)
14062 {
14063 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14064 }
14065 }
14066 }
14067 }
14068
14069
14071 {
14072 int id = muzzle_owner.GetMuzzleID();
14073 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14074
14075 if (WPOOH_array)
14076 {
14077 for (int i = 0; i < WPOOH_array.Count(); i++)
14078 {
14079 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14080
14081 if (WPOOH)
14082 {
14083 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14084 }
14085 }
14086 }
14087 }
14088
14089
14091 {
14092 int id = muzzle_owner.GetMuzzleID();
14093 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14094
14095 if (WPOOH_array)
14096 {
14097 for (int i = 0; i < WPOOH_array.Count(); i++)
14098 {
14099 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14100
14101 if (WPOOH)
14102 {
14103 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14104 }
14105 }
14106 }
14107 }
14108
14109
14110
14112 {
14114 {
14115 return true;
14116 }
14117
14118 return false;
14119 }
14120
14122 {
14124 {
14125 return true;
14126 }
14127
14128 return false;
14129 }
14130
14132 {
14134 {
14135 return true;
14136 }
14137
14138 return false;
14139 }
14140
14142 {
14143 return false;
14144 }
14145
14148 {
14149 return UATimeSpent.DEFAULT_DEPLOY;
14150 }
14151
14152
14153
14154
14156 {
14158 SetSynchDirty();
14159 }
14160
14162 {
14164 }
14165
14166
14168 {
14169 return false;
14170 }
14171
14174 {
14175 string att_type = "None";
14176
14177 if (ConfigIsExisting("soundAttType"))
14178 {
14179 att_type = ConfigGetString("soundAttType");
14180 }
14181
14183 }
14184
14186 {
14188 }
14189
14190
14191
14192
14193
14199
14201 {
14204
14206 }
14207
14208
14210 {
14212 return;
14213
14215
14218
14221
14222 SoundParameters params = new SoundParameters();
14226 }
14227
14228
14230 {
14232 {
14235
14236 SetSynchDirty();
14237
14240 }
14241 }
14242
14244 {
14246 }
14247
14248
14250 {
14252 return;
14253
14255 SetSynchDirty();
14256
14259 }
14260
14262 {
14265 }
14266
14268 {
14270 }
14271
14272 void OnApply(PlayerBase player);
14273
14275 {
14276 return 1.0;
14277 };
14278
14280 {
14282 }
14283
14285 {
14287 }
14288
14290
14292 {
14293 SetDynamicPhysicsLifeTime(0.01);
14295 }
14296
14298 {
14299 array<string> zone_names = new array<string>;
14300 GetDamageZones(zone_names);
14301 for (int i = 0; i < zone_names.Count(); i++)
14302 {
14303 SetHealthMax(zone_names.Get(i),"Health");
14304 }
14305 SetHealthMax("","Health");
14306 }
14307
14310 {
14311 float global_health = GetHealth01("","Health");
14312 array<string> zones = new array<string>;
14313 GetDamageZones(zones);
14314
14315 for (int i = 0; i < zones.Count(); i++)
14316 {
14317 SetHealth01(zones.Get(i),"Health",global_health);
14318 }
14319 }
14320
14323 {
14324 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14325 }
14326
14328 {
14329 if (!hasRootAsPlayer)
14330 {
14331 if (refParentIB)
14332 {
14333
14334 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14335 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14336
14337 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14338 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14339
14342 }
14343 else
14344 {
14345
14348 }
14349 }
14350 }
14351
14353 {
14355 {
14356 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14357 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14358 {
14359 float heatPermCoef = 1.0;
14361 while (ent)
14362 {
14363 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14364 ent = ent.GetHierarchyParent();
14365 }
14366
14367 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14368 }
14369 }
14370 }
14371
14373 {
14374
14375 EntityAI parent = GetHierarchyParent();
14376 if (!parent)
14377 {
14378 hasParent = false;
14379 hasRootAsPlayer = false;
14380 }
14381 else
14382 {
14383 hasParent = true;
14384 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14385 refParentIB =
ItemBase.Cast(parent);
14386 }
14387 }
14388
14389 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14390 {
14391
14392 }
14393
14395 {
14396
14397 return false;
14398 }
14399
14401 {
14402
14403
14404 return false;
14405 }
14406
14408 {
14409
14410 return false;
14411 }
14412
14415 {
14416 return !GetIsFrozen() &&
IsOpen();
14417 }
14418
14420 {
14421 bool hasParent = false, hasRootAsPlayer = false;
14423
14424 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14425 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14426
14427 if (wwtu || foodDecay)
14428 {
14432
14433 if (processWetness || processTemperature || processDecay)
14434 {
14436
14437 if (processWetness)
14438 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14439
14440 if (processTemperature)
14442
14443 if (processDecay)
14444 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14445 }
14446 }
14447 }
14448
14451 {
14453 }
14454
14456 {
14459
14460 return super.GetTemperatureFreezeThreshold();
14461 }
14462
14464 {
14467
14468 return super.GetTemperatureThawThreshold();
14469 }
14470
14472 {
14475
14476 return super.GetItemOverheatThreshold();
14477 }
14478
14480 {
14482 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14483
14484 return super.GetTemperatureFreezeTime();
14485 }
14486
14488 {
14490 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14491
14492 return super.GetTemperatureThawTime();
14493 }
14494
14499
14501 {
14502 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14503 }
14504
14506 {
14507 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14508 }
14509
14512 {
14514 }
14515
14517 {
14519 }
14520
14522 {
14524 }
14525
14528 {
14529 return null;
14530 }
14531
14534 {
14535 return false;
14536 }
14537
14539 {
14541 {
14544 if (!trg)
14545 {
14547 explosive = this;
14548 }
14549
14550 explosive.PairRemote(trg);
14552
14553 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14554 trg.SetPersistentPairID(persistentID);
14555 explosive.SetPersistentPairID(persistentID);
14556
14557 return true;
14558 }
14559 return false;
14560 }
14561
14564 {
14565 float ret = 1.0;
14568 ret *= GetHealth01();
14569
14570 return ret;
14571 }
14572
14573 #ifdef DEVELOPER
14574 override void SetDebugItem()
14575 {
14576 super.SetDebugItem();
14577 _itemBase = this;
14578 }
14579
14581 {
14582 string text = super.GetDebugText();
14583
14585 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14586
14587 return text;
14588 }
14589 #endif
14590
14592 {
14593 return true;
14594 }
14595
14597
14599
14601 {
14604 }
14605
14606
14614
14630
14631 [
Obsolete(
"Use ItemSoundHandler instead")]
14634 {
14635 if (!
g_Game.IsDedicatedServer())
14636 {
14637 if (ConfigIsExisting("attachSoundSet"))
14638 {
14639 string cfg_path = "";
14640 string soundset = "";
14641 string type_name =
GetType();
14642
14645 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14646 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14647
14648 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14649 {
14650 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14651 {
14652 if (cfg_slot_array[i] == slot_type)
14653 {
14654 soundset = cfg_soundset_array[i];
14655 break;
14656 }
14657 }
14658 }
14659
14660 if (soundset != "")
14661 {
14662 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14664 }
14665 }
14666 }
14667 }
14668
14670}
14671
14673{
14675 if (entity)
14676 {
14677 bool is_item = entity.IsInherited(
ItemBase);
14678 if (is_item && full_quantity)
14679 {
14682 }
14683 }
14684 else
14685 {
14687 return NULL;
14688 }
14689 return entity;
14690}
14691
14693{
14694 if (item)
14695 {
14696 if (health > 0)
14697 item.SetHealth("", "", health);
14698
14699 if (item.CanHaveTemperature())
14700 {
14702 if (item.CanFreeze())
14703 item.SetFrozen(false);
14704 }
14705
14706 if (item.HasEnergyManager())
14707 {
14708 if (quantity >= 0)
14709 {
14710 item.GetCompEM().SetEnergy0To1(quantity);
14711 }
14712 else
14713 {
14715 }
14716 }
14717 else if (item.IsMagazine())
14718 {
14719 Magazine mag = Magazine.Cast(item);
14720 if (quantity >= 0)
14721 {
14722 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14723 }
14724 else
14725 {
14727 }
14728
14729 }
14730 else
14731 {
14732 if (quantity >= 0)
14733 {
14734 item.SetQuantityNormalized(quantity, false);
14735 }
14736 else
14737 {
14739 }
14740
14741 }
14742 }
14743}
14744
14745#ifdef DEVELOPER
14747#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.