9757{
9759 {
9760 return true;
9761 }
9762};
9763
9765{
9766
9767};
9768
9769
9770
9772{
9776
9778
9781
9782
9783
9784
9785
9794
9800
9805
9810
9831 protected bool m_IsResultOfSplit
9832
9834
9839
9840
9841
9843
9847
9848
9849
9851
9854
9855
9856
9862
9863
9871
9874
9875
9877
9878
9880
9881
9886
9887
9892
9894
9895
9897
9898
9900 {
9905
9906 if (!
g_Game.IsDedicatedServer())
9907 {
9909 {
9911
9913 {
9915 }
9916 }
9917
9920 }
9921
9922 m_OldLocation = null;
9923
9925 {
9927 }
9928
9929 if (ConfigIsExisting("headSelectionsToHide"))
9930 {
9933 }
9934
9936 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9937 {
9939 }
9940
9942
9943 m_IsResultOfSplit = false;
9944
9946 }
9947
9949 {
9950 super.InitItemVariables();
9951
9957 m_Count = ConfigGetInt(
"count");
9958
9961
9966
9969
9974
9986
9990
9991
9994 if (ConfigIsExisting("canBeSplit"))
9995 {
9998 }
9999
10001 if (ConfigIsExisting("itemBehaviour"))
10003
10004
10007 RegisterNetSyncVariableInt("m_VarLiquidType");
10008 RegisterNetSyncVariableInt("m_Cleanness",0,1);
10009
10010 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
10011 RegisterNetSyncVariableFloat("m_ImpactSpeed");
10012 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
10013
10014 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
10015 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
10016 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
10017 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
10018
10019 RegisterNetSyncVariableBool("m_IsBeingPlaced");
10020 RegisterNetSyncVariableBool("m_IsTakeable");
10021 RegisterNetSyncVariableBool("m_IsHologram");
10022
10025 {
10028 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10029 }
10030
10032
10034 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10036
10038 }
10039
10041 {
10043 }
10044
10046 {
10049 {
10054 }
10055 }
10056
10057 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10058 {
10060 {
10063 }
10064
10066 }
10067
10069 {
10075 }
10076
10078
10080 {
10082
10083 if (!action)
10084 {
10085 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10086 return;
10087 }
10088
10090 if (!ai)
10091 {
10093 return;
10094 }
10095
10097 if (!action_array)
10098 {
10099 action_array = new array<ActionBase_Basic>;
10101 }
10102 if (LogManager.IsActionLogEnable())
10103 {
10104 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10105 }
10106
10107 if (action_array.Find(action) != -1)
10108 {
10109 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10110 }
10111 else
10112 {
10113 action_array.Insert(action);
10114 }
10115 }
10116
10118 {
10119 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10120 ActionBase action = player.GetActionManager().GetAction(actionName);
10123
10124 if (action_array)
10125 {
10126 action_array.RemoveItem(action);
10127 }
10128 }
10129
10130
10131
10133 {
10134 ActionOverrideData overrideData = new ActionOverrideData();
10138
10140 if (!actionMap)
10141 {
10144 }
10145
10146 actionMap.Insert(this.
Type(), overrideData);
10147
10148 }
10149
10151
10153
10154
10156 {
10159
10162
10163 string config_to_search = "CfgVehicles";
10164 string muzzle_owner_config;
10165
10167 {
10168 if (IsInherited(Weapon))
10169 config_to_search = "CfgWeapons";
10170
10171 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10172
10173 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10174
10175 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10176
10177 if (config_OnFire_subclass_count > 0)
10178 {
10179 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10180
10181 for (int i = 0; i < config_OnFire_subclass_count; i++)
10182 {
10183 string particle_class = "";
10184 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10185 string config_OnFire_entry = config_OnFire_class + particle_class;
10186 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10187 WPOF_array.Insert(WPOF);
10188 }
10189
10190
10192 }
10193 }
10194
10196 {
10197 config_to_search = "CfgWeapons";
10198 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10199
10200 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10201
10202 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10203
10204 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10205 {
10206 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10207
10208 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10209 {
10210 string particle_class2 = "";
10211 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10212 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10213 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10214 WPOBE_array.Insert(WPOBE);
10215 }
10216
10217
10219 }
10220 }
10221 }
10222
10223
10225 {
10228
10230 {
10231 string config_to_search = "CfgVehicles";
10232
10233 if (IsInherited(Weapon))
10234 config_to_search = "CfgWeapons";
10235
10236 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10237 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10238
10239 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10240 {
10241
10243
10245 {
10247 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10249 return;
10250 }
10251
10254
10255
10256
10257 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10258 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10259
10260 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10261 {
10262 string particle_class = "";
10263 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10264 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10265 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10266
10267 if (entry_type == CT_CLASS)
10268 {
10269 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10270 WPOOH_array.Insert(WPOF);
10271 }
10272 }
10273
10274
10276 }
10277 }
10278 }
10279
10281 {
10283 }
10284
10286 {
10288 {
10290
10293
10296
10297 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10298 }
10299 }
10300
10302 {
10304 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10305
10307 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10308
10310 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10311
10313 {
10315 }
10316 }
10317
10319 {
10321 }
10322
10324 {
10327 else
10329
10331 {
10334 }
10335 else
10336 {
10339
10342 }
10343
10345 }
10346
10348 {
10350 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10351 }
10352
10354 {
10356 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10358 }
10359
10361 {
10363 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10364 }
10365
10367 {
10370
10371 OverheatingParticle OP = new OverheatingParticle();
10376
10378 }
10379
10381 {
10384
10385 return -1;
10386 }
10387
10389 {
10391 {
10394
10395 for (int i = count; i > 0; --i)
10396 {
10397 int id = i - 1;
10400
10403
10404 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10405 {
10406 if (p)
10407 {
10410 }
10411 }
10412 }
10413 }
10414 }
10415
10417 {
10419 {
10421 {
10422 int id = i - 1;
10424
10425 if (OP)
10426 {
10428
10429 if (p)
10430 {
10432 }
10433
10434 delete OP;
10435 }
10436 }
10437
10440 }
10441 }
10442
10445 {
10446 return 0.0;
10447 }
10448
10449
10451 {
10452 return 250;
10453 }
10454
10456 {
10457 return 0;
10458 }
10459
10462 {
10464 return true;
10465
10466 return false;
10467 }
10468
10471 {
10474
10476 {
10478 }
10479 else
10480 {
10481
10483 }
10484
10486 }
10487
10494 {
10495 return -1;
10496 }
10497
10498
10499
10500
10502 {
10504 {
10505 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10506 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10507
10508 if (r_index >= 0)
10509 {
10510 InventoryLocation r_il = new InventoryLocation;
10511 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10512
10513 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10516 {
10517 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10518 }
10520 {
10521 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10522 }
10523
10524 }
10525
10526 player.GetHumanInventory().ClearUserReservedLocation(this);
10527 }
10528
10531 }
10532
10533
10534
10535
10537 {
10538 return ItemBase.m_DebugActionsMask;
10539 }
10540
10542 {
10543 return ItemBase.m_DebugActionsMask & mask;
10544 }
10545
10547 {
10548 ItemBase.m_DebugActionsMask = mask;
10549 }
10550
10552 {
10553 ItemBase.m_DebugActionsMask |= mask;
10554 }
10555
10557 {
10558 ItemBase.m_DebugActionsMask &= ~mask;
10559 }
10560
10562 {
10564 {
10566 }
10567 else
10568 {
10570 }
10571 }
10572
10573
10575 {
10576 if (GetEconomyProfile())
10577 {
10578 float q_max = GetEconomyProfile().GetQuantityMax();
10579 if (q_max > 0)
10580 {
10581 float q_min = GetEconomyProfile().GetQuantityMin();
10582 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10583
10585 {
10586 ComponentEnergyManager comp = GetCompEM();
10588 {
10590 }
10591 }
10593 {
10595
10596 }
10597
10598 }
10599 }
10600 }
10601
10604 {
10605 EntityAI parent = GetHierarchyParent();
10606
10607 if (parent)
10608 {
10609 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10610 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10611 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10612 }
10613 }
10614
10617 {
10618 EntityAI parent = GetHierarchyParent();
10619
10620 if (parent)
10621 {
10622 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10623 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10624 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10625 }
10626 }
10627
10629 {
10630
10631
10632
10633
10635
10637 {
10638 if (ScriptInputUserData.CanStoreInputUserData())
10639 {
10640 ScriptInputUserData ctx = new ScriptInputUserData;
10646 ctx.
Write(use_stack_max);
10649
10651 {
10652 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10653 }
10654 }
10655 }
10656 else if (!
g_Game.IsMultiplayer())
10657 {
10659 }
10660 }
10661
10663 {
10665 }
10666
10668 {
10670 }
10671
10673 {
10675 }
10676
10678 {
10679
10680 return false;
10681 }
10682
10684 {
10685 return false;
10686 }
10687
10691 {
10692 return false;
10693 }
10694
10696 {
10697 return "";
10698 }
10699
10701
10703 {
10704 return false;
10705 }
10706
10708 {
10709 return true;
10710 }
10711
10712
10713
10715 {
10716 return true;
10717 }
10718
10720 {
10721 return true;
10722 }
10723
10725 {
10726 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10728 }
10729
10731 {
10733 }
10734
10736 {
10738 if (!is_being_placed)
10740 SetSynchDirty();
10741 }
10742
10743
10745
10747 {
10749 }
10750
10752 {
10754 }
10755
10757 {
10758 return 1;
10759 }
10760
10762 {
10763 return false;
10764 }
10765
10767 {
10769 SetSynchDirty();
10770 }
10771
10772
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
10807 {
10808 super.OnMovedInsideCargo(container);
10809
10810 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10811 }
10812
10813 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10814 {
10815 super.EEItemLocationChanged(oldLoc, newLoc);
10816
10817 PlayerBase newPlayer = null;
10818 PlayerBase oldPlayer = null;
10819
10820 if (newLoc.GetParent())
10821 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10822
10823 if (oldLoc.GetParent())
10824 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10825
10827 {
10828 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10829
10830 if (rIndex >= 0)
10831 {
10832 InventoryLocation rIl = new InventoryLocation;
10833 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10834
10835 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10838 {
10839 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10840 }
10842 {
10844 }
10845
10846 }
10847 }
10848
10850 {
10851 if (newPlayer)
10852 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10853
10854 if (newPlayer == oldPlayer)
10855 {
10856 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10857 {
10859 {
10860 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10861 {
10862 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10863 }
10864 }
10865 else
10866 {
10867 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10868 }
10869 }
10870
10871 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10872 {
10873 int type = oldLoc.GetType();
10875 {
10876 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10877 }
10879 {
10880 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10881 }
10882 }
10883 if (!m_OldLocation)
10884 {
10885 m_OldLocation = new InventoryLocation;
10886 }
10887 m_OldLocation.Copy(oldLoc);
10888 }
10889 else
10890 {
10891 if (m_OldLocation)
10892 {
10893 m_OldLocation.Reset();
10894 }
10895 }
10896
10897 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10898 }
10899 else
10900 {
10901 if (newPlayer)
10902 {
10903 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10904 if (resIndex >= 0)
10905 {
10906 InventoryLocation il = new InventoryLocation;
10907 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10909 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10912 {
10913 il.
GetParent().GetOnReleaseLock().Invoke(it);
10914 }
10916 {
10918 }
10919
10920 }
10921 }
10923 {
10924
10926 }
10927
10928 if (m_OldLocation)
10929 {
10930 m_OldLocation.Reset();
10931 }
10932 }
10933
10935 {
10936 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10937 }
10938
10940 {
10941 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10942 }
10943 }
10944
10945 override void EOnContact(IEntity other, Contact extra)
10946 {
10948 {
10949 int liquidType = -1;
10951 if (impactSpeed > 0.0)
10952 {
10954 #ifndef SERVER
10956 #else
10958 SetSynchDirty();
10959 #endif
10961 }
10962 }
10963
10964 #ifdef SERVER
10965 if (GetCompEM() && GetCompEM().IsPlugged())
10966 {
10967 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10968 GetCompEM().UnplugThis();
10969 }
10970 #endif
10971 }
10972
10974
10976 {
10978 }
10979
10981 {
10982
10983 }
10984
10986 {
10987 super.OnItemLocationChanged(old_owner, new_owner);
10988
10989 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10990 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10991
10992 if (!relatedPlayer && playerNew)
10993 relatedPlayer = playerNew;
10994
10995 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10996 {
10998 if (actionMgr)
10999 {
11000 ActionBase currentAction = actionMgr.GetRunningAction();
11001 if (currentAction)
11003 }
11004 }
11005
11006 Man ownerPlayerOld = null;
11007 Man ownerPlayerNew = null;
11008
11009 if (old_owner)
11010 {
11011 if (old_owner.
IsMan())
11012 {
11013 ownerPlayerOld = Man.Cast(old_owner);
11014 }
11015 else
11016 {
11017 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
11018 }
11019 }
11020 else
11021 {
11023 {
11025
11026 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11027 {
11028 GetCompEM().UnplugThis();
11029 }
11030 }
11031 }
11032
11033 if (new_owner)
11034 {
11035 if (new_owner.
IsMan())
11036 {
11037 ownerPlayerNew = Man.Cast(new_owner);
11038 }
11039 else
11040 {
11041 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11042 }
11043 }
11044
11045 if (ownerPlayerOld != ownerPlayerNew)
11046 {
11047 if (ownerPlayerOld)
11048 {
11049 array<EntityAI> subItemsExit = new array<EntityAI>;
11051 for (int i = 0; i < subItemsExit.Count(); i++)
11052 {
11055 }
11056 }
11057
11058 if (ownerPlayerNew)
11059 {
11060 array<EntityAI> subItemsEnter = new array<EntityAI>;
11062 for (int j = 0; j < subItemsEnter.Count(); j++)
11063 {
11066 }
11067 }
11068 }
11069 else if (ownerPlayerNew != null)
11070 {
11071 PlayerBase nplayer;
11072 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11073 {
11074 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11076 for (int k = 0; k < subItemsUpdate.Count(); k++)
11077 {
11079 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11080 }
11081 }
11082 }
11083
11084 if (old_owner)
11085 old_owner.OnChildItemRemoved(this);
11086 if (new_owner)
11087 new_owner.OnChildItemReceived(this);
11088 }
11089
11090
11092 {
11093 super.EEDelete(parent);
11094 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11095 if (player)
11096 {
11098
11099 if (player.IsAlive())
11100 {
11101 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11102 if (r_index >= 0)
11103 {
11104 InventoryLocation r_il = new InventoryLocation;
11105 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11106
11107 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11110 {
11111 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11112 }
11114 {
11115 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11116 }
11117
11118 }
11119
11120 player.RemoveQuickBarEntityShortcut(this);
11121 }
11122 }
11123 }
11124
11126 {
11127 super.EEKilled(killer);
11128
11131 {
11132 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11133 {
11134 if (IsMagazine())
11135 {
11136 if (Magazine.Cast(this).GetAmmoCount() > 0)
11137 {
11139 }
11140 }
11141 else
11142 {
11144 }
11145 }
11146 }
11147 }
11148
11150 {
11151 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11152
11153 super.OnWasAttached(parent, slot_id);
11154
11157
11160 }
11161
11163 {
11164 super.OnWasDetached(parent, slot_id);
11165
11168
11171 }
11172
11174 {
11175 int idx;
11178
11179 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11180 if (inventory_slots.Count() < 1)
11181 {
11182 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11183 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11184 }
11185 else
11186 {
11187 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11188 }
11189
11190 idx = inventory_slots.Find(slot);
11191 if (idx < 0)
11192 return "";
11193
11194 return attach_types.Get(idx);
11195 }
11196
11198 {
11199 int idx = -1;
11200 string slot;
11201
11204
11205 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11206 if (inventory_slots.Count() < 1)
11207 {
11208 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11209 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11210 }
11211 else
11212 {
11213 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11214 if (detach_types.Count() < 1)
11215 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11216 }
11217
11218 for (int i = 0; i < inventory_slots.Count(); i++)
11219 {
11220 slot = inventory_slots.Get(i);
11221 }
11222
11223 if (slot != "")
11224 {
11225 if (detach_types.Count() == 1)
11226 idx = 0;
11227 else
11228 idx = inventory_slots.Find(slot);
11229 }
11230 if (idx < 0)
11231 return "";
11232
11233 return detach_types.Get(idx);
11234 }
11235
11237 {
11238
11240
11241
11242 float min_time = 1;
11243 float max_time = 3;
11244 float delay = Math.RandomFloat(min_time, max_time);
11245
11246 explode_timer.Run(delay, this, "DoAmmoExplosion");
11247 }
11248
11250 {
11251 Magazine magazine = Magazine.Cast(this);
11252 int pop_sounds_count = 6;
11253 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11254
11255
11256 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11257 string sound_name = pop_sounds[ sound_idx ];
11258 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11259
11260
11261 magazine.ServerAddAmmoCount(-1);
11262
11263
11264 float min_temp_to_explode = 100;
11265
11266 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11267 {
11269 }
11270 }
11271
11272
11273 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11274 {
11275 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11276
11277 const int CHANCE_DAMAGE_CARGO = 4;
11278 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11279 const int CHANCE_DAMAGE_NOTHING = 2;
11280
11282 {
11283 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11284 int chances;
11285 int rnd;
11286
11287 if (GetInventory().GetCargo())
11288 {
11289 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11290 rnd = Math.RandomInt(0,chances);
11291
11292 if (rnd < CHANCE_DAMAGE_CARGO)
11293 {
11295 }
11296 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11297 {
11299 }
11300 }
11301 else
11302 {
11303 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11304 rnd = Math.RandomInt(0,chances);
11305
11306 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11307 {
11309 }
11310 }
11311 }
11312 }
11313
11315 {
11316 CargoBase cargo = GetInventory().GetCargo();
11317 if (cargo)
11318 {
11320 if (item_count > 0)
11321 {
11322 int random_pick = Math.RandomInt(0, item_count);
11324 if (!item.IsExplosive())
11325 {
11326 item.AddHealth("","",damage);
11327 return true;
11328 }
11329 }
11330 }
11331 return false;
11332 }
11333
11335 {
11336 GameInventory inventory = GetInventory();
11338 if (attachment_count > 0)
11339 {
11340 int random_pick = Math.RandomInt(0, attachment_count);
11342 if (!attachment.IsExplosive())
11343 {
11344 attachment.AddHealth("","",damage);
11345 return true;
11346 }
11347 }
11348 return false;
11349 }
11350
11352 {
11354 }
11355
11357 {
11359 return GetInventory().CanRemoveEntity();
11360
11361 return false;
11362 }
11363
11365 {
11366
11368 return false;
11369
11370
11372 return false;
11373
11374
11375
11377 if (delta == 0)
11378 return false;
11379
11380
11381 return true;
11382 }
11383
11385 {
11387 {
11388 if (ScriptInputUserData.CanStoreInputUserData())
11389 {
11390 ScriptInputUserData ctx = new ScriptInputUserData;
11395 ctx.
Write(destination_entity);
11397 ctx.
Write(slot_id);
11399 }
11400 }
11401 else if (!
g_Game.IsMultiplayer())
11402 {
11404 }
11405 }
11406
11408 {
11409 float split_quantity_new;
11413 InventoryLocation loc = new InventoryLocation;
11414
11415 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11416 {
11418 split_quantity_new = stack_max;
11419 else
11421
11423 {
11424 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11425 if (new_item)
11426 {
11427 new_item.SetResultOfSplit(true);
11428 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11430 new_item.
SetQuantity(split_quantity_new,
false,
true);
11431 }
11432 }
11433 }
11434 else if (destination_entity && slot_id == -1)
11435 {
11436 if (quantity > stack_max)
11437 split_quantity_new = stack_max;
11438 else
11439 split_quantity_new = quantity;
11440
11442 {
11443 GameInventory destinationInventory = destination_entity.GetInventory();
11445 {
11448 }
11449
11450 if (new_item)
11451 {
11452 new_item.SetResultOfSplit(true);
11453 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11455 new_item.
SetQuantity(split_quantity_new,
false,
true);
11456 }
11457 }
11458 }
11459 else
11460 {
11461 if (stack_max != 0)
11462 {
11464 {
11466 }
11467
11468 if (split_quantity_new == 0)
11469 {
11470 if (!
g_Game.IsMultiplayer())
11471 player.PhysicalPredictiveDropItem(this);
11472 else
11473 player.ServerDropEntity(this);
11474 return;
11475 }
11476
11478 {
11480
11481 if (new_item)
11482 {
11483 new_item.SetResultOfSplit(true);
11484 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11487 new_item.PlaceOnSurface();
11488 }
11489 }
11490 }
11491 }
11492 }
11493
11495 {
11496 float split_quantity_new;
11500 InventoryLocation loc = new InventoryLocation;
11501
11502 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11503 {
11505 split_quantity_new = stack_max;
11506 else
11508
11510 {
11511 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11512 if (new_item)
11513 {
11514 new_item.SetResultOfSplit(true);
11515 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11517 new_item.
SetQuantity(split_quantity_new,
false,
true);
11518 }
11519 }
11520 }
11521 else if (destination_entity && slot_id == -1)
11522 {
11523 if (quantity > stack_max)
11524 split_quantity_new = stack_max;
11525 else
11526 split_quantity_new = quantity;
11527
11529 {
11530 GameInventory destinationInventory = destination_entity.GetInventory();
11532 {
11535 }
11536
11537 if (new_item)
11538 {
11539 new_item.SetResultOfSplit(true);
11540 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11542 new_item.
SetQuantity(split_quantity_new,
false,
true);
11543 }
11544 }
11545 }
11546 else
11547 {
11548 if (stack_max != 0)
11549 {
11551 {
11553 }
11554
11556 {
11558
11559 if (new_item)
11560 {
11561 new_item.SetResultOfSplit(true);
11562 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11565 new_item.PlaceOnSurface();
11566 }
11567 }
11568 }
11569 }
11570 }
11571
11573 {
11575 {
11576 if (ScriptInputUserData.CanStoreInputUserData())
11577 {
11578 ScriptInputUserData ctx = new ScriptInputUserData;
11583 dst.WriteToContext(ctx);
11585 }
11586 }
11587 else if (!
g_Game.IsMultiplayer())
11588 {
11590 }
11591 }
11592
11594 {
11596 {
11597 if (ScriptInputUserData.CanStoreInputUserData())
11598 {
11599 ScriptInputUserData ctx = new ScriptInputUserData;
11604 ctx.
Write(destination_entity);
11610 }
11611 }
11612 else if (!
g_Game.IsMultiplayer())
11613 {
11615 }
11616 }
11617
11619 {
11621 }
11622
11624 {
11626 float split_quantity_new;
11628 if (dst.IsValid())
11629 {
11630 int slot_id = dst.GetSlot();
11632
11633 if (quantity > stack_max)
11634 split_quantity_new = stack_max;
11635 else
11636 split_quantity_new = quantity;
11637
11639 {
11641
11642 if (new_item)
11643 {
11644 new_item.SetResultOfSplit(true);
11645 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11647 new_item.
SetQuantity(split_quantity_new,
false,
true);
11648 }
11649
11650 return new_item;
11651 }
11652 }
11653
11654 return null;
11655 }
11656
11658 {
11660 float split_quantity_new;
11662 if (destination_entity)
11663 {
11665 if (quantity > stackable)
11666 split_quantity_new = stackable;
11667 else
11668 split_quantity_new = quantity;
11669
11671 {
11672 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11673 if (new_item)
11674 {
11675 new_item.SetResultOfSplit(true);
11676 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11678 new_item.
SetQuantity(split_quantity_new,
false,
true);
11679 }
11680 }
11681 }
11682 }
11683
11685 {
11687 {
11688 if (ScriptInputUserData.CanStoreInputUserData())
11689 {
11690 ScriptInputUserData ctx = new ScriptInputUserData;
11695 ItemBase destination_entity =
this;
11696 ctx.
Write(destination_entity);
11700 }
11701 }
11702 else if (!
g_Game.IsMultiplayer())
11703 {
11705 }
11706 }
11707
11709 {
11711 float split_quantity_new;
11713 if (player)
11714 {
11716 if (quantity > stackable)
11717 split_quantity_new = stackable;
11718 else
11719 split_quantity_new = quantity;
11720
11722 {
11723 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11724 new_item =
ItemBase.Cast(in_hands);
11725 if (new_item)
11726 {
11727 new_item.SetResultOfSplit(true);
11728 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11730 new_item.SetQuantity(split_quantity_new, false, true);
11731 }
11732 }
11733 }
11734 }
11735
11737 {
11739 float split_quantity_new = Math.Floor(quantity * 0.5);
11740
11742 return;
11743
11745
11746 if (new_item)
11747 {
11748 if (new_item.GetQuantityMax() < split_quantity_new)
11749 {
11750 split_quantity_new = new_item.GetQuantityMax();
11751 }
11752
11753 new_item.SetResultOfSplit(true);
11754 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11755
11757 {
11760 }
11761 else
11762 {
11764 new_item.
SetQuantity(split_quantity_new,
false,
true);
11765 }
11766 }
11767 }
11768
11770 {
11772 float split_quantity_new = Math.Floor(quantity / 2);
11773
11775 return;
11776
11777 InventoryLocation invloc = new InventoryLocation;
11779
11781 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11782
11783 if (new_item)
11784 {
11785 if (new_item.GetQuantityMax() < split_quantity_new)
11786 {
11787 split_quantity_new = new_item.GetQuantityMax();
11788 }
11790 {
11793 }
11794 else if (split_quantity_new > 1)
11795 {
11797 new_item.
SetQuantity(split_quantity_new,
false,
true);
11798 }
11799 }
11800 }
11801
11804 {
11805 SetWeightDirty();
11807
11808 if (parent)
11809 parent.OnAttachmentQuantityChangedEx(this, delta);
11810
11812 {
11814 {
11816 }
11818 {
11819 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11821 }
11822 }
11823 }
11824
11827 {
11828
11829 }
11830
11833 {
11835 }
11836
11838 {
11839 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11840
11842 {
11843 if (newLevel == GameConstants.STATE_RUINED)
11844 {
11846 EntityAI parent = GetHierarchyParent();
11847 if (parent && parent.IsFireplace())
11848 {
11849 CargoBase cargo = GetInventory().GetCargo();
11850 if (cargo)
11851 {
11853 {
11855 }
11856 }
11857 }
11858 }
11859
11861 {
11862
11864 return;
11865 }
11866
11867 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11868 {
11870 }
11871 }
11872 }
11873
11874
11876 {
11877 super.OnRightClick();
11878
11880 {
11882 {
11883 if (ScriptInputUserData.CanStoreInputUserData())
11884 {
11885 EntityAI root = GetHierarchyRoot();
11886 Man playerOwner = GetHierarchyRootPlayer();
11887 InventoryLocation dst = new InventoryLocation;
11888
11889
11890 if (!playerOwner && root && root == this)
11891 {
11893 }
11894 else
11895 {
11896
11897 GetInventory().GetCurrentInventoryLocation(dst);
11899 {
11900 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11902 {
11904 }
11905 else
11906 {
11908
11909
11910 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11911 {
11913 }
11914 else
11915 {
11916 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11917 }
11918 }
11919 }
11920 }
11921
11922 ScriptInputUserData ctx = new ScriptInputUserData;
11930 }
11931 }
11932 else if (!
g_Game.IsMultiplayer())
11933 {
11935 }
11936 }
11937 }
11938
11940 {
11941 if (root)
11942 {
11943 vector m4[4];
11944 root.GetTransform(m4);
11945 dst.SetGround(this, m4);
11946 }
11947 else
11948 {
11949 GetInventory().GetCurrentInventoryLocation(dst);
11950 }
11951 }
11952
11953 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11954 {
11955
11956 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11957 return false;
11958
11959 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11960 return false;
11961
11962
11964 return false;
11965
11966
11967 Magazine mag = Magazine.Cast(this);
11968 if (mag)
11969 {
11970 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11971 return false;
11972
11973 if (stack_max_limit)
11974 {
11975 Magazine other_mag = Magazine.Cast(other_item);
11976 if (other_item)
11977 {
11978 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11979 return false;
11980 }
11981
11982 }
11983 }
11984 else
11985 {
11986
11988 return false;
11989
11991 return false;
11992 }
11993
11994 PlayerBase player = null;
11995 if (CastTo(player, GetHierarchyRootPlayer()))
11996 {
11997 if (player.GetInventory().HasAttachment(this))
11998 return false;
11999
12000 if (player.IsItemsToDelete())
12001 return false;
12002 }
12003
12004 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
12005 return false;
12006
12007 int slotID;
12009 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
12010 return false;
12011
12012 return true;
12013 }
12014
12016 {
12018 }
12019
12021 {
12022 return m_IsResultOfSplit;
12023 }
12024
12026 {
12027 m_IsResultOfSplit = value;
12028 }
12029
12031 {
12033 }
12034
12036 {
12037 float other_item_quantity = other_item.GetQuantity();
12038 float this_free_space;
12039
12041
12043
12044 if (other_item_quantity > this_free_space)
12045 {
12046 return this_free_space;
12047 }
12048 else
12049 {
12050 return other_item_quantity;
12051 }
12052 }
12053
12055 {
12057 }
12058
12060 {
12062 return;
12063
12064 if (!IsMagazine() && other_item)
12065 {
12067 if (quantity_used != 0)
12068 {
12069 float hp1 = GetHealth01("","");
12070 float hp2 = other_item.GetHealth01("","");
12071 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12072 hpResult = hpResult / (
GetQuantity() + quantity_used);
12073
12074 hpResult *= GetMaxHealth();
12075 Math.Round(hpResult);
12076 SetHealth("", "Health", hpResult);
12077
12079 other_item.AddQuantity(-quantity_used);
12080 }
12081 }
12083 }
12084
12086 {
12087 #ifdef SERVER
12088 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12089 GetHierarchyParent().IncreaseLifetimeUp();
12090 #endif
12091 };
12092
12094 {
12095 PlayerBase p = PlayerBase.Cast(player);
12096
12097 array<int> recipesIds = p.m_Recipes;
12098 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12099 if (moduleRecipesManager)
12100 {
12101 EntityAI itemInHands = player.GetEntityInHands();
12102 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12103 }
12104
12105 for (int i = 0;i < recipesIds.Count(); i++)
12106 {
12107 int key = recipesIds.Get(i);
12108 string recipeName = moduleRecipesManager.GetRecipeName(key);
12110 }
12111 }
12112
12113
12114 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12115 {
12116 super.GetDebugActions(outputList);
12117
12118
12124
12125
12130
12135
12136
12140
12141
12143 {
12147 }
12148
12151
12152
12156
12158
12159 InventoryLocation loc = new InventoryLocation();
12160 GetInventory().GetCurrentInventoryLocation(loc);
12162 {
12163 if (Gizmo_IsSupported())
12166 }
12167
12169 }
12170
12171
12172
12173
12175 {
12176 super.OnAction(action_id, player, ctx);
12177
12179 {
12180 switch (action_id)
12181 {
12185 return true;
12189 return true;
12190 }
12191 }
12192
12194 {
12195 switch (action_id)
12196 {
12198 Delete();
12199 return true;
12200 }
12201 }
12202
12203 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12204 {
12205 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12206 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12207 PlayerBase p = PlayerBase.Cast(player);
12208 if (
EActions.RECIPES_RANGE_START < 1000)
12209 {
12210 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12211 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12212 }
12213 }
12214 #ifndef SERVER
12215 else if (action_id ==
EActions.WATCH_PLAYER)
12216 {
12217 PluginDeveloper.SetDeveloperItemClientEx(player);
12218 }
12219 #endif
12221 {
12222 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12223 {
12224 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12225 OnDebugButtonPressServer(id + 1);
12226 }
12227
12228 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12229 {
12230 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12232 }
12233
12234 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12235 {
12236 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12238 }
12239
12240 else if (action_id ==
EActions.ADD_QUANTITY)
12241 {
12242 if (IsMagazine())
12243 {
12244 Magazine mag = Magazine.Cast(this);
12245 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12246 }
12247 else
12248 {
12250 }
12251
12252 if (m_EM)
12253 {
12254 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12255 }
12256
12257 }
12258
12259 else if (action_id ==
EActions.REMOVE_QUANTITY)
12260 {
12261 if (IsMagazine())
12262 {
12263 Magazine mag2 = Magazine.Cast(this);
12264 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12265 }
12266 else
12267 {
12269 }
12270 if (m_EM)
12271 {
12272 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12273 }
12274
12275 }
12276
12277 else if (action_id ==
EActions.SET_QUANTITY_0)
12278 {
12280
12281 if (m_EM)
12282 {
12283 m_EM.SetEnergy(0);
12284 }
12285 }
12286
12287 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12288 {
12290
12291 if (m_EM)
12292 {
12293 m_EM.SetEnergy(m_EM.GetEnergyMax());
12294 }
12295 }
12296
12297 else if (action_id ==
EActions.ADD_HEALTH)
12298 {
12299 AddHealth("","",GetMaxHealth("","Health")/5);
12300 }
12301 else if (action_id ==
EActions.REMOVE_HEALTH)
12302 {
12303 AddHealth("","",-GetMaxHealth("","Health")/5);
12304 }
12305 else if (action_id ==
EActions.DESTROY_HEALTH)
12306 {
12307 SetHealth01("","",0);
12308 }
12309 else if (action_id ==
EActions.WATCH_ITEM)
12310 {
12312 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12313 #ifdef DEVELOPER
12314 SetDebugDeveloper_item(this);
12315 #endif
12316 }
12317
12318 else if (action_id ==
EActions.ADD_TEMPERATURE)
12319 {
12320 AddTemperature(20);
12321
12322 }
12323
12324 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12325 {
12326 AddTemperature(-20);
12327
12328 }
12329
12330 else if (action_id ==
EActions.FLIP_FROZEN)
12331 {
12332 SetFrozen(!GetIsFrozen());
12333
12334 }
12335
12336 else if (action_id ==
EActions.ADD_WETNESS)
12337 {
12339
12340 }
12341
12342 else if (action_id ==
EActions.REMOVE_WETNESS)
12343 {
12345
12346 }
12347
12348 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12349 {
12352
12353
12354 }
12355
12356 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12357 {
12360 }
12361
12362 else if (action_id ==
EActions.MAKE_SPECIAL)
12363 {
12364 auto debugParams = DebugSpawnParams.WithPlayer(player);
12365 OnDebugSpawnEx(debugParams);
12366 }
12367
12368 }
12369
12370
12371 return false;
12372 }
12373
12374
12375
12376
12380
12383
12384
12385
12387 {
12388 return false;
12389 }
12390
12391
12393 {
12394 return true;
12395 }
12396
12397
12399 {
12400 return true;
12401 }
12402
12403
12404
12406 {
12407 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12408 return g_Game.ConfigIsExisting(config_path);
12409 }
12410
12413 {
12414 return null;
12415 }
12416
12418 {
12419 return false;
12420 }
12421
12423 {
12424 return false;
12425 }
12426
12430
12431
12433 {
12434 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12435 return module_repairing.CanRepair(this, item_repair_kit);
12436 }
12437
12438
12439 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12440 {
12441 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12442 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12443 }
12444
12445
12447 {
12448
12449
12450
12451
12452
12453
12454
12455
12456 return 1;
12457 }
12458
12459
12460
12462 {
12464 }
12465
12466
12467
12469 {
12471 }
12472
12473
12482 {
12483 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12484
12485 if (player)
12486 {
12487 player.MessageStatus(text);
12488 }
12489 }
12490
12491
12500 {
12501 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12502
12503 if (player)
12504 {
12505 player.MessageAction(text);
12506 }
12507 }
12508
12509
12518 {
12519 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12520
12521 if (player)
12522 {
12523 player.MessageFriendly(text);
12524 }
12525 }
12526
12527
12536 {
12537 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12538
12539 if (player)
12540 {
12541 player.MessageImportant(text);
12542 }
12543 }
12544
12546 {
12547 return true;
12548 }
12549
12550
12551 override bool KindOf(
string tag)
12552 {
12553 bool found = false;
12554 string item_name = this.
GetType();
12556 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12557
12558 int array_size = item_tag_array.Count();
12559 for (int i = 0; i < array_size; i++)
12560 {
12561 if (item_tag_array.Get(i) == tag)
12562 {
12563 found = true;
12564 break;
12565 }
12566 }
12567 return found;
12568 }
12569
12570
12572 {
12573
12574 super.OnRPC(sender, rpc_type,ctx);
12575
12576
12577 switch (rpc_type)
12578 {
12579 #ifndef SERVER
12580 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12581 Param2<bool, string> p = new Param2<bool, string>(false, "");
12582
12584 return;
12585
12586 bool play = p.param1;
12587 string soundSet = p.param2;
12588
12589 if (play)
12590 {
12592 {
12594 {
12596 }
12597 }
12598 else
12599 {
12601 }
12602 }
12603 else
12604 {
12606 }
12607
12608 break;
12609 #endif
12610
12611 }
12612
12614 {
12616 }
12617 }
12618
12619
12620
12621
12623 {
12624 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12625 return plugin.GetID(
name);
12626 }
12627
12629 {
12630 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12631 return plugin.GetName(id);
12632 }
12633
12636 {
12637
12638
12639 int varFlags;
12640 if (!ctx.
Read(varFlags))
12641 return;
12642
12643 if (varFlags & ItemVariableFlags.FLOAT)
12644 {
12646 }
12647 }
12648
12650 {
12651
12652 super.SerializeNumericalVars(floats_out);
12653
12654
12655
12657 {
12659 }
12660
12662 {
12664 }
12665
12667 {
12669 }
12670
12672 {
12677 }
12678
12680 {
12682 }
12683 }
12684
12686 {
12687
12688 super.DeSerializeNumericalVars(floats);
12689
12690
12691 int index = 0;
12692 int mask = Math.Round(floats.Get(index));
12693
12694 index++;
12695
12697 {
12699 {
12701 }
12702 else
12703 {
12704 float quantity = floats.Get(index);
12705 SetQuantity(quantity,
true,
false,
false,
false);
12706 }
12707 index++;
12708 }
12709
12711 {
12712 float wet = floats.Get(index);
12714 index++;
12715 }
12716
12718 {
12719 int liquidtype = Math.Round(floats.Get(index));
12721 index++;
12722 }
12723
12725 {
12727 index++;
12729 index++;
12731 index++;
12733 index++;
12734 }
12735
12737 {
12738 int cleanness = Math.Round(floats.Get(index));
12740 index++;
12741 }
12742 }
12743
12745 {
12746 super.WriteVarsToCTX(ctx);
12747
12748
12750 {
12752 }
12753
12755 {
12757 }
12758
12760 {
12762 }
12763
12765 {
12766 int r,g,b,a;
12772 }
12773
12775 {
12777 }
12778 }
12779
12781 {
12782 if (!super.ReadVarsFromCTX(ctx,version))
12783 return false;
12784
12785 int intValue;
12786 float value;
12787
12788 if (version < 140)
12789 {
12790 if (!ctx.
Read(intValue))
12791 return false;
12792
12793 m_VariablesMask = intValue;
12794 }
12795
12797 {
12798 if (!ctx.
Read(value))
12799 return false;
12800
12802 {
12804 }
12805 else
12806 {
12808 }
12809 }
12810
12811 if (version < 140)
12812 {
12814 {
12815 if (!ctx.
Read(value))
12816 return false;
12817 SetTemperatureDirect(value);
12818 }
12819 }
12820
12822 {
12823 if (!ctx.
Read(value))
12824 return false;
12826 }
12827
12829 {
12830 if (!ctx.
Read(intValue))
12831 return false;
12833 }
12834
12836 {
12837 int r,g,b,a;
12839 return false;
12841 return false;
12843 return false;
12845 return false;
12846
12848 }
12849
12851 {
12852 if (!ctx.
Read(intValue))
12853 return false;
12855 }
12856
12857 if (version >= 138 && version < 140)
12858 {
12860 {
12861 if (!ctx.
Read(intValue))
12862 return false;
12863 SetFrozen(intValue);
12864 }
12865 }
12866
12867 return true;
12868 }
12869
12870
12872 {
12875 {
12877 }
12878
12879 if (!super.OnStoreLoad(ctx, version))
12880 {
12882 return false;
12883 }
12884
12885 if (version >= 114)
12886 {
12887 bool hasQuickBarIndexSaved;
12888
12889 if (!ctx.
Read(hasQuickBarIndexSaved))
12890 {
12892 return false;
12893 }
12894
12895 if (hasQuickBarIndexSaved)
12896 {
12897 int itmQBIndex;
12898
12899
12900 if (!ctx.
Read(itmQBIndex))
12901 {
12903 return false;
12904 }
12905
12906 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12907 if (itmQBIndex != -1 && parentPlayer)
12908 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12909 }
12910 }
12911 else
12912 {
12913
12914 PlayerBase player;
12915 int itemQBIndex;
12916 if (version ==
int.
MAX)
12917 {
12918 if (!ctx.
Read(itemQBIndex))
12919 {
12921 return false;
12922 }
12923 }
12924 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12925 {
12926
12927 if (!ctx.
Read(itemQBIndex))
12928 {
12930 return false;
12931 }
12932 if (itemQBIndex != -1 && player)
12933 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12934 }
12935 }
12936
12937 if (version < 140)
12938 {
12939
12940 if (!LoadVariables(ctx, version))
12941 {
12943 return false;
12944 }
12945 }
12946
12947
12949 {
12951 return false;
12952 }
12953 if (version >= 132)
12954 {
12956 if (raib)
12957 {
12959 {
12961 return false;
12962 }
12963 }
12964 }
12965
12967 return true;
12968 }
12969
12970
12971
12973 {
12974 super.OnStoreSave(ctx);
12975
12976 PlayerBase player;
12977 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12978 {
12980
12981 int itemQBIndex = -1;
12982 itemQBIndex = player.FindQuickBarEntityIndex(this);
12983 ctx.
Write(itemQBIndex);
12984 }
12985 else
12986 {
12988 }
12989
12991
12993 if (raib)
12994 {
12996 }
12997 }
12998
12999
13001 {
13002 super.AfterStoreLoad();
13003
13005 {
13007 }
13008
13010 {
13013 }
13014 }
13015
13017 {
13018 super.EEOnAfterLoad();
13019
13021 {
13023 }
13024
13027 }
13028
13030 {
13031 return false;
13032 }
13033
13034
13035
13037 {
13039 {
13040 #ifdef PLATFORM_CONSOLE
13041
13043 {
13045 if (menu)
13046 {
13048 }
13049 }
13050 #endif
13051 }
13052
13054 {
13057 }
13058
13060 {
13061 SetWeightDirty();
13063 }
13065 {
13068 }
13069
13071 {
13074
13077 }
13079 {
13083 }
13084
13085 super.OnVariablesSynchronized();
13086 }
13087
13088
13089
13091 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13092 {
13093 if (!IsServerCheck(allow_client))
13094 return false;
13095
13097 return false;
13098
13101
13102 if (value <= (min + 0.001))
13103 value = min;
13104
13105 if (value == min)
13106 {
13107 if (destroy_config)
13108 {
13109 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13110 if (dstr)
13111 {
13113 this.Delete();
13114 return true;
13115 }
13116 }
13117 else if (destroy_forced)
13118 {
13120 this.Delete();
13121 return true;
13122 }
13123
13125 }
13126
13129
13131 {
13132 EntityAI parent = GetHierarchyRoot();
13133 InventoryLocation iLoc = new InventoryLocation();
13134 GetInventory().GetCurrentInventoryLocation(iLoc);
13136 {
13137 int iLocSlot = iLoc.
GetSlot();
13139 {
13141 }
13143 {
13145 }
13146 }
13147 }
13148
13150 {
13152
13153 if (delta)
13155 }
13156
13158
13159 return false;
13160 }
13161
13162
13164 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13165 {
13167 }
13168
13170 {
13173 }
13174
13176 {
13179 }
13180
13182 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13183 {
13184 float value_clamped = Math.Clamp(value, 0, 1);
13186 SetQuantity(result, destroy_config, destroy_forced);
13187 }
13188
13189
13192 {
13194 }
13195
13197 {
13199 }
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13211 {
13212 int slot = -1;
13213 GameInventory inventory = GetInventory();
13214 if (inventory)
13215 {
13216 InventoryLocation il = new InventoryLocation;
13219 }
13220
13222 }
13223
13225 {
13226 float quantity_max = 0;
13227
13229 {
13230 if (attSlotID != -1)
13231 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13232
13233 if (quantity_max <= 0)
13235 }
13236
13237 if (quantity_max <= 0)
13239
13240 return quantity_max;
13241 }
13242
13244 {
13246 }
13247
13249 {
13251 }
13252
13253
13255 {
13257 }
13258
13260 {
13262 }
13263
13265 {
13267 }
13268
13269
13271 {
13272
13273 float weightEx = GetWeightEx();
13274 float special = GetInventoryAndCargoWeight();
13275 return weightEx - special;
13276 }
13277
13278
13280 {
13282 }
13283
13285 {
13287 {
13288 #ifdef DEVELOPER
13289 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13290 {
13291 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13293 }
13294 #endif
13295
13296 return GetQuantity() * GetConfigWeightModified();
13297 }
13298 else if (HasEnergyManager())
13299 {
13300 #ifdef DEVELOPER
13301 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13302 {
13303 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13304 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13305 }
13306 #endif
13307 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13308 }
13309 else
13310 {
13311 #ifdef DEVELOPER
13312 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13313 {
13314 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13315 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13316 }
13317 #endif
13318 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13319 }
13320 }
13321
13324 {
13325 int item_count = 0;
13327
13328 GameInventory inventory = GetInventory();
13329 CargoBase cargo = inventory.
GetCargo();
13330 if (cargo != NULL)
13331 {
13333 }
13334
13336 for (int i = 0; i < nAttachments; ++i)
13337 {
13339 if (item)
13340 item_count += item.GetNumberOfItems();
13341 }
13342 return item_count;
13343 }
13344
13347 {
13348 float weight = 0;
13349 float wetness = 1;
13350 if (include_wetness)
13353 {
13354 weight = wetness * m_ConfigWeight;
13355 }
13357 {
13358 weight = 1;
13359 }
13360 return weight;
13361 }
13362
13363
13364
13366 {
13367 GameInventory inventory = GetInventory();
13368 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13369 {
13370 array<EntityAI> items = new array<EntityAI>;
13372 for (int i = 0; i < items.Count(); ++i)
13373 {
13375 if (item)
13376 {
13377 g_Game.ObjectDelete(item);
13378 }
13379 }
13380 }
13381 }
13382
13383
13384
13385
13387 {
13388 float energy = 0;
13389 if (HasEnergyManager())
13390 {
13391 energy = GetCompEM().GetEnergy();
13392 }
13393 return energy;
13394 }
13395
13396
13398 {
13399 super.OnEnergyConsumed();
13400
13402 }
13403
13405 {
13406 super.OnEnergyAdded();
13407
13409 }
13410
13411
13413 {
13414 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13415 {
13417 {
13418 float energy_0to1 = GetCompEM().GetEnergy0To1();
13420 }
13421 }
13422 }
13423
13424
13426 {
13427 return ConfigGetFloat("heatIsolation");
13428 }
13429
13431 {
13433 }
13434
13436 {
13437 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13438 if (
g_Game.ConfigIsExisting(paramPath))
13439 return g_Game.ConfigGetFloat(paramPath);
13440
13441 return 0.0;
13442 }
13443
13445 {
13446 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13447 if (
g_Game.ConfigIsExisting(paramPath))
13448 return g_Game.ConfigGetFloat(paramPath);
13449
13450 return 0.0;
13451 }
13452
13453 override void SetWet(
float value,
bool allow_client =
false)
13454 {
13455 if (!IsServerCheck(allow_client))
13456 return;
13457
13460
13462
13463 m_VarWet = Math.Clamp(value, min, max);
13464
13466 {
13469 }
13470 }
13471
13472 override void AddWet(
float value)
13473 {
13475 }
13476
13478 {
13480 }
13481
13483 {
13485 }
13486
13488 {
13490 }
13491
13493 {
13495 }
13496
13498 {
13500 }
13501
13502 override void OnWetChanged(
float newVal,
float oldVal)
13503 {
13506 if (newLevel != oldLevel)
13507 {
13509 }
13510 }
13511
13513 {
13514 SetWeightDirty();
13515 }
13516
13518 {
13519 return GetWetLevelInternal(
m_VarWet);
13520 }
13521
13522
13523
13525 {
13527 }
13528
13530 {
13532 }
13533
13535 {
13537 }
13538
13540 {
13542 }
13543
13544
13545
13547 {
13548 if (ConfigIsExisting("itemModelLength"))
13549 {
13550 return ConfigGetFloat("itemModelLength");
13551 }
13552 return 0;
13553 }
13554
13556 {
13557 if (ConfigIsExisting("itemAttachOffset"))
13558 {
13559 return ConfigGetFloat("itemAttachOffset");
13560 }
13561 return 0;
13562 }
13563
13564 override void SetCleanness(
int value,
bool allow_client =
false)
13565 {
13566 if (!IsServerCheck(allow_client))
13567 return;
13568
13570
13572
13575 }
13576
13578 {
13580 }
13581
13583 {
13584 return true;
13585 }
13586
13587
13588
13589
13591 {
13593 }
13594
13596 {
13598 }
13599
13600
13601
13602
13603 override void SetColor(
int r,
int g,
int b,
int a)
13604 {
13610 }
13612 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13613 {
13618 }
13619
13621 {
13623 }
13624
13627 {
13628 int r,g,b,a;
13630 r = r/255;
13631 g = g/255;
13632 b = b/255;
13633 a = a/255;
13634 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13635 }
13636
13637
13638
13639 override void SetLiquidType(
int value,
bool allow_client =
false)
13640 {
13641 if (!IsServerCheck(allow_client))
13642 return;
13643
13648 }
13649
13651 {
13652 return ConfigGetInt("varLiquidTypeInit");
13653 }
13654
13656 {
13658 }
13659
13661 {
13663 SetFrozen(false);
13664 }
13665
13668 {
13669 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13670 }
13671
13672
13675 {
13676 PlayerBase nplayer;
13677 if (PlayerBase.CastTo(nplayer, player))
13678 {
13680 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13681 }
13682 }
13683
13684
13687 {
13688 PlayerBase nplayer;
13689 if (PlayerBase.CastTo(nplayer,player))
13690 {
13691 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13692 }
13693
13694 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13695
13696 if (HasEnergyManager())
13697 {
13698 GetCompEM().UpdatePlugState();
13699 }
13700 }
13701
13702
13704 {
13705 super.OnPlacementStarted(player);
13706
13708 }
13709
13710 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13711 {
13713 {
13714 m_AdminLog.OnPlacementComplete(player,
this);
13715 }
13716
13717 super.OnPlacementComplete(player, position, orientation);
13718 }
13719
13720
13721
13722
13723
13725 {
13727 {
13728 return true;
13729 }
13730 else
13731 {
13732 return false;
13733 }
13734 }
13735
13736
13738 {
13740 {
13742 }
13743 }
13744
13745
13747 {
13749 }
13750
13752 {
13754 }
13755
13756 override void InsertAgent(
int agent,
float count = 1)
13757 {
13758 if (count < 1)
13759 return;
13760
13762 }
13763
13766 {
13768 }
13769
13770
13772 {
13774 }
13775
13776
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
13818 {
13820 return false;
13821 return true;
13822 }
13823
13825 {
13826
13828 }
13829
13830
13833 {
13834 super.CheckForRoofLimited(timeTresholdMS);
13835
13836 float time =
g_Game.GetTime();
13837 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13838 {
13839 m_PreviousRoofTestTime = time;
13840 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13841 }
13842 }
13843
13844
13846 {
13848 {
13849 return 0;
13850 }
13851
13852 if (GetInventory().GetAttachmentSlotsCount() != 0)
13853 {
13854 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13855 if (filter)
13856 return filter.GetProtectionLevel(type, false, system);
13857 else
13858 return 0;
13859 }
13860
13861 string subclassPath, entryName;
13862
13863 switch (type)
13864 {
13866 entryName = "biological";
13867 break;
13869 entryName = "chemical";
13870 break;
13871 default:
13872 entryName = "biological";
13873 break;
13874 }
13875
13876 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13877
13878 return g_Game.ConfigGetFloat(subclassPath + entryName);
13879 }
13880
13881
13882
13885 {
13886 if (!IsMagazine())
13888
13890 }
13891
13892
13893
13894
13895
13900 {
13901 return true;
13902 }
13903
13905 {
13907 }
13908
13909
13910
13911
13912
13914 {
13915 if (parent)
13916 {
13917 if (parent.IsInherited(DayZInfected))
13918 return true;
13919
13920 if (!parent.IsRuined())
13921 return true;
13922 }
13923
13924 return true;
13925 }
13926
13928 {
13929 if (!super.CanPutAsAttachment(parent))
13930 {
13931 return false;
13932 }
13933
13934 if (!IsRuined() && !parent.IsRuined())
13935 {
13936 return true;
13937 }
13938
13939 return false;
13940 }
13941
13943 {
13944
13945
13946
13947
13948 return super.CanReceiveItemIntoCargo(item);
13949 }
13950
13952 {
13953
13954
13955
13956
13957 GameInventory attachmentInv = attachment.GetInventory();
13959 {
13960 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13961 return false;
13962 }
13963
13964 InventoryLocation loc = new InventoryLocation();
13965 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13966 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13967 return false;
13968
13969 return super.CanReceiveAttachment(attachment, slotId);
13970 }
13971
13973 {
13974 if (!super.CanReleaseAttachment(attachment))
13975 return false;
13976
13977 return GetInventory().AreChildrenAccessible();
13978 }
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14001 {
14002 int id = muzzle_owner.GetMuzzleID();
14003 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
14004
14005 if (WPOF_array)
14006 {
14007 for (int i = 0; i < WPOF_array.Count(); i++)
14008 {
14009 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
14010
14011 if (WPOF)
14012 {
14013 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
14014 }
14015 }
14016 }
14017 }
14018
14019
14021 {
14022 int id = muzzle_owner.GetMuzzleID();
14024
14025 if (WPOBE_array)
14026 {
14027 for (int i = 0; i < WPOBE_array.Count(); i++)
14028 {
14029 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14030
14031 if (WPOBE)
14032 {
14033 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14034 }
14035 }
14036 }
14037 }
14038
14039
14041 {
14042 int id = muzzle_owner.GetMuzzleID();
14043 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14044
14045 if (WPOOH_array)
14046 {
14047 for (int i = 0; i < WPOOH_array.Count(); i++)
14048 {
14049 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14050
14051 if (WPOOH)
14052 {
14053 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14054 }
14055 }
14056 }
14057 }
14058
14059
14061 {
14062 int id = muzzle_owner.GetMuzzleID();
14063 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14064
14065 if (WPOOH_array)
14066 {
14067 for (int i = 0; i < WPOOH_array.Count(); i++)
14068 {
14069 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14070
14071 if (WPOOH)
14072 {
14073 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14074 }
14075 }
14076 }
14077 }
14078
14079
14081 {
14082 int id = muzzle_owner.GetMuzzleID();
14083 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14084
14085 if (WPOOH_array)
14086 {
14087 for (int i = 0; i < WPOOH_array.Count(); i++)
14088 {
14089 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14090
14091 if (WPOOH)
14092 {
14093 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14094 }
14095 }
14096 }
14097 }
14098
14099
14100
14102 {
14104 {
14105 return true;
14106 }
14107
14108 return false;
14109 }
14110
14112 {
14114 {
14115 return true;
14116 }
14117
14118 return false;
14119 }
14120
14122 {
14124 {
14125 return true;
14126 }
14127
14128 return false;
14129 }
14130
14132 {
14133 return false;
14134 }
14135
14138 {
14139 return UATimeSpent.DEFAULT_DEPLOY;
14140 }
14141
14142
14143
14144
14146 {
14148 SetSynchDirty();
14149 }
14150
14152 {
14154 }
14155
14156
14158 {
14159 return false;
14160 }
14161
14164 {
14165 string att_type = "None";
14166
14167 if (ConfigIsExisting("soundAttType"))
14168 {
14169 att_type = ConfigGetString("soundAttType");
14170 }
14171
14173 }
14174
14176 {
14178 }
14179
14180
14181
14182
14183
14189
14191 {
14194
14196 }
14197
14198
14200 {
14202 return;
14203
14205
14208
14211
14212 SoundParameters params = new SoundParameters();
14216 }
14217
14218
14220 {
14222 {
14225
14226 SetSynchDirty();
14227
14230 }
14231 }
14232
14234 {
14236 }
14237
14238
14240 {
14242 return;
14243
14245 SetSynchDirty();
14246
14249 }
14250
14252 {
14255 }
14256
14258 {
14260 }
14261
14262 void OnApply(PlayerBase player);
14263
14265 {
14266 return 1.0;
14267 };
14268
14270 {
14272 }
14273
14275 {
14277 }
14278
14280
14282 {
14283 SetDynamicPhysicsLifeTime(0.01);
14285 }
14286
14288 {
14289 array<string> zone_names = new array<string>;
14290 GetDamageZones(zone_names);
14291 for (int i = 0; i < zone_names.Count(); i++)
14292 {
14293 SetHealthMax(zone_names.Get(i),"Health");
14294 }
14295 SetHealthMax("","Health");
14296 }
14297
14300 {
14301 float global_health = GetHealth01("","Health");
14302 array<string> zones = new array<string>;
14303 GetDamageZones(zones);
14304
14305 for (int i = 0; i < zones.Count(); i++)
14306 {
14307 SetHealth01(zones.Get(i),"Health",global_health);
14308 }
14309 }
14310
14313 {
14314 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14315 }
14316
14318 {
14319 if (!hasRootAsPlayer)
14320 {
14321 if (refParentIB)
14322 {
14323
14324 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14325 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14326
14327 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14328 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14329
14332 }
14333 else
14334 {
14335
14338 }
14339 }
14340 }
14341
14343 {
14345 {
14346 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14347 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14348 {
14349 float heatPermCoef = 1.0;
14351 while (ent)
14352 {
14353 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14354 ent = ent.GetHierarchyParent();
14355 }
14356
14357 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14358 }
14359 }
14360 }
14361
14363 {
14364
14365 EntityAI parent = GetHierarchyParent();
14366 if (!parent)
14367 {
14368 hasParent = false;
14369 hasRootAsPlayer = false;
14370 }
14371 else
14372 {
14373 hasParent = true;
14374 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14375 refParentIB =
ItemBase.Cast(parent);
14376 }
14377 }
14378
14379 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14380 {
14381
14382 }
14383
14385 {
14386
14387 return false;
14388 }
14389
14391 {
14392
14393
14394 return false;
14395 }
14396
14398 {
14399
14400 return false;
14401 }
14402
14405 {
14406 return !GetIsFrozen() &&
IsOpen();
14407 }
14408
14410 {
14411 bool hasParent = false, hasRootAsPlayer = false;
14413
14414 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14415 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14416
14417 if (wwtu || foodDecay)
14418 {
14422
14423 if (processWetness || processTemperature || processDecay)
14424 {
14426
14427 if (processWetness)
14428 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14429
14430 if (processTemperature)
14432
14433 if (processDecay)
14434 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14435 }
14436 }
14437 }
14438
14441 {
14443 }
14444
14446 {
14449
14450 return super.GetTemperatureFreezeThreshold();
14451 }
14452
14454 {
14457
14458 return super.GetTemperatureThawThreshold();
14459 }
14460
14462 {
14465
14466 return super.GetItemOverheatThreshold();
14467 }
14468
14470 {
14472 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14473
14474 return super.GetTemperatureFreezeTime();
14475 }
14476
14478 {
14480 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14481
14482 return super.GetTemperatureThawTime();
14483 }
14484
14489
14491 {
14492 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14493 }
14494
14496 {
14497 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14498 }
14499
14502 {
14504 }
14505
14507 {
14509 }
14510
14512 {
14514 }
14515
14518 {
14519 return null;
14520 }
14521
14524 {
14525 return false;
14526 }
14527
14529 {
14531 {
14534 if (!trg)
14535 {
14537 explosive = this;
14538 }
14539
14540 explosive.PairRemote(trg);
14542
14543 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14544 trg.SetPersistentPairID(persistentID);
14545 explosive.SetPersistentPairID(persistentID);
14546
14547 return true;
14548 }
14549 return false;
14550 }
14551
14554 {
14555 float ret = 1.0;
14558 ret *= GetHealth01();
14559
14560 return ret;
14561 }
14562
14563 #ifdef DEVELOPER
14564 override void SetDebugItem()
14565 {
14566 super.SetDebugItem();
14567 _itemBase = this;
14568 }
14569
14571 {
14572 string text = super.GetDebugText();
14573
14575 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14576
14577 return text;
14578 }
14579 #endif
14580
14582 {
14583 return true;
14584 }
14585
14587
14589
14591 {
14594 }
14595
14596
14604
14620
14621 [
Obsolete(
"Use ItemSoundHandler instead")]
14624 {
14625 if (!
g_Game.IsDedicatedServer())
14626 {
14627 if (ConfigIsExisting("attachSoundSet"))
14628 {
14629 string cfg_path = "";
14630 string soundset = "";
14631 string type_name =
GetType();
14632
14635 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14636 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14637
14638 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14639 {
14640 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14641 {
14642 if (cfg_slot_array[i] == slot_type)
14643 {
14644 soundset = cfg_soundset_array[i];
14645 break;
14646 }
14647 }
14648 }
14649
14650 if (soundset != "")
14651 {
14652 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14654 }
14655 }
14656 }
14657 }
14658
14660}
14661
14663{
14665 if (entity)
14666 {
14667 bool is_item = entity.IsInherited(
ItemBase);
14668 if (is_item && full_quantity)
14669 {
14672 }
14673 }
14674 else
14675 {
14677 return NULL;
14678 }
14679 return entity;
14680}
14681
14683{
14684 if (item)
14685 {
14686 if (health > 0)
14687 item.SetHealth("", "", health);
14688
14689 if (item.CanHaveTemperature())
14690 {
14692 if (item.CanFreeze())
14693 item.SetFrozen(false);
14694 }
14695
14696 if (item.HasEnergyManager())
14697 {
14698 if (quantity >= 0)
14699 {
14700 item.GetCompEM().SetEnergy0To1(quantity);
14701 }
14702 else
14703 {
14705 }
14706 }
14707 else if (item.IsMagazine())
14708 {
14709 Magazine mag = Magazine.Cast(item);
14710 if (quantity >= 0)
14711 {
14712 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14713 }
14714 else
14715 {
14717 }
14718
14719 }
14720 else
14721 {
14722 if (quantity >= 0)
14723 {
14724 item.SetQuantityNormalized(quantity, false);
14725 }
14726 else
14727 {
14729 }
14730
14731 }
14732 }
14733}
14734
14735#ifdef DEVELOPER
14737#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.