9725{
9727 {
9728 return true;
9729 }
9730};
9731
9733{
9734
9735};
9736
9737
9738
9740{
9744
9746
9749
9750
9751
9752
9753
9762
9768
9773
9778
9799 protected bool m_IsResultOfSplit
9800
9802
9807
9808
9809
9811
9815
9816
9817
9819
9822
9823
9824
9830
9831
9839
9842
9843
9845
9846
9848
9849
9854
9855
9860
9862
9863
9865
9866
9868 {
9873
9874 if (!
g_Game.IsDedicatedServer())
9875 {
9877 {
9879
9881 {
9883 }
9884 }
9885
9888 }
9889
9890 m_OldLocation = null;
9891
9893 {
9895 }
9896
9897 if (ConfigIsExisting("headSelectionsToHide"))
9898 {
9901 }
9902
9904 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9905 {
9907 }
9908
9910
9911 m_IsResultOfSplit = false;
9912
9914 }
9915
9917 {
9918 super.InitItemVariables();
9919
9925 m_Count = ConfigGetInt(
"count");
9926
9929
9934
9937
9942
9954
9958
9959
9962 if (ConfigIsExisting("canBeSplit"))
9963 {
9966 }
9967
9969 if (ConfigIsExisting("itemBehaviour"))
9971
9972
9975 RegisterNetSyncVariableInt("m_VarLiquidType");
9976 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9977
9978 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9979 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9980 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9981
9982 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9983 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9984 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9985 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9986
9987 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9988 RegisterNetSyncVariableBool("m_IsTakeable");
9989 RegisterNetSyncVariableBool("m_IsHologram");
9990
9993 {
9996 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9997 }
9998
10000
10002 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10004
10006 }
10007
10009 {
10011 }
10012
10014 {
10017 {
10022 }
10023 }
10024
10025 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10026 {
10028 {
10031 }
10032
10034 }
10035
10037 {
10043 }
10044
10046
10048 {
10050
10051 if (!action)
10052 {
10053 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10054 return;
10055 }
10056
10058 if (!ai)
10059 {
10061 return;
10062 }
10063
10065 if (!action_array)
10066 {
10067 action_array = new array<ActionBase_Basic>;
10069 }
10070 if (LogManager.IsActionLogEnable())
10071 {
10072 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10073 }
10074
10075 if (action_array.Find(action) != -1)
10076 {
10077 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10078 }
10079 else
10080 {
10081 action_array.Insert(action);
10082 }
10083 }
10084
10086 {
10087 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10088 ActionBase action = player.GetActionManager().GetAction(actionName);
10091
10092 if (action_array)
10093 {
10094 action_array.RemoveItem(action);
10095 }
10096 }
10097
10098
10099
10101 {
10102 ActionOverrideData overrideData = new ActionOverrideData();
10106
10108 if (!actionMap)
10109 {
10112 }
10113
10114 actionMap.Insert(this.
Type(), overrideData);
10115
10116 }
10117
10119
10121
10122
10124 {
10127
10130
10131 string config_to_search = "CfgVehicles";
10132 string muzzle_owner_config;
10133
10135 {
10136 if (IsInherited(Weapon))
10137 config_to_search = "CfgWeapons";
10138
10139 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10140
10141 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10142
10143 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10144
10145 if (config_OnFire_subclass_count > 0)
10146 {
10147 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10148
10149 for (int i = 0; i < config_OnFire_subclass_count; i++)
10150 {
10151 string particle_class = "";
10152 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10153 string config_OnFire_entry = config_OnFire_class + particle_class;
10154 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10155 WPOF_array.Insert(WPOF);
10156 }
10157
10158
10160 }
10161 }
10162
10164 {
10165 config_to_search = "CfgWeapons";
10166 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10167
10168 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10169
10170 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10171
10172 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10173 {
10174 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10175
10176 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10177 {
10178 string particle_class2 = "";
10179 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10180 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10181 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10182 WPOBE_array.Insert(WPOBE);
10183 }
10184
10185
10187 }
10188 }
10189 }
10190
10191
10193 {
10196
10198 {
10199 string config_to_search = "CfgVehicles";
10200
10201 if (IsInherited(Weapon))
10202 config_to_search = "CfgWeapons";
10203
10204 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10205 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10206
10207 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10208 {
10209
10211
10213 {
10215 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10217 return;
10218 }
10219
10222
10223
10224
10225 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10226 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10227
10228 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10229 {
10230 string particle_class = "";
10231 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10232 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10233 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10234
10235 if (entry_type == CT_CLASS)
10236 {
10237 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10238 WPOOH_array.Insert(WPOF);
10239 }
10240 }
10241
10242
10244 }
10245 }
10246 }
10247
10249 {
10251 }
10252
10254 {
10256 {
10258
10261
10264
10265 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10266 }
10267 }
10268
10270 {
10272 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10273
10275 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10276
10278 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10279
10281 {
10283 }
10284 }
10285
10287 {
10289 }
10290
10292 {
10295 else
10297
10299 {
10302 }
10303 else
10304 {
10307
10310 }
10311
10313 }
10314
10316 {
10318 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10319 }
10320
10322 {
10324 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10326 }
10327
10329 {
10331 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10332 }
10333
10335 {
10338
10339 OverheatingParticle OP = new OverheatingParticle();
10344
10346 }
10347
10349 {
10352
10353 return -1;
10354 }
10355
10357 {
10359 {
10362
10363 for (int i = count; i > 0; --i)
10364 {
10365 int id = i - 1;
10368
10371
10372 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10373 {
10374 if (p)
10375 {
10378 }
10379 }
10380 }
10381 }
10382 }
10383
10385 {
10387 {
10389 {
10390 int id = i - 1;
10392
10393 if (OP)
10394 {
10396
10397 if (p)
10398 {
10400 }
10401
10402 delete OP;
10403 }
10404 }
10405
10408 }
10409 }
10410
10413 {
10414 return 0.0;
10415 }
10416
10417
10419 {
10420 return 250;
10421 }
10422
10424 {
10425 return 0;
10426 }
10427
10430 {
10432 return true;
10433
10434 return false;
10435 }
10436
10439 {
10442
10444 {
10446 }
10447 else
10448 {
10449
10451 }
10452
10454 }
10455
10462 {
10463 return -1;
10464 }
10465
10466
10467
10468
10470 {
10472 {
10473 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10474 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10475
10476 if (r_index >= 0)
10477 {
10478 InventoryLocation r_il = new InventoryLocation;
10479 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10480
10481 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10484 {
10485 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10486 }
10488 {
10489 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10490 }
10491
10492 }
10493
10494 player.GetHumanInventory().ClearUserReservedLocation(this);
10495 }
10496
10499 }
10500
10501
10502
10503
10505 {
10506 return ItemBase.m_DebugActionsMask;
10507 }
10508
10510 {
10511 return ItemBase.m_DebugActionsMask & mask;
10512 }
10513
10515 {
10516 ItemBase.m_DebugActionsMask = mask;
10517 }
10518
10520 {
10521 ItemBase.m_DebugActionsMask |= mask;
10522 }
10523
10525 {
10526 ItemBase.m_DebugActionsMask &= ~mask;
10527 }
10528
10530 {
10532 {
10534 }
10535 else
10536 {
10538 }
10539 }
10540
10541
10543 {
10544 if (GetEconomyProfile())
10545 {
10546 float q_max = GetEconomyProfile().GetQuantityMax();
10547 if (q_max > 0)
10548 {
10549 float q_min = GetEconomyProfile().GetQuantityMin();
10550 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10551
10553 {
10554 ComponentEnergyManager comp = GetCompEM();
10556 {
10558 }
10559 }
10561 {
10563
10564 }
10565
10566 }
10567 }
10568 }
10569
10572 {
10573 EntityAI parent = GetHierarchyParent();
10574
10575 if (parent)
10576 {
10577 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10578 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10579 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10580 }
10581 }
10582
10585 {
10586 EntityAI parent = GetHierarchyParent();
10587
10588 if (parent)
10589 {
10590 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10591 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10592 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10593 }
10594 }
10595
10597 {
10598
10599
10600
10601
10603
10605 {
10606 if (ScriptInputUserData.CanStoreInputUserData())
10607 {
10608 ScriptInputUserData ctx = new ScriptInputUserData;
10614 ctx.
Write(use_stack_max);
10617
10619 {
10620 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10621 }
10622 }
10623 }
10624 else if (!
g_Game.IsMultiplayer())
10625 {
10627 }
10628 }
10629
10631 {
10633 }
10634
10636 {
10638 }
10639
10641 {
10643 }
10644
10646 {
10647
10648 return false;
10649 }
10650
10652 {
10653 return false;
10654 }
10655
10659 {
10660 return false;
10661 }
10662
10664 {
10665 return "";
10666 }
10667
10669
10671 {
10672 return false;
10673 }
10674
10676 {
10677 return true;
10678 }
10679
10680
10681
10683 {
10684 return true;
10685 }
10686
10688 {
10689 return true;
10690 }
10691
10693 {
10694 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10696 }
10697
10699 {
10701 }
10702
10704 {
10706 if (!is_being_placed)
10708 SetSynchDirty();
10709 }
10710
10711
10713
10715 {
10717 }
10718
10720 {
10722 }
10723
10725 {
10726 return 1;
10727 }
10728
10730 {
10731 return false;
10732 }
10733
10735 {
10737 SetSynchDirty();
10738 }
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10775 {
10776 super.OnMovedInsideCargo(container);
10777
10778 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10779 }
10780
10781 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10782 {
10783 super.EEItemLocationChanged(oldLoc, newLoc);
10784
10785 PlayerBase newPlayer = null;
10786 PlayerBase oldPlayer = null;
10787
10788 if (newLoc.GetParent())
10789 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10790
10791 if (oldLoc.GetParent())
10792 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10793
10795 {
10796 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10797
10798 if (rIndex >= 0)
10799 {
10800 InventoryLocation rIl = new InventoryLocation;
10801 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10802
10803 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10806 {
10807 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10808 }
10810 {
10812 }
10813
10814 }
10815 }
10816
10818 {
10819 if (newPlayer)
10820 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10821
10822 if (newPlayer == oldPlayer)
10823 {
10824 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10825 {
10827 {
10828 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10829 {
10830 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10831 }
10832 }
10833 else
10834 {
10835 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10836 }
10837 }
10838
10839 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10840 {
10841 int type = oldLoc.GetType();
10843 {
10844 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10845 }
10847 {
10848 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10849 }
10850 }
10851 if (!m_OldLocation)
10852 {
10853 m_OldLocation = new InventoryLocation;
10854 }
10855 m_OldLocation.Copy(oldLoc);
10856 }
10857 else
10858 {
10859 if (m_OldLocation)
10860 {
10861 m_OldLocation.Reset();
10862 }
10863 }
10864
10865 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10866 }
10867 else
10868 {
10869 if (newPlayer)
10870 {
10871 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10872 if (resIndex >= 0)
10873 {
10874 InventoryLocation il = new InventoryLocation;
10875 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10877 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10880 {
10881 il.
GetParent().GetOnReleaseLock().Invoke(it);
10882 }
10884 {
10886 }
10887
10888 }
10889 }
10891 {
10892
10894 }
10895
10896 if (m_OldLocation)
10897 {
10898 m_OldLocation.Reset();
10899 }
10900 }
10901
10903 {
10904 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10905 }
10906
10908 {
10909 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10910 }
10911 }
10912
10913 override void EOnContact(IEntity other, Contact extra)
10914 {
10916 {
10917 int liquidType = -1;
10919 if (impactSpeed > 0.0)
10920 {
10922 #ifndef SERVER
10924 #else
10926 SetSynchDirty();
10927 #endif
10929 }
10930 }
10931
10932 #ifdef SERVER
10933 if (GetCompEM() && GetCompEM().IsPlugged())
10934 {
10935 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10936 GetCompEM().UnplugThis();
10937 }
10938 #endif
10939 }
10940
10942
10944 {
10946 }
10947
10949 {
10950
10951 }
10952
10954 {
10955 super.OnItemLocationChanged(old_owner, new_owner);
10956
10957 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10958 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10959
10960 if (!relatedPlayer && playerNew)
10961 relatedPlayer = playerNew;
10962
10963 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10964 {
10966 if (actionMgr)
10967 {
10968 ActionBase currentAction = actionMgr.GetRunningAction();
10969 if (currentAction)
10971 }
10972 }
10973
10974 Man ownerPlayerOld = null;
10975 Man ownerPlayerNew = null;
10976
10977 if (old_owner)
10978 {
10979 if (old_owner.
IsMan())
10980 {
10981 ownerPlayerOld = Man.Cast(old_owner);
10982 }
10983 else
10984 {
10985 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10986 }
10987 }
10988 else
10989 {
10991 {
10993
10994 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10995 {
10996 GetCompEM().UnplugThis();
10997 }
10998 }
10999 }
11000
11001 if (new_owner)
11002 {
11003 if (new_owner.
IsMan())
11004 {
11005 ownerPlayerNew = Man.Cast(new_owner);
11006 }
11007 else
11008 {
11009 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11010 }
11011 }
11012
11013 if (ownerPlayerOld != ownerPlayerNew)
11014 {
11015 if (ownerPlayerOld)
11016 {
11017 array<EntityAI> subItemsExit = new array<EntityAI>;
11019 for (int i = 0; i < subItemsExit.Count(); i++)
11020 {
11023 }
11024 }
11025
11026 if (ownerPlayerNew)
11027 {
11028 array<EntityAI> subItemsEnter = new array<EntityAI>;
11030 for (int j = 0; j < subItemsEnter.Count(); j++)
11031 {
11034 }
11035 }
11036 }
11037 else if (ownerPlayerNew != null)
11038 {
11039 PlayerBase nplayer;
11040 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11041 {
11042 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11044 for (int k = 0; k < subItemsUpdate.Count(); k++)
11045 {
11047 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11048 }
11049 }
11050 }
11051
11052 if (old_owner)
11053 old_owner.OnChildItemRemoved(this);
11054 if (new_owner)
11055 new_owner.OnChildItemReceived(this);
11056 }
11057
11058
11060 {
11061 super.EEDelete(parent);
11062 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11063 if (player)
11064 {
11066
11067 if (player.IsAlive())
11068 {
11069 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11070 if (r_index >= 0)
11071 {
11072 InventoryLocation r_il = new InventoryLocation;
11073 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11074
11075 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11078 {
11079 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11080 }
11082 {
11083 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11084 }
11085
11086 }
11087
11088 player.RemoveQuickBarEntityShortcut(this);
11089 }
11090 }
11091 }
11092
11094 {
11095 super.EEKilled(killer);
11096
11099 {
11100 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11101 {
11102 if (IsMagazine())
11103 {
11104 if (Magazine.Cast(this).GetAmmoCount() > 0)
11105 {
11107 }
11108 }
11109 else
11110 {
11112 }
11113 }
11114 }
11115 }
11116
11118 {
11119 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11120
11121 super.OnWasAttached(parent, slot_id);
11122
11125
11128 }
11129
11131 {
11132 super.OnWasDetached(parent, slot_id);
11133
11136
11139 }
11140
11142 {
11143 int idx;
11146
11147 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11148 if (inventory_slots.Count() < 1)
11149 {
11150 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11151 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11152 }
11153 else
11154 {
11155 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11156 }
11157
11158 idx = inventory_slots.Find(slot);
11159 if (idx < 0)
11160 return "";
11161
11162 return attach_types.Get(idx);
11163 }
11164
11166 {
11167 int idx = -1;
11168 string slot;
11169
11172
11173 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11174 if (inventory_slots.Count() < 1)
11175 {
11176 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11177 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11178 }
11179 else
11180 {
11181 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11182 if (detach_types.Count() < 1)
11183 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11184 }
11185
11186 for (int i = 0; i < inventory_slots.Count(); i++)
11187 {
11188 slot = inventory_slots.Get(i);
11189 }
11190
11191 if (slot != "")
11192 {
11193 if (detach_types.Count() == 1)
11194 idx = 0;
11195 else
11196 idx = inventory_slots.Find(slot);
11197 }
11198 if (idx < 0)
11199 return "";
11200
11201 return detach_types.Get(idx);
11202 }
11203
11205 {
11206
11208
11209
11210 float min_time = 1;
11211 float max_time = 3;
11212 float delay = Math.RandomFloat(min_time, max_time);
11213
11214 explode_timer.Run(delay, this, "DoAmmoExplosion");
11215 }
11216
11218 {
11219 Magazine magazine = Magazine.Cast(this);
11220 int pop_sounds_count = 6;
11221 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11222
11223
11224 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11225 string sound_name = pop_sounds[ sound_idx ];
11226 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11227
11228
11229 magazine.ServerAddAmmoCount(-1);
11230
11231
11232 float min_temp_to_explode = 100;
11233
11234 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11235 {
11237 }
11238 }
11239
11240
11241 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11242 {
11243 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11244
11245 const int CHANCE_DAMAGE_CARGO = 4;
11246 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11247 const int CHANCE_DAMAGE_NOTHING = 2;
11248
11250 {
11251 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11252 int chances;
11253 int rnd;
11254
11255 if (GetInventory().GetCargo())
11256 {
11257 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11258 rnd = Math.RandomInt(0,chances);
11259
11260 if (rnd < CHANCE_DAMAGE_CARGO)
11261 {
11263 }
11264 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11265 {
11267 }
11268 }
11269 else
11270 {
11271 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11272 rnd = Math.RandomInt(0,chances);
11273
11274 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11275 {
11277 }
11278 }
11279 }
11280 }
11281
11283 {
11284 CargoBase cargo = GetInventory().GetCargo();
11285 if (cargo)
11286 {
11288 if (item_count > 0)
11289 {
11290 int random_pick = Math.RandomInt(0, item_count);
11292 if (!item.IsExplosive())
11293 {
11294 item.AddHealth("","",damage);
11295 return true;
11296 }
11297 }
11298 }
11299 return false;
11300 }
11301
11303 {
11304 GameInventory inventory = GetInventory();
11306 if (attachment_count > 0)
11307 {
11308 int random_pick = Math.RandomInt(0, attachment_count);
11310 if (!attachment.IsExplosive())
11311 {
11312 attachment.AddHealth("","",damage);
11313 return true;
11314 }
11315 }
11316 return false;
11317 }
11318
11320 {
11322 }
11323
11325 {
11327 return GetInventory().CanRemoveEntity();
11328
11329 return false;
11330 }
11331
11333 {
11334
11336 return false;
11337
11338
11340 return false;
11341
11342
11343
11345 if (delta == 0)
11346 return false;
11347
11348
11349 return true;
11350 }
11351
11353 {
11355 {
11356 if (ScriptInputUserData.CanStoreInputUserData())
11357 {
11358 ScriptInputUserData ctx = new ScriptInputUserData;
11363 ctx.
Write(destination_entity);
11365 ctx.
Write(slot_id);
11367 }
11368 }
11369 else if (!
g_Game.IsMultiplayer())
11370 {
11372 }
11373 }
11374
11376 {
11377 float split_quantity_new;
11381 InventoryLocation loc = new InventoryLocation;
11382
11383 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11384 {
11386 split_quantity_new = stack_max;
11387 else
11389
11391 {
11392 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11393 if (new_item)
11394 {
11395 new_item.SetResultOfSplit(true);
11396 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11398 new_item.
SetQuantity(split_quantity_new,
false,
true);
11399 }
11400 }
11401 }
11402 else if (destination_entity && slot_id == -1)
11403 {
11404 if (quantity > stack_max)
11405 split_quantity_new = stack_max;
11406 else
11407 split_quantity_new = quantity;
11408
11410 {
11411 GameInventory destinationInventory = destination_entity.GetInventory();
11413 {
11416 }
11417
11418 if (new_item)
11419 {
11420 new_item.SetResultOfSplit(true);
11421 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11423 new_item.
SetQuantity(split_quantity_new,
false,
true);
11424 }
11425 }
11426 }
11427 else
11428 {
11429 if (stack_max != 0)
11430 {
11432 {
11434 }
11435
11436 if (split_quantity_new == 0)
11437 {
11438 if (!
g_Game.IsMultiplayer())
11439 player.PhysicalPredictiveDropItem(this);
11440 else
11441 player.ServerDropEntity(this);
11442 return;
11443 }
11444
11446 {
11448
11449 if (new_item)
11450 {
11451 new_item.SetResultOfSplit(true);
11452 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11455 new_item.PlaceOnSurface();
11456 }
11457 }
11458 }
11459 }
11460 }
11461
11463 {
11464 float split_quantity_new;
11468 InventoryLocation loc = new InventoryLocation;
11469
11470 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11471 {
11473 split_quantity_new = stack_max;
11474 else
11476
11478 {
11479 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11480 if (new_item)
11481 {
11482 new_item.SetResultOfSplit(true);
11483 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11485 new_item.
SetQuantity(split_quantity_new,
false,
true);
11486 }
11487 }
11488 }
11489 else if (destination_entity && slot_id == -1)
11490 {
11491 if (quantity > stack_max)
11492 split_quantity_new = stack_max;
11493 else
11494 split_quantity_new = quantity;
11495
11497 {
11498 GameInventory destinationInventory = destination_entity.GetInventory();
11500 {
11503 }
11504
11505 if (new_item)
11506 {
11507 new_item.SetResultOfSplit(true);
11508 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11510 new_item.
SetQuantity(split_quantity_new,
false,
true);
11511 }
11512 }
11513 }
11514 else
11515 {
11516 if (stack_max != 0)
11517 {
11519 {
11521 }
11522
11524 {
11526
11527 if (new_item)
11528 {
11529 new_item.SetResultOfSplit(true);
11530 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11533 new_item.PlaceOnSurface();
11534 }
11535 }
11536 }
11537 }
11538 }
11539
11541 {
11543 {
11544 if (ScriptInputUserData.CanStoreInputUserData())
11545 {
11546 ScriptInputUserData ctx = new ScriptInputUserData;
11551 dst.WriteToContext(ctx);
11553 }
11554 }
11555 else if (!
g_Game.IsMultiplayer())
11556 {
11558 }
11559 }
11560
11562 {
11564 {
11565 if (ScriptInputUserData.CanStoreInputUserData())
11566 {
11567 ScriptInputUserData ctx = new ScriptInputUserData;
11572 ctx.
Write(destination_entity);
11578 }
11579 }
11580 else if (!
g_Game.IsMultiplayer())
11581 {
11583 }
11584 }
11585
11587 {
11589 }
11590
11592 {
11594 float split_quantity_new;
11596 if (dst.IsValid())
11597 {
11598 int slot_id = dst.GetSlot();
11600
11601 if (quantity > stack_max)
11602 split_quantity_new = stack_max;
11603 else
11604 split_quantity_new = quantity;
11605
11607 {
11609
11610 if (new_item)
11611 {
11612 new_item.SetResultOfSplit(true);
11613 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11615 new_item.
SetQuantity(split_quantity_new,
false,
true);
11616 }
11617
11618 return new_item;
11619 }
11620 }
11621
11622 return null;
11623 }
11624
11626 {
11628 float split_quantity_new;
11630 if (destination_entity)
11631 {
11633 if (quantity > stackable)
11634 split_quantity_new = stackable;
11635 else
11636 split_quantity_new = quantity;
11637
11639 {
11640 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11641 if (new_item)
11642 {
11643 new_item.SetResultOfSplit(true);
11644 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11646 new_item.
SetQuantity(split_quantity_new,
false,
true);
11647 }
11648 }
11649 }
11650 }
11651
11653 {
11655 {
11656 if (ScriptInputUserData.CanStoreInputUserData())
11657 {
11658 ScriptInputUserData ctx = new ScriptInputUserData;
11663 ItemBase destination_entity =
this;
11664 ctx.
Write(destination_entity);
11668 }
11669 }
11670 else if (!
g_Game.IsMultiplayer())
11671 {
11673 }
11674 }
11675
11677 {
11679 float split_quantity_new;
11681 if (player)
11682 {
11684 if (quantity > stackable)
11685 split_quantity_new = stackable;
11686 else
11687 split_quantity_new = quantity;
11688
11690 {
11691 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11692 new_item =
ItemBase.Cast(in_hands);
11693 if (new_item)
11694 {
11695 new_item.SetResultOfSplit(true);
11696 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11698 new_item.SetQuantity(split_quantity_new, false, true);
11699 }
11700 }
11701 }
11702 }
11703
11705 {
11707 float split_quantity_new = Math.Floor(quantity * 0.5);
11708
11710 return;
11711
11713
11714 if (new_item)
11715 {
11716 if (new_item.GetQuantityMax() < split_quantity_new)
11717 {
11718 split_quantity_new = new_item.GetQuantityMax();
11719 }
11720
11721 new_item.SetResultOfSplit(true);
11722 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11723
11725 {
11728 }
11729 else
11730 {
11732 new_item.
SetQuantity(split_quantity_new,
false,
true);
11733 }
11734 }
11735 }
11736
11738 {
11740 float split_quantity_new = Math.Floor(quantity / 2);
11741
11743 return;
11744
11745 InventoryLocation invloc = new InventoryLocation;
11747
11749 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11750
11751 if (new_item)
11752 {
11753 if (new_item.GetQuantityMax() < split_quantity_new)
11754 {
11755 split_quantity_new = new_item.GetQuantityMax();
11756 }
11758 {
11761 }
11762 else if (split_quantity_new > 1)
11763 {
11765 new_item.
SetQuantity(split_quantity_new,
false,
true);
11766 }
11767 }
11768 }
11769
11772 {
11773 SetWeightDirty();
11775
11776 if (parent)
11777 parent.OnAttachmentQuantityChangedEx(this, delta);
11778
11780 {
11782 {
11784 }
11786 {
11787 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11789 }
11790 }
11791 }
11792
11795 {
11796
11797 }
11798
11801 {
11803 }
11804
11806 {
11807 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11808
11810 {
11811 if (newLevel == GameConstants.STATE_RUINED)
11812 {
11814 EntityAI parent = GetHierarchyParent();
11815 if (parent && parent.IsFireplace())
11816 {
11817 CargoBase cargo = GetInventory().GetCargo();
11818 if (cargo)
11819 {
11821 {
11823 }
11824 }
11825 }
11826 }
11827
11829 {
11830
11832 return;
11833 }
11834
11835 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11836 {
11838 }
11839 }
11840 }
11841
11842
11844 {
11845 super.OnRightClick();
11846
11848 {
11850 {
11851 if (ScriptInputUserData.CanStoreInputUserData())
11852 {
11853 EntityAI root = GetHierarchyRoot();
11854 Man playerOwner = GetHierarchyRootPlayer();
11855 InventoryLocation dst = new InventoryLocation;
11856
11857
11858 if (!playerOwner && root && root == this)
11859 {
11861 }
11862 else
11863 {
11864
11865 GetInventory().GetCurrentInventoryLocation(dst);
11867 {
11868 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11870 {
11872 }
11873 else
11874 {
11876
11877
11878 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11879 {
11881 }
11882 else
11883 {
11884 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11885 }
11886 }
11887 }
11888 }
11889
11890 ScriptInputUserData ctx = new ScriptInputUserData;
11898 }
11899 }
11900 else if (!
g_Game.IsMultiplayer())
11901 {
11903 }
11904 }
11905 }
11906
11908 {
11909 if (root)
11910 {
11911 vector m4[4];
11912 root.GetTransform(m4);
11913 dst.SetGround(this, m4);
11914 }
11915 else
11916 {
11917 GetInventory().GetCurrentInventoryLocation(dst);
11918 }
11919 }
11920
11921 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11922 {
11923
11924 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11925 return false;
11926
11927 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11928 return false;
11929
11930
11932 return false;
11933
11934
11935 Magazine mag = Magazine.Cast(this);
11936 if (mag)
11937 {
11938 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11939 return false;
11940
11941 if (stack_max_limit)
11942 {
11943 Magazine other_mag = Magazine.Cast(other_item);
11944 if (other_item)
11945 {
11946 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11947 return false;
11948 }
11949
11950 }
11951 }
11952 else
11953 {
11954
11956 return false;
11957
11959 return false;
11960 }
11961
11962 PlayerBase player = null;
11963 if (CastTo(player, GetHierarchyRootPlayer()))
11964 {
11965 if (player.GetInventory().HasAttachment(this))
11966 return false;
11967
11968 if (player.IsItemsToDelete())
11969 return false;
11970 }
11971
11972 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11973 return false;
11974
11975 int slotID;
11977 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11978 return false;
11979
11980 return true;
11981 }
11982
11984 {
11986 }
11987
11989 {
11990 return m_IsResultOfSplit;
11991 }
11992
11994 {
11995 m_IsResultOfSplit = value;
11996 }
11997
11999 {
12001 }
12002
12004 {
12005 float other_item_quantity = other_item.GetQuantity();
12006 float this_free_space;
12007
12009
12011
12012 if (other_item_quantity > this_free_space)
12013 {
12014 return this_free_space;
12015 }
12016 else
12017 {
12018 return other_item_quantity;
12019 }
12020 }
12021
12023 {
12025 }
12026
12028 {
12030 return;
12031
12032 if (!IsMagazine() && other_item)
12033 {
12035 if (quantity_used != 0)
12036 {
12037 float hp1 = GetHealth01("","");
12038 float hp2 = other_item.GetHealth01("","");
12039 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12040 hpResult = hpResult / (
GetQuantity() + quantity_used);
12041
12042 hpResult *= GetMaxHealth();
12043 Math.Round(hpResult);
12044 SetHealth("", "Health", hpResult);
12045
12047 other_item.AddQuantity(-quantity_used);
12048 }
12049 }
12051 }
12052
12054 {
12055 #ifdef SERVER
12056 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12057 GetHierarchyParent().IncreaseLifetimeUp();
12058 #endif
12059 };
12060
12062 {
12063 PlayerBase p = PlayerBase.Cast(player);
12064
12065 array<int> recipesIds = p.m_Recipes;
12066 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12067 if (moduleRecipesManager)
12068 {
12069 EntityAI itemInHands = player.GetEntityInHands();
12070 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12071 }
12072
12073 for (int i = 0;i < recipesIds.Count(); i++)
12074 {
12075 int key = recipesIds.Get(i);
12076 string recipeName = moduleRecipesManager.GetRecipeName(key);
12078 }
12079 }
12080
12081
12082 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12083 {
12084 super.GetDebugActions(outputList);
12085
12086
12092
12093
12098
12103
12104
12108
12109
12111 {
12115 }
12116
12119
12120
12124
12126
12127 InventoryLocation loc = new InventoryLocation();
12128 GetInventory().GetCurrentInventoryLocation(loc);
12130 {
12131 if (Gizmo_IsSupported())
12134 }
12135
12137 }
12138
12139
12140
12141
12143 {
12144 super.OnAction(action_id, player, ctx);
12145
12147 {
12148 switch (action_id)
12149 {
12153 return true;
12157 return true;
12158 }
12159 }
12160
12162 {
12163 switch (action_id)
12164 {
12166 Delete();
12167 return true;
12168 }
12169 }
12170
12171 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12172 {
12173 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12174 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12175 PlayerBase p = PlayerBase.Cast(player);
12176 if (
EActions.RECIPES_RANGE_START < 1000)
12177 {
12178 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12179 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12180 }
12181 }
12182 #ifndef SERVER
12183 else if (action_id ==
EActions.WATCH_PLAYER)
12184 {
12185 PluginDeveloper.SetDeveloperItemClientEx(player);
12186 }
12187 #endif
12189 {
12190 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12191 {
12192 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12193 OnDebugButtonPressServer(id + 1);
12194 }
12195
12196 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12197 {
12198 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12200 }
12201
12202 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12203 {
12204 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12206 }
12207
12208 else if (action_id ==
EActions.ADD_QUANTITY)
12209 {
12210 if (IsMagazine())
12211 {
12212 Magazine mag = Magazine.Cast(this);
12213 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12214 }
12215 else
12216 {
12218 }
12219
12220 if (m_EM)
12221 {
12222 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12223 }
12224
12225 }
12226
12227 else if (action_id ==
EActions.REMOVE_QUANTITY)
12228 {
12229 if (IsMagazine())
12230 {
12231 Magazine mag2 = Magazine.Cast(this);
12232 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12233 }
12234 else
12235 {
12237 }
12238 if (m_EM)
12239 {
12240 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12241 }
12242
12243 }
12244
12245 else if (action_id ==
EActions.SET_QUANTITY_0)
12246 {
12248
12249 if (m_EM)
12250 {
12251 m_EM.SetEnergy(0);
12252 }
12253 }
12254
12255 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12256 {
12258
12259 if (m_EM)
12260 {
12261 m_EM.SetEnergy(m_EM.GetEnergyMax());
12262 }
12263 }
12264
12265 else if (action_id ==
EActions.ADD_HEALTH)
12266 {
12267 AddHealth("","",GetMaxHealth("","Health")/5);
12268 }
12269 else if (action_id ==
EActions.REMOVE_HEALTH)
12270 {
12271 AddHealth("","",-GetMaxHealth("","Health")/5);
12272 }
12273 else if (action_id ==
EActions.DESTROY_HEALTH)
12274 {
12275 SetHealth01("","",0);
12276 }
12277 else if (action_id ==
EActions.WATCH_ITEM)
12278 {
12280 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12281 #ifdef DEVELOPER
12282 SetDebugDeveloper_item(this);
12283 #endif
12284 }
12285
12286 else if (action_id ==
EActions.ADD_TEMPERATURE)
12287 {
12288 AddTemperature(20);
12289
12290 }
12291
12292 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12293 {
12294 AddTemperature(-20);
12295
12296 }
12297
12298 else if (action_id ==
EActions.FLIP_FROZEN)
12299 {
12300 SetFrozen(!GetIsFrozen());
12301
12302 }
12303
12304 else if (action_id ==
EActions.ADD_WETNESS)
12305 {
12307
12308 }
12309
12310 else if (action_id ==
EActions.REMOVE_WETNESS)
12311 {
12313
12314 }
12315
12316 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12317 {
12320
12321
12322 }
12323
12324 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12325 {
12328 }
12329
12330 else if (action_id ==
EActions.MAKE_SPECIAL)
12331 {
12332 auto debugParams = DebugSpawnParams.WithPlayer(player);
12333 OnDebugSpawnEx(debugParams);
12334 }
12335
12336 }
12337
12338
12339 return false;
12340 }
12341
12342
12343
12344
12348
12351
12352
12353
12355 {
12356 return false;
12357 }
12358
12359
12361 {
12362 return true;
12363 }
12364
12365
12367 {
12368 return true;
12369 }
12370
12371
12372
12374 {
12375 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12376 return g_Game.ConfigIsExisting(config_path);
12377 }
12378
12381 {
12382 return null;
12383 }
12384
12386 {
12387 return false;
12388 }
12389
12391 {
12392 return false;
12393 }
12394
12398
12399
12401 {
12402 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12403 return module_repairing.CanRepair(this, item_repair_kit);
12404 }
12405
12406
12407 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12408 {
12409 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12410 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12411 }
12412
12413
12415 {
12416
12417
12418
12419
12420
12421
12422
12423
12424 return 1;
12425 }
12426
12427
12428
12430 {
12432 }
12433
12434
12435
12437 {
12439 }
12440
12441
12450 {
12451 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12452
12453 if (player)
12454 {
12455 player.MessageStatus(text);
12456 }
12457 }
12458
12459
12468 {
12469 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12470
12471 if (player)
12472 {
12473 player.MessageAction(text);
12474 }
12475 }
12476
12477
12486 {
12487 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12488
12489 if (player)
12490 {
12491 player.MessageFriendly(text);
12492 }
12493 }
12494
12495
12504 {
12505 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12506
12507 if (player)
12508 {
12509 player.MessageImportant(text);
12510 }
12511 }
12512
12514 {
12515 return true;
12516 }
12517
12518
12519 override bool KindOf(
string tag)
12520 {
12521 bool found = false;
12522 string item_name = this.
GetType();
12524 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12525
12526 int array_size = item_tag_array.Count();
12527 for (int i = 0; i < array_size; i++)
12528 {
12529 if (item_tag_array.Get(i) == tag)
12530 {
12531 found = true;
12532 break;
12533 }
12534 }
12535 return found;
12536 }
12537
12538
12540 {
12541
12542 super.OnRPC(sender, rpc_type,ctx);
12543
12544
12545 switch (rpc_type)
12546 {
12547 #ifndef SERVER
12548 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12549 Param2<bool, string> p = new Param2<bool, string>(false, "");
12550
12552 return;
12553
12554 bool play = p.param1;
12555 string soundSet = p.param2;
12556
12557 if (play)
12558 {
12560 {
12562 {
12564 }
12565 }
12566 else
12567 {
12569 }
12570 }
12571 else
12572 {
12574 }
12575
12576 break;
12577 #endif
12578
12579 }
12580
12582 {
12584 }
12585 }
12586
12587
12588
12589
12591 {
12592 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12593 return plugin.GetID(
name);
12594 }
12595
12597 {
12598 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12599 return plugin.GetName(id);
12600 }
12601
12604 {
12605
12606
12607 int varFlags;
12608 if (!ctx.
Read(varFlags))
12609 return;
12610
12611 if (varFlags & ItemVariableFlags.FLOAT)
12612 {
12614 }
12615 }
12616
12618 {
12619
12620 super.SerializeNumericalVars(floats_out);
12621
12622
12623
12625 {
12627 }
12628
12630 {
12632 }
12633
12635 {
12637 }
12638
12640 {
12645 }
12646
12648 {
12650 }
12651 }
12652
12654 {
12655
12656 super.DeSerializeNumericalVars(floats);
12657
12658
12659 int index = 0;
12660 int mask = Math.Round(floats.Get(index));
12661
12662 index++;
12663
12665 {
12667 {
12669 }
12670 else
12671 {
12672 float quantity = floats.Get(index);
12673 SetQuantity(quantity,
true,
false,
false,
false);
12674 }
12675 index++;
12676 }
12677
12679 {
12680 float wet = floats.Get(index);
12682 index++;
12683 }
12684
12686 {
12687 int liquidtype = Math.Round(floats.Get(index));
12689 index++;
12690 }
12691
12693 {
12695 index++;
12697 index++;
12699 index++;
12701 index++;
12702 }
12703
12705 {
12706 int cleanness = Math.Round(floats.Get(index));
12708 index++;
12709 }
12710 }
12711
12713 {
12714 super.WriteVarsToCTX(ctx);
12715
12716
12718 {
12720 }
12721
12723 {
12725 }
12726
12728 {
12730 }
12731
12733 {
12734 int r,g,b,a;
12740 }
12741
12743 {
12745 }
12746 }
12747
12749 {
12750 if (!super.ReadVarsFromCTX(ctx,version))
12751 return false;
12752
12753 int intValue;
12754 float value;
12755
12756 if (version < 140)
12757 {
12758 if (!ctx.
Read(intValue))
12759 return false;
12760
12761 m_VariablesMask = intValue;
12762 }
12763
12765 {
12766 if (!ctx.
Read(value))
12767 return false;
12768
12770 {
12772 }
12773 else
12774 {
12776 }
12777 }
12778
12779 if (version < 140)
12780 {
12782 {
12783 if (!ctx.
Read(value))
12784 return false;
12785 SetTemperatureDirect(value);
12786 }
12787 }
12788
12790 {
12791 if (!ctx.
Read(value))
12792 return false;
12794 }
12795
12797 {
12798 if (!ctx.
Read(intValue))
12799 return false;
12801 }
12802
12804 {
12805 int r,g,b,a;
12807 return false;
12809 return false;
12811 return false;
12813 return false;
12814
12816 }
12817
12819 {
12820 if (!ctx.
Read(intValue))
12821 return false;
12823 }
12824
12825 if (version >= 138 && version < 140)
12826 {
12828 {
12829 if (!ctx.
Read(intValue))
12830 return false;
12831 SetFrozen(intValue);
12832 }
12833 }
12834
12835 return true;
12836 }
12837
12838
12840 {
12843 {
12845 }
12846
12847 if (!super.OnStoreLoad(ctx, version))
12848 {
12850 return false;
12851 }
12852
12853 if (version >= 114)
12854 {
12855 bool hasQuickBarIndexSaved;
12856
12857 if (!ctx.
Read(hasQuickBarIndexSaved))
12858 {
12860 return false;
12861 }
12862
12863 if (hasQuickBarIndexSaved)
12864 {
12865 int itmQBIndex;
12866
12867
12868 if (!ctx.
Read(itmQBIndex))
12869 {
12871 return false;
12872 }
12873
12874 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12875 if (itmQBIndex != -1 && parentPlayer)
12876 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12877 }
12878 }
12879 else
12880 {
12881
12882 PlayerBase player;
12883 int itemQBIndex;
12884 if (version ==
int.
MAX)
12885 {
12886 if (!ctx.
Read(itemQBIndex))
12887 {
12889 return false;
12890 }
12891 }
12892 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12893 {
12894
12895 if (!ctx.
Read(itemQBIndex))
12896 {
12898 return false;
12899 }
12900 if (itemQBIndex != -1 && player)
12901 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12902 }
12903 }
12904
12905 if (version < 140)
12906 {
12907
12908 if (!LoadVariables(ctx, version))
12909 {
12911 return false;
12912 }
12913 }
12914
12915
12917 {
12919 return false;
12920 }
12921 if (version >= 132)
12922 {
12924 if (raib)
12925 {
12927 {
12929 return false;
12930 }
12931 }
12932 }
12933
12935 return true;
12936 }
12937
12938
12939
12941 {
12942 super.OnStoreSave(ctx);
12943
12944 PlayerBase player;
12945 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12946 {
12948
12949 int itemQBIndex = -1;
12950 itemQBIndex = player.FindQuickBarEntityIndex(this);
12951 ctx.
Write(itemQBIndex);
12952 }
12953 else
12954 {
12956 }
12957
12959
12961 if (raib)
12962 {
12964 }
12965 }
12966
12967
12969 {
12970 super.AfterStoreLoad();
12971
12973 {
12975 }
12976
12978 {
12981 }
12982 }
12983
12985 {
12986 super.EEOnAfterLoad();
12987
12989 {
12991 }
12992
12995 }
12996
12998 {
12999 return false;
13000 }
13001
13002
13003
13005 {
13007 {
13008 #ifdef PLATFORM_CONSOLE
13009
13011 {
13013 if (menu)
13014 {
13016 }
13017 }
13018 #endif
13019 }
13020
13022 {
13025 }
13026
13028 {
13029 SetWeightDirty();
13031 }
13033 {
13036 }
13037
13039 {
13042
13045 }
13047 {
13051 }
13052
13053 super.OnVariablesSynchronized();
13054 }
13055
13056
13057
13059 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13060 {
13061 if (!IsServerCheck(allow_client))
13062 return false;
13063
13065 return false;
13066
13069
13070 if (value <= (min + 0.001))
13071 value = min;
13072
13073 if (value == min)
13074 {
13075 if (destroy_config)
13076 {
13077 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13078 if (dstr)
13079 {
13081 this.Delete();
13082 return true;
13083 }
13084 }
13085 else if (destroy_forced)
13086 {
13088 this.Delete();
13089 return true;
13090 }
13091
13093 }
13094
13097
13099 {
13100 EntityAI parent = GetHierarchyRoot();
13101 InventoryLocation iLoc = new InventoryLocation();
13102 GetInventory().GetCurrentInventoryLocation(iLoc);
13104 {
13105 int iLocSlot = iLoc.
GetSlot();
13107 {
13109 }
13111 {
13113 }
13114 }
13115 }
13116
13118 {
13120
13121 if (delta)
13123 }
13124
13126
13127 return false;
13128 }
13129
13130
13132 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13133 {
13135 }
13136
13138 {
13141 }
13142
13144 {
13147 }
13148
13150 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13151 {
13152 float value_clamped = Math.Clamp(value, 0, 1);
13154 SetQuantity(result, destroy_config, destroy_forced);
13155 }
13156
13157
13160 {
13162 }
13163
13165 {
13167 }
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13179 {
13180 int slot = -1;
13181 GameInventory inventory = GetInventory();
13182 if (inventory)
13183 {
13184 InventoryLocation il = new InventoryLocation;
13187 }
13188
13190 }
13191
13193 {
13194 float quantity_max = 0;
13195
13197 {
13198 if (attSlotID != -1)
13199 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13200
13201 if (quantity_max <= 0)
13203 }
13204
13205 if (quantity_max <= 0)
13207
13208 return quantity_max;
13209 }
13210
13212 {
13214 }
13215
13217 {
13219 }
13220
13221
13223 {
13225 }
13226
13228 {
13230 }
13231
13233 {
13235 }
13236
13237
13239 {
13240
13241 float weightEx = GetWeightEx();
13242 float special = GetInventoryAndCargoWeight();
13243 return weightEx - special;
13244 }
13245
13246
13248 {
13250 }
13251
13253 {
13255 {
13256 #ifdef DEVELOPER
13257 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13258 {
13259 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13261 }
13262 #endif
13263
13264 return GetQuantity() * GetConfigWeightModified();
13265 }
13266 else if (HasEnergyManager())
13267 {
13268 #ifdef DEVELOPER
13269 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13270 {
13271 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13272 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13273 }
13274 #endif
13275 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13276 }
13277 else
13278 {
13279 #ifdef DEVELOPER
13280 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13281 {
13282 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13283 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13284 }
13285 #endif
13286 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13287 }
13288 }
13289
13292 {
13293 int item_count = 0;
13295
13296 GameInventory inventory = GetInventory();
13297 CargoBase cargo = inventory.
GetCargo();
13298 if (cargo != NULL)
13299 {
13301 }
13302
13304 for (int i = 0; i < nAttachments; ++i)
13305 {
13307 if (item)
13308 item_count += item.GetNumberOfItems();
13309 }
13310 return item_count;
13311 }
13312
13315 {
13316 float weight = 0;
13317 float wetness = 1;
13318 if (include_wetness)
13321 {
13322 weight = wetness * m_ConfigWeight;
13323 }
13325 {
13326 weight = 1;
13327 }
13328 return weight;
13329 }
13330
13331
13332
13334 {
13335 GameInventory inventory = GetInventory();
13336 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13337 {
13338 array<EntityAI> items = new array<EntityAI>;
13340 for (int i = 0; i < items.Count(); ++i)
13341 {
13343 if (item)
13344 {
13345 g_Game.ObjectDelete(item);
13346 }
13347 }
13348 }
13349 }
13350
13351
13352
13353
13355 {
13356 float energy = 0;
13357 if (HasEnergyManager())
13358 {
13359 energy = GetCompEM().GetEnergy();
13360 }
13361 return energy;
13362 }
13363
13364
13366 {
13367 super.OnEnergyConsumed();
13368
13370 }
13371
13373 {
13374 super.OnEnergyAdded();
13375
13377 }
13378
13379
13381 {
13382 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13383 {
13385 {
13386 float energy_0to1 = GetCompEM().GetEnergy0To1();
13388 }
13389 }
13390 }
13391
13392
13394 {
13395 return ConfigGetFloat("heatIsolation");
13396 }
13397
13399 {
13401 }
13402
13404 {
13405 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13406 if (
g_Game.ConfigIsExisting(paramPath))
13407 return g_Game.ConfigGetFloat(paramPath);
13408
13409 return 0.0;
13410 }
13411
13413 {
13414 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13415 if (
g_Game.ConfigIsExisting(paramPath))
13416 return g_Game.ConfigGetFloat(paramPath);
13417
13418 return 0.0;
13419 }
13420
13421 override void SetWet(
float value,
bool allow_client =
false)
13422 {
13423 if (!IsServerCheck(allow_client))
13424 return;
13425
13428
13430
13431 m_VarWet = Math.Clamp(value, min, max);
13432
13434 {
13437 }
13438 }
13439
13440 override void AddWet(
float value)
13441 {
13443 }
13444
13446 {
13448 }
13449
13451 {
13453 }
13454
13456 {
13458 }
13459
13461 {
13463 }
13464
13466 {
13468 }
13469
13470 override void OnWetChanged(
float newVal,
float oldVal)
13471 {
13474 if (newLevel != oldLevel)
13475 {
13477 }
13478 }
13479
13481 {
13482 SetWeightDirty();
13483 }
13484
13486 {
13487 return GetWetLevelInternal(
m_VarWet);
13488 }
13489
13490
13491
13493 {
13495 }
13496
13498 {
13500 }
13501
13503 {
13505 }
13506
13508 {
13510 }
13511
13512
13513
13515 {
13516 if (ConfigIsExisting("itemModelLength"))
13517 {
13518 return ConfigGetFloat("itemModelLength");
13519 }
13520 return 0;
13521 }
13522
13524 {
13525 if (ConfigIsExisting("itemAttachOffset"))
13526 {
13527 return ConfigGetFloat("itemAttachOffset");
13528 }
13529 return 0;
13530 }
13531
13532 override void SetCleanness(
int value,
bool allow_client =
false)
13533 {
13534 if (!IsServerCheck(allow_client))
13535 return;
13536
13538
13540
13543 }
13544
13546 {
13548 }
13549
13551 {
13552 return true;
13553 }
13554
13555
13556
13557
13559 {
13561 }
13562
13564 {
13566 }
13567
13568
13569
13570
13571 override void SetColor(
int r,
int g,
int b,
int a)
13572 {
13578 }
13580 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13581 {
13586 }
13587
13589 {
13591 }
13592
13595 {
13596 int r,g,b,a;
13598 r = r/255;
13599 g = g/255;
13600 b = b/255;
13601 a = a/255;
13602 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13603 }
13604
13605
13606
13607 override void SetLiquidType(
int value,
bool allow_client =
false)
13608 {
13609 if (!IsServerCheck(allow_client))
13610 return;
13611
13616 }
13617
13619 {
13620 return ConfigGetInt("varLiquidTypeInit");
13621 }
13622
13624 {
13626 }
13627
13629 {
13631 SetFrozen(false);
13632 }
13633
13636 {
13637 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13638 }
13639
13640
13643 {
13644 PlayerBase nplayer;
13645 if (PlayerBase.CastTo(nplayer, player))
13646 {
13648 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13649 }
13650 }
13651
13652
13655 {
13656 PlayerBase nplayer;
13657 if (PlayerBase.CastTo(nplayer,player))
13658 {
13659 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13660 }
13661
13662 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13663
13664 if (HasEnergyManager())
13665 {
13666 GetCompEM().UpdatePlugState();
13667 }
13668 }
13669
13670
13672 {
13673 super.OnPlacementStarted(player);
13674
13676 }
13677
13678 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13679 {
13681 {
13682 m_AdminLog.OnPlacementComplete(player,
this);
13683 }
13684
13685 super.OnPlacementComplete(player, position, orientation);
13686 }
13687
13688
13689
13690
13691
13693 {
13695 {
13696 return true;
13697 }
13698 else
13699 {
13700 return false;
13701 }
13702 }
13703
13704
13706 {
13708 {
13710 }
13711 }
13712
13713
13715 {
13717 }
13718
13720 {
13722 }
13723
13724 override void InsertAgent(
int agent,
float count = 1)
13725 {
13726 if (count < 1)
13727 return;
13728
13730 }
13731
13734 {
13736 }
13737
13738
13740 {
13742 }
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13786 {
13788 return false;
13789 return true;
13790 }
13791
13793 {
13794
13796 }
13797
13798
13801 {
13802 super.CheckForRoofLimited(timeTresholdMS);
13803
13804 float time =
g_Game.GetTime();
13805 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13806 {
13807 m_PreviousRoofTestTime = time;
13808 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13809 }
13810 }
13811
13812
13814 {
13816 {
13817 return 0;
13818 }
13819
13820 if (GetInventory().GetAttachmentSlotsCount() != 0)
13821 {
13822 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13823 if (filter)
13824 return filter.GetProtectionLevel(type, false, system);
13825 else
13826 return 0;
13827 }
13828
13829 string subclassPath, entryName;
13830
13831 switch (type)
13832 {
13834 entryName = "biological";
13835 break;
13837 entryName = "chemical";
13838 break;
13839 default:
13840 entryName = "biological";
13841 break;
13842 }
13843
13844 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13845
13846 return g_Game.ConfigGetFloat(subclassPath + entryName);
13847 }
13848
13849
13850
13853 {
13854 if (!IsMagazine())
13856
13858 }
13859
13860
13861
13862
13863
13868 {
13869 return true;
13870 }
13871
13873 {
13875 }
13876
13877
13878
13879
13880
13882 {
13883 if (parent)
13884 {
13885 if (parent.IsInherited(DayZInfected))
13886 return true;
13887
13888 if (!parent.IsRuined())
13889 return true;
13890 }
13891
13892 return true;
13893 }
13894
13896 {
13897 if (!super.CanPutAsAttachment(parent))
13898 {
13899 return false;
13900 }
13901
13902 if (!IsRuined() && !parent.IsRuined())
13903 {
13904 return true;
13905 }
13906
13907 return false;
13908 }
13909
13911 {
13912
13913
13914
13915
13916 return super.CanReceiveItemIntoCargo(item);
13917 }
13918
13920 {
13921
13922
13923
13924
13925 GameInventory attachmentInv = attachment.GetInventory();
13927 {
13928 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13929 return false;
13930 }
13931
13932 InventoryLocation loc = new InventoryLocation();
13933 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13934 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13935 return false;
13936
13937 return super.CanReceiveAttachment(attachment, slotId);
13938 }
13939
13941 {
13942 if (!super.CanReleaseAttachment(attachment))
13943 return false;
13944
13945 return GetInventory().AreChildrenAccessible();
13946 }
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13969 {
13970 int id = muzzle_owner.GetMuzzleID();
13971 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13972
13973 if (WPOF_array)
13974 {
13975 for (int i = 0; i < WPOF_array.Count(); i++)
13976 {
13977 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13978
13979 if (WPOF)
13980 {
13981 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13982 }
13983 }
13984 }
13985 }
13986
13987
13989 {
13990 int id = muzzle_owner.GetMuzzleID();
13992
13993 if (WPOBE_array)
13994 {
13995 for (int i = 0; i < WPOBE_array.Count(); i++)
13996 {
13997 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13998
13999 if (WPOBE)
14000 {
14001 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14002 }
14003 }
14004 }
14005 }
14006
14007
14009 {
14010 int id = muzzle_owner.GetMuzzleID();
14011 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14012
14013 if (WPOOH_array)
14014 {
14015 for (int i = 0; i < WPOOH_array.Count(); i++)
14016 {
14017 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14018
14019 if (WPOOH)
14020 {
14021 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14022 }
14023 }
14024 }
14025 }
14026
14027
14029 {
14030 int id = muzzle_owner.GetMuzzleID();
14031 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14032
14033 if (WPOOH_array)
14034 {
14035 for (int i = 0; i < WPOOH_array.Count(); i++)
14036 {
14037 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14038
14039 if (WPOOH)
14040 {
14041 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14042 }
14043 }
14044 }
14045 }
14046
14047
14049 {
14050 int id = muzzle_owner.GetMuzzleID();
14051 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14052
14053 if (WPOOH_array)
14054 {
14055 for (int i = 0; i < WPOOH_array.Count(); i++)
14056 {
14057 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14058
14059 if (WPOOH)
14060 {
14061 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14062 }
14063 }
14064 }
14065 }
14066
14067
14068
14070 {
14072 {
14073 return true;
14074 }
14075
14076 return false;
14077 }
14078
14080 {
14082 {
14083 return true;
14084 }
14085
14086 return false;
14087 }
14088
14090 {
14092 {
14093 return true;
14094 }
14095
14096 return false;
14097 }
14098
14100 {
14101 return false;
14102 }
14103
14106 {
14107 return UATimeSpent.DEFAULT_DEPLOY;
14108 }
14109
14110
14111
14112
14114 {
14116 SetSynchDirty();
14117 }
14118
14120 {
14122 }
14123
14124
14126 {
14127 return false;
14128 }
14129
14132 {
14133 string att_type = "None";
14134
14135 if (ConfigIsExisting("soundAttType"))
14136 {
14137 att_type = ConfigGetString("soundAttType");
14138 }
14139
14141 }
14142
14144 {
14146 }
14147
14148
14149
14150
14151
14157
14159 {
14162
14164 }
14165
14166
14168 {
14170 return;
14171
14173
14176
14179
14180 SoundParameters params = new SoundParameters();
14184 }
14185
14186
14188 {
14190 {
14193
14194 SetSynchDirty();
14195
14198 }
14199 }
14200
14202 {
14204 }
14205
14206
14208 {
14210 return;
14211
14213 SetSynchDirty();
14214
14217 }
14218
14220 {
14223 }
14224
14226 {
14228 }
14229
14230 void OnApply(PlayerBase player);
14231
14233 {
14234 return 1.0;
14235 };
14236
14238 {
14240 }
14241
14243 {
14245 }
14246
14248
14250 {
14251 SetDynamicPhysicsLifeTime(0.01);
14253 }
14254
14256 {
14257 array<string> zone_names = new array<string>;
14258 GetDamageZones(zone_names);
14259 for (int i = 0; i < zone_names.Count(); i++)
14260 {
14261 SetHealthMax(zone_names.Get(i),"Health");
14262 }
14263 SetHealthMax("","Health");
14264 }
14265
14268 {
14269 float global_health = GetHealth01("","Health");
14270 array<string> zones = new array<string>;
14271 GetDamageZones(zones);
14272
14273 for (int i = 0; i < zones.Count(); i++)
14274 {
14275 SetHealth01(zones.Get(i),"Health",global_health);
14276 }
14277 }
14278
14281 {
14282 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14283 }
14284
14286 {
14287 if (!hasRootAsPlayer)
14288 {
14289 if (refParentIB)
14290 {
14291
14292 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14293 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14294
14295 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14296 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14297
14300 }
14301 else
14302 {
14303
14306 }
14307 }
14308 }
14309
14311 {
14313 {
14314 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14315 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14316 {
14317 float heatPermCoef = 1.0;
14319 while (ent)
14320 {
14321 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14322 ent = ent.GetHierarchyParent();
14323 }
14324
14325 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14326 }
14327 }
14328 }
14329
14331 {
14332
14333 EntityAI parent = GetHierarchyParent();
14334 if (!parent)
14335 {
14336 hasParent = false;
14337 hasRootAsPlayer = false;
14338 }
14339 else
14340 {
14341 hasParent = true;
14342 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14343 refParentIB =
ItemBase.Cast(parent);
14344 }
14345 }
14346
14347 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14348 {
14349
14350 }
14351
14353 {
14354
14355 return false;
14356 }
14357
14359 {
14360
14361
14362 return false;
14363 }
14364
14366 {
14367
14368 return false;
14369 }
14370
14373 {
14374 return !GetIsFrozen() &&
IsOpen();
14375 }
14376
14378 {
14379 bool hasParent = false, hasRootAsPlayer = false;
14381
14382 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14383 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14384
14385 if (wwtu || foodDecay)
14386 {
14390
14391 if (processWetness || processTemperature || processDecay)
14392 {
14394
14395 if (processWetness)
14396 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14397
14398 if (processTemperature)
14400
14401 if (processDecay)
14402 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14403 }
14404 }
14405 }
14406
14409 {
14411 }
14412
14414 {
14417
14418 return super.GetTemperatureFreezeThreshold();
14419 }
14420
14422 {
14425
14426 return super.GetTemperatureThawThreshold();
14427 }
14428
14430 {
14433
14434 return super.GetItemOverheatThreshold();
14435 }
14436
14438 {
14440 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14441
14442 return super.GetTemperatureFreezeTime();
14443 }
14444
14446 {
14448 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14449
14450 return super.GetTemperatureThawTime();
14451 }
14452
14457
14459 {
14460 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14461 }
14462
14464 {
14465 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14466 }
14467
14470 {
14472 }
14473
14475 {
14477 }
14478
14480 {
14482 }
14483
14486 {
14487 return null;
14488 }
14489
14492 {
14493 return false;
14494 }
14495
14497 {
14499 {
14502 if (!trg)
14503 {
14505 explosive = this;
14506 }
14507
14508 explosive.PairRemote(trg);
14510
14511 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14512 trg.SetPersistentPairID(persistentID);
14513 explosive.SetPersistentPairID(persistentID);
14514
14515 return true;
14516 }
14517 return false;
14518 }
14519
14522 {
14523 float ret = 1.0;
14526 ret *= GetHealth01();
14527
14528 return ret;
14529 }
14530
14531 #ifdef DEVELOPER
14532 override void SetDebugItem()
14533 {
14534 super.SetDebugItem();
14535 _itemBase = this;
14536 }
14537
14539 {
14540 string text = super.GetDebugText();
14541
14543 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14544
14545 return text;
14546 }
14547 #endif
14548
14550 {
14551 return true;
14552 }
14553
14555
14557
14559 {
14562 }
14563
14564
14572
14588
14589 [
Obsolete(
"Use ItemSoundHandler instead")]
14592 {
14593 if (!
g_Game.IsDedicatedServer())
14594 {
14595 if (ConfigIsExisting("attachSoundSet"))
14596 {
14597 string cfg_path = "";
14598 string soundset = "";
14599 string type_name =
GetType();
14600
14603 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14604 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14605
14606 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14607 {
14608 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14609 {
14610 if (cfg_slot_array[i] == slot_type)
14611 {
14612 soundset = cfg_soundset_array[i];
14613 break;
14614 }
14615 }
14616 }
14617
14618 if (soundset != "")
14619 {
14620 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14622 }
14623 }
14624 }
14625 }
14626
14628}
14629
14631{
14633 if (entity)
14634 {
14635 bool is_item = entity.IsInherited(
ItemBase);
14636 if (is_item && full_quantity)
14637 {
14640 }
14641 }
14642 else
14643 {
14645 return NULL;
14646 }
14647 return entity;
14648}
14649
14651{
14652 if (item)
14653 {
14654 if (health > 0)
14655 item.SetHealth("", "", health);
14656
14657 if (item.CanHaveTemperature())
14658 {
14660 if (item.CanFreeze())
14661 item.SetFrozen(false);
14662 }
14663
14664 if (item.HasEnergyManager())
14665 {
14666 if (quantity >= 0)
14667 {
14668 item.GetCompEM().SetEnergy0To1(quantity);
14669 }
14670 else
14671 {
14673 }
14674 }
14675 else if (item.IsMagazine())
14676 {
14677 Magazine mag = Magazine.Cast(item);
14678 if (quantity >= 0)
14679 {
14680 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14681 }
14682 else
14683 {
14685 }
14686
14687 }
14688 else
14689 {
14690 if (quantity >= 0)
14691 {
14692 item.SetQuantityNormalized(quantity, false);
14693 }
14694 else
14695 {
14697 }
14698
14699 }
14700 }
14701}
14702
14703#ifdef DEVELOPER
14705#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.