9655{
9657 {
9658 return true;
9659 }
9660};
9661
9663{
9664
9665};
9666
9667
9668
9670{
9674
9676
9679
9680
9681
9682
9683
9692
9698
9703
9708
9729 protected bool m_IsResultOfSplit
9730
9732
9737
9738
9739
9741
9745
9746
9747
9749
9752
9753
9754
9760
9761
9769
9772
9773
9775
9776
9778
9779
9784
9785
9790
9792
9793
9795
9796
9798 {
9803
9804 if (!
g_Game.IsDedicatedServer())
9805 {
9807 {
9809
9811 {
9813 }
9814 }
9815
9818 }
9819
9820 m_OldLocation = null;
9821
9823 {
9825 }
9826
9827 if (ConfigIsExisting("headSelectionsToHide"))
9828 {
9831 }
9832
9834 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9835 {
9837 }
9838
9840
9841 m_IsResultOfSplit = false;
9842
9844 }
9845
9847 {
9848 super.InitItemVariables();
9849
9855 m_Count = ConfigGetInt(
"count");
9856
9859
9864
9867
9872
9884
9888
9889
9892 if (ConfigIsExisting("canBeSplit"))
9893 {
9896 }
9897
9899 if (ConfigIsExisting("itemBehaviour"))
9901
9902
9905 RegisterNetSyncVariableInt("m_VarLiquidType");
9906 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9907
9908 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9909 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9910 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9911
9912 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9913 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9914 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9915 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9916
9917 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9918 RegisterNetSyncVariableBool("m_IsTakeable");
9919 RegisterNetSyncVariableBool("m_IsHologram");
9920
9923 {
9926 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9927 }
9928
9930
9932 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9934
9936 }
9937
9939 {
9941 }
9942
9944 {
9947 {
9952 }
9953 }
9954
9955 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9956 {
9958 {
9961 }
9962
9964 }
9965
9967 {
9973 }
9974
9976
9978 {
9980
9981 if (!action)
9982 {
9983 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9984 return;
9985 }
9986
9988 if (!ai)
9989 {
9991 return;
9992 }
9993
9995 if (!action_array)
9996 {
9997 action_array = new array<ActionBase_Basic>;
9999 }
10000 if (LogManager.IsActionLogEnable())
10001 {
10002 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10003 }
10004
10005 if (action_array.Find(action) != -1)
10006 {
10007 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10008 }
10009 else
10010 {
10011 action_array.Insert(action);
10012 }
10013 }
10014
10016 {
10017 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10018 ActionBase action = player.GetActionManager().GetAction(actionName);
10021
10022 if (action_array)
10023 {
10024 action_array.RemoveItem(action);
10025 }
10026 }
10027
10028
10029
10031 {
10032 ActionOverrideData overrideData = new ActionOverrideData();
10036
10038 if (!actionMap)
10039 {
10042 }
10043
10044 actionMap.Insert(this.
Type(), overrideData);
10045
10046 }
10047
10049
10051
10052
10054 {
10057
10060
10061 string config_to_search = "CfgVehicles";
10062 string muzzle_owner_config;
10063
10065 {
10066 if (IsInherited(Weapon))
10067 config_to_search = "CfgWeapons";
10068
10069 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10070
10071 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10072
10073 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10074
10075 if (config_OnFire_subclass_count > 0)
10076 {
10077 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10078
10079 for (int i = 0; i < config_OnFire_subclass_count; i++)
10080 {
10081 string particle_class = "";
10082 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10083 string config_OnFire_entry = config_OnFire_class + particle_class;
10084 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10085 WPOF_array.Insert(WPOF);
10086 }
10087
10088
10090 }
10091 }
10092
10094 {
10095 config_to_search = "CfgWeapons";
10096 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10097
10098 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10099
10100 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10101
10102 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10103 {
10104 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10105
10106 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10107 {
10108 string particle_class2 = "";
10109 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10110 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10111 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10112 WPOBE_array.Insert(WPOBE);
10113 }
10114
10115
10117 }
10118 }
10119 }
10120
10121
10123 {
10126
10128 {
10129 string config_to_search = "CfgVehicles";
10130
10131 if (IsInherited(Weapon))
10132 config_to_search = "CfgWeapons";
10133
10134 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10135 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10136
10137 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10138 {
10139
10141
10143 {
10145 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10147 return;
10148 }
10149
10152
10153
10154
10155 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10156 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10157
10158 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10159 {
10160 string particle_class = "";
10161 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10162 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10163 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10164
10165 if (entry_type == CT_CLASS)
10166 {
10167 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10168 WPOOH_array.Insert(WPOF);
10169 }
10170 }
10171
10172
10174 }
10175 }
10176 }
10177
10179 {
10181 }
10182
10184 {
10186 {
10188
10191
10194
10195 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10196 }
10197 }
10198
10200 {
10202 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10203
10205 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10206
10208 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10209
10211 {
10213 }
10214 }
10215
10217 {
10219 }
10220
10222 {
10225 else
10227
10229 {
10232 }
10233 else
10234 {
10237
10240 }
10241
10243 }
10244
10246 {
10248 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10249 }
10250
10252 {
10254 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10256 }
10257
10259 {
10261 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10262 }
10263
10265 {
10268
10269 OverheatingParticle OP = new OverheatingParticle();
10274
10276 }
10277
10279 {
10282
10283 return -1;
10284 }
10285
10287 {
10289 {
10292
10293 for (int i = count; i > 0; --i)
10294 {
10295 int id = i - 1;
10298
10301
10302 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10303 {
10304 if (p)
10305 {
10308 }
10309 }
10310 }
10311 }
10312 }
10313
10315 {
10317 {
10319 {
10320 int id = i - 1;
10322
10323 if (OP)
10324 {
10326
10327 if (p)
10328 {
10330 }
10331
10332 delete OP;
10333 }
10334 }
10335
10338 }
10339 }
10340
10343 {
10344 return 0.0;
10345 }
10346
10347
10349 {
10350 return 250;
10351 }
10352
10354 {
10355 return 0;
10356 }
10357
10360 {
10362 return true;
10363
10364 return false;
10365 }
10366
10369 {
10372
10374 {
10376 }
10377 else
10378 {
10379
10381 }
10382
10384 }
10385
10392 {
10393 return -1;
10394 }
10395
10396
10397
10398
10400 {
10402 {
10403 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10404 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10405
10406 if (r_index >= 0)
10407 {
10408 InventoryLocation r_il = new InventoryLocation;
10409 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10410
10411 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10414 {
10415 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10416 }
10418 {
10419 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10420 }
10421
10422 }
10423
10424 player.GetHumanInventory().ClearUserReservedLocation(this);
10425 }
10426
10429 }
10430
10431
10432
10433
10435 {
10436 return ItemBase.m_DebugActionsMask;
10437 }
10438
10440 {
10441 return ItemBase.m_DebugActionsMask & mask;
10442 }
10443
10445 {
10446 ItemBase.m_DebugActionsMask = mask;
10447 }
10448
10450 {
10451 ItemBase.m_DebugActionsMask |= mask;
10452 }
10453
10455 {
10456 ItemBase.m_DebugActionsMask &= ~mask;
10457 }
10458
10460 {
10462 {
10464 }
10465 else
10466 {
10468 }
10469 }
10470
10471
10473 {
10474 if (GetEconomyProfile())
10475 {
10476 float q_max = GetEconomyProfile().GetQuantityMax();
10477 if (q_max > 0)
10478 {
10479 float q_min = GetEconomyProfile().GetQuantityMin();
10480 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10481
10483 {
10484 ComponentEnergyManager comp = GetCompEM();
10486 {
10488 }
10489 }
10491 {
10493
10494 }
10495
10496 }
10497 }
10498 }
10499
10502 {
10503 EntityAI parent = GetHierarchyParent();
10504
10505 if (parent)
10506 {
10507 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10508 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10509 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10510 }
10511 }
10512
10515 {
10516 EntityAI parent = GetHierarchyParent();
10517
10518 if (parent)
10519 {
10520 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10521 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10522 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10523 }
10524 }
10525
10527 {
10528
10529
10530
10531
10533
10535 {
10536 if (ScriptInputUserData.CanStoreInputUserData())
10537 {
10538 ScriptInputUserData ctx = new ScriptInputUserData;
10544 ctx.
Write(use_stack_max);
10547
10549 {
10550 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10551 }
10552 }
10553 }
10554 else if (!
g_Game.IsMultiplayer())
10555 {
10557 }
10558 }
10559
10561 {
10563 }
10564
10566 {
10568 }
10569
10571 {
10573 }
10574
10576 {
10577
10578 return false;
10579 }
10580
10582 {
10583 return false;
10584 }
10585
10589 {
10590 return false;
10591 }
10592
10594 {
10595 return "";
10596 }
10597
10599
10601 {
10602 return false;
10603 }
10604
10606 {
10607 return true;
10608 }
10609
10610
10611
10613 {
10614 return true;
10615 }
10616
10618 {
10619 return true;
10620 }
10621
10623 {
10624 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10626 }
10627
10629 {
10631 }
10632
10634 {
10636 if (!is_being_placed)
10638 SetSynchDirty();
10639 }
10640
10641
10643
10645 {
10647 }
10648
10650 {
10652 }
10653
10655 {
10656 return 1;
10657 }
10658
10660 {
10661 return false;
10662 }
10663
10665 {
10667 SetSynchDirty();
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
10699
10700
10701
10702
10703
10705 {
10706 super.OnMovedInsideCargo(container);
10707
10708 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10709 }
10710
10711 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10712 {
10713 super.EEItemLocationChanged(oldLoc, newLoc);
10714
10715 PlayerBase newPlayer = null;
10716 PlayerBase oldPlayer = null;
10717
10718 if (newLoc.GetParent())
10719 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10720
10721 if (oldLoc.GetParent())
10722 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10723
10725 {
10726 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10727
10728 if (rIndex >= 0)
10729 {
10730 InventoryLocation rIl = new InventoryLocation;
10731 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10732
10733 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10736 {
10737 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10738 }
10740 {
10742 }
10743
10744 }
10745 }
10746
10748 {
10749 if (newPlayer)
10750 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10751
10752 if (newPlayer == oldPlayer)
10753 {
10754 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10755 {
10757 {
10758 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10759 {
10760 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10761 }
10762 }
10763 else
10764 {
10765 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10766 }
10767 }
10768
10769 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10770 {
10771 int type = oldLoc.GetType();
10773 {
10774 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10775 }
10777 {
10778 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10779 }
10780 }
10781 if (!m_OldLocation)
10782 {
10783 m_OldLocation = new InventoryLocation;
10784 }
10785 m_OldLocation.Copy(oldLoc);
10786 }
10787 else
10788 {
10789 if (m_OldLocation)
10790 {
10791 m_OldLocation.Reset();
10792 }
10793 }
10794
10795 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10796 }
10797 else
10798 {
10799 if (newPlayer)
10800 {
10801 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10802 if (resIndex >= 0)
10803 {
10804 InventoryLocation il = new InventoryLocation;
10805 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10807 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10810 {
10811 il.
GetParent().GetOnReleaseLock().Invoke(it);
10812 }
10814 {
10816 }
10817
10818 }
10819 }
10821 {
10822
10824 }
10825
10826 if (m_OldLocation)
10827 {
10828 m_OldLocation.Reset();
10829 }
10830 }
10831
10833 {
10834 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10835 }
10836
10838 {
10839 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10840 }
10841 }
10842
10843 override void EOnContact(IEntity other, Contact extra)
10844 {
10846 {
10847 int liquidType = -1;
10849 if (impactSpeed > 0.0)
10850 {
10852 #ifndef SERVER
10854 #else
10856 SetSynchDirty();
10857 #endif
10859 }
10860 }
10861
10862 #ifdef SERVER
10863 if (GetCompEM() && GetCompEM().IsPlugged())
10864 {
10865 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10866 GetCompEM().UnplugThis();
10867 }
10868 #endif
10869 }
10870
10872
10874 {
10876 }
10877
10879 {
10880
10881 }
10882
10884 {
10885 super.OnItemLocationChanged(old_owner, new_owner);
10886
10887 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10888 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10889
10890 if (!relatedPlayer && playerNew)
10891 relatedPlayer = playerNew;
10892
10893 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10894 {
10896 if (actionMgr)
10897 {
10898 ActionBase currentAction = actionMgr.GetRunningAction();
10899 if (currentAction)
10901 }
10902 }
10903
10904 Man ownerPlayerOld = null;
10905 Man ownerPlayerNew = null;
10906
10907 if (old_owner)
10908 {
10909 if (old_owner.
IsMan())
10910 {
10911 ownerPlayerOld = Man.Cast(old_owner);
10912 }
10913 else
10914 {
10915 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10916 }
10917 }
10918 else
10919 {
10921 {
10923
10924 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10925 {
10926 GetCompEM().UnplugThis();
10927 }
10928 }
10929 }
10930
10931 if (new_owner)
10932 {
10933 if (new_owner.
IsMan())
10934 {
10935 ownerPlayerNew = Man.Cast(new_owner);
10936 }
10937 else
10938 {
10939 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10940 }
10941 }
10942
10943 if (ownerPlayerOld != ownerPlayerNew)
10944 {
10945 if (ownerPlayerOld)
10946 {
10947 array<EntityAI> subItemsExit = new array<EntityAI>;
10949 for (int i = 0; i < subItemsExit.Count(); i++)
10950 {
10953 }
10954 }
10955
10956 if (ownerPlayerNew)
10957 {
10958 array<EntityAI> subItemsEnter = new array<EntityAI>;
10960 for (int j = 0; j < subItemsEnter.Count(); j++)
10961 {
10964 }
10965 }
10966 }
10967 else if (ownerPlayerNew != null)
10968 {
10969 PlayerBase nplayer;
10970 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10971 {
10972 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10974 for (int k = 0; k < subItemsUpdate.Count(); k++)
10975 {
10977 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10978 }
10979 }
10980 }
10981
10982 if (old_owner)
10983 old_owner.OnChildItemRemoved(this);
10984 if (new_owner)
10985 new_owner.OnChildItemReceived(this);
10986 }
10987
10988
10990 {
10991 super.EEDelete(parent);
10992 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10993 if (player)
10994 {
10996
10997 if (player.IsAlive())
10998 {
10999 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11000 if (r_index >= 0)
11001 {
11002 InventoryLocation r_il = new InventoryLocation;
11003 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11004
11005 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11008 {
11009 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11010 }
11012 {
11013 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11014 }
11015
11016 }
11017
11018 player.RemoveQuickBarEntityShortcut(this);
11019 }
11020 }
11021 }
11022
11024 {
11025 super.EEKilled(killer);
11026
11029 {
11030 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11031 {
11032 if (IsMagazine())
11033 {
11034 if (Magazine.Cast(this).GetAmmoCount() > 0)
11035 {
11037 }
11038 }
11039 else
11040 {
11042 }
11043 }
11044 }
11045 }
11046
11048 {
11049 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11050
11051 super.OnWasAttached(parent, slot_id);
11052
11055
11058 }
11059
11061 {
11062 super.OnWasDetached(parent, slot_id);
11063
11066
11069 }
11070
11072 {
11073 int idx;
11076
11077 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11078 if (inventory_slots.Count() < 1)
11079 {
11080 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11081 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11082 }
11083 else
11084 {
11085 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11086 }
11087
11088 idx = inventory_slots.Find(slot);
11089 if (idx < 0)
11090 return "";
11091
11092 return attach_types.Get(idx);
11093 }
11094
11096 {
11097 int idx = -1;
11098 string slot;
11099
11102
11103 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11104 if (inventory_slots.Count() < 1)
11105 {
11106 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11107 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11108 }
11109 else
11110 {
11111 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11112 if (detach_types.Count() < 1)
11113 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11114 }
11115
11116 for (int i = 0; i < inventory_slots.Count(); i++)
11117 {
11118 slot = inventory_slots.Get(i);
11119 }
11120
11121 if (slot != "")
11122 {
11123 if (detach_types.Count() == 1)
11124 idx = 0;
11125 else
11126 idx = inventory_slots.Find(slot);
11127 }
11128 if (idx < 0)
11129 return "";
11130
11131 return detach_types.Get(idx);
11132 }
11133
11135 {
11136
11138
11139
11140 float min_time = 1;
11141 float max_time = 3;
11142 float delay = Math.RandomFloat(min_time, max_time);
11143
11144 explode_timer.Run(delay, this, "DoAmmoExplosion");
11145 }
11146
11148 {
11149 Magazine magazine = Magazine.Cast(this);
11150 int pop_sounds_count = 6;
11151 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11152
11153
11154 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11155 string sound_name = pop_sounds[ sound_idx ];
11156 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11157
11158
11159 magazine.ServerAddAmmoCount(-1);
11160
11161
11162 float min_temp_to_explode = 100;
11163
11164 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11165 {
11167 }
11168 }
11169
11170
11171 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11172 {
11173 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11174
11175 const int CHANCE_DAMAGE_CARGO = 4;
11176 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11177 const int CHANCE_DAMAGE_NOTHING = 2;
11178
11180 {
11181 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11182 int chances;
11183 int rnd;
11184
11185 if (GetInventory().GetCargo())
11186 {
11187 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11188 rnd = Math.RandomInt(0,chances);
11189
11190 if (rnd < CHANCE_DAMAGE_CARGO)
11191 {
11193 }
11194 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11195 {
11197 }
11198 }
11199 else
11200 {
11201 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11202 rnd = Math.RandomInt(0,chances);
11203
11204 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11205 {
11207 }
11208 }
11209 }
11210 }
11211
11213 {
11214 CargoBase cargo = GetInventory().GetCargo();
11215 if (cargo)
11216 {
11218 if (item_count > 0)
11219 {
11220 int random_pick = Math.RandomInt(0, item_count);
11222 if (!item.IsExplosive())
11223 {
11224 item.AddHealth("","",damage);
11225 return true;
11226 }
11227 }
11228 }
11229 return false;
11230 }
11231
11233 {
11234 GameInventory inventory = GetInventory();
11236 if (attachment_count > 0)
11237 {
11238 int random_pick = Math.RandomInt(0, attachment_count);
11240 if (!attachment.IsExplosive())
11241 {
11242 attachment.AddHealth("","",damage);
11243 return true;
11244 }
11245 }
11246 return false;
11247 }
11248
11250 {
11252 }
11253
11255 {
11257 return GetInventory().CanRemoveEntity();
11258
11259 return false;
11260 }
11261
11263 {
11264
11266 return false;
11267
11268
11270 return false;
11271
11272
11273
11275 if (delta == 0)
11276 return false;
11277
11278
11279 return true;
11280 }
11281
11283 {
11285 {
11286 if (ScriptInputUserData.CanStoreInputUserData())
11287 {
11288 ScriptInputUserData ctx = new ScriptInputUserData;
11293 ctx.
Write(destination_entity);
11295 ctx.
Write(slot_id);
11297 }
11298 }
11299 else if (!
g_Game.IsMultiplayer())
11300 {
11302 }
11303 }
11304
11306 {
11307 float split_quantity_new;
11311 InventoryLocation loc = new InventoryLocation;
11312
11313 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11314 {
11316 split_quantity_new = stack_max;
11317 else
11319
11321 {
11322 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11323 if (new_item)
11324 {
11325 new_item.SetResultOfSplit(true);
11326 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11328 new_item.
SetQuantity(split_quantity_new,
false,
true);
11329 }
11330 }
11331 }
11332 else if (destination_entity && slot_id == -1)
11333 {
11334 if (quantity > stack_max)
11335 split_quantity_new = stack_max;
11336 else
11337 split_quantity_new = quantity;
11338
11340 {
11341 GameInventory destinationInventory = destination_entity.GetInventory();
11343 {
11346 }
11347
11348 if (new_item)
11349 {
11350 new_item.SetResultOfSplit(true);
11351 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11353 new_item.
SetQuantity(split_quantity_new,
false,
true);
11354 }
11355 }
11356 }
11357 else
11358 {
11359 if (stack_max != 0)
11360 {
11362 {
11364 }
11365
11366 if (split_quantity_new == 0)
11367 {
11368 if (!
g_Game.IsMultiplayer())
11369 player.PhysicalPredictiveDropItem(this);
11370 else
11371 player.ServerDropEntity(this);
11372 return;
11373 }
11374
11376 {
11378
11379 if (new_item)
11380 {
11381 new_item.SetResultOfSplit(true);
11382 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11385 new_item.PlaceOnSurface();
11386 }
11387 }
11388 }
11389 }
11390 }
11391
11393 {
11394 float split_quantity_new;
11398 InventoryLocation loc = new InventoryLocation;
11399
11400 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11401 {
11403 split_quantity_new = stack_max;
11404 else
11406
11408 {
11409 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11410 if (new_item)
11411 {
11412 new_item.SetResultOfSplit(true);
11413 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11415 new_item.
SetQuantity(split_quantity_new,
false,
true);
11416 }
11417 }
11418 }
11419 else if (destination_entity && slot_id == -1)
11420 {
11421 if (quantity > stack_max)
11422 split_quantity_new = stack_max;
11423 else
11424 split_quantity_new = quantity;
11425
11427 {
11428 GameInventory destinationInventory = destination_entity.GetInventory();
11430 {
11433 }
11434
11435 if (new_item)
11436 {
11437 new_item.SetResultOfSplit(true);
11438 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11440 new_item.
SetQuantity(split_quantity_new,
false,
true);
11441 }
11442 }
11443 }
11444 else
11445 {
11446 if (stack_max != 0)
11447 {
11449 {
11451 }
11452
11454 {
11456
11457 if (new_item)
11458 {
11459 new_item.SetResultOfSplit(true);
11460 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11463 new_item.PlaceOnSurface();
11464 }
11465 }
11466 }
11467 }
11468 }
11469
11471 {
11473 {
11474 if (ScriptInputUserData.CanStoreInputUserData())
11475 {
11476 ScriptInputUserData ctx = new ScriptInputUserData;
11481 dst.WriteToContext(ctx);
11483 }
11484 }
11485 else if (!
g_Game.IsMultiplayer())
11486 {
11488 }
11489 }
11490
11492 {
11494 {
11495 if (ScriptInputUserData.CanStoreInputUserData())
11496 {
11497 ScriptInputUserData ctx = new ScriptInputUserData;
11502 ctx.
Write(destination_entity);
11508 }
11509 }
11510 else if (!
g_Game.IsMultiplayer())
11511 {
11513 }
11514 }
11515
11517 {
11519 }
11520
11522 {
11524 float split_quantity_new;
11526 if (dst.IsValid())
11527 {
11528 int slot_id = dst.GetSlot();
11530
11531 if (quantity > stack_max)
11532 split_quantity_new = stack_max;
11533 else
11534 split_quantity_new = quantity;
11535
11537 {
11539
11540 if (new_item)
11541 {
11542 new_item.SetResultOfSplit(true);
11543 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11545 new_item.
SetQuantity(split_quantity_new,
false,
true);
11546 }
11547
11548 return new_item;
11549 }
11550 }
11551
11552 return null;
11553 }
11554
11556 {
11558 float split_quantity_new;
11560 if (destination_entity)
11561 {
11563 if (quantity > stackable)
11564 split_quantity_new = stackable;
11565 else
11566 split_quantity_new = quantity;
11567
11569 {
11570 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11571 if (new_item)
11572 {
11573 new_item.SetResultOfSplit(true);
11574 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11576 new_item.
SetQuantity(split_quantity_new,
false,
true);
11577 }
11578 }
11579 }
11580 }
11581
11583 {
11585 {
11586 if (ScriptInputUserData.CanStoreInputUserData())
11587 {
11588 ScriptInputUserData ctx = new ScriptInputUserData;
11593 ItemBase destination_entity =
this;
11594 ctx.
Write(destination_entity);
11598 }
11599 }
11600 else if (!
g_Game.IsMultiplayer())
11601 {
11603 }
11604 }
11605
11607 {
11609 float split_quantity_new;
11611 if (player)
11612 {
11614 if (quantity > stackable)
11615 split_quantity_new = stackable;
11616 else
11617 split_quantity_new = quantity;
11618
11620 {
11621 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11622 new_item =
ItemBase.Cast(in_hands);
11623 if (new_item)
11624 {
11625 new_item.SetResultOfSplit(true);
11626 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11628 new_item.SetQuantity(split_quantity_new, false, true);
11629 }
11630 }
11631 }
11632 }
11633
11635 {
11637 float split_quantity_new = Math.Floor(quantity * 0.5);
11638
11640 return;
11641
11643
11644 if (new_item)
11645 {
11646 if (new_item.GetQuantityMax() < split_quantity_new)
11647 {
11648 split_quantity_new = new_item.GetQuantityMax();
11649 }
11650
11651 new_item.SetResultOfSplit(true);
11652 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11653
11655 {
11658 }
11659 else
11660 {
11662 new_item.
SetQuantity(split_quantity_new,
false,
true);
11663 }
11664 }
11665 }
11666
11668 {
11670 float split_quantity_new = Math.Floor(quantity / 2);
11671
11673 return;
11674
11675 InventoryLocation invloc = new InventoryLocation;
11677
11679 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11680
11681 if (new_item)
11682 {
11683 if (new_item.GetQuantityMax() < split_quantity_new)
11684 {
11685 split_quantity_new = new_item.GetQuantityMax();
11686 }
11688 {
11691 }
11692 else if (split_quantity_new > 1)
11693 {
11695 new_item.
SetQuantity(split_quantity_new,
false,
true);
11696 }
11697 }
11698 }
11699
11702 {
11703 SetWeightDirty();
11705
11706 if (parent)
11707 parent.OnAttachmentQuantityChangedEx(this, delta);
11708
11710 {
11712 {
11714 }
11716 {
11717 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11719 }
11720 }
11721 }
11722
11725 {
11726
11727 }
11728
11731 {
11733 }
11734
11736 {
11737 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11738
11740 {
11741 if (newLevel == GameConstants.STATE_RUINED)
11742 {
11744 EntityAI parent = GetHierarchyParent();
11745 if (parent && parent.IsFireplace())
11746 {
11747 CargoBase cargo = GetInventory().GetCargo();
11748 if (cargo)
11749 {
11751 {
11753 }
11754 }
11755 }
11756 }
11757
11759 {
11760
11762 return;
11763 }
11764
11765 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11766 {
11768 }
11769 }
11770 }
11771
11772
11774 {
11775 super.OnRightClick();
11776
11778 {
11780 {
11781 if (ScriptInputUserData.CanStoreInputUserData())
11782 {
11783 EntityAI root = GetHierarchyRoot();
11784 Man playerOwner = GetHierarchyRootPlayer();
11785 InventoryLocation dst = new InventoryLocation;
11786
11787
11788 if (!playerOwner && root && root == this)
11789 {
11791 }
11792 else
11793 {
11794
11795 GetInventory().GetCurrentInventoryLocation(dst);
11797 {
11798 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11800 {
11802 }
11803 else
11804 {
11806
11807
11808 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11809 {
11811 }
11812 else
11813 {
11814 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11815 }
11816 }
11817 }
11818 }
11819
11820 ScriptInputUserData ctx = new ScriptInputUserData;
11828 }
11829 }
11830 else if (!
g_Game.IsMultiplayer())
11831 {
11833 }
11834 }
11835 }
11836
11838 {
11839 if (root)
11840 {
11841 vector m4[4];
11842 root.GetTransform(m4);
11843 dst.SetGround(this, m4);
11844 }
11845 else
11846 {
11847 GetInventory().GetCurrentInventoryLocation(dst);
11848 }
11849 }
11850
11851 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11852 {
11853
11854 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11855 return false;
11856
11857 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11858 return false;
11859
11860
11862 return false;
11863
11864
11865 Magazine mag = Magazine.Cast(this);
11866 if (mag)
11867 {
11868 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11869 return false;
11870
11871 if (stack_max_limit)
11872 {
11873 Magazine other_mag = Magazine.Cast(other_item);
11874 if (other_item)
11875 {
11876 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11877 return false;
11878 }
11879
11880 }
11881 }
11882 else
11883 {
11884
11886 return false;
11887
11889 return false;
11890 }
11891
11892 PlayerBase player = null;
11893 if (CastTo(player, GetHierarchyRootPlayer()))
11894 {
11895 if (player.GetInventory().HasAttachment(this))
11896 return false;
11897
11898 if (player.IsItemsToDelete())
11899 return false;
11900 }
11901
11902 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11903 return false;
11904
11905 int slotID;
11907 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11908 return false;
11909
11910 return true;
11911 }
11912
11914 {
11916 }
11917
11919 {
11920 return m_IsResultOfSplit;
11921 }
11922
11924 {
11925 m_IsResultOfSplit = value;
11926 }
11927
11929 {
11931 }
11932
11934 {
11935 float other_item_quantity = other_item.GetQuantity();
11936 float this_free_space;
11937
11939
11941
11942 if (other_item_quantity > this_free_space)
11943 {
11944 return this_free_space;
11945 }
11946 else
11947 {
11948 return other_item_quantity;
11949 }
11950 }
11951
11953 {
11955 }
11956
11958 {
11960 return;
11961
11962 if (!IsMagazine() && other_item)
11963 {
11965 if (quantity_used != 0)
11966 {
11967 float hp1 = GetHealth01("","");
11968 float hp2 = other_item.GetHealth01("","");
11969 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11970 hpResult = hpResult / (
GetQuantity() + quantity_used);
11971
11972 hpResult *= GetMaxHealth();
11973 Math.Round(hpResult);
11974 SetHealth("", "Health", hpResult);
11975
11977 other_item.AddQuantity(-quantity_used);
11978 }
11979 }
11981 }
11982
11984 {
11985 #ifdef SERVER
11986 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11987 GetHierarchyParent().IncreaseLifetimeUp();
11988 #endif
11989 };
11990
11992 {
11993 PlayerBase p = PlayerBase.Cast(player);
11994
11995 array<int> recipesIds = p.m_Recipes;
11996 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11997 if (moduleRecipesManager)
11998 {
11999 EntityAI itemInHands = player.GetEntityInHands();
12000 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12001 }
12002
12003 for (int i = 0;i < recipesIds.Count(); i++)
12004 {
12005 int key = recipesIds.Get(i);
12006 string recipeName = moduleRecipesManager.GetRecipeName(key);
12008 }
12009 }
12010
12011
12012 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12013 {
12014 super.GetDebugActions(outputList);
12015
12016
12022
12023
12028
12033
12034
12038
12039
12041 {
12045 }
12046
12049
12050
12054
12056
12057 InventoryLocation loc = new InventoryLocation();
12058 GetInventory().GetCurrentInventoryLocation(loc);
12060 {
12061 if (Gizmo_IsSupported())
12064 }
12065
12067 }
12068
12069
12070
12071
12073 {
12074 super.OnAction(action_id, player, ctx);
12075
12077 {
12078 switch (action_id)
12079 {
12083 return true;
12087 return true;
12088 }
12089 }
12090
12092 {
12093 switch (action_id)
12094 {
12096 Delete();
12097 return true;
12098 }
12099 }
12100
12101 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12102 {
12103 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12104 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12105 PlayerBase p = PlayerBase.Cast(player);
12106 if (
EActions.RECIPES_RANGE_START < 1000)
12107 {
12108 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12109 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12110 }
12111 }
12112 #ifndef SERVER
12113 else if (action_id ==
EActions.WATCH_PLAYER)
12114 {
12115 PluginDeveloper.SetDeveloperItemClientEx(player);
12116 }
12117 #endif
12119 {
12120 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12121 {
12122 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12123 OnDebugButtonPressServer(id + 1);
12124 }
12125
12126 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12127 {
12128 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12130 }
12131
12132 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12133 {
12134 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12136 }
12137
12138 else if (action_id ==
EActions.ADD_QUANTITY)
12139 {
12140 if (IsMagazine())
12141 {
12142 Magazine mag = Magazine.Cast(this);
12143 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12144 }
12145 else
12146 {
12148 }
12149
12150 if (m_EM)
12151 {
12152 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12153 }
12154
12155 }
12156
12157 else if (action_id ==
EActions.REMOVE_QUANTITY)
12158 {
12159 if (IsMagazine())
12160 {
12161 Magazine mag2 = Magazine.Cast(this);
12162 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12163 }
12164 else
12165 {
12167 }
12168 if (m_EM)
12169 {
12170 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12171 }
12172
12173 }
12174
12175 else if (action_id ==
EActions.SET_QUANTITY_0)
12176 {
12178
12179 if (m_EM)
12180 {
12181 m_EM.SetEnergy(0);
12182 }
12183 }
12184
12185 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12186 {
12188
12189 if (m_EM)
12190 {
12191 m_EM.SetEnergy(m_EM.GetEnergyMax());
12192 }
12193 }
12194
12195 else if (action_id ==
EActions.ADD_HEALTH)
12196 {
12197 AddHealth("","",GetMaxHealth("","Health")/5);
12198 }
12199 else if (action_id ==
EActions.REMOVE_HEALTH)
12200 {
12201 AddHealth("","",-GetMaxHealth("","Health")/5);
12202 }
12203 else if (action_id ==
EActions.DESTROY_HEALTH)
12204 {
12205 SetHealth01("","",0);
12206 }
12207 else if (action_id ==
EActions.WATCH_ITEM)
12208 {
12210 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12211 #ifdef DEVELOPER
12212 SetDebugDeveloper_item(this);
12213 #endif
12214 }
12215
12216 else if (action_id ==
EActions.ADD_TEMPERATURE)
12217 {
12218 AddTemperature(20);
12219
12220 }
12221
12222 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12223 {
12224 AddTemperature(-20);
12225
12226 }
12227
12228 else if (action_id ==
EActions.FLIP_FROZEN)
12229 {
12230 SetFrozen(!GetIsFrozen());
12231
12232 }
12233
12234 else if (action_id ==
EActions.ADD_WETNESS)
12235 {
12237
12238 }
12239
12240 else if (action_id ==
EActions.REMOVE_WETNESS)
12241 {
12243
12244 }
12245
12246 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12247 {
12250
12251
12252 }
12253
12254 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12255 {
12258 }
12259
12260 else if (action_id ==
EActions.MAKE_SPECIAL)
12261 {
12262 auto debugParams = DebugSpawnParams.WithPlayer(player);
12263 OnDebugSpawnEx(debugParams);
12264 }
12265
12266 }
12267
12268
12269 return false;
12270 }
12271
12272
12273
12274
12278
12281
12282
12283
12285 {
12286 return false;
12287 }
12288
12289
12291 {
12292 return true;
12293 }
12294
12295
12297 {
12298 return true;
12299 }
12300
12301
12302
12304 {
12305 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12306 return g_Game.ConfigIsExisting(config_path);
12307 }
12308
12311 {
12312 return null;
12313 }
12314
12316 {
12317 return false;
12318 }
12319
12321 {
12322 return false;
12323 }
12324
12328
12329
12331 {
12332 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12333 return module_repairing.CanRepair(this, item_repair_kit);
12334 }
12335
12336
12337 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12338 {
12339 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12340 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12341 }
12342
12343
12345 {
12346
12347
12348
12349
12350
12351
12352
12353
12354 return 1;
12355 }
12356
12357
12358
12360 {
12362 }
12363
12364
12365
12367 {
12369 }
12370
12371
12380 {
12381 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12382
12383 if (player)
12384 {
12385 player.MessageStatus(text);
12386 }
12387 }
12388
12389
12398 {
12399 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12400
12401 if (player)
12402 {
12403 player.MessageAction(text);
12404 }
12405 }
12406
12407
12416 {
12417 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12418
12419 if (player)
12420 {
12421 player.MessageFriendly(text);
12422 }
12423 }
12424
12425
12434 {
12435 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12436
12437 if (player)
12438 {
12439 player.MessageImportant(text);
12440 }
12441 }
12442
12444 {
12445 return true;
12446 }
12447
12448
12449 override bool KindOf(
string tag)
12450 {
12451 bool found = false;
12452 string item_name = this.
GetType();
12454 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12455
12456 int array_size = item_tag_array.Count();
12457 for (int i = 0; i < array_size; i++)
12458 {
12459 if (item_tag_array.Get(i) == tag)
12460 {
12461 found = true;
12462 break;
12463 }
12464 }
12465 return found;
12466 }
12467
12468
12470 {
12471
12472 super.OnRPC(sender, rpc_type,ctx);
12473
12474
12475 switch (rpc_type)
12476 {
12477 #ifndef SERVER
12478 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12479 Param2<bool, string> p = new Param2<bool, string>(false, "");
12480
12482 return;
12483
12484 bool play = p.param1;
12485 string soundSet = p.param2;
12486
12487 if (play)
12488 {
12490 {
12492 {
12494 }
12495 }
12496 else
12497 {
12499 }
12500 }
12501 else
12502 {
12504 }
12505
12506 break;
12507 #endif
12508
12509 }
12510
12512 {
12514 }
12515 }
12516
12517
12518
12519
12521 {
12522 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12523 return plugin.GetID(
name);
12524 }
12525
12527 {
12528 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12529 return plugin.GetName(id);
12530 }
12531
12534 {
12535
12536
12537 int varFlags;
12538 if (!ctx.
Read(varFlags))
12539 return;
12540
12541 if (varFlags & ItemVariableFlags.FLOAT)
12542 {
12544 }
12545 }
12546
12548 {
12549
12550 super.SerializeNumericalVars(floats_out);
12551
12552
12553
12555 {
12557 }
12558
12560 {
12562 }
12563
12565 {
12567 }
12568
12570 {
12575 }
12576
12578 {
12580 }
12581 }
12582
12584 {
12585
12586 super.DeSerializeNumericalVars(floats);
12587
12588
12589 int index = 0;
12590 int mask = Math.Round(floats.Get(index));
12591
12592 index++;
12593
12595 {
12597 {
12599 }
12600 else
12601 {
12602 float quantity = floats.Get(index);
12603 SetQuantity(quantity,
true,
false,
false,
false);
12604 }
12605 index++;
12606 }
12607
12609 {
12610 float wet = floats.Get(index);
12612 index++;
12613 }
12614
12616 {
12617 int liquidtype = Math.Round(floats.Get(index));
12619 index++;
12620 }
12621
12623 {
12625 index++;
12627 index++;
12629 index++;
12631 index++;
12632 }
12633
12635 {
12636 int cleanness = Math.Round(floats.Get(index));
12638 index++;
12639 }
12640 }
12641
12643 {
12644 super.WriteVarsToCTX(ctx);
12645
12646
12648 {
12650 }
12651
12653 {
12655 }
12656
12658 {
12660 }
12661
12663 {
12664 int r,g,b,a;
12670 }
12671
12673 {
12675 }
12676 }
12677
12679 {
12680 if (!super.ReadVarsFromCTX(ctx,version))
12681 return false;
12682
12683 int intValue;
12684 float value;
12685
12686 if (version < 140)
12687 {
12688 if (!ctx.
Read(intValue))
12689 return false;
12690
12691 m_VariablesMask = intValue;
12692 }
12693
12695 {
12696 if (!ctx.
Read(value))
12697 return false;
12698
12700 {
12702 }
12703 else
12704 {
12706 }
12707 }
12708
12709 if (version < 140)
12710 {
12712 {
12713 if (!ctx.
Read(value))
12714 return false;
12715 SetTemperatureDirect(value);
12716 }
12717 }
12718
12720 {
12721 if (!ctx.
Read(value))
12722 return false;
12724 }
12725
12727 {
12728 if (!ctx.
Read(intValue))
12729 return false;
12731 }
12732
12734 {
12735 int r,g,b,a;
12737 return false;
12739 return false;
12741 return false;
12743 return false;
12744
12746 }
12747
12749 {
12750 if (!ctx.
Read(intValue))
12751 return false;
12753 }
12754
12755 if (version >= 138 && version < 140)
12756 {
12758 {
12759 if (!ctx.
Read(intValue))
12760 return false;
12761 SetFrozen(intValue);
12762 }
12763 }
12764
12765 return true;
12766 }
12767
12768
12770 {
12773 {
12775 }
12776
12777 if (!super.OnStoreLoad(ctx, version))
12778 {
12780 return false;
12781 }
12782
12783 if (version >= 114)
12784 {
12785 bool hasQuickBarIndexSaved;
12786
12787 if (!ctx.
Read(hasQuickBarIndexSaved))
12788 {
12790 return false;
12791 }
12792
12793 if (hasQuickBarIndexSaved)
12794 {
12795 int itmQBIndex;
12796
12797
12798 if (!ctx.
Read(itmQBIndex))
12799 {
12801 return false;
12802 }
12803
12804 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12805 if (itmQBIndex != -1 && parentPlayer)
12806 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12807 }
12808 }
12809 else
12810 {
12811
12812 PlayerBase player;
12813 int itemQBIndex;
12814 if (version ==
int.
MAX)
12815 {
12816 if (!ctx.
Read(itemQBIndex))
12817 {
12819 return false;
12820 }
12821 }
12822 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12823 {
12824
12825 if (!ctx.
Read(itemQBIndex))
12826 {
12828 return false;
12829 }
12830 if (itemQBIndex != -1 && player)
12831 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12832 }
12833 }
12834
12835 if (version < 140)
12836 {
12837
12838 if (!LoadVariables(ctx, version))
12839 {
12841 return false;
12842 }
12843 }
12844
12845
12847 {
12849 return false;
12850 }
12851 if (version >= 132)
12852 {
12854 if (raib)
12855 {
12857 {
12859 return false;
12860 }
12861 }
12862 }
12863
12865 return true;
12866 }
12867
12868
12869
12871 {
12872 super.OnStoreSave(ctx);
12873
12874 PlayerBase player;
12875 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12876 {
12878
12879 int itemQBIndex = -1;
12880 itemQBIndex = player.FindQuickBarEntityIndex(this);
12881 ctx.
Write(itemQBIndex);
12882 }
12883 else
12884 {
12886 }
12887
12889
12891 if (raib)
12892 {
12894 }
12895 }
12896
12897
12899 {
12900 super.AfterStoreLoad();
12901
12903 {
12905 }
12906
12908 {
12911 }
12912 }
12913
12915 {
12916 super.EEOnAfterLoad();
12917
12919 {
12921 }
12922
12925 }
12926
12928 {
12929 return false;
12930 }
12931
12932
12933
12935 {
12937 {
12938 #ifdef PLATFORM_CONSOLE
12939
12941 {
12943 if (menu)
12944 {
12946 }
12947 }
12948 #endif
12949 }
12950
12952 {
12955 }
12956
12958 {
12959 SetWeightDirty();
12961 }
12963 {
12966 }
12967
12969 {
12972
12975 }
12977 {
12981 }
12982
12983 super.OnVariablesSynchronized();
12984 }
12985
12986
12987
12989 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12990 {
12991 if (!IsServerCheck(allow_client))
12992 return false;
12993
12995 return false;
12996
12999
13000 if (value <= (min + 0.001))
13001 value = min;
13002
13003 if (value == min)
13004 {
13005 if (destroy_config)
13006 {
13007 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13008 if (dstr)
13009 {
13011 this.Delete();
13012 return true;
13013 }
13014 }
13015 else if (destroy_forced)
13016 {
13018 this.Delete();
13019 return true;
13020 }
13021
13023 }
13024
13027
13029 {
13030 EntityAI parent = GetHierarchyRoot();
13031 InventoryLocation iLoc = new InventoryLocation();
13032 GetInventory().GetCurrentInventoryLocation(iLoc);
13034 {
13035 int iLocSlot = iLoc.
GetSlot();
13037 {
13039 }
13041 {
13043 }
13044 }
13045 }
13046
13048 {
13050
13051 if (delta)
13053 }
13054
13056
13057 return false;
13058 }
13059
13060
13062 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13063 {
13065 }
13066
13068 {
13071 }
13072
13074 {
13077 }
13078
13080 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13081 {
13082 float value_clamped = Math.Clamp(value, 0, 1);
13084 SetQuantity(result, destroy_config, destroy_forced);
13085 }
13086
13087
13090 {
13092 }
13093
13095 {
13097 }
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13109 {
13110 int slot = -1;
13111 GameInventory inventory = GetInventory();
13112 if (inventory)
13113 {
13114 InventoryLocation il = new InventoryLocation;
13117 }
13118
13120 }
13121
13123 {
13124 float quantity_max = 0;
13125
13127 {
13128 if (attSlotID != -1)
13129 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13130
13131 if (quantity_max <= 0)
13133 }
13134
13135 if (quantity_max <= 0)
13137
13138 return quantity_max;
13139 }
13140
13142 {
13144 }
13145
13147 {
13149 }
13150
13151
13153 {
13155 }
13156
13158 {
13160 }
13161
13163 {
13165 }
13166
13167
13169 {
13170
13171 float weightEx = GetWeightEx();
13172 float special = GetInventoryAndCargoWeight();
13173 return weightEx - special;
13174 }
13175
13176
13178 {
13180 }
13181
13183 {
13185 {
13186 #ifdef DEVELOPER
13187 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13188 {
13189 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13191 }
13192 #endif
13193
13194 return GetQuantity() * GetConfigWeightModified();
13195 }
13196 else if (HasEnergyManager())
13197 {
13198 #ifdef DEVELOPER
13199 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13200 {
13201 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13202 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13203 }
13204 #endif
13205 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13206 }
13207 else
13208 {
13209 #ifdef DEVELOPER
13210 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13211 {
13212 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13213 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13214 }
13215 #endif
13216 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13217 }
13218 }
13219
13222 {
13223 int item_count = 0;
13225
13226 GameInventory inventory = GetInventory();
13227 CargoBase cargo = inventory.
GetCargo();
13228 if (cargo != NULL)
13229 {
13231 }
13232
13234 for (int i = 0; i < nAttachments; ++i)
13235 {
13237 if (item)
13238 item_count += item.GetNumberOfItems();
13239 }
13240 return item_count;
13241 }
13242
13245 {
13246 float weight = 0;
13247 float wetness = 1;
13248 if (include_wetness)
13251 {
13252 weight = wetness * m_ConfigWeight;
13253 }
13255 {
13256 weight = 1;
13257 }
13258 return weight;
13259 }
13260
13261
13262
13264 {
13265 GameInventory inventory = GetInventory();
13266 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13267 {
13268 array<EntityAI> items = new array<EntityAI>;
13270 for (int i = 0; i < items.Count(); ++i)
13271 {
13273 if (item)
13274 {
13275 g_Game.ObjectDelete(item);
13276 }
13277 }
13278 }
13279 }
13280
13281
13282
13283
13285 {
13286 float energy = 0;
13287 if (HasEnergyManager())
13288 {
13289 energy = GetCompEM().GetEnergy();
13290 }
13291 return energy;
13292 }
13293
13294
13296 {
13297 super.OnEnergyConsumed();
13298
13300 }
13301
13303 {
13304 super.OnEnergyAdded();
13305
13307 }
13308
13309
13311 {
13312 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13313 {
13315 {
13316 float energy_0to1 = GetCompEM().GetEnergy0To1();
13318 }
13319 }
13320 }
13321
13322
13324 {
13325 return ConfigGetFloat("heatIsolation");
13326 }
13327
13329 {
13331 }
13332
13334 {
13335 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13336 if (
g_Game.ConfigIsExisting(paramPath))
13337 return g_Game.ConfigGetFloat(paramPath);
13338
13339 return 0.0;
13340 }
13341
13343 {
13344 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13345 if (
g_Game.ConfigIsExisting(paramPath))
13346 return g_Game.ConfigGetFloat(paramPath);
13347
13348 return 0.0;
13349 }
13350
13351 override void SetWet(
float value,
bool allow_client =
false)
13352 {
13353 if (!IsServerCheck(allow_client))
13354 return;
13355
13358
13360
13361 m_VarWet = Math.Clamp(value, min, max);
13362
13364 {
13367 }
13368 }
13369
13370 override void AddWet(
float value)
13371 {
13373 }
13374
13376 {
13378 }
13379
13381 {
13383 }
13384
13386 {
13388 }
13389
13391 {
13393 }
13394
13396 {
13398 }
13399
13400 override void OnWetChanged(
float newVal,
float oldVal)
13401 {
13404 if (newLevel != oldLevel)
13405 {
13407 }
13408 }
13409
13411 {
13412 SetWeightDirty();
13413 }
13414
13416 {
13417 return GetWetLevelInternal(
m_VarWet);
13418 }
13419
13420
13421
13423 {
13425 }
13426
13428 {
13430 }
13431
13433 {
13435 }
13436
13438 {
13440 }
13441
13442
13443
13445 {
13446 if (ConfigIsExisting("itemModelLength"))
13447 {
13448 return ConfigGetFloat("itemModelLength");
13449 }
13450 return 0;
13451 }
13452
13454 {
13455 if (ConfigIsExisting("itemAttachOffset"))
13456 {
13457 return ConfigGetFloat("itemAttachOffset");
13458 }
13459 return 0;
13460 }
13461
13462 override void SetCleanness(
int value,
bool allow_client =
false)
13463 {
13464 if (!IsServerCheck(allow_client))
13465 return;
13466
13468
13470
13473 }
13474
13476 {
13478 }
13479
13481 {
13482 return true;
13483 }
13484
13485
13486
13487
13489 {
13491 }
13492
13494 {
13496 }
13497
13498
13499
13500
13501 override void SetColor(
int r,
int g,
int b,
int a)
13502 {
13508 }
13510 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13511 {
13516 }
13517
13519 {
13521 }
13522
13525 {
13526 int r,g,b,a;
13528 r = r/255;
13529 g = g/255;
13530 b = b/255;
13531 a = a/255;
13532 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13533 }
13534
13535
13536
13537 override void SetLiquidType(
int value,
bool allow_client =
false)
13538 {
13539 if (!IsServerCheck(allow_client))
13540 return;
13541
13546 }
13547
13549 {
13550 return ConfigGetInt("varLiquidTypeInit");
13551 }
13552
13554 {
13556 }
13557
13559 {
13561 SetFrozen(false);
13562 }
13563
13566 {
13567 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13568 }
13569
13570
13573 {
13574 PlayerBase nplayer;
13575 if (PlayerBase.CastTo(nplayer, player))
13576 {
13578 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13579 }
13580 }
13581
13582
13585 {
13586 PlayerBase nplayer;
13587 if (PlayerBase.CastTo(nplayer,player))
13588 {
13589 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13590 }
13591
13592 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13593
13594 if (HasEnergyManager())
13595 {
13596 GetCompEM().UpdatePlugState();
13597 }
13598 }
13599
13600
13602 {
13603 super.OnPlacementStarted(player);
13604
13606 }
13607
13608 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13609 {
13611 {
13612 m_AdminLog.OnPlacementComplete(player,
this);
13613 }
13614
13615 super.OnPlacementComplete(player, position, orientation);
13616 }
13617
13618
13619
13620
13621
13623 {
13625 {
13626 return true;
13627 }
13628 else
13629 {
13630 return false;
13631 }
13632 }
13633
13634
13636 {
13638 {
13640 }
13641 }
13642
13643
13645 {
13647 }
13648
13650 {
13652 }
13653
13654 override void InsertAgent(
int agent,
float count = 1)
13655 {
13656 if (count < 1)
13657 return;
13658
13660 }
13661
13664 {
13666 }
13667
13668
13670 {
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
13710
13711
13712
13713
13714
13716 {
13718 return false;
13719 return true;
13720 }
13721
13723 {
13724
13726 }
13727
13728
13731 {
13732 super.CheckForRoofLimited(timeTresholdMS);
13733
13734 float time =
g_Game.GetTime();
13735 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13736 {
13737 m_PreviousRoofTestTime = time;
13738 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13739 }
13740 }
13741
13742
13744 {
13746 {
13747 return 0;
13748 }
13749
13750 if (GetInventory().GetAttachmentSlotsCount() != 0)
13751 {
13752 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13753 if (filter)
13754 return filter.GetProtectionLevel(type, false, system);
13755 else
13756 return 0;
13757 }
13758
13759 string subclassPath, entryName;
13760
13761 switch (type)
13762 {
13764 entryName = "biological";
13765 break;
13767 entryName = "chemical";
13768 break;
13769 default:
13770 entryName = "biological";
13771 break;
13772 }
13773
13774 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13775
13776 return g_Game.ConfigGetFloat(subclassPath + entryName);
13777 }
13778
13779
13780
13783 {
13784 if (!IsMagazine())
13786
13788 }
13789
13790
13791
13792
13793
13798 {
13799 return true;
13800 }
13801
13803 {
13805 }
13806
13807
13808
13809
13810
13812 {
13813 if (parent)
13814 {
13815 if (parent.IsInherited(DayZInfected))
13816 return true;
13817
13818 if (!parent.IsRuined())
13819 return true;
13820 }
13821
13822 return true;
13823 }
13824
13826 {
13827 if (!super.CanPutAsAttachment(parent))
13828 {
13829 return false;
13830 }
13831
13832 if (!IsRuined() && !parent.IsRuined())
13833 {
13834 return true;
13835 }
13836
13837 return false;
13838 }
13839
13841 {
13842
13843
13844
13845
13846 return super.CanReceiveItemIntoCargo(item);
13847 }
13848
13850 {
13851
13852
13853
13854
13855 GameInventory attachmentInv = attachment.GetInventory();
13857 {
13858 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13859 return false;
13860 }
13861
13862 InventoryLocation loc = new InventoryLocation();
13863 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13864 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13865 return false;
13866
13867 return super.CanReceiveAttachment(attachment, slotId);
13868 }
13869
13871 {
13872 if (!super.CanReleaseAttachment(attachment))
13873 return false;
13874
13875 return GetInventory().AreChildrenAccessible();
13876 }
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13899 {
13900 int id = muzzle_owner.GetMuzzleID();
13901 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13902
13903 if (WPOF_array)
13904 {
13905 for (int i = 0; i < WPOF_array.Count(); i++)
13906 {
13907 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13908
13909 if (WPOF)
13910 {
13911 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13912 }
13913 }
13914 }
13915 }
13916
13917
13919 {
13920 int id = muzzle_owner.GetMuzzleID();
13922
13923 if (WPOBE_array)
13924 {
13925 for (int i = 0; i < WPOBE_array.Count(); i++)
13926 {
13927 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13928
13929 if (WPOBE)
13930 {
13931 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13932 }
13933 }
13934 }
13935 }
13936
13937
13939 {
13940 int id = muzzle_owner.GetMuzzleID();
13941 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13942
13943 if (WPOOH_array)
13944 {
13945 for (int i = 0; i < WPOOH_array.Count(); i++)
13946 {
13947 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13948
13949 if (WPOOH)
13950 {
13951 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13952 }
13953 }
13954 }
13955 }
13956
13957
13959 {
13960 int id = muzzle_owner.GetMuzzleID();
13961 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13962
13963 if (WPOOH_array)
13964 {
13965 for (int i = 0; i < WPOOH_array.Count(); i++)
13966 {
13967 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13968
13969 if (WPOOH)
13970 {
13971 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13972 }
13973 }
13974 }
13975 }
13976
13977
13979 {
13980 int id = muzzle_owner.GetMuzzleID();
13981 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13982
13983 if (WPOOH_array)
13984 {
13985 for (int i = 0; i < WPOOH_array.Count(); i++)
13986 {
13987 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13988
13989 if (WPOOH)
13990 {
13991 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13992 }
13993 }
13994 }
13995 }
13996
13997
13998
14000 {
14002 {
14003 return true;
14004 }
14005
14006 return false;
14007 }
14008
14010 {
14012 {
14013 return true;
14014 }
14015
14016 return false;
14017 }
14018
14020 {
14022 {
14023 return true;
14024 }
14025
14026 return false;
14027 }
14028
14030 {
14031 return false;
14032 }
14033
14036 {
14037 return UATimeSpent.DEFAULT_DEPLOY;
14038 }
14039
14040
14041
14042
14044 {
14046 SetSynchDirty();
14047 }
14048
14050 {
14052 }
14053
14054
14056 {
14057 return false;
14058 }
14059
14062 {
14063 string att_type = "None";
14064
14065 if (ConfigIsExisting("soundAttType"))
14066 {
14067 att_type = ConfigGetString("soundAttType");
14068 }
14069
14071 }
14072
14074 {
14076 }
14077
14078
14079
14080
14081
14087
14089 {
14092
14094 }
14095
14096
14098 {
14100 return;
14101
14103
14106
14109
14110 SoundParameters params = new SoundParameters();
14114 }
14115
14116
14118 {
14120 {
14123
14124 SetSynchDirty();
14125
14128 }
14129 }
14130
14132 {
14134 }
14135
14136
14138 {
14140 return;
14141
14143 SetSynchDirty();
14144
14147 }
14148
14150 {
14153 }
14154
14156 {
14158 }
14159
14160 void OnApply(PlayerBase player);
14161
14163 {
14164 return 1.0;
14165 };
14166
14168 {
14170 }
14171
14173 {
14175 }
14176
14178
14180 {
14181 SetDynamicPhysicsLifeTime(0.01);
14183 }
14184
14186 {
14187 array<string> zone_names = new array<string>;
14188 GetDamageZones(zone_names);
14189 for (int i = 0; i < zone_names.Count(); i++)
14190 {
14191 SetHealthMax(zone_names.Get(i),"Health");
14192 }
14193 SetHealthMax("","Health");
14194 }
14195
14198 {
14199 float global_health = GetHealth01("","Health");
14200 array<string> zones = new array<string>;
14201 GetDamageZones(zones);
14202
14203 for (int i = 0; i < zones.Count(); i++)
14204 {
14205 SetHealth01(zones.Get(i),"Health",global_health);
14206 }
14207 }
14208
14211 {
14212 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14213 }
14214
14216 {
14217 if (!hasRootAsPlayer)
14218 {
14219 if (refParentIB)
14220 {
14221
14222 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14223 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14224
14225 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14226 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14227
14230 }
14231 else
14232 {
14233
14236 }
14237 }
14238 }
14239
14241 {
14243 {
14244 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14245 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14246 {
14247 float heatPermCoef = 1.0;
14249 while (ent)
14250 {
14251 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14252 ent = ent.GetHierarchyParent();
14253 }
14254
14255 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14256 }
14257 }
14258 }
14259
14261 {
14262
14263 EntityAI parent = GetHierarchyParent();
14264 if (!parent)
14265 {
14266 hasParent = false;
14267 hasRootAsPlayer = false;
14268 }
14269 else
14270 {
14271 hasParent = true;
14272 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14273 refParentIB =
ItemBase.Cast(parent);
14274 }
14275 }
14276
14277 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14278 {
14279
14280 }
14281
14283 {
14284
14285 return false;
14286 }
14287
14289 {
14290
14291
14292 return false;
14293 }
14294
14296 {
14297
14298 return false;
14299 }
14300
14303 {
14304 return !GetIsFrozen() &&
IsOpen();
14305 }
14306
14308 {
14309 bool hasParent = false, hasRootAsPlayer = false;
14311
14312 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14313 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14314
14315 if (wwtu || foodDecay)
14316 {
14320
14321 if (processWetness || processTemperature || processDecay)
14322 {
14324
14325 if (processWetness)
14326 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14327
14328 if (processTemperature)
14330
14331 if (processDecay)
14332 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14333 }
14334 }
14335 }
14336
14339 {
14341 }
14342
14344 {
14347
14348 return super.GetTemperatureFreezeThreshold();
14349 }
14350
14352 {
14355
14356 return super.GetTemperatureThawThreshold();
14357 }
14358
14360 {
14363
14364 return super.GetItemOverheatThreshold();
14365 }
14366
14368 {
14370 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14371
14372 return super.GetTemperatureFreezeTime();
14373 }
14374
14376 {
14378 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14379
14380 return super.GetTemperatureThawTime();
14381 }
14382
14387
14389 {
14390 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14391 }
14392
14394 {
14395 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14396 }
14397
14400 {
14402 }
14403
14405 {
14407 }
14408
14410 {
14412 }
14413
14416 {
14417 return null;
14418 }
14419
14422 {
14423 return false;
14424 }
14425
14427 {
14429 {
14432 if (!trg)
14433 {
14435 explosive = this;
14436 }
14437
14438 explosive.PairRemote(trg);
14440
14441 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14442 trg.SetPersistentPairID(persistentID);
14443 explosive.SetPersistentPairID(persistentID);
14444
14445 return true;
14446 }
14447 return false;
14448 }
14449
14452 {
14453 float ret = 1.0;
14456 ret *= GetHealth01();
14457
14458 return ret;
14459 }
14460
14461 #ifdef DEVELOPER
14462 override void SetDebugItem()
14463 {
14464 super.SetDebugItem();
14465 _itemBase = this;
14466 }
14467
14469 {
14470 string text = super.GetDebugText();
14471
14473 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14474
14475 return text;
14476 }
14477 #endif
14478
14480 {
14481 return true;
14482 }
14483
14485
14487
14489 {
14492 }
14493
14494
14502
14518
14519 [
Obsolete(
"Use ItemSoundHandler instead")]
14522 {
14523 if (!
g_Game.IsDedicatedServer())
14524 {
14525 if (ConfigIsExisting("attachSoundSet"))
14526 {
14527 string cfg_path = "";
14528 string soundset = "";
14529 string type_name =
GetType();
14530
14533 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14534 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14535
14536 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14537 {
14538 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14539 {
14540 if (cfg_slot_array[i] == slot_type)
14541 {
14542 soundset = cfg_soundset_array[i];
14543 break;
14544 }
14545 }
14546 }
14547
14548 if (soundset != "")
14549 {
14550 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14552 }
14553 }
14554 }
14555 }
14556
14558}
14559
14561{
14563 if (entity)
14564 {
14565 bool is_item = entity.IsInherited(
ItemBase);
14566 if (is_item && full_quantity)
14567 {
14570 }
14571 }
14572 else
14573 {
14575 return NULL;
14576 }
14577 return entity;
14578}
14579
14581{
14582 if (item)
14583 {
14584 if (health > 0)
14585 item.SetHealth("", "", health);
14586
14587 if (item.CanHaveTemperature())
14588 {
14590 if (item.CanFreeze())
14591 item.SetFrozen(false);
14592 }
14593
14594 if (item.HasEnergyManager())
14595 {
14596 if (quantity >= 0)
14597 {
14598 item.GetCompEM().SetEnergy0To1(quantity);
14599 }
14600 else
14601 {
14603 }
14604 }
14605 else if (item.IsMagazine())
14606 {
14607 Magazine mag = Magazine.Cast(item);
14608 if (quantity >= 0)
14609 {
14610 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14611 }
14612 else
14613 {
14615 }
14616
14617 }
14618 else
14619 {
14620 if (quantity >= 0)
14621 {
14622 item.SetQuantityNormalized(quantity, false);
14623 }
14624 else
14625 {
14627 }
14628
14629 }
14630 }
14631}
14632
14633#ifdef DEVELOPER
14635#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.