9761{
9763 {
9764 return true;
9765 }
9766};
9767
9769{
9770
9771};
9772
9773
9774
9776{
9780
9782
9785
9786
9787
9788
9789
9798
9804
9809
9814
9835 protected bool m_IsResultOfSplit
9836
9838
9843
9844
9845
9847
9851
9852
9853
9855
9858
9859
9860
9866
9867
9875
9878
9879
9881
9882
9884
9885
9890
9891
9896
9898
9899
9901
9902
9904 {
9909
9910 if (!
g_Game.IsDedicatedServer())
9911 {
9913 {
9915
9917 {
9919 }
9920 }
9921
9924 }
9925
9926 m_OldLocation = null;
9927
9929 {
9931 }
9932
9933 if (ConfigIsExisting("headSelectionsToHide"))
9934 {
9937 }
9938
9940 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9941 {
9943 }
9944
9946
9947 m_IsResultOfSplit = false;
9948
9950 }
9951
9953 {
9954 super.InitItemVariables();
9955
9961 m_Count = ConfigGetInt(
"count");
9962
9965
9970
9973
9978
9990
9994
9995
9998 if (ConfigIsExisting("canBeSplit"))
9999 {
10002 }
10003
10005 if (ConfigIsExisting("itemBehaviour"))
10007
10008
10011 RegisterNetSyncVariableInt("m_VarLiquidType");
10012 RegisterNetSyncVariableInt("m_Cleanness",0,1);
10013
10014 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
10015 RegisterNetSyncVariableFloat("m_ImpactSpeed");
10016 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
10017
10018 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
10019 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
10020 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
10021 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
10022
10023 RegisterNetSyncVariableBool("m_IsBeingPlaced");
10024 RegisterNetSyncVariableBool("m_IsTakeable");
10025 RegisterNetSyncVariableBool("m_IsHologram");
10026
10029 {
10032 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10033 }
10034
10036
10038 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10040
10042 }
10043
10045 {
10047 }
10048
10050 {
10053 {
10058 }
10059 }
10060
10061 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10062 {
10064 {
10067 }
10068
10070 }
10071
10073 {
10079 }
10080
10082
10084 {
10086
10087 if (!action)
10088 {
10089 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10090 return;
10091 }
10092
10094 if (!ai)
10095 {
10097 return;
10098 }
10099
10101 if (!action_array)
10102 {
10103 action_array = new array<ActionBase_Basic>;
10105 }
10106 if (LogManager.IsActionLogEnable())
10107 {
10108 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10109 }
10110
10111 if (action_array.Find(action) != -1)
10112 {
10113 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10114 }
10115 else
10116 {
10117 action_array.Insert(action);
10118 }
10119 }
10120
10122 {
10123 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10124 ActionBase action = player.GetActionManager().GetAction(actionName);
10127
10128 if (action_array)
10129 {
10130 action_array.RemoveItem(action);
10131 }
10132 }
10133
10134
10135
10137 {
10138 ActionOverrideData overrideData = new ActionOverrideData();
10142
10144 if (!actionMap)
10145 {
10148 }
10149
10150 actionMap.Insert(this.
Type(), overrideData);
10151
10152 }
10153
10155
10157
10158
10160 {
10163
10166
10167 string config_to_search = "CfgVehicles";
10168 string muzzle_owner_config;
10169
10171 {
10172 if (IsInherited(Weapon))
10173 config_to_search = "CfgWeapons";
10174
10175 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10176
10177 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10178
10179 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10180
10181 if (config_OnFire_subclass_count > 0)
10182 {
10183 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10184
10185 for (int i = 0; i < config_OnFire_subclass_count; i++)
10186 {
10187 string particle_class = "";
10188 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10189 string config_OnFire_entry = config_OnFire_class + particle_class;
10190 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10191 WPOF_array.Insert(WPOF);
10192 }
10193
10194
10196 }
10197 }
10198
10200 {
10201 config_to_search = "CfgWeapons";
10202 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10203
10204 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10205
10206 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10207
10208 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10209 {
10210 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10211
10212 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10213 {
10214 string particle_class2 = "";
10215 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10216 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10217 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10218 WPOBE_array.Insert(WPOBE);
10219 }
10220
10221
10223 }
10224 }
10225 }
10226
10227
10229 {
10232
10234 {
10235 string config_to_search = "CfgVehicles";
10236
10237 if (IsInherited(Weapon))
10238 config_to_search = "CfgWeapons";
10239
10240 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10241 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10242
10243 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10244 {
10245
10247
10249 {
10251 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10253 return;
10254 }
10255
10258
10259
10260
10261 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10262 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10263
10264 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10265 {
10266 string particle_class = "";
10267 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10268 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10269 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10270
10271 if (entry_type == CT_CLASS)
10272 {
10273 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10274 WPOOH_array.Insert(WPOF);
10275 }
10276 }
10277
10278
10280 }
10281 }
10282 }
10283
10285 {
10287 }
10288
10290 {
10292 {
10294
10297
10300
10301 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10302 }
10303 }
10304
10306 {
10308 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10309
10311 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10312
10314 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10315
10317 {
10319 }
10320 }
10321
10323 {
10325 }
10326
10328 {
10331 else
10333
10335 {
10338 }
10339 else
10340 {
10343
10346 }
10347
10349 }
10350
10352 {
10354 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10355 }
10356
10358 {
10360 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10362 }
10363
10365 {
10367 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10368 }
10369
10371 {
10374
10375 OverheatingParticle OP = new OverheatingParticle();
10380
10382 }
10383
10385 {
10388
10389 return -1;
10390 }
10391
10393 {
10395 {
10398
10399 for (int i = count; i > 0; --i)
10400 {
10401 int id = i - 1;
10404
10407
10408 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10409 {
10410 if (p)
10411 {
10414 }
10415 }
10416 }
10417 }
10418 }
10419
10421 {
10423 {
10425 {
10426 int id = i - 1;
10428
10429 if (OP)
10430 {
10432
10433 if (p)
10434 {
10436 }
10437
10438 delete OP;
10439 }
10440 }
10441
10444 }
10445 }
10446
10449 {
10450 return 0.0;
10451 }
10452
10453
10455 {
10456 return 250;
10457 }
10458
10460 {
10461 return 0;
10462 }
10463
10466 {
10468 return true;
10469
10470 return false;
10471 }
10472
10475 {
10478
10480 {
10482 }
10483 else
10484 {
10485
10487 }
10488
10490 }
10491
10498 {
10499 return -1;
10500 }
10501
10502
10503
10504
10506 {
10508 {
10509 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10510 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10511
10512 if (r_index >= 0)
10513 {
10514 InventoryLocation r_il = new InventoryLocation;
10515 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10516
10517 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10520 {
10521 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10522 }
10524 {
10525 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10526 }
10527
10528 }
10529
10530 player.GetHumanInventory().ClearUserReservedLocation(this);
10531 }
10532
10535 }
10536
10537
10538
10539
10541 {
10542 return ItemBase.m_DebugActionsMask;
10543 }
10544
10546 {
10547 return ItemBase.m_DebugActionsMask & mask;
10548 }
10549
10551 {
10552 ItemBase.m_DebugActionsMask = mask;
10553 }
10554
10556 {
10557 ItemBase.m_DebugActionsMask |= mask;
10558 }
10559
10561 {
10562 ItemBase.m_DebugActionsMask &= ~mask;
10563 }
10564
10566 {
10568 {
10570 }
10571 else
10572 {
10574 }
10575 }
10576
10577
10579 {
10580 if (GetEconomyProfile())
10581 {
10582 float q_max = GetEconomyProfile().GetQuantityMax();
10583 if (q_max > 0)
10584 {
10585 float q_min = GetEconomyProfile().GetQuantityMin();
10586 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10587
10589 {
10590 ComponentEnergyManager comp = GetCompEM();
10592 {
10594 }
10595 }
10597 {
10599
10600 }
10601
10602 }
10603 }
10604 }
10605
10608 {
10609 EntityAI parent = GetHierarchyParent();
10610
10611 if (parent)
10612 {
10613 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10614 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10615 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10616 }
10617 }
10618
10621 {
10622 EntityAI parent = GetHierarchyParent();
10623
10624 if (parent)
10625 {
10626 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10627 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10628 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10629 }
10630 }
10631
10633 {
10634
10635
10636
10637
10639
10641 {
10642 if (ScriptInputUserData.CanStoreInputUserData())
10643 {
10644 ScriptInputUserData ctx = new ScriptInputUserData;
10650 ctx.
Write(use_stack_max);
10653
10655 {
10656 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10657 }
10658 }
10659 }
10660 else if (!
g_Game.IsMultiplayer())
10661 {
10663 }
10664 }
10665
10667 {
10669 }
10670
10672 {
10674 }
10675
10677 {
10679 }
10680
10682 {
10683
10684 return false;
10685 }
10686
10688 {
10689 return false;
10690 }
10691
10695 {
10696 return false;
10697 }
10698
10700 {
10701 return "";
10702 }
10703
10705
10707 {
10708 return false;
10709 }
10710
10712 {
10713 return true;
10714 }
10715
10716
10717
10719 {
10720 return true;
10721 }
10722
10724 {
10725 return true;
10726 }
10727
10729 {
10730 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10732 }
10733
10735 {
10737 }
10738
10740 {
10742 if (!is_being_placed)
10744 SetSynchDirty();
10745 }
10746
10747
10749
10751 {
10753 }
10754
10756 {
10758 }
10759
10761 {
10762 return 1;
10763 }
10764
10766 {
10767 return false;
10768 }
10769
10771 {
10773 SetSynchDirty();
10774 }
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10811 {
10812 super.OnMovedInsideCargo(container);
10813
10814 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10815 }
10816
10817 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10818 {
10819 super.EEItemLocationChanged(oldLoc, newLoc);
10820
10821 PlayerBase newPlayer = null;
10822 PlayerBase oldPlayer = null;
10823
10824 if (newLoc.GetParent())
10825 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10826
10827 if (oldLoc.GetParent())
10828 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10829
10831 {
10832 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10833
10834 if (rIndex >= 0)
10835 {
10836 InventoryLocation rIl = new InventoryLocation;
10837 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10838
10839 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10842 {
10843 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10844 }
10846 {
10848 }
10849
10850 }
10851 }
10852
10854 {
10855 if (newPlayer)
10856 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10857
10858 if (newPlayer == oldPlayer)
10859 {
10860 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10861 {
10863 {
10864 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10865 {
10866 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10867 }
10868 }
10869 else
10870 {
10871 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10872 }
10873 }
10874
10875 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10876 {
10877 int type = oldLoc.GetType();
10879 {
10880 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10881 }
10883 {
10884 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10885 }
10886 }
10887 if (!m_OldLocation)
10888 {
10889 m_OldLocation = new InventoryLocation;
10890 }
10891 m_OldLocation.Copy(oldLoc);
10892 }
10893 else
10894 {
10895 if (m_OldLocation)
10896 {
10897 m_OldLocation.Reset();
10898 }
10899 }
10900
10901 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10902 }
10903 else
10904 {
10905 if (newPlayer)
10906 {
10907 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10908 if (resIndex >= 0)
10909 {
10910 InventoryLocation il = new InventoryLocation;
10911 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10913 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10916 {
10917 il.
GetParent().GetOnReleaseLock().Invoke(it);
10918 }
10920 {
10922 }
10923
10924 }
10925 }
10927 {
10928
10930 }
10931
10932 if (m_OldLocation)
10933 {
10934 m_OldLocation.Reset();
10935 }
10936 }
10937
10939 {
10940 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10941 }
10942
10944 {
10945 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10946 }
10947 }
10948
10949 override void EOnContact(IEntity other, Contact extra)
10950 {
10952 {
10953 int liquidType = -1;
10955 if (impactSpeed > 0.0)
10956 {
10958 #ifndef SERVER
10960 #else
10962 SetSynchDirty();
10963 #endif
10965 }
10966 }
10967
10968 #ifdef SERVER
10969 if (GetCompEM() && GetCompEM().IsPlugged())
10970 {
10971 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10972 GetCompEM().UnplugThis();
10973 }
10974 #endif
10975 }
10976
10978
10980 {
10982 }
10983
10985 {
10986
10987 }
10988
10990 {
10991 super.OnItemLocationChanged(old_owner, new_owner);
10992
10993 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10994 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10995
10996 if (!relatedPlayer && playerNew)
10997 relatedPlayer = playerNew;
10998
10999 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
11000 {
11002 if (actionMgr)
11003 {
11004 ActionBase currentAction = actionMgr.GetRunningAction();
11005 if (currentAction)
11007 }
11008 }
11009
11010 Man ownerPlayerOld = null;
11011 Man ownerPlayerNew = null;
11012
11013 if (old_owner)
11014 {
11015 if (old_owner.
IsMan())
11016 {
11017 ownerPlayerOld = Man.Cast(old_owner);
11018 }
11019 else
11020 {
11021 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
11022 }
11023 }
11024 else
11025 {
11027 {
11029
11030 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11031 {
11032 GetCompEM().UnplugThis();
11033 }
11034 }
11035 }
11036
11037 if (new_owner)
11038 {
11039 if (new_owner.
IsMan())
11040 {
11041 ownerPlayerNew = Man.Cast(new_owner);
11042 }
11043 else
11044 {
11045 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11046 }
11047 }
11048
11049 if (ownerPlayerOld != ownerPlayerNew)
11050 {
11051 if (ownerPlayerOld)
11052 {
11053 array<EntityAI> subItemsExit = new array<EntityAI>;
11055 for (int i = 0; i < subItemsExit.Count(); i++)
11056 {
11059 }
11060 }
11061
11062 if (ownerPlayerNew)
11063 {
11064 array<EntityAI> subItemsEnter = new array<EntityAI>;
11066 for (int j = 0; j < subItemsEnter.Count(); j++)
11067 {
11070 }
11071 }
11072 }
11073 else if (ownerPlayerNew != null)
11074 {
11075 PlayerBase nplayer;
11076 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11077 {
11078 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11080 for (int k = 0; k < subItemsUpdate.Count(); k++)
11081 {
11083 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11084 }
11085 }
11086 }
11087
11088 if (old_owner)
11089 old_owner.OnChildItemRemoved(this);
11090 if (new_owner)
11091 new_owner.OnChildItemReceived(this);
11092 }
11093
11094
11096 {
11097 super.EEDelete(parent);
11098 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11099 if (player)
11100 {
11102
11103 if (player.IsAlive())
11104 {
11105 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11106 if (r_index >= 0)
11107 {
11108 InventoryLocation r_il = new InventoryLocation;
11109 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11110
11111 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11114 {
11115 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11116 }
11118 {
11119 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11120 }
11121
11122 }
11123
11124 player.RemoveQuickBarEntityShortcut(this);
11125 }
11126 }
11127 }
11128
11130 {
11131 super.EEKilled(killer);
11132
11135 {
11136 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11137 {
11138 if (IsMagazine())
11139 {
11140 if (Magazine.Cast(this).GetAmmoCount() > 0)
11141 {
11143 }
11144 }
11145 else
11146 {
11148 }
11149 }
11150 }
11151 }
11152
11154 {
11155 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11156
11157 super.OnWasAttached(parent, slot_id);
11158
11161
11164 }
11165
11167 {
11168 super.OnWasDetached(parent, slot_id);
11169
11172
11175 }
11176
11178 {
11179 int idx;
11182
11183 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11184 if (inventory_slots.Count() < 1)
11185 {
11186 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11187 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11188 }
11189 else
11190 {
11191 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11192 }
11193
11194 idx = inventory_slots.Find(slot);
11195 if (idx < 0)
11196 return "";
11197
11198 return attach_types.Get(idx);
11199 }
11200
11202 {
11203 int idx = -1;
11204 string slot;
11205
11208
11209 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11210 if (inventory_slots.Count() < 1)
11211 {
11212 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11213 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11214 }
11215 else
11216 {
11217 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11218 if (detach_types.Count() < 1)
11219 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11220 }
11221
11222 for (int i = 0; i < inventory_slots.Count(); i++)
11223 {
11224 slot = inventory_slots.Get(i);
11225 }
11226
11227 if (slot != "")
11228 {
11229 if (detach_types.Count() == 1)
11230 idx = 0;
11231 else
11232 idx = inventory_slots.Find(slot);
11233 }
11234 if (idx < 0)
11235 return "";
11236
11237 return detach_types.Get(idx);
11238 }
11239
11241 {
11242
11244
11245
11246 float min_time = 1;
11247 float max_time = 3;
11248 float delay = Math.RandomFloat(min_time, max_time);
11249
11250 explode_timer.Run(delay, this, "DoAmmoExplosion");
11251 }
11252
11254 {
11255 Magazine magazine = Magazine.Cast(this);
11256 int pop_sounds_count = 6;
11257 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11258
11259
11260 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11261 string sound_name = pop_sounds[ sound_idx ];
11262 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11263
11264
11265 magazine.ServerAddAmmoCount(-1);
11266
11267
11268 float min_temp_to_explode = 100;
11269
11270 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11271 {
11273 }
11274 }
11275
11276
11277 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11278 {
11279 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11280
11281 const int CHANCE_DAMAGE_CARGO = 4;
11282 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11283 const int CHANCE_DAMAGE_NOTHING = 2;
11284
11286 {
11287 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11288 int chances;
11289 int rnd;
11290
11291 if (GetInventory().GetCargo())
11292 {
11293 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11294 rnd = Math.RandomInt(0,chances);
11295
11296 if (rnd < CHANCE_DAMAGE_CARGO)
11297 {
11299 }
11300 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11301 {
11303 }
11304 }
11305 else
11306 {
11307 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11308 rnd = Math.RandomInt(0,chances);
11309
11310 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11311 {
11313 }
11314 }
11315 }
11316 }
11317
11319 {
11320 CargoBase cargo = GetInventory().GetCargo();
11321 if (cargo)
11322 {
11324 if (item_count > 0)
11325 {
11326 int random_pick = Math.RandomInt(0, item_count);
11328 if (!item.IsExplosive())
11329 {
11330 item.AddHealth("","",damage);
11331 return true;
11332 }
11333 }
11334 }
11335 return false;
11336 }
11337
11339 {
11340 GameInventory inventory = GetInventory();
11342 if (attachment_count > 0)
11343 {
11344 int random_pick = Math.RandomInt(0, attachment_count);
11346 if (!attachment.IsExplosive())
11347 {
11348 attachment.AddHealth("","",damage);
11349 return true;
11350 }
11351 }
11352 return false;
11353 }
11354
11356 {
11358 }
11359
11361 {
11363 return GetInventory().CanRemoveEntity();
11364
11365 return false;
11366 }
11367
11369 {
11370
11372 return false;
11373
11374
11376 return false;
11377
11378
11379
11381 if (delta == 0)
11382 return false;
11383
11384
11385 return true;
11386 }
11387
11389 {
11391 {
11392 if (ScriptInputUserData.CanStoreInputUserData())
11393 {
11394 ScriptInputUserData ctx = new ScriptInputUserData;
11399 ctx.
Write(destination_entity);
11401 ctx.
Write(slot_id);
11403 }
11404 }
11405 else if (!
g_Game.IsMultiplayer())
11406 {
11408 }
11409 }
11410
11412 {
11413 float split_quantity_new;
11417 InventoryLocation loc = new InventoryLocation;
11418
11419 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11420 {
11422 split_quantity_new = stack_max;
11423 else
11425
11427 {
11428 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11429 if (new_item)
11430 {
11431 new_item.SetResultOfSplit(true);
11432 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11434 new_item.
SetQuantity(split_quantity_new,
false,
true);
11435 }
11436 }
11437 }
11438 else if (destination_entity && slot_id == -1)
11439 {
11440 if (quantity > stack_max)
11441 split_quantity_new = stack_max;
11442 else
11443 split_quantity_new = quantity;
11444
11446 {
11447 GameInventory destinationInventory = destination_entity.GetInventory();
11449 {
11452 }
11453
11454 if (new_item)
11455 {
11456 new_item.SetResultOfSplit(true);
11457 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11459 new_item.
SetQuantity(split_quantity_new,
false,
true);
11460 }
11461 }
11462 }
11463 else
11464 {
11465 if (stack_max != 0)
11466 {
11468 {
11470 }
11471
11472 if (split_quantity_new == 0)
11473 {
11474 if (!
g_Game.IsMultiplayer())
11475 player.PhysicalPredictiveDropItem(this);
11476 else
11477 player.ServerDropEntity(this);
11478 return;
11479 }
11480
11482 {
11484
11485 if (new_item)
11486 {
11487 new_item.SetResultOfSplit(true);
11488 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11491 new_item.PlaceOnSurface();
11492 }
11493 }
11494 }
11495 }
11496 }
11497
11499 {
11500 float split_quantity_new;
11504 InventoryLocation loc = new InventoryLocation;
11505
11506 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11507 {
11509 split_quantity_new = stack_max;
11510 else
11512
11514 {
11515 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11516 if (new_item)
11517 {
11518 new_item.SetResultOfSplit(true);
11519 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11521 new_item.
SetQuantity(split_quantity_new,
false,
true);
11522 }
11523 }
11524 }
11525 else if (destination_entity && slot_id == -1)
11526 {
11527 if (quantity > stack_max)
11528 split_quantity_new = stack_max;
11529 else
11530 split_quantity_new = quantity;
11531
11533 {
11534 GameInventory destinationInventory = destination_entity.GetInventory();
11536 {
11539 }
11540
11541 if (new_item)
11542 {
11543 new_item.SetResultOfSplit(true);
11544 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11546 new_item.
SetQuantity(split_quantity_new,
false,
true);
11547 }
11548 }
11549 }
11550 else
11551 {
11552 if (stack_max != 0)
11553 {
11555 {
11557 }
11558
11560 {
11562
11563 if (new_item)
11564 {
11565 new_item.SetResultOfSplit(true);
11566 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11569 new_item.PlaceOnSurface();
11570 }
11571 }
11572 }
11573 }
11574 }
11575
11577 {
11579 {
11580 if (ScriptInputUserData.CanStoreInputUserData())
11581 {
11582 ScriptInputUserData ctx = new ScriptInputUserData;
11587 dst.WriteToContext(ctx);
11589 }
11590 }
11591 else if (!
g_Game.IsMultiplayer())
11592 {
11594 }
11595 }
11596
11598 {
11600 {
11601 if (ScriptInputUserData.CanStoreInputUserData())
11602 {
11603 ScriptInputUserData ctx = new ScriptInputUserData;
11608 ctx.
Write(destination_entity);
11614 }
11615 }
11616 else if (!
g_Game.IsMultiplayer())
11617 {
11619 }
11620 }
11621
11623 {
11625 }
11626
11628 {
11630 float split_quantity_new;
11632 if (dst.IsValid())
11633 {
11634 int slot_id = dst.GetSlot();
11636
11637 if (quantity > stack_max)
11638 split_quantity_new = stack_max;
11639 else
11640 split_quantity_new = quantity;
11641
11643 {
11645
11646 if (new_item)
11647 {
11648 new_item.SetResultOfSplit(true);
11649 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11651 new_item.
SetQuantity(split_quantity_new,
false,
true);
11652 }
11653
11654 return new_item;
11655 }
11656 }
11657
11658 return null;
11659 }
11660
11662 {
11664 float split_quantity_new;
11666 if (destination_entity)
11667 {
11669 if (quantity > stackable)
11670 split_quantity_new = stackable;
11671 else
11672 split_quantity_new = quantity;
11673
11675 {
11676 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11677 if (new_item)
11678 {
11679 new_item.SetResultOfSplit(true);
11680 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11682 new_item.
SetQuantity(split_quantity_new,
false,
true);
11683 }
11684 }
11685 }
11686 }
11687
11689 {
11691 {
11692 if (ScriptInputUserData.CanStoreInputUserData())
11693 {
11694 ScriptInputUserData ctx = new ScriptInputUserData;
11699 ItemBase destination_entity =
this;
11700 ctx.
Write(destination_entity);
11704 }
11705 }
11706 else if (!
g_Game.IsMultiplayer())
11707 {
11709 }
11710 }
11711
11713 {
11715 float split_quantity_new;
11717 if (player)
11718 {
11720 if (quantity > stackable)
11721 split_quantity_new = stackable;
11722 else
11723 split_quantity_new = quantity;
11724
11726 {
11727 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11728 new_item =
ItemBase.Cast(in_hands);
11729 if (new_item)
11730 {
11731 new_item.SetResultOfSplit(true);
11732 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11734 new_item.SetQuantity(split_quantity_new, false, true);
11735 }
11736 }
11737 }
11738 }
11739
11741 {
11743 float split_quantity_new = Math.Floor(quantity * 0.5);
11744
11746 return;
11747
11749
11750 if (new_item)
11751 {
11752 if (new_item.GetQuantityMax() < split_quantity_new)
11753 {
11754 split_quantity_new = new_item.GetQuantityMax();
11755 }
11756
11757 new_item.SetResultOfSplit(true);
11758 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11759
11761 {
11764 }
11765 else
11766 {
11768 new_item.
SetQuantity(split_quantity_new,
false,
true);
11769 }
11770 }
11771 }
11772
11774 {
11776 float split_quantity_new = Math.Floor(quantity / 2);
11777
11779 return;
11780
11781 InventoryLocation invloc = new InventoryLocation;
11783
11785 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11786
11787 if (new_item)
11788 {
11789 if (new_item.GetQuantityMax() < split_quantity_new)
11790 {
11791 split_quantity_new = new_item.GetQuantityMax();
11792 }
11794 {
11797 }
11798 else if (split_quantity_new > 1)
11799 {
11801 new_item.
SetQuantity(split_quantity_new,
false,
true);
11802 }
11803 }
11804 }
11805
11808 {
11809 SetWeightDirty();
11811
11812 if (parent)
11813 parent.OnAttachmentQuantityChangedEx(this, delta);
11814
11816 {
11818 {
11820 }
11822 {
11823 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11825 }
11826 }
11827 }
11828
11831 {
11832
11833 }
11834
11837 {
11839 }
11840
11842 {
11843 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11844
11846 {
11847 if (newLevel == GameConstants.STATE_RUINED)
11848 {
11850 EntityAI parent = GetHierarchyParent();
11851 if (parent && parent.IsFireplace())
11852 {
11853 CargoBase cargo = GetInventory().GetCargo();
11854 if (cargo)
11855 {
11857 {
11859 }
11860 }
11861 }
11862 }
11863
11865 {
11866
11868 return;
11869 }
11870
11871 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11872 {
11874 }
11875 }
11876 }
11877
11878
11880 {
11881 super.OnRightClick();
11882
11884 {
11886 {
11887 if (ScriptInputUserData.CanStoreInputUserData())
11888 {
11889 EntityAI root = GetHierarchyRoot();
11890 Man playerOwner = GetHierarchyRootPlayer();
11891 InventoryLocation dst = new InventoryLocation;
11892
11893
11894 if (!playerOwner && root && root == this)
11895 {
11897 }
11898 else
11899 {
11900
11901 GetInventory().GetCurrentInventoryLocation(dst);
11903 {
11904 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11906 {
11908 }
11909 else
11910 {
11912
11913
11914 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11915 {
11917 }
11918 else
11919 {
11920 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11921 }
11922 }
11923 }
11924 }
11925
11926 ScriptInputUserData ctx = new ScriptInputUserData;
11934 }
11935 }
11936 else if (!
g_Game.IsMultiplayer())
11937 {
11939 }
11940 }
11941 }
11942
11944 {
11945 if (root)
11946 {
11947 vector m4[4];
11948 root.GetTransform(m4);
11949 dst.SetGround(this, m4);
11950 }
11951 else
11952 {
11953 GetInventory().GetCurrentInventoryLocation(dst);
11954 }
11955 }
11956
11957 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11958 {
11959
11960 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11961 return false;
11962
11963 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11964 return false;
11965
11966
11968 return false;
11969
11970
11971 Magazine mag = Magazine.Cast(this);
11972 if (mag)
11973 {
11974 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11975 return false;
11976
11977 if (stack_max_limit)
11978 {
11979 Magazine other_mag = Magazine.Cast(other_item);
11980 if (other_item)
11981 {
11982 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11983 return false;
11984 }
11985
11986 }
11987 }
11988 else
11989 {
11990
11992 return false;
11993
11995 return false;
11996 }
11997
11998 PlayerBase player = null;
11999 if (CastTo(player, GetHierarchyRootPlayer()))
12000 {
12001 if (player.GetInventory().HasAttachment(this))
12002 return false;
12003
12004 if (player.IsItemsToDelete())
12005 return false;
12006 }
12007
12008 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
12009 return false;
12010
12011 int slotID;
12013 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
12014 return false;
12015
12016 return true;
12017 }
12018
12020 {
12022 }
12023
12025 {
12026 return m_IsResultOfSplit;
12027 }
12028
12030 {
12031 m_IsResultOfSplit = value;
12032 }
12033
12035 {
12037 }
12038
12040 {
12041 float other_item_quantity = other_item.GetQuantity();
12042 float this_free_space;
12043
12045
12047
12048 if (other_item_quantity > this_free_space)
12049 {
12050 return this_free_space;
12051 }
12052 else
12053 {
12054 return other_item_quantity;
12055 }
12056 }
12057
12059 {
12061 }
12062
12064 {
12066 return;
12067
12068 if (!IsMagazine() && other_item)
12069 {
12071 if (quantity_used != 0)
12072 {
12073 float hp1 = GetHealth01("","");
12074 float hp2 = other_item.GetHealth01("","");
12075 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12076 hpResult = hpResult / (
GetQuantity() + quantity_used);
12077
12078 hpResult *= GetMaxHealth();
12079 Math.Round(hpResult);
12080 SetHealth("", "Health", hpResult);
12081
12083 other_item.AddQuantity(-quantity_used);
12084 }
12085 }
12087 }
12088
12090 {
12091 #ifdef SERVER
12092 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12093 GetHierarchyParent().IncreaseLifetimeUp();
12094 #endif
12095 };
12096
12098 {
12099 PlayerBase p = PlayerBase.Cast(player);
12100
12101 array<int> recipesIds = p.m_Recipes;
12102 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12103 if (moduleRecipesManager)
12104 {
12105 EntityAI itemInHands = player.GetEntityInHands();
12106 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12107 }
12108
12109 for (int i = 0;i < recipesIds.Count(); i++)
12110 {
12111 int key = recipesIds.Get(i);
12112 string recipeName = moduleRecipesManager.GetRecipeName(key);
12114 }
12115 }
12116
12117
12118 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12119 {
12120 super.GetDebugActions(outputList);
12121
12122
12128
12129
12134
12139
12140
12144
12145
12147 {
12151 }
12152
12155
12156
12160
12162
12163 InventoryLocation loc = new InventoryLocation();
12164 GetInventory().GetCurrentInventoryLocation(loc);
12166 {
12167 if (Gizmo_IsSupported())
12170 }
12171
12173 }
12174
12175
12176
12177
12179 {
12180 super.OnAction(action_id, player, ctx);
12181
12183 {
12184 switch (action_id)
12185 {
12189 return true;
12193 return true;
12194 }
12195 }
12196
12198 {
12199 switch (action_id)
12200 {
12202 Delete();
12203 return true;
12204 }
12205 }
12206
12207 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12208 {
12209 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12210 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12211 PlayerBase p = PlayerBase.Cast(player);
12212 if (
EActions.RECIPES_RANGE_START < 1000)
12213 {
12214 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12215 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12216 }
12217 }
12218 #ifndef SERVER
12219 else if (action_id ==
EActions.WATCH_PLAYER)
12220 {
12221 PluginDeveloper.SetDeveloperItemClientEx(player);
12222 }
12223 #endif
12225 {
12226 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12227 {
12228 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12229 OnDebugButtonPressServer(id + 1);
12230 }
12231
12232 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12233 {
12234 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12236 }
12237
12238 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12239 {
12240 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12242 }
12243
12244 else if (action_id ==
EActions.ADD_QUANTITY)
12245 {
12246 if (IsMagazine())
12247 {
12248 Magazine mag = Magazine.Cast(this);
12249 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12250 }
12251 else
12252 {
12254 }
12255
12256 if (m_EM)
12257 {
12258 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12259 }
12260
12261 }
12262
12263 else if (action_id ==
EActions.REMOVE_QUANTITY)
12264 {
12265 if (IsMagazine())
12266 {
12267 Magazine mag2 = Magazine.Cast(this);
12268 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12269 }
12270 else
12271 {
12273 }
12274 if (m_EM)
12275 {
12276 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12277 }
12278
12279 }
12280
12281 else if (action_id ==
EActions.SET_QUANTITY_0)
12282 {
12284
12285 if (m_EM)
12286 {
12287 m_EM.SetEnergy(0);
12288 }
12289 }
12290
12291 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12292 {
12294
12295 if (m_EM)
12296 {
12297 m_EM.SetEnergy(m_EM.GetEnergyMax());
12298 }
12299 }
12300
12301 else if (action_id ==
EActions.ADD_HEALTH)
12302 {
12303 AddHealth("","",GetMaxHealth("","Health")/5);
12304 }
12305 else if (action_id ==
EActions.REMOVE_HEALTH)
12306 {
12307 AddHealth("","",-GetMaxHealth("","Health")/5);
12308 }
12309 else if (action_id ==
EActions.DESTROY_HEALTH)
12310 {
12311 SetHealth01("","",0);
12312 }
12313 else if (action_id ==
EActions.WATCH_ITEM)
12314 {
12316 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12317 #ifdef DEVELOPER
12318 SetDebugDeveloper_item(this);
12319 #endif
12320 }
12321
12322 else if (action_id ==
EActions.ADD_TEMPERATURE)
12323 {
12324 AddTemperature(20);
12325
12326 }
12327
12328 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12329 {
12330 AddTemperature(-20);
12331
12332 }
12333
12334 else if (action_id ==
EActions.FLIP_FROZEN)
12335 {
12336 SetFrozen(!GetIsFrozen());
12337
12338 }
12339
12340 else if (action_id ==
EActions.ADD_WETNESS)
12341 {
12343
12344 }
12345
12346 else if (action_id ==
EActions.REMOVE_WETNESS)
12347 {
12349
12350 }
12351
12352 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12353 {
12356
12357
12358 }
12359
12360 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12361 {
12364 }
12365
12366 else if (action_id ==
EActions.MAKE_SPECIAL)
12367 {
12368 auto debugParams = DebugSpawnParams.WithPlayer(player);
12369 OnDebugSpawnEx(debugParams);
12370 }
12371
12372 }
12373
12374
12375 return false;
12376 }
12377
12378
12379
12380
12384
12387
12388
12389
12391 {
12392 return false;
12393 }
12394
12395
12397 {
12398 return true;
12399 }
12400
12401
12403 {
12404 return true;
12405 }
12406
12407
12408
12410 {
12411 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12412 return g_Game.ConfigIsExisting(config_path);
12413 }
12414
12417 {
12418 return null;
12419 }
12420
12422 {
12423 return false;
12424 }
12425
12427 {
12428 return false;
12429 }
12430
12434
12435
12437 {
12438 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12439 return module_repairing.CanRepair(this, item_repair_kit);
12440 }
12441
12442
12443 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12444 {
12445 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12446 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12447 }
12448
12449
12451 {
12452
12453
12454
12455
12456
12457
12458
12459
12460 return 1;
12461 }
12462
12463
12464
12466 {
12468 }
12469
12470
12471
12473 {
12475 }
12476
12477
12486 {
12487 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12488
12489 if (player)
12490 {
12491 player.MessageStatus(text);
12492 }
12493 }
12494
12495
12504 {
12505 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12506
12507 if (player)
12508 {
12509 player.MessageAction(text);
12510 }
12511 }
12512
12513
12522 {
12523 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12524
12525 if (player)
12526 {
12527 player.MessageFriendly(text);
12528 }
12529 }
12530
12531
12540 {
12541 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12542
12543 if (player)
12544 {
12545 player.MessageImportant(text);
12546 }
12547 }
12548
12550 {
12551 return true;
12552 }
12553
12554
12555 override bool KindOf(
string tag)
12556 {
12557 bool found = false;
12558 string item_name = this.
GetType();
12560 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12561
12562 int array_size = item_tag_array.Count();
12563 for (int i = 0; i < array_size; i++)
12564 {
12565 if (item_tag_array.Get(i) == tag)
12566 {
12567 found = true;
12568 break;
12569 }
12570 }
12571 return found;
12572 }
12573
12574
12576 {
12577
12578 super.OnRPC(sender, rpc_type,ctx);
12579
12580
12581 switch (rpc_type)
12582 {
12583 #ifndef SERVER
12584 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12585 Param2<bool, string> p = new Param2<bool, string>(false, "");
12586
12588 return;
12589
12590 bool play = p.param1;
12591 string soundSet = p.param2;
12592
12593 if (play)
12594 {
12596 {
12598 {
12600 }
12601 }
12602 else
12603 {
12605 }
12606 }
12607 else
12608 {
12610 }
12611
12612 break;
12613 #endif
12614
12615 }
12616
12618 {
12620 }
12621 }
12622
12623
12624
12625
12627 {
12628 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12629 return plugin.GetID(
name);
12630 }
12631
12633 {
12634 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12635 return plugin.GetName(id);
12636 }
12637
12640 {
12641
12642
12643 int varFlags;
12644 if (!ctx.
Read(varFlags))
12645 return;
12646
12647 if (varFlags & ItemVariableFlags.FLOAT)
12648 {
12650 }
12651 }
12652
12654 {
12655
12656 super.SerializeNumericalVars(floats_out);
12657
12658
12659
12661 {
12663 }
12664
12666 {
12668 }
12669
12671 {
12673 }
12674
12676 {
12681 }
12682
12684 {
12686 }
12687 }
12688
12690 {
12691
12692 super.DeSerializeNumericalVars(floats);
12693
12694
12695 int index = 0;
12696 int mask = Math.Round(floats.Get(index));
12697
12698 index++;
12699
12701 {
12703 {
12705 }
12706 else
12707 {
12708 float quantity = floats.Get(index);
12709 SetQuantity(quantity,
true,
false,
false,
false);
12710 }
12711 index++;
12712 }
12713
12715 {
12716 float wet = floats.Get(index);
12718 index++;
12719 }
12720
12722 {
12723 int liquidtype = Math.Round(floats.Get(index));
12725 index++;
12726 }
12727
12729 {
12731 index++;
12733 index++;
12735 index++;
12737 index++;
12738 }
12739
12741 {
12742 int cleanness = Math.Round(floats.Get(index));
12744 index++;
12745 }
12746 }
12747
12749 {
12750 super.WriteVarsToCTX(ctx);
12751
12752
12754 {
12756 }
12757
12759 {
12761 }
12762
12764 {
12766 }
12767
12769 {
12770 int r,g,b,a;
12776 }
12777
12779 {
12781 }
12782 }
12783
12785 {
12786 if (!super.ReadVarsFromCTX(ctx,version))
12787 return false;
12788
12789 int intValue;
12790 float value;
12791
12792 if (version < 140)
12793 {
12794 if (!ctx.
Read(intValue))
12795 return false;
12796
12797 m_VariablesMask = intValue;
12798 }
12799
12801 {
12802 if (!ctx.
Read(value))
12803 return false;
12804
12806 {
12808 }
12809 else
12810 {
12812 }
12813 }
12814
12815 if (version < 140)
12816 {
12818 {
12819 if (!ctx.
Read(value))
12820 return false;
12821 SetTemperatureDirect(value);
12822 }
12823 }
12824
12826 {
12827 if (!ctx.
Read(value))
12828 return false;
12830 }
12831
12833 {
12834 if (!ctx.
Read(intValue))
12835 return false;
12837 }
12838
12840 {
12841 int r,g,b,a;
12843 return false;
12845 return false;
12847 return false;
12849 return false;
12850
12852 }
12853
12855 {
12856 if (!ctx.
Read(intValue))
12857 return false;
12859 }
12860
12861 if (version >= 138 && version < 140)
12862 {
12864 {
12865 if (!ctx.
Read(intValue))
12866 return false;
12867 SetFrozen(intValue);
12868 }
12869 }
12870
12871 return true;
12872 }
12873
12874
12876 {
12879 {
12881 }
12882
12883 if (!super.OnStoreLoad(ctx, version))
12884 {
12886 return false;
12887 }
12888
12889 if (version >= 114)
12890 {
12891 bool hasQuickBarIndexSaved;
12892
12893 if (!ctx.
Read(hasQuickBarIndexSaved))
12894 {
12896 return false;
12897 }
12898
12899 if (hasQuickBarIndexSaved)
12900 {
12901 int itmQBIndex;
12902
12903
12904 if (!ctx.
Read(itmQBIndex))
12905 {
12907 return false;
12908 }
12909
12910 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12911 if (itmQBIndex != -1 && parentPlayer)
12912 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12913 }
12914 }
12915 else
12916 {
12917
12918 PlayerBase player;
12919 int itemQBIndex;
12920 if (version ==
int.
MAX)
12921 {
12922 if (!ctx.
Read(itemQBIndex))
12923 {
12925 return false;
12926 }
12927 }
12928 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12929 {
12930
12931 if (!ctx.
Read(itemQBIndex))
12932 {
12934 return false;
12935 }
12936 if (itemQBIndex != -1 && player)
12937 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12938 }
12939 }
12940
12941 if (version < 140)
12942 {
12943
12944 if (!LoadVariables(ctx, version))
12945 {
12947 return false;
12948 }
12949 }
12950
12951
12953 {
12955 return false;
12956 }
12957 if (version >= 132)
12958 {
12960 if (raib)
12961 {
12963 {
12965 return false;
12966 }
12967 }
12968 }
12969
12971 return true;
12972 }
12973
12974
12975
12977 {
12978 super.OnStoreSave(ctx);
12979
12980 PlayerBase player;
12981 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12982 {
12984
12985 int itemQBIndex = -1;
12986 itemQBIndex = player.FindQuickBarEntityIndex(this);
12987 ctx.
Write(itemQBIndex);
12988 }
12989 else
12990 {
12992 }
12993
12995
12997 if (raib)
12998 {
13000 }
13001 }
13002
13003
13005 {
13006 super.AfterStoreLoad();
13007
13009 {
13011 }
13012
13014 {
13017 }
13018 }
13019
13021 {
13022 super.EEOnAfterLoad();
13023
13025 {
13027 }
13028
13031 }
13032
13034 {
13035 return false;
13036 }
13037
13038
13039
13041 {
13043 {
13044 #ifdef PLATFORM_CONSOLE
13045
13047 {
13049 if (menu)
13050 {
13052 }
13053 }
13054 #endif
13055 }
13056
13058 {
13061 }
13062
13064 {
13065 SetWeightDirty();
13067 }
13069 {
13072 }
13073
13075 {
13078
13081 }
13083 {
13087 }
13088
13089 super.OnVariablesSynchronized();
13090 }
13091
13092
13093
13095 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13096 {
13097 if (!IsServerCheck(allow_client))
13098 return false;
13099
13101 return false;
13102
13105
13106 if (value <= (min + 0.001))
13107 value = min;
13108
13109 if (value == min)
13110 {
13111 if (destroy_config)
13112 {
13113 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13114 if (dstr)
13115 {
13117 this.Delete();
13118 return true;
13119 }
13120 }
13121 else if (destroy_forced)
13122 {
13124 this.Delete();
13125 return true;
13126 }
13127
13129 }
13130
13133
13135 {
13136 EntityAI parent = GetHierarchyRoot();
13137 InventoryLocation iLoc = new InventoryLocation();
13138 GetInventory().GetCurrentInventoryLocation(iLoc);
13140 {
13141 int iLocSlot = iLoc.
GetSlot();
13143 {
13145 }
13147 {
13149 }
13150 }
13151 }
13152
13154 {
13156
13157 if (delta)
13159 }
13160
13162
13163 return false;
13164 }
13165
13166
13168 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13169 {
13171 }
13172
13174 {
13177 }
13178
13180 {
13183 }
13184
13186 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13187 {
13188 float value_clamped = Math.Clamp(value, 0, 1);
13190 SetQuantity(result, destroy_config, destroy_forced);
13191 }
13192
13193
13196 {
13198 }
13199
13201 {
13203 }
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13215 {
13216 int slot = -1;
13217 GameInventory inventory = GetInventory();
13218 if (inventory)
13219 {
13220 InventoryLocation il = new InventoryLocation;
13223 }
13224
13226 }
13227
13229 {
13230 float quantity_max = 0;
13231
13233 {
13234 if (attSlotID != -1)
13235 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13236
13237 if (quantity_max <= 0)
13239 }
13240
13241 if (quantity_max <= 0)
13243
13244 return quantity_max;
13245 }
13246
13248 {
13250 }
13251
13253 {
13255 }
13256
13257
13259 {
13261 }
13262
13264 {
13266 }
13267
13269 {
13271 }
13272
13273
13275 {
13276
13277 float weightEx = GetWeightEx();
13278 float special = GetInventoryAndCargoWeight();
13279 return weightEx - special;
13280 }
13281
13282
13284 {
13286 }
13287
13289 {
13291 {
13292 #ifdef DEVELOPER
13293 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13294 {
13295 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13297 }
13298 #endif
13299
13300 return GetQuantity() * GetConfigWeightModified();
13301 }
13302 else if (HasEnergyManager())
13303 {
13304 #ifdef DEVELOPER
13305 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13306 {
13307 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13308 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13309 }
13310 #endif
13311 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13312 }
13313 else
13314 {
13315 #ifdef DEVELOPER
13316 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13317 {
13318 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13319 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13320 }
13321 #endif
13322 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13323 }
13324 }
13325
13328 {
13329 int item_count = 0;
13331
13332 GameInventory inventory = GetInventory();
13333 CargoBase cargo = inventory.
GetCargo();
13334 if (cargo != NULL)
13335 {
13337 }
13338
13340 for (int i = 0; i < nAttachments; ++i)
13341 {
13343 if (item)
13344 item_count += item.GetNumberOfItems();
13345 }
13346 return item_count;
13347 }
13348
13351 {
13352 float weight = 0;
13353 float wetness = 1;
13354 if (include_wetness)
13357 {
13358 weight = wetness * m_ConfigWeight;
13359 }
13361 {
13362 weight = 1;
13363 }
13364 return weight;
13365 }
13366
13367
13368
13370 {
13371 GameInventory inventory = GetInventory();
13372 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13373 {
13374 array<EntityAI> items = new array<EntityAI>;
13376 for (int i = 0; i < items.Count(); ++i)
13377 {
13379 if (item)
13380 {
13381 g_Game.ObjectDelete(item);
13382 }
13383 }
13384 }
13385 }
13386
13387
13388
13389
13391 {
13392 float energy = 0;
13393 if (HasEnergyManager())
13394 {
13395 energy = GetCompEM().GetEnergy();
13396 }
13397 return energy;
13398 }
13399
13400
13402 {
13403 super.OnEnergyConsumed();
13404
13406 }
13407
13409 {
13410 super.OnEnergyAdded();
13411
13413 }
13414
13415
13417 {
13418 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13419 {
13421 {
13422 float energy_0to1 = GetCompEM().GetEnergy0To1();
13424 }
13425 }
13426 }
13427
13428
13430 {
13431 return ConfigGetFloat("heatIsolation");
13432 }
13433
13435 {
13437 }
13438
13440 {
13441 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13442 if (
g_Game.ConfigIsExisting(paramPath))
13443 return g_Game.ConfigGetFloat(paramPath);
13444
13445 return 0.0;
13446 }
13447
13449 {
13450 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13451 if (
g_Game.ConfigIsExisting(paramPath))
13452 return g_Game.ConfigGetFloat(paramPath);
13453
13454 return 0.0;
13455 }
13456
13457 override void SetWet(
float value,
bool allow_client =
false)
13458 {
13459 if (!IsServerCheck(allow_client))
13460 return;
13461
13464
13466
13467 m_VarWet = Math.Clamp(value, min, max);
13468
13470 {
13473 }
13474 }
13475
13476 override void AddWet(
float value)
13477 {
13479 }
13480
13482 {
13484 }
13485
13487 {
13489 }
13490
13492 {
13494 }
13495
13497 {
13499 }
13500
13502 {
13504 }
13505
13506 override void OnWetChanged(
float newVal,
float oldVal)
13507 {
13510 if (newLevel != oldLevel)
13511 {
13513 }
13514 }
13515
13517 {
13518 SetWeightDirty();
13519 }
13520
13522 {
13523 return GetWetLevelInternal(
m_VarWet);
13524 }
13525
13526
13527
13529 {
13531 }
13532
13534 {
13536 }
13537
13539 {
13541 }
13542
13544 {
13546 }
13547
13548
13549
13551 {
13552 if (ConfigIsExisting("itemModelLength"))
13553 {
13554 return ConfigGetFloat("itemModelLength");
13555 }
13556 return 0;
13557 }
13558
13560 {
13561 if (ConfigIsExisting("itemAttachOffset"))
13562 {
13563 return ConfigGetFloat("itemAttachOffset");
13564 }
13565 return 0;
13566 }
13567
13568 override void SetCleanness(
int value,
bool allow_client =
false)
13569 {
13570 if (!IsServerCheck(allow_client))
13571 return;
13572
13574
13576
13579 }
13580
13582 {
13584 }
13585
13587 {
13588 return true;
13589 }
13590
13591
13592
13593
13595 {
13597 }
13598
13600 {
13602 }
13603
13604
13605
13606
13607 override void SetColor(
int r,
int g,
int b,
int a)
13608 {
13614 }
13616 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13617 {
13622 }
13623
13625 {
13627 }
13628
13631 {
13632 int r,g,b,a;
13634 r = r/255;
13635 g = g/255;
13636 b = b/255;
13637 a = a/255;
13638 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13639 }
13640
13641
13642
13643 override void SetLiquidType(
int value,
bool allow_client =
false)
13644 {
13645 if (!IsServerCheck(allow_client))
13646 return;
13647
13652 }
13653
13655 {
13656 return ConfigGetInt("varLiquidTypeInit");
13657 }
13658
13660 {
13662 }
13663
13665 {
13667 SetFrozen(false);
13668 }
13669
13672 {
13673 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13674 }
13675
13676
13679 {
13680 PlayerBase nplayer;
13681 if (PlayerBase.CastTo(nplayer, player))
13682 {
13684 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13685 }
13686 }
13687
13688
13691 {
13692 PlayerBase nplayer;
13693 if (PlayerBase.CastTo(nplayer,player))
13694 {
13695 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13696 }
13697
13698 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13699
13700 if (HasEnergyManager())
13701 {
13702 GetCompEM().UpdatePlugState();
13703 }
13704 }
13705
13706
13708 {
13709 super.OnPlacementStarted(player);
13710
13712 }
13713
13714 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13715 {
13717 {
13718 m_AdminLog.OnPlacementComplete(player,
this);
13719 }
13720
13721 super.OnPlacementComplete(player, position, orientation);
13722 }
13723
13724
13725
13726
13727
13729 {
13731 {
13732 return true;
13733 }
13734 else
13735 {
13736 return false;
13737 }
13738 }
13739
13740
13742 {
13744 {
13746 }
13747 }
13748
13749
13751 {
13753 }
13754
13756 {
13758 }
13759
13760 override void InsertAgent(
int agent,
float count = 1)
13761 {
13762 if (count < 1)
13763 return;
13764
13766 }
13767
13770 {
13772 }
13773
13774
13776 {
13778 }
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13822 {
13824 return false;
13825 return true;
13826 }
13827
13829 {
13830
13832 }
13833
13834
13837 {
13838 super.CheckForRoofLimited(timeTresholdMS);
13839
13840 float time =
g_Game.GetTime();
13841 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13842 {
13843 m_PreviousRoofTestTime = time;
13844 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13845 }
13846 }
13847
13848
13850 {
13852 {
13853 return 0;
13854 }
13855
13856 if (GetInventory().GetAttachmentSlotsCount() != 0)
13857 {
13858 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13859 if (filter)
13860 return filter.GetProtectionLevel(type, false, system);
13861 else
13862 return 0;
13863 }
13864
13865 string subclassPath, entryName;
13866
13867 switch (type)
13868 {
13870 entryName = "biological";
13871 break;
13873 entryName = "chemical";
13874 break;
13875 default:
13876 entryName = "biological";
13877 break;
13878 }
13879
13880 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13881
13882 return g_Game.ConfigGetFloat(subclassPath + entryName);
13883 }
13884
13885
13886
13889 {
13890 if (!IsMagazine())
13892
13894 }
13895
13896
13897
13898
13899
13904 {
13905 return true;
13906 }
13907
13909 {
13911 }
13912
13913
13914
13915
13916
13918 {
13919 if (parent)
13920 {
13921 if (parent.IsInherited(DayZInfected))
13922 return true;
13923
13924 if (!parent.IsRuined())
13925 return true;
13926 }
13927
13928 return true;
13929 }
13930
13932 {
13933 if (!super.CanPutAsAttachment(parent))
13934 {
13935 return false;
13936 }
13937
13938 if (!IsRuined() && !parent.IsRuined())
13939 {
13940 return true;
13941 }
13942
13943 return false;
13944 }
13945
13947 {
13948
13949
13950
13951
13952 return super.CanReceiveItemIntoCargo(item);
13953 }
13954
13956 {
13957
13958
13959
13960
13961 GameInventory attachmentInv = attachment.GetInventory();
13963 {
13964 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13965 return false;
13966 }
13967
13968 InventoryLocation loc = new InventoryLocation();
13969 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13970 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13971 return false;
13972
13973 return super.CanReceiveAttachment(attachment, slotId);
13974 }
13975
13977 {
13978 if (!super.CanReleaseAttachment(attachment))
13979 return false;
13980
13981 return GetInventory().AreChildrenAccessible();
13982 }
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14005 {
14006 int id = muzzle_owner.GetMuzzleID();
14007 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
14008
14009 if (WPOF_array)
14010 {
14011 for (int i = 0; i < WPOF_array.Count(); i++)
14012 {
14013 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
14014
14015 if (WPOF)
14016 {
14017 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
14018 }
14019 }
14020 }
14021 }
14022
14023
14025 {
14026 int id = muzzle_owner.GetMuzzleID();
14028
14029 if (WPOBE_array)
14030 {
14031 for (int i = 0; i < WPOBE_array.Count(); i++)
14032 {
14033 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14034
14035 if (WPOBE)
14036 {
14037 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14038 }
14039 }
14040 }
14041 }
14042
14043
14045 {
14046 int id = muzzle_owner.GetMuzzleID();
14047 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14048
14049 if (WPOOH_array)
14050 {
14051 for (int i = 0; i < WPOOH_array.Count(); i++)
14052 {
14053 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14054
14055 if (WPOOH)
14056 {
14057 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14058 }
14059 }
14060 }
14061 }
14062
14063
14065 {
14066 int id = muzzle_owner.GetMuzzleID();
14067 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14068
14069 if (WPOOH_array)
14070 {
14071 for (int i = 0; i < WPOOH_array.Count(); i++)
14072 {
14073 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14074
14075 if (WPOOH)
14076 {
14077 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14078 }
14079 }
14080 }
14081 }
14082
14083
14085 {
14086 int id = muzzle_owner.GetMuzzleID();
14087 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14088
14089 if (WPOOH_array)
14090 {
14091 for (int i = 0; i < WPOOH_array.Count(); i++)
14092 {
14093 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14094
14095 if (WPOOH)
14096 {
14097 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14098 }
14099 }
14100 }
14101 }
14102
14103
14104
14106 {
14108 {
14109 return true;
14110 }
14111
14112 return false;
14113 }
14114
14116 {
14118 {
14119 return true;
14120 }
14121
14122 return false;
14123 }
14124
14126 {
14128 {
14129 return true;
14130 }
14131
14132 return false;
14133 }
14134
14136 {
14137 return false;
14138 }
14139
14142 {
14143 return UATimeSpent.DEFAULT_DEPLOY;
14144 }
14145
14146
14147
14148
14150 {
14152 SetSynchDirty();
14153 }
14154
14156 {
14158 }
14159
14160
14162 {
14163 return false;
14164 }
14165
14168 {
14169 string att_type = "None";
14170
14171 if (ConfigIsExisting("soundAttType"))
14172 {
14173 att_type = ConfigGetString("soundAttType");
14174 }
14175
14177 }
14178
14180 {
14182 }
14183
14184
14185
14186
14187
14193
14195 {
14198
14200 }
14201
14202
14204 {
14206 return;
14207
14209
14212
14215
14216 SoundParameters params = new SoundParameters();
14220 }
14221
14222
14224 {
14226 {
14229
14230 SetSynchDirty();
14231
14234 }
14235 }
14236
14238 {
14240 }
14241
14242
14244 {
14246 return;
14247
14249 SetSynchDirty();
14250
14253 }
14254
14256 {
14259 }
14260
14262 {
14264 }
14265
14266 void OnApply(PlayerBase player);
14267
14269 {
14270 return 1.0;
14271 };
14272
14274 {
14276 }
14277
14279 {
14281 }
14282
14284
14286 {
14287 SetDynamicPhysicsLifeTime(0.01);
14289 }
14290
14292 {
14293 array<string> zone_names = new array<string>;
14294 GetDamageZones(zone_names);
14295 for (int i = 0; i < zone_names.Count(); i++)
14296 {
14297 SetHealthMax(zone_names.Get(i),"Health");
14298 }
14299 SetHealthMax("","Health");
14300 }
14301
14304 {
14305 float global_health = GetHealth01("","Health");
14306 array<string> zones = new array<string>;
14307 GetDamageZones(zones);
14308
14309 for (int i = 0; i < zones.Count(); i++)
14310 {
14311 SetHealth01(zones.Get(i),"Health",global_health);
14312 }
14313 }
14314
14317 {
14318 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14319 }
14320
14322 {
14323 if (!hasRootAsPlayer)
14324 {
14325 if (refParentIB)
14326 {
14327
14328 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14329 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14330
14331 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14332 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14333
14336 }
14337 else
14338 {
14339
14342 }
14343 }
14344 }
14345
14347 {
14349 {
14350 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14351 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14352 {
14353 float heatPermCoef = 1.0;
14355 while (ent)
14356 {
14357 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14358 ent = ent.GetHierarchyParent();
14359 }
14360
14361 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14362 }
14363 }
14364 }
14365
14367 {
14368
14369 EntityAI parent = GetHierarchyParent();
14370 if (!parent)
14371 {
14372 hasParent = false;
14373 hasRootAsPlayer = false;
14374 }
14375 else
14376 {
14377 hasParent = true;
14378 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14379 refParentIB =
ItemBase.Cast(parent);
14380 }
14381 }
14382
14383 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14384 {
14385
14386 }
14387
14389 {
14390
14391 return false;
14392 }
14393
14395 {
14396
14397
14398 return false;
14399 }
14400
14402 {
14403
14404 return false;
14405 }
14406
14409 {
14410 return !GetIsFrozen() &&
IsOpen();
14411 }
14412
14414 {
14415 bool hasParent = false, hasRootAsPlayer = false;
14417
14418 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14419 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14420
14421 if (wwtu || foodDecay)
14422 {
14426
14427 if (processWetness || processTemperature || processDecay)
14428 {
14430
14431 if (processWetness)
14432 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14433
14434 if (processTemperature)
14436
14437 if (processDecay)
14438 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14439 }
14440 }
14441 }
14442
14445 {
14447 }
14448
14450 {
14453
14454 return super.GetTemperatureFreezeThreshold();
14455 }
14456
14458 {
14461
14462 return super.GetTemperatureThawThreshold();
14463 }
14464
14466 {
14469
14470 return super.GetItemOverheatThreshold();
14471 }
14472
14474 {
14476 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14477
14478 return super.GetTemperatureFreezeTime();
14479 }
14480
14482 {
14484 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14485
14486 return super.GetTemperatureThawTime();
14487 }
14488
14493
14495 {
14496 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14497 }
14498
14500 {
14501 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14502 }
14503
14506 {
14508 }
14509
14511 {
14513 }
14514
14516 {
14518 }
14519
14522 {
14523 return null;
14524 }
14525
14528 {
14529 return false;
14530 }
14531
14533 {
14535 {
14538 if (!trg)
14539 {
14541 explosive = this;
14542 }
14543
14544 explosive.PairRemote(trg);
14546
14547 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14548 trg.SetPersistentPairID(persistentID);
14549 explosive.SetPersistentPairID(persistentID);
14550
14551 return true;
14552 }
14553 return false;
14554 }
14555
14558 {
14559 float ret = 1.0;
14562 ret *= GetHealth01();
14563
14564 return ret;
14565 }
14566
14567 #ifdef DEVELOPER
14568 override void SetDebugItem()
14569 {
14570 super.SetDebugItem();
14571 _itemBase = this;
14572 }
14573
14575 {
14576 string text = super.GetDebugText();
14577
14579 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14580
14581 return text;
14582 }
14583 #endif
14584
14586 {
14587 return true;
14588 }
14589
14591
14593
14595 {
14598 }
14599
14600
14608
14624
14625 [
Obsolete(
"Use ItemSoundHandler instead")]
14628 {
14629 if (!
g_Game.IsDedicatedServer())
14630 {
14631 if (ConfigIsExisting("attachSoundSet"))
14632 {
14633 string cfg_path = "";
14634 string soundset = "";
14635 string type_name =
GetType();
14636
14639 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14640 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14641
14642 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14643 {
14644 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14645 {
14646 if (cfg_slot_array[i] == slot_type)
14647 {
14648 soundset = cfg_soundset_array[i];
14649 break;
14650 }
14651 }
14652 }
14653
14654 if (soundset != "")
14655 {
14656 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14658 }
14659 }
14660 }
14661 }
14662
14664}
14665
14667{
14669 if (entity)
14670 {
14671 bool is_item = entity.IsInherited(
ItemBase);
14672 if (is_item && full_quantity)
14673 {
14676 }
14677 }
14678 else
14679 {
14681 return NULL;
14682 }
14683 return entity;
14684}
14685
14687{
14688 if (item)
14689 {
14690 if (health > 0)
14691 item.SetHealth("", "", health);
14692
14693 if (item.CanHaveTemperature())
14694 {
14696 if (item.CanFreeze())
14697 item.SetFrozen(false);
14698 }
14699
14700 if (item.HasEnergyManager())
14701 {
14702 if (quantity >= 0)
14703 {
14704 item.GetCompEM().SetEnergy0To1(quantity);
14705 }
14706 else
14707 {
14709 }
14710 }
14711 else if (item.IsMagazine())
14712 {
14713 Magazine mag = Magazine.Cast(item);
14714 if (quantity >= 0)
14715 {
14716 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14717 }
14718 else
14719 {
14721 }
14722
14723 }
14724 else
14725 {
14726 if (quantity >= 0)
14727 {
14728 item.SetQuantityNormalized(quantity, false);
14729 }
14730 else
14731 {
14733 }
14734
14735 }
14736 }
14737}
14738
14739#ifdef DEVELOPER
14741#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.