9758{
9760 {
9761 return true;
9762 }
9763};
9764
9766{
9767
9768};
9769
9770
9771
9773{
9777
9779
9782
9783
9784
9785
9786
9795
9801
9806
9811
9832 protected bool m_IsResultOfSplit
9833
9835
9840
9841
9842
9844
9848
9849
9850
9852
9855
9856
9857
9863
9864
9872
9875
9876
9878
9879
9881
9882
9887
9888
9893
9895
9896
9898
9899
9901 {
9906
9907 if (!
g_Game.IsDedicatedServer())
9908 {
9910 {
9912
9914 {
9916 }
9917 }
9918
9921 }
9922
9923 m_OldLocation = null;
9924
9926 {
9928 }
9929
9930 if (ConfigIsExisting("headSelectionsToHide"))
9931 {
9934 }
9935
9937 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9938 {
9940 }
9941
9943
9944 m_IsResultOfSplit = false;
9945
9947 }
9948
9950 {
9951 super.InitItemVariables();
9952
9958 m_Count = ConfigGetInt(
"count");
9959
9962
9967
9970
9975
9987
9991
9992
9995 if (ConfigIsExisting("canBeSplit"))
9996 {
9999 }
10000
10002 if (ConfigIsExisting("itemBehaviour"))
10004
10005
10008 RegisterNetSyncVariableInt("m_VarLiquidType");
10009 RegisterNetSyncVariableInt("m_Cleanness",0,1);
10010
10011 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
10012 RegisterNetSyncVariableFloat("m_ImpactSpeed");
10013 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
10014
10015 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
10016 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
10017 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
10018 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
10019
10020 RegisterNetSyncVariableBool("m_IsBeingPlaced");
10021 RegisterNetSyncVariableBool("m_IsTakeable");
10022 RegisterNetSyncVariableBool("m_IsHologram");
10023
10026 {
10029 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10030 }
10031
10033
10035 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10037
10039 }
10040
10042 {
10044 }
10045
10047 {
10050 {
10055 }
10056 }
10057
10058 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10059 {
10061 {
10064 }
10065
10067 }
10068
10070 {
10076 }
10077
10079
10081 {
10083
10084 if (!action)
10085 {
10086 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10087 return;
10088 }
10089
10091 if (!ai)
10092 {
10094 return;
10095 }
10096
10098 if (!action_array)
10099 {
10100 action_array = new array<ActionBase_Basic>;
10102 }
10103 if (LogManager.IsActionLogEnable())
10104 {
10105 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10106 }
10107
10108 if (action_array.Find(action) != -1)
10109 {
10110 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10111 }
10112 else
10113 {
10114 action_array.Insert(action);
10115 }
10116 }
10117
10119 {
10120 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10121 ActionBase action = player.GetActionManager().GetAction(actionName);
10124
10125 if (action_array)
10126 {
10127 action_array.RemoveItem(action);
10128 }
10129 }
10130
10131
10132
10134 {
10135 ActionOverrideData overrideData = new ActionOverrideData();
10139
10141 if (!actionMap)
10142 {
10145 }
10146
10147 actionMap.Insert(this.
Type(), overrideData);
10148
10149 }
10150
10152
10154
10155
10157 {
10160
10163
10164 string config_to_search = "CfgVehicles";
10165 string muzzle_owner_config;
10166
10168 {
10169 if (IsInherited(Weapon))
10170 config_to_search = "CfgWeapons";
10171
10172 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10173
10174 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10175
10176 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10177
10178 if (config_OnFire_subclass_count > 0)
10179 {
10180 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10181
10182 for (int i = 0; i < config_OnFire_subclass_count; i++)
10183 {
10184 string particle_class = "";
10185 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10186 string config_OnFire_entry = config_OnFire_class + particle_class;
10187 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10188 WPOF_array.Insert(WPOF);
10189 }
10190
10191
10193 }
10194 }
10195
10197 {
10198 config_to_search = "CfgWeapons";
10199 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10200
10201 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10202
10203 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10204
10205 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10206 {
10207 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10208
10209 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10210 {
10211 string particle_class2 = "";
10212 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10213 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10214 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10215 WPOBE_array.Insert(WPOBE);
10216 }
10217
10218
10220 }
10221 }
10222 }
10223
10224
10226 {
10229
10231 {
10232 string config_to_search = "CfgVehicles";
10233
10234 if (IsInherited(Weapon))
10235 config_to_search = "CfgWeapons";
10236
10237 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10238 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10239
10240 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10241 {
10242
10244
10246 {
10248 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10250 return;
10251 }
10252
10255
10256
10257
10258 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10259 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10260
10261 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10262 {
10263 string particle_class = "";
10264 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10265 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10266 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10267
10268 if (entry_type == CT_CLASS)
10269 {
10270 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10271 WPOOH_array.Insert(WPOF);
10272 }
10273 }
10274
10275
10277 }
10278 }
10279 }
10280
10282 {
10284 }
10285
10287 {
10289 {
10291
10294
10297
10298 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10299 }
10300 }
10301
10303 {
10305 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10306
10308 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10309
10311 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10312
10314 {
10316 }
10317 }
10318
10320 {
10322 }
10323
10325 {
10328 else
10330
10332 {
10335 }
10336 else
10337 {
10340
10343 }
10344
10346 }
10347
10349 {
10351 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10352 }
10353
10355 {
10357 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10359 }
10360
10362 {
10364 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10365 }
10366
10368 {
10371
10372 OverheatingParticle OP = new OverheatingParticle();
10377
10379 }
10380
10382 {
10385
10386 return -1;
10387 }
10388
10390 {
10392 {
10395
10396 for (int i = count; i > 0; --i)
10397 {
10398 int id = i - 1;
10401
10404
10405 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10406 {
10407 if (p)
10408 {
10411 }
10412 }
10413 }
10414 }
10415 }
10416
10418 {
10420 {
10422 {
10423 int id = i - 1;
10425
10426 if (OP)
10427 {
10429
10430 if (p)
10431 {
10433 }
10434
10435 delete OP;
10436 }
10437 }
10438
10441 }
10442 }
10443
10446 {
10447 return 0.0;
10448 }
10449
10450
10452 {
10453 return 250;
10454 }
10455
10457 {
10458 return 0;
10459 }
10460
10463 {
10465 return true;
10466
10467 return false;
10468 }
10469
10472 {
10475
10477 {
10479 }
10480 else
10481 {
10482
10484 }
10485
10487 }
10488
10495 {
10496 return -1;
10497 }
10498
10499
10500
10501
10503 {
10505 {
10506 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10507 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10508
10509 if (r_index >= 0)
10510 {
10511 InventoryLocation r_il = new InventoryLocation;
10512 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10513
10514 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10517 {
10518 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10519 }
10521 {
10522 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10523 }
10524
10525 }
10526
10527 player.GetHumanInventory().ClearUserReservedLocation(this);
10528 }
10529
10532 }
10533
10534
10535
10536
10538 {
10539 return ItemBase.m_DebugActionsMask;
10540 }
10541
10543 {
10544 return ItemBase.m_DebugActionsMask & mask;
10545 }
10546
10548 {
10549 ItemBase.m_DebugActionsMask = mask;
10550 }
10551
10553 {
10554 ItemBase.m_DebugActionsMask |= mask;
10555 }
10556
10558 {
10559 ItemBase.m_DebugActionsMask &= ~mask;
10560 }
10561
10563 {
10565 {
10567 }
10568 else
10569 {
10571 }
10572 }
10573
10574
10576 {
10577 if (GetEconomyProfile())
10578 {
10579 float q_max = GetEconomyProfile().GetQuantityMax();
10580 if (q_max > 0)
10581 {
10582 float q_min = GetEconomyProfile().GetQuantityMin();
10583 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10584
10586 {
10587 ComponentEnergyManager comp = GetCompEM();
10589 {
10591 }
10592 }
10594 {
10596
10597 }
10598
10599 }
10600 }
10601 }
10602
10605 {
10606 EntityAI parent = GetHierarchyParent();
10607
10608 if (parent)
10609 {
10610 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10611 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10612 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10613 }
10614 }
10615
10618 {
10619 EntityAI parent = GetHierarchyParent();
10620
10621 if (parent)
10622 {
10623 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10624 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10625 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10626 }
10627 }
10628
10630 {
10631
10632
10633
10634
10636
10638 {
10639 if (ScriptInputUserData.CanStoreInputUserData())
10640 {
10641 ScriptInputUserData ctx = new ScriptInputUserData;
10647 ctx.
Write(use_stack_max);
10650
10652 {
10653 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10654 }
10655 }
10656 }
10657 else if (!
g_Game.IsMultiplayer())
10658 {
10660 }
10661 }
10662
10664 {
10666 }
10667
10669 {
10671 }
10672
10674 {
10676 }
10677
10679 {
10680
10681 return false;
10682 }
10683
10685 {
10686 return false;
10687 }
10688
10692 {
10693 return false;
10694 }
10695
10697 {
10698 return "";
10699 }
10700
10702
10704 {
10705 return false;
10706 }
10707
10709 {
10710 return true;
10711 }
10712
10713
10714
10716 {
10717 return true;
10718 }
10719
10721 {
10722 return true;
10723 }
10724
10726 {
10727 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10729 }
10730
10732 {
10734 }
10735
10737 {
10739 if (!is_being_placed)
10741 SetSynchDirty();
10742 }
10743
10744
10746
10748 {
10750 }
10751
10753 {
10755 }
10756
10758 {
10759 return 1;
10760 }
10761
10763 {
10764 return false;
10765 }
10766
10768 {
10770 SetSynchDirty();
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
10806
10808 {
10809 super.OnMovedInsideCargo(container);
10810
10811 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10812 }
10813
10814 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10815 {
10816 super.EEItemLocationChanged(oldLoc, newLoc);
10817
10818 PlayerBase newPlayer = null;
10819 PlayerBase oldPlayer = null;
10820
10821 if (newLoc.GetParent())
10822 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10823
10824 if (oldLoc.GetParent())
10825 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10826
10828 {
10829 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10830
10831 if (rIndex >= 0)
10832 {
10833 InventoryLocation rIl = new InventoryLocation;
10834 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10835
10836 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10839 {
10840 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10841 }
10843 {
10845 }
10846
10847 }
10848 }
10849
10851 {
10852 if (newPlayer)
10853 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10854
10855 if (newPlayer == oldPlayer)
10856 {
10857 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10858 {
10860 {
10861 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10862 {
10863 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10864 }
10865 }
10866 else
10867 {
10868 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10869 }
10870 }
10871
10872 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10873 {
10874 int type = oldLoc.GetType();
10876 {
10877 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10878 }
10880 {
10881 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10882 }
10883 }
10884 if (!m_OldLocation)
10885 {
10886 m_OldLocation = new InventoryLocation;
10887 }
10888 m_OldLocation.Copy(oldLoc);
10889 }
10890 else
10891 {
10892 if (m_OldLocation)
10893 {
10894 m_OldLocation.Reset();
10895 }
10896 }
10897
10898 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10899 }
10900 else
10901 {
10902 if (newPlayer)
10903 {
10904 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10905 if (resIndex >= 0)
10906 {
10907 InventoryLocation il = new InventoryLocation;
10908 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10910 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10913 {
10914 il.
GetParent().GetOnReleaseLock().Invoke(it);
10915 }
10917 {
10919 }
10920
10921 }
10922 }
10924 {
10925
10927 }
10928
10929 if (m_OldLocation)
10930 {
10931 m_OldLocation.Reset();
10932 }
10933 }
10934
10936 {
10937 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10938 }
10939
10941 {
10942 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10943 }
10944 }
10945
10946 override void EOnContact(IEntity other, Contact extra)
10947 {
10949 {
10950 int liquidType = -1;
10952 if (impactSpeed > 0.0)
10953 {
10955 #ifndef SERVER
10957 #else
10959 SetSynchDirty();
10960 #endif
10962 }
10963 }
10964
10965 #ifdef SERVER
10966 if (GetCompEM() && GetCompEM().IsPlugged())
10967 {
10968 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10969 GetCompEM().UnplugThis();
10970 }
10971 #endif
10972 }
10973
10975
10977 {
10979 }
10980
10982 {
10983
10984 }
10985
10987 {
10988 super.OnItemLocationChanged(old_owner, new_owner);
10989
10990 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10991 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10992
10993 if (!relatedPlayer && playerNew)
10994 relatedPlayer = playerNew;
10995
10996 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10997 {
10999 if (actionMgr)
11000 {
11001 ActionBase currentAction = actionMgr.GetRunningAction();
11002 if (currentAction)
11004 }
11005 }
11006
11007 Man ownerPlayerOld = null;
11008 Man ownerPlayerNew = null;
11009
11010 if (old_owner)
11011 {
11012 if (old_owner.
IsMan())
11013 {
11014 ownerPlayerOld = Man.Cast(old_owner);
11015 }
11016 else
11017 {
11018 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
11019 }
11020 }
11021 else
11022 {
11024 {
11026
11027 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11028 {
11029 GetCompEM().UnplugThis();
11030 }
11031 }
11032 }
11033
11034 if (new_owner)
11035 {
11036 if (new_owner.
IsMan())
11037 {
11038 ownerPlayerNew = Man.Cast(new_owner);
11039 }
11040 else
11041 {
11042 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11043 }
11044 }
11045
11046 if (ownerPlayerOld != ownerPlayerNew)
11047 {
11048 if (ownerPlayerOld)
11049 {
11050 array<EntityAI> subItemsExit = new array<EntityAI>;
11052 for (int i = 0; i < subItemsExit.Count(); i++)
11053 {
11056 }
11057 }
11058
11059 if (ownerPlayerNew)
11060 {
11061 array<EntityAI> subItemsEnter = new array<EntityAI>;
11063 for (int j = 0; j < subItemsEnter.Count(); j++)
11064 {
11067 }
11068 }
11069 }
11070 else if (ownerPlayerNew != null)
11071 {
11072 PlayerBase nplayer;
11073 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11074 {
11075 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11077 for (int k = 0; k < subItemsUpdate.Count(); k++)
11078 {
11080 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11081 }
11082 }
11083 }
11084
11085 if (old_owner)
11086 old_owner.OnChildItemRemoved(this);
11087 if (new_owner)
11088 new_owner.OnChildItemReceived(this);
11089 }
11090
11091
11093 {
11094 super.EEDelete(parent);
11095 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11096 if (player)
11097 {
11099
11100 if (player.IsAlive())
11101 {
11102 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11103 if (r_index >= 0)
11104 {
11105 InventoryLocation r_il = new InventoryLocation;
11106 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11107
11108 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11111 {
11112 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11113 }
11115 {
11116 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11117 }
11118
11119 }
11120
11121 player.RemoveQuickBarEntityShortcut(this);
11122 }
11123 }
11124 }
11125
11127 {
11128 super.EEKilled(killer);
11129
11132 {
11133 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11134 {
11135 if (IsMagazine())
11136 {
11137 if (Magazine.Cast(this).GetAmmoCount() > 0)
11138 {
11140 }
11141 }
11142 else
11143 {
11145 }
11146 }
11147 }
11148 }
11149
11151 {
11152 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11153
11154 super.OnWasAttached(parent, slot_id);
11155
11158
11161 }
11162
11164 {
11165 super.OnWasDetached(parent, slot_id);
11166
11169
11172 }
11173
11175 {
11176 int idx;
11179
11180 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11181 if (inventory_slots.Count() < 1)
11182 {
11183 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11184 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11185 }
11186 else
11187 {
11188 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11189 }
11190
11191 idx = inventory_slots.Find(slot);
11192 if (idx < 0)
11193 return "";
11194
11195 return attach_types.Get(idx);
11196 }
11197
11199 {
11200 int idx = -1;
11201 string slot;
11202
11205
11206 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11207 if (inventory_slots.Count() < 1)
11208 {
11209 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11210 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11211 }
11212 else
11213 {
11214 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11215 if (detach_types.Count() < 1)
11216 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11217 }
11218
11219 for (int i = 0; i < inventory_slots.Count(); i++)
11220 {
11221 slot = inventory_slots.Get(i);
11222 }
11223
11224 if (slot != "")
11225 {
11226 if (detach_types.Count() == 1)
11227 idx = 0;
11228 else
11229 idx = inventory_slots.Find(slot);
11230 }
11231 if (idx < 0)
11232 return "";
11233
11234 return detach_types.Get(idx);
11235 }
11236
11238 {
11239
11241
11242
11243 float min_time = 1;
11244 float max_time = 3;
11245 float delay = Math.RandomFloat(min_time, max_time);
11246
11247 explode_timer.Run(delay, this, "DoAmmoExplosion");
11248 }
11249
11251 {
11252 Magazine magazine = Magazine.Cast(this);
11253 int pop_sounds_count = 6;
11254 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11255
11256
11257 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11258 string sound_name = pop_sounds[ sound_idx ];
11259 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11260
11261
11262 magazine.ServerAddAmmoCount(-1);
11263
11264
11265 float min_temp_to_explode = 100;
11266
11267 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11268 {
11270 }
11271 }
11272
11273
11274 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11275 {
11276 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11277
11278 const int CHANCE_DAMAGE_CARGO = 4;
11279 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11280 const int CHANCE_DAMAGE_NOTHING = 2;
11281
11283 {
11284 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11285 int chances;
11286 int rnd;
11287
11288 if (GetInventory().GetCargo())
11289 {
11290 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11291 rnd = Math.RandomInt(0,chances);
11292
11293 if (rnd < CHANCE_DAMAGE_CARGO)
11294 {
11296 }
11297 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11298 {
11300 }
11301 }
11302 else
11303 {
11304 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11305 rnd = Math.RandomInt(0,chances);
11306
11307 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11308 {
11310 }
11311 }
11312 }
11313 }
11314
11316 {
11317 CargoBase cargo = GetInventory().GetCargo();
11318 if (cargo)
11319 {
11321 if (item_count > 0)
11322 {
11323 int random_pick = Math.RandomInt(0, item_count);
11325 if (!item.IsExplosive())
11326 {
11327 item.AddHealth("","",damage);
11328 return true;
11329 }
11330 }
11331 }
11332 return false;
11333 }
11334
11336 {
11337 GameInventory inventory = GetInventory();
11339 if (attachment_count > 0)
11340 {
11341 int random_pick = Math.RandomInt(0, attachment_count);
11343 if (!attachment.IsExplosive())
11344 {
11345 attachment.AddHealth("","",damage);
11346 return true;
11347 }
11348 }
11349 return false;
11350 }
11351
11353 {
11355 }
11356
11358 {
11360 return GetInventory().CanRemoveEntity();
11361
11362 return false;
11363 }
11364
11366 {
11367
11369 return false;
11370
11371
11373 return false;
11374
11375
11376
11378 if (delta == 0)
11379 return false;
11380
11381
11382 return true;
11383 }
11384
11386 {
11388 {
11389 if (ScriptInputUserData.CanStoreInputUserData())
11390 {
11391 ScriptInputUserData ctx = new ScriptInputUserData;
11396 ctx.
Write(destination_entity);
11398 ctx.
Write(slot_id);
11400 }
11401 }
11402 else if (!
g_Game.IsMultiplayer())
11403 {
11405 }
11406 }
11407
11409 {
11410 float split_quantity_new;
11414 InventoryLocation loc = new InventoryLocation;
11415
11416 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11417 {
11419 split_quantity_new = stack_max;
11420 else
11422
11424 {
11425 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11426 if (new_item)
11427 {
11428 new_item.SetResultOfSplit(true);
11429 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11431 new_item.
SetQuantity(split_quantity_new,
false,
true);
11432 }
11433 }
11434 }
11435 else if (destination_entity && slot_id == -1)
11436 {
11437 if (quantity > stack_max)
11438 split_quantity_new = stack_max;
11439 else
11440 split_quantity_new = quantity;
11441
11443 {
11444 GameInventory destinationInventory = destination_entity.GetInventory();
11446 {
11449 }
11450
11451 if (new_item)
11452 {
11453 new_item.SetResultOfSplit(true);
11454 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11456 new_item.
SetQuantity(split_quantity_new,
false,
true);
11457 }
11458 }
11459 }
11460 else
11461 {
11462 if (stack_max != 0)
11463 {
11465 {
11467 }
11468
11469 if (split_quantity_new == 0)
11470 {
11471 if (!
g_Game.IsMultiplayer())
11472 player.PhysicalPredictiveDropItem(this);
11473 else
11474 player.ServerDropEntity(this);
11475 return;
11476 }
11477
11479 {
11481
11482 if (new_item)
11483 {
11484 new_item.SetResultOfSplit(true);
11485 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11488 new_item.PlaceOnSurface();
11489 }
11490 }
11491 }
11492 }
11493 }
11494
11496 {
11497 float split_quantity_new;
11501 InventoryLocation loc = new InventoryLocation;
11502
11503 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11504 {
11506 split_quantity_new = stack_max;
11507 else
11509
11511 {
11512 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11513 if (new_item)
11514 {
11515 new_item.SetResultOfSplit(true);
11516 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11518 new_item.
SetQuantity(split_quantity_new,
false,
true);
11519 }
11520 }
11521 }
11522 else if (destination_entity && slot_id == -1)
11523 {
11524 if (quantity > stack_max)
11525 split_quantity_new = stack_max;
11526 else
11527 split_quantity_new = quantity;
11528
11530 {
11531 GameInventory destinationInventory = destination_entity.GetInventory();
11533 {
11536 }
11537
11538 if (new_item)
11539 {
11540 new_item.SetResultOfSplit(true);
11541 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11543 new_item.
SetQuantity(split_quantity_new,
false,
true);
11544 }
11545 }
11546 }
11547 else
11548 {
11549 if (stack_max != 0)
11550 {
11552 {
11554 }
11555
11557 {
11559
11560 if (new_item)
11561 {
11562 new_item.SetResultOfSplit(true);
11563 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11566 new_item.PlaceOnSurface();
11567 }
11568 }
11569 }
11570 }
11571 }
11572
11574 {
11576 {
11577 if (ScriptInputUserData.CanStoreInputUserData())
11578 {
11579 ScriptInputUserData ctx = new ScriptInputUserData;
11584 dst.WriteToContext(ctx);
11586 }
11587 }
11588 else if (!
g_Game.IsMultiplayer())
11589 {
11591 }
11592 }
11593
11595 {
11597 {
11598 if (ScriptInputUserData.CanStoreInputUserData())
11599 {
11600 ScriptInputUserData ctx = new ScriptInputUserData;
11605 ctx.
Write(destination_entity);
11611 }
11612 }
11613 else if (!
g_Game.IsMultiplayer())
11614 {
11616 }
11617 }
11618
11620 {
11622 }
11623
11625 {
11627 float split_quantity_new;
11629 if (dst.IsValid())
11630 {
11631 int slot_id = dst.GetSlot();
11633
11634 if (quantity > stack_max)
11635 split_quantity_new = stack_max;
11636 else
11637 split_quantity_new = quantity;
11638
11640 {
11642
11643 if (new_item)
11644 {
11645 new_item.SetResultOfSplit(true);
11646 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11648 new_item.
SetQuantity(split_quantity_new,
false,
true);
11649 }
11650
11651 return new_item;
11652 }
11653 }
11654
11655 return null;
11656 }
11657
11659 {
11661 float split_quantity_new;
11663 if (destination_entity)
11664 {
11666 if (quantity > stackable)
11667 split_quantity_new = stackable;
11668 else
11669 split_quantity_new = quantity;
11670
11672 {
11673 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11674 if (new_item)
11675 {
11676 new_item.SetResultOfSplit(true);
11677 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11679 new_item.
SetQuantity(split_quantity_new,
false,
true);
11680 }
11681 }
11682 }
11683 }
11684
11686 {
11688 {
11689 if (ScriptInputUserData.CanStoreInputUserData())
11690 {
11691 ScriptInputUserData ctx = new ScriptInputUserData;
11696 ItemBase destination_entity =
this;
11697 ctx.
Write(destination_entity);
11701 }
11702 }
11703 else if (!
g_Game.IsMultiplayer())
11704 {
11706 }
11707 }
11708
11710 {
11712 float split_quantity_new;
11714 if (player)
11715 {
11717 if (quantity > stackable)
11718 split_quantity_new = stackable;
11719 else
11720 split_quantity_new = quantity;
11721
11723 {
11724 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11725 new_item =
ItemBase.Cast(in_hands);
11726 if (new_item)
11727 {
11728 new_item.SetResultOfSplit(true);
11729 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11731 new_item.SetQuantity(split_quantity_new, false, true);
11732 }
11733 }
11734 }
11735 }
11736
11738 {
11740 float split_quantity_new = Math.Floor(quantity * 0.5);
11741
11743 return;
11744
11746
11747 if (new_item)
11748 {
11749 if (new_item.GetQuantityMax() < split_quantity_new)
11750 {
11751 split_quantity_new = new_item.GetQuantityMax();
11752 }
11753
11754 new_item.SetResultOfSplit(true);
11755 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11756
11758 {
11761 }
11762 else
11763 {
11765 new_item.
SetQuantity(split_quantity_new,
false,
true);
11766 }
11767 }
11768 }
11769
11771 {
11773 float split_quantity_new = Math.Floor(quantity / 2);
11774
11776 return;
11777
11778 InventoryLocation invloc = new InventoryLocation;
11780
11782 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11783
11784 if (new_item)
11785 {
11786 if (new_item.GetQuantityMax() < split_quantity_new)
11787 {
11788 split_quantity_new = new_item.GetQuantityMax();
11789 }
11791 {
11794 }
11795 else if (split_quantity_new > 1)
11796 {
11798 new_item.
SetQuantity(split_quantity_new,
false,
true);
11799 }
11800 }
11801 }
11802
11805 {
11806 SetWeightDirty();
11808
11809 if (parent)
11810 parent.OnAttachmentQuantityChangedEx(this, delta);
11811
11813 {
11815 {
11817 }
11819 {
11820 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11822 }
11823 }
11824 }
11825
11828 {
11829
11830 }
11831
11834 {
11836 }
11837
11839 {
11840 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11841
11843 {
11844 if (newLevel == GameConstants.STATE_RUINED)
11845 {
11847 EntityAI parent = GetHierarchyParent();
11848 if (parent && parent.IsFireplace())
11849 {
11850 CargoBase cargo = GetInventory().GetCargo();
11851 if (cargo)
11852 {
11854 {
11856 }
11857 }
11858 }
11859 }
11860
11862 {
11863
11865 return;
11866 }
11867
11868 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11869 {
11871 }
11872 }
11873 }
11874
11875
11877 {
11878 super.OnRightClick();
11879
11881 {
11883 {
11884 if (ScriptInputUserData.CanStoreInputUserData())
11885 {
11886 EntityAI root = GetHierarchyRoot();
11887 Man playerOwner = GetHierarchyRootPlayer();
11888 InventoryLocation dst = new InventoryLocation;
11889
11890
11891 if (!playerOwner && root && root == this)
11892 {
11894 }
11895 else
11896 {
11897
11898 GetInventory().GetCurrentInventoryLocation(dst);
11900 {
11901 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11903 {
11905 }
11906 else
11907 {
11909
11910
11911 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11912 {
11914 }
11915 else
11916 {
11917 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11918 }
11919 }
11920 }
11921 }
11922
11923 ScriptInputUserData ctx = new ScriptInputUserData;
11931 }
11932 }
11933 else if (!
g_Game.IsMultiplayer())
11934 {
11936 }
11937 }
11938 }
11939
11941 {
11942 if (root)
11943 {
11944 vector m4[4];
11945 root.GetTransform(m4);
11946 dst.SetGround(this, m4);
11947 }
11948 else
11949 {
11950 GetInventory().GetCurrentInventoryLocation(dst);
11951 }
11952 }
11953
11954 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11955 {
11956
11957 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11958 return false;
11959
11960 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11961 return false;
11962
11963
11965 return false;
11966
11967
11968 Magazine mag = Magazine.Cast(this);
11969 if (mag)
11970 {
11971 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11972 return false;
11973
11974 if (stack_max_limit)
11975 {
11976 Magazine other_mag = Magazine.Cast(other_item);
11977 if (other_item)
11978 {
11979 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11980 return false;
11981 }
11982
11983 }
11984 }
11985 else
11986 {
11987
11989 return false;
11990
11992 return false;
11993 }
11994
11995 PlayerBase player = null;
11996 if (CastTo(player, GetHierarchyRootPlayer()))
11997 {
11998 if (player.GetInventory().HasAttachment(this))
11999 return false;
12000
12001 if (player.IsItemsToDelete())
12002 return false;
12003 }
12004
12005 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
12006 return false;
12007
12008 int slotID;
12010 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
12011 return false;
12012
12013 return true;
12014 }
12015
12017 {
12019 }
12020
12022 {
12023 return m_IsResultOfSplit;
12024 }
12025
12027 {
12028 m_IsResultOfSplit = value;
12029 }
12030
12032 {
12034 }
12035
12037 {
12038 float other_item_quantity = other_item.GetQuantity();
12039 float this_free_space;
12040
12042
12044
12045 if (other_item_quantity > this_free_space)
12046 {
12047 return this_free_space;
12048 }
12049 else
12050 {
12051 return other_item_quantity;
12052 }
12053 }
12054
12056 {
12058 }
12059
12061 {
12063 return;
12064
12065 if (!IsMagazine() && other_item)
12066 {
12068 if (quantity_used != 0)
12069 {
12070 float hp1 = GetHealth01("","");
12071 float hp2 = other_item.GetHealth01("","");
12072 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12073 hpResult = hpResult / (
GetQuantity() + quantity_used);
12074
12075 hpResult *= GetMaxHealth();
12076 Math.Round(hpResult);
12077 SetHealth("", "Health", hpResult);
12078
12080 other_item.AddQuantity(-quantity_used);
12081 }
12082 }
12084 }
12085
12087 {
12088 #ifdef SERVER
12089 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12090 GetHierarchyParent().IncreaseLifetimeUp();
12091 #endif
12092 };
12093
12095 {
12096 PlayerBase p = PlayerBase.Cast(player);
12097
12098 array<int> recipesIds = p.m_Recipes;
12099 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12100 if (moduleRecipesManager)
12101 {
12102 EntityAI itemInHands = player.GetEntityInHands();
12103 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12104 }
12105
12106 for (int i = 0;i < recipesIds.Count(); i++)
12107 {
12108 int key = recipesIds.Get(i);
12109 string recipeName = moduleRecipesManager.GetRecipeName(key);
12111 }
12112 }
12113
12114
12115 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12116 {
12117 super.GetDebugActions(outputList);
12118
12119
12125
12126
12131
12136
12137
12141
12142
12144 {
12148 }
12149
12152
12153
12157
12159
12160 InventoryLocation loc = new InventoryLocation();
12161 GetInventory().GetCurrentInventoryLocation(loc);
12163 {
12164 if (Gizmo_IsSupported())
12167 }
12168
12170 }
12171
12172
12173
12174
12176 {
12177 super.OnAction(action_id, player, ctx);
12178
12180 {
12181 switch (action_id)
12182 {
12186 return true;
12190 return true;
12191 }
12192 }
12193
12195 {
12196 switch (action_id)
12197 {
12199 Delete();
12200 return true;
12201 }
12202 }
12203
12204 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12205 {
12206 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12207 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12208 PlayerBase p = PlayerBase.Cast(player);
12209 if (
EActions.RECIPES_RANGE_START < 1000)
12210 {
12211 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12212 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12213 }
12214 }
12215 #ifndef SERVER
12216 else if (action_id ==
EActions.WATCH_PLAYER)
12217 {
12218 PluginDeveloper.SetDeveloperItemClientEx(player);
12219 }
12220 #endif
12222 {
12223 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12224 {
12225 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12226 OnDebugButtonPressServer(id + 1);
12227 }
12228
12229 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12230 {
12231 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12233 }
12234
12235 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12236 {
12237 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12239 }
12240
12241 else if (action_id ==
EActions.ADD_QUANTITY)
12242 {
12243 if (IsMagazine())
12244 {
12245 Magazine mag = Magazine.Cast(this);
12246 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12247 }
12248 else
12249 {
12251 }
12252
12253 if (m_EM)
12254 {
12255 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12256 }
12257
12258 }
12259
12260 else if (action_id ==
EActions.REMOVE_QUANTITY)
12261 {
12262 if (IsMagazine())
12263 {
12264 Magazine mag2 = Magazine.Cast(this);
12265 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12266 }
12267 else
12268 {
12270 }
12271 if (m_EM)
12272 {
12273 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12274 }
12275
12276 }
12277
12278 else if (action_id ==
EActions.SET_QUANTITY_0)
12279 {
12281
12282 if (m_EM)
12283 {
12284 m_EM.SetEnergy(0);
12285 }
12286 }
12287
12288 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12289 {
12291
12292 if (m_EM)
12293 {
12294 m_EM.SetEnergy(m_EM.GetEnergyMax());
12295 }
12296 }
12297
12298 else if (action_id ==
EActions.ADD_HEALTH)
12299 {
12300 AddHealth("","",GetMaxHealth("","Health")/5);
12301 }
12302 else if (action_id ==
EActions.REMOVE_HEALTH)
12303 {
12304 AddHealth("","",-GetMaxHealth("","Health")/5);
12305 }
12306 else if (action_id ==
EActions.DESTROY_HEALTH)
12307 {
12308 SetHealth01("","",0);
12309 }
12310 else if (action_id ==
EActions.WATCH_ITEM)
12311 {
12313 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12314 #ifdef DEVELOPER
12315 SetDebugDeveloper_item(this);
12316 #endif
12317 }
12318
12319 else if (action_id ==
EActions.ADD_TEMPERATURE)
12320 {
12321 AddTemperature(20);
12322
12323 }
12324
12325 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12326 {
12327 AddTemperature(-20);
12328
12329 }
12330
12331 else if (action_id ==
EActions.FLIP_FROZEN)
12332 {
12333 SetFrozen(!GetIsFrozen());
12334
12335 }
12336
12337 else if (action_id ==
EActions.ADD_WETNESS)
12338 {
12340
12341 }
12342
12343 else if (action_id ==
EActions.REMOVE_WETNESS)
12344 {
12346
12347 }
12348
12349 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12350 {
12353
12354
12355 }
12356
12357 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12358 {
12361 }
12362
12363 else if (action_id ==
EActions.MAKE_SPECIAL)
12364 {
12365 auto debugParams = DebugSpawnParams.WithPlayer(player);
12366 OnDebugSpawnEx(debugParams);
12367 }
12368
12369 }
12370
12371
12372 return false;
12373 }
12374
12375
12376
12377
12381
12384
12385
12386
12388 {
12389 return false;
12390 }
12391
12392
12394 {
12395 return true;
12396 }
12397
12398
12400 {
12401 return true;
12402 }
12403
12404
12405
12407 {
12408 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12409 return g_Game.ConfigIsExisting(config_path);
12410 }
12411
12414 {
12415 return null;
12416 }
12417
12419 {
12420 return false;
12421 }
12422
12424 {
12425 return false;
12426 }
12427
12431
12432
12434 {
12435 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12436 return module_repairing.CanRepair(this, item_repair_kit);
12437 }
12438
12439
12440 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12441 {
12442 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12443 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12444 }
12445
12446
12448 {
12449
12450
12451
12452
12453
12454
12455
12456
12457 return 1;
12458 }
12459
12460
12461
12463 {
12465 }
12466
12467
12468
12470 {
12472 }
12473
12474
12483 {
12484 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12485
12486 if (player)
12487 {
12488 player.MessageStatus(text);
12489 }
12490 }
12491
12492
12501 {
12502 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12503
12504 if (player)
12505 {
12506 player.MessageAction(text);
12507 }
12508 }
12509
12510
12519 {
12520 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12521
12522 if (player)
12523 {
12524 player.MessageFriendly(text);
12525 }
12526 }
12527
12528
12537 {
12538 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12539
12540 if (player)
12541 {
12542 player.MessageImportant(text);
12543 }
12544 }
12545
12547 {
12548 return true;
12549 }
12550
12551
12552 override bool KindOf(
string tag)
12553 {
12554 bool found = false;
12555 string item_name = this.
GetType();
12557 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12558
12559 int array_size = item_tag_array.Count();
12560 for (int i = 0; i < array_size; i++)
12561 {
12562 if (item_tag_array.Get(i) == tag)
12563 {
12564 found = true;
12565 break;
12566 }
12567 }
12568 return found;
12569 }
12570
12571
12573 {
12574
12575 super.OnRPC(sender, rpc_type,ctx);
12576
12577
12578 switch (rpc_type)
12579 {
12580 #ifndef SERVER
12581 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12582 Param2<bool, string> p = new Param2<bool, string>(false, "");
12583
12585 return;
12586
12587 bool play = p.param1;
12588 string soundSet = p.param2;
12589
12590 if (play)
12591 {
12593 {
12595 {
12597 }
12598 }
12599 else
12600 {
12602 }
12603 }
12604 else
12605 {
12607 }
12608
12609 break;
12610 #endif
12611
12612 }
12613
12615 {
12617 }
12618 }
12619
12620
12621
12622
12624 {
12625 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12626 return plugin.GetID(
name);
12627 }
12628
12630 {
12631 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12632 return plugin.GetName(id);
12633 }
12634
12637 {
12638
12639
12640 int varFlags;
12641 if (!ctx.
Read(varFlags))
12642 return;
12643
12644 if (varFlags & ItemVariableFlags.FLOAT)
12645 {
12647 }
12648 }
12649
12651 {
12652
12653 super.SerializeNumericalVars(floats_out);
12654
12655
12656
12658 {
12660 }
12661
12663 {
12665 }
12666
12668 {
12670 }
12671
12673 {
12678 }
12679
12681 {
12683 }
12684 }
12685
12687 {
12688
12689 super.DeSerializeNumericalVars(floats);
12690
12691
12692 int index = 0;
12693 int mask = Math.Round(floats.Get(index));
12694
12695 index++;
12696
12698 {
12700 {
12702 }
12703 else
12704 {
12705 float quantity = floats.Get(index);
12706 SetQuantity(quantity,
true,
false,
false,
false);
12707 }
12708 index++;
12709 }
12710
12712 {
12713 float wet = floats.Get(index);
12715 index++;
12716 }
12717
12719 {
12720 int liquidtype = Math.Round(floats.Get(index));
12722 index++;
12723 }
12724
12726 {
12728 index++;
12730 index++;
12732 index++;
12734 index++;
12735 }
12736
12738 {
12739 int cleanness = Math.Round(floats.Get(index));
12741 index++;
12742 }
12743 }
12744
12746 {
12747 super.WriteVarsToCTX(ctx);
12748
12749
12751 {
12753 }
12754
12756 {
12758 }
12759
12761 {
12763 }
12764
12766 {
12767 int r,g,b,a;
12773 }
12774
12776 {
12778 }
12779 }
12780
12782 {
12783 if (!super.ReadVarsFromCTX(ctx,version))
12784 return false;
12785
12786 int intValue;
12787 float value;
12788
12789 if (version < 140)
12790 {
12791 if (!ctx.
Read(intValue))
12792 return false;
12793
12794 m_VariablesMask = intValue;
12795 }
12796
12798 {
12799 if (!ctx.
Read(value))
12800 return false;
12801
12803 {
12805 }
12806 else
12807 {
12809 }
12810 }
12811
12812 if (version < 140)
12813 {
12815 {
12816 if (!ctx.
Read(value))
12817 return false;
12818 SetTemperatureDirect(value);
12819 }
12820 }
12821
12823 {
12824 if (!ctx.
Read(value))
12825 return false;
12827 }
12828
12830 {
12831 if (!ctx.
Read(intValue))
12832 return false;
12834 }
12835
12837 {
12838 int r,g,b,a;
12840 return false;
12842 return false;
12844 return false;
12846 return false;
12847
12849 }
12850
12852 {
12853 if (!ctx.
Read(intValue))
12854 return false;
12856 }
12857
12858 if (version >= 138 && version < 140)
12859 {
12861 {
12862 if (!ctx.
Read(intValue))
12863 return false;
12864 SetFrozen(intValue);
12865 }
12866 }
12867
12868 return true;
12869 }
12870
12871
12873 {
12876 {
12878 }
12879
12880 if (!super.OnStoreLoad(ctx, version))
12881 {
12883 return false;
12884 }
12885
12886 if (version >= 114)
12887 {
12888 bool hasQuickBarIndexSaved;
12889
12890 if (!ctx.
Read(hasQuickBarIndexSaved))
12891 {
12893 return false;
12894 }
12895
12896 if (hasQuickBarIndexSaved)
12897 {
12898 int itmQBIndex;
12899
12900
12901 if (!ctx.
Read(itmQBIndex))
12902 {
12904 return false;
12905 }
12906
12907 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12908 if (itmQBIndex != -1 && parentPlayer)
12909 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12910 }
12911 }
12912 else
12913 {
12914
12915 PlayerBase player;
12916 int itemQBIndex;
12917 if (version ==
int.
MAX)
12918 {
12919 if (!ctx.
Read(itemQBIndex))
12920 {
12922 return false;
12923 }
12924 }
12925 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12926 {
12927
12928 if (!ctx.
Read(itemQBIndex))
12929 {
12931 return false;
12932 }
12933 if (itemQBIndex != -1 && player)
12934 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12935 }
12936 }
12937
12938 if (version < 140)
12939 {
12940
12941 if (!LoadVariables(ctx, version))
12942 {
12944 return false;
12945 }
12946 }
12947
12948
12950 {
12952 return false;
12953 }
12954 if (version >= 132)
12955 {
12957 if (raib)
12958 {
12960 {
12962 return false;
12963 }
12964 }
12965 }
12966
12968 return true;
12969 }
12970
12971
12972
12974 {
12975 super.OnStoreSave(ctx);
12976
12977 PlayerBase player;
12978 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12979 {
12981
12982 int itemQBIndex = -1;
12983 itemQBIndex = player.FindQuickBarEntityIndex(this);
12984 ctx.
Write(itemQBIndex);
12985 }
12986 else
12987 {
12989 }
12990
12992
12994 if (raib)
12995 {
12997 }
12998 }
12999
13000
13002 {
13003 super.AfterStoreLoad();
13004
13006 {
13008 }
13009
13011 {
13014 }
13015 }
13016
13018 {
13019 super.EEOnAfterLoad();
13020
13022 {
13024 }
13025
13028 }
13029
13031 {
13032 return false;
13033 }
13034
13035
13036
13038 {
13040 {
13041 #ifdef PLATFORM_CONSOLE
13042
13044 {
13046 if (menu)
13047 {
13049 }
13050 }
13051 #endif
13052 }
13053
13055 {
13058 }
13059
13061 {
13062 SetWeightDirty();
13064 }
13066 {
13069 }
13070
13072 {
13075
13078 }
13080 {
13084 }
13085
13086 super.OnVariablesSynchronized();
13087 }
13088
13089
13090
13092 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13093 {
13094 if (!IsServerCheck(allow_client))
13095 return false;
13096
13098 return false;
13099
13102
13103 if (value <= (min + 0.001))
13104 value = min;
13105
13106 if (value == min)
13107 {
13108 if (destroy_config)
13109 {
13110 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13111 if (dstr)
13112 {
13114 this.Delete();
13115 return true;
13116 }
13117 }
13118 else if (destroy_forced)
13119 {
13121 this.Delete();
13122 return true;
13123 }
13124
13126 }
13127
13130
13132 {
13133 EntityAI parent = GetHierarchyRoot();
13134 InventoryLocation iLoc = new InventoryLocation();
13135 GetInventory().GetCurrentInventoryLocation(iLoc);
13137 {
13138 int iLocSlot = iLoc.
GetSlot();
13140 {
13142 }
13144 {
13146 }
13147 }
13148 }
13149
13151 {
13153
13154 if (delta)
13156 }
13157
13159
13160 return false;
13161 }
13162
13163
13165 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13166 {
13168 }
13169
13171 {
13174 }
13175
13177 {
13180 }
13181
13183 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13184 {
13185 float value_clamped = Math.Clamp(value, 0, 1);
13187 SetQuantity(result, destroy_config, destroy_forced);
13188 }
13189
13190
13193 {
13195 }
13196
13198 {
13200 }
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13212 {
13213 int slot = -1;
13214 GameInventory inventory = GetInventory();
13215 if (inventory)
13216 {
13217 InventoryLocation il = new InventoryLocation;
13220 }
13221
13223 }
13224
13226 {
13227 float quantity_max = 0;
13228
13230 {
13231 if (attSlotID != -1)
13232 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13233
13234 if (quantity_max <= 0)
13236 }
13237
13238 if (quantity_max <= 0)
13240
13241 return quantity_max;
13242 }
13243
13245 {
13247 }
13248
13250 {
13252 }
13253
13254
13256 {
13258 }
13259
13261 {
13263 }
13264
13266 {
13268 }
13269
13270
13272 {
13273
13274 float weightEx = GetWeightEx();
13275 float special = GetInventoryAndCargoWeight();
13276 return weightEx - special;
13277 }
13278
13279
13281 {
13283 }
13284
13286 {
13288 {
13289 #ifdef DEVELOPER
13290 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13291 {
13292 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13294 }
13295 #endif
13296
13297 return GetQuantity() * GetConfigWeightModified();
13298 }
13299 else if (HasEnergyManager())
13300 {
13301 #ifdef DEVELOPER
13302 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13303 {
13304 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13305 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13306 }
13307 #endif
13308 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13309 }
13310 else
13311 {
13312 #ifdef DEVELOPER
13313 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13314 {
13315 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13316 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13317 }
13318 #endif
13319 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13320 }
13321 }
13322
13325 {
13326 int item_count = 0;
13328
13329 GameInventory inventory = GetInventory();
13330 CargoBase cargo = inventory.
GetCargo();
13331 if (cargo != NULL)
13332 {
13334 }
13335
13337 for (int i = 0; i < nAttachments; ++i)
13338 {
13340 if (item)
13341 item_count += item.GetNumberOfItems();
13342 }
13343 return item_count;
13344 }
13345
13348 {
13349 float weight = 0;
13350 float wetness = 1;
13351 if (include_wetness)
13354 {
13355 weight = wetness * m_ConfigWeight;
13356 }
13358 {
13359 weight = 1;
13360 }
13361 return weight;
13362 }
13363
13364
13365
13367 {
13368 GameInventory inventory = GetInventory();
13369 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13370 {
13371 array<EntityAI> items = new array<EntityAI>;
13373 for (int i = 0; i < items.Count(); ++i)
13374 {
13376 if (item)
13377 {
13378 g_Game.ObjectDelete(item);
13379 }
13380 }
13381 }
13382 }
13383
13384
13385
13386
13388 {
13389 float energy = 0;
13390 if (HasEnergyManager())
13391 {
13392 energy = GetCompEM().GetEnergy();
13393 }
13394 return energy;
13395 }
13396
13397
13399 {
13400 super.OnEnergyConsumed();
13401
13403 }
13404
13406 {
13407 super.OnEnergyAdded();
13408
13410 }
13411
13412
13414 {
13415 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13416 {
13418 {
13419 float energy_0to1 = GetCompEM().GetEnergy0To1();
13421 }
13422 }
13423 }
13424
13425
13427 {
13428 return ConfigGetFloat("heatIsolation");
13429 }
13430
13432 {
13434 }
13435
13437 {
13438 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13439 if (
g_Game.ConfigIsExisting(paramPath))
13440 return g_Game.ConfigGetFloat(paramPath);
13441
13442 return 0.0;
13443 }
13444
13446 {
13447 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13448 if (
g_Game.ConfigIsExisting(paramPath))
13449 return g_Game.ConfigGetFloat(paramPath);
13450
13451 return 0.0;
13452 }
13453
13454 override void SetWet(
float value,
bool allow_client =
false)
13455 {
13456 if (!IsServerCheck(allow_client))
13457 return;
13458
13461
13463
13464 m_VarWet = Math.Clamp(value, min, max);
13465
13467 {
13470 }
13471 }
13472
13473 override void AddWet(
float value)
13474 {
13476 }
13477
13479 {
13481 }
13482
13484 {
13486 }
13487
13489 {
13491 }
13492
13494 {
13496 }
13497
13499 {
13501 }
13502
13503 override void OnWetChanged(
float newVal,
float oldVal)
13504 {
13507 if (newLevel != oldLevel)
13508 {
13510 }
13511 }
13512
13514 {
13515 SetWeightDirty();
13516 }
13517
13519 {
13520 return GetWetLevelInternal(
m_VarWet);
13521 }
13522
13523
13524
13526 {
13528 }
13529
13531 {
13533 }
13534
13536 {
13538 }
13539
13541 {
13543 }
13544
13545
13546
13548 {
13549 if (ConfigIsExisting("itemModelLength"))
13550 {
13551 return ConfigGetFloat("itemModelLength");
13552 }
13553 return 0;
13554 }
13555
13557 {
13558 if (ConfigIsExisting("itemAttachOffset"))
13559 {
13560 return ConfigGetFloat("itemAttachOffset");
13561 }
13562 return 0;
13563 }
13564
13565 override void SetCleanness(
int value,
bool allow_client =
false)
13566 {
13567 if (!IsServerCheck(allow_client))
13568 return;
13569
13571
13573
13576 }
13577
13579 {
13581 }
13582
13584 {
13585 return true;
13586 }
13587
13588
13589
13590
13592 {
13594 }
13595
13597 {
13599 }
13600
13601
13602
13603
13604 override void SetColor(
int r,
int g,
int b,
int a)
13605 {
13611 }
13613 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13614 {
13619 }
13620
13622 {
13624 }
13625
13628 {
13629 int r,g,b,a;
13631 r = r/255;
13632 g = g/255;
13633 b = b/255;
13634 a = a/255;
13635 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13636 }
13637
13638
13639
13640 override void SetLiquidType(
int value,
bool allow_client =
false)
13641 {
13642 if (!IsServerCheck(allow_client))
13643 return;
13644
13649 }
13650
13652 {
13653 return ConfigGetInt("varLiquidTypeInit");
13654 }
13655
13657 {
13659 }
13660
13662 {
13664 SetFrozen(false);
13665 }
13666
13669 {
13670 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13671 }
13672
13673
13676 {
13677 PlayerBase nplayer;
13678 if (PlayerBase.CastTo(nplayer, player))
13679 {
13681 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13682 }
13683 }
13684
13685
13688 {
13689 PlayerBase nplayer;
13690 if (PlayerBase.CastTo(nplayer,player))
13691 {
13692 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13693 }
13694
13695 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13696
13697 if (HasEnergyManager())
13698 {
13699 GetCompEM().UpdatePlugState();
13700 }
13701 }
13702
13703
13705 {
13706 super.OnPlacementStarted(player);
13707
13709 }
13710
13711 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13712 {
13714 {
13715 m_AdminLog.OnPlacementComplete(player,
this);
13716 }
13717
13718 super.OnPlacementComplete(player, position, orientation);
13719 }
13720
13721
13722
13723
13724
13726 {
13728 {
13729 return true;
13730 }
13731 else
13732 {
13733 return false;
13734 }
13735 }
13736
13737
13739 {
13741 {
13743 }
13744 }
13745
13746
13748 {
13750 }
13751
13753 {
13755 }
13756
13757 override void InsertAgent(
int agent,
float count = 1)
13758 {
13759 if (count < 1)
13760 return;
13761
13763 }
13764
13767 {
13769 }
13770
13771
13773 {
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
13817
13819 {
13821 return false;
13822 return true;
13823 }
13824
13826 {
13827
13829 }
13830
13831
13834 {
13835 super.CheckForRoofLimited(timeTresholdMS);
13836
13837 float time =
g_Game.GetTime();
13838 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13839 {
13840 m_PreviousRoofTestTime = time;
13841 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13842 }
13843 }
13844
13845
13847 {
13849 {
13850 return 0;
13851 }
13852
13853 if (GetInventory().GetAttachmentSlotsCount() != 0)
13854 {
13855 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13856 if (filter)
13857 return filter.GetProtectionLevel(type, false, system);
13858 else
13859 return 0;
13860 }
13861
13862 string subclassPath, entryName;
13863
13864 switch (type)
13865 {
13867 entryName = "biological";
13868 break;
13870 entryName = "chemical";
13871 break;
13872 default:
13873 entryName = "biological";
13874 break;
13875 }
13876
13877 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13878
13879 return g_Game.ConfigGetFloat(subclassPath + entryName);
13880 }
13881
13882
13883
13886 {
13887 if (!IsMagazine())
13889
13891 }
13892
13893
13894
13895
13896
13901 {
13902 return true;
13903 }
13904
13906 {
13908 }
13909
13910
13911
13912
13913
13915 {
13916 if (parent)
13917 {
13918 if (parent.IsInherited(DayZInfected))
13919 return true;
13920
13921 if (!parent.IsRuined())
13922 return true;
13923 }
13924
13925 return true;
13926 }
13927
13929 {
13930 if (!super.CanPutAsAttachment(parent))
13931 {
13932 return false;
13933 }
13934
13935 if (!IsRuined() && !parent.IsRuined())
13936 {
13937 return true;
13938 }
13939
13940 return false;
13941 }
13942
13944 {
13945
13946
13947
13948
13949 return super.CanReceiveItemIntoCargo(item);
13950 }
13951
13953 {
13954
13955
13956
13957
13958 GameInventory attachmentInv = attachment.GetInventory();
13960 {
13961 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13962 return false;
13963 }
13964
13965 InventoryLocation loc = new InventoryLocation();
13966 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13967 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13968 return false;
13969
13970 return super.CanReceiveAttachment(attachment, slotId);
13971 }
13972
13974 {
13975 if (!super.CanReleaseAttachment(attachment))
13976 return false;
13977
13978 return GetInventory().AreChildrenAccessible();
13979 }
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14002 {
14003 int id = muzzle_owner.GetMuzzleID();
14004 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
14005
14006 if (WPOF_array)
14007 {
14008 for (int i = 0; i < WPOF_array.Count(); i++)
14009 {
14010 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
14011
14012 if (WPOF)
14013 {
14014 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
14015 }
14016 }
14017 }
14018 }
14019
14020
14022 {
14023 int id = muzzle_owner.GetMuzzleID();
14025
14026 if (WPOBE_array)
14027 {
14028 for (int i = 0; i < WPOBE_array.Count(); i++)
14029 {
14030 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14031
14032 if (WPOBE)
14033 {
14034 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14035 }
14036 }
14037 }
14038 }
14039
14040
14042 {
14043 int id = muzzle_owner.GetMuzzleID();
14044 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14045
14046 if (WPOOH_array)
14047 {
14048 for (int i = 0; i < WPOOH_array.Count(); i++)
14049 {
14050 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14051
14052 if (WPOOH)
14053 {
14054 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14055 }
14056 }
14057 }
14058 }
14059
14060
14062 {
14063 int id = muzzle_owner.GetMuzzleID();
14064 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14065
14066 if (WPOOH_array)
14067 {
14068 for (int i = 0; i < WPOOH_array.Count(); i++)
14069 {
14070 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14071
14072 if (WPOOH)
14073 {
14074 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14075 }
14076 }
14077 }
14078 }
14079
14080
14082 {
14083 int id = muzzle_owner.GetMuzzleID();
14084 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14085
14086 if (WPOOH_array)
14087 {
14088 for (int i = 0; i < WPOOH_array.Count(); i++)
14089 {
14090 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14091
14092 if (WPOOH)
14093 {
14094 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14095 }
14096 }
14097 }
14098 }
14099
14100
14101
14103 {
14105 {
14106 return true;
14107 }
14108
14109 return false;
14110 }
14111
14113 {
14115 {
14116 return true;
14117 }
14118
14119 return false;
14120 }
14121
14123 {
14125 {
14126 return true;
14127 }
14128
14129 return false;
14130 }
14131
14133 {
14134 return false;
14135 }
14136
14139 {
14140 return UATimeSpent.DEFAULT_DEPLOY;
14141 }
14142
14143
14144
14145
14147 {
14149 SetSynchDirty();
14150 }
14151
14153 {
14155 }
14156
14157
14159 {
14160 return false;
14161 }
14162
14165 {
14166 string att_type = "None";
14167
14168 if (ConfigIsExisting("soundAttType"))
14169 {
14170 att_type = ConfigGetString("soundAttType");
14171 }
14172
14174 }
14175
14177 {
14179 }
14180
14181
14182
14183
14184
14190
14192 {
14195
14197 }
14198
14199
14201 {
14203 return;
14204
14206
14209
14212
14213 SoundParameters params = new SoundParameters();
14217 }
14218
14219
14221 {
14223 {
14226
14227 SetSynchDirty();
14228
14231 }
14232 }
14233
14235 {
14237 }
14238
14239
14241 {
14243 return;
14244
14246 SetSynchDirty();
14247
14250 }
14251
14253 {
14256 }
14257
14259 {
14261 }
14262
14263 void OnApply(PlayerBase player);
14264
14266 {
14267 return 1.0;
14268 };
14269
14271 {
14273 }
14274
14276 {
14278 }
14279
14281
14283 {
14284 SetDynamicPhysicsLifeTime(0.01);
14286 }
14287
14289 {
14290 array<string> zone_names = new array<string>;
14291 GetDamageZones(zone_names);
14292 for (int i = 0; i < zone_names.Count(); i++)
14293 {
14294 SetHealthMax(zone_names.Get(i),"Health");
14295 }
14296 SetHealthMax("","Health");
14297 }
14298
14301 {
14302 float global_health = GetHealth01("","Health");
14303 array<string> zones = new array<string>;
14304 GetDamageZones(zones);
14305
14306 for (int i = 0; i < zones.Count(); i++)
14307 {
14308 SetHealth01(zones.Get(i),"Health",global_health);
14309 }
14310 }
14311
14314 {
14315 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14316 }
14317
14319 {
14320 if (!hasRootAsPlayer)
14321 {
14322 if (refParentIB)
14323 {
14324
14325 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14326 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14327
14328 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14329 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14330
14333 }
14334 else
14335 {
14336
14339 }
14340 }
14341 }
14342
14344 {
14346 {
14347 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14348 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14349 {
14350 float heatPermCoef = 1.0;
14352 while (ent)
14353 {
14354 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14355 ent = ent.GetHierarchyParent();
14356 }
14357
14358 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14359 }
14360 }
14361 }
14362
14364 {
14365
14366 EntityAI parent = GetHierarchyParent();
14367 if (!parent)
14368 {
14369 hasParent = false;
14370 hasRootAsPlayer = false;
14371 }
14372 else
14373 {
14374 hasParent = true;
14375 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14376 refParentIB =
ItemBase.Cast(parent);
14377 }
14378 }
14379
14380 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14381 {
14382
14383 }
14384
14386 {
14387
14388 return false;
14389 }
14390
14392 {
14393
14394
14395 return false;
14396 }
14397
14399 {
14400
14401 return false;
14402 }
14403
14406 {
14407 return !GetIsFrozen() &&
IsOpen();
14408 }
14409
14411 {
14412 bool hasParent = false, hasRootAsPlayer = false;
14414
14415 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14416 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14417
14418 if (wwtu || foodDecay)
14419 {
14423
14424 if (processWetness || processTemperature || processDecay)
14425 {
14427
14428 if (processWetness)
14429 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14430
14431 if (processTemperature)
14433
14434 if (processDecay)
14435 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14436 }
14437 }
14438 }
14439
14442 {
14444 }
14445
14447 {
14450
14451 return super.GetTemperatureFreezeThreshold();
14452 }
14453
14455 {
14458
14459 return super.GetTemperatureThawThreshold();
14460 }
14461
14463 {
14466
14467 return super.GetItemOverheatThreshold();
14468 }
14469
14471 {
14473 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14474
14475 return super.GetTemperatureFreezeTime();
14476 }
14477
14479 {
14481 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14482
14483 return super.GetTemperatureThawTime();
14484 }
14485
14490
14492 {
14493 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14494 }
14495
14497 {
14498 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14499 }
14500
14503 {
14505 }
14506
14508 {
14510 }
14511
14513 {
14515 }
14516
14519 {
14520 return null;
14521 }
14522
14525 {
14526 return false;
14527 }
14528
14530 {
14532 {
14535 if (!trg)
14536 {
14538 explosive = this;
14539 }
14540
14541 explosive.PairRemote(trg);
14543
14544 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14545 trg.SetPersistentPairID(persistentID);
14546 explosive.SetPersistentPairID(persistentID);
14547
14548 return true;
14549 }
14550 return false;
14551 }
14552
14555 {
14556 float ret = 1.0;
14559 ret *= GetHealth01();
14560
14561 return ret;
14562 }
14563
14564 #ifdef DEVELOPER
14565 override void SetDebugItem()
14566 {
14567 super.SetDebugItem();
14568 _itemBase = this;
14569 }
14570
14572 {
14573 string text = super.GetDebugText();
14574
14576 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14577
14578 return text;
14579 }
14580 #endif
14581
14583 {
14584 return true;
14585 }
14586
14588
14590
14592 {
14595 }
14596
14597
14605
14621
14622 [
Obsolete(
"Use ItemSoundHandler instead")]
14625 {
14626 if (!
g_Game.IsDedicatedServer())
14627 {
14628 if (ConfigIsExisting("attachSoundSet"))
14629 {
14630 string cfg_path = "";
14631 string soundset = "";
14632 string type_name =
GetType();
14633
14636 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14637 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14638
14639 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14640 {
14641 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14642 {
14643 if (cfg_slot_array[i] == slot_type)
14644 {
14645 soundset = cfg_soundset_array[i];
14646 break;
14647 }
14648 }
14649 }
14650
14651 if (soundset != "")
14652 {
14653 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14655 }
14656 }
14657 }
14658 }
14659
14661}
14662
14664{
14666 if (entity)
14667 {
14668 bool is_item = entity.IsInherited(
ItemBase);
14669 if (is_item && full_quantity)
14670 {
14673 }
14674 }
14675 else
14676 {
14678 return NULL;
14679 }
14680 return entity;
14681}
14682
14684{
14685 if (item)
14686 {
14687 if (health > 0)
14688 item.SetHealth("", "", health);
14689
14690 if (item.CanHaveTemperature())
14691 {
14693 if (item.CanFreeze())
14694 item.SetFrozen(false);
14695 }
14696
14697 if (item.HasEnergyManager())
14698 {
14699 if (quantity >= 0)
14700 {
14701 item.GetCompEM().SetEnergy0To1(quantity);
14702 }
14703 else
14704 {
14706 }
14707 }
14708 else if (item.IsMagazine())
14709 {
14710 Magazine mag = Magazine.Cast(item);
14711 if (quantity >= 0)
14712 {
14713 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14714 }
14715 else
14716 {
14718 }
14719
14720 }
14721 else
14722 {
14723 if (quantity >= 0)
14724 {
14725 item.SetQuantityNormalized(quantity, false);
14726 }
14727 else
14728 {
14730 }
14731
14732 }
14733 }
14734}
14735
14736#ifdef DEVELOPER
14738#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.