9734{
9736 {
9737 return true;
9738 }
9739};
9740
9742{
9743
9744};
9745
9746
9747
9749{
9753
9755
9758
9759
9760
9761
9762
9771
9777
9782
9787
9808 protected bool m_IsResultOfSplit
9809
9811
9816
9817
9818
9820
9824
9825
9826
9828
9831
9832
9833
9839
9840
9848
9851
9852
9854
9855
9857
9858
9863
9864
9869
9871
9872
9874
9875
9877 {
9882
9883 if (!
g_Game.IsDedicatedServer())
9884 {
9886 {
9888
9890 {
9892 }
9893 }
9894
9897 }
9898
9899 m_OldLocation = null;
9900
9902 {
9904 }
9905
9906 if (ConfigIsExisting("headSelectionsToHide"))
9907 {
9910 }
9911
9913 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9914 {
9916 }
9917
9919
9920 m_IsResultOfSplit = false;
9921
9923 }
9924
9926 {
9927 super.InitItemVariables();
9928
9934 m_Count = ConfigGetInt(
"count");
9935
9938
9943
9946
9951
9963
9967
9968
9971 if (ConfigIsExisting("canBeSplit"))
9972 {
9975 }
9976
9978 if (ConfigIsExisting("itemBehaviour"))
9980
9981
9984 RegisterNetSyncVariableInt("m_VarLiquidType");
9985 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9986
9987 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9988 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9989 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9990
9991 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9992 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9993 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9994 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9995
9996 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9997 RegisterNetSyncVariableBool("m_IsTakeable");
9998 RegisterNetSyncVariableBool("m_IsHologram");
9999
10002 {
10005 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10006 }
10007
10009
10011 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10013
10015 }
10016
10018 {
10020 }
10021
10023 {
10026 {
10031 }
10032 }
10033
10034 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10035 {
10037 {
10040 }
10041
10043 }
10044
10046 {
10052 }
10053
10055
10057 {
10059
10060 if (!action)
10061 {
10062 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10063 return;
10064 }
10065
10067 if (!ai)
10068 {
10070 return;
10071 }
10072
10074 if (!action_array)
10075 {
10076 action_array = new array<ActionBase_Basic>;
10078 }
10079 if (LogManager.IsActionLogEnable())
10080 {
10081 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10082 }
10083
10084 if (action_array.Find(action) != -1)
10085 {
10086 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10087 }
10088 else
10089 {
10090 action_array.Insert(action);
10091 }
10092 }
10093
10095 {
10096 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10097 ActionBase action = player.GetActionManager().GetAction(actionName);
10100
10101 if (action_array)
10102 {
10103 action_array.RemoveItem(action);
10104 }
10105 }
10106
10107
10108
10110 {
10111 ActionOverrideData overrideData = new ActionOverrideData();
10115
10117 if (!actionMap)
10118 {
10121 }
10122
10123 actionMap.Insert(this.
Type(), overrideData);
10124
10125 }
10126
10128
10130
10131
10133 {
10136
10139
10140 string config_to_search = "CfgVehicles";
10141 string muzzle_owner_config;
10142
10144 {
10145 if (IsInherited(Weapon))
10146 config_to_search = "CfgWeapons";
10147
10148 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10149
10150 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10151
10152 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10153
10154 if (config_OnFire_subclass_count > 0)
10155 {
10156 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10157
10158 for (int i = 0; i < config_OnFire_subclass_count; i++)
10159 {
10160 string particle_class = "";
10161 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10162 string config_OnFire_entry = config_OnFire_class + particle_class;
10163 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10164 WPOF_array.Insert(WPOF);
10165 }
10166
10167
10169 }
10170 }
10171
10173 {
10174 config_to_search = "CfgWeapons";
10175 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10176
10177 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10178
10179 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10180
10181 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10182 {
10183 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10184
10185 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10186 {
10187 string particle_class2 = "";
10188 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10189 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10190 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10191 WPOBE_array.Insert(WPOBE);
10192 }
10193
10194
10196 }
10197 }
10198 }
10199
10200
10202 {
10205
10207 {
10208 string config_to_search = "CfgVehicles";
10209
10210 if (IsInherited(Weapon))
10211 config_to_search = "CfgWeapons";
10212
10213 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10214 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10215
10216 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10217 {
10218
10220
10222 {
10224 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10226 return;
10227 }
10228
10231
10232
10233
10234 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10235 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10236
10237 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10238 {
10239 string particle_class = "";
10240 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10241 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10242 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10243
10244 if (entry_type == CT_CLASS)
10245 {
10246 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10247 WPOOH_array.Insert(WPOF);
10248 }
10249 }
10250
10251
10253 }
10254 }
10255 }
10256
10258 {
10260 }
10261
10263 {
10265 {
10267
10270
10273
10274 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10275 }
10276 }
10277
10279 {
10281 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10282
10284 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10285
10287 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10288
10290 {
10292 }
10293 }
10294
10296 {
10298 }
10299
10301 {
10304 else
10306
10308 {
10311 }
10312 else
10313 {
10316
10319 }
10320
10322 }
10323
10325 {
10327 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10328 }
10329
10331 {
10333 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10335 }
10336
10338 {
10340 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10341 }
10342
10344 {
10347
10348 OverheatingParticle OP = new OverheatingParticle();
10353
10355 }
10356
10358 {
10361
10362 return -1;
10363 }
10364
10366 {
10368 {
10371
10372 for (int i = count; i > 0; --i)
10373 {
10374 int id = i - 1;
10377
10380
10381 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10382 {
10383 if (p)
10384 {
10387 }
10388 }
10389 }
10390 }
10391 }
10392
10394 {
10396 {
10398 {
10399 int id = i - 1;
10401
10402 if (OP)
10403 {
10405
10406 if (p)
10407 {
10409 }
10410
10411 delete OP;
10412 }
10413 }
10414
10417 }
10418 }
10419
10422 {
10423 return 0.0;
10424 }
10425
10426
10428 {
10429 return 250;
10430 }
10431
10433 {
10434 return 0;
10435 }
10436
10439 {
10441 return true;
10442
10443 return false;
10444 }
10445
10448 {
10451
10453 {
10455 }
10456 else
10457 {
10458
10460 }
10461
10463 }
10464
10471 {
10472 return -1;
10473 }
10474
10475
10476
10477
10479 {
10481 {
10482 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10483 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10484
10485 if (r_index >= 0)
10486 {
10487 InventoryLocation r_il = new InventoryLocation;
10488 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10489
10490 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10493 {
10494 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10495 }
10497 {
10498 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10499 }
10500
10501 }
10502
10503 player.GetHumanInventory().ClearUserReservedLocation(this);
10504 }
10505
10508 }
10509
10510
10511
10512
10514 {
10515 return ItemBase.m_DebugActionsMask;
10516 }
10517
10519 {
10520 return ItemBase.m_DebugActionsMask & mask;
10521 }
10522
10524 {
10525 ItemBase.m_DebugActionsMask = mask;
10526 }
10527
10529 {
10530 ItemBase.m_DebugActionsMask |= mask;
10531 }
10532
10534 {
10535 ItemBase.m_DebugActionsMask &= ~mask;
10536 }
10537
10539 {
10541 {
10543 }
10544 else
10545 {
10547 }
10548 }
10549
10550
10552 {
10553 if (GetEconomyProfile())
10554 {
10555 float q_max = GetEconomyProfile().GetQuantityMax();
10556 if (q_max > 0)
10557 {
10558 float q_min = GetEconomyProfile().GetQuantityMin();
10559 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10560
10562 {
10563 ComponentEnergyManager comp = GetCompEM();
10565 {
10567 }
10568 }
10570 {
10572
10573 }
10574
10575 }
10576 }
10577 }
10578
10581 {
10582 EntityAI parent = GetHierarchyParent();
10583
10584 if (parent)
10585 {
10586 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10587 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10588 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10589 }
10590 }
10591
10594 {
10595 EntityAI parent = GetHierarchyParent();
10596
10597 if (parent)
10598 {
10599 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10600 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10601 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10602 }
10603 }
10604
10606 {
10607
10608
10609
10610
10612
10614 {
10615 if (ScriptInputUserData.CanStoreInputUserData())
10616 {
10617 ScriptInputUserData ctx = new ScriptInputUserData;
10623 ctx.
Write(use_stack_max);
10626
10628 {
10629 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10630 }
10631 }
10632 }
10633 else if (!
g_Game.IsMultiplayer())
10634 {
10636 }
10637 }
10638
10640 {
10642 }
10643
10645 {
10647 }
10648
10650 {
10652 }
10653
10655 {
10656
10657 return false;
10658 }
10659
10661 {
10662 return false;
10663 }
10664
10668 {
10669 return false;
10670 }
10671
10673 {
10674 return "";
10675 }
10676
10678
10680 {
10681 return false;
10682 }
10683
10685 {
10686 return true;
10687 }
10688
10689
10690
10692 {
10693 return true;
10694 }
10695
10697 {
10698 return true;
10699 }
10700
10702 {
10703 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10705 }
10706
10708 {
10710 }
10711
10713 {
10715 if (!is_being_placed)
10717 SetSynchDirty();
10718 }
10719
10720
10722
10724 {
10726 }
10727
10729 {
10731 }
10732
10734 {
10735 return 1;
10736 }
10737
10739 {
10740 return false;
10741 }
10742
10744 {
10746 SetSynchDirty();
10747 }
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10784 {
10785 super.OnMovedInsideCargo(container);
10786
10787 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10788 }
10789
10790 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10791 {
10792 super.EEItemLocationChanged(oldLoc, newLoc);
10793
10794 PlayerBase newPlayer = null;
10795 PlayerBase oldPlayer = null;
10796
10797 if (newLoc.GetParent())
10798 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10799
10800 if (oldLoc.GetParent())
10801 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10802
10804 {
10805 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10806
10807 if (rIndex >= 0)
10808 {
10809 InventoryLocation rIl = new InventoryLocation;
10810 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10811
10812 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10815 {
10816 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10817 }
10819 {
10821 }
10822
10823 }
10824 }
10825
10827 {
10828 if (newPlayer)
10829 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10830
10831 if (newPlayer == oldPlayer)
10832 {
10833 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10834 {
10836 {
10837 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10838 {
10839 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10840 }
10841 }
10842 else
10843 {
10844 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10845 }
10846 }
10847
10848 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10849 {
10850 int type = oldLoc.GetType();
10852 {
10853 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10854 }
10856 {
10857 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10858 }
10859 }
10860 if (!m_OldLocation)
10861 {
10862 m_OldLocation = new InventoryLocation;
10863 }
10864 m_OldLocation.Copy(oldLoc);
10865 }
10866 else
10867 {
10868 if (m_OldLocation)
10869 {
10870 m_OldLocation.Reset();
10871 }
10872 }
10873
10874 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10875 }
10876 else
10877 {
10878 if (newPlayer)
10879 {
10880 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10881 if (resIndex >= 0)
10882 {
10883 InventoryLocation il = new InventoryLocation;
10884 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10886 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10889 {
10890 il.
GetParent().GetOnReleaseLock().Invoke(it);
10891 }
10893 {
10895 }
10896
10897 }
10898 }
10900 {
10901
10903 }
10904
10905 if (m_OldLocation)
10906 {
10907 m_OldLocation.Reset();
10908 }
10909 }
10910
10912 {
10913 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10914 }
10915
10917 {
10918 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10919 }
10920 }
10921
10922 override void EOnContact(IEntity other, Contact extra)
10923 {
10925 {
10926 int liquidType = -1;
10928 if (impactSpeed > 0.0)
10929 {
10931 #ifndef SERVER
10933 #else
10935 SetSynchDirty();
10936 #endif
10938 }
10939 }
10940
10941 #ifdef SERVER
10942 if (GetCompEM() && GetCompEM().IsPlugged())
10943 {
10944 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10945 GetCompEM().UnplugThis();
10946 }
10947 #endif
10948 }
10949
10951
10953 {
10955 }
10956
10958 {
10959
10960 }
10961
10963 {
10964 super.OnItemLocationChanged(old_owner, new_owner);
10965
10966 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10967 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10968
10969 if (!relatedPlayer && playerNew)
10970 relatedPlayer = playerNew;
10971
10972 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10973 {
10975 if (actionMgr)
10976 {
10977 ActionBase currentAction = actionMgr.GetRunningAction();
10978 if (currentAction)
10980 }
10981 }
10982
10983 Man ownerPlayerOld = null;
10984 Man ownerPlayerNew = null;
10985
10986 if (old_owner)
10987 {
10988 if (old_owner.
IsMan())
10989 {
10990 ownerPlayerOld = Man.Cast(old_owner);
10991 }
10992 else
10993 {
10994 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10995 }
10996 }
10997 else
10998 {
11000 {
11002
11003 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11004 {
11005 GetCompEM().UnplugThis();
11006 }
11007 }
11008 }
11009
11010 if (new_owner)
11011 {
11012 if (new_owner.
IsMan())
11013 {
11014 ownerPlayerNew = Man.Cast(new_owner);
11015 }
11016 else
11017 {
11018 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11019 }
11020 }
11021
11022 if (ownerPlayerOld != ownerPlayerNew)
11023 {
11024 if (ownerPlayerOld)
11025 {
11026 array<EntityAI> subItemsExit = new array<EntityAI>;
11028 for (int i = 0; i < subItemsExit.Count(); i++)
11029 {
11032 }
11033 }
11034
11035 if (ownerPlayerNew)
11036 {
11037 array<EntityAI> subItemsEnter = new array<EntityAI>;
11039 for (int j = 0; j < subItemsEnter.Count(); j++)
11040 {
11043 }
11044 }
11045 }
11046 else if (ownerPlayerNew != null)
11047 {
11048 PlayerBase nplayer;
11049 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11050 {
11051 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11053 for (int k = 0; k < subItemsUpdate.Count(); k++)
11054 {
11056 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11057 }
11058 }
11059 }
11060
11061 if (old_owner)
11062 old_owner.OnChildItemRemoved(this);
11063 if (new_owner)
11064 new_owner.OnChildItemReceived(this);
11065 }
11066
11067
11069 {
11070 super.EEDelete(parent);
11071 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11072 if (player)
11073 {
11075
11076 if (player.IsAlive())
11077 {
11078 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11079 if (r_index >= 0)
11080 {
11081 InventoryLocation r_il = new InventoryLocation;
11082 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11083
11084 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11087 {
11088 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11089 }
11091 {
11092 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11093 }
11094
11095 }
11096
11097 player.RemoveQuickBarEntityShortcut(this);
11098 }
11099 }
11100 }
11101
11103 {
11104 super.EEKilled(killer);
11105
11108 {
11109 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11110 {
11111 if (IsMagazine())
11112 {
11113 if (Magazine.Cast(this).GetAmmoCount() > 0)
11114 {
11116 }
11117 }
11118 else
11119 {
11121 }
11122 }
11123 }
11124 }
11125
11127 {
11128 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11129
11130 super.OnWasAttached(parent, slot_id);
11131
11134
11137 }
11138
11140 {
11141 super.OnWasDetached(parent, slot_id);
11142
11145
11148 }
11149
11151 {
11152 int idx;
11155
11156 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11157 if (inventory_slots.Count() < 1)
11158 {
11159 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11160 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11161 }
11162 else
11163 {
11164 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11165 }
11166
11167 idx = inventory_slots.Find(slot);
11168 if (idx < 0)
11169 return "";
11170
11171 return attach_types.Get(idx);
11172 }
11173
11175 {
11176 int idx = -1;
11177 string slot;
11178
11181
11182 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11183 if (inventory_slots.Count() < 1)
11184 {
11185 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11186 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11187 }
11188 else
11189 {
11190 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11191 if (detach_types.Count() < 1)
11192 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11193 }
11194
11195 for (int i = 0; i < inventory_slots.Count(); i++)
11196 {
11197 slot = inventory_slots.Get(i);
11198 }
11199
11200 if (slot != "")
11201 {
11202 if (detach_types.Count() == 1)
11203 idx = 0;
11204 else
11205 idx = inventory_slots.Find(slot);
11206 }
11207 if (idx < 0)
11208 return "";
11209
11210 return detach_types.Get(idx);
11211 }
11212
11214 {
11215
11217
11218
11219 float min_time = 1;
11220 float max_time = 3;
11221 float delay = Math.RandomFloat(min_time, max_time);
11222
11223 explode_timer.Run(delay, this, "DoAmmoExplosion");
11224 }
11225
11227 {
11228 Magazine magazine = Magazine.Cast(this);
11229 int pop_sounds_count = 6;
11230 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11231
11232
11233 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11234 string sound_name = pop_sounds[ sound_idx ];
11235 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11236
11237
11238 magazine.ServerAddAmmoCount(-1);
11239
11240
11241 float min_temp_to_explode = 100;
11242
11243 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11244 {
11246 }
11247 }
11248
11249
11250 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11251 {
11252 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11253
11254 const int CHANCE_DAMAGE_CARGO = 4;
11255 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11256 const int CHANCE_DAMAGE_NOTHING = 2;
11257
11259 {
11260 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11261 int chances;
11262 int rnd;
11263
11264 if (GetInventory().GetCargo())
11265 {
11266 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11267 rnd = Math.RandomInt(0,chances);
11268
11269 if (rnd < CHANCE_DAMAGE_CARGO)
11270 {
11272 }
11273 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11274 {
11276 }
11277 }
11278 else
11279 {
11280 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11281 rnd = Math.RandomInt(0,chances);
11282
11283 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11284 {
11286 }
11287 }
11288 }
11289 }
11290
11292 {
11293 CargoBase cargo = GetInventory().GetCargo();
11294 if (cargo)
11295 {
11297 if (item_count > 0)
11298 {
11299 int random_pick = Math.RandomInt(0, item_count);
11301 if (!item.IsExplosive())
11302 {
11303 item.AddHealth("","",damage);
11304 return true;
11305 }
11306 }
11307 }
11308 return false;
11309 }
11310
11312 {
11313 GameInventory inventory = GetInventory();
11315 if (attachment_count > 0)
11316 {
11317 int random_pick = Math.RandomInt(0, attachment_count);
11319 if (!attachment.IsExplosive())
11320 {
11321 attachment.AddHealth("","",damage);
11322 return true;
11323 }
11324 }
11325 return false;
11326 }
11327
11329 {
11331 }
11332
11334 {
11336 return GetInventory().CanRemoveEntity();
11337
11338 return false;
11339 }
11340
11342 {
11343
11345 return false;
11346
11347
11349 return false;
11350
11351
11352
11354 if (delta == 0)
11355 return false;
11356
11357
11358 return true;
11359 }
11360
11362 {
11364 {
11365 if (ScriptInputUserData.CanStoreInputUserData())
11366 {
11367 ScriptInputUserData ctx = new ScriptInputUserData;
11372 ctx.
Write(destination_entity);
11374 ctx.
Write(slot_id);
11376 }
11377 }
11378 else if (!
g_Game.IsMultiplayer())
11379 {
11381 }
11382 }
11383
11385 {
11386 float split_quantity_new;
11390 InventoryLocation loc = new InventoryLocation;
11391
11392 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11393 {
11395 split_quantity_new = stack_max;
11396 else
11398
11400 {
11401 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11402 if (new_item)
11403 {
11404 new_item.SetResultOfSplit(true);
11405 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11407 new_item.
SetQuantity(split_quantity_new,
false,
true);
11408 }
11409 }
11410 }
11411 else if (destination_entity && slot_id == -1)
11412 {
11413 if (quantity > stack_max)
11414 split_quantity_new = stack_max;
11415 else
11416 split_quantity_new = quantity;
11417
11419 {
11420 GameInventory destinationInventory = destination_entity.GetInventory();
11422 {
11425 }
11426
11427 if (new_item)
11428 {
11429 new_item.SetResultOfSplit(true);
11430 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11432 new_item.
SetQuantity(split_quantity_new,
false,
true);
11433 }
11434 }
11435 }
11436 else
11437 {
11438 if (stack_max != 0)
11439 {
11441 {
11443 }
11444
11445 if (split_quantity_new == 0)
11446 {
11447 if (!
g_Game.IsMultiplayer())
11448 player.PhysicalPredictiveDropItem(this);
11449 else
11450 player.ServerDropEntity(this);
11451 return;
11452 }
11453
11455 {
11457
11458 if (new_item)
11459 {
11460 new_item.SetResultOfSplit(true);
11461 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11464 new_item.PlaceOnSurface();
11465 }
11466 }
11467 }
11468 }
11469 }
11470
11472 {
11473 float split_quantity_new;
11477 InventoryLocation loc = new InventoryLocation;
11478
11479 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11480 {
11482 split_quantity_new = stack_max;
11483 else
11485
11487 {
11488 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11489 if (new_item)
11490 {
11491 new_item.SetResultOfSplit(true);
11492 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11494 new_item.
SetQuantity(split_quantity_new,
false,
true);
11495 }
11496 }
11497 }
11498 else if (destination_entity && slot_id == -1)
11499 {
11500 if (quantity > stack_max)
11501 split_quantity_new = stack_max;
11502 else
11503 split_quantity_new = quantity;
11504
11506 {
11507 GameInventory destinationInventory = destination_entity.GetInventory();
11509 {
11512 }
11513
11514 if (new_item)
11515 {
11516 new_item.SetResultOfSplit(true);
11517 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11519 new_item.
SetQuantity(split_quantity_new,
false,
true);
11520 }
11521 }
11522 }
11523 else
11524 {
11525 if (stack_max != 0)
11526 {
11528 {
11530 }
11531
11533 {
11535
11536 if (new_item)
11537 {
11538 new_item.SetResultOfSplit(true);
11539 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11542 new_item.PlaceOnSurface();
11543 }
11544 }
11545 }
11546 }
11547 }
11548
11550 {
11552 {
11553 if (ScriptInputUserData.CanStoreInputUserData())
11554 {
11555 ScriptInputUserData ctx = new ScriptInputUserData;
11560 dst.WriteToContext(ctx);
11562 }
11563 }
11564 else if (!
g_Game.IsMultiplayer())
11565 {
11567 }
11568 }
11569
11571 {
11573 {
11574 if (ScriptInputUserData.CanStoreInputUserData())
11575 {
11576 ScriptInputUserData ctx = new ScriptInputUserData;
11581 ctx.
Write(destination_entity);
11587 }
11588 }
11589 else if (!
g_Game.IsMultiplayer())
11590 {
11592 }
11593 }
11594
11596 {
11598 }
11599
11601 {
11603 float split_quantity_new;
11605 if (dst.IsValid())
11606 {
11607 int slot_id = dst.GetSlot();
11609
11610 if (quantity > stack_max)
11611 split_quantity_new = stack_max;
11612 else
11613 split_quantity_new = quantity;
11614
11616 {
11618
11619 if (new_item)
11620 {
11621 new_item.SetResultOfSplit(true);
11622 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11624 new_item.
SetQuantity(split_quantity_new,
false,
true);
11625 }
11626
11627 return new_item;
11628 }
11629 }
11630
11631 return null;
11632 }
11633
11635 {
11637 float split_quantity_new;
11639 if (destination_entity)
11640 {
11642 if (quantity > stackable)
11643 split_quantity_new = stackable;
11644 else
11645 split_quantity_new = quantity;
11646
11648 {
11649 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11650 if (new_item)
11651 {
11652 new_item.SetResultOfSplit(true);
11653 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11655 new_item.
SetQuantity(split_quantity_new,
false,
true);
11656 }
11657 }
11658 }
11659 }
11660
11662 {
11664 {
11665 if (ScriptInputUserData.CanStoreInputUserData())
11666 {
11667 ScriptInputUserData ctx = new ScriptInputUserData;
11672 ItemBase destination_entity =
this;
11673 ctx.
Write(destination_entity);
11677 }
11678 }
11679 else if (!
g_Game.IsMultiplayer())
11680 {
11682 }
11683 }
11684
11686 {
11688 float split_quantity_new;
11690 if (player)
11691 {
11693 if (quantity > stackable)
11694 split_quantity_new = stackable;
11695 else
11696 split_quantity_new = quantity;
11697
11699 {
11700 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11701 new_item =
ItemBase.Cast(in_hands);
11702 if (new_item)
11703 {
11704 new_item.SetResultOfSplit(true);
11705 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11707 new_item.SetQuantity(split_quantity_new, false, true);
11708 }
11709 }
11710 }
11711 }
11712
11714 {
11716 float split_quantity_new = Math.Floor(quantity * 0.5);
11717
11719 return;
11720
11722
11723 if (new_item)
11724 {
11725 if (new_item.GetQuantityMax() < split_quantity_new)
11726 {
11727 split_quantity_new = new_item.GetQuantityMax();
11728 }
11729
11730 new_item.SetResultOfSplit(true);
11731 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11732
11734 {
11737 }
11738 else
11739 {
11741 new_item.
SetQuantity(split_quantity_new,
false,
true);
11742 }
11743 }
11744 }
11745
11747 {
11749 float split_quantity_new = Math.Floor(quantity / 2);
11750
11752 return;
11753
11754 InventoryLocation invloc = new InventoryLocation;
11756
11758 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11759
11760 if (new_item)
11761 {
11762 if (new_item.GetQuantityMax() < split_quantity_new)
11763 {
11764 split_quantity_new = new_item.GetQuantityMax();
11765 }
11767 {
11770 }
11771 else if (split_quantity_new > 1)
11772 {
11774 new_item.
SetQuantity(split_quantity_new,
false,
true);
11775 }
11776 }
11777 }
11778
11781 {
11782 SetWeightDirty();
11784
11785 if (parent)
11786 parent.OnAttachmentQuantityChangedEx(this, delta);
11787
11789 {
11791 {
11793 }
11795 {
11796 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11798 }
11799 }
11800 }
11801
11804 {
11805
11806 }
11807
11810 {
11812 }
11813
11815 {
11816 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11817
11819 {
11820 if (newLevel == GameConstants.STATE_RUINED)
11821 {
11823 EntityAI parent = GetHierarchyParent();
11824 if (parent && parent.IsFireplace())
11825 {
11826 CargoBase cargo = GetInventory().GetCargo();
11827 if (cargo)
11828 {
11830 {
11832 }
11833 }
11834 }
11835 }
11836
11838 {
11839
11841 return;
11842 }
11843
11844 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11845 {
11847 }
11848 }
11849 }
11850
11851
11853 {
11854 super.OnRightClick();
11855
11857 {
11859 {
11860 if (ScriptInputUserData.CanStoreInputUserData())
11861 {
11862 EntityAI root = GetHierarchyRoot();
11863 Man playerOwner = GetHierarchyRootPlayer();
11864 InventoryLocation dst = new InventoryLocation;
11865
11866
11867 if (!playerOwner && root && root == this)
11868 {
11870 }
11871 else
11872 {
11873
11874 GetInventory().GetCurrentInventoryLocation(dst);
11876 {
11877 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11879 {
11881 }
11882 else
11883 {
11885
11886
11887 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11888 {
11890 }
11891 else
11892 {
11893 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11894 }
11895 }
11896 }
11897 }
11898
11899 ScriptInputUserData ctx = new ScriptInputUserData;
11907 }
11908 }
11909 else if (!
g_Game.IsMultiplayer())
11910 {
11912 }
11913 }
11914 }
11915
11917 {
11918 if (root)
11919 {
11920 vector m4[4];
11921 root.GetTransform(m4);
11922 dst.SetGround(this, m4);
11923 }
11924 else
11925 {
11926 GetInventory().GetCurrentInventoryLocation(dst);
11927 }
11928 }
11929
11930 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11931 {
11932
11933 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11934 return false;
11935
11936 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11937 return false;
11938
11939
11941 return false;
11942
11943
11944 Magazine mag = Magazine.Cast(this);
11945 if (mag)
11946 {
11947 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11948 return false;
11949
11950 if (stack_max_limit)
11951 {
11952 Magazine other_mag = Magazine.Cast(other_item);
11953 if (other_item)
11954 {
11955 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11956 return false;
11957 }
11958
11959 }
11960 }
11961 else
11962 {
11963
11965 return false;
11966
11968 return false;
11969 }
11970
11971 PlayerBase player = null;
11972 if (CastTo(player, GetHierarchyRootPlayer()))
11973 {
11974 if (player.GetInventory().HasAttachment(this))
11975 return false;
11976
11977 if (player.IsItemsToDelete())
11978 return false;
11979 }
11980
11981 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11982 return false;
11983
11984 int slotID;
11986 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11987 return false;
11988
11989 return true;
11990 }
11991
11993 {
11995 }
11996
11998 {
11999 return m_IsResultOfSplit;
12000 }
12001
12003 {
12004 m_IsResultOfSplit = value;
12005 }
12006
12008 {
12010 }
12011
12013 {
12014 float other_item_quantity = other_item.GetQuantity();
12015 float this_free_space;
12016
12018
12020
12021 if (other_item_quantity > this_free_space)
12022 {
12023 return this_free_space;
12024 }
12025 else
12026 {
12027 return other_item_quantity;
12028 }
12029 }
12030
12032 {
12034 }
12035
12037 {
12039 return;
12040
12041 if (!IsMagazine() && other_item)
12042 {
12044 if (quantity_used != 0)
12045 {
12046 float hp1 = GetHealth01("","");
12047 float hp2 = other_item.GetHealth01("","");
12048 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12049 hpResult = hpResult / (
GetQuantity() + quantity_used);
12050
12051 hpResult *= GetMaxHealth();
12052 Math.Round(hpResult);
12053 SetHealth("", "Health", hpResult);
12054
12056 other_item.AddQuantity(-quantity_used);
12057 }
12058 }
12060 }
12061
12063 {
12064 #ifdef SERVER
12065 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12066 GetHierarchyParent().IncreaseLifetimeUp();
12067 #endif
12068 };
12069
12071 {
12072 PlayerBase p = PlayerBase.Cast(player);
12073
12074 array<int> recipesIds = p.m_Recipes;
12075 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12076 if (moduleRecipesManager)
12077 {
12078 EntityAI itemInHands = player.GetEntityInHands();
12079 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12080 }
12081
12082 for (int i = 0;i < recipesIds.Count(); i++)
12083 {
12084 int key = recipesIds.Get(i);
12085 string recipeName = moduleRecipesManager.GetRecipeName(key);
12087 }
12088 }
12089
12090
12091 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12092 {
12093 super.GetDebugActions(outputList);
12094
12095
12101
12102
12107
12112
12113
12117
12118
12120 {
12124 }
12125
12128
12129
12133
12135
12136 InventoryLocation loc = new InventoryLocation();
12137 GetInventory().GetCurrentInventoryLocation(loc);
12139 {
12140 if (Gizmo_IsSupported())
12143 }
12144
12146 }
12147
12148
12149
12150
12152 {
12153 super.OnAction(action_id, player, ctx);
12154
12156 {
12157 switch (action_id)
12158 {
12162 return true;
12166 return true;
12167 }
12168 }
12169
12171 {
12172 switch (action_id)
12173 {
12175 Delete();
12176 return true;
12177 }
12178 }
12179
12180 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12181 {
12182 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12183 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12184 PlayerBase p = PlayerBase.Cast(player);
12185 if (
EActions.RECIPES_RANGE_START < 1000)
12186 {
12187 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12188 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12189 }
12190 }
12191 #ifndef SERVER
12192 else if (action_id ==
EActions.WATCH_PLAYER)
12193 {
12194 PluginDeveloper.SetDeveloperItemClientEx(player);
12195 }
12196 #endif
12198 {
12199 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12200 {
12201 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12202 OnDebugButtonPressServer(id + 1);
12203 }
12204
12205 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12206 {
12207 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12209 }
12210
12211 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12212 {
12213 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12215 }
12216
12217 else if (action_id ==
EActions.ADD_QUANTITY)
12218 {
12219 if (IsMagazine())
12220 {
12221 Magazine mag = Magazine.Cast(this);
12222 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12223 }
12224 else
12225 {
12227 }
12228
12229 if (m_EM)
12230 {
12231 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12232 }
12233
12234 }
12235
12236 else if (action_id ==
EActions.REMOVE_QUANTITY)
12237 {
12238 if (IsMagazine())
12239 {
12240 Magazine mag2 = Magazine.Cast(this);
12241 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12242 }
12243 else
12244 {
12246 }
12247 if (m_EM)
12248 {
12249 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12250 }
12251
12252 }
12253
12254 else if (action_id ==
EActions.SET_QUANTITY_0)
12255 {
12257
12258 if (m_EM)
12259 {
12260 m_EM.SetEnergy(0);
12261 }
12262 }
12263
12264 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12265 {
12267
12268 if (m_EM)
12269 {
12270 m_EM.SetEnergy(m_EM.GetEnergyMax());
12271 }
12272 }
12273
12274 else if (action_id ==
EActions.ADD_HEALTH)
12275 {
12276 AddHealth("","",GetMaxHealth("","Health")/5);
12277 }
12278 else if (action_id ==
EActions.REMOVE_HEALTH)
12279 {
12280 AddHealth("","",-GetMaxHealth("","Health")/5);
12281 }
12282 else if (action_id ==
EActions.DESTROY_HEALTH)
12283 {
12284 SetHealth01("","",0);
12285 }
12286 else if (action_id ==
EActions.WATCH_ITEM)
12287 {
12289 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12290 #ifdef DEVELOPER
12291 SetDebugDeveloper_item(this);
12292 #endif
12293 }
12294
12295 else if (action_id ==
EActions.ADD_TEMPERATURE)
12296 {
12297 AddTemperature(20);
12298
12299 }
12300
12301 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12302 {
12303 AddTemperature(-20);
12304
12305 }
12306
12307 else if (action_id ==
EActions.FLIP_FROZEN)
12308 {
12309 SetFrozen(!GetIsFrozen());
12310
12311 }
12312
12313 else if (action_id ==
EActions.ADD_WETNESS)
12314 {
12316
12317 }
12318
12319 else if (action_id ==
EActions.REMOVE_WETNESS)
12320 {
12322
12323 }
12324
12325 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12326 {
12329
12330
12331 }
12332
12333 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12334 {
12337 }
12338
12339 else if (action_id ==
EActions.MAKE_SPECIAL)
12340 {
12341 auto debugParams = DebugSpawnParams.WithPlayer(player);
12342 OnDebugSpawnEx(debugParams);
12343 }
12344
12345 }
12346
12347
12348 return false;
12349 }
12350
12351
12352
12353
12357
12360
12361
12362
12364 {
12365 return false;
12366 }
12367
12368
12370 {
12371 return true;
12372 }
12373
12374
12376 {
12377 return true;
12378 }
12379
12380
12381
12383 {
12384 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12385 return g_Game.ConfigIsExisting(config_path);
12386 }
12387
12390 {
12391 return null;
12392 }
12393
12395 {
12396 return false;
12397 }
12398
12400 {
12401 return false;
12402 }
12403
12407
12408
12410 {
12411 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12412 return module_repairing.CanRepair(this, item_repair_kit);
12413 }
12414
12415
12416 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12417 {
12418 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12419 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12420 }
12421
12422
12424 {
12425
12426
12427
12428
12429
12430
12431
12432
12433 return 1;
12434 }
12435
12436
12437
12439 {
12441 }
12442
12443
12444
12446 {
12448 }
12449
12450
12459 {
12460 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12461
12462 if (player)
12463 {
12464 player.MessageStatus(text);
12465 }
12466 }
12467
12468
12477 {
12478 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12479
12480 if (player)
12481 {
12482 player.MessageAction(text);
12483 }
12484 }
12485
12486
12495 {
12496 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12497
12498 if (player)
12499 {
12500 player.MessageFriendly(text);
12501 }
12502 }
12503
12504
12513 {
12514 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12515
12516 if (player)
12517 {
12518 player.MessageImportant(text);
12519 }
12520 }
12521
12523 {
12524 return true;
12525 }
12526
12527
12528 override bool KindOf(
string tag)
12529 {
12530 bool found = false;
12531 string item_name = this.
GetType();
12533 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12534
12535 int array_size = item_tag_array.Count();
12536 for (int i = 0; i < array_size; i++)
12537 {
12538 if (item_tag_array.Get(i) == tag)
12539 {
12540 found = true;
12541 break;
12542 }
12543 }
12544 return found;
12545 }
12546
12547
12549 {
12550
12551 super.OnRPC(sender, rpc_type,ctx);
12552
12553
12554 switch (rpc_type)
12555 {
12556 #ifndef SERVER
12557 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12558 Param2<bool, string> p = new Param2<bool, string>(false, "");
12559
12561 return;
12562
12563 bool play = p.param1;
12564 string soundSet = p.param2;
12565
12566 if (play)
12567 {
12569 {
12571 {
12573 }
12574 }
12575 else
12576 {
12578 }
12579 }
12580 else
12581 {
12583 }
12584
12585 break;
12586 #endif
12587
12588 }
12589
12591 {
12593 }
12594 }
12595
12596
12597
12598
12600 {
12601 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12602 return plugin.GetID(
name);
12603 }
12604
12606 {
12607 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12608 return plugin.GetName(id);
12609 }
12610
12613 {
12614
12615
12616 int varFlags;
12617 if (!ctx.
Read(varFlags))
12618 return;
12619
12620 if (varFlags & ItemVariableFlags.FLOAT)
12621 {
12623 }
12624 }
12625
12627 {
12628
12629 super.SerializeNumericalVars(floats_out);
12630
12631
12632
12634 {
12636 }
12637
12639 {
12641 }
12642
12644 {
12646 }
12647
12649 {
12654 }
12655
12657 {
12659 }
12660 }
12661
12663 {
12664
12665 super.DeSerializeNumericalVars(floats);
12666
12667
12668 int index = 0;
12669 int mask = Math.Round(floats.Get(index));
12670
12671 index++;
12672
12674 {
12676 {
12678 }
12679 else
12680 {
12681 float quantity = floats.Get(index);
12682 SetQuantity(quantity,
true,
false,
false,
false);
12683 }
12684 index++;
12685 }
12686
12688 {
12689 float wet = floats.Get(index);
12691 index++;
12692 }
12693
12695 {
12696 int liquidtype = Math.Round(floats.Get(index));
12698 index++;
12699 }
12700
12702 {
12704 index++;
12706 index++;
12708 index++;
12710 index++;
12711 }
12712
12714 {
12715 int cleanness = Math.Round(floats.Get(index));
12717 index++;
12718 }
12719 }
12720
12722 {
12723 super.WriteVarsToCTX(ctx);
12724
12725
12727 {
12729 }
12730
12732 {
12734 }
12735
12737 {
12739 }
12740
12742 {
12743 int r,g,b,a;
12749 }
12750
12752 {
12754 }
12755 }
12756
12758 {
12759 if (!super.ReadVarsFromCTX(ctx,version))
12760 return false;
12761
12762 int intValue;
12763 float value;
12764
12765 if (version < 140)
12766 {
12767 if (!ctx.
Read(intValue))
12768 return false;
12769
12770 m_VariablesMask = intValue;
12771 }
12772
12774 {
12775 if (!ctx.
Read(value))
12776 return false;
12777
12779 {
12781 }
12782 else
12783 {
12785 }
12786 }
12787
12788 if (version < 140)
12789 {
12791 {
12792 if (!ctx.
Read(value))
12793 return false;
12794 SetTemperatureDirect(value);
12795 }
12796 }
12797
12799 {
12800 if (!ctx.
Read(value))
12801 return false;
12803 }
12804
12806 {
12807 if (!ctx.
Read(intValue))
12808 return false;
12810 }
12811
12813 {
12814 int r,g,b,a;
12816 return false;
12818 return false;
12820 return false;
12822 return false;
12823
12825 }
12826
12828 {
12829 if (!ctx.
Read(intValue))
12830 return false;
12832 }
12833
12834 if (version >= 138 && version < 140)
12835 {
12837 {
12838 if (!ctx.
Read(intValue))
12839 return false;
12840 SetFrozen(intValue);
12841 }
12842 }
12843
12844 return true;
12845 }
12846
12847
12849 {
12852 {
12854 }
12855
12856 if (!super.OnStoreLoad(ctx, version))
12857 {
12859 return false;
12860 }
12861
12862 if (version >= 114)
12863 {
12864 bool hasQuickBarIndexSaved;
12865
12866 if (!ctx.
Read(hasQuickBarIndexSaved))
12867 {
12869 return false;
12870 }
12871
12872 if (hasQuickBarIndexSaved)
12873 {
12874 int itmQBIndex;
12875
12876
12877 if (!ctx.
Read(itmQBIndex))
12878 {
12880 return false;
12881 }
12882
12883 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12884 if (itmQBIndex != -1 && parentPlayer)
12885 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12886 }
12887 }
12888 else
12889 {
12890
12891 PlayerBase player;
12892 int itemQBIndex;
12893 if (version ==
int.
MAX)
12894 {
12895 if (!ctx.
Read(itemQBIndex))
12896 {
12898 return false;
12899 }
12900 }
12901 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12902 {
12903
12904 if (!ctx.
Read(itemQBIndex))
12905 {
12907 return false;
12908 }
12909 if (itemQBIndex != -1 && player)
12910 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12911 }
12912 }
12913
12914 if (version < 140)
12915 {
12916
12917 if (!LoadVariables(ctx, version))
12918 {
12920 return false;
12921 }
12922 }
12923
12924
12926 {
12928 return false;
12929 }
12930 if (version >= 132)
12931 {
12933 if (raib)
12934 {
12936 {
12938 return false;
12939 }
12940 }
12941 }
12942
12944 return true;
12945 }
12946
12947
12948
12950 {
12951 super.OnStoreSave(ctx);
12952
12953 PlayerBase player;
12954 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12955 {
12957
12958 int itemQBIndex = -1;
12959 itemQBIndex = player.FindQuickBarEntityIndex(this);
12960 ctx.
Write(itemQBIndex);
12961 }
12962 else
12963 {
12965 }
12966
12968
12970 if (raib)
12971 {
12973 }
12974 }
12975
12976
12978 {
12979 super.AfterStoreLoad();
12980
12982 {
12984 }
12985
12987 {
12990 }
12991 }
12992
12994 {
12995 super.EEOnAfterLoad();
12996
12998 {
13000 }
13001
13004 }
13005
13007 {
13008 return false;
13009 }
13010
13011
13012
13014 {
13016 {
13017 #ifdef PLATFORM_CONSOLE
13018
13020 {
13022 if (menu)
13023 {
13025 }
13026 }
13027 #endif
13028 }
13029
13031 {
13034 }
13035
13037 {
13038 SetWeightDirty();
13040 }
13042 {
13045 }
13046
13048 {
13051
13054 }
13056 {
13060 }
13061
13062 super.OnVariablesSynchronized();
13063 }
13064
13065
13066
13068 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13069 {
13070 if (!IsServerCheck(allow_client))
13071 return false;
13072
13074 return false;
13075
13078
13079 if (value <= (min + 0.001))
13080 value = min;
13081
13082 if (value == min)
13083 {
13084 if (destroy_config)
13085 {
13086 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13087 if (dstr)
13088 {
13090 this.Delete();
13091 return true;
13092 }
13093 }
13094 else if (destroy_forced)
13095 {
13097 this.Delete();
13098 return true;
13099 }
13100
13102 }
13103
13106
13108 {
13109 EntityAI parent = GetHierarchyRoot();
13110 InventoryLocation iLoc = new InventoryLocation();
13111 GetInventory().GetCurrentInventoryLocation(iLoc);
13113 {
13114 int iLocSlot = iLoc.
GetSlot();
13116 {
13118 }
13120 {
13122 }
13123 }
13124 }
13125
13127 {
13129
13130 if (delta)
13132 }
13133
13135
13136 return false;
13137 }
13138
13139
13141 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13142 {
13144 }
13145
13147 {
13150 }
13151
13153 {
13156 }
13157
13159 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13160 {
13161 float value_clamped = Math.Clamp(value, 0, 1);
13163 SetQuantity(result, destroy_config, destroy_forced);
13164 }
13165
13166
13169 {
13171 }
13172
13174 {
13176 }
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13188 {
13189 int slot = -1;
13190 GameInventory inventory = GetInventory();
13191 if (inventory)
13192 {
13193 InventoryLocation il = new InventoryLocation;
13196 }
13197
13199 }
13200
13202 {
13203 float quantity_max = 0;
13204
13206 {
13207 if (attSlotID != -1)
13208 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13209
13210 if (quantity_max <= 0)
13212 }
13213
13214 if (quantity_max <= 0)
13216
13217 return quantity_max;
13218 }
13219
13221 {
13223 }
13224
13226 {
13228 }
13229
13230
13232 {
13234 }
13235
13237 {
13239 }
13240
13242 {
13244 }
13245
13246
13248 {
13249
13250 float weightEx = GetWeightEx();
13251 float special = GetInventoryAndCargoWeight();
13252 return weightEx - special;
13253 }
13254
13255
13257 {
13259 }
13260
13262 {
13264 {
13265 #ifdef DEVELOPER
13266 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13267 {
13268 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13270 }
13271 #endif
13272
13273 return GetQuantity() * GetConfigWeightModified();
13274 }
13275 else if (HasEnergyManager())
13276 {
13277 #ifdef DEVELOPER
13278 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13279 {
13280 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13281 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13282 }
13283 #endif
13284 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13285 }
13286 else
13287 {
13288 #ifdef DEVELOPER
13289 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13290 {
13291 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13292 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13293 }
13294 #endif
13295 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13296 }
13297 }
13298
13301 {
13302 int item_count = 0;
13304
13305 GameInventory inventory = GetInventory();
13306 CargoBase cargo = inventory.
GetCargo();
13307 if (cargo != NULL)
13308 {
13310 }
13311
13313 for (int i = 0; i < nAttachments; ++i)
13314 {
13316 if (item)
13317 item_count += item.GetNumberOfItems();
13318 }
13319 return item_count;
13320 }
13321
13324 {
13325 float weight = 0;
13326 float wetness = 1;
13327 if (include_wetness)
13330 {
13331 weight = wetness * m_ConfigWeight;
13332 }
13334 {
13335 weight = 1;
13336 }
13337 return weight;
13338 }
13339
13340
13341
13343 {
13344 GameInventory inventory = GetInventory();
13345 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13346 {
13347 array<EntityAI> items = new array<EntityAI>;
13349 for (int i = 0; i < items.Count(); ++i)
13350 {
13352 if (item)
13353 {
13354 g_Game.ObjectDelete(item);
13355 }
13356 }
13357 }
13358 }
13359
13360
13361
13362
13364 {
13365 float energy = 0;
13366 if (HasEnergyManager())
13367 {
13368 energy = GetCompEM().GetEnergy();
13369 }
13370 return energy;
13371 }
13372
13373
13375 {
13376 super.OnEnergyConsumed();
13377
13379 }
13380
13382 {
13383 super.OnEnergyAdded();
13384
13386 }
13387
13388
13390 {
13391 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13392 {
13394 {
13395 float energy_0to1 = GetCompEM().GetEnergy0To1();
13397 }
13398 }
13399 }
13400
13401
13403 {
13404 return ConfigGetFloat("heatIsolation");
13405 }
13406
13408 {
13410 }
13411
13413 {
13414 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13415 if (
g_Game.ConfigIsExisting(paramPath))
13416 return g_Game.ConfigGetFloat(paramPath);
13417
13418 return 0.0;
13419 }
13420
13422 {
13423 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13424 if (
g_Game.ConfigIsExisting(paramPath))
13425 return g_Game.ConfigGetFloat(paramPath);
13426
13427 return 0.0;
13428 }
13429
13430 override void SetWet(
float value,
bool allow_client =
false)
13431 {
13432 if (!IsServerCheck(allow_client))
13433 return;
13434
13437
13439
13440 m_VarWet = Math.Clamp(value, min, max);
13441
13443 {
13446 }
13447 }
13448
13449 override void AddWet(
float value)
13450 {
13452 }
13453
13455 {
13457 }
13458
13460 {
13462 }
13463
13465 {
13467 }
13468
13470 {
13472 }
13473
13475 {
13477 }
13478
13479 override void OnWetChanged(
float newVal,
float oldVal)
13480 {
13483 if (newLevel != oldLevel)
13484 {
13486 }
13487 }
13488
13490 {
13491 SetWeightDirty();
13492 }
13493
13495 {
13496 return GetWetLevelInternal(
m_VarWet);
13497 }
13498
13499
13500
13502 {
13504 }
13505
13507 {
13509 }
13510
13512 {
13514 }
13515
13517 {
13519 }
13520
13521
13522
13524 {
13525 if (ConfigIsExisting("itemModelLength"))
13526 {
13527 return ConfigGetFloat("itemModelLength");
13528 }
13529 return 0;
13530 }
13531
13533 {
13534 if (ConfigIsExisting("itemAttachOffset"))
13535 {
13536 return ConfigGetFloat("itemAttachOffset");
13537 }
13538 return 0;
13539 }
13540
13541 override void SetCleanness(
int value,
bool allow_client =
false)
13542 {
13543 if (!IsServerCheck(allow_client))
13544 return;
13545
13547
13549
13552 }
13553
13555 {
13557 }
13558
13560 {
13561 return true;
13562 }
13563
13564
13565
13566
13568 {
13570 }
13571
13573 {
13575 }
13576
13577
13578
13579
13580 override void SetColor(
int r,
int g,
int b,
int a)
13581 {
13587 }
13589 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13590 {
13595 }
13596
13598 {
13600 }
13601
13604 {
13605 int r,g,b,a;
13607 r = r/255;
13608 g = g/255;
13609 b = b/255;
13610 a = a/255;
13611 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13612 }
13613
13614
13615
13616 override void SetLiquidType(
int value,
bool allow_client =
false)
13617 {
13618 if (!IsServerCheck(allow_client))
13619 return;
13620
13625 }
13626
13628 {
13629 return ConfigGetInt("varLiquidTypeInit");
13630 }
13631
13633 {
13635 }
13636
13638 {
13640 SetFrozen(false);
13641 }
13642
13645 {
13646 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13647 }
13648
13649
13652 {
13653 PlayerBase nplayer;
13654 if (PlayerBase.CastTo(nplayer, player))
13655 {
13657 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13658 }
13659 }
13660
13661
13664 {
13665 PlayerBase nplayer;
13666 if (PlayerBase.CastTo(nplayer,player))
13667 {
13668 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13669 }
13670
13671 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13672
13673 if (HasEnergyManager())
13674 {
13675 GetCompEM().UpdatePlugState();
13676 }
13677 }
13678
13679
13681 {
13682 super.OnPlacementStarted(player);
13683
13685 }
13686
13687 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13688 {
13690 {
13691 m_AdminLog.OnPlacementComplete(player,
this);
13692 }
13693
13694 super.OnPlacementComplete(player, position, orientation);
13695 }
13696
13697
13698
13699
13700
13702 {
13704 {
13705 return true;
13706 }
13707 else
13708 {
13709 return false;
13710 }
13711 }
13712
13713
13715 {
13717 {
13719 }
13720 }
13721
13722
13724 {
13726 }
13727
13729 {
13731 }
13732
13733 override void InsertAgent(
int agent,
float count = 1)
13734 {
13735 if (count < 1)
13736 return;
13737
13739 }
13740
13743 {
13745 }
13746
13747
13749 {
13751 }
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13795 {
13797 return false;
13798 return true;
13799 }
13800
13802 {
13803
13805 }
13806
13807
13810 {
13811 super.CheckForRoofLimited(timeTresholdMS);
13812
13813 float time =
g_Game.GetTime();
13814 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13815 {
13816 m_PreviousRoofTestTime = time;
13817 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13818 }
13819 }
13820
13821
13823 {
13825 {
13826 return 0;
13827 }
13828
13829 if (GetInventory().GetAttachmentSlotsCount() != 0)
13830 {
13831 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13832 if (filter)
13833 return filter.GetProtectionLevel(type, false, system);
13834 else
13835 return 0;
13836 }
13837
13838 string subclassPath, entryName;
13839
13840 switch (type)
13841 {
13843 entryName = "biological";
13844 break;
13846 entryName = "chemical";
13847 break;
13848 default:
13849 entryName = "biological";
13850 break;
13851 }
13852
13853 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13854
13855 return g_Game.ConfigGetFloat(subclassPath + entryName);
13856 }
13857
13858
13859
13862 {
13863 if (!IsMagazine())
13865
13867 }
13868
13869
13870
13871
13872
13877 {
13878 return true;
13879 }
13880
13882 {
13884 }
13885
13886
13887
13888
13889
13891 {
13892 if (parent)
13893 {
13894 if (parent.IsInherited(DayZInfected))
13895 return true;
13896
13897 if (!parent.IsRuined())
13898 return true;
13899 }
13900
13901 return true;
13902 }
13903
13905 {
13906 if (!super.CanPutAsAttachment(parent))
13907 {
13908 return false;
13909 }
13910
13911 if (!IsRuined() && !parent.IsRuined())
13912 {
13913 return true;
13914 }
13915
13916 return false;
13917 }
13918
13920 {
13921
13922
13923
13924
13925 return super.CanReceiveItemIntoCargo(item);
13926 }
13927
13929 {
13930
13931
13932
13933
13934 GameInventory attachmentInv = attachment.GetInventory();
13936 {
13937 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13938 return false;
13939 }
13940
13941 InventoryLocation loc = new InventoryLocation();
13942 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13943 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13944 return false;
13945
13946 return super.CanReceiveAttachment(attachment, slotId);
13947 }
13948
13950 {
13951 if (!super.CanReleaseAttachment(attachment))
13952 return false;
13953
13954 return GetInventory().AreChildrenAccessible();
13955 }
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13978 {
13979 int id = muzzle_owner.GetMuzzleID();
13980 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13981
13982 if (WPOF_array)
13983 {
13984 for (int i = 0; i < WPOF_array.Count(); i++)
13985 {
13986 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13987
13988 if (WPOF)
13989 {
13990 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13991 }
13992 }
13993 }
13994 }
13995
13996
13998 {
13999 int id = muzzle_owner.GetMuzzleID();
14001
14002 if (WPOBE_array)
14003 {
14004 for (int i = 0; i < WPOBE_array.Count(); i++)
14005 {
14006 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14007
14008 if (WPOBE)
14009 {
14010 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14011 }
14012 }
14013 }
14014 }
14015
14016
14018 {
14019 int id = muzzle_owner.GetMuzzleID();
14020 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14021
14022 if (WPOOH_array)
14023 {
14024 for (int i = 0; i < WPOOH_array.Count(); i++)
14025 {
14026 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14027
14028 if (WPOOH)
14029 {
14030 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14031 }
14032 }
14033 }
14034 }
14035
14036
14038 {
14039 int id = muzzle_owner.GetMuzzleID();
14040 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14041
14042 if (WPOOH_array)
14043 {
14044 for (int i = 0; i < WPOOH_array.Count(); i++)
14045 {
14046 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14047
14048 if (WPOOH)
14049 {
14050 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14051 }
14052 }
14053 }
14054 }
14055
14056
14058 {
14059 int id = muzzle_owner.GetMuzzleID();
14060 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14061
14062 if (WPOOH_array)
14063 {
14064 for (int i = 0; i < WPOOH_array.Count(); i++)
14065 {
14066 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14067
14068 if (WPOOH)
14069 {
14070 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14071 }
14072 }
14073 }
14074 }
14075
14076
14077
14079 {
14081 {
14082 return true;
14083 }
14084
14085 return false;
14086 }
14087
14089 {
14091 {
14092 return true;
14093 }
14094
14095 return false;
14096 }
14097
14099 {
14101 {
14102 return true;
14103 }
14104
14105 return false;
14106 }
14107
14109 {
14110 return false;
14111 }
14112
14115 {
14116 return UATimeSpent.DEFAULT_DEPLOY;
14117 }
14118
14119
14120
14121
14123 {
14125 SetSynchDirty();
14126 }
14127
14129 {
14131 }
14132
14133
14135 {
14136 return false;
14137 }
14138
14141 {
14142 string att_type = "None";
14143
14144 if (ConfigIsExisting("soundAttType"))
14145 {
14146 att_type = ConfigGetString("soundAttType");
14147 }
14148
14150 }
14151
14153 {
14155 }
14156
14157
14158
14159
14160
14166
14168 {
14171
14173 }
14174
14175
14177 {
14179 return;
14180
14182
14185
14188
14189 SoundParameters params = new SoundParameters();
14193 }
14194
14195
14197 {
14199 {
14202
14203 SetSynchDirty();
14204
14207 }
14208 }
14209
14211 {
14213 }
14214
14215
14217 {
14219 return;
14220
14222 SetSynchDirty();
14223
14226 }
14227
14229 {
14232 }
14233
14235 {
14237 }
14238
14239 void OnApply(PlayerBase player);
14240
14242 {
14243 return 1.0;
14244 };
14245
14247 {
14249 }
14250
14252 {
14254 }
14255
14257
14259 {
14260 SetDynamicPhysicsLifeTime(0.01);
14262 }
14263
14265 {
14266 array<string> zone_names = new array<string>;
14267 GetDamageZones(zone_names);
14268 for (int i = 0; i < zone_names.Count(); i++)
14269 {
14270 SetHealthMax(zone_names.Get(i),"Health");
14271 }
14272 SetHealthMax("","Health");
14273 }
14274
14277 {
14278 float global_health = GetHealth01("","Health");
14279 array<string> zones = new array<string>;
14280 GetDamageZones(zones);
14281
14282 for (int i = 0; i < zones.Count(); i++)
14283 {
14284 SetHealth01(zones.Get(i),"Health",global_health);
14285 }
14286 }
14287
14290 {
14291 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14292 }
14293
14295 {
14296 if (!hasRootAsPlayer)
14297 {
14298 if (refParentIB)
14299 {
14300
14301 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14302 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14303
14304 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14305 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14306
14309 }
14310 else
14311 {
14312
14315 }
14316 }
14317 }
14318
14320 {
14322 {
14323 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14324 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14325 {
14326 float heatPermCoef = 1.0;
14328 while (ent)
14329 {
14330 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14331 ent = ent.GetHierarchyParent();
14332 }
14333
14334 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14335 }
14336 }
14337 }
14338
14340 {
14341
14342 EntityAI parent = GetHierarchyParent();
14343 if (!parent)
14344 {
14345 hasParent = false;
14346 hasRootAsPlayer = false;
14347 }
14348 else
14349 {
14350 hasParent = true;
14351 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14352 refParentIB =
ItemBase.Cast(parent);
14353 }
14354 }
14355
14356 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14357 {
14358
14359 }
14360
14362 {
14363
14364 return false;
14365 }
14366
14368 {
14369
14370
14371 return false;
14372 }
14373
14375 {
14376
14377 return false;
14378 }
14379
14382 {
14383 return !GetIsFrozen() &&
IsOpen();
14384 }
14385
14387 {
14388 bool hasParent = false, hasRootAsPlayer = false;
14390
14391 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14392 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14393
14394 if (wwtu || foodDecay)
14395 {
14399
14400 if (processWetness || processTemperature || processDecay)
14401 {
14403
14404 if (processWetness)
14405 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14406
14407 if (processTemperature)
14409
14410 if (processDecay)
14411 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14412 }
14413 }
14414 }
14415
14418 {
14420 }
14421
14423 {
14426
14427 return super.GetTemperatureFreezeThreshold();
14428 }
14429
14431 {
14434
14435 return super.GetTemperatureThawThreshold();
14436 }
14437
14439 {
14442
14443 return super.GetItemOverheatThreshold();
14444 }
14445
14447 {
14449 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14450
14451 return super.GetTemperatureFreezeTime();
14452 }
14453
14455 {
14457 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14458
14459 return super.GetTemperatureThawTime();
14460 }
14461
14466
14468 {
14469 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14470 }
14471
14473 {
14474 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14475 }
14476
14479 {
14481 }
14482
14484 {
14486 }
14487
14489 {
14491 }
14492
14495 {
14496 return null;
14497 }
14498
14501 {
14502 return false;
14503 }
14504
14506 {
14508 {
14511 if (!trg)
14512 {
14514 explosive = this;
14515 }
14516
14517 explosive.PairRemote(trg);
14519
14520 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14521 trg.SetPersistentPairID(persistentID);
14522 explosive.SetPersistentPairID(persistentID);
14523
14524 return true;
14525 }
14526 return false;
14527 }
14528
14531 {
14532 float ret = 1.0;
14535 ret *= GetHealth01();
14536
14537 return ret;
14538 }
14539
14540 #ifdef DEVELOPER
14541 override void SetDebugItem()
14542 {
14543 super.SetDebugItem();
14544 _itemBase = this;
14545 }
14546
14548 {
14549 string text = super.GetDebugText();
14550
14552 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14553
14554 return text;
14555 }
14556 #endif
14557
14559 {
14560 return true;
14561 }
14562
14564
14566
14568 {
14571 }
14572
14573
14581
14597
14598 [
Obsolete(
"Use ItemSoundHandler instead")]
14601 {
14602 if (!
g_Game.IsDedicatedServer())
14603 {
14604 if (ConfigIsExisting("attachSoundSet"))
14605 {
14606 string cfg_path = "";
14607 string soundset = "";
14608 string type_name =
GetType();
14609
14612 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14613 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14614
14615 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14616 {
14617 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14618 {
14619 if (cfg_slot_array[i] == slot_type)
14620 {
14621 soundset = cfg_soundset_array[i];
14622 break;
14623 }
14624 }
14625 }
14626
14627 if (soundset != "")
14628 {
14629 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14631 }
14632 }
14633 }
14634 }
14635
14637}
14638
14640{
14642 if (entity)
14643 {
14644 bool is_item = entity.IsInherited(
ItemBase);
14645 if (is_item && full_quantity)
14646 {
14649 }
14650 }
14651 else
14652 {
14654 return NULL;
14655 }
14656 return entity;
14657}
14658
14660{
14661 if (item)
14662 {
14663 if (health > 0)
14664 item.SetHealth("", "", health);
14665
14666 if (item.CanHaveTemperature())
14667 {
14669 if (item.CanFreeze())
14670 item.SetFrozen(false);
14671 }
14672
14673 if (item.HasEnergyManager())
14674 {
14675 if (quantity >= 0)
14676 {
14677 item.GetCompEM().SetEnergy0To1(quantity);
14678 }
14679 else
14680 {
14682 }
14683 }
14684 else if (item.IsMagazine())
14685 {
14686 Magazine mag = Magazine.Cast(item);
14687 if (quantity >= 0)
14688 {
14689 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14690 }
14691 else
14692 {
14694 }
14695
14696 }
14697 else
14698 {
14699 if (quantity >= 0)
14700 {
14701 item.SetQuantityNormalized(quantity, false);
14702 }
14703 else
14704 {
14706 }
14707
14708 }
14709 }
14710}
14711
14712#ifdef DEVELOPER
14714#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.