9760{
9762 {
9763 return true;
9764 }
9765};
9766
9768{
9769
9770};
9771
9772
9773
9775{
9779
9781
9784
9785
9786
9787
9788
9797
9803
9808
9813
9834 protected bool m_IsResultOfSplit
9835
9837
9842
9843
9844
9846
9850
9851
9852
9854
9857
9858
9859
9865
9866
9874
9877
9878
9880
9881
9883
9884
9889
9890
9895
9897
9898
9900
9901
9903 {
9908
9909 if (!
g_Game.IsDedicatedServer())
9910 {
9912 {
9914
9916 {
9918 }
9919 }
9920
9923 }
9924
9925 m_OldLocation = null;
9926
9928 {
9930 }
9931
9932 if (ConfigIsExisting("headSelectionsToHide"))
9933 {
9936 }
9937
9939 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9940 {
9942 }
9943
9945
9946 m_IsResultOfSplit = false;
9947
9949 }
9950
9952 {
9953 super.InitItemVariables();
9954
9960 m_Count = ConfigGetInt(
"count");
9961
9964
9969
9972
9977
9989
9993
9994
9997 if (ConfigIsExisting("canBeSplit"))
9998 {
10001 }
10002
10004 if (ConfigIsExisting("itemBehaviour"))
10006
10007
10010 RegisterNetSyncVariableInt("m_VarLiquidType");
10011 RegisterNetSyncVariableInt("m_Cleanness",0,1);
10012
10013 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
10014 RegisterNetSyncVariableFloat("m_ImpactSpeed");
10015 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
10016
10017 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
10018 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
10019 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
10020 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
10021
10022 RegisterNetSyncVariableBool("m_IsBeingPlaced");
10023 RegisterNetSyncVariableBool("m_IsTakeable");
10024 RegisterNetSyncVariableBool("m_IsHologram");
10025
10028 {
10031 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10032 }
10033
10035
10037 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10039
10041 }
10042
10044 {
10046 }
10047
10049 {
10052 {
10057 }
10058 }
10059
10060 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10061 {
10063 {
10066 }
10067
10069 }
10070
10072 {
10078 }
10079
10081
10083 {
10085
10086 if (!action)
10087 {
10088 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10089 return;
10090 }
10091
10093 if (!ai)
10094 {
10096 return;
10097 }
10098
10100 if (!action_array)
10101 {
10102 action_array = new array<ActionBase_Basic>;
10104 }
10105 if (LogManager.IsActionLogEnable())
10106 {
10107 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10108 }
10109
10110 if (action_array.Find(action) != -1)
10111 {
10112 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10113 }
10114 else
10115 {
10116 action_array.Insert(action);
10117 }
10118 }
10119
10121 {
10122 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10123 ActionBase action = player.GetActionManager().GetAction(actionName);
10126
10127 if (action_array)
10128 {
10129 action_array.RemoveItem(action);
10130 }
10131 }
10132
10133
10134
10136 {
10137 ActionOverrideData overrideData = new ActionOverrideData();
10141
10143 if (!actionMap)
10144 {
10147 }
10148
10149 actionMap.Insert(this.
Type(), overrideData);
10150
10151 }
10152
10154
10156
10157
10159 {
10162
10165
10166 string config_to_search = "CfgVehicles";
10167 string muzzle_owner_config;
10168
10170 {
10171 if (IsInherited(Weapon))
10172 config_to_search = "CfgWeapons";
10173
10174 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10175
10176 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10177
10178 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10179
10180 if (config_OnFire_subclass_count > 0)
10181 {
10182 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10183
10184 for (int i = 0; i < config_OnFire_subclass_count; i++)
10185 {
10186 string particle_class = "";
10187 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10188 string config_OnFire_entry = config_OnFire_class + particle_class;
10189 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10190 WPOF_array.Insert(WPOF);
10191 }
10192
10193
10195 }
10196 }
10197
10199 {
10200 config_to_search = "CfgWeapons";
10201 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10202
10203 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10204
10205 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10206
10207 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10208 {
10209 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10210
10211 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10212 {
10213 string particle_class2 = "";
10214 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10215 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10216 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10217 WPOBE_array.Insert(WPOBE);
10218 }
10219
10220
10222 }
10223 }
10224 }
10225
10226
10228 {
10231
10233 {
10234 string config_to_search = "CfgVehicles";
10235
10236 if (IsInherited(Weapon))
10237 config_to_search = "CfgWeapons";
10238
10239 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10240 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10241
10242 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10243 {
10244
10246
10248 {
10250 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10252 return;
10253 }
10254
10257
10258
10259
10260 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10261 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10262
10263 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10264 {
10265 string particle_class = "";
10266 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10267 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10268 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10269
10270 if (entry_type == CT_CLASS)
10271 {
10272 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10273 WPOOH_array.Insert(WPOF);
10274 }
10275 }
10276
10277
10279 }
10280 }
10281 }
10282
10284 {
10286 }
10287
10289 {
10291 {
10293
10296
10299
10300 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10301 }
10302 }
10303
10305 {
10307 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10308
10310 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10311
10313 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10314
10316 {
10318 }
10319 }
10320
10322 {
10324 }
10325
10327 {
10330 else
10332
10334 {
10337 }
10338 else
10339 {
10342
10345 }
10346
10348 }
10349
10351 {
10353 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10354 }
10355
10357 {
10359 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10361 }
10362
10364 {
10366 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10367 }
10368
10370 {
10373
10374 OverheatingParticle OP = new OverheatingParticle();
10379
10381 }
10382
10384 {
10387
10388 return -1;
10389 }
10390
10392 {
10394 {
10397
10398 for (int i = count; i > 0; --i)
10399 {
10400 int id = i - 1;
10403
10406
10407 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10408 {
10409 if (p)
10410 {
10413 }
10414 }
10415 }
10416 }
10417 }
10418
10420 {
10422 {
10424 {
10425 int id = i - 1;
10427
10428 if (OP)
10429 {
10431
10432 if (p)
10433 {
10435 }
10436
10437 delete OP;
10438 }
10439 }
10440
10443 }
10444 }
10445
10448 {
10449 return 0.0;
10450 }
10451
10452
10454 {
10455 return 250;
10456 }
10457
10459 {
10460 return 0;
10461 }
10462
10465 {
10467 return true;
10468
10469 return false;
10470 }
10471
10474 {
10477
10479 {
10481 }
10482 else
10483 {
10484
10486 }
10487
10489 }
10490
10497 {
10498 return -1;
10499 }
10500
10501
10502
10503
10505 {
10507 {
10508 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10509 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10510
10511 if (r_index >= 0)
10512 {
10513 InventoryLocation r_il = new InventoryLocation;
10514 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10515
10516 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10519 {
10520 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10521 }
10523 {
10524 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10525 }
10526
10527 }
10528
10529 player.GetHumanInventory().ClearUserReservedLocation(this);
10530 }
10531
10534 }
10535
10536
10537
10538
10540 {
10541 return ItemBase.m_DebugActionsMask;
10542 }
10543
10545 {
10546 return ItemBase.m_DebugActionsMask & mask;
10547 }
10548
10550 {
10551 ItemBase.m_DebugActionsMask = mask;
10552 }
10553
10555 {
10556 ItemBase.m_DebugActionsMask |= mask;
10557 }
10558
10560 {
10561 ItemBase.m_DebugActionsMask &= ~mask;
10562 }
10563
10565 {
10567 {
10569 }
10570 else
10571 {
10573 }
10574 }
10575
10576
10578 {
10579 if (GetEconomyProfile())
10580 {
10581 float q_max = GetEconomyProfile().GetQuantityMax();
10582 if (q_max > 0)
10583 {
10584 float q_min = GetEconomyProfile().GetQuantityMin();
10585 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10586
10588 {
10589 ComponentEnergyManager comp = GetCompEM();
10591 {
10593 }
10594 }
10596 {
10598
10599 }
10600
10601 }
10602 }
10603 }
10604
10607 {
10608 EntityAI parent = GetHierarchyParent();
10609
10610 if (parent)
10611 {
10612 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10613 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10614 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10615 }
10616 }
10617
10620 {
10621 EntityAI parent = GetHierarchyParent();
10622
10623 if (parent)
10624 {
10625 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10626 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10627 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10628 }
10629 }
10630
10632 {
10633
10634
10635
10636
10638
10640 {
10641 if (ScriptInputUserData.CanStoreInputUserData())
10642 {
10643 ScriptInputUserData ctx = new ScriptInputUserData;
10649 ctx.
Write(use_stack_max);
10652
10654 {
10655 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10656 }
10657 }
10658 }
10659 else if (!
g_Game.IsMultiplayer())
10660 {
10662 }
10663 }
10664
10666 {
10668 }
10669
10671 {
10673 }
10674
10676 {
10678 }
10679
10681 {
10682
10683 return false;
10684 }
10685
10687 {
10688 return false;
10689 }
10690
10694 {
10695 return false;
10696 }
10697
10699 {
10700 return "";
10701 }
10702
10704
10706 {
10707 return false;
10708 }
10709
10711 {
10712 return true;
10713 }
10714
10715
10716
10718 {
10719 return true;
10720 }
10721
10723 {
10724 return true;
10725 }
10726
10728 {
10729 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10731 }
10732
10734 {
10736 }
10737
10739 {
10741 if (!is_being_placed)
10743 SetSynchDirty();
10744 }
10745
10746
10748
10750 {
10752 }
10753
10755 {
10757 }
10758
10760 {
10761 return 1;
10762 }
10763
10765 {
10766 return false;
10767 }
10768
10770 {
10772 SetSynchDirty();
10773 }
10774
10775
10776
10777
10778
10779
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
10810 {
10811 super.OnMovedInsideCargo(container);
10812
10813 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10814 }
10815
10816 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10817 {
10818 super.EEItemLocationChanged(oldLoc, newLoc);
10819
10820 PlayerBase newPlayer = null;
10821 PlayerBase oldPlayer = null;
10822
10823 if (newLoc.GetParent())
10824 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10825
10826 if (oldLoc.GetParent())
10827 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10828
10830 {
10831 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10832
10833 if (rIndex >= 0)
10834 {
10835 InventoryLocation rIl = new InventoryLocation;
10836 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10837
10838 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10841 {
10842 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10843 }
10845 {
10847 }
10848
10849 }
10850 }
10851
10853 {
10854 if (newPlayer)
10855 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10856
10857 if (newPlayer == oldPlayer)
10858 {
10859 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10860 {
10862 {
10863 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10864 {
10865 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10866 }
10867 }
10868 else
10869 {
10870 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10871 }
10872 }
10873
10874 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10875 {
10876 int type = oldLoc.GetType();
10878 {
10879 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10880 }
10882 {
10883 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10884 }
10885 }
10886 if (!m_OldLocation)
10887 {
10888 m_OldLocation = new InventoryLocation;
10889 }
10890 m_OldLocation.Copy(oldLoc);
10891 }
10892 else
10893 {
10894 if (m_OldLocation)
10895 {
10896 m_OldLocation.Reset();
10897 }
10898 }
10899
10900 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10901 }
10902 else
10903 {
10904 if (newPlayer)
10905 {
10906 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10907 if (resIndex >= 0)
10908 {
10909 InventoryLocation il = new InventoryLocation;
10910 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10912 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10915 {
10916 il.
GetParent().GetOnReleaseLock().Invoke(it);
10917 }
10919 {
10921 }
10922
10923 }
10924 }
10926 {
10927
10929 }
10930
10931 if (m_OldLocation)
10932 {
10933 m_OldLocation.Reset();
10934 }
10935 }
10936
10938 {
10939 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10940 }
10941
10943 {
10944 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10945 }
10946 }
10947
10948 override void EOnContact(IEntity other, Contact extra)
10949 {
10951 {
10952 int liquidType = -1;
10954 if (impactSpeed > 0.0)
10955 {
10957 #ifndef SERVER
10959 #else
10961 SetSynchDirty();
10962 #endif
10964 }
10965 }
10966
10967 #ifdef SERVER
10968 if (GetCompEM() && GetCompEM().IsPlugged())
10969 {
10970 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10971 GetCompEM().UnplugThis();
10972 }
10973 #endif
10974 }
10975
10977
10979 {
10981 }
10982
10984 {
10985
10986 }
10987
10989 {
10990 super.OnItemLocationChanged(old_owner, new_owner);
10991
10992 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10993 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10994
10995 if (!relatedPlayer && playerNew)
10996 relatedPlayer = playerNew;
10997
10998 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10999 {
11001 if (actionMgr)
11002 {
11003 ActionBase currentAction = actionMgr.GetRunningAction();
11004 if (currentAction)
11006 }
11007 }
11008
11009 Man ownerPlayerOld = null;
11010 Man ownerPlayerNew = null;
11011
11012 if (old_owner)
11013 {
11014 if (old_owner.
IsMan())
11015 {
11016 ownerPlayerOld = Man.Cast(old_owner);
11017 }
11018 else
11019 {
11020 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
11021 }
11022 }
11023 else
11024 {
11026 {
11028
11029 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11030 {
11031 GetCompEM().UnplugThis();
11032 }
11033 }
11034 }
11035
11036 if (new_owner)
11037 {
11038 if (new_owner.
IsMan())
11039 {
11040 ownerPlayerNew = Man.Cast(new_owner);
11041 }
11042 else
11043 {
11044 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11045 }
11046 }
11047
11048 if (ownerPlayerOld != ownerPlayerNew)
11049 {
11050 if (ownerPlayerOld)
11051 {
11052 array<EntityAI> subItemsExit = new array<EntityAI>;
11054 for (int i = 0; i < subItemsExit.Count(); i++)
11055 {
11058 }
11059 }
11060
11061 if (ownerPlayerNew)
11062 {
11063 array<EntityAI> subItemsEnter = new array<EntityAI>;
11065 for (int j = 0; j < subItemsEnter.Count(); j++)
11066 {
11069 }
11070 }
11071 }
11072 else if (ownerPlayerNew != null)
11073 {
11074 PlayerBase nplayer;
11075 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11076 {
11077 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11079 for (int k = 0; k < subItemsUpdate.Count(); k++)
11080 {
11082 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11083 }
11084 }
11085 }
11086
11087 if (old_owner)
11088 old_owner.OnChildItemRemoved(this);
11089 if (new_owner)
11090 new_owner.OnChildItemReceived(this);
11091 }
11092
11093
11095 {
11096 super.EEDelete(parent);
11097 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11098 if (player)
11099 {
11101
11102 if (player.IsAlive())
11103 {
11104 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11105 if (r_index >= 0)
11106 {
11107 InventoryLocation r_il = new InventoryLocation;
11108 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11109
11110 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11113 {
11114 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11115 }
11117 {
11118 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11119 }
11120
11121 }
11122
11123 player.RemoveQuickBarEntityShortcut(this);
11124 }
11125 }
11126 }
11127
11129 {
11130 super.EEKilled(killer);
11131
11134 {
11135 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11136 {
11137 if (IsMagazine())
11138 {
11139 if (Magazine.Cast(this).GetAmmoCount() > 0)
11140 {
11142 }
11143 }
11144 else
11145 {
11147 }
11148 }
11149 }
11150 }
11151
11153 {
11154 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11155
11156 super.OnWasAttached(parent, slot_id);
11157
11160
11163 }
11164
11166 {
11167 super.OnWasDetached(parent, slot_id);
11168
11171
11174 }
11175
11177 {
11178 int idx;
11181
11182 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11183 if (inventory_slots.Count() < 1)
11184 {
11185 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11186 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11187 }
11188 else
11189 {
11190 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11191 }
11192
11193 idx = inventory_slots.Find(slot);
11194 if (idx < 0)
11195 return "";
11196
11197 return attach_types.Get(idx);
11198 }
11199
11201 {
11202 int idx = -1;
11203 string slot;
11204
11207
11208 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11209 if (inventory_slots.Count() < 1)
11210 {
11211 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11212 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11213 }
11214 else
11215 {
11216 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11217 if (detach_types.Count() < 1)
11218 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11219 }
11220
11221 for (int i = 0; i < inventory_slots.Count(); i++)
11222 {
11223 slot = inventory_slots.Get(i);
11224 }
11225
11226 if (slot != "")
11227 {
11228 if (detach_types.Count() == 1)
11229 idx = 0;
11230 else
11231 idx = inventory_slots.Find(slot);
11232 }
11233 if (idx < 0)
11234 return "";
11235
11236 return detach_types.Get(idx);
11237 }
11238
11240 {
11241
11243
11244
11245 float min_time = 1;
11246 float max_time = 3;
11247 float delay = Math.RandomFloat(min_time, max_time);
11248
11249 explode_timer.Run(delay, this, "DoAmmoExplosion");
11250 }
11251
11253 {
11254 Magazine magazine = Magazine.Cast(this);
11255 int pop_sounds_count = 6;
11256 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11257
11258
11259 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11260 string sound_name = pop_sounds[ sound_idx ];
11261 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11262
11263
11264 magazine.ServerAddAmmoCount(-1);
11265
11266
11267 float min_temp_to_explode = 100;
11268
11269 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11270 {
11272 }
11273 }
11274
11275
11276 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11277 {
11278 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11279
11280 const int CHANCE_DAMAGE_CARGO = 4;
11281 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11282 const int CHANCE_DAMAGE_NOTHING = 2;
11283
11285 {
11286 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11287 int chances;
11288 int rnd;
11289
11290 if (GetInventory().GetCargo())
11291 {
11292 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11293 rnd = Math.RandomInt(0,chances);
11294
11295 if (rnd < CHANCE_DAMAGE_CARGO)
11296 {
11298 }
11299 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11300 {
11302 }
11303 }
11304 else
11305 {
11306 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11307 rnd = Math.RandomInt(0,chances);
11308
11309 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11310 {
11312 }
11313 }
11314 }
11315 }
11316
11318 {
11319 CargoBase cargo = GetInventory().GetCargo();
11320 if (cargo)
11321 {
11323 if (item_count > 0)
11324 {
11325 int random_pick = Math.RandomInt(0, item_count);
11327 if (!item.IsExplosive())
11328 {
11329 item.AddHealth("","",damage);
11330 return true;
11331 }
11332 }
11333 }
11334 return false;
11335 }
11336
11338 {
11339 GameInventory inventory = GetInventory();
11341 if (attachment_count > 0)
11342 {
11343 int random_pick = Math.RandomInt(0, attachment_count);
11345 if (!attachment.IsExplosive())
11346 {
11347 attachment.AddHealth("","",damage);
11348 return true;
11349 }
11350 }
11351 return false;
11352 }
11353
11355 {
11357 }
11358
11360 {
11362 return GetInventory().CanRemoveEntity();
11363
11364 return false;
11365 }
11366
11368 {
11369
11371 return false;
11372
11373
11375 return false;
11376
11377
11378
11380 if (delta == 0)
11381 return false;
11382
11383
11384 return true;
11385 }
11386
11388 {
11390 {
11391 if (ScriptInputUserData.CanStoreInputUserData())
11392 {
11393 ScriptInputUserData ctx = new ScriptInputUserData;
11398 ctx.
Write(destination_entity);
11400 ctx.
Write(slot_id);
11402 }
11403 }
11404 else if (!
g_Game.IsMultiplayer())
11405 {
11407 }
11408 }
11409
11411 {
11412 float split_quantity_new;
11416 InventoryLocation loc = new InventoryLocation;
11417
11418 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11419 {
11421 split_quantity_new = stack_max;
11422 else
11424
11426 {
11427 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11428 if (new_item)
11429 {
11430 new_item.SetResultOfSplit(true);
11431 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11433 new_item.
SetQuantity(split_quantity_new,
false,
true);
11434 }
11435 }
11436 }
11437 else if (destination_entity && slot_id == -1)
11438 {
11439 if (quantity > stack_max)
11440 split_quantity_new = stack_max;
11441 else
11442 split_quantity_new = quantity;
11443
11445 {
11446 GameInventory destinationInventory = destination_entity.GetInventory();
11448 {
11451 }
11452
11453 if (new_item)
11454 {
11455 new_item.SetResultOfSplit(true);
11456 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11458 new_item.
SetQuantity(split_quantity_new,
false,
true);
11459 }
11460 }
11461 }
11462 else
11463 {
11464 if (stack_max != 0)
11465 {
11467 {
11469 }
11470
11471 if (split_quantity_new == 0)
11472 {
11473 if (!
g_Game.IsMultiplayer())
11474 player.PhysicalPredictiveDropItem(this);
11475 else
11476 player.ServerDropEntity(this);
11477 return;
11478 }
11479
11481 {
11483
11484 if (new_item)
11485 {
11486 new_item.SetResultOfSplit(true);
11487 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11490 new_item.PlaceOnSurface();
11491 }
11492 }
11493 }
11494 }
11495 }
11496
11498 {
11499 float split_quantity_new;
11503 InventoryLocation loc = new InventoryLocation;
11504
11505 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11506 {
11508 split_quantity_new = stack_max;
11509 else
11511
11513 {
11514 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11515 if (new_item)
11516 {
11517 new_item.SetResultOfSplit(true);
11518 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11520 new_item.
SetQuantity(split_quantity_new,
false,
true);
11521 }
11522 }
11523 }
11524 else if (destination_entity && slot_id == -1)
11525 {
11526 if (quantity > stack_max)
11527 split_quantity_new = stack_max;
11528 else
11529 split_quantity_new = quantity;
11530
11532 {
11533 GameInventory destinationInventory = destination_entity.GetInventory();
11535 {
11538 }
11539
11540 if (new_item)
11541 {
11542 new_item.SetResultOfSplit(true);
11543 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11545 new_item.
SetQuantity(split_quantity_new,
false,
true);
11546 }
11547 }
11548 }
11549 else
11550 {
11551 if (stack_max != 0)
11552 {
11554 {
11556 }
11557
11559 {
11561
11562 if (new_item)
11563 {
11564 new_item.SetResultOfSplit(true);
11565 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11568 new_item.PlaceOnSurface();
11569 }
11570 }
11571 }
11572 }
11573 }
11574
11576 {
11578 {
11579 if (ScriptInputUserData.CanStoreInputUserData())
11580 {
11581 ScriptInputUserData ctx = new ScriptInputUserData;
11586 dst.WriteToContext(ctx);
11588 }
11589 }
11590 else if (!
g_Game.IsMultiplayer())
11591 {
11593 }
11594 }
11595
11597 {
11599 {
11600 if (ScriptInputUserData.CanStoreInputUserData())
11601 {
11602 ScriptInputUserData ctx = new ScriptInputUserData;
11607 ctx.
Write(destination_entity);
11613 }
11614 }
11615 else if (!
g_Game.IsMultiplayer())
11616 {
11618 }
11619 }
11620
11622 {
11624 }
11625
11627 {
11629 float split_quantity_new;
11631 if (dst.IsValid())
11632 {
11633 int slot_id = dst.GetSlot();
11635
11636 if (quantity > stack_max)
11637 split_quantity_new = stack_max;
11638 else
11639 split_quantity_new = quantity;
11640
11642 {
11644
11645 if (new_item)
11646 {
11647 new_item.SetResultOfSplit(true);
11648 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11650 new_item.
SetQuantity(split_quantity_new,
false,
true);
11651 }
11652
11653 return new_item;
11654 }
11655 }
11656
11657 return null;
11658 }
11659
11661 {
11663 float split_quantity_new;
11665 if (destination_entity)
11666 {
11668 if (quantity > stackable)
11669 split_quantity_new = stackable;
11670 else
11671 split_quantity_new = quantity;
11672
11674 {
11675 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11676 if (new_item)
11677 {
11678 new_item.SetResultOfSplit(true);
11679 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11681 new_item.
SetQuantity(split_quantity_new,
false,
true);
11682 }
11683 }
11684 }
11685 }
11686
11688 {
11690 {
11691 if (ScriptInputUserData.CanStoreInputUserData())
11692 {
11693 ScriptInputUserData ctx = new ScriptInputUserData;
11698 ItemBase destination_entity =
this;
11699 ctx.
Write(destination_entity);
11703 }
11704 }
11705 else if (!
g_Game.IsMultiplayer())
11706 {
11708 }
11709 }
11710
11712 {
11714 float split_quantity_new;
11716 if (player)
11717 {
11719 if (quantity > stackable)
11720 split_quantity_new = stackable;
11721 else
11722 split_quantity_new = quantity;
11723
11725 {
11726 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11727 new_item =
ItemBase.Cast(in_hands);
11728 if (new_item)
11729 {
11730 new_item.SetResultOfSplit(true);
11731 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11733 new_item.SetQuantity(split_quantity_new, false, true);
11734 }
11735 }
11736 }
11737 }
11738
11740 {
11742 float split_quantity_new = Math.Floor(quantity * 0.5);
11743
11745 return;
11746
11748
11749 if (new_item)
11750 {
11751 if (new_item.GetQuantityMax() < split_quantity_new)
11752 {
11753 split_quantity_new = new_item.GetQuantityMax();
11754 }
11755
11756 new_item.SetResultOfSplit(true);
11757 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11758
11760 {
11763 }
11764 else
11765 {
11767 new_item.
SetQuantity(split_quantity_new,
false,
true);
11768 }
11769 }
11770 }
11771
11773 {
11775 float split_quantity_new = Math.Floor(quantity / 2);
11776
11778 return;
11779
11780 InventoryLocation invloc = new InventoryLocation;
11782
11784 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11785
11786 if (new_item)
11787 {
11788 if (new_item.GetQuantityMax() < split_quantity_new)
11789 {
11790 split_quantity_new = new_item.GetQuantityMax();
11791 }
11793 {
11796 }
11797 else if (split_quantity_new > 1)
11798 {
11800 new_item.
SetQuantity(split_quantity_new,
false,
true);
11801 }
11802 }
11803 }
11804
11807 {
11808 SetWeightDirty();
11810
11811 if (parent)
11812 parent.OnAttachmentQuantityChangedEx(this, delta);
11813
11815 {
11817 {
11819 }
11821 {
11822 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11824 }
11825 }
11826 }
11827
11830 {
11831
11832 }
11833
11836 {
11838 }
11839
11841 {
11842 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11843
11845 {
11846 if (newLevel == GameConstants.STATE_RUINED)
11847 {
11849 EntityAI parent = GetHierarchyParent();
11850 if (parent && parent.IsFireplace())
11851 {
11852 CargoBase cargo = GetInventory().GetCargo();
11853 if (cargo)
11854 {
11856 {
11858 }
11859 }
11860 }
11861 }
11862
11864 {
11865
11867 return;
11868 }
11869
11870 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11871 {
11873 }
11874 }
11875 }
11876
11877
11879 {
11880 super.OnRightClick();
11881
11883 {
11885 {
11886 if (ScriptInputUserData.CanStoreInputUserData())
11887 {
11888 EntityAI root = GetHierarchyRoot();
11889 Man playerOwner = GetHierarchyRootPlayer();
11890 InventoryLocation dst = new InventoryLocation;
11891
11892
11893 if (!playerOwner && root && root == this)
11894 {
11896 }
11897 else
11898 {
11899
11900 GetInventory().GetCurrentInventoryLocation(dst);
11902 {
11903 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11905 {
11907 }
11908 else
11909 {
11911
11912
11913 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11914 {
11916 }
11917 else
11918 {
11919 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11920 }
11921 }
11922 }
11923 }
11924
11925 ScriptInputUserData ctx = new ScriptInputUserData;
11933 }
11934 }
11935 else if (!
g_Game.IsMultiplayer())
11936 {
11938 }
11939 }
11940 }
11941
11943 {
11944 if (root)
11945 {
11946 vector m4[4];
11947 root.GetTransform(m4);
11948 dst.SetGround(this, m4);
11949 }
11950 else
11951 {
11952 GetInventory().GetCurrentInventoryLocation(dst);
11953 }
11954 }
11955
11956 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11957 {
11958
11959 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11960 return false;
11961
11962 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11963 return false;
11964
11965
11967 return false;
11968
11969
11970 Magazine mag = Magazine.Cast(this);
11971 if (mag)
11972 {
11973 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11974 return false;
11975
11976 if (stack_max_limit)
11977 {
11978 Magazine other_mag = Magazine.Cast(other_item);
11979 if (other_item)
11980 {
11981 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11982 return false;
11983 }
11984
11985 }
11986 }
11987 else
11988 {
11989
11991 return false;
11992
11994 return false;
11995 }
11996
11997 PlayerBase player = null;
11998 if (CastTo(player, GetHierarchyRootPlayer()))
11999 {
12000 if (player.GetInventory().HasAttachment(this))
12001 return false;
12002
12003 if (player.IsItemsToDelete())
12004 return false;
12005 }
12006
12007 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
12008 return false;
12009
12010 int slotID;
12012 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
12013 return false;
12014
12015 return true;
12016 }
12017
12019 {
12021 }
12022
12024 {
12025 return m_IsResultOfSplit;
12026 }
12027
12029 {
12030 m_IsResultOfSplit = value;
12031 }
12032
12034 {
12036 }
12037
12039 {
12040 float other_item_quantity = other_item.GetQuantity();
12041 float this_free_space;
12042
12044
12046
12047 if (other_item_quantity > this_free_space)
12048 {
12049 return this_free_space;
12050 }
12051 else
12052 {
12053 return other_item_quantity;
12054 }
12055 }
12056
12058 {
12060 }
12061
12063 {
12065 return;
12066
12067 if (!IsMagazine() && other_item)
12068 {
12070 if (quantity_used != 0)
12071 {
12072 float hp1 = GetHealth01("","");
12073 float hp2 = other_item.GetHealth01("","");
12074 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12075 hpResult = hpResult / (
GetQuantity() + quantity_used);
12076
12077 hpResult *= GetMaxHealth();
12078 Math.Round(hpResult);
12079 SetHealth("", "Health", hpResult);
12080
12082 other_item.AddQuantity(-quantity_used);
12083 }
12084 }
12086 }
12087
12089 {
12090 #ifdef SERVER
12091 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12092 GetHierarchyParent().IncreaseLifetimeUp();
12093 #endif
12094 };
12095
12097 {
12098 PlayerBase p = PlayerBase.Cast(player);
12099
12100 array<int> recipesIds = p.m_Recipes;
12101 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12102 if (moduleRecipesManager)
12103 {
12104 EntityAI itemInHands = player.GetEntityInHands();
12105 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12106 }
12107
12108 for (int i = 0;i < recipesIds.Count(); i++)
12109 {
12110 int key = recipesIds.Get(i);
12111 string recipeName = moduleRecipesManager.GetRecipeName(key);
12113 }
12114 }
12115
12116
12117 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12118 {
12119 super.GetDebugActions(outputList);
12120
12121
12127
12128
12133
12138
12139
12143
12144
12146 {
12150 }
12151
12154
12155
12159
12161
12162 InventoryLocation loc = new InventoryLocation();
12163 GetInventory().GetCurrentInventoryLocation(loc);
12165 {
12166 if (Gizmo_IsSupported())
12169 }
12170
12172 }
12173
12174
12175
12176
12178 {
12179 super.OnAction(action_id, player, ctx);
12180
12182 {
12183 switch (action_id)
12184 {
12188 return true;
12192 return true;
12193 }
12194 }
12195
12197 {
12198 switch (action_id)
12199 {
12201 Delete();
12202 return true;
12203 }
12204 }
12205
12206 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12207 {
12208 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12209 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12210 PlayerBase p = PlayerBase.Cast(player);
12211 if (
EActions.RECIPES_RANGE_START < 1000)
12212 {
12213 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12214 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12215 }
12216 }
12217 #ifndef SERVER
12218 else if (action_id ==
EActions.WATCH_PLAYER)
12219 {
12220 PluginDeveloper.SetDeveloperItemClientEx(player);
12221 }
12222 #endif
12224 {
12225 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12226 {
12227 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12228 OnDebugButtonPressServer(id + 1);
12229 }
12230
12231 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12232 {
12233 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12235 }
12236
12237 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12238 {
12239 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12241 }
12242
12243 else if (action_id ==
EActions.ADD_QUANTITY)
12244 {
12245 if (IsMagazine())
12246 {
12247 Magazine mag = Magazine.Cast(this);
12248 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12249 }
12250 else
12251 {
12253 }
12254
12255 if (m_EM)
12256 {
12257 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12258 }
12259
12260 }
12261
12262 else if (action_id ==
EActions.REMOVE_QUANTITY)
12263 {
12264 if (IsMagazine())
12265 {
12266 Magazine mag2 = Magazine.Cast(this);
12267 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12268 }
12269 else
12270 {
12272 }
12273 if (m_EM)
12274 {
12275 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12276 }
12277
12278 }
12279
12280 else if (action_id ==
EActions.SET_QUANTITY_0)
12281 {
12283
12284 if (m_EM)
12285 {
12286 m_EM.SetEnergy(0);
12287 }
12288 }
12289
12290 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12291 {
12293
12294 if (m_EM)
12295 {
12296 m_EM.SetEnergy(m_EM.GetEnergyMax());
12297 }
12298 }
12299
12300 else if (action_id ==
EActions.ADD_HEALTH)
12301 {
12302 AddHealth("","",GetMaxHealth("","Health")/5);
12303 }
12304 else if (action_id ==
EActions.REMOVE_HEALTH)
12305 {
12306 AddHealth("","",-GetMaxHealth("","Health")/5);
12307 }
12308 else if (action_id ==
EActions.DESTROY_HEALTH)
12309 {
12310 SetHealth01("","",0);
12311 }
12312 else if (action_id ==
EActions.WATCH_ITEM)
12313 {
12315 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12316 #ifdef DEVELOPER
12317 SetDebugDeveloper_item(this);
12318 #endif
12319 }
12320
12321 else if (action_id ==
EActions.ADD_TEMPERATURE)
12322 {
12323 AddTemperature(20);
12324
12325 }
12326
12327 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12328 {
12329 AddTemperature(-20);
12330
12331 }
12332
12333 else if (action_id ==
EActions.FLIP_FROZEN)
12334 {
12335 SetFrozen(!GetIsFrozen());
12336
12337 }
12338
12339 else if (action_id ==
EActions.ADD_WETNESS)
12340 {
12342
12343 }
12344
12345 else if (action_id ==
EActions.REMOVE_WETNESS)
12346 {
12348
12349 }
12350
12351 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12352 {
12355
12356
12357 }
12358
12359 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12360 {
12363 }
12364
12365 else if (action_id ==
EActions.MAKE_SPECIAL)
12366 {
12367 auto debugParams = DebugSpawnParams.WithPlayer(player);
12368 OnDebugSpawnEx(debugParams);
12369 }
12370
12371 }
12372
12373
12374 return false;
12375 }
12376
12377
12378
12379
12383
12386
12387
12388
12390 {
12391 return false;
12392 }
12393
12394
12396 {
12397 return true;
12398 }
12399
12400
12402 {
12403 return true;
12404 }
12405
12406
12407
12409 {
12410 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12411 return g_Game.ConfigIsExisting(config_path);
12412 }
12413
12416 {
12417 return null;
12418 }
12419
12421 {
12422 return false;
12423 }
12424
12426 {
12427 return false;
12428 }
12429
12433
12434
12436 {
12437 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12438 return module_repairing.CanRepair(this, item_repair_kit);
12439 }
12440
12441
12442 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12443 {
12444 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12445 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12446 }
12447
12448
12450 {
12451
12452
12453
12454
12455
12456
12457
12458
12459 return 1;
12460 }
12461
12462
12463
12465 {
12467 }
12468
12469
12470
12472 {
12474 }
12475
12476
12485 {
12486 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12487
12488 if (player)
12489 {
12490 player.MessageStatus(text);
12491 }
12492 }
12493
12494
12503 {
12504 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12505
12506 if (player)
12507 {
12508 player.MessageAction(text);
12509 }
12510 }
12511
12512
12521 {
12522 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12523
12524 if (player)
12525 {
12526 player.MessageFriendly(text);
12527 }
12528 }
12529
12530
12539 {
12540 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12541
12542 if (player)
12543 {
12544 player.MessageImportant(text);
12545 }
12546 }
12547
12549 {
12550 return true;
12551 }
12552
12553
12554 override bool KindOf(
string tag)
12555 {
12556 bool found = false;
12557 string item_name = this.
GetType();
12559 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12560
12561 int array_size = item_tag_array.Count();
12562 for (int i = 0; i < array_size; i++)
12563 {
12564 if (item_tag_array.Get(i) == tag)
12565 {
12566 found = true;
12567 break;
12568 }
12569 }
12570 return found;
12571 }
12572
12573
12575 {
12576
12577 super.OnRPC(sender, rpc_type,ctx);
12578
12579
12580 switch (rpc_type)
12581 {
12582 #ifndef SERVER
12583 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12584 Param2<bool, string> p = new Param2<bool, string>(false, "");
12585
12587 return;
12588
12589 bool play = p.param1;
12590 string soundSet = p.param2;
12591
12592 if (play)
12593 {
12595 {
12597 {
12599 }
12600 }
12601 else
12602 {
12604 }
12605 }
12606 else
12607 {
12609 }
12610
12611 break;
12612 #endif
12613
12614 }
12615
12617 {
12619 }
12620 }
12621
12622
12623
12624
12626 {
12627 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12628 return plugin.GetID(
name);
12629 }
12630
12632 {
12633 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12634 return plugin.GetName(id);
12635 }
12636
12639 {
12640
12641
12642 int varFlags;
12643 if (!ctx.
Read(varFlags))
12644 return;
12645
12646 if (varFlags & ItemVariableFlags.FLOAT)
12647 {
12649 }
12650 }
12651
12653 {
12654
12655 super.SerializeNumericalVars(floats_out);
12656
12657
12658
12660 {
12662 }
12663
12665 {
12667 }
12668
12670 {
12672 }
12673
12675 {
12680 }
12681
12683 {
12685 }
12686 }
12687
12689 {
12690
12691 super.DeSerializeNumericalVars(floats);
12692
12693
12694 int index = 0;
12695 int mask = Math.Round(floats.Get(index));
12696
12697 index++;
12698
12700 {
12702 {
12704 }
12705 else
12706 {
12707 float quantity = floats.Get(index);
12708 SetQuantity(quantity,
true,
false,
false,
false);
12709 }
12710 index++;
12711 }
12712
12714 {
12715 float wet = floats.Get(index);
12717 index++;
12718 }
12719
12721 {
12722 int liquidtype = Math.Round(floats.Get(index));
12724 index++;
12725 }
12726
12728 {
12730 index++;
12732 index++;
12734 index++;
12736 index++;
12737 }
12738
12740 {
12741 int cleanness = Math.Round(floats.Get(index));
12743 index++;
12744 }
12745 }
12746
12748 {
12749 super.WriteVarsToCTX(ctx);
12750
12751
12753 {
12755 }
12756
12758 {
12760 }
12761
12763 {
12765 }
12766
12768 {
12769 int r,g,b,a;
12775 }
12776
12778 {
12780 }
12781 }
12782
12784 {
12785 if (!super.ReadVarsFromCTX(ctx,version))
12786 return false;
12787
12788 int intValue;
12789 float value;
12790
12791 if (version < 140)
12792 {
12793 if (!ctx.
Read(intValue))
12794 return false;
12795
12796 m_VariablesMask = intValue;
12797 }
12798
12800 {
12801 if (!ctx.
Read(value))
12802 return false;
12803
12805 {
12807 }
12808 else
12809 {
12811 }
12812 }
12813
12814 if (version < 140)
12815 {
12817 {
12818 if (!ctx.
Read(value))
12819 return false;
12820 SetTemperatureDirect(value);
12821 }
12822 }
12823
12825 {
12826 if (!ctx.
Read(value))
12827 return false;
12829 }
12830
12832 {
12833 if (!ctx.
Read(intValue))
12834 return false;
12836 }
12837
12839 {
12840 int r,g,b,a;
12842 return false;
12844 return false;
12846 return false;
12848 return false;
12849
12851 }
12852
12854 {
12855 if (!ctx.
Read(intValue))
12856 return false;
12858 }
12859
12860 if (version >= 138 && version < 140)
12861 {
12863 {
12864 if (!ctx.
Read(intValue))
12865 return false;
12866 SetFrozen(intValue);
12867 }
12868 }
12869
12870 return true;
12871 }
12872
12873
12875 {
12878 {
12880 }
12881
12882 if (!super.OnStoreLoad(ctx, version))
12883 {
12885 return false;
12886 }
12887
12888 if (version >= 114)
12889 {
12890 bool hasQuickBarIndexSaved;
12891
12892 if (!ctx.
Read(hasQuickBarIndexSaved))
12893 {
12895 return false;
12896 }
12897
12898 if (hasQuickBarIndexSaved)
12899 {
12900 int itmQBIndex;
12901
12902
12903 if (!ctx.
Read(itmQBIndex))
12904 {
12906 return false;
12907 }
12908
12909 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12910 if (itmQBIndex != -1 && parentPlayer)
12911 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12912 }
12913 }
12914 else
12915 {
12916
12917 PlayerBase player;
12918 int itemQBIndex;
12919 if (version ==
int.
MAX)
12920 {
12921 if (!ctx.
Read(itemQBIndex))
12922 {
12924 return false;
12925 }
12926 }
12927 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12928 {
12929
12930 if (!ctx.
Read(itemQBIndex))
12931 {
12933 return false;
12934 }
12935 if (itemQBIndex != -1 && player)
12936 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12937 }
12938 }
12939
12940 if (version < 140)
12941 {
12942
12943 if (!LoadVariables(ctx, version))
12944 {
12946 return false;
12947 }
12948 }
12949
12950
12952 {
12954 return false;
12955 }
12956 if (version >= 132)
12957 {
12959 if (raib)
12960 {
12962 {
12964 return false;
12965 }
12966 }
12967 }
12968
12970 return true;
12971 }
12972
12973
12974
12976 {
12977 super.OnStoreSave(ctx);
12978
12979 PlayerBase player;
12980 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12981 {
12983
12984 int itemQBIndex = -1;
12985 itemQBIndex = player.FindQuickBarEntityIndex(this);
12986 ctx.
Write(itemQBIndex);
12987 }
12988 else
12989 {
12991 }
12992
12994
12996 if (raib)
12997 {
12999 }
13000 }
13001
13002
13004 {
13005 super.AfterStoreLoad();
13006
13008 {
13010 }
13011
13013 {
13016 }
13017 }
13018
13020 {
13021 super.EEOnAfterLoad();
13022
13024 {
13026 }
13027
13030 }
13031
13033 {
13034 return false;
13035 }
13036
13037
13038
13040 {
13042 {
13043 #ifdef PLATFORM_CONSOLE
13044
13046 {
13048 if (menu)
13049 {
13051 }
13052 }
13053 #endif
13054 }
13055
13057 {
13060 }
13061
13063 {
13064 SetWeightDirty();
13066 }
13068 {
13071 }
13072
13074 {
13077
13080 }
13082 {
13086 }
13087
13088 super.OnVariablesSynchronized();
13089 }
13090
13091
13092
13094 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13095 {
13096 if (!IsServerCheck(allow_client))
13097 return false;
13098
13100 return false;
13101
13104
13105 if (value <= (min + 0.001))
13106 value = min;
13107
13108 if (value == min)
13109 {
13110 if (destroy_config)
13111 {
13112 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13113 if (dstr)
13114 {
13116 this.Delete();
13117 return true;
13118 }
13119 }
13120 else if (destroy_forced)
13121 {
13123 this.Delete();
13124 return true;
13125 }
13126
13128 }
13129
13132
13134 {
13135 EntityAI parent = GetHierarchyRoot();
13136 InventoryLocation iLoc = new InventoryLocation();
13137 GetInventory().GetCurrentInventoryLocation(iLoc);
13139 {
13140 int iLocSlot = iLoc.
GetSlot();
13142 {
13144 }
13146 {
13148 }
13149 }
13150 }
13151
13153 {
13155
13156 if (delta)
13158 }
13159
13161
13162 return false;
13163 }
13164
13165
13167 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13168 {
13170 }
13171
13173 {
13176 }
13177
13179 {
13182 }
13183
13185 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13186 {
13187 float value_clamped = Math.Clamp(value, 0, 1);
13189 SetQuantity(result, destroy_config, destroy_forced);
13190 }
13191
13192
13195 {
13197 }
13198
13200 {
13202 }
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13214 {
13215 int slot = -1;
13216 GameInventory inventory = GetInventory();
13217 if (inventory)
13218 {
13219 InventoryLocation il = new InventoryLocation;
13222 }
13223
13225 }
13226
13228 {
13229 float quantity_max = 0;
13230
13232 {
13233 if (attSlotID != -1)
13234 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13235
13236 if (quantity_max <= 0)
13238 }
13239
13240 if (quantity_max <= 0)
13242
13243 return quantity_max;
13244 }
13245
13247 {
13249 }
13250
13252 {
13254 }
13255
13256
13258 {
13260 }
13261
13263 {
13265 }
13266
13268 {
13270 }
13271
13272
13274 {
13275
13276 float weightEx = GetWeightEx();
13277 float special = GetInventoryAndCargoWeight();
13278 return weightEx - special;
13279 }
13280
13281
13283 {
13285 }
13286
13288 {
13290 {
13291 #ifdef DEVELOPER
13292 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13293 {
13294 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13296 }
13297 #endif
13298
13299 return GetQuantity() * GetConfigWeightModified();
13300 }
13301 else if (HasEnergyManager())
13302 {
13303 #ifdef DEVELOPER
13304 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13305 {
13306 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13307 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13308 }
13309 #endif
13310 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13311 }
13312 else
13313 {
13314 #ifdef DEVELOPER
13315 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13316 {
13317 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13318 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13319 }
13320 #endif
13321 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13322 }
13323 }
13324
13327 {
13328 int item_count = 0;
13330
13331 GameInventory inventory = GetInventory();
13332 CargoBase cargo = inventory.
GetCargo();
13333 if (cargo != NULL)
13334 {
13336 }
13337
13339 for (int i = 0; i < nAttachments; ++i)
13340 {
13342 if (item)
13343 item_count += item.GetNumberOfItems();
13344 }
13345 return item_count;
13346 }
13347
13350 {
13351 float weight = 0;
13352 float wetness = 1;
13353 if (include_wetness)
13356 {
13357 weight = wetness * m_ConfigWeight;
13358 }
13360 {
13361 weight = 1;
13362 }
13363 return weight;
13364 }
13365
13366
13367
13369 {
13370 GameInventory inventory = GetInventory();
13371 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13372 {
13373 array<EntityAI> items = new array<EntityAI>;
13375 for (int i = 0; i < items.Count(); ++i)
13376 {
13378 if (item)
13379 {
13380 g_Game.ObjectDelete(item);
13381 }
13382 }
13383 }
13384 }
13385
13386
13387
13388
13390 {
13391 float energy = 0;
13392 if (HasEnergyManager())
13393 {
13394 energy = GetCompEM().GetEnergy();
13395 }
13396 return energy;
13397 }
13398
13399
13401 {
13402 super.OnEnergyConsumed();
13403
13405 }
13406
13408 {
13409 super.OnEnergyAdded();
13410
13412 }
13413
13414
13416 {
13417 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13418 {
13420 {
13421 float energy_0to1 = GetCompEM().GetEnergy0To1();
13423 }
13424 }
13425 }
13426
13427
13429 {
13430 return ConfigGetFloat("heatIsolation");
13431 }
13432
13434 {
13436 }
13437
13439 {
13440 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13441 if (
g_Game.ConfigIsExisting(paramPath))
13442 return g_Game.ConfigGetFloat(paramPath);
13443
13444 return 0.0;
13445 }
13446
13448 {
13449 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13450 if (
g_Game.ConfigIsExisting(paramPath))
13451 return g_Game.ConfigGetFloat(paramPath);
13452
13453 return 0.0;
13454 }
13455
13456 override void SetWet(
float value,
bool allow_client =
false)
13457 {
13458 if (!IsServerCheck(allow_client))
13459 return;
13460
13463
13465
13466 m_VarWet = Math.Clamp(value, min, max);
13467
13469 {
13472 }
13473 }
13474
13475 override void AddWet(
float value)
13476 {
13478 }
13479
13481 {
13483 }
13484
13486 {
13488 }
13489
13491 {
13493 }
13494
13496 {
13498 }
13499
13501 {
13503 }
13504
13505 override void OnWetChanged(
float newVal,
float oldVal)
13506 {
13509 if (newLevel != oldLevel)
13510 {
13512 }
13513 }
13514
13516 {
13517 SetWeightDirty();
13518 }
13519
13521 {
13522 return GetWetLevelInternal(
m_VarWet);
13523 }
13524
13525
13526
13528 {
13530 }
13531
13533 {
13535 }
13536
13538 {
13540 }
13541
13543 {
13545 }
13546
13547
13548
13550 {
13551 if (ConfigIsExisting("itemModelLength"))
13552 {
13553 return ConfigGetFloat("itemModelLength");
13554 }
13555 return 0;
13556 }
13557
13559 {
13560 if (ConfigIsExisting("itemAttachOffset"))
13561 {
13562 return ConfigGetFloat("itemAttachOffset");
13563 }
13564 return 0;
13565 }
13566
13567 override void SetCleanness(
int value,
bool allow_client =
false)
13568 {
13569 if (!IsServerCheck(allow_client))
13570 return;
13571
13573
13575
13578 }
13579
13581 {
13583 }
13584
13586 {
13587 return true;
13588 }
13589
13590
13591
13592
13594 {
13596 }
13597
13599 {
13601 }
13602
13603
13604
13605
13606 override void SetColor(
int r,
int g,
int b,
int a)
13607 {
13613 }
13615 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13616 {
13621 }
13622
13624 {
13626 }
13627
13630 {
13631 int r,g,b,a;
13633 r = r/255;
13634 g = g/255;
13635 b = b/255;
13636 a = a/255;
13637 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13638 }
13639
13640
13641
13642 override void SetLiquidType(
int value,
bool allow_client =
false)
13643 {
13644 if (!IsServerCheck(allow_client))
13645 return;
13646
13651 }
13652
13654 {
13655 return ConfigGetInt("varLiquidTypeInit");
13656 }
13657
13659 {
13661 }
13662
13664 {
13666 SetFrozen(false);
13667 }
13668
13671 {
13672 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13673 }
13674
13675
13678 {
13679 PlayerBase nplayer;
13680 if (PlayerBase.CastTo(nplayer, player))
13681 {
13683 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13684 }
13685 }
13686
13687
13690 {
13691 PlayerBase nplayer;
13692 if (PlayerBase.CastTo(nplayer,player))
13693 {
13694 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13695 }
13696
13697 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13698
13699 if (HasEnergyManager())
13700 {
13701 GetCompEM().UpdatePlugState();
13702 }
13703 }
13704
13705
13707 {
13708 super.OnPlacementStarted(player);
13709
13711 }
13712
13713 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13714 {
13716 {
13717 m_AdminLog.OnPlacementComplete(player,
this);
13718 }
13719
13720 super.OnPlacementComplete(player, position, orientation);
13721 }
13722
13723
13724
13725
13726
13728 {
13730 {
13731 return true;
13732 }
13733 else
13734 {
13735 return false;
13736 }
13737 }
13738
13739
13741 {
13743 {
13745 }
13746 }
13747
13748
13750 {
13752 }
13753
13755 {
13757 }
13758
13759 override void InsertAgent(
int agent,
float count = 1)
13760 {
13761 if (count < 1)
13762 return;
13763
13765 }
13766
13769 {
13771 }
13772
13773
13775 {
13777 }
13778
13779
13780
13781
13782
13783
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
13821 {
13823 return false;
13824 return true;
13825 }
13826
13828 {
13829
13831 }
13832
13833
13836 {
13837 super.CheckForRoofLimited(timeTresholdMS);
13838
13839 float time =
g_Game.GetTime();
13840 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13841 {
13842 m_PreviousRoofTestTime = time;
13843 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13844 }
13845 }
13846
13847
13849 {
13851 {
13852 return 0;
13853 }
13854
13855 if (GetInventory().GetAttachmentSlotsCount() != 0)
13856 {
13857 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13858 if (filter)
13859 return filter.GetProtectionLevel(type, false, system);
13860 else
13861 return 0;
13862 }
13863
13864 string subclassPath, entryName;
13865
13866 switch (type)
13867 {
13869 entryName = "biological";
13870 break;
13872 entryName = "chemical";
13873 break;
13874 default:
13875 entryName = "biological";
13876 break;
13877 }
13878
13879 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13880
13881 return g_Game.ConfigGetFloat(subclassPath + entryName);
13882 }
13883
13884
13885
13888 {
13889 if (!IsMagazine())
13891
13893 }
13894
13895
13896
13897
13898
13903 {
13904 return true;
13905 }
13906
13908 {
13910 }
13911
13912
13913
13914
13915
13917 {
13918 if (parent)
13919 {
13920 if (parent.IsInherited(DayZInfected))
13921 return true;
13922
13923 if (!parent.IsRuined())
13924 return true;
13925 }
13926
13927 return true;
13928 }
13929
13931 {
13932 if (!super.CanPutAsAttachment(parent))
13933 {
13934 return false;
13935 }
13936
13937 if (!IsRuined() && !parent.IsRuined())
13938 {
13939 return true;
13940 }
13941
13942 return false;
13943 }
13944
13946 {
13947
13948
13949
13950
13951 return super.CanReceiveItemIntoCargo(item);
13952 }
13953
13955 {
13956
13957
13958
13959
13960 GameInventory attachmentInv = attachment.GetInventory();
13962 {
13963 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13964 return false;
13965 }
13966
13967 InventoryLocation loc = new InventoryLocation();
13968 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13969 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13970 return false;
13971
13972 return super.CanReceiveAttachment(attachment, slotId);
13973 }
13974
13976 {
13977 if (!super.CanReleaseAttachment(attachment))
13978 return false;
13979
13980 return GetInventory().AreChildrenAccessible();
13981 }
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14004 {
14005 int id = muzzle_owner.GetMuzzleID();
14006 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
14007
14008 if (WPOF_array)
14009 {
14010 for (int i = 0; i < WPOF_array.Count(); i++)
14011 {
14012 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
14013
14014 if (WPOF)
14015 {
14016 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
14017 }
14018 }
14019 }
14020 }
14021
14022
14024 {
14025 int id = muzzle_owner.GetMuzzleID();
14027
14028 if (WPOBE_array)
14029 {
14030 for (int i = 0; i < WPOBE_array.Count(); i++)
14031 {
14032 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14033
14034 if (WPOBE)
14035 {
14036 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14037 }
14038 }
14039 }
14040 }
14041
14042
14044 {
14045 int id = muzzle_owner.GetMuzzleID();
14046 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14047
14048 if (WPOOH_array)
14049 {
14050 for (int i = 0; i < WPOOH_array.Count(); i++)
14051 {
14052 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14053
14054 if (WPOOH)
14055 {
14056 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14057 }
14058 }
14059 }
14060 }
14061
14062
14064 {
14065 int id = muzzle_owner.GetMuzzleID();
14066 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14067
14068 if (WPOOH_array)
14069 {
14070 for (int i = 0; i < WPOOH_array.Count(); i++)
14071 {
14072 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14073
14074 if (WPOOH)
14075 {
14076 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14077 }
14078 }
14079 }
14080 }
14081
14082
14084 {
14085 int id = muzzle_owner.GetMuzzleID();
14086 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14087
14088 if (WPOOH_array)
14089 {
14090 for (int i = 0; i < WPOOH_array.Count(); i++)
14091 {
14092 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14093
14094 if (WPOOH)
14095 {
14096 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14097 }
14098 }
14099 }
14100 }
14101
14102
14103
14105 {
14107 {
14108 return true;
14109 }
14110
14111 return false;
14112 }
14113
14115 {
14117 {
14118 return true;
14119 }
14120
14121 return false;
14122 }
14123
14125 {
14127 {
14128 return true;
14129 }
14130
14131 return false;
14132 }
14133
14135 {
14136 return false;
14137 }
14138
14141 {
14142 return UATimeSpent.DEFAULT_DEPLOY;
14143 }
14144
14145
14146
14147
14149 {
14151 SetSynchDirty();
14152 }
14153
14155 {
14157 }
14158
14159
14161 {
14162 return false;
14163 }
14164
14167 {
14168 string att_type = "None";
14169
14170 if (ConfigIsExisting("soundAttType"))
14171 {
14172 att_type = ConfigGetString("soundAttType");
14173 }
14174
14176 }
14177
14179 {
14181 }
14182
14183
14184
14185
14186
14192
14194 {
14197
14199 }
14200
14201
14203 {
14205 return;
14206
14208
14211
14214
14215 SoundParameters params = new SoundParameters();
14219 }
14220
14221
14223 {
14225 {
14228
14229 SetSynchDirty();
14230
14233 }
14234 }
14235
14237 {
14239 }
14240
14241
14243 {
14245 return;
14246
14248 SetSynchDirty();
14249
14252 }
14253
14255 {
14258 }
14259
14261 {
14263 }
14264
14265 void OnApply(PlayerBase player);
14266
14268 {
14269 return 1.0;
14270 };
14271
14273 {
14275 }
14276
14278 {
14280 }
14281
14283
14285 {
14286 SetDynamicPhysicsLifeTime(0.01);
14288 }
14289
14291 {
14292 array<string> zone_names = new array<string>;
14293 GetDamageZones(zone_names);
14294 for (int i = 0; i < zone_names.Count(); i++)
14295 {
14296 SetHealthMax(zone_names.Get(i),"Health");
14297 }
14298 SetHealthMax("","Health");
14299 }
14300
14303 {
14304 float global_health = GetHealth01("","Health");
14305 array<string> zones = new array<string>;
14306 GetDamageZones(zones);
14307
14308 for (int i = 0; i < zones.Count(); i++)
14309 {
14310 SetHealth01(zones.Get(i),"Health",global_health);
14311 }
14312 }
14313
14316 {
14317 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14318 }
14319
14321 {
14322 if (!hasRootAsPlayer)
14323 {
14324 if (refParentIB)
14325 {
14326
14327 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14328 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14329
14330 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14331 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14332
14335 }
14336 else
14337 {
14338
14341 }
14342 }
14343 }
14344
14346 {
14348 {
14349 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14350 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14351 {
14352 float heatPermCoef = 1.0;
14354 while (ent)
14355 {
14356 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14357 ent = ent.GetHierarchyParent();
14358 }
14359
14360 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14361 }
14362 }
14363 }
14364
14366 {
14367
14368 EntityAI parent = GetHierarchyParent();
14369 if (!parent)
14370 {
14371 hasParent = false;
14372 hasRootAsPlayer = false;
14373 }
14374 else
14375 {
14376 hasParent = true;
14377 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14378 refParentIB =
ItemBase.Cast(parent);
14379 }
14380 }
14381
14382 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14383 {
14384
14385 }
14386
14388 {
14389
14390 return false;
14391 }
14392
14394 {
14395
14396
14397 return false;
14398 }
14399
14401 {
14402
14403 return false;
14404 }
14405
14408 {
14409 return !GetIsFrozen() &&
IsOpen();
14410 }
14411
14413 {
14414 bool hasParent = false, hasRootAsPlayer = false;
14416
14417 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14418 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14419
14420 if (wwtu || foodDecay)
14421 {
14425
14426 if (processWetness || processTemperature || processDecay)
14427 {
14429
14430 if (processWetness)
14431 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14432
14433 if (processTemperature)
14435
14436 if (processDecay)
14437 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14438 }
14439 }
14440 }
14441
14444 {
14446 }
14447
14449 {
14452
14453 return super.GetTemperatureFreezeThreshold();
14454 }
14455
14457 {
14460
14461 return super.GetTemperatureThawThreshold();
14462 }
14463
14465 {
14468
14469 return super.GetItemOverheatThreshold();
14470 }
14471
14473 {
14475 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14476
14477 return super.GetTemperatureFreezeTime();
14478 }
14479
14481 {
14483 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14484
14485 return super.GetTemperatureThawTime();
14486 }
14487
14492
14494 {
14495 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14496 }
14497
14499 {
14500 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14501 }
14502
14505 {
14507 }
14508
14510 {
14512 }
14513
14515 {
14517 }
14518
14521 {
14522 return null;
14523 }
14524
14527 {
14528 return false;
14529 }
14530
14532 {
14534 {
14537 if (!trg)
14538 {
14540 explosive = this;
14541 }
14542
14543 explosive.PairRemote(trg);
14545
14546 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14547 trg.SetPersistentPairID(persistentID);
14548 explosive.SetPersistentPairID(persistentID);
14549
14550 return true;
14551 }
14552 return false;
14553 }
14554
14557 {
14558 float ret = 1.0;
14561 ret *= GetHealth01();
14562
14563 return ret;
14564 }
14565
14566 #ifdef DEVELOPER
14567 override void SetDebugItem()
14568 {
14569 super.SetDebugItem();
14570 _itemBase = this;
14571 }
14572
14574 {
14575 string text = super.GetDebugText();
14576
14578 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14579
14580 return text;
14581 }
14582 #endif
14583
14585 {
14586 return true;
14587 }
14588
14590
14592
14594 {
14597 }
14598
14599
14607
14623
14624 [
Obsolete(
"Use ItemSoundHandler instead")]
14627 {
14628 if (!
g_Game.IsDedicatedServer())
14629 {
14630 if (ConfigIsExisting("attachSoundSet"))
14631 {
14632 string cfg_path = "";
14633 string soundset = "";
14634 string type_name =
GetType();
14635
14638 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14639 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14640
14641 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14642 {
14643 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14644 {
14645 if (cfg_slot_array[i] == slot_type)
14646 {
14647 soundset = cfg_soundset_array[i];
14648 break;
14649 }
14650 }
14651 }
14652
14653 if (soundset != "")
14654 {
14655 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14657 }
14658 }
14659 }
14660 }
14661
14663}
14664
14666{
14668 if (entity)
14669 {
14670 bool is_item = entity.IsInherited(
ItemBase);
14671 if (is_item && full_quantity)
14672 {
14675 }
14676 }
14677 else
14678 {
14680 return NULL;
14681 }
14682 return entity;
14683}
14684
14686{
14687 if (item)
14688 {
14689 if (health > 0)
14690 item.SetHealth("", "", health);
14691
14692 if (item.CanHaveTemperature())
14693 {
14695 if (item.CanFreeze())
14696 item.SetFrozen(false);
14697 }
14698
14699 if (item.HasEnergyManager())
14700 {
14701 if (quantity >= 0)
14702 {
14703 item.GetCompEM().SetEnergy0To1(quantity);
14704 }
14705 else
14706 {
14708 }
14709 }
14710 else if (item.IsMagazine())
14711 {
14712 Magazine mag = Magazine.Cast(item);
14713 if (quantity >= 0)
14714 {
14715 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14716 }
14717 else
14718 {
14720 }
14721
14722 }
14723 else
14724 {
14725 if (quantity >= 0)
14726 {
14727 item.SetQuantityNormalized(quantity, false);
14728 }
14729 else
14730 {
14732 }
14733
14734 }
14735 }
14736}
14737
14738#ifdef DEVELOPER
14740#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.