9650{
9652 {
9653 return true;
9654 }
9655};
9656
9658{
9659
9660};
9661
9662
9663
9665{
9669
9671
9674
9675
9676
9677
9678
9687
9693
9698
9703
9724 protected bool m_IsResultOfSplit
9725
9727
9732
9733
9734
9736
9740
9741
9742
9744
9747
9748
9749
9755
9756
9764
9767
9768
9770
9771
9773
9774
9779
9780
9785
9787
9788
9790
9791
9793 {
9798
9799 if (!
g_Game.IsDedicatedServer())
9800 {
9802 {
9804
9806 {
9808 }
9809 }
9810
9813 }
9814
9815 m_OldLocation = null;
9816
9818 {
9820 }
9821
9822 if (ConfigIsExisting("headSelectionsToHide"))
9823 {
9826 }
9827
9829 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9830 {
9832 }
9833
9835
9836 m_IsResultOfSplit = false;
9837
9839 }
9840
9842 {
9843 super.InitItemVariables();
9844
9850 m_Count = ConfigGetInt(
"count");
9851
9854
9859
9862
9867
9879
9883
9884
9887 if (ConfigIsExisting("canBeSplit"))
9888 {
9891 }
9892
9894 if (ConfigIsExisting("itemBehaviour"))
9896
9897
9900 RegisterNetSyncVariableInt("m_VarLiquidType");
9901 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9902
9903 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9904 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9905 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9906
9907 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9908 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9909 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9910 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9911
9912 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9913 RegisterNetSyncVariableBool("m_IsTakeable");
9914 RegisterNetSyncVariableBool("m_IsHologram");
9915
9918 {
9921 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9922 }
9923
9925
9927 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9929
9931 }
9932
9934 {
9936 }
9937
9939 {
9942 {
9947 }
9948 }
9949
9950 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9951 {
9953 {
9956 }
9957
9959 }
9960
9962 {
9968 }
9969
9971
9973 {
9975
9976 if (!action)
9977 {
9978 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9979 return;
9980 }
9981
9983 if (!ai)
9984 {
9986 return;
9987 }
9988
9990 if (!action_array)
9991 {
9992 action_array = new array<ActionBase_Basic>;
9994 }
9995 if (LogManager.IsActionLogEnable())
9996 {
9997 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9998 }
9999
10000 if (action_array.Find(action) != -1)
10001 {
10002 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10003 }
10004 else
10005 {
10006 action_array.Insert(action);
10007 }
10008 }
10009
10011 {
10012 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10013 ActionBase action = player.GetActionManager().GetAction(actionName);
10016
10017 if (action_array)
10018 {
10019 action_array.RemoveItem(action);
10020 }
10021 }
10022
10023
10024
10026 {
10027 ActionOverrideData overrideData = new ActionOverrideData();
10031
10033 if (!actionMap)
10034 {
10037 }
10038
10039 actionMap.Insert(this.
Type(), overrideData);
10040
10041 }
10042
10044
10046
10047
10049 {
10052
10055
10056 string config_to_search = "CfgVehicles";
10057 string muzzle_owner_config;
10058
10060 {
10061 if (IsInherited(Weapon))
10062 config_to_search = "CfgWeapons";
10063
10064 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10065
10066 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10067
10068 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10069
10070 if (config_OnFire_subclass_count > 0)
10071 {
10072 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10073
10074 for (int i = 0; i < config_OnFire_subclass_count; i++)
10075 {
10076 string particle_class = "";
10077 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10078 string config_OnFire_entry = config_OnFire_class + particle_class;
10079 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10080 WPOF_array.Insert(WPOF);
10081 }
10082
10083
10085 }
10086 }
10087
10089 {
10090 config_to_search = "CfgWeapons";
10091 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10092
10093 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10094
10095 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10096
10097 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10098 {
10099 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10100
10101 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10102 {
10103 string particle_class2 = "";
10104 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10105 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10106 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10107 WPOBE_array.Insert(WPOBE);
10108 }
10109
10110
10112 }
10113 }
10114 }
10115
10116
10118 {
10121
10123 {
10124 string config_to_search = "CfgVehicles";
10125
10126 if (IsInherited(Weapon))
10127 config_to_search = "CfgWeapons";
10128
10129 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10130 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10131
10132 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10133 {
10134
10136
10138 {
10140 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10142 return;
10143 }
10144
10147
10148
10149
10150 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10151 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10152
10153 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10154 {
10155 string particle_class = "";
10156 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10157 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10158 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10159
10160 if (entry_type == CT_CLASS)
10161 {
10162 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10163 WPOOH_array.Insert(WPOF);
10164 }
10165 }
10166
10167
10169 }
10170 }
10171 }
10172
10174 {
10176 }
10177
10179 {
10181 {
10183
10186
10189
10190 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10191 }
10192 }
10193
10195 {
10197 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10198
10200 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10201
10203 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10204
10206 {
10208 }
10209 }
10210
10212 {
10214 }
10215
10217 {
10220 else
10222
10224 {
10227 }
10228 else
10229 {
10232
10235 }
10236
10238 }
10239
10241 {
10243 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10244 }
10245
10247 {
10249 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10251 }
10252
10254 {
10256 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10257 }
10258
10260 {
10263
10264 OverheatingParticle OP = new OverheatingParticle();
10269
10271 }
10272
10274 {
10277
10278 return -1;
10279 }
10280
10282 {
10284 {
10287
10288 for (int i = count; i > 0; --i)
10289 {
10290 int id = i - 1;
10293
10296
10297 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10298 {
10299 if (p)
10300 {
10303 }
10304 }
10305 }
10306 }
10307 }
10308
10310 {
10312 {
10314 {
10315 int id = i - 1;
10317
10318 if (OP)
10319 {
10321
10322 if (p)
10323 {
10325 }
10326
10327 delete OP;
10328 }
10329 }
10330
10333 }
10334 }
10335
10338 {
10339 return 0.0;
10340 }
10341
10342
10344 {
10345 return 250;
10346 }
10347
10349 {
10350 return 0;
10351 }
10352
10355 {
10357 return true;
10358
10359 return false;
10360 }
10361
10364 {
10367
10369 {
10371 }
10372 else
10373 {
10374
10376 }
10377
10379 }
10380
10387 {
10388 return -1;
10389 }
10390
10391
10392
10393
10395 {
10397 {
10398 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10399 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10400
10401 if (r_index >= 0)
10402 {
10403 InventoryLocation r_il = new InventoryLocation;
10404 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10405
10406 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10409 {
10410 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10411 }
10413 {
10414 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10415 }
10416
10417 }
10418
10419 player.GetHumanInventory().ClearUserReservedLocation(this);
10420 }
10421
10424 }
10425
10426
10427
10428
10430 {
10431 return ItemBase.m_DebugActionsMask;
10432 }
10433
10435 {
10436 return ItemBase.m_DebugActionsMask & mask;
10437 }
10438
10440 {
10441 ItemBase.m_DebugActionsMask = mask;
10442 }
10443
10445 {
10446 ItemBase.m_DebugActionsMask |= mask;
10447 }
10448
10450 {
10451 ItemBase.m_DebugActionsMask &= ~mask;
10452 }
10453
10455 {
10457 {
10459 }
10460 else
10461 {
10463 }
10464 }
10465
10466
10468 {
10469 if (GetEconomyProfile())
10470 {
10471 float q_max = GetEconomyProfile().GetQuantityMax();
10472 if (q_max > 0)
10473 {
10474 float q_min = GetEconomyProfile().GetQuantityMin();
10475 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10476
10478 {
10479 ComponentEnergyManager comp = GetCompEM();
10481 {
10483 }
10484 }
10486 {
10488
10489 }
10490
10491 }
10492 }
10493 }
10494
10497 {
10498 EntityAI parent = GetHierarchyParent();
10499
10500 if (parent)
10501 {
10502 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10503 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10504 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10505 }
10506 }
10507
10510 {
10511 EntityAI parent = GetHierarchyParent();
10512
10513 if (parent)
10514 {
10515 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10516 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10517 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10518 }
10519 }
10520
10522 {
10523
10524
10525
10526
10528
10530 {
10531 if (ScriptInputUserData.CanStoreInputUserData())
10532 {
10533 ScriptInputUserData ctx = new ScriptInputUserData;
10539 ctx.
Write(use_stack_max);
10542
10544 {
10545 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10546 }
10547 }
10548 }
10549 else if (!
g_Game.IsMultiplayer())
10550 {
10552 }
10553 }
10554
10556 {
10558 }
10559
10561 {
10563 }
10564
10566 {
10568 }
10569
10571 {
10572
10573 return false;
10574 }
10575
10577 {
10578 return false;
10579 }
10580
10584 {
10585 return false;
10586 }
10587
10589 {
10590 return "";
10591 }
10592
10594
10596 {
10597 return false;
10598 }
10599
10601 {
10602 return true;
10603 }
10604
10605
10606
10608 {
10609 return true;
10610 }
10611
10613 {
10614 return true;
10615 }
10616
10618 {
10619 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10621 }
10622
10624 {
10626 }
10627
10629 {
10631 if (!is_being_placed)
10633 SetSynchDirty();
10634 }
10635
10636
10638
10640 {
10642 }
10643
10645 {
10647 }
10648
10650 {
10651 return 1;
10652 }
10653
10655 {
10656 return false;
10657 }
10658
10660 {
10662 SetSynchDirty();
10663 }
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10700 {
10701 super.OnMovedInsideCargo(container);
10702
10703 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10704 }
10705
10706 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10707 {
10708 super.EEItemLocationChanged(oldLoc, newLoc);
10709
10710 PlayerBase newPlayer = null;
10711 PlayerBase oldPlayer = null;
10712
10713 if (newLoc.GetParent())
10714 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10715
10716 if (oldLoc.GetParent())
10717 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10718
10720 {
10721 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10722
10723 if (rIndex >= 0)
10724 {
10725 InventoryLocation rIl = new InventoryLocation;
10726 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10727
10728 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10731 {
10732 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10733 }
10735 {
10737 }
10738
10739 }
10740 }
10741
10743 {
10744 if (newPlayer)
10745 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10746
10747 if (newPlayer == oldPlayer)
10748 {
10749 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10750 {
10752 {
10753 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10754 {
10755 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10756 }
10757 }
10758 else
10759 {
10760 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10761 }
10762 }
10763
10764 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10765 {
10766 int type = oldLoc.GetType();
10768 {
10769 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10770 }
10772 {
10773 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10774 }
10775 }
10776 if (!m_OldLocation)
10777 {
10778 m_OldLocation = new InventoryLocation;
10779 }
10780 m_OldLocation.Copy(oldLoc);
10781 }
10782 else
10783 {
10784 if (m_OldLocation)
10785 {
10786 m_OldLocation.Reset();
10787 }
10788 }
10789
10790 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10791 }
10792 else
10793 {
10794 if (newPlayer)
10795 {
10796 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10797 if (resIndex >= 0)
10798 {
10799 InventoryLocation il = new InventoryLocation;
10800 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10802 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10805 {
10806 il.
GetParent().GetOnReleaseLock().Invoke(it);
10807 }
10809 {
10811 }
10812
10813 }
10814 }
10816 {
10817
10819 }
10820
10821 if (m_OldLocation)
10822 {
10823 m_OldLocation.Reset();
10824 }
10825 }
10826
10828 {
10829 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10830 }
10831
10833 {
10834 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10835 }
10836 }
10837
10838 override void EOnContact(IEntity other, Contact extra)
10839 {
10841 {
10842 int liquidType = -1;
10844 if (impactSpeed > 0.0)
10845 {
10847 #ifndef SERVER
10849 #else
10851 SetSynchDirty();
10852 #endif
10854 }
10855 }
10856
10857 #ifdef SERVER
10858 if (GetCompEM() && GetCompEM().IsPlugged())
10859 {
10860 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10861 GetCompEM().UnplugThis();
10862 }
10863 #endif
10864 }
10865
10867
10869 {
10871 }
10872
10874 {
10875
10876 }
10877
10879 {
10880 super.OnItemLocationChanged(old_owner, new_owner);
10881
10882 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10883 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10884
10885 if (!relatedPlayer && playerNew)
10886 relatedPlayer = playerNew;
10887
10888 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10889 {
10891 if (actionMgr)
10892 {
10893 ActionBase currentAction = actionMgr.GetRunningAction();
10894 if (currentAction)
10896 }
10897 }
10898
10899 Man ownerPlayerOld = null;
10900 Man ownerPlayerNew = null;
10901
10902 if (old_owner)
10903 {
10904 if (old_owner.
IsMan())
10905 {
10906 ownerPlayerOld = Man.Cast(old_owner);
10907 }
10908 else
10909 {
10910 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10911 }
10912 }
10913 else
10914 {
10916 {
10918
10919 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10920 {
10921 GetCompEM().UnplugThis();
10922 }
10923 }
10924 }
10925
10926 if (new_owner)
10927 {
10928 if (new_owner.
IsMan())
10929 {
10930 ownerPlayerNew = Man.Cast(new_owner);
10931 }
10932 else
10933 {
10934 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10935 }
10936 }
10937
10938 if (ownerPlayerOld != ownerPlayerNew)
10939 {
10940 if (ownerPlayerOld)
10941 {
10942 array<EntityAI> subItemsExit = new array<EntityAI>;
10944 for (int i = 0; i < subItemsExit.Count(); i++)
10945 {
10948 }
10949 }
10950
10951 if (ownerPlayerNew)
10952 {
10953 array<EntityAI> subItemsEnter = new array<EntityAI>;
10955 for (int j = 0; j < subItemsEnter.Count(); j++)
10956 {
10959 }
10960 }
10961 }
10962 else if (ownerPlayerNew != null)
10963 {
10964 PlayerBase nplayer;
10965 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10966 {
10967 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10969 for (int k = 0; k < subItemsUpdate.Count(); k++)
10970 {
10972 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10973 }
10974 }
10975 }
10976
10977 if (old_owner)
10978 old_owner.OnChildItemRemoved(this);
10979 if (new_owner)
10980 new_owner.OnChildItemReceived(this);
10981 }
10982
10983
10985 {
10986 super.EEDelete(parent);
10987 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10988 if (player)
10989 {
10991
10992 if (player.IsAlive())
10993 {
10994 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10995 if (r_index >= 0)
10996 {
10997 InventoryLocation r_il = new InventoryLocation;
10998 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10999
11000 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11003 {
11004 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11005 }
11007 {
11008 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11009 }
11010
11011 }
11012
11013 player.RemoveQuickBarEntityShortcut(this);
11014 }
11015 }
11016 }
11017
11019 {
11020 super.EEKilled(killer);
11021
11024 {
11025 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11026 {
11027 if (IsMagazine())
11028 {
11029 if (Magazine.Cast(this).GetAmmoCount() > 0)
11030 {
11032 }
11033 }
11034 else
11035 {
11037 }
11038 }
11039 }
11040 }
11041
11043 {
11044 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11045
11046 super.OnWasAttached(parent, slot_id);
11047
11050
11053 }
11054
11056 {
11057 super.OnWasDetached(parent, slot_id);
11058
11061
11064 }
11065
11067 {
11068 int idx;
11071
11072 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11073 if (inventory_slots.Count() < 1)
11074 {
11075 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11076 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11077 }
11078 else
11079 {
11080 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11081 }
11082
11083 idx = inventory_slots.Find(slot);
11084 if (idx < 0)
11085 return "";
11086
11087 return attach_types.Get(idx);
11088 }
11089
11091 {
11092 int idx = -1;
11093 string slot;
11094
11097
11098 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11099 if (inventory_slots.Count() < 1)
11100 {
11101 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11102 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11103 }
11104 else
11105 {
11106 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11107 if (detach_types.Count() < 1)
11108 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11109 }
11110
11111 for (int i = 0; i < inventory_slots.Count(); i++)
11112 {
11113 slot = inventory_slots.Get(i);
11114 }
11115
11116 if (slot != "")
11117 {
11118 if (detach_types.Count() == 1)
11119 idx = 0;
11120 else
11121 idx = inventory_slots.Find(slot);
11122 }
11123 if (idx < 0)
11124 return "";
11125
11126 return detach_types.Get(idx);
11127 }
11128
11130 {
11131
11133
11134
11135 float min_time = 1;
11136 float max_time = 3;
11137 float delay = Math.RandomFloat(min_time, max_time);
11138
11139 explode_timer.Run(delay, this, "DoAmmoExplosion");
11140 }
11141
11143 {
11144 Magazine magazine = Magazine.Cast(this);
11145 int pop_sounds_count = 6;
11146 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11147
11148
11149 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11150 string sound_name = pop_sounds[ sound_idx ];
11151 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11152
11153
11154 magazine.ServerAddAmmoCount(-1);
11155
11156
11157 float min_temp_to_explode = 100;
11158
11159 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11160 {
11162 }
11163 }
11164
11165
11166 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11167 {
11168 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11169
11170 const int CHANCE_DAMAGE_CARGO = 4;
11171 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11172 const int CHANCE_DAMAGE_NOTHING = 2;
11173
11175 {
11176 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11177 int chances;
11178 int rnd;
11179
11180 if (GetInventory().GetCargo())
11181 {
11182 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11183 rnd = Math.RandomInt(0,chances);
11184
11185 if (rnd < CHANCE_DAMAGE_CARGO)
11186 {
11188 }
11189 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11190 {
11192 }
11193 }
11194 else
11195 {
11196 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11197 rnd = Math.RandomInt(0,chances);
11198
11199 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11200 {
11202 }
11203 }
11204 }
11205 }
11206
11208 {
11209 CargoBase cargo = GetInventory().GetCargo();
11210 if (cargo)
11211 {
11213 if (item_count > 0)
11214 {
11215 int random_pick = Math.RandomInt(0, item_count);
11217 if (!item.IsExplosive())
11218 {
11219 item.AddHealth("","",damage);
11220 return true;
11221 }
11222 }
11223 }
11224 return false;
11225 }
11226
11228 {
11229 GameInventory inventory = GetInventory();
11231 if (attachment_count > 0)
11232 {
11233 int random_pick = Math.RandomInt(0, attachment_count);
11235 if (!attachment.IsExplosive())
11236 {
11237 attachment.AddHealth("","",damage);
11238 return true;
11239 }
11240 }
11241 return false;
11242 }
11243
11245 {
11247 }
11248
11250 {
11252 return GetInventory().CanRemoveEntity();
11253
11254 return false;
11255 }
11256
11258 {
11259
11261 return false;
11262
11263
11265 return false;
11266
11267
11268
11270 if (delta == 0)
11271 return false;
11272
11273
11274 return true;
11275 }
11276
11278 {
11280 {
11281 if (ScriptInputUserData.CanStoreInputUserData())
11282 {
11283 ScriptInputUserData ctx = new ScriptInputUserData;
11288 ctx.
Write(destination_entity);
11290 ctx.
Write(slot_id);
11292 }
11293 }
11294 else if (!
g_Game.IsMultiplayer())
11295 {
11297 }
11298 }
11299
11301 {
11302 float split_quantity_new;
11306 InventoryLocation loc = new InventoryLocation;
11307
11308 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11309 {
11311 split_quantity_new = stack_max;
11312 else
11314
11316 {
11317 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11318 if (new_item)
11319 {
11320 new_item.SetResultOfSplit(true);
11321 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11323 new_item.
SetQuantity(split_quantity_new,
false,
true);
11324 }
11325 }
11326 }
11327 else if (destination_entity && slot_id == -1)
11328 {
11329 if (quantity > stack_max)
11330 split_quantity_new = stack_max;
11331 else
11332 split_quantity_new = quantity;
11333
11335 {
11336 GameInventory destinationInventory = destination_entity.GetInventory();
11338 {
11341 }
11342
11343 if (new_item)
11344 {
11345 new_item.SetResultOfSplit(true);
11346 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11348 new_item.
SetQuantity(split_quantity_new,
false,
true);
11349 }
11350 }
11351 }
11352 else
11353 {
11354 if (stack_max != 0)
11355 {
11357 {
11359 }
11360
11361 if (split_quantity_new == 0)
11362 {
11363 if (!
g_Game.IsMultiplayer())
11364 player.PhysicalPredictiveDropItem(this);
11365 else
11366 player.ServerDropEntity(this);
11367 return;
11368 }
11369
11371 {
11373
11374 if (new_item)
11375 {
11376 new_item.SetResultOfSplit(true);
11377 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11380 new_item.PlaceOnSurface();
11381 }
11382 }
11383 }
11384 }
11385 }
11386
11388 {
11389 float split_quantity_new;
11393 InventoryLocation loc = new InventoryLocation;
11394
11395 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11396 {
11398 split_quantity_new = stack_max;
11399 else
11401
11403 {
11404 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11405 if (new_item)
11406 {
11407 new_item.SetResultOfSplit(true);
11408 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11410 new_item.
SetQuantity(split_quantity_new,
false,
true);
11411 }
11412 }
11413 }
11414 else if (destination_entity && slot_id == -1)
11415 {
11416 if (quantity > stack_max)
11417 split_quantity_new = stack_max;
11418 else
11419 split_quantity_new = quantity;
11420
11422 {
11423 GameInventory destinationInventory = destination_entity.GetInventory();
11425 {
11428 }
11429
11430 if (new_item)
11431 {
11432 new_item.SetResultOfSplit(true);
11433 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11435 new_item.
SetQuantity(split_quantity_new,
false,
true);
11436 }
11437 }
11438 }
11439 else
11440 {
11441 if (stack_max != 0)
11442 {
11444 {
11446 }
11447
11449 {
11451
11452 if (new_item)
11453 {
11454 new_item.SetResultOfSplit(true);
11455 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11458 new_item.PlaceOnSurface();
11459 }
11460 }
11461 }
11462 }
11463 }
11464
11466 {
11468 {
11469 if (ScriptInputUserData.CanStoreInputUserData())
11470 {
11471 ScriptInputUserData ctx = new ScriptInputUserData;
11476 dst.WriteToContext(ctx);
11478 }
11479 }
11480 else if (!
g_Game.IsMultiplayer())
11481 {
11483 }
11484 }
11485
11487 {
11489 {
11490 if (ScriptInputUserData.CanStoreInputUserData())
11491 {
11492 ScriptInputUserData ctx = new ScriptInputUserData;
11497 ctx.
Write(destination_entity);
11503 }
11504 }
11505 else if (!
g_Game.IsMultiplayer())
11506 {
11508 }
11509 }
11510
11512 {
11514 }
11515
11517 {
11519 float split_quantity_new;
11521 if (dst.IsValid())
11522 {
11523 int slot_id = dst.GetSlot();
11525
11526 if (quantity > stack_max)
11527 split_quantity_new = stack_max;
11528 else
11529 split_quantity_new = quantity;
11530
11532 {
11534
11535 if (new_item)
11536 {
11537 new_item.SetResultOfSplit(true);
11538 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11540 new_item.
SetQuantity(split_quantity_new,
false,
true);
11541 }
11542
11543 return new_item;
11544 }
11545 }
11546
11547 return null;
11548 }
11549
11551 {
11553 float split_quantity_new;
11555 if (destination_entity)
11556 {
11558 if (quantity > stackable)
11559 split_quantity_new = stackable;
11560 else
11561 split_quantity_new = quantity;
11562
11564 {
11565 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11566 if (new_item)
11567 {
11568 new_item.SetResultOfSplit(true);
11569 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11571 new_item.
SetQuantity(split_quantity_new,
false,
true);
11572 }
11573 }
11574 }
11575 }
11576
11578 {
11580 {
11581 if (ScriptInputUserData.CanStoreInputUserData())
11582 {
11583 ScriptInputUserData ctx = new ScriptInputUserData;
11588 ItemBase destination_entity =
this;
11589 ctx.
Write(destination_entity);
11593 }
11594 }
11595 else if (!
g_Game.IsMultiplayer())
11596 {
11598 }
11599 }
11600
11602 {
11604 float split_quantity_new;
11606 if (player)
11607 {
11609 if (quantity > stackable)
11610 split_quantity_new = stackable;
11611 else
11612 split_quantity_new = quantity;
11613
11615 {
11616 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11617 new_item =
ItemBase.Cast(in_hands);
11618 if (new_item)
11619 {
11620 new_item.SetResultOfSplit(true);
11621 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11623 new_item.SetQuantity(split_quantity_new, false, true);
11624 }
11625 }
11626 }
11627 }
11628
11630 {
11632 float split_quantity_new = Math.Floor(quantity * 0.5);
11633
11635 return;
11636
11638
11639 if (new_item)
11640 {
11641 if (new_item.GetQuantityMax() < split_quantity_new)
11642 {
11643 split_quantity_new = new_item.GetQuantityMax();
11644 }
11645
11646 new_item.SetResultOfSplit(true);
11647 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11648
11650 {
11653 }
11654 else
11655 {
11657 new_item.
SetQuantity(split_quantity_new,
false,
true);
11658 }
11659 }
11660 }
11661
11663 {
11665 float split_quantity_new = Math.Floor(quantity / 2);
11666
11668 return;
11669
11670 InventoryLocation invloc = new InventoryLocation;
11672
11674 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11675
11676 if (new_item)
11677 {
11678 if (new_item.GetQuantityMax() < split_quantity_new)
11679 {
11680 split_quantity_new = new_item.GetQuantityMax();
11681 }
11683 {
11686 }
11687 else if (split_quantity_new > 1)
11688 {
11690 new_item.
SetQuantity(split_quantity_new,
false,
true);
11691 }
11692 }
11693 }
11694
11697 {
11698 SetWeightDirty();
11700
11701 if (parent)
11702 parent.OnAttachmentQuantityChangedEx(this, delta);
11703
11705 {
11707 {
11709 }
11711 {
11712 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11714 }
11715 }
11716 }
11717
11720 {
11721
11722 }
11723
11726 {
11728 }
11729
11731 {
11732 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11733
11735 {
11736 if (newLevel == GameConstants.STATE_RUINED)
11737 {
11739 EntityAI parent = GetHierarchyParent();
11740 if (parent && parent.IsFireplace())
11741 {
11742 CargoBase cargo = GetInventory().GetCargo();
11743 if (cargo)
11744 {
11746 {
11748 }
11749 }
11750 }
11751 }
11752
11754 {
11755
11757 return;
11758 }
11759
11760 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11761 {
11763 }
11764 }
11765 }
11766
11767
11769 {
11770 super.OnRightClick();
11771
11773 {
11775 {
11776 if (ScriptInputUserData.CanStoreInputUserData())
11777 {
11778 EntityAI root = GetHierarchyRoot();
11779 Man playerOwner = GetHierarchyRootPlayer();
11780 InventoryLocation dst = new InventoryLocation;
11781
11782
11783 if (!playerOwner && root && root == this)
11784 {
11786 }
11787 else
11788 {
11789
11790 GetInventory().GetCurrentInventoryLocation(dst);
11792 {
11793 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11795 {
11797 }
11798 else
11799 {
11801
11802
11803 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11804 {
11806 }
11807 else
11808 {
11809 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11810 }
11811 }
11812 }
11813 }
11814
11815 ScriptInputUserData ctx = new ScriptInputUserData;
11823 }
11824 }
11825 else if (!
g_Game.IsMultiplayer())
11826 {
11828 }
11829 }
11830 }
11831
11833 {
11834 if (root)
11835 {
11836 vector m4[4];
11837 root.GetTransform(m4);
11838 dst.SetGround(this, m4);
11839 }
11840 else
11841 {
11842 GetInventory().GetCurrentInventoryLocation(dst);
11843 }
11844 }
11845
11846 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11847 {
11848
11849 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11850 return false;
11851
11852 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11853 return false;
11854
11855
11857 return false;
11858
11859
11860 Magazine mag = Magazine.Cast(this);
11861 if (mag)
11862 {
11863 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11864 return false;
11865
11866 if (stack_max_limit)
11867 {
11868 Magazine other_mag = Magazine.Cast(other_item);
11869 if (other_item)
11870 {
11871 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11872 return false;
11873 }
11874
11875 }
11876 }
11877 else
11878 {
11879
11881 return false;
11882
11884 return false;
11885 }
11886
11887 PlayerBase player = null;
11888 if (CastTo(player, GetHierarchyRootPlayer()))
11889 {
11890 if (player.GetInventory().HasAttachment(this))
11891 return false;
11892
11893 if (player.IsItemsToDelete())
11894 return false;
11895 }
11896
11897 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11898 return false;
11899
11900 int slotID;
11902 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11903 return false;
11904
11905 return true;
11906 }
11907
11909 {
11911 }
11912
11914 {
11915 return m_IsResultOfSplit;
11916 }
11917
11919 {
11920 m_IsResultOfSplit = value;
11921 }
11922
11924 {
11926 }
11927
11929 {
11930 float other_item_quantity = other_item.GetQuantity();
11931 float this_free_space;
11932
11934
11936
11937 if (other_item_quantity > this_free_space)
11938 {
11939 return this_free_space;
11940 }
11941 else
11942 {
11943 return other_item_quantity;
11944 }
11945 }
11946
11948 {
11950 }
11951
11953 {
11955 return;
11956
11957 if (!IsMagazine() && other_item)
11958 {
11960 if (quantity_used != 0)
11961 {
11962 float hp1 = GetHealth01("","");
11963 float hp2 = other_item.GetHealth01("","");
11964 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11965 hpResult = hpResult / (
GetQuantity() + quantity_used);
11966
11967 hpResult *= GetMaxHealth();
11968 Math.Round(hpResult);
11969 SetHealth("", "Health", hpResult);
11970
11972 other_item.AddQuantity(-quantity_used);
11973 }
11974 }
11976 }
11977
11979 {
11980 #ifdef SERVER
11981 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11982 GetHierarchyParent().IncreaseLifetimeUp();
11983 #endif
11984 };
11985
11987 {
11988 PlayerBase p = PlayerBase.Cast(player);
11989
11990 array<int> recipesIds = p.m_Recipes;
11991 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11992 if (moduleRecipesManager)
11993 {
11994 EntityAI itemInHands = player.GetEntityInHands();
11995 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11996 }
11997
11998 for (int i = 0;i < recipesIds.Count(); i++)
11999 {
12000 int key = recipesIds.Get(i);
12001 string recipeName = moduleRecipesManager.GetRecipeName(key);
12003 }
12004 }
12005
12006
12007 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12008 {
12009 super.GetDebugActions(outputList);
12010
12011
12017
12018
12023
12028
12029
12033
12034
12036 {
12040 }
12041
12044
12045
12049
12051
12052 InventoryLocation loc = new InventoryLocation();
12053 GetInventory().GetCurrentInventoryLocation(loc);
12055 {
12056 if (Gizmo_IsSupported())
12059 }
12060
12062 }
12063
12064
12065
12066
12068 {
12069 super.OnAction(action_id, player, ctx);
12070
12072 {
12073 switch (action_id)
12074 {
12078 return true;
12082 return true;
12083 }
12084 }
12085
12087 {
12088 switch (action_id)
12089 {
12091 Delete();
12092 return true;
12093 }
12094 }
12095
12096 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12097 {
12098 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12099 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12100 PlayerBase p = PlayerBase.Cast(player);
12101 if (
EActions.RECIPES_RANGE_START < 1000)
12102 {
12103 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12104 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12105 }
12106 }
12107 #ifndef SERVER
12108 else if (action_id ==
EActions.WATCH_PLAYER)
12109 {
12110 PluginDeveloper.SetDeveloperItemClientEx(player);
12111 }
12112 #endif
12114 {
12115 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12116 {
12117 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12118 OnDebugButtonPressServer(id + 1);
12119 }
12120
12121 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12122 {
12123 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12125 }
12126
12127 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12128 {
12129 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12131 }
12132
12133 else if (action_id ==
EActions.ADD_QUANTITY)
12134 {
12135 if (IsMagazine())
12136 {
12137 Magazine mag = Magazine.Cast(this);
12138 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12139 }
12140 else
12141 {
12143 }
12144
12145 if (m_EM)
12146 {
12147 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12148 }
12149
12150 }
12151
12152 else if (action_id ==
EActions.REMOVE_QUANTITY)
12153 {
12154 if (IsMagazine())
12155 {
12156 Magazine mag2 = Magazine.Cast(this);
12157 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12158 }
12159 else
12160 {
12162 }
12163 if (m_EM)
12164 {
12165 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12166 }
12167
12168 }
12169
12170 else if (action_id ==
EActions.SET_QUANTITY_0)
12171 {
12173
12174 if (m_EM)
12175 {
12176 m_EM.SetEnergy(0);
12177 }
12178 }
12179
12180 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12181 {
12183
12184 if (m_EM)
12185 {
12186 m_EM.SetEnergy(m_EM.GetEnergyMax());
12187 }
12188 }
12189
12190 else if (action_id ==
EActions.ADD_HEALTH)
12191 {
12192 AddHealth("","",GetMaxHealth("","Health")/5);
12193 }
12194 else if (action_id ==
EActions.REMOVE_HEALTH)
12195 {
12196 AddHealth("","",-GetMaxHealth("","Health")/5);
12197 }
12198 else if (action_id ==
EActions.DESTROY_HEALTH)
12199 {
12200 SetHealth01("","",0);
12201 }
12202 else if (action_id ==
EActions.WATCH_ITEM)
12203 {
12205 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12206 #ifdef DEVELOPER
12207 SetDebugDeveloper_item(this);
12208 #endif
12209 }
12210
12211 else if (action_id ==
EActions.ADD_TEMPERATURE)
12212 {
12213 AddTemperature(20);
12214
12215 }
12216
12217 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12218 {
12219 AddTemperature(-20);
12220
12221 }
12222
12223 else if (action_id ==
EActions.FLIP_FROZEN)
12224 {
12225 SetFrozen(!GetIsFrozen());
12226
12227 }
12228
12229 else if (action_id ==
EActions.ADD_WETNESS)
12230 {
12232
12233 }
12234
12235 else if (action_id ==
EActions.REMOVE_WETNESS)
12236 {
12238
12239 }
12240
12241 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12242 {
12245
12246
12247 }
12248
12249 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12250 {
12253 }
12254
12255 else if (action_id ==
EActions.MAKE_SPECIAL)
12256 {
12257 auto debugParams = DebugSpawnParams.WithPlayer(player);
12258 OnDebugSpawnEx(debugParams);
12259 }
12260
12261 }
12262
12263
12264 return false;
12265 }
12266
12267
12268
12269
12273
12276
12277
12278
12280 {
12281 return false;
12282 }
12283
12284
12286 {
12287 return true;
12288 }
12289
12290
12292 {
12293 return true;
12294 }
12295
12296
12297
12299 {
12300 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12301 return g_Game.ConfigIsExisting(config_path);
12302 }
12303
12306 {
12307 return null;
12308 }
12309
12311 {
12312 return false;
12313 }
12314
12316 {
12317 return false;
12318 }
12319
12323
12324
12326 {
12327 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12328 return module_repairing.CanRepair(this, item_repair_kit);
12329 }
12330
12331
12332 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12333 {
12334 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12335 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12336 }
12337
12338
12340 {
12341
12342
12343
12344
12345
12346
12347
12348
12349 return 1;
12350 }
12351
12352
12353
12355 {
12357 }
12358
12359
12360
12362 {
12364 }
12365
12366
12375 {
12376 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12377
12378 if (player)
12379 {
12380 player.MessageStatus(text);
12381 }
12382 }
12383
12384
12393 {
12394 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12395
12396 if (player)
12397 {
12398 player.MessageAction(text);
12399 }
12400 }
12401
12402
12411 {
12412 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12413
12414 if (player)
12415 {
12416 player.MessageFriendly(text);
12417 }
12418 }
12419
12420
12429 {
12430 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12431
12432 if (player)
12433 {
12434 player.MessageImportant(text);
12435 }
12436 }
12437
12439 {
12440 return true;
12441 }
12442
12443
12444 override bool KindOf(
string tag)
12445 {
12446 bool found = false;
12447 string item_name = this.
GetType();
12449 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12450
12451 int array_size = item_tag_array.Count();
12452 for (int i = 0; i < array_size; i++)
12453 {
12454 if (item_tag_array.Get(i) == tag)
12455 {
12456 found = true;
12457 break;
12458 }
12459 }
12460 return found;
12461 }
12462
12463
12465 {
12466
12467 super.OnRPC(sender, rpc_type,ctx);
12468
12469
12470 switch (rpc_type)
12471 {
12472 #ifndef SERVER
12473 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12474 Param2<bool, string> p = new Param2<bool, string>(false, "");
12475
12477 return;
12478
12479 bool play = p.param1;
12480 string soundSet = p.param2;
12481
12482 if (play)
12483 {
12485 {
12487 {
12489 }
12490 }
12491 else
12492 {
12494 }
12495 }
12496 else
12497 {
12499 }
12500
12501 break;
12502 #endif
12503
12504 }
12505
12507 {
12509 }
12510 }
12511
12512
12513
12514
12516 {
12517 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12518 return plugin.GetID(
name);
12519 }
12520
12522 {
12523 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12524 return plugin.GetName(id);
12525 }
12526
12529 {
12530
12531
12532 int varFlags;
12533 if (!ctx.
Read(varFlags))
12534 return;
12535
12536 if (varFlags & ItemVariableFlags.FLOAT)
12537 {
12539 }
12540 }
12541
12543 {
12544
12545 super.SerializeNumericalVars(floats_out);
12546
12547
12548
12550 {
12552 }
12553
12555 {
12557 }
12558
12560 {
12562 }
12563
12565 {
12570 }
12571
12573 {
12575 }
12576 }
12577
12579 {
12580
12581 super.DeSerializeNumericalVars(floats);
12582
12583
12584 int index = 0;
12585 int mask = Math.Round(floats.Get(index));
12586
12587 index++;
12588
12590 {
12592 {
12594 }
12595 else
12596 {
12597 float quantity = floats.Get(index);
12598 SetQuantity(quantity,
true,
false,
false,
false);
12599 }
12600 index++;
12601 }
12602
12604 {
12605 float wet = floats.Get(index);
12607 index++;
12608 }
12609
12611 {
12612 int liquidtype = Math.Round(floats.Get(index));
12614 index++;
12615 }
12616
12618 {
12620 index++;
12622 index++;
12624 index++;
12626 index++;
12627 }
12628
12630 {
12631 int cleanness = Math.Round(floats.Get(index));
12633 index++;
12634 }
12635 }
12636
12638 {
12639 super.WriteVarsToCTX(ctx);
12640
12641
12643 {
12645 }
12646
12648 {
12650 }
12651
12653 {
12655 }
12656
12658 {
12659 int r,g,b,a;
12665 }
12666
12668 {
12670 }
12671 }
12672
12674 {
12675 if (!super.ReadVarsFromCTX(ctx,version))
12676 return false;
12677
12678 int intValue;
12679 float value;
12680
12681 if (version < 140)
12682 {
12683 if (!ctx.
Read(intValue))
12684 return false;
12685
12686 m_VariablesMask = intValue;
12687 }
12688
12690 {
12691 if (!ctx.
Read(value))
12692 return false;
12693
12695 {
12697 }
12698 else
12699 {
12701 }
12702 }
12703
12704 if (version < 140)
12705 {
12707 {
12708 if (!ctx.
Read(value))
12709 return false;
12710 SetTemperatureDirect(value);
12711 }
12712 }
12713
12715 {
12716 if (!ctx.
Read(value))
12717 return false;
12719 }
12720
12722 {
12723 if (!ctx.
Read(intValue))
12724 return false;
12726 }
12727
12729 {
12730 int r,g,b,a;
12732 return false;
12734 return false;
12736 return false;
12738 return false;
12739
12741 }
12742
12744 {
12745 if (!ctx.
Read(intValue))
12746 return false;
12748 }
12749
12750 if (version >= 138 && version < 140)
12751 {
12753 {
12754 if (!ctx.
Read(intValue))
12755 return false;
12756 SetFrozen(intValue);
12757 }
12758 }
12759
12760 return true;
12761 }
12762
12763
12765 {
12768 {
12770 }
12771
12772 if (!super.OnStoreLoad(ctx, version))
12773 {
12775 return false;
12776 }
12777
12778 if (version >= 114)
12779 {
12780 bool hasQuickBarIndexSaved;
12781
12782 if (!ctx.
Read(hasQuickBarIndexSaved))
12783 {
12785 return false;
12786 }
12787
12788 if (hasQuickBarIndexSaved)
12789 {
12790 int itmQBIndex;
12791
12792
12793 if (!ctx.
Read(itmQBIndex))
12794 {
12796 return false;
12797 }
12798
12799 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12800 if (itmQBIndex != -1 && parentPlayer)
12801 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12802 }
12803 }
12804 else
12805 {
12806
12807 PlayerBase player;
12808 int itemQBIndex;
12809 if (version ==
int.
MAX)
12810 {
12811 if (!ctx.
Read(itemQBIndex))
12812 {
12814 return false;
12815 }
12816 }
12817 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12818 {
12819
12820 if (!ctx.
Read(itemQBIndex))
12821 {
12823 return false;
12824 }
12825 if (itemQBIndex != -1 && player)
12826 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12827 }
12828 }
12829
12830 if (version < 140)
12831 {
12832
12833 if (!LoadVariables(ctx, version))
12834 {
12836 return false;
12837 }
12838 }
12839
12840
12842 {
12844 return false;
12845 }
12846 if (version >= 132)
12847 {
12849 if (raib)
12850 {
12852 {
12854 return false;
12855 }
12856 }
12857 }
12858
12860 return true;
12861 }
12862
12863
12864
12866 {
12867 super.OnStoreSave(ctx);
12868
12869 PlayerBase player;
12870 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12871 {
12873
12874 int itemQBIndex = -1;
12875 itemQBIndex = player.FindQuickBarEntityIndex(this);
12876 ctx.
Write(itemQBIndex);
12877 }
12878 else
12879 {
12881 }
12882
12884
12886 if (raib)
12887 {
12889 }
12890 }
12891
12892
12894 {
12895 super.AfterStoreLoad();
12896
12898 {
12900 }
12901
12903 {
12906 }
12907 }
12908
12910 {
12911 super.EEOnAfterLoad();
12912
12914 {
12916 }
12917
12920 }
12921
12923 {
12924 return false;
12925 }
12926
12927
12928
12930 {
12932 {
12933 #ifdef PLATFORM_CONSOLE
12934
12936 {
12938 if (menu)
12939 {
12941 }
12942 }
12943 #endif
12944 }
12945
12947 {
12950 }
12951
12953 {
12954 SetWeightDirty();
12956 }
12958 {
12961 }
12962
12964 {
12967
12970 }
12972 {
12976 }
12977
12978 super.OnVariablesSynchronized();
12979 }
12980
12981
12982
12984 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12985 {
12986 if (!IsServerCheck(allow_client))
12987 return false;
12988
12990 return false;
12991
12994
12995 if (value <= (min + 0.001))
12996 value = min;
12997
12998 if (value == min)
12999 {
13000 if (destroy_config)
13001 {
13002 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13003 if (dstr)
13004 {
13006 this.Delete();
13007 return true;
13008 }
13009 }
13010 else if (destroy_forced)
13011 {
13013 this.Delete();
13014 return true;
13015 }
13016
13018 }
13019
13022
13024 {
13025 EntityAI parent = GetHierarchyRoot();
13026 InventoryLocation iLoc = new InventoryLocation();
13027 GetInventory().GetCurrentInventoryLocation(iLoc);
13029 {
13030 int iLocSlot = iLoc.
GetSlot();
13032 {
13034 }
13036 {
13038 }
13039 }
13040 }
13041
13043 {
13045
13046 if (delta)
13048 }
13049
13051
13052 return false;
13053 }
13054
13055
13057 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13058 {
13060 }
13061
13063 {
13066 }
13067
13069 {
13072 }
13073
13075 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13076 {
13077 float value_clamped = Math.Clamp(value, 0, 1);
13079 SetQuantity(result, destroy_config, destroy_forced);
13080 }
13081
13082
13085 {
13087 }
13088
13090 {
13092 }
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13104 {
13105 int slot = -1;
13106 GameInventory inventory = GetInventory();
13107 if (inventory)
13108 {
13109 InventoryLocation il = new InventoryLocation;
13112 }
13113
13115 }
13116
13118 {
13119 float quantity_max = 0;
13120
13122 {
13123 if (attSlotID != -1)
13124 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13125
13126 if (quantity_max <= 0)
13128 }
13129
13130 if (quantity_max <= 0)
13132
13133 return quantity_max;
13134 }
13135
13137 {
13139 }
13140
13142 {
13144 }
13145
13146
13148 {
13150 }
13151
13153 {
13155 }
13156
13158 {
13160 }
13161
13162
13164 {
13165
13166 float weightEx = GetWeightEx();
13167 float special = GetInventoryAndCargoWeight();
13168 return weightEx - special;
13169 }
13170
13171
13173 {
13175 }
13176
13178 {
13180 {
13181 #ifdef DEVELOPER
13182 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13183 {
13184 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13186 }
13187 #endif
13188
13189 return GetQuantity() * GetConfigWeightModified();
13190 }
13191 else if (HasEnergyManager())
13192 {
13193 #ifdef DEVELOPER
13194 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13195 {
13196 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13197 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13198 }
13199 #endif
13200 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13201 }
13202 else
13203 {
13204 #ifdef DEVELOPER
13205 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13206 {
13207 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13208 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13209 }
13210 #endif
13211 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13212 }
13213 }
13214
13217 {
13218 int item_count = 0;
13220
13221 GameInventory inventory = GetInventory();
13222 CargoBase cargo = inventory.
GetCargo();
13223 if (cargo != NULL)
13224 {
13226 }
13227
13229 for (int i = 0; i < nAttachments; ++i)
13230 {
13232 if (item)
13233 item_count += item.GetNumberOfItems();
13234 }
13235 return item_count;
13236 }
13237
13240 {
13241 float weight = 0;
13242 float wetness = 1;
13243 if (include_wetness)
13246 {
13247 weight = wetness * m_ConfigWeight;
13248 }
13250 {
13251 weight = 1;
13252 }
13253 return weight;
13254 }
13255
13256
13257
13259 {
13260 GameInventory inventory = GetInventory();
13261 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13262 {
13263 array<EntityAI> items = new array<EntityAI>;
13265 for (int i = 0; i < items.Count(); ++i)
13266 {
13268 if (item)
13269 {
13270 g_Game.ObjectDelete(item);
13271 }
13272 }
13273 }
13274 }
13275
13276
13277
13278
13280 {
13281 float energy = 0;
13282 if (HasEnergyManager())
13283 {
13284 energy = GetCompEM().GetEnergy();
13285 }
13286 return energy;
13287 }
13288
13289
13291 {
13292 super.OnEnergyConsumed();
13293
13295 }
13296
13298 {
13299 super.OnEnergyAdded();
13300
13302 }
13303
13304
13306 {
13307 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13308 {
13310 {
13311 float energy_0to1 = GetCompEM().GetEnergy0To1();
13313 }
13314 }
13315 }
13316
13317
13319 {
13320 return ConfigGetFloat("heatIsolation");
13321 }
13322
13324 {
13326 }
13327
13329 {
13330 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13331 if (
g_Game.ConfigIsExisting(paramPath))
13332 return g_Game.ConfigGetFloat(paramPath);
13333
13334 return 0.0;
13335 }
13336
13338 {
13339 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13340 if (
g_Game.ConfigIsExisting(paramPath))
13341 return g_Game.ConfigGetFloat(paramPath);
13342
13343 return 0.0;
13344 }
13345
13346 override void SetWet(
float value,
bool allow_client =
false)
13347 {
13348 if (!IsServerCheck(allow_client))
13349 return;
13350
13353
13355
13356 m_VarWet = Math.Clamp(value, min, max);
13357
13359 {
13362 }
13363 }
13364
13365 override void AddWet(
float value)
13366 {
13368 }
13369
13371 {
13373 }
13374
13376 {
13378 }
13379
13381 {
13383 }
13384
13386 {
13388 }
13389
13391 {
13393 }
13394
13395 override void OnWetChanged(
float newVal,
float oldVal)
13396 {
13399 if (newLevel != oldLevel)
13400 {
13402 }
13403 }
13404
13406 {
13407 SetWeightDirty();
13408 }
13409
13411 {
13412 return GetWetLevelInternal(
m_VarWet);
13413 }
13414
13415
13416
13418 {
13420 }
13421
13423 {
13425 }
13426
13428 {
13430 }
13431
13433 {
13435 }
13436
13437
13438
13440 {
13441 if (ConfigIsExisting("itemModelLength"))
13442 {
13443 return ConfigGetFloat("itemModelLength");
13444 }
13445 return 0;
13446 }
13447
13449 {
13450 if (ConfigIsExisting("itemAttachOffset"))
13451 {
13452 return ConfigGetFloat("itemAttachOffset");
13453 }
13454 return 0;
13455 }
13456
13457 override void SetCleanness(
int value,
bool allow_client =
false)
13458 {
13459 if (!IsServerCheck(allow_client))
13460 return;
13461
13463
13465
13468 }
13469
13471 {
13473 }
13474
13476 {
13477 return true;
13478 }
13479
13480
13481
13482
13484 {
13486 }
13487
13489 {
13491 }
13492
13493
13494
13495
13496 override void SetColor(
int r,
int g,
int b,
int a)
13497 {
13503 }
13505 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13506 {
13511 }
13512
13514 {
13516 }
13517
13520 {
13521 int r,g,b,a;
13523 r = r/255;
13524 g = g/255;
13525 b = b/255;
13526 a = a/255;
13527 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13528 }
13529
13530
13531
13532 override void SetLiquidType(
int value,
bool allow_client =
false)
13533 {
13534 if (!IsServerCheck(allow_client))
13535 return;
13536
13541 }
13542
13544 {
13545 return ConfigGetInt("varLiquidTypeInit");
13546 }
13547
13549 {
13551 }
13552
13554 {
13556 SetFrozen(false);
13557 }
13558
13561 {
13562 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13563 }
13564
13565
13568 {
13569 PlayerBase nplayer;
13570 if (PlayerBase.CastTo(nplayer, player))
13571 {
13573 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13574 }
13575 }
13576
13577
13580 {
13581 PlayerBase nplayer;
13582 if (PlayerBase.CastTo(nplayer,player))
13583 {
13584 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13585 }
13586
13587 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13588
13589 if (HasEnergyManager())
13590 {
13591 GetCompEM().UpdatePlugState();
13592 }
13593 }
13594
13595
13597 {
13598 super.OnPlacementStarted(player);
13599
13601 }
13602
13603 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13604 {
13606 {
13607 m_AdminLog.OnPlacementComplete(player,
this);
13608 }
13609
13610 super.OnPlacementComplete(player, position, orientation);
13611 }
13612
13613
13614
13615
13616
13618 {
13620 {
13621 return true;
13622 }
13623 else
13624 {
13625 return false;
13626 }
13627 }
13628
13629
13631 {
13633 {
13635 }
13636 }
13637
13638
13640 {
13642 }
13643
13645 {
13647 }
13648
13649 override void InsertAgent(
int agent,
float count = 1)
13650 {
13651 if (count < 1)
13652 return;
13653
13655 }
13656
13659 {
13661 }
13662
13663
13665 {
13667 }
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13711 {
13713 return false;
13714 return true;
13715 }
13716
13718 {
13719
13721 }
13722
13723
13726 {
13727 super.CheckForRoofLimited(timeTresholdMS);
13728
13729 float time =
g_Game.GetTime();
13730 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13731 {
13732 m_PreviousRoofTestTime = time;
13733 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13734 }
13735 }
13736
13737
13739 {
13741 {
13742 return 0;
13743 }
13744
13745 if (GetInventory().GetAttachmentSlotsCount() != 0)
13746 {
13747 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13748 if (filter)
13749 return filter.GetProtectionLevel(type, false, system);
13750 else
13751 return 0;
13752 }
13753
13754 string subclassPath, entryName;
13755
13756 switch (type)
13757 {
13759 entryName = "biological";
13760 break;
13762 entryName = "chemical";
13763 break;
13764 default:
13765 entryName = "biological";
13766 break;
13767 }
13768
13769 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13770
13771 return g_Game.ConfigGetFloat(subclassPath + entryName);
13772 }
13773
13774
13775
13778 {
13779 if (!IsMagazine())
13781
13783 }
13784
13785
13786
13787
13788
13793 {
13794 return true;
13795 }
13796
13798 {
13800 }
13801
13802
13803
13804
13805
13807 {
13808 if (parent)
13809 {
13810 if (parent.IsInherited(DayZInfected))
13811 return true;
13812
13813 if (!parent.IsRuined())
13814 return true;
13815 }
13816
13817 return true;
13818 }
13819
13821 {
13822 if (!super.CanPutAsAttachment(parent))
13823 {
13824 return false;
13825 }
13826
13827 if (!IsRuined() && !parent.IsRuined())
13828 {
13829 return true;
13830 }
13831
13832 return false;
13833 }
13834
13836 {
13837
13838
13839
13840
13841 return super.CanReceiveItemIntoCargo(item);
13842 }
13843
13845 {
13846
13847
13848
13849
13850 GameInventory attachmentInv = attachment.GetInventory();
13852 {
13853 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13854 return false;
13855 }
13856
13857 InventoryLocation loc = new InventoryLocation();
13858 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13859 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13860 return false;
13861
13862 return super.CanReceiveAttachment(attachment, slotId);
13863 }
13864
13866 {
13867 if (!super.CanReleaseAttachment(attachment))
13868 return false;
13869
13870 return GetInventory().AreChildrenAccessible();
13871 }
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13894 {
13895 int id = muzzle_owner.GetMuzzleID();
13896 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13897
13898 if (WPOF_array)
13899 {
13900 for (int i = 0; i < WPOF_array.Count(); i++)
13901 {
13902 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13903
13904 if (WPOF)
13905 {
13906 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13907 }
13908 }
13909 }
13910 }
13911
13912
13914 {
13915 int id = muzzle_owner.GetMuzzleID();
13917
13918 if (WPOBE_array)
13919 {
13920 for (int i = 0; i < WPOBE_array.Count(); i++)
13921 {
13922 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13923
13924 if (WPOBE)
13925 {
13926 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13927 }
13928 }
13929 }
13930 }
13931
13932
13934 {
13935 int id = muzzle_owner.GetMuzzleID();
13936 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13937
13938 if (WPOOH_array)
13939 {
13940 for (int i = 0; i < WPOOH_array.Count(); i++)
13941 {
13942 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13943
13944 if (WPOOH)
13945 {
13946 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13947 }
13948 }
13949 }
13950 }
13951
13952
13954 {
13955 int id = muzzle_owner.GetMuzzleID();
13956 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13957
13958 if (WPOOH_array)
13959 {
13960 for (int i = 0; i < WPOOH_array.Count(); i++)
13961 {
13962 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13963
13964 if (WPOOH)
13965 {
13966 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13967 }
13968 }
13969 }
13970 }
13971
13972
13974 {
13975 int id = muzzle_owner.GetMuzzleID();
13976 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13977
13978 if (WPOOH_array)
13979 {
13980 for (int i = 0; i < WPOOH_array.Count(); i++)
13981 {
13982 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13983
13984 if (WPOOH)
13985 {
13986 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13987 }
13988 }
13989 }
13990 }
13991
13992
13993
13995 {
13997 {
13998 return true;
13999 }
14000
14001 return false;
14002 }
14003
14005 {
14007 {
14008 return true;
14009 }
14010
14011 return false;
14012 }
14013
14015 {
14017 {
14018 return true;
14019 }
14020
14021 return false;
14022 }
14023
14025 {
14026 return false;
14027 }
14028
14031 {
14032 return UATimeSpent.DEFAULT_DEPLOY;
14033 }
14034
14035
14036
14037
14039 {
14041 SetSynchDirty();
14042 }
14043
14045 {
14047 }
14048
14049
14051 {
14052 return false;
14053 }
14054
14057 {
14058 string att_type = "None";
14059
14060 if (ConfigIsExisting("soundAttType"))
14061 {
14062 att_type = ConfigGetString("soundAttType");
14063 }
14064
14066 }
14067
14069 {
14071 }
14072
14073
14074
14075
14076
14082
14084 {
14087
14089 }
14090
14091
14093 {
14095 return;
14096
14098
14101
14104
14105 SoundParameters params = new SoundParameters();
14109 }
14110
14111
14113 {
14115 {
14118
14119 SetSynchDirty();
14120
14123 }
14124 }
14125
14127 {
14129 }
14130
14131
14133 {
14135 return;
14136
14138 SetSynchDirty();
14139
14142 }
14143
14145 {
14148 }
14149
14151 {
14153 }
14154
14155 void OnApply(PlayerBase player);
14156
14158 {
14159 return 1.0;
14160 };
14161
14163 {
14165 }
14166
14168 {
14170 }
14171
14173
14175 {
14176 SetDynamicPhysicsLifeTime(0.01);
14178 }
14179
14181 {
14182 array<string> zone_names = new array<string>;
14183 GetDamageZones(zone_names);
14184 for (int i = 0; i < zone_names.Count(); i++)
14185 {
14186 SetHealthMax(zone_names.Get(i),"Health");
14187 }
14188 SetHealthMax("","Health");
14189 }
14190
14193 {
14194 float global_health = GetHealth01("","Health");
14195 array<string> zones = new array<string>;
14196 GetDamageZones(zones);
14197
14198 for (int i = 0; i < zones.Count(); i++)
14199 {
14200 SetHealth01(zones.Get(i),"Health",global_health);
14201 }
14202 }
14203
14206 {
14207 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14208 }
14209
14211 {
14212 if (!hasRootAsPlayer)
14213 {
14214 if (refParentIB)
14215 {
14216
14217 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14218 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14219
14220 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14221 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14222
14225 }
14226 else
14227 {
14228
14231 }
14232 }
14233 }
14234
14236 {
14238 {
14239 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14240 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14241 {
14242 float heatPermCoef = 1.0;
14244 while (ent)
14245 {
14246 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14247 ent = ent.GetHierarchyParent();
14248 }
14249
14250 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14251 }
14252 }
14253 }
14254
14256 {
14257
14258 EntityAI parent = GetHierarchyParent();
14259 if (!parent)
14260 {
14261 hasParent = false;
14262 hasRootAsPlayer = false;
14263 }
14264 else
14265 {
14266 hasParent = true;
14267 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14268 refParentIB =
ItemBase.Cast(parent);
14269 }
14270 }
14271
14272 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14273 {
14274
14275 }
14276
14278 {
14279
14280 return false;
14281 }
14282
14284 {
14285
14286
14287 return false;
14288 }
14289
14291 {
14292
14293 return false;
14294 }
14295
14298 {
14299 return !GetIsFrozen() &&
IsOpen();
14300 }
14301
14303 {
14304 bool hasParent = false, hasRootAsPlayer = false;
14306
14307 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14308 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14309
14310 if (wwtu || foodDecay)
14311 {
14315
14316 if (processWetness || processTemperature || processDecay)
14317 {
14319
14320 if (processWetness)
14321 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14322
14323 if (processTemperature)
14325
14326 if (processDecay)
14327 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14328 }
14329 }
14330 }
14331
14334 {
14336 }
14337
14339 {
14342
14343 return super.GetTemperatureFreezeThreshold();
14344 }
14345
14347 {
14350
14351 return super.GetTemperatureThawThreshold();
14352 }
14353
14355 {
14358
14359 return super.GetItemOverheatThreshold();
14360 }
14361
14363 {
14365 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14366
14367 return super.GetTemperatureFreezeTime();
14368 }
14369
14371 {
14373 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14374
14375 return super.GetTemperatureThawTime();
14376 }
14377
14382
14384 {
14385 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14386 }
14387
14389 {
14390 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14391 }
14392
14395 {
14397 }
14398
14400 {
14402 }
14403
14405 {
14407 }
14408
14411 {
14412 return null;
14413 }
14414
14417 {
14418 return false;
14419 }
14420
14422 {
14424 {
14427 if (!trg)
14428 {
14430 explosive = this;
14431 }
14432
14433 explosive.PairRemote(trg);
14435
14436 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14437 trg.SetPersistentPairID(persistentID);
14438 explosive.SetPersistentPairID(persistentID);
14439
14440 return true;
14441 }
14442 return false;
14443 }
14444
14447 {
14448 float ret = 1.0;
14451 ret *= GetHealth01();
14452
14453 return ret;
14454 }
14455
14456 #ifdef DEVELOPER
14457 override void SetDebugItem()
14458 {
14459 super.SetDebugItem();
14460 _itemBase = this;
14461 }
14462
14464 {
14465 string text = super.GetDebugText();
14466
14468 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14469
14470 return text;
14471 }
14472 #endif
14473
14475 {
14476 return true;
14477 }
14478
14480
14482
14484 {
14487 }
14488
14489
14497
14513
14514 [
Obsolete(
"Use ItemSoundHandler instead")]
14517 {
14518 if (!
g_Game.IsDedicatedServer())
14519 {
14520 if (ConfigIsExisting("attachSoundSet"))
14521 {
14522 string cfg_path = "";
14523 string soundset = "";
14524 string type_name =
GetType();
14525
14528 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14529 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14530
14531 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14532 {
14533 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14534 {
14535 if (cfg_slot_array[i] == slot_type)
14536 {
14537 soundset = cfg_soundset_array[i];
14538 break;
14539 }
14540 }
14541 }
14542
14543 if (soundset != "")
14544 {
14545 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14547 }
14548 }
14549 }
14550 }
14551
14553}
14554
14556{
14558 if (entity)
14559 {
14560 bool is_item = entity.IsInherited(
ItemBase);
14561 if (is_item && full_quantity)
14562 {
14565 }
14566 }
14567 else
14568 {
14570 return NULL;
14571 }
14572 return entity;
14573}
14574
14576{
14577 if (item)
14578 {
14579 if (health > 0)
14580 item.SetHealth("", "", health);
14581
14582 if (item.CanHaveTemperature())
14583 {
14585 if (item.CanFreeze())
14586 item.SetFrozen(false);
14587 }
14588
14589 if (item.HasEnergyManager())
14590 {
14591 if (quantity >= 0)
14592 {
14593 item.GetCompEM().SetEnergy0To1(quantity);
14594 }
14595 else
14596 {
14598 }
14599 }
14600 else if (item.IsMagazine())
14601 {
14602 Magazine mag = Magazine.Cast(item);
14603 if (quantity >= 0)
14604 {
14605 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14606 }
14607 else
14608 {
14610 }
14611
14612 }
14613 else
14614 {
14615 if (quantity >= 0)
14616 {
14617 item.SetQuantityNormalized(quantity, false);
14618 }
14619 else
14620 {
14622 }
14623
14624 }
14625 }
14626}
14627
14628#ifdef DEVELOPER
14630#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.