9697{
9699 {
9700 return true;
9701 }
9702};
9703
9705{
9706
9707};
9708
9709
9710
9712{
9716
9718
9721
9722
9723
9724
9725
9734
9740
9745
9750
9771 protected bool m_IsResultOfSplit
9772
9774
9779
9780
9781
9783
9787
9788
9789
9791
9794
9795
9796
9802
9803
9811
9814
9815
9817
9818
9820
9821
9826
9827
9832
9834
9835
9837
9838
9840 {
9845
9846 if (!
g_Game.IsDedicatedServer())
9847 {
9849 {
9851
9853 {
9855 }
9856 }
9857
9860 }
9861
9862 m_OldLocation = null;
9863
9865 {
9867 }
9868
9869 if (ConfigIsExisting("headSelectionsToHide"))
9870 {
9873 }
9874
9876 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9877 {
9879 }
9880
9882
9883 m_IsResultOfSplit = false;
9884
9886 }
9887
9889 {
9890 super.InitItemVariables();
9891
9897 m_Count = ConfigGetInt(
"count");
9898
9901
9906
9909
9914
9926
9930
9931
9934 if (ConfigIsExisting("canBeSplit"))
9935 {
9938 }
9939
9941 if (ConfigIsExisting("itemBehaviour"))
9943
9944
9947 RegisterNetSyncVariableInt("m_VarLiquidType");
9948 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9949
9950 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9951 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9952 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9953
9954 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9955 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9956 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9957 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9958
9959 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9960 RegisterNetSyncVariableBool("m_IsTakeable");
9961 RegisterNetSyncVariableBool("m_IsHologram");
9962
9965 {
9968 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9969 }
9970
9972
9974 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9976
9978 }
9979
9981 {
9983 }
9984
9986 {
9989 {
9994 }
9995 }
9996
9997 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9998 {
10000 {
10003 }
10004
10006 }
10007
10009 {
10015 }
10016
10018
10020 {
10022
10023 if (!action)
10024 {
10025 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10026 return;
10027 }
10028
10030 if (!ai)
10031 {
10033 return;
10034 }
10035
10037 if (!action_array)
10038 {
10039 action_array = new array<ActionBase_Basic>;
10041 }
10042 if (LogManager.IsActionLogEnable())
10043 {
10044 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10045 }
10046
10047 if (action_array.Find(action) != -1)
10048 {
10049 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10050 }
10051 else
10052 {
10053 action_array.Insert(action);
10054 }
10055 }
10056
10058 {
10059 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10060 ActionBase action = player.GetActionManager().GetAction(actionName);
10063
10064 if (action_array)
10065 {
10066 action_array.RemoveItem(action);
10067 }
10068 }
10069
10070
10071
10073 {
10074 ActionOverrideData overrideData = new ActionOverrideData();
10078
10080 if (!actionMap)
10081 {
10084 }
10085
10086 actionMap.Insert(this.
Type(), overrideData);
10087
10088 }
10089
10091
10093
10094
10096 {
10099
10102
10103 string config_to_search = "CfgVehicles";
10104 string muzzle_owner_config;
10105
10107 {
10108 if (IsInherited(Weapon))
10109 config_to_search = "CfgWeapons";
10110
10111 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10112
10113 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10114
10115 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10116
10117 if (config_OnFire_subclass_count > 0)
10118 {
10119 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10120
10121 for (int i = 0; i < config_OnFire_subclass_count; i++)
10122 {
10123 string particle_class = "";
10124 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10125 string config_OnFire_entry = config_OnFire_class + particle_class;
10126 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10127 WPOF_array.Insert(WPOF);
10128 }
10129
10130
10132 }
10133 }
10134
10136 {
10137 config_to_search = "CfgWeapons";
10138 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10139
10140 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10141
10142 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10143
10144 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10145 {
10146 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10147
10148 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10149 {
10150 string particle_class2 = "";
10151 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10152 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10153 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10154 WPOBE_array.Insert(WPOBE);
10155 }
10156
10157
10159 }
10160 }
10161 }
10162
10163
10165 {
10168
10170 {
10171 string config_to_search = "CfgVehicles";
10172
10173 if (IsInherited(Weapon))
10174 config_to_search = "CfgWeapons";
10175
10176 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10177 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10178
10179 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10180 {
10181
10183
10185 {
10187 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10189 return;
10190 }
10191
10194
10195
10196
10197 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10198 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10199
10200 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10201 {
10202 string particle_class = "";
10203 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10204 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10205 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10206
10207 if (entry_type == CT_CLASS)
10208 {
10209 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10210 WPOOH_array.Insert(WPOF);
10211 }
10212 }
10213
10214
10216 }
10217 }
10218 }
10219
10221 {
10223 }
10224
10226 {
10228 {
10230
10233
10236
10237 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10238 }
10239 }
10240
10242 {
10244 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10245
10247 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10248
10250 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10251
10253 {
10255 }
10256 }
10257
10259 {
10261 }
10262
10264 {
10267 else
10269
10271 {
10274 }
10275 else
10276 {
10279
10282 }
10283
10285 }
10286
10288 {
10290 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10291 }
10292
10294 {
10296 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10298 }
10299
10301 {
10303 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10304 }
10305
10307 {
10310
10311 OverheatingParticle OP = new OverheatingParticle();
10316
10318 }
10319
10321 {
10324
10325 return -1;
10326 }
10327
10329 {
10331 {
10334
10335 for (int i = count; i > 0; --i)
10336 {
10337 int id = i - 1;
10340
10343
10344 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10345 {
10346 if (p)
10347 {
10350 }
10351 }
10352 }
10353 }
10354 }
10355
10357 {
10359 {
10361 {
10362 int id = i - 1;
10364
10365 if (OP)
10366 {
10368
10369 if (p)
10370 {
10372 }
10373
10374 delete OP;
10375 }
10376 }
10377
10380 }
10381 }
10382
10385 {
10386 return 0.0;
10387 }
10388
10389
10391 {
10392 return 250;
10393 }
10394
10396 {
10397 return 0;
10398 }
10399
10402 {
10404 return true;
10405
10406 return false;
10407 }
10408
10411 {
10414
10416 {
10418 }
10419 else
10420 {
10421
10423 }
10424
10426 }
10427
10434 {
10435 return -1;
10436 }
10437
10438
10439
10440
10442 {
10444 {
10445 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10446 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10447
10448 if (r_index >= 0)
10449 {
10450 InventoryLocation r_il = new InventoryLocation;
10451 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10452
10453 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10456 {
10457 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10458 }
10460 {
10461 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10462 }
10463
10464 }
10465
10466 player.GetHumanInventory().ClearUserReservedLocation(this);
10467 }
10468
10471 }
10472
10473
10474
10475
10477 {
10478 return ItemBase.m_DebugActionsMask;
10479 }
10480
10482 {
10483 return ItemBase.m_DebugActionsMask & mask;
10484 }
10485
10487 {
10488 ItemBase.m_DebugActionsMask = mask;
10489 }
10490
10492 {
10493 ItemBase.m_DebugActionsMask |= mask;
10494 }
10495
10497 {
10498 ItemBase.m_DebugActionsMask &= ~mask;
10499 }
10500
10502 {
10504 {
10506 }
10507 else
10508 {
10510 }
10511 }
10512
10513
10515 {
10516 if (GetEconomyProfile())
10517 {
10518 float q_max = GetEconomyProfile().GetQuantityMax();
10519 if (q_max > 0)
10520 {
10521 float q_min = GetEconomyProfile().GetQuantityMin();
10522 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10523
10525 {
10526 ComponentEnergyManager comp = GetCompEM();
10528 {
10530 }
10531 }
10533 {
10535
10536 }
10537
10538 }
10539 }
10540 }
10541
10544 {
10545 EntityAI parent = GetHierarchyParent();
10546
10547 if (parent)
10548 {
10549 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10550 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10551 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10552 }
10553 }
10554
10557 {
10558 EntityAI parent = GetHierarchyParent();
10559
10560 if (parent)
10561 {
10562 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10563 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10564 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10565 }
10566 }
10567
10569 {
10570
10571
10572
10573
10575
10577 {
10578 if (ScriptInputUserData.CanStoreInputUserData())
10579 {
10580 ScriptInputUserData ctx = new ScriptInputUserData;
10586 ctx.
Write(use_stack_max);
10589
10591 {
10592 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10593 }
10594 }
10595 }
10596 else if (!
g_Game.IsMultiplayer())
10597 {
10599 }
10600 }
10601
10603 {
10605 }
10606
10608 {
10610 }
10611
10613 {
10615 }
10616
10618 {
10619
10620 return false;
10621 }
10622
10624 {
10625 return false;
10626 }
10627
10631 {
10632 return false;
10633 }
10634
10636 {
10637 return "";
10638 }
10639
10641
10643 {
10644 return false;
10645 }
10646
10648 {
10649 return true;
10650 }
10651
10652
10653
10655 {
10656 return true;
10657 }
10658
10660 {
10661 return true;
10662 }
10663
10665 {
10666 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10668 }
10669
10671 {
10673 }
10674
10676 {
10678 if (!is_being_placed)
10680 SetSynchDirty();
10681 }
10682
10683
10685
10687 {
10689 }
10690
10692 {
10694 }
10695
10697 {
10698 return 1;
10699 }
10700
10702 {
10703 return false;
10704 }
10705
10707 {
10709 SetSynchDirty();
10710 }
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10747 {
10748 super.OnMovedInsideCargo(container);
10749
10750 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10751 }
10752
10753 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10754 {
10755 super.EEItemLocationChanged(oldLoc, newLoc);
10756
10757 PlayerBase newPlayer = null;
10758 PlayerBase oldPlayer = null;
10759
10760 if (newLoc.GetParent())
10761 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10762
10763 if (oldLoc.GetParent())
10764 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10765
10767 {
10768 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10769
10770 if (rIndex >= 0)
10771 {
10772 InventoryLocation rIl = new InventoryLocation;
10773 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10774
10775 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10778 {
10779 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10780 }
10782 {
10784 }
10785
10786 }
10787 }
10788
10790 {
10791 if (newPlayer)
10792 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10793
10794 if (newPlayer == oldPlayer)
10795 {
10796 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10797 {
10799 {
10800 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10801 {
10802 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10803 }
10804 }
10805 else
10806 {
10807 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10808 }
10809 }
10810
10811 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10812 {
10813 int type = oldLoc.GetType();
10815 {
10816 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10817 }
10819 {
10820 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10821 }
10822 }
10823 if (!m_OldLocation)
10824 {
10825 m_OldLocation = new InventoryLocation;
10826 }
10827 m_OldLocation.Copy(oldLoc);
10828 }
10829 else
10830 {
10831 if (m_OldLocation)
10832 {
10833 m_OldLocation.Reset();
10834 }
10835 }
10836
10837 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10838 }
10839 else
10840 {
10841 if (newPlayer)
10842 {
10843 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10844 if (resIndex >= 0)
10845 {
10846 InventoryLocation il = new InventoryLocation;
10847 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10849 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10852 {
10853 il.
GetParent().GetOnReleaseLock().Invoke(it);
10854 }
10856 {
10858 }
10859
10860 }
10861 }
10863 {
10864
10866 }
10867
10868 if (m_OldLocation)
10869 {
10870 m_OldLocation.Reset();
10871 }
10872 }
10873
10875 {
10876 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10877 }
10878
10880 {
10881 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10882 }
10883 }
10884
10885 override void EOnContact(IEntity other, Contact extra)
10886 {
10888 {
10889 int liquidType = -1;
10891 if (impactSpeed > 0.0)
10892 {
10894 #ifndef SERVER
10896 #else
10898 SetSynchDirty();
10899 #endif
10901 }
10902 }
10903
10904 #ifdef SERVER
10905 if (GetCompEM() && GetCompEM().IsPlugged())
10906 {
10907 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10908 GetCompEM().UnplugThis();
10909 }
10910 #endif
10911 }
10912
10914
10916 {
10918 }
10919
10921 {
10922
10923 }
10924
10926 {
10927 super.OnItemLocationChanged(old_owner, new_owner);
10928
10929 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10930 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10931
10932 if (!relatedPlayer && playerNew)
10933 relatedPlayer = playerNew;
10934
10935 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10936 {
10938 if (actionMgr)
10939 {
10940 ActionBase currentAction = actionMgr.GetRunningAction();
10941 if (currentAction)
10943 }
10944 }
10945
10946 Man ownerPlayerOld = null;
10947 Man ownerPlayerNew = null;
10948
10949 if (old_owner)
10950 {
10951 if (old_owner.
IsMan())
10952 {
10953 ownerPlayerOld = Man.Cast(old_owner);
10954 }
10955 else
10956 {
10957 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10958 }
10959 }
10960 else
10961 {
10963 {
10965
10966 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10967 {
10968 GetCompEM().UnplugThis();
10969 }
10970 }
10971 }
10972
10973 if (new_owner)
10974 {
10975 if (new_owner.
IsMan())
10976 {
10977 ownerPlayerNew = Man.Cast(new_owner);
10978 }
10979 else
10980 {
10981 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10982 }
10983 }
10984
10985 if (ownerPlayerOld != ownerPlayerNew)
10986 {
10987 if (ownerPlayerOld)
10988 {
10989 array<EntityAI> subItemsExit = new array<EntityAI>;
10991 for (int i = 0; i < subItemsExit.Count(); i++)
10992 {
10995 }
10996 }
10997
10998 if (ownerPlayerNew)
10999 {
11000 array<EntityAI> subItemsEnter = new array<EntityAI>;
11002 for (int j = 0; j < subItemsEnter.Count(); j++)
11003 {
11006 }
11007 }
11008 }
11009 else if (ownerPlayerNew != null)
11010 {
11011 PlayerBase nplayer;
11012 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11013 {
11014 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11016 for (int k = 0; k < subItemsUpdate.Count(); k++)
11017 {
11019 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11020 }
11021 }
11022 }
11023
11024 if (old_owner)
11025 old_owner.OnChildItemRemoved(this);
11026 if (new_owner)
11027 new_owner.OnChildItemReceived(this);
11028 }
11029
11030
11032 {
11033 super.EEDelete(parent);
11034 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11035 if (player)
11036 {
11038
11039 if (player.IsAlive())
11040 {
11041 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11042 if (r_index >= 0)
11043 {
11044 InventoryLocation r_il = new InventoryLocation;
11045 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11046
11047 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11050 {
11051 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11052 }
11054 {
11055 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11056 }
11057
11058 }
11059
11060 player.RemoveQuickBarEntityShortcut(this);
11061 }
11062 }
11063 }
11064
11066 {
11067 super.EEKilled(killer);
11068
11071 {
11072 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11073 {
11074 if (IsMagazine())
11075 {
11076 if (Magazine.Cast(this).GetAmmoCount() > 0)
11077 {
11079 }
11080 }
11081 else
11082 {
11084 }
11085 }
11086 }
11087 }
11088
11090 {
11091 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11092
11093 super.OnWasAttached(parent, slot_id);
11094
11097
11100 }
11101
11103 {
11104 super.OnWasDetached(parent, slot_id);
11105
11108
11111 }
11112
11114 {
11115 int idx;
11118
11119 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11120 if (inventory_slots.Count() < 1)
11121 {
11122 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11123 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11124 }
11125 else
11126 {
11127 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11128 }
11129
11130 idx = inventory_slots.Find(slot);
11131 if (idx < 0)
11132 return "";
11133
11134 return attach_types.Get(idx);
11135 }
11136
11138 {
11139 int idx = -1;
11140 string slot;
11141
11144
11145 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11146 if (inventory_slots.Count() < 1)
11147 {
11148 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11149 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11150 }
11151 else
11152 {
11153 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11154 if (detach_types.Count() < 1)
11155 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11156 }
11157
11158 for (int i = 0; i < inventory_slots.Count(); i++)
11159 {
11160 slot = inventory_slots.Get(i);
11161 }
11162
11163 if (slot != "")
11164 {
11165 if (detach_types.Count() == 1)
11166 idx = 0;
11167 else
11168 idx = inventory_slots.Find(slot);
11169 }
11170 if (idx < 0)
11171 return "";
11172
11173 return detach_types.Get(idx);
11174 }
11175
11177 {
11178
11180
11181
11182 float min_time = 1;
11183 float max_time = 3;
11184 float delay = Math.RandomFloat(min_time, max_time);
11185
11186 explode_timer.Run(delay, this, "DoAmmoExplosion");
11187 }
11188
11190 {
11191 Magazine magazine = Magazine.Cast(this);
11192 int pop_sounds_count = 6;
11193 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11194
11195
11196 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11197 string sound_name = pop_sounds[ sound_idx ];
11198 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11199
11200
11201 magazine.ServerAddAmmoCount(-1);
11202
11203
11204 float min_temp_to_explode = 100;
11205
11206 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11207 {
11209 }
11210 }
11211
11212
11213 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11214 {
11215 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11216
11217 const int CHANCE_DAMAGE_CARGO = 4;
11218 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11219 const int CHANCE_DAMAGE_NOTHING = 2;
11220
11222 {
11223 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11224 int chances;
11225 int rnd;
11226
11227 if (GetInventory().GetCargo())
11228 {
11229 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11230 rnd = Math.RandomInt(0,chances);
11231
11232 if (rnd < CHANCE_DAMAGE_CARGO)
11233 {
11235 }
11236 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11237 {
11239 }
11240 }
11241 else
11242 {
11243 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11244 rnd = Math.RandomInt(0,chances);
11245
11246 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11247 {
11249 }
11250 }
11251 }
11252 }
11253
11255 {
11256 CargoBase cargo = GetInventory().GetCargo();
11257 if (cargo)
11258 {
11260 if (item_count > 0)
11261 {
11262 int random_pick = Math.RandomInt(0, item_count);
11264 if (!item.IsExplosive())
11265 {
11266 item.AddHealth("","",damage);
11267 return true;
11268 }
11269 }
11270 }
11271 return false;
11272 }
11273
11275 {
11276 GameInventory inventory = GetInventory();
11278 if (attachment_count > 0)
11279 {
11280 int random_pick = Math.RandomInt(0, attachment_count);
11282 if (!attachment.IsExplosive())
11283 {
11284 attachment.AddHealth("","",damage);
11285 return true;
11286 }
11287 }
11288 return false;
11289 }
11290
11292 {
11294 }
11295
11297 {
11299 return GetInventory().CanRemoveEntity();
11300
11301 return false;
11302 }
11303
11305 {
11306
11308 return false;
11309
11310
11312 return false;
11313
11314
11315
11317 if (delta == 0)
11318 return false;
11319
11320
11321 return true;
11322 }
11323
11325 {
11327 {
11328 if (ScriptInputUserData.CanStoreInputUserData())
11329 {
11330 ScriptInputUserData ctx = new ScriptInputUserData;
11335 ctx.
Write(destination_entity);
11337 ctx.
Write(slot_id);
11339 }
11340 }
11341 else if (!
g_Game.IsMultiplayer())
11342 {
11344 }
11345 }
11346
11348 {
11349 float split_quantity_new;
11353 InventoryLocation loc = new InventoryLocation;
11354
11355 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11356 {
11358 split_quantity_new = stack_max;
11359 else
11361
11363 {
11364 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11365 if (new_item)
11366 {
11367 new_item.SetResultOfSplit(true);
11368 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11370 new_item.
SetQuantity(split_quantity_new,
false,
true);
11371 }
11372 }
11373 }
11374 else if (destination_entity && slot_id == -1)
11375 {
11376 if (quantity > stack_max)
11377 split_quantity_new = stack_max;
11378 else
11379 split_quantity_new = quantity;
11380
11382 {
11383 GameInventory destinationInventory = destination_entity.GetInventory();
11385 {
11388 }
11389
11390 if (new_item)
11391 {
11392 new_item.SetResultOfSplit(true);
11393 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11395 new_item.
SetQuantity(split_quantity_new,
false,
true);
11396 }
11397 }
11398 }
11399 else
11400 {
11401 if (stack_max != 0)
11402 {
11404 {
11406 }
11407
11408 if (split_quantity_new == 0)
11409 {
11410 if (!
g_Game.IsMultiplayer())
11411 player.PhysicalPredictiveDropItem(this);
11412 else
11413 player.ServerDropEntity(this);
11414 return;
11415 }
11416
11418 {
11420
11421 if (new_item)
11422 {
11423 new_item.SetResultOfSplit(true);
11424 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11427 new_item.PlaceOnSurface();
11428 }
11429 }
11430 }
11431 }
11432 }
11433
11435 {
11436 float split_quantity_new;
11440 InventoryLocation loc = new InventoryLocation;
11441
11442 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11443 {
11445 split_quantity_new = stack_max;
11446 else
11448
11450 {
11451 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11452 if (new_item)
11453 {
11454 new_item.SetResultOfSplit(true);
11455 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11457 new_item.
SetQuantity(split_quantity_new,
false,
true);
11458 }
11459 }
11460 }
11461 else if (destination_entity && slot_id == -1)
11462 {
11463 if (quantity > stack_max)
11464 split_quantity_new = stack_max;
11465 else
11466 split_quantity_new = quantity;
11467
11469 {
11470 GameInventory destinationInventory = destination_entity.GetInventory();
11472 {
11475 }
11476
11477 if (new_item)
11478 {
11479 new_item.SetResultOfSplit(true);
11480 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11482 new_item.
SetQuantity(split_quantity_new,
false,
true);
11483 }
11484 }
11485 }
11486 else
11487 {
11488 if (stack_max != 0)
11489 {
11491 {
11493 }
11494
11496 {
11498
11499 if (new_item)
11500 {
11501 new_item.SetResultOfSplit(true);
11502 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11505 new_item.PlaceOnSurface();
11506 }
11507 }
11508 }
11509 }
11510 }
11511
11513 {
11515 {
11516 if (ScriptInputUserData.CanStoreInputUserData())
11517 {
11518 ScriptInputUserData ctx = new ScriptInputUserData;
11523 dst.WriteToContext(ctx);
11525 }
11526 }
11527 else if (!
g_Game.IsMultiplayer())
11528 {
11530 }
11531 }
11532
11534 {
11536 {
11537 if (ScriptInputUserData.CanStoreInputUserData())
11538 {
11539 ScriptInputUserData ctx = new ScriptInputUserData;
11544 ctx.
Write(destination_entity);
11550 }
11551 }
11552 else if (!
g_Game.IsMultiplayer())
11553 {
11555 }
11556 }
11557
11559 {
11561 }
11562
11564 {
11566 float split_quantity_new;
11568 if (dst.IsValid())
11569 {
11570 int slot_id = dst.GetSlot();
11572
11573 if (quantity > stack_max)
11574 split_quantity_new = stack_max;
11575 else
11576 split_quantity_new = quantity;
11577
11579 {
11581
11582 if (new_item)
11583 {
11584 new_item.SetResultOfSplit(true);
11585 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11587 new_item.
SetQuantity(split_quantity_new,
false,
true);
11588 }
11589
11590 return new_item;
11591 }
11592 }
11593
11594 return null;
11595 }
11596
11598 {
11600 float split_quantity_new;
11602 if (destination_entity)
11603 {
11605 if (quantity > stackable)
11606 split_quantity_new = stackable;
11607 else
11608 split_quantity_new = quantity;
11609
11611 {
11612 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11613 if (new_item)
11614 {
11615 new_item.SetResultOfSplit(true);
11616 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11618 new_item.
SetQuantity(split_quantity_new,
false,
true);
11619 }
11620 }
11621 }
11622 }
11623
11625 {
11627 {
11628 if (ScriptInputUserData.CanStoreInputUserData())
11629 {
11630 ScriptInputUserData ctx = new ScriptInputUserData;
11635 ItemBase destination_entity =
this;
11636 ctx.
Write(destination_entity);
11640 }
11641 }
11642 else if (!
g_Game.IsMultiplayer())
11643 {
11645 }
11646 }
11647
11649 {
11651 float split_quantity_new;
11653 if (player)
11654 {
11656 if (quantity > stackable)
11657 split_quantity_new = stackable;
11658 else
11659 split_quantity_new = quantity;
11660
11662 {
11663 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11664 new_item =
ItemBase.Cast(in_hands);
11665 if (new_item)
11666 {
11667 new_item.SetResultOfSplit(true);
11668 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11670 new_item.SetQuantity(split_quantity_new, false, true);
11671 }
11672 }
11673 }
11674 }
11675
11677 {
11679 float split_quantity_new = Math.Floor(quantity * 0.5);
11680
11682 return;
11683
11685
11686 if (new_item)
11687 {
11688 if (new_item.GetQuantityMax() < split_quantity_new)
11689 {
11690 split_quantity_new = new_item.GetQuantityMax();
11691 }
11692
11693 new_item.SetResultOfSplit(true);
11694 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11695
11697 {
11700 }
11701 else
11702 {
11704 new_item.
SetQuantity(split_quantity_new,
false,
true);
11705 }
11706 }
11707 }
11708
11710 {
11712 float split_quantity_new = Math.Floor(quantity / 2);
11713
11715 return;
11716
11717 InventoryLocation invloc = new InventoryLocation;
11719
11721 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11722
11723 if (new_item)
11724 {
11725 if (new_item.GetQuantityMax() < split_quantity_new)
11726 {
11727 split_quantity_new = new_item.GetQuantityMax();
11728 }
11730 {
11733 }
11734 else if (split_quantity_new > 1)
11735 {
11737 new_item.
SetQuantity(split_quantity_new,
false,
true);
11738 }
11739 }
11740 }
11741
11744 {
11745 SetWeightDirty();
11747
11748 if (parent)
11749 parent.OnAttachmentQuantityChangedEx(this, delta);
11750
11752 {
11754 {
11756 }
11758 {
11759 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11761 }
11762 }
11763 }
11764
11767 {
11768
11769 }
11770
11773 {
11775 }
11776
11778 {
11779 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11780
11782 {
11783 if (newLevel == GameConstants.STATE_RUINED)
11784 {
11786 EntityAI parent = GetHierarchyParent();
11787 if (parent && parent.IsFireplace())
11788 {
11789 CargoBase cargo = GetInventory().GetCargo();
11790 if (cargo)
11791 {
11793 {
11795 }
11796 }
11797 }
11798 }
11799
11801 {
11802
11804 return;
11805 }
11806
11807 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11808 {
11810 }
11811 }
11812 }
11813
11814
11816 {
11817 super.OnRightClick();
11818
11820 {
11822 {
11823 if (ScriptInputUserData.CanStoreInputUserData())
11824 {
11825 EntityAI root = GetHierarchyRoot();
11826 Man playerOwner = GetHierarchyRootPlayer();
11827 InventoryLocation dst = new InventoryLocation;
11828
11829
11830 if (!playerOwner && root && root == this)
11831 {
11833 }
11834 else
11835 {
11836
11837 GetInventory().GetCurrentInventoryLocation(dst);
11839 {
11840 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11842 {
11844 }
11845 else
11846 {
11848
11849
11850 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11851 {
11853 }
11854 else
11855 {
11856 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11857 }
11858 }
11859 }
11860 }
11861
11862 ScriptInputUserData ctx = new ScriptInputUserData;
11870 }
11871 }
11872 else if (!
g_Game.IsMultiplayer())
11873 {
11875 }
11876 }
11877 }
11878
11880 {
11881 if (root)
11882 {
11883 vector m4[4];
11884 root.GetTransform(m4);
11885 dst.SetGround(this, m4);
11886 }
11887 else
11888 {
11889 GetInventory().GetCurrentInventoryLocation(dst);
11890 }
11891 }
11892
11893 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11894 {
11895
11896 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11897 return false;
11898
11899 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11900 return false;
11901
11902
11904 return false;
11905
11906
11907 Magazine mag = Magazine.Cast(this);
11908 if (mag)
11909 {
11910 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11911 return false;
11912
11913 if (stack_max_limit)
11914 {
11915 Magazine other_mag = Magazine.Cast(other_item);
11916 if (other_item)
11917 {
11918 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11919 return false;
11920 }
11921
11922 }
11923 }
11924 else
11925 {
11926
11928 return false;
11929
11931 return false;
11932 }
11933
11934 PlayerBase player = null;
11935 if (CastTo(player, GetHierarchyRootPlayer()))
11936 {
11937 if (player.GetInventory().HasAttachment(this))
11938 return false;
11939
11940 if (player.IsItemsToDelete())
11941 return false;
11942 }
11943
11944 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11945 return false;
11946
11947 int slotID;
11949 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11950 return false;
11951
11952 return true;
11953 }
11954
11956 {
11958 }
11959
11961 {
11962 return m_IsResultOfSplit;
11963 }
11964
11966 {
11967 m_IsResultOfSplit = value;
11968 }
11969
11971 {
11973 }
11974
11976 {
11977 float other_item_quantity = other_item.GetQuantity();
11978 float this_free_space;
11979
11981
11983
11984 if (other_item_quantity > this_free_space)
11985 {
11986 return this_free_space;
11987 }
11988 else
11989 {
11990 return other_item_quantity;
11991 }
11992 }
11993
11995 {
11997 }
11998
12000 {
12002 return;
12003
12004 if (!IsMagazine() && other_item)
12005 {
12007 if (quantity_used != 0)
12008 {
12009 float hp1 = GetHealth01("","");
12010 float hp2 = other_item.GetHealth01("","");
12011 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12012 hpResult = hpResult / (
GetQuantity() + quantity_used);
12013
12014 hpResult *= GetMaxHealth();
12015 Math.Round(hpResult);
12016 SetHealth("", "Health", hpResult);
12017
12019 other_item.AddQuantity(-quantity_used);
12020 }
12021 }
12023 }
12024
12026 {
12027 #ifdef SERVER
12028 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12029 GetHierarchyParent().IncreaseLifetimeUp();
12030 #endif
12031 };
12032
12034 {
12035 PlayerBase p = PlayerBase.Cast(player);
12036
12037 array<int> recipesIds = p.m_Recipes;
12038 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12039 if (moduleRecipesManager)
12040 {
12041 EntityAI itemInHands = player.GetEntityInHands();
12042 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12043 }
12044
12045 for (int i = 0;i < recipesIds.Count(); i++)
12046 {
12047 int key = recipesIds.Get(i);
12048 string recipeName = moduleRecipesManager.GetRecipeName(key);
12050 }
12051 }
12052
12053
12054 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12055 {
12056 super.GetDebugActions(outputList);
12057
12058
12064
12065
12070
12075
12076
12080
12081
12083 {
12087 }
12088
12091
12092
12096
12098
12099 InventoryLocation loc = new InventoryLocation();
12100 GetInventory().GetCurrentInventoryLocation(loc);
12102 {
12103 if (Gizmo_IsSupported())
12106 }
12107
12109 }
12110
12111
12112
12113
12115 {
12116 super.OnAction(action_id, player, ctx);
12117
12119 {
12120 switch (action_id)
12121 {
12125 return true;
12129 return true;
12130 }
12131 }
12132
12134 {
12135 switch (action_id)
12136 {
12138 Delete();
12139 return true;
12140 }
12141 }
12142
12143 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12144 {
12145 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12146 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12147 PlayerBase p = PlayerBase.Cast(player);
12148 if (
EActions.RECIPES_RANGE_START < 1000)
12149 {
12150 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12151 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12152 }
12153 }
12154 #ifndef SERVER
12155 else if (action_id ==
EActions.WATCH_PLAYER)
12156 {
12157 PluginDeveloper.SetDeveloperItemClientEx(player);
12158 }
12159 #endif
12161 {
12162 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12163 {
12164 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12165 OnDebugButtonPressServer(id + 1);
12166 }
12167
12168 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12169 {
12170 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12172 }
12173
12174 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12175 {
12176 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12178 }
12179
12180 else if (action_id ==
EActions.ADD_QUANTITY)
12181 {
12182 if (IsMagazine())
12183 {
12184 Magazine mag = Magazine.Cast(this);
12185 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12186 }
12187 else
12188 {
12190 }
12191
12192 if (m_EM)
12193 {
12194 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12195 }
12196
12197 }
12198
12199 else if (action_id ==
EActions.REMOVE_QUANTITY)
12200 {
12201 if (IsMagazine())
12202 {
12203 Magazine mag2 = Magazine.Cast(this);
12204 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12205 }
12206 else
12207 {
12209 }
12210 if (m_EM)
12211 {
12212 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12213 }
12214
12215 }
12216
12217 else if (action_id ==
EActions.SET_QUANTITY_0)
12218 {
12220
12221 if (m_EM)
12222 {
12223 m_EM.SetEnergy(0);
12224 }
12225 }
12226
12227 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12228 {
12230
12231 if (m_EM)
12232 {
12233 m_EM.SetEnergy(m_EM.GetEnergyMax());
12234 }
12235 }
12236
12237 else if (action_id ==
EActions.ADD_HEALTH)
12238 {
12239 AddHealth("","",GetMaxHealth("","Health")/5);
12240 }
12241 else if (action_id ==
EActions.REMOVE_HEALTH)
12242 {
12243 AddHealth("","",-GetMaxHealth("","Health")/5);
12244 }
12245 else if (action_id ==
EActions.DESTROY_HEALTH)
12246 {
12247 SetHealth01("","",0);
12248 }
12249 else if (action_id ==
EActions.WATCH_ITEM)
12250 {
12252 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12253 #ifdef DEVELOPER
12254 SetDebugDeveloper_item(this);
12255 #endif
12256 }
12257
12258 else if (action_id ==
EActions.ADD_TEMPERATURE)
12259 {
12260 AddTemperature(20);
12261
12262 }
12263
12264 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12265 {
12266 AddTemperature(-20);
12267
12268 }
12269
12270 else if (action_id ==
EActions.FLIP_FROZEN)
12271 {
12272 SetFrozen(!GetIsFrozen());
12273
12274 }
12275
12276 else if (action_id ==
EActions.ADD_WETNESS)
12277 {
12279
12280 }
12281
12282 else if (action_id ==
EActions.REMOVE_WETNESS)
12283 {
12285
12286 }
12287
12288 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12289 {
12292
12293
12294 }
12295
12296 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12297 {
12300 }
12301
12302 else if (action_id ==
EActions.MAKE_SPECIAL)
12303 {
12304 auto debugParams = DebugSpawnParams.WithPlayer(player);
12305 OnDebugSpawnEx(debugParams);
12306 }
12307
12308 }
12309
12310
12311 return false;
12312 }
12313
12314
12315
12316
12320
12323
12324
12325
12327 {
12328 return false;
12329 }
12330
12331
12333 {
12334 return true;
12335 }
12336
12337
12339 {
12340 return true;
12341 }
12342
12343
12344
12346 {
12347 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12348 return g_Game.ConfigIsExisting(config_path);
12349 }
12350
12353 {
12354 return null;
12355 }
12356
12358 {
12359 return false;
12360 }
12361
12363 {
12364 return false;
12365 }
12366
12370
12371
12373 {
12374 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12375 return module_repairing.CanRepair(this, item_repair_kit);
12376 }
12377
12378
12379 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12380 {
12381 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12382 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12383 }
12384
12385
12387 {
12388
12389
12390
12391
12392
12393
12394
12395
12396 return 1;
12397 }
12398
12399
12400
12402 {
12404 }
12405
12406
12407
12409 {
12411 }
12412
12413
12422 {
12423 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12424
12425 if (player)
12426 {
12427 player.MessageStatus(text);
12428 }
12429 }
12430
12431
12440 {
12441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12442
12443 if (player)
12444 {
12445 player.MessageAction(text);
12446 }
12447 }
12448
12449
12458 {
12459 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12460
12461 if (player)
12462 {
12463 player.MessageFriendly(text);
12464 }
12465 }
12466
12467
12476 {
12477 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12478
12479 if (player)
12480 {
12481 player.MessageImportant(text);
12482 }
12483 }
12484
12486 {
12487 return true;
12488 }
12489
12490
12491 override bool KindOf(
string tag)
12492 {
12493 bool found = false;
12494 string item_name = this.
GetType();
12496 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12497
12498 int array_size = item_tag_array.Count();
12499 for (int i = 0; i < array_size; i++)
12500 {
12501 if (item_tag_array.Get(i) == tag)
12502 {
12503 found = true;
12504 break;
12505 }
12506 }
12507 return found;
12508 }
12509
12510
12512 {
12513
12514 super.OnRPC(sender, rpc_type,ctx);
12515
12516
12517 switch (rpc_type)
12518 {
12519 #ifndef SERVER
12520 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12521 Param2<bool, string> p = new Param2<bool, string>(false, "");
12522
12524 return;
12525
12526 bool play = p.param1;
12527 string soundSet = p.param2;
12528
12529 if (play)
12530 {
12532 {
12534 {
12536 }
12537 }
12538 else
12539 {
12541 }
12542 }
12543 else
12544 {
12546 }
12547
12548 break;
12549 #endif
12550
12551 }
12552
12554 {
12556 }
12557 }
12558
12559
12560
12561
12563 {
12564 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12565 return plugin.GetID(
name);
12566 }
12567
12569 {
12570 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12571 return plugin.GetName(id);
12572 }
12573
12576 {
12577
12578
12579 int varFlags;
12580 if (!ctx.
Read(varFlags))
12581 return;
12582
12583 if (varFlags & ItemVariableFlags.FLOAT)
12584 {
12586 }
12587 }
12588
12590 {
12591
12592 super.SerializeNumericalVars(floats_out);
12593
12594
12595
12597 {
12599 }
12600
12602 {
12604 }
12605
12607 {
12609 }
12610
12612 {
12617 }
12618
12620 {
12622 }
12623 }
12624
12626 {
12627
12628 super.DeSerializeNumericalVars(floats);
12629
12630
12631 int index = 0;
12632 int mask = Math.Round(floats.Get(index));
12633
12634 index++;
12635
12637 {
12639 {
12641 }
12642 else
12643 {
12644 float quantity = floats.Get(index);
12645 SetQuantity(quantity,
true,
false,
false,
false);
12646 }
12647 index++;
12648 }
12649
12651 {
12652 float wet = floats.Get(index);
12654 index++;
12655 }
12656
12658 {
12659 int liquidtype = Math.Round(floats.Get(index));
12661 index++;
12662 }
12663
12665 {
12667 index++;
12669 index++;
12671 index++;
12673 index++;
12674 }
12675
12677 {
12678 int cleanness = Math.Round(floats.Get(index));
12680 index++;
12681 }
12682 }
12683
12685 {
12686 super.WriteVarsToCTX(ctx);
12687
12688
12690 {
12692 }
12693
12695 {
12697 }
12698
12700 {
12702 }
12703
12705 {
12706 int r,g,b,a;
12712 }
12713
12715 {
12717 }
12718 }
12719
12721 {
12722 if (!super.ReadVarsFromCTX(ctx,version))
12723 return false;
12724
12725 int intValue;
12726 float value;
12727
12728 if (version < 140)
12729 {
12730 if (!ctx.
Read(intValue))
12731 return false;
12732
12733 m_VariablesMask = intValue;
12734 }
12735
12737 {
12738 if (!ctx.
Read(value))
12739 return false;
12740
12742 {
12744 }
12745 else
12746 {
12748 }
12749 }
12750
12751 if (version < 140)
12752 {
12754 {
12755 if (!ctx.
Read(value))
12756 return false;
12757 SetTemperatureDirect(value);
12758 }
12759 }
12760
12762 {
12763 if (!ctx.
Read(value))
12764 return false;
12766 }
12767
12769 {
12770 if (!ctx.
Read(intValue))
12771 return false;
12773 }
12774
12776 {
12777 int r,g,b,a;
12779 return false;
12781 return false;
12783 return false;
12785 return false;
12786
12788 }
12789
12791 {
12792 if (!ctx.
Read(intValue))
12793 return false;
12795 }
12796
12797 if (version >= 138 && version < 140)
12798 {
12800 {
12801 if (!ctx.
Read(intValue))
12802 return false;
12803 SetFrozen(intValue);
12804 }
12805 }
12806
12807 return true;
12808 }
12809
12810
12812 {
12815 {
12817 }
12818
12819 if (!super.OnStoreLoad(ctx, version))
12820 {
12822 return false;
12823 }
12824
12825 if (version >= 114)
12826 {
12827 bool hasQuickBarIndexSaved;
12828
12829 if (!ctx.
Read(hasQuickBarIndexSaved))
12830 {
12832 return false;
12833 }
12834
12835 if (hasQuickBarIndexSaved)
12836 {
12837 int itmQBIndex;
12838
12839
12840 if (!ctx.
Read(itmQBIndex))
12841 {
12843 return false;
12844 }
12845
12846 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12847 if (itmQBIndex != -1 && parentPlayer)
12848 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12849 }
12850 }
12851 else
12852 {
12853
12854 PlayerBase player;
12855 int itemQBIndex;
12856 if (version ==
int.
MAX)
12857 {
12858 if (!ctx.
Read(itemQBIndex))
12859 {
12861 return false;
12862 }
12863 }
12864 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12865 {
12866
12867 if (!ctx.
Read(itemQBIndex))
12868 {
12870 return false;
12871 }
12872 if (itemQBIndex != -1 && player)
12873 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12874 }
12875 }
12876
12877 if (version < 140)
12878 {
12879
12880 if (!LoadVariables(ctx, version))
12881 {
12883 return false;
12884 }
12885 }
12886
12887
12889 {
12891 return false;
12892 }
12893 if (version >= 132)
12894 {
12896 if (raib)
12897 {
12899 {
12901 return false;
12902 }
12903 }
12904 }
12905
12907 return true;
12908 }
12909
12910
12911
12913 {
12914 super.OnStoreSave(ctx);
12915
12916 PlayerBase player;
12917 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12918 {
12920
12921 int itemQBIndex = -1;
12922 itemQBIndex = player.FindQuickBarEntityIndex(this);
12923 ctx.
Write(itemQBIndex);
12924 }
12925 else
12926 {
12928 }
12929
12931
12933 if (raib)
12934 {
12936 }
12937 }
12938
12939
12941 {
12942 super.AfterStoreLoad();
12943
12945 {
12947 }
12948
12950 {
12953 }
12954 }
12955
12957 {
12958 super.EEOnAfterLoad();
12959
12961 {
12963 }
12964
12967 }
12968
12970 {
12971 return false;
12972 }
12973
12974
12975
12977 {
12979 {
12980 #ifdef PLATFORM_CONSOLE
12981
12983 {
12985 if (menu)
12986 {
12988 }
12989 }
12990 #endif
12991 }
12992
12994 {
12997 }
12998
13000 {
13001 SetWeightDirty();
13003 }
13005 {
13008 }
13009
13011 {
13014
13017 }
13019 {
13023 }
13024
13025 super.OnVariablesSynchronized();
13026 }
13027
13028
13029
13031 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13032 {
13033 if (!IsServerCheck(allow_client))
13034 return false;
13035
13037 return false;
13038
13041
13042 if (value <= (min + 0.001))
13043 value = min;
13044
13045 if (value == min)
13046 {
13047 if (destroy_config)
13048 {
13049 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13050 if (dstr)
13051 {
13053 this.Delete();
13054 return true;
13055 }
13056 }
13057 else if (destroy_forced)
13058 {
13060 this.Delete();
13061 return true;
13062 }
13063
13065 }
13066
13069
13071 {
13072 EntityAI parent = GetHierarchyRoot();
13073 InventoryLocation iLoc = new InventoryLocation();
13074 GetInventory().GetCurrentInventoryLocation(iLoc);
13076 {
13077 int iLocSlot = iLoc.
GetSlot();
13079 {
13081 }
13083 {
13085 }
13086 }
13087 }
13088
13090 {
13092
13093 if (delta)
13095 }
13096
13098
13099 return false;
13100 }
13101
13102
13104 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13105 {
13107 }
13108
13110 {
13113 }
13114
13116 {
13119 }
13120
13122 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13123 {
13124 float value_clamped = Math.Clamp(value, 0, 1);
13126 SetQuantity(result, destroy_config, destroy_forced);
13127 }
13128
13129
13132 {
13134 }
13135
13137 {
13139 }
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13151 {
13152 int slot = -1;
13153 GameInventory inventory = GetInventory();
13154 if (inventory)
13155 {
13156 InventoryLocation il = new InventoryLocation;
13159 }
13160
13162 }
13163
13165 {
13166 float quantity_max = 0;
13167
13169 {
13170 if (attSlotID != -1)
13171 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13172
13173 if (quantity_max <= 0)
13175 }
13176
13177 if (quantity_max <= 0)
13179
13180 return quantity_max;
13181 }
13182
13184 {
13186 }
13187
13189 {
13191 }
13192
13193
13195 {
13197 }
13198
13200 {
13202 }
13203
13205 {
13207 }
13208
13209
13211 {
13212
13213 float weightEx = GetWeightEx();
13214 float special = GetInventoryAndCargoWeight();
13215 return weightEx - special;
13216 }
13217
13218
13220 {
13222 }
13223
13225 {
13227 {
13228 #ifdef DEVELOPER
13229 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13230 {
13231 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13233 }
13234 #endif
13235
13236 return GetQuantity() * GetConfigWeightModified();
13237 }
13238 else if (HasEnergyManager())
13239 {
13240 #ifdef DEVELOPER
13241 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13242 {
13243 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13244 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13245 }
13246 #endif
13247 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13248 }
13249 else
13250 {
13251 #ifdef DEVELOPER
13252 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13253 {
13254 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13255 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13256 }
13257 #endif
13258 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13259 }
13260 }
13261
13264 {
13265 int item_count = 0;
13267
13268 GameInventory inventory = GetInventory();
13269 CargoBase cargo = inventory.
GetCargo();
13270 if (cargo != NULL)
13271 {
13273 }
13274
13276 for (int i = 0; i < nAttachments; ++i)
13277 {
13279 if (item)
13280 item_count += item.GetNumberOfItems();
13281 }
13282 return item_count;
13283 }
13284
13287 {
13288 float weight = 0;
13289 float wetness = 1;
13290 if (include_wetness)
13293 {
13294 weight = wetness * m_ConfigWeight;
13295 }
13297 {
13298 weight = 1;
13299 }
13300 return weight;
13301 }
13302
13303
13304
13306 {
13307 GameInventory inventory = GetInventory();
13308 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13309 {
13310 array<EntityAI> items = new array<EntityAI>;
13312 for (int i = 0; i < items.Count(); ++i)
13313 {
13315 if (item)
13316 {
13317 g_Game.ObjectDelete(item);
13318 }
13319 }
13320 }
13321 }
13322
13323
13324
13325
13327 {
13328 float energy = 0;
13329 if (HasEnergyManager())
13330 {
13331 energy = GetCompEM().GetEnergy();
13332 }
13333 return energy;
13334 }
13335
13336
13338 {
13339 super.OnEnergyConsumed();
13340
13342 }
13343
13345 {
13346 super.OnEnergyAdded();
13347
13349 }
13350
13351
13353 {
13354 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13355 {
13357 {
13358 float energy_0to1 = GetCompEM().GetEnergy0To1();
13360 }
13361 }
13362 }
13363
13364
13366 {
13367 return ConfigGetFloat("heatIsolation");
13368 }
13369
13371 {
13373 }
13374
13376 {
13377 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13378 if (
g_Game.ConfigIsExisting(paramPath))
13379 return g_Game.ConfigGetFloat(paramPath);
13380
13381 return 0.0;
13382 }
13383
13385 {
13386 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13387 if (
g_Game.ConfigIsExisting(paramPath))
13388 return g_Game.ConfigGetFloat(paramPath);
13389
13390 return 0.0;
13391 }
13392
13393 override void SetWet(
float value,
bool allow_client =
false)
13394 {
13395 if (!IsServerCheck(allow_client))
13396 return;
13397
13400
13402
13403 m_VarWet = Math.Clamp(value, min, max);
13404
13406 {
13409 }
13410 }
13411
13412 override void AddWet(
float value)
13413 {
13415 }
13416
13418 {
13420 }
13421
13423 {
13425 }
13426
13428 {
13430 }
13431
13433 {
13435 }
13436
13438 {
13440 }
13441
13442 override void OnWetChanged(
float newVal,
float oldVal)
13443 {
13446 if (newLevel != oldLevel)
13447 {
13449 }
13450 }
13451
13453 {
13454 SetWeightDirty();
13455 }
13456
13458 {
13459 return GetWetLevelInternal(
m_VarWet);
13460 }
13461
13462
13463
13465 {
13467 }
13468
13470 {
13472 }
13473
13475 {
13477 }
13478
13480 {
13482 }
13483
13484
13485
13487 {
13488 if (ConfigIsExisting("itemModelLength"))
13489 {
13490 return ConfigGetFloat("itemModelLength");
13491 }
13492 return 0;
13493 }
13494
13496 {
13497 if (ConfigIsExisting("itemAttachOffset"))
13498 {
13499 return ConfigGetFloat("itemAttachOffset");
13500 }
13501 return 0;
13502 }
13503
13504 override void SetCleanness(
int value,
bool allow_client =
false)
13505 {
13506 if (!IsServerCheck(allow_client))
13507 return;
13508
13510
13512
13515 }
13516
13518 {
13520 }
13521
13523 {
13524 return true;
13525 }
13526
13527
13528
13529
13531 {
13533 }
13534
13536 {
13538 }
13539
13540
13541
13542
13543 override void SetColor(
int r,
int g,
int b,
int a)
13544 {
13550 }
13552 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13553 {
13558 }
13559
13561 {
13563 }
13564
13567 {
13568 int r,g,b,a;
13570 r = r/255;
13571 g = g/255;
13572 b = b/255;
13573 a = a/255;
13574 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13575 }
13576
13577
13578
13579 override void SetLiquidType(
int value,
bool allow_client =
false)
13580 {
13581 if (!IsServerCheck(allow_client))
13582 return;
13583
13588 }
13589
13591 {
13592 return ConfigGetInt("varLiquidTypeInit");
13593 }
13594
13596 {
13598 }
13599
13601 {
13603 SetFrozen(false);
13604 }
13605
13608 {
13609 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13610 }
13611
13612
13615 {
13616 PlayerBase nplayer;
13617 if (PlayerBase.CastTo(nplayer, player))
13618 {
13620 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13621 }
13622 }
13623
13624
13627 {
13628 PlayerBase nplayer;
13629 if (PlayerBase.CastTo(nplayer,player))
13630 {
13631 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13632 }
13633
13634 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13635
13636 if (HasEnergyManager())
13637 {
13638 GetCompEM().UpdatePlugState();
13639 }
13640 }
13641
13642
13644 {
13645 super.OnPlacementStarted(player);
13646
13648 }
13649
13650 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13651 {
13653 {
13654 m_AdminLog.OnPlacementComplete(player,
this);
13655 }
13656
13657 super.OnPlacementComplete(player, position, orientation);
13658 }
13659
13660
13661
13662
13663
13665 {
13667 {
13668 return true;
13669 }
13670 else
13671 {
13672 return false;
13673 }
13674 }
13675
13676
13678 {
13680 {
13682 }
13683 }
13684
13685
13687 {
13689 }
13690
13692 {
13694 }
13695
13696 override void InsertAgent(
int agent,
float count = 1)
13697 {
13698 if (count < 1)
13699 return;
13700
13702 }
13703
13706 {
13708 }
13709
13710
13712 {
13714 }
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13758 {
13760 return false;
13761 return true;
13762 }
13763
13765 {
13766
13768 }
13769
13770
13773 {
13774 super.CheckForRoofLimited(timeTresholdMS);
13775
13776 float time =
g_Game.GetTime();
13777 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13778 {
13779 m_PreviousRoofTestTime = time;
13780 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13781 }
13782 }
13783
13784
13786 {
13788 {
13789 return 0;
13790 }
13791
13792 if (GetInventory().GetAttachmentSlotsCount() != 0)
13793 {
13794 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13795 if (filter)
13796 return filter.GetProtectionLevel(type, false, system);
13797 else
13798 return 0;
13799 }
13800
13801 string subclassPath, entryName;
13802
13803 switch (type)
13804 {
13806 entryName = "biological";
13807 break;
13809 entryName = "chemical";
13810 break;
13811 default:
13812 entryName = "biological";
13813 break;
13814 }
13815
13816 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13817
13818 return g_Game.ConfigGetFloat(subclassPath + entryName);
13819 }
13820
13821
13822
13825 {
13826 if (!IsMagazine())
13828
13830 }
13831
13832
13833
13834
13835
13840 {
13841 return true;
13842 }
13843
13845 {
13847 }
13848
13849
13850
13851
13852
13854 {
13855 if (parent)
13856 {
13857 if (parent.IsInherited(DayZInfected))
13858 return true;
13859
13860 if (!parent.IsRuined())
13861 return true;
13862 }
13863
13864 return true;
13865 }
13866
13868 {
13869 if (!super.CanPutAsAttachment(parent))
13870 {
13871 return false;
13872 }
13873
13874 if (!IsRuined() && !parent.IsRuined())
13875 {
13876 return true;
13877 }
13878
13879 return false;
13880 }
13881
13883 {
13884
13885
13886
13887
13888 return super.CanReceiveItemIntoCargo(item);
13889 }
13890
13892 {
13893
13894
13895
13896
13897 GameInventory attachmentInv = attachment.GetInventory();
13899 {
13900 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13901 return false;
13902 }
13903
13904 InventoryLocation loc = new InventoryLocation();
13905 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13906 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13907 return false;
13908
13909 return super.CanReceiveAttachment(attachment, slotId);
13910 }
13911
13913 {
13914 if (!super.CanReleaseAttachment(attachment))
13915 return false;
13916
13917 return GetInventory().AreChildrenAccessible();
13918 }
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13941 {
13942 int id = muzzle_owner.GetMuzzleID();
13943 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13944
13945 if (WPOF_array)
13946 {
13947 for (int i = 0; i < WPOF_array.Count(); i++)
13948 {
13949 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13950
13951 if (WPOF)
13952 {
13953 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13954 }
13955 }
13956 }
13957 }
13958
13959
13961 {
13962 int id = muzzle_owner.GetMuzzleID();
13964
13965 if (WPOBE_array)
13966 {
13967 for (int i = 0; i < WPOBE_array.Count(); i++)
13968 {
13969 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13970
13971 if (WPOBE)
13972 {
13973 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13974 }
13975 }
13976 }
13977 }
13978
13979
13981 {
13982 int id = muzzle_owner.GetMuzzleID();
13983 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13984
13985 if (WPOOH_array)
13986 {
13987 for (int i = 0; i < WPOOH_array.Count(); i++)
13988 {
13989 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13990
13991 if (WPOOH)
13992 {
13993 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13994 }
13995 }
13996 }
13997 }
13998
13999
14001 {
14002 int id = muzzle_owner.GetMuzzleID();
14003 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14004
14005 if (WPOOH_array)
14006 {
14007 for (int i = 0; i < WPOOH_array.Count(); i++)
14008 {
14009 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14010
14011 if (WPOOH)
14012 {
14013 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14014 }
14015 }
14016 }
14017 }
14018
14019
14021 {
14022 int id = muzzle_owner.GetMuzzleID();
14023 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14024
14025 if (WPOOH_array)
14026 {
14027 for (int i = 0; i < WPOOH_array.Count(); i++)
14028 {
14029 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14030
14031 if (WPOOH)
14032 {
14033 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14034 }
14035 }
14036 }
14037 }
14038
14039
14040
14042 {
14044 {
14045 return true;
14046 }
14047
14048 return false;
14049 }
14050
14052 {
14054 {
14055 return true;
14056 }
14057
14058 return false;
14059 }
14060
14062 {
14064 {
14065 return true;
14066 }
14067
14068 return false;
14069 }
14070
14072 {
14073 return false;
14074 }
14075
14078 {
14079 return UATimeSpent.DEFAULT_DEPLOY;
14080 }
14081
14082
14083
14084
14086 {
14088 SetSynchDirty();
14089 }
14090
14092 {
14094 }
14095
14096
14098 {
14099 return false;
14100 }
14101
14104 {
14105 string att_type = "None";
14106
14107 if (ConfigIsExisting("soundAttType"))
14108 {
14109 att_type = ConfigGetString("soundAttType");
14110 }
14111
14113 }
14114
14116 {
14118 }
14119
14120
14121
14122
14123
14129
14131 {
14134
14136 }
14137
14138
14140 {
14142 return;
14143
14145
14148
14151
14152 SoundParameters params = new SoundParameters();
14156 }
14157
14158
14160 {
14162 {
14165
14166 SetSynchDirty();
14167
14170 }
14171 }
14172
14174 {
14176 }
14177
14178
14180 {
14182 return;
14183
14185 SetSynchDirty();
14186
14189 }
14190
14192 {
14195 }
14196
14198 {
14200 }
14201
14202 void OnApply(PlayerBase player);
14203
14205 {
14206 return 1.0;
14207 };
14208
14210 {
14212 }
14213
14215 {
14217 }
14218
14220
14222 {
14223 SetDynamicPhysicsLifeTime(0.01);
14225 }
14226
14228 {
14229 array<string> zone_names = new array<string>;
14230 GetDamageZones(zone_names);
14231 for (int i = 0; i < zone_names.Count(); i++)
14232 {
14233 SetHealthMax(zone_names.Get(i),"Health");
14234 }
14235 SetHealthMax("","Health");
14236 }
14237
14240 {
14241 float global_health = GetHealth01("","Health");
14242 array<string> zones = new array<string>;
14243 GetDamageZones(zones);
14244
14245 for (int i = 0; i < zones.Count(); i++)
14246 {
14247 SetHealth01(zones.Get(i),"Health",global_health);
14248 }
14249 }
14250
14253 {
14254 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14255 }
14256
14258 {
14259 if (!hasRootAsPlayer)
14260 {
14261 if (refParentIB)
14262 {
14263
14264 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14265 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14266
14267 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14268 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14269
14272 }
14273 else
14274 {
14275
14278 }
14279 }
14280 }
14281
14283 {
14285 {
14286 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14287 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14288 {
14289 float heatPermCoef = 1.0;
14291 while (ent)
14292 {
14293 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14294 ent = ent.GetHierarchyParent();
14295 }
14296
14297 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14298 }
14299 }
14300 }
14301
14303 {
14304
14305 EntityAI parent = GetHierarchyParent();
14306 if (!parent)
14307 {
14308 hasParent = false;
14309 hasRootAsPlayer = false;
14310 }
14311 else
14312 {
14313 hasParent = true;
14314 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14315 refParentIB =
ItemBase.Cast(parent);
14316 }
14317 }
14318
14319 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14320 {
14321
14322 }
14323
14325 {
14326
14327 return false;
14328 }
14329
14331 {
14332
14333
14334 return false;
14335 }
14336
14338 {
14339
14340 return false;
14341 }
14342
14345 {
14346 return !GetIsFrozen() &&
IsOpen();
14347 }
14348
14350 {
14351 bool hasParent = false, hasRootAsPlayer = false;
14353
14354 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14355 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14356
14357 if (wwtu || foodDecay)
14358 {
14362
14363 if (processWetness || processTemperature || processDecay)
14364 {
14366
14367 if (processWetness)
14368 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14369
14370 if (processTemperature)
14372
14373 if (processDecay)
14374 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14375 }
14376 }
14377 }
14378
14381 {
14383 }
14384
14386 {
14389
14390 return super.GetTemperatureFreezeThreshold();
14391 }
14392
14394 {
14397
14398 return super.GetTemperatureThawThreshold();
14399 }
14400
14402 {
14405
14406 return super.GetItemOverheatThreshold();
14407 }
14408
14410 {
14412 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14413
14414 return super.GetTemperatureFreezeTime();
14415 }
14416
14418 {
14420 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14421
14422 return super.GetTemperatureThawTime();
14423 }
14424
14429
14431 {
14432 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14433 }
14434
14436 {
14437 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14438 }
14439
14442 {
14444 }
14445
14447 {
14449 }
14450
14452 {
14454 }
14455
14458 {
14459 return null;
14460 }
14461
14464 {
14465 return false;
14466 }
14467
14469 {
14471 {
14474 if (!trg)
14475 {
14477 explosive = this;
14478 }
14479
14480 explosive.PairRemote(trg);
14482
14483 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14484 trg.SetPersistentPairID(persistentID);
14485 explosive.SetPersistentPairID(persistentID);
14486
14487 return true;
14488 }
14489 return false;
14490 }
14491
14494 {
14495 float ret = 1.0;
14498 ret *= GetHealth01();
14499
14500 return ret;
14501 }
14502
14503 #ifdef DEVELOPER
14504 override void SetDebugItem()
14505 {
14506 super.SetDebugItem();
14507 _itemBase = this;
14508 }
14509
14511 {
14512 string text = super.GetDebugText();
14513
14515 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14516
14517 return text;
14518 }
14519 #endif
14520
14522 {
14523 return true;
14524 }
14525
14527
14529
14531 {
14534 }
14535
14536
14544
14560
14561 [
Obsolete(
"Use ItemSoundHandler instead")]
14564 {
14565 if (!
g_Game.IsDedicatedServer())
14566 {
14567 if (ConfigIsExisting("attachSoundSet"))
14568 {
14569 string cfg_path = "";
14570 string soundset = "";
14571 string type_name =
GetType();
14572
14575 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14576 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14577
14578 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14579 {
14580 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14581 {
14582 if (cfg_slot_array[i] == slot_type)
14583 {
14584 soundset = cfg_soundset_array[i];
14585 break;
14586 }
14587 }
14588 }
14589
14590 if (soundset != "")
14591 {
14592 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14594 }
14595 }
14596 }
14597 }
14598
14600}
14601
14603{
14605 if (entity)
14606 {
14607 bool is_item = entity.IsInherited(
ItemBase);
14608 if (is_item && full_quantity)
14609 {
14612 }
14613 }
14614 else
14615 {
14617 return NULL;
14618 }
14619 return entity;
14620}
14621
14623{
14624 if (item)
14625 {
14626 if (health > 0)
14627 item.SetHealth("", "", health);
14628
14629 if (item.CanHaveTemperature())
14630 {
14632 if (item.CanFreeze())
14633 item.SetFrozen(false);
14634 }
14635
14636 if (item.HasEnergyManager())
14637 {
14638 if (quantity >= 0)
14639 {
14640 item.GetCompEM().SetEnergy0To1(quantity);
14641 }
14642 else
14643 {
14645 }
14646 }
14647 else if (item.IsMagazine())
14648 {
14649 Magazine mag = Magazine.Cast(item);
14650 if (quantity >= 0)
14651 {
14652 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14653 }
14654 else
14655 {
14657 }
14658
14659 }
14660 else
14661 {
14662 if (quantity >= 0)
14663 {
14664 item.SetQuantityNormalized(quantity, false);
14665 }
14666 else
14667 {
14669 }
14670
14671 }
14672 }
14673}
14674
14675#ifdef DEVELOPER
14677#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.