9613{
9615 {
9616 return true;
9617 }
9618};
9619
9621{
9622
9623};
9624
9625
9626
9628{
9632
9634
9637
9638
9639
9640
9641
9650
9656
9661
9666
9687 protected bool m_IsResultOfSplit
9688
9690
9695
9696
9697
9699
9703
9704
9705
9707
9710
9711
9712
9718
9719
9727
9730
9731
9733
9734
9736
9737
9742
9743
9748
9750
9751
9753
9754
9756 {
9761
9762 if (!
g_Game.IsDedicatedServer())
9763 {
9765 {
9767
9769 {
9771 }
9772 }
9773
9776 }
9777
9778 m_OldLocation = null;
9779
9781 {
9783 }
9784
9785 if (ConfigIsExisting("headSelectionsToHide"))
9786 {
9789 }
9790
9792 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9793 {
9795 }
9796
9798
9799 m_IsResultOfSplit = false;
9800
9802 }
9803
9805 {
9806 super.InitItemVariables();
9807
9813 m_Count = ConfigGetInt(
"count");
9814
9817
9822
9825
9830
9842
9846
9847
9850 if (ConfigIsExisting("canBeSplit"))
9851 {
9854 }
9855
9857 if (ConfigIsExisting("itemBehaviour"))
9859
9860
9863 RegisterNetSyncVariableInt("m_VarLiquidType");
9864 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9865
9866 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9867 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9868 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9869
9870 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9871 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9872 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9873 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9874
9875 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9876 RegisterNetSyncVariableBool("m_IsTakeable");
9877 RegisterNetSyncVariableBool("m_IsHologram");
9878
9881 {
9884 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9885 }
9886
9888
9890 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9892
9894 }
9895
9897 {
9899 }
9900
9902 {
9905 {
9910 }
9911 }
9912
9913 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9914 {
9916 {
9919 }
9920
9922 }
9923
9925 {
9931 }
9932
9934
9936 {
9938
9939 if (!action)
9940 {
9941 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9942 return;
9943 }
9944
9946 if (!ai)
9947 {
9949 return;
9950 }
9951
9953 if (!action_array)
9954 {
9955 action_array = new array<ActionBase_Basic>;
9957 }
9958 if (LogManager.IsActionLogEnable())
9959 {
9960 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9961 }
9962
9963 if (action_array.Find(action) != -1)
9964 {
9965 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9966 }
9967 else
9968 {
9969 action_array.Insert(action);
9970 }
9971 }
9972
9974 {
9975 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9976 ActionBase action = player.GetActionManager().GetAction(actionName);
9979
9980 if (action_array)
9981 {
9982 action_array.RemoveItem(action);
9983 }
9984 }
9985
9986
9987
9989 {
9990 ActionOverrideData overrideData = new ActionOverrideData();
9994
9996 if (!actionMap)
9997 {
10000 }
10001
10002 actionMap.Insert(this.
Type(), overrideData);
10003
10004 }
10005
10007
10009
10010
10012 {
10015
10018
10019 string config_to_search = "CfgVehicles";
10020 string muzzle_owner_config;
10021
10023 {
10024 if (IsInherited(Weapon))
10025 config_to_search = "CfgWeapons";
10026
10027 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10028
10029 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10030
10031 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10032
10033 if (config_OnFire_subclass_count > 0)
10034 {
10035 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10036
10037 for (int i = 0; i < config_OnFire_subclass_count; i++)
10038 {
10039 string particle_class = "";
10040 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10041 string config_OnFire_entry = config_OnFire_class + particle_class;
10042 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10043 WPOF_array.Insert(WPOF);
10044 }
10045
10046
10048 }
10049 }
10050
10052 {
10053 config_to_search = "CfgWeapons";
10054 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10055
10056 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10057
10058 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10059
10060 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10061 {
10062 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10063
10064 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10065 {
10066 string particle_class2 = "";
10067 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10068 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10069 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10070 WPOBE_array.Insert(WPOBE);
10071 }
10072
10073
10075 }
10076 }
10077 }
10078
10079
10081 {
10084
10086 {
10087 string config_to_search = "CfgVehicles";
10088
10089 if (IsInherited(Weapon))
10090 config_to_search = "CfgWeapons";
10091
10092 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10093 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10094
10095 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10096 {
10097
10099
10101 {
10103 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10105 return;
10106 }
10107
10110
10111
10112
10113 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10114 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10115
10116 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10117 {
10118 string particle_class = "";
10119 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10120 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10121 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10122
10123 if (entry_type == CT_CLASS)
10124 {
10125 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10126 WPOOH_array.Insert(WPOF);
10127 }
10128 }
10129
10130
10132 }
10133 }
10134 }
10135
10137 {
10139 }
10140
10142 {
10144 {
10146
10149
10152
10153 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10154 }
10155 }
10156
10158 {
10160 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10161
10163 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10164
10166 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10167
10169 {
10171 }
10172 }
10173
10175 {
10177 }
10178
10180 {
10183 else
10185
10187 {
10190 }
10191 else
10192 {
10195
10198 }
10199
10201 }
10202
10204 {
10206 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10207 }
10208
10210 {
10212 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10214 }
10215
10217 {
10219 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10220 }
10221
10223 {
10226
10227 OverheatingParticle OP = new OverheatingParticle();
10232
10234 }
10235
10237 {
10240
10241 return -1;
10242 }
10243
10245 {
10247 {
10250
10251 for (int i = count; i > 0; --i)
10252 {
10253 int id = i - 1;
10256
10259
10260 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10261 {
10262 if (p)
10263 {
10266 }
10267 }
10268 }
10269 }
10270 }
10271
10273 {
10275 {
10277 {
10278 int id = i - 1;
10280
10281 if (OP)
10282 {
10284
10285 if (p)
10286 {
10288 }
10289
10290 delete OP;
10291 }
10292 }
10293
10296 }
10297 }
10298
10301 {
10302 return 0.0;
10303 }
10304
10305
10307 {
10308 return 250;
10309 }
10310
10312 {
10313 return 0;
10314 }
10315
10318 {
10320 return true;
10321
10322 return false;
10323 }
10324
10327 {
10330
10332 {
10334 }
10335 else
10336 {
10337
10339 }
10340
10342 }
10343
10350 {
10351 return -1;
10352 }
10353
10354
10355
10356
10358 {
10360 {
10361 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10362 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10363
10364 if (r_index >= 0)
10365 {
10366 InventoryLocation r_il = new InventoryLocation;
10367 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10368
10369 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10372 {
10373 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10374 }
10376 {
10377 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10378 }
10379
10380 }
10381
10382 player.GetHumanInventory().ClearUserReservedLocation(this);
10383 }
10384
10387 }
10388
10389
10390
10391
10393 {
10394 return ItemBase.m_DebugActionsMask;
10395 }
10396
10398 {
10399 return ItemBase.m_DebugActionsMask & mask;
10400 }
10401
10403 {
10404 ItemBase.m_DebugActionsMask = mask;
10405 }
10406
10408 {
10409 ItemBase.m_DebugActionsMask |= mask;
10410 }
10411
10413 {
10414 ItemBase.m_DebugActionsMask &= ~mask;
10415 }
10416
10418 {
10420 {
10422 }
10423 else
10424 {
10426 }
10427 }
10428
10429
10431 {
10432 if (GetEconomyProfile())
10433 {
10434 float q_max = GetEconomyProfile().GetQuantityMax();
10435 if (q_max > 0)
10436 {
10437 float q_min = GetEconomyProfile().GetQuantityMin();
10438 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10439
10441 {
10442 ComponentEnergyManager comp = GetCompEM();
10444 {
10446 }
10447 }
10449 {
10451
10452 }
10453
10454 }
10455 }
10456 }
10457
10460 {
10461 EntityAI parent = GetHierarchyParent();
10462
10463 if (parent)
10464 {
10465 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10466 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10467 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10468 }
10469 }
10470
10473 {
10474 EntityAI parent = GetHierarchyParent();
10475
10476 if (parent)
10477 {
10478 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10479 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10480 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10481 }
10482 }
10483
10485 {
10486
10487
10488
10489
10491
10493 {
10494 if (ScriptInputUserData.CanStoreInputUserData())
10495 {
10496 ScriptInputUserData ctx = new ScriptInputUserData;
10502 ctx.
Write(use_stack_max);
10505
10507 {
10508 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10509 }
10510 }
10511 }
10512 else if (!
g_Game.IsMultiplayer())
10513 {
10515 }
10516 }
10517
10519 {
10521 }
10522
10524 {
10526 }
10527
10529 {
10531 }
10532
10534 {
10535
10536 return false;
10537 }
10538
10540 {
10541 return false;
10542 }
10543
10547 {
10548 return false;
10549 }
10550
10552 {
10553 return "";
10554 }
10555
10557
10559 {
10560 return false;
10561 }
10562
10564 {
10565 return true;
10566 }
10567
10568
10569
10571 {
10572 return true;
10573 }
10574
10576 {
10577 return true;
10578 }
10579
10581 {
10582 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10584 }
10585
10587 {
10589 }
10590
10592 {
10594 if (!is_being_placed)
10596 SetSynchDirty();
10597 }
10598
10599
10601
10603 {
10605 }
10606
10608 {
10610 }
10611
10613 {
10614 return 1;
10615 }
10616
10618 {
10619 return false;
10620 }
10621
10623 {
10625 SetSynchDirty();
10626 }
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10663 {
10664 super.OnMovedInsideCargo(container);
10665
10666 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10667 }
10668
10669 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10670 {
10671 super.EEItemLocationChanged(oldLoc, newLoc);
10672
10673 PlayerBase newPlayer = null;
10674 PlayerBase oldPlayer = null;
10675
10676 if (newLoc.GetParent())
10677 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10678
10679 if (oldLoc.GetParent())
10680 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10681
10683 {
10684 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10685
10686 if (rIndex >= 0)
10687 {
10688 InventoryLocation rIl = new InventoryLocation;
10689 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10690
10691 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10694 {
10695 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10696 }
10698 {
10700 }
10701
10702 }
10703 }
10704
10706 {
10707 if (newPlayer)
10708 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10709
10710 if (newPlayer == oldPlayer)
10711 {
10712 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10713 {
10715 {
10716 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10717 {
10718 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10719 }
10720 }
10721 else
10722 {
10723 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10724 }
10725 }
10726
10727 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10728 {
10729 int type = oldLoc.GetType();
10731 {
10732 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10733 }
10735 {
10736 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10737 }
10738 }
10739 if (!m_OldLocation)
10740 {
10741 m_OldLocation = new InventoryLocation;
10742 }
10743 m_OldLocation.Copy(oldLoc);
10744 }
10745 else
10746 {
10747 if (m_OldLocation)
10748 {
10749 m_OldLocation.Reset();
10750 }
10751 }
10752
10753 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10754 }
10755 else
10756 {
10757 if (newPlayer)
10758 {
10759 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10760 if (resIndex >= 0)
10761 {
10762 InventoryLocation il = new InventoryLocation;
10763 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10765 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10768 {
10769 il.
GetParent().GetOnReleaseLock().Invoke(it);
10770 }
10772 {
10774 }
10775
10776 }
10777 }
10779 {
10780
10782 }
10783
10784 if (m_OldLocation)
10785 {
10786 m_OldLocation.Reset();
10787 }
10788 }
10789
10791 {
10792 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10793 }
10794
10796 {
10797 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10798 }
10799 }
10800
10801 override void EOnContact(IEntity other, Contact extra)
10802 {
10804 {
10805 int liquidType = -1;
10807 if (impactSpeed > 0.0)
10808 {
10810 #ifndef SERVER
10812 #else
10814 SetSynchDirty();
10815 #endif
10817 }
10818 }
10819
10820 #ifdef SERVER
10821 if (GetCompEM() && GetCompEM().IsPlugged())
10822 {
10823 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10824 GetCompEM().UnplugThis();
10825 }
10826 #endif
10827 }
10828
10830
10832 {
10834 }
10835
10837 {
10838
10839 }
10840
10842 {
10843 super.OnItemLocationChanged(old_owner, new_owner);
10844
10845 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10846 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10847
10848 if (!relatedPlayer && playerNew)
10849 relatedPlayer = playerNew;
10850
10851 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10852 {
10854 if (actionMgr)
10855 {
10856 ActionBase currentAction = actionMgr.GetRunningAction();
10857 if (currentAction)
10859 }
10860 }
10861
10862 Man ownerPlayerOld = null;
10863 Man ownerPlayerNew = null;
10864
10865 if (old_owner)
10866 {
10867 if (old_owner.
IsMan())
10868 {
10869 ownerPlayerOld = Man.Cast(old_owner);
10870 }
10871 else
10872 {
10873 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10874 }
10875 }
10876 else
10877 {
10879 {
10881
10882 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10883 {
10884 GetCompEM().UnplugThis();
10885 }
10886 }
10887 }
10888
10889 if (new_owner)
10890 {
10891 if (new_owner.
IsMan())
10892 {
10893 ownerPlayerNew = Man.Cast(new_owner);
10894 }
10895 else
10896 {
10897 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10898 }
10899 }
10900
10901 if (ownerPlayerOld != ownerPlayerNew)
10902 {
10903 if (ownerPlayerOld)
10904 {
10905 array<EntityAI> subItemsExit = new array<EntityAI>;
10907 for (int i = 0; i < subItemsExit.Count(); i++)
10908 {
10911 }
10912 }
10913
10914 if (ownerPlayerNew)
10915 {
10916 array<EntityAI> subItemsEnter = new array<EntityAI>;
10918 for (int j = 0; j < subItemsEnter.Count(); j++)
10919 {
10922 }
10923 }
10924 }
10925 else if (ownerPlayerNew != null)
10926 {
10927 PlayerBase nplayer;
10928 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10929 {
10930 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10932 for (int k = 0; k < subItemsUpdate.Count(); k++)
10933 {
10935 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10936 }
10937 }
10938 }
10939
10940 if (old_owner)
10941 old_owner.OnChildItemRemoved(this);
10942 if (new_owner)
10943 new_owner.OnChildItemReceived(this);
10944 }
10945
10946
10948 {
10949 super.EEDelete(parent);
10950 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10951 if (player)
10952 {
10954
10955 if (player.IsAlive())
10956 {
10957 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10958 if (r_index >= 0)
10959 {
10960 InventoryLocation r_il = new InventoryLocation;
10961 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10962
10963 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10966 {
10967 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10968 }
10970 {
10971 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10972 }
10973
10974 }
10975
10976 player.RemoveQuickBarEntityShortcut(this);
10977 }
10978 }
10979 }
10980
10982 {
10983 super.EEKilled(killer);
10984
10987 {
10988 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10989 {
10990 if (IsMagazine())
10991 {
10992 if (Magazine.Cast(this).GetAmmoCount() > 0)
10993 {
10995 }
10996 }
10997 else
10998 {
11000 }
11001 }
11002 }
11003 }
11004
11006 {
11007 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11008
11009 super.OnWasAttached(parent, slot_id);
11010
11013
11016 }
11017
11019 {
11020 super.OnWasDetached(parent, slot_id);
11021
11024
11027 }
11028
11030 {
11031 int idx;
11034
11035 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11036 if (inventory_slots.Count() < 1)
11037 {
11038 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11039 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11040 }
11041 else
11042 {
11043 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11044 }
11045
11046 idx = inventory_slots.Find(slot);
11047 if (idx < 0)
11048 return "";
11049
11050 return attach_types.Get(idx);
11051 }
11052
11054 {
11055 int idx = -1;
11056 string slot;
11057
11060
11061 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11062 if (inventory_slots.Count() < 1)
11063 {
11064 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11065 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11066 }
11067 else
11068 {
11069 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11070 if (detach_types.Count() < 1)
11071 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11072 }
11073
11074 for (int i = 0; i < inventory_slots.Count(); i++)
11075 {
11076 slot = inventory_slots.Get(i);
11077 }
11078
11079 if (slot != "")
11080 {
11081 if (detach_types.Count() == 1)
11082 idx = 0;
11083 else
11084 idx = inventory_slots.Find(slot);
11085 }
11086 if (idx < 0)
11087 return "";
11088
11089 return detach_types.Get(idx);
11090 }
11091
11093 {
11094
11096
11097
11098 float min_time = 1;
11099 float max_time = 3;
11100 float delay = Math.RandomFloat(min_time, max_time);
11101
11102 explode_timer.Run(delay, this, "DoAmmoExplosion");
11103 }
11104
11106 {
11107 Magazine magazine = Magazine.Cast(this);
11108 int pop_sounds_count = 6;
11109 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11110
11111
11112 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11113 string sound_name = pop_sounds[ sound_idx ];
11114 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11115
11116
11117 magazine.ServerAddAmmoCount(-1);
11118
11119
11120 float min_temp_to_explode = 100;
11121
11122 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11123 {
11125 }
11126 }
11127
11128
11129 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11130 {
11131 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11132
11133 const int CHANCE_DAMAGE_CARGO = 4;
11134 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11135 const int CHANCE_DAMAGE_NOTHING = 2;
11136
11138 {
11139 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11140 int chances;
11141 int rnd;
11142
11143 if (GetInventory().GetCargo())
11144 {
11145 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11146 rnd = Math.RandomInt(0,chances);
11147
11148 if (rnd < CHANCE_DAMAGE_CARGO)
11149 {
11151 }
11152 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11153 {
11155 }
11156 }
11157 else
11158 {
11159 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11160 rnd = Math.RandomInt(0,chances);
11161
11162 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11163 {
11165 }
11166 }
11167 }
11168 }
11169
11171 {
11172 CargoBase cargo = GetInventory().GetCargo();
11173 if (cargo)
11174 {
11176 if (item_count > 0)
11177 {
11178 int random_pick = Math.RandomInt(0, item_count);
11180 if (!item.IsExplosive())
11181 {
11182 item.AddHealth("","",damage);
11183 return true;
11184 }
11185 }
11186 }
11187 return false;
11188 }
11189
11191 {
11192 GameInventory inventory = GetInventory();
11194 if (attachment_count > 0)
11195 {
11196 int random_pick = Math.RandomInt(0, attachment_count);
11198 if (!attachment.IsExplosive())
11199 {
11200 attachment.AddHealth("","",damage);
11201 return true;
11202 }
11203 }
11204 return false;
11205 }
11206
11208 {
11210 }
11211
11213 {
11215 return GetInventory().CanRemoveEntity();
11216
11217 return false;
11218 }
11219
11221 {
11222
11224 return false;
11225
11226
11228 return false;
11229
11230
11231
11233 if (delta == 0)
11234 return false;
11235
11236
11237 return true;
11238 }
11239
11241 {
11243 {
11244 if (ScriptInputUserData.CanStoreInputUserData())
11245 {
11246 ScriptInputUserData ctx = new ScriptInputUserData;
11251 ctx.
Write(destination_entity);
11253 ctx.
Write(slot_id);
11255 }
11256 }
11257 else if (!
g_Game.IsMultiplayer())
11258 {
11260 }
11261 }
11262
11264 {
11265 float split_quantity_new;
11269 InventoryLocation loc = new InventoryLocation;
11270
11271 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11272 {
11274 split_quantity_new = stack_max;
11275 else
11277
11279 {
11280 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11281 if (new_item)
11282 {
11283 new_item.SetResultOfSplit(true);
11284 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11286 new_item.
SetQuantity(split_quantity_new,
false,
true);
11287 }
11288 }
11289 }
11290 else if (destination_entity && slot_id == -1)
11291 {
11292 if (quantity > stack_max)
11293 split_quantity_new = stack_max;
11294 else
11295 split_quantity_new = quantity;
11296
11298 {
11299 GameInventory destinationInventory = destination_entity.GetInventory();
11301 {
11304 }
11305
11306 if (new_item)
11307 {
11308 new_item.SetResultOfSplit(true);
11309 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11311 new_item.
SetQuantity(split_quantity_new,
false,
true);
11312 }
11313 }
11314 }
11315 else
11316 {
11317 if (stack_max != 0)
11318 {
11320 {
11322 }
11323
11324 if (split_quantity_new == 0)
11325 {
11326 if (!
g_Game.IsMultiplayer())
11327 player.PhysicalPredictiveDropItem(this);
11328 else
11329 player.ServerDropEntity(this);
11330 return;
11331 }
11332
11334 {
11336
11337 if (new_item)
11338 {
11339 new_item.SetResultOfSplit(true);
11340 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11343 new_item.PlaceOnSurface();
11344 }
11345 }
11346 }
11347 }
11348 }
11349
11351 {
11352 float split_quantity_new;
11356 InventoryLocation loc = new InventoryLocation;
11357
11358 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11359 {
11361 split_quantity_new = stack_max;
11362 else
11364
11366 {
11367 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11368 if (new_item)
11369 {
11370 new_item.SetResultOfSplit(true);
11371 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11373 new_item.
SetQuantity(split_quantity_new,
false,
true);
11374 }
11375 }
11376 }
11377 else if (destination_entity && slot_id == -1)
11378 {
11379 if (quantity > stack_max)
11380 split_quantity_new = stack_max;
11381 else
11382 split_quantity_new = quantity;
11383
11385 {
11386 GameInventory destinationInventory = destination_entity.GetInventory();
11388 {
11391 }
11392
11393 if (new_item)
11394 {
11395 new_item.SetResultOfSplit(true);
11396 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11398 new_item.
SetQuantity(split_quantity_new,
false,
true);
11399 }
11400 }
11401 }
11402 else
11403 {
11404 if (stack_max != 0)
11405 {
11407 {
11409 }
11410
11412 {
11414
11415 if (new_item)
11416 {
11417 new_item.SetResultOfSplit(true);
11418 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11421 new_item.PlaceOnSurface();
11422 }
11423 }
11424 }
11425 }
11426 }
11427
11429 {
11431 {
11432 if (ScriptInputUserData.CanStoreInputUserData())
11433 {
11434 ScriptInputUserData ctx = new ScriptInputUserData;
11439 dst.WriteToContext(ctx);
11441 }
11442 }
11443 else if (!
g_Game.IsMultiplayer())
11444 {
11446 }
11447 }
11448
11450 {
11452 {
11453 if (ScriptInputUserData.CanStoreInputUserData())
11454 {
11455 ScriptInputUserData ctx = new ScriptInputUserData;
11460 ctx.
Write(destination_entity);
11466 }
11467 }
11468 else if (!
g_Game.IsMultiplayer())
11469 {
11471 }
11472 }
11473
11475 {
11477 }
11478
11480 {
11482 float split_quantity_new;
11484 if (dst.IsValid())
11485 {
11486 int slot_id = dst.GetSlot();
11488
11489 if (quantity > stack_max)
11490 split_quantity_new = stack_max;
11491 else
11492 split_quantity_new = quantity;
11493
11495 {
11497
11498 if (new_item)
11499 {
11500 new_item.SetResultOfSplit(true);
11501 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11503 new_item.
SetQuantity(split_quantity_new,
false,
true);
11504 }
11505
11506 return new_item;
11507 }
11508 }
11509
11510 return null;
11511 }
11512
11514 {
11516 float split_quantity_new;
11518 if (destination_entity)
11519 {
11521 if (quantity > stackable)
11522 split_quantity_new = stackable;
11523 else
11524 split_quantity_new = quantity;
11525
11527 {
11528 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11529 if (new_item)
11530 {
11531 new_item.SetResultOfSplit(true);
11532 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11534 new_item.
SetQuantity(split_quantity_new,
false,
true);
11535 }
11536 }
11537 }
11538 }
11539
11541 {
11543 {
11544 if (ScriptInputUserData.CanStoreInputUserData())
11545 {
11546 ScriptInputUserData ctx = new ScriptInputUserData;
11551 ItemBase destination_entity =
this;
11552 ctx.
Write(destination_entity);
11556 }
11557 }
11558 else if (!
g_Game.IsMultiplayer())
11559 {
11561 }
11562 }
11563
11565 {
11567 float split_quantity_new;
11569 if (player)
11570 {
11572 if (quantity > stackable)
11573 split_quantity_new = stackable;
11574 else
11575 split_quantity_new = quantity;
11576
11578 {
11579 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11580 new_item =
ItemBase.Cast(in_hands);
11581 if (new_item)
11582 {
11583 new_item.SetResultOfSplit(true);
11584 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11586 new_item.SetQuantity(split_quantity_new, false, true);
11587 }
11588 }
11589 }
11590 }
11591
11593 {
11595 float split_quantity_new = Math.Floor(quantity * 0.5);
11596
11598 return;
11599
11601
11602 if (new_item)
11603 {
11604 if (new_item.GetQuantityMax() < split_quantity_new)
11605 {
11606 split_quantity_new = new_item.GetQuantityMax();
11607 }
11608
11609 new_item.SetResultOfSplit(true);
11610 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11611
11613 {
11616 }
11617 else
11618 {
11620 new_item.
SetQuantity(split_quantity_new,
false,
true);
11621 }
11622 }
11623 }
11624
11626 {
11628 float split_quantity_new = Math.Floor(quantity / 2);
11629
11631 return;
11632
11633 InventoryLocation invloc = new InventoryLocation;
11635
11637 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11638
11639 if (new_item)
11640 {
11641 if (new_item.GetQuantityMax() < split_quantity_new)
11642 {
11643 split_quantity_new = new_item.GetQuantityMax();
11644 }
11646 {
11649 }
11650 else if (split_quantity_new > 1)
11651 {
11653 new_item.
SetQuantity(split_quantity_new,
false,
true);
11654 }
11655 }
11656 }
11657
11660 {
11661 SetWeightDirty();
11663
11664 if (parent)
11665 parent.OnAttachmentQuantityChangedEx(this, delta);
11666
11668 {
11670 {
11672 }
11674 {
11675 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11677 }
11678 }
11679 }
11680
11683 {
11684
11685 }
11686
11689 {
11691 }
11692
11694 {
11695 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11696
11698 {
11699 if (newLevel == GameConstants.STATE_RUINED)
11700 {
11702 EntityAI parent = GetHierarchyParent();
11703 if (parent && parent.IsFireplace())
11704 {
11705 CargoBase cargo = GetInventory().GetCargo();
11706 if (cargo)
11707 {
11709 {
11711 }
11712 }
11713 }
11714 }
11715
11717 {
11718
11720 return;
11721 }
11722
11723 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11724 {
11726 }
11727 }
11728 }
11729
11730
11732 {
11733 super.OnRightClick();
11734
11736 {
11738 {
11739 if (ScriptInputUserData.CanStoreInputUserData())
11740 {
11741 EntityAI root = GetHierarchyRoot();
11742 Man playerOwner = GetHierarchyRootPlayer();
11743 InventoryLocation dst = new InventoryLocation;
11744
11745
11746 if (!playerOwner && root && root == this)
11747 {
11749 }
11750 else
11751 {
11752
11753 GetInventory().GetCurrentInventoryLocation(dst);
11755 {
11756 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11758 {
11760 }
11761 else
11762 {
11764
11765
11766 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11767 {
11769 }
11770 else
11771 {
11772 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11773 }
11774 }
11775 }
11776 }
11777
11778 ScriptInputUserData ctx = new ScriptInputUserData;
11786 }
11787 }
11788 else if (!
g_Game.IsMultiplayer())
11789 {
11791 }
11792 }
11793 }
11794
11796 {
11797 if (root)
11798 {
11799 vector m4[4];
11800 root.GetTransform(m4);
11801 dst.SetGround(this, m4);
11802 }
11803 else
11804 {
11805 GetInventory().GetCurrentInventoryLocation(dst);
11806 }
11807 }
11808
11809 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11810 {
11811
11812 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11813 return false;
11814
11815 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11816 return false;
11817
11818
11820 return false;
11821
11822
11823 Magazine mag = Magazine.Cast(this);
11824 if (mag)
11825 {
11826 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11827 return false;
11828
11829 if (stack_max_limit)
11830 {
11831 Magazine other_mag = Magazine.Cast(other_item);
11832 if (other_item)
11833 {
11834 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11835 return false;
11836 }
11837
11838 }
11839 }
11840 else
11841 {
11842
11844 return false;
11845
11847 return false;
11848 }
11849
11850 PlayerBase player = null;
11851 if (CastTo(player, GetHierarchyRootPlayer()))
11852 {
11853 if (player.GetInventory().HasAttachment(this))
11854 return false;
11855
11856 if (player.IsItemsToDelete())
11857 return false;
11858 }
11859
11860 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11861 return false;
11862
11863 int slotID;
11865 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11866 return false;
11867
11868 return true;
11869 }
11870
11872 {
11874 }
11875
11877 {
11878 return m_IsResultOfSplit;
11879 }
11880
11882 {
11883 m_IsResultOfSplit = value;
11884 }
11885
11887 {
11889 }
11890
11892 {
11893 float other_item_quantity = other_item.GetQuantity();
11894 float this_free_space;
11895
11897
11899
11900 if (other_item_quantity > this_free_space)
11901 {
11902 return this_free_space;
11903 }
11904 else
11905 {
11906 return other_item_quantity;
11907 }
11908 }
11909
11911 {
11913 }
11914
11916 {
11918 return;
11919
11920 if (!IsMagazine() && other_item)
11921 {
11923 if (quantity_used != 0)
11924 {
11925 float hp1 = GetHealth01("","");
11926 float hp2 = other_item.GetHealth01("","");
11927 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11928 hpResult = hpResult / (
GetQuantity() + quantity_used);
11929
11930 hpResult *= GetMaxHealth();
11931 Math.Round(hpResult);
11932 SetHealth("", "Health", hpResult);
11933
11935 other_item.AddQuantity(-quantity_used);
11936 }
11937 }
11939 }
11940
11942 {
11943 #ifdef SERVER
11944 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11945 GetHierarchyParent().IncreaseLifetimeUp();
11946 #endif
11947 };
11948
11950 {
11951 PlayerBase p = PlayerBase.Cast(player);
11952
11953 array<int> recipesIds = p.m_Recipes;
11954 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11955 if (moduleRecipesManager)
11956 {
11957 EntityAI itemInHands = player.GetEntityInHands();
11958 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11959 }
11960
11961 for (int i = 0;i < recipesIds.Count(); i++)
11962 {
11963 int key = recipesIds.Get(i);
11964 string recipeName = moduleRecipesManager.GetRecipeName(key);
11966 }
11967 }
11968
11969
11970 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11971 {
11972 super.GetDebugActions(outputList);
11973
11974
11980
11981
11986
11991
11992
11996
11997
11999 {
12003 }
12004
12007
12008
12012
12014
12015 InventoryLocation loc = new InventoryLocation();
12016 GetInventory().GetCurrentInventoryLocation(loc);
12018 {
12019 if (Gizmo_IsSupported())
12022 }
12023
12025 }
12026
12027
12028
12029
12031 {
12032 super.OnAction(action_id, player, ctx);
12033
12035 {
12036 switch (action_id)
12037 {
12041 return true;
12045 return true;
12046 }
12047 }
12048
12050 {
12051 switch (action_id)
12052 {
12054 Delete();
12055 return true;
12056 }
12057 }
12058
12059 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12060 {
12061 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12062 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12063 PlayerBase p = PlayerBase.Cast(player);
12064 if (
EActions.RECIPES_RANGE_START < 1000)
12065 {
12066 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12067 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12068 }
12069 }
12070 #ifndef SERVER
12071 else if (action_id ==
EActions.WATCH_PLAYER)
12072 {
12073 PluginDeveloper.SetDeveloperItemClientEx(player);
12074 }
12075 #endif
12077 {
12078 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12079 {
12080 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12081 OnDebugButtonPressServer(id + 1);
12082 }
12083
12084 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12085 {
12086 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12088 }
12089
12090 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12091 {
12092 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12094 }
12095
12096 else if (action_id ==
EActions.ADD_QUANTITY)
12097 {
12098 if (IsMagazine())
12099 {
12100 Magazine mag = Magazine.Cast(this);
12101 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12102 }
12103 else
12104 {
12106 }
12107
12108 if (m_EM)
12109 {
12110 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12111 }
12112
12113 }
12114
12115 else if (action_id ==
EActions.REMOVE_QUANTITY)
12116 {
12117 if (IsMagazine())
12118 {
12119 Magazine mag2 = Magazine.Cast(this);
12120 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12121 }
12122 else
12123 {
12125 }
12126 if (m_EM)
12127 {
12128 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12129 }
12130
12131 }
12132
12133 else if (action_id ==
EActions.SET_QUANTITY_0)
12134 {
12136
12137 if (m_EM)
12138 {
12139 m_EM.SetEnergy(0);
12140 }
12141 }
12142
12143 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12144 {
12146
12147 if (m_EM)
12148 {
12149 m_EM.SetEnergy(m_EM.GetEnergyMax());
12150 }
12151 }
12152
12153 else if (action_id ==
EActions.ADD_HEALTH)
12154 {
12155 AddHealth("","",GetMaxHealth("","Health")/5);
12156 }
12157 else if (action_id ==
EActions.REMOVE_HEALTH)
12158 {
12159 AddHealth("","",-GetMaxHealth("","Health")/5);
12160 }
12161 else if (action_id ==
EActions.DESTROY_HEALTH)
12162 {
12163 SetHealth01("","",0);
12164 }
12165 else if (action_id ==
EActions.WATCH_ITEM)
12166 {
12168 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12169 #ifdef DEVELOPER
12170 SetDebugDeveloper_item(this);
12171 #endif
12172 }
12173
12174 else if (action_id ==
EActions.ADD_TEMPERATURE)
12175 {
12176 AddTemperature(20);
12177
12178 }
12179
12180 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12181 {
12182 AddTemperature(-20);
12183
12184 }
12185
12186 else if (action_id ==
EActions.FLIP_FROZEN)
12187 {
12188 SetFrozen(!GetIsFrozen());
12189
12190 }
12191
12192 else if (action_id ==
EActions.ADD_WETNESS)
12193 {
12195
12196 }
12197
12198 else if (action_id ==
EActions.REMOVE_WETNESS)
12199 {
12201
12202 }
12203
12204 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12205 {
12208
12209
12210 }
12211
12212 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12213 {
12216 }
12217
12218 else if (action_id ==
EActions.MAKE_SPECIAL)
12219 {
12220 auto debugParams = DebugSpawnParams.WithPlayer(player);
12221 OnDebugSpawnEx(debugParams);
12222 }
12223
12224 }
12225
12226
12227 return false;
12228 }
12229
12230
12231
12232
12236
12239
12240
12241
12243 {
12244 return false;
12245 }
12246
12247
12249 {
12250 return true;
12251 }
12252
12253
12255 {
12256 return true;
12257 }
12258
12259
12260
12262 {
12263 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12264 return g_Game.ConfigIsExisting(config_path);
12265 }
12266
12269 {
12270 return null;
12271 }
12272
12274 {
12275 return false;
12276 }
12277
12279 {
12280 return false;
12281 }
12282
12286
12287
12289 {
12290 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12291 return module_repairing.CanRepair(this, item_repair_kit);
12292 }
12293
12294
12295 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12296 {
12297 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12298 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12299 }
12300
12301
12303 {
12304
12305
12306
12307
12308
12309
12310
12311
12312 return 1;
12313 }
12314
12315
12316
12318 {
12320 }
12321
12322
12323
12325 {
12327 }
12328
12329
12338 {
12339 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12340
12341 if (player)
12342 {
12343 player.MessageStatus(text);
12344 }
12345 }
12346
12347
12356 {
12357 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12358
12359 if (player)
12360 {
12361 player.MessageAction(text);
12362 }
12363 }
12364
12365
12374 {
12375 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12376
12377 if (player)
12378 {
12379 player.MessageFriendly(text);
12380 }
12381 }
12382
12383
12392 {
12393 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12394
12395 if (player)
12396 {
12397 player.MessageImportant(text);
12398 }
12399 }
12400
12402 {
12403 return true;
12404 }
12405
12406
12407 override bool KindOf(
string tag)
12408 {
12409 bool found = false;
12410 string item_name = this.
GetType();
12412 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12413
12414 int array_size = item_tag_array.Count();
12415 for (int i = 0; i < array_size; i++)
12416 {
12417 if (item_tag_array.Get(i) == tag)
12418 {
12419 found = true;
12420 break;
12421 }
12422 }
12423 return found;
12424 }
12425
12426
12428 {
12429
12430 super.OnRPC(sender, rpc_type,ctx);
12431
12432
12433 switch (rpc_type)
12434 {
12435 #ifndef SERVER
12436 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12437 Param2<bool, string> p = new Param2<bool, string>(false, "");
12438
12440 return;
12441
12442 bool play = p.param1;
12443 string soundSet = p.param2;
12444
12445 if (play)
12446 {
12448 {
12450 {
12452 }
12453 }
12454 else
12455 {
12457 }
12458 }
12459 else
12460 {
12462 }
12463
12464 break;
12465 #endif
12466
12467 }
12468
12470 {
12472 }
12473 }
12474
12475
12476
12477
12479 {
12480 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12481 return plugin.GetID(
name);
12482 }
12483
12485 {
12486 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12487 return plugin.GetName(id);
12488 }
12489
12492 {
12493
12494
12495 int varFlags;
12496 if (!ctx.
Read(varFlags))
12497 return;
12498
12499 if (varFlags & ItemVariableFlags.FLOAT)
12500 {
12502 }
12503 }
12504
12506 {
12507
12508 super.SerializeNumericalVars(floats_out);
12509
12510
12511
12513 {
12515 }
12516
12518 {
12520 }
12521
12523 {
12525 }
12526
12528 {
12533 }
12534
12536 {
12538 }
12539 }
12540
12542 {
12543
12544 super.DeSerializeNumericalVars(floats);
12545
12546
12547 int index = 0;
12548 int mask = Math.Round(floats.Get(index));
12549
12550 index++;
12551
12553 {
12555 {
12557 }
12558 else
12559 {
12560 float quantity = floats.Get(index);
12561 SetQuantity(quantity,
true,
false,
false,
false);
12562 }
12563 index++;
12564 }
12565
12567 {
12568 float wet = floats.Get(index);
12570 index++;
12571 }
12572
12574 {
12575 int liquidtype = Math.Round(floats.Get(index));
12577 index++;
12578 }
12579
12581 {
12583 index++;
12585 index++;
12587 index++;
12589 index++;
12590 }
12591
12593 {
12594 int cleanness = Math.Round(floats.Get(index));
12596 index++;
12597 }
12598 }
12599
12601 {
12602 super.WriteVarsToCTX(ctx);
12603
12604
12606 {
12608 }
12609
12611 {
12613 }
12614
12616 {
12618 }
12619
12621 {
12622 int r,g,b,a;
12628 }
12629
12631 {
12633 }
12634 }
12635
12637 {
12638 if (!super.ReadVarsFromCTX(ctx,version))
12639 return false;
12640
12641 int intValue;
12642 float value;
12643
12644 if (version < 140)
12645 {
12646 if (!ctx.
Read(intValue))
12647 return false;
12648
12649 m_VariablesMask = intValue;
12650 }
12651
12653 {
12654 if (!ctx.
Read(value))
12655 return false;
12656
12658 {
12660 }
12661 else
12662 {
12664 }
12665 }
12666
12667 if (version < 140)
12668 {
12670 {
12671 if (!ctx.
Read(value))
12672 return false;
12673 SetTemperatureDirect(value);
12674 }
12675 }
12676
12678 {
12679 if (!ctx.
Read(value))
12680 return false;
12682 }
12683
12685 {
12686 if (!ctx.
Read(intValue))
12687 return false;
12689 }
12690
12692 {
12693 int r,g,b,a;
12695 return false;
12697 return false;
12699 return false;
12701 return false;
12702
12704 }
12705
12707 {
12708 if (!ctx.
Read(intValue))
12709 return false;
12711 }
12712
12713 if (version >= 138 && version < 140)
12714 {
12716 {
12717 if (!ctx.
Read(intValue))
12718 return false;
12719 SetFrozen(intValue);
12720 }
12721 }
12722
12723 return true;
12724 }
12725
12726
12728 {
12731 {
12733 }
12734
12735 if (!super.OnStoreLoad(ctx, version))
12736 {
12738 return false;
12739 }
12740
12741 if (version >= 114)
12742 {
12743 bool hasQuickBarIndexSaved;
12744
12745 if (!ctx.
Read(hasQuickBarIndexSaved))
12746 {
12748 return false;
12749 }
12750
12751 if (hasQuickBarIndexSaved)
12752 {
12753 int itmQBIndex;
12754
12755
12756 if (!ctx.
Read(itmQBIndex))
12757 {
12759 return false;
12760 }
12761
12762 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12763 if (itmQBIndex != -1 && parentPlayer)
12764 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12765 }
12766 }
12767 else
12768 {
12769
12770 PlayerBase player;
12771 int itemQBIndex;
12772 if (version ==
int.
MAX)
12773 {
12774 if (!ctx.
Read(itemQBIndex))
12775 {
12777 return false;
12778 }
12779 }
12780 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12781 {
12782
12783 if (!ctx.
Read(itemQBIndex))
12784 {
12786 return false;
12787 }
12788 if (itemQBIndex != -1 && player)
12789 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12790 }
12791 }
12792
12793 if (version < 140)
12794 {
12795
12796 if (!LoadVariables(ctx, version))
12797 {
12799 return false;
12800 }
12801 }
12802
12803
12805 {
12807 return false;
12808 }
12809 if (version >= 132)
12810 {
12812 if (raib)
12813 {
12815 {
12817 return false;
12818 }
12819 }
12820 }
12821
12823 return true;
12824 }
12825
12826
12827
12829 {
12830 super.OnStoreSave(ctx);
12831
12832 PlayerBase player;
12833 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12834 {
12836
12837 int itemQBIndex = -1;
12838 itemQBIndex = player.FindQuickBarEntityIndex(this);
12839 ctx.
Write(itemQBIndex);
12840 }
12841 else
12842 {
12844 }
12845
12847
12849 if (raib)
12850 {
12852 }
12853 }
12854
12855
12857 {
12858 super.AfterStoreLoad();
12859
12861 {
12863 }
12864
12866 {
12869 }
12870 }
12871
12873 {
12874 super.EEOnAfterLoad();
12875
12877 {
12879 }
12880
12883 }
12884
12886 {
12887 return false;
12888 }
12889
12890
12891
12893 {
12895 {
12896 #ifdef PLATFORM_CONSOLE
12897
12899 {
12901 if (menu)
12902 {
12904 }
12905 }
12906 #endif
12907 }
12908
12910 {
12913 }
12914
12916 {
12917 SetWeightDirty();
12919 }
12921 {
12924 }
12925
12927 {
12930
12933 }
12935 {
12939 }
12940
12941 super.OnVariablesSynchronized();
12942 }
12943
12944
12945
12947 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12948 {
12949 if (!IsServerCheck(allow_client))
12950 return false;
12951
12953 return false;
12954
12957
12958 if (value <= (min + 0.001))
12959 value = min;
12960
12961 if (value == min)
12962 {
12963 if (destroy_config)
12964 {
12965 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12966 if (dstr)
12967 {
12969 this.Delete();
12970 return true;
12971 }
12972 }
12973 else if (destroy_forced)
12974 {
12976 this.Delete();
12977 return true;
12978 }
12979
12981 }
12982
12985
12987 {
12988 EntityAI parent = GetHierarchyRoot();
12989 InventoryLocation iLoc = new InventoryLocation();
12990 GetInventory().GetCurrentInventoryLocation(iLoc);
12992 {
12993 int iLocSlot = iLoc.
GetSlot();
12995 {
12997 }
12999 {
13001 }
13002 }
13003 }
13004
13006 {
13008
13009 if (delta)
13011 }
13012
13014
13015 return false;
13016 }
13017
13018
13020 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13021 {
13023 }
13024
13026 {
13029 }
13030
13032 {
13035 }
13036
13038 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13039 {
13040 float value_clamped = Math.Clamp(value, 0, 1);
13042 SetQuantity(result, destroy_config, destroy_forced);
13043 }
13044
13045
13048 {
13050 }
13051
13053 {
13055 }
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13067 {
13068 int slot = -1;
13069 GameInventory inventory = GetInventory();
13070 if (inventory)
13071 {
13072 InventoryLocation il = new InventoryLocation;
13075 }
13076
13078 }
13079
13081 {
13082 float quantity_max = 0;
13083
13085 {
13086 if (attSlotID != -1)
13087 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13088
13089 if (quantity_max <= 0)
13091 }
13092
13093 if (quantity_max <= 0)
13095
13096 return quantity_max;
13097 }
13098
13100 {
13102 }
13103
13105 {
13107 }
13108
13109
13111 {
13113 }
13114
13116 {
13118 }
13119
13121 {
13123 }
13124
13125
13127 {
13128
13129 float weightEx = GetWeightEx();
13130 float special = GetInventoryAndCargoWeight();
13131 return weightEx - special;
13132 }
13133
13134
13136 {
13138 }
13139
13141 {
13143 {
13144 #ifdef DEVELOPER
13145 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13146 {
13147 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13149 }
13150 #endif
13151
13152 return GetQuantity() * GetConfigWeightModified();
13153 }
13154 else if (HasEnergyManager())
13155 {
13156 #ifdef DEVELOPER
13157 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13158 {
13159 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13160 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13161 }
13162 #endif
13163 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13164 }
13165 else
13166 {
13167 #ifdef DEVELOPER
13168 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13169 {
13170 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13171 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13172 }
13173 #endif
13174 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13175 }
13176 }
13177
13180 {
13181 int item_count = 0;
13183
13184 GameInventory inventory = GetInventory();
13185 CargoBase cargo = inventory.
GetCargo();
13186 if (cargo != NULL)
13187 {
13189 }
13190
13192 for (int i = 0; i < nAttachments; ++i)
13193 {
13195 if (item)
13196 item_count += item.GetNumberOfItems();
13197 }
13198 return item_count;
13199 }
13200
13203 {
13204 float weight = 0;
13205 float wetness = 1;
13206 if (include_wetness)
13209 {
13210 weight = wetness * m_ConfigWeight;
13211 }
13213 {
13214 weight = 1;
13215 }
13216 return weight;
13217 }
13218
13219
13220
13222 {
13223 GameInventory inventory = GetInventory();
13224 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13225 {
13226 array<EntityAI> items = new array<EntityAI>;
13228 for (int i = 0; i < items.Count(); ++i)
13229 {
13231 if (item)
13232 {
13233 g_Game.ObjectDelete(item);
13234 }
13235 }
13236 }
13237 }
13238
13239
13240
13241
13243 {
13244 float energy = 0;
13245 if (HasEnergyManager())
13246 {
13247 energy = GetCompEM().GetEnergy();
13248 }
13249 return energy;
13250 }
13251
13252
13254 {
13255 super.OnEnergyConsumed();
13256
13258 }
13259
13261 {
13262 super.OnEnergyAdded();
13263
13265 }
13266
13267
13269 {
13270 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13271 {
13273 {
13274 float energy_0to1 = GetCompEM().GetEnergy0To1();
13276 }
13277 }
13278 }
13279
13280
13282 {
13283 return ConfigGetFloat("heatIsolation");
13284 }
13285
13287 {
13289 }
13290
13292 {
13293 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13294 if (
g_Game.ConfigIsExisting(paramPath))
13295 return g_Game.ConfigGetFloat(paramPath);
13296
13297 return 0.0;
13298 }
13299
13301 {
13302 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13303 if (
g_Game.ConfigIsExisting(paramPath))
13304 return g_Game.ConfigGetFloat(paramPath);
13305
13306 return 0.0;
13307 }
13308
13309 override void SetWet(
float value,
bool allow_client =
false)
13310 {
13311 if (!IsServerCheck(allow_client))
13312 return;
13313
13316
13318
13319 m_VarWet = Math.Clamp(value, min, max);
13320
13322 {
13325 }
13326 }
13327
13328 override void AddWet(
float value)
13329 {
13331 }
13332
13334 {
13336 }
13337
13339 {
13341 }
13342
13344 {
13346 }
13347
13349 {
13351 }
13352
13354 {
13356 }
13357
13358 override void OnWetChanged(
float newVal,
float oldVal)
13359 {
13362 if (newLevel != oldLevel)
13363 {
13365 }
13366 }
13367
13369 {
13370 SetWeightDirty();
13371 }
13372
13374 {
13375 return GetWetLevelInternal(
m_VarWet);
13376 }
13377
13378
13379
13381 {
13383 }
13384
13386 {
13388 }
13389
13391 {
13393 }
13394
13396 {
13398 }
13399
13400
13401
13403 {
13404 if (ConfigIsExisting("itemModelLength"))
13405 {
13406 return ConfigGetFloat("itemModelLength");
13407 }
13408 return 0;
13409 }
13410
13412 {
13413 if (ConfigIsExisting("itemAttachOffset"))
13414 {
13415 return ConfigGetFloat("itemAttachOffset");
13416 }
13417 return 0;
13418 }
13419
13420 override void SetCleanness(
int value,
bool allow_client =
false)
13421 {
13422 if (!IsServerCheck(allow_client))
13423 return;
13424
13426
13428
13431 }
13432
13434 {
13436 }
13437
13439 {
13440 return true;
13441 }
13442
13443
13444
13445
13447 {
13449 }
13450
13452 {
13454 }
13455
13456
13457
13458
13459 override void SetColor(
int r,
int g,
int b,
int a)
13460 {
13466 }
13468 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13469 {
13474 }
13475
13477 {
13479 }
13480
13483 {
13484 int r,g,b,a;
13486 r = r/255;
13487 g = g/255;
13488 b = b/255;
13489 a = a/255;
13490 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13491 }
13492
13493
13494
13495 override void SetLiquidType(
int value,
bool allow_client =
false)
13496 {
13497 if (!IsServerCheck(allow_client))
13498 return;
13499
13504 }
13505
13507 {
13508 return ConfigGetInt("varLiquidTypeInit");
13509 }
13510
13512 {
13514 }
13515
13517 {
13519 SetFrozen(false);
13520 }
13521
13524 {
13525 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13526 }
13527
13528
13531 {
13532 PlayerBase nplayer;
13533 if (PlayerBase.CastTo(nplayer, player))
13534 {
13536 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13537 }
13538 }
13539
13540
13543 {
13544 PlayerBase nplayer;
13545 if (PlayerBase.CastTo(nplayer,player))
13546 {
13547 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13548 }
13549
13550 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13551
13552 if (HasEnergyManager())
13553 {
13554 GetCompEM().UpdatePlugState();
13555 }
13556 }
13557
13558
13560 {
13561 super.OnPlacementStarted(player);
13562
13564 }
13565
13566 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13567 {
13569 {
13570 m_AdminLog.OnPlacementComplete(player,
this);
13571 }
13572
13573 super.OnPlacementComplete(player, position, orientation);
13574 }
13575
13576
13577
13578
13579
13581 {
13583 {
13584 return true;
13585 }
13586 else
13587 {
13588 return false;
13589 }
13590 }
13591
13592
13594 {
13596 {
13598 }
13599 }
13600
13601
13603 {
13605 }
13606
13608 {
13610 }
13611
13612 override void InsertAgent(
int agent,
float count = 1)
13613 {
13614 if (count < 1)
13615 return;
13616
13618 }
13619
13622 {
13624 }
13625
13626
13628 {
13630 }
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13674 {
13676 return false;
13677 return true;
13678 }
13679
13681 {
13682
13684 }
13685
13686
13689 {
13690 super.CheckForRoofLimited(timeTresholdMS);
13691
13692 float time =
g_Game.GetTime();
13693 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13694 {
13695 m_PreviousRoofTestTime = time;
13696 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13697 }
13698 }
13699
13700
13702 {
13704 {
13705 return 0;
13706 }
13707
13708 if (GetInventory().GetAttachmentSlotsCount() != 0)
13709 {
13710 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13711 if (filter)
13712 return filter.GetProtectionLevel(type, false, system);
13713 else
13714 return 0;
13715 }
13716
13717 string subclassPath, entryName;
13718
13719 switch (type)
13720 {
13722 entryName = "biological";
13723 break;
13725 entryName = "chemical";
13726 break;
13727 default:
13728 entryName = "biological";
13729 break;
13730 }
13731
13732 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13733
13734 return g_Game.ConfigGetFloat(subclassPath + entryName);
13735 }
13736
13737
13738
13741 {
13742 if (!IsMagazine())
13744
13746 }
13747
13748
13749
13750
13751
13756 {
13757 return true;
13758 }
13759
13761 {
13763 }
13764
13765
13766
13767
13768
13770 {
13771 if (parent)
13772 {
13773 if (parent.IsInherited(DayZInfected))
13774 return true;
13775
13776 if (!parent.IsRuined())
13777 return true;
13778 }
13779
13780 return true;
13781 }
13782
13784 {
13785 if (!super.CanPutAsAttachment(parent))
13786 {
13787 return false;
13788 }
13789
13790 if (!IsRuined() && !parent.IsRuined())
13791 {
13792 return true;
13793 }
13794
13795 return false;
13796 }
13797
13799 {
13800
13801
13802
13803
13804 return super.CanReceiveItemIntoCargo(item);
13805 }
13806
13808 {
13809
13810
13811
13812
13813 GameInventory attachmentInv = attachment.GetInventory();
13815 {
13816 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13817 return false;
13818 }
13819
13820 InventoryLocation loc = new InventoryLocation();
13821 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13822 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13823 return false;
13824
13825 return super.CanReceiveAttachment(attachment, slotId);
13826 }
13827
13829 {
13830 if (!super.CanReleaseAttachment(attachment))
13831 return false;
13832
13833 return GetInventory().AreChildrenAccessible();
13834 }
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13857 {
13858 int id = muzzle_owner.GetMuzzleID();
13859 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13860
13861 if (WPOF_array)
13862 {
13863 for (int i = 0; i < WPOF_array.Count(); i++)
13864 {
13865 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13866
13867 if (WPOF)
13868 {
13869 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13870 }
13871 }
13872 }
13873 }
13874
13875
13877 {
13878 int id = muzzle_owner.GetMuzzleID();
13880
13881 if (WPOBE_array)
13882 {
13883 for (int i = 0; i < WPOBE_array.Count(); i++)
13884 {
13885 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13886
13887 if (WPOBE)
13888 {
13889 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13890 }
13891 }
13892 }
13893 }
13894
13895
13897 {
13898 int id = muzzle_owner.GetMuzzleID();
13899 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13900
13901 if (WPOOH_array)
13902 {
13903 for (int i = 0; i < WPOOH_array.Count(); i++)
13904 {
13905 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13906
13907 if (WPOOH)
13908 {
13909 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13910 }
13911 }
13912 }
13913 }
13914
13915
13917 {
13918 int id = muzzle_owner.GetMuzzleID();
13919 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13920
13921 if (WPOOH_array)
13922 {
13923 for (int i = 0; i < WPOOH_array.Count(); i++)
13924 {
13925 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13926
13927 if (WPOOH)
13928 {
13929 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13930 }
13931 }
13932 }
13933 }
13934
13935
13937 {
13938 int id = muzzle_owner.GetMuzzleID();
13939 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13940
13941 if (WPOOH_array)
13942 {
13943 for (int i = 0; i < WPOOH_array.Count(); i++)
13944 {
13945 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13946
13947 if (WPOOH)
13948 {
13949 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13950 }
13951 }
13952 }
13953 }
13954
13955
13956
13958 {
13960 {
13961 return true;
13962 }
13963
13964 return false;
13965 }
13966
13968 {
13970 {
13971 return true;
13972 }
13973
13974 return false;
13975 }
13976
13978 {
13980 {
13981 return true;
13982 }
13983
13984 return false;
13985 }
13986
13988 {
13989 return false;
13990 }
13991
13994 {
13995 return UATimeSpent.DEFAULT_DEPLOY;
13996 }
13997
13998
13999
14000
14002 {
14004 SetSynchDirty();
14005 }
14006
14008 {
14010 }
14011
14012
14014 {
14015 return false;
14016 }
14017
14020 {
14021 string att_type = "None";
14022
14023 if (ConfigIsExisting("soundAttType"))
14024 {
14025 att_type = ConfigGetString("soundAttType");
14026 }
14027
14029 }
14030
14032 {
14034 }
14035
14036
14037
14038
14039
14045
14047 {
14050
14052 }
14053
14054
14056 {
14058 return;
14059
14061
14064
14067
14068 SoundParameters params = new SoundParameters();
14072 }
14073
14074
14076 {
14078 {
14081
14082 SetSynchDirty();
14083
14086 }
14087 }
14088
14090 {
14092 }
14093
14094
14096 {
14098 return;
14099
14101 SetSynchDirty();
14102
14105 }
14106
14108 {
14111 }
14112
14114 {
14116 }
14117
14118 void OnApply(PlayerBase player);
14119
14121 {
14122 return 1.0;
14123 };
14124
14126 {
14128 }
14129
14131 {
14133 }
14134
14136
14138 {
14139 SetDynamicPhysicsLifeTime(0.01);
14141 }
14142
14144 {
14145 array<string> zone_names = new array<string>;
14146 GetDamageZones(zone_names);
14147 for (int i = 0; i < zone_names.Count(); i++)
14148 {
14149 SetHealthMax(zone_names.Get(i),"Health");
14150 }
14151 SetHealthMax("","Health");
14152 }
14153
14156 {
14157 float global_health = GetHealth01("","Health");
14158 array<string> zones = new array<string>;
14159 GetDamageZones(zones);
14160
14161 for (int i = 0; i < zones.Count(); i++)
14162 {
14163 SetHealth01(zones.Get(i),"Health",global_health);
14164 }
14165 }
14166
14169 {
14170 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14171 }
14172
14174 {
14175 if (!hasRootAsPlayer)
14176 {
14177 if (refParentIB)
14178 {
14179
14180 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14181 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14182
14183 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14184 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14185
14188 }
14189 else
14190 {
14191
14194 }
14195 }
14196 }
14197
14199 {
14201 {
14202 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14203 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14204 {
14205 float heatPermCoef = 1.0;
14207 while (ent)
14208 {
14209 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14210 ent = ent.GetHierarchyParent();
14211 }
14212
14213 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14214 }
14215 }
14216 }
14217
14219 {
14220
14221 EntityAI parent = GetHierarchyParent();
14222 if (!parent)
14223 {
14224 hasParent = false;
14225 hasRootAsPlayer = false;
14226 }
14227 else
14228 {
14229 hasParent = true;
14230 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14231 refParentIB =
ItemBase.Cast(parent);
14232 }
14233 }
14234
14235 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14236 {
14237
14238 }
14239
14241 {
14242
14243 return false;
14244 }
14245
14247 {
14248
14249
14250 return false;
14251 }
14252
14254 {
14255
14256 return false;
14257 }
14258
14261 {
14262 return !GetIsFrozen() &&
IsOpen();
14263 }
14264
14266 {
14267 bool hasParent = false, hasRootAsPlayer = false;
14269
14270 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14271 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14272
14273 if (wwtu || foodDecay)
14274 {
14278
14279 if (processWetness || processTemperature || processDecay)
14280 {
14282
14283 if (processWetness)
14284 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14285
14286 if (processTemperature)
14288
14289 if (processDecay)
14290 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14291 }
14292 }
14293 }
14294
14297 {
14299 }
14300
14302 {
14305
14306 return super.GetTemperatureFreezeThreshold();
14307 }
14308
14310 {
14313
14314 return super.GetTemperatureThawThreshold();
14315 }
14316
14318 {
14321
14322 return super.GetItemOverheatThreshold();
14323 }
14324
14326 {
14328 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14329
14330 return super.GetTemperatureFreezeTime();
14331 }
14332
14334 {
14336 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14337
14338 return super.GetTemperatureThawTime();
14339 }
14340
14345
14347 {
14348 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14349 }
14350
14352 {
14353 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14354 }
14355
14358 {
14360 }
14361
14363 {
14365 }
14366
14368 {
14370 }
14371
14374 {
14375 return null;
14376 }
14377
14380 {
14381 return false;
14382 }
14383
14385 {
14387 {
14390 if (!trg)
14391 {
14393 explosive = this;
14394 }
14395
14396 explosive.PairRemote(trg);
14398
14399 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14400 trg.SetPersistentPairID(persistentID);
14401 explosive.SetPersistentPairID(persistentID);
14402
14403 return true;
14404 }
14405 return false;
14406 }
14407
14410 {
14411 float ret = 1.0;
14414 ret *= GetHealth01();
14415
14416 return ret;
14417 }
14418
14419 #ifdef DEVELOPER
14420 override void SetDebugItem()
14421 {
14422 super.SetDebugItem();
14423 _itemBase = this;
14424 }
14425
14427 {
14428 string text = super.GetDebugText();
14429
14431 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14432
14433 return text;
14434 }
14435 #endif
14436
14438 {
14439 return true;
14440 }
14441
14443
14445
14447 {
14450 }
14451
14452
14460
14476
14477 [
Obsolete(
"Use ItemSoundHandler instead")]
14480 {
14481 if (!
g_Game.IsDedicatedServer())
14482 {
14483 if (ConfigIsExisting("attachSoundSet"))
14484 {
14485 string cfg_path = "";
14486 string soundset = "";
14487 string type_name =
GetType();
14488
14491 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14492 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14493
14494 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14495 {
14496 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14497 {
14498 if (cfg_slot_array[i] == slot_type)
14499 {
14500 soundset = cfg_soundset_array[i];
14501 break;
14502 }
14503 }
14504 }
14505
14506 if (soundset != "")
14507 {
14508 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14510 }
14511 }
14512 }
14513 }
14514
14516}
14517
14519{
14521 if (entity)
14522 {
14523 bool is_item = entity.IsInherited(
ItemBase);
14524 if (is_item && full_quantity)
14525 {
14528 }
14529 }
14530 else
14531 {
14533 return NULL;
14534 }
14535 return entity;
14536}
14537
14539{
14540 if (item)
14541 {
14542 if (health > 0)
14543 item.SetHealth("", "", health);
14544
14545 if (item.CanHaveTemperature())
14546 {
14548 if (item.CanFreeze())
14549 item.SetFrozen(false);
14550 }
14551
14552 if (item.HasEnergyManager())
14553 {
14554 if (quantity >= 0)
14555 {
14556 item.GetCompEM().SetEnergy0To1(quantity);
14557 }
14558 else
14559 {
14561 }
14562 }
14563 else if (item.IsMagazine())
14564 {
14565 Magazine mag = Magazine.Cast(item);
14566 if (quantity >= 0)
14567 {
14568 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14569 }
14570 else
14571 {
14573 }
14574
14575 }
14576 else
14577 {
14578 if (quantity >= 0)
14579 {
14580 item.SetQuantityNormalized(quantity, false);
14581 }
14582 else
14583 {
14585 }
14586
14587 }
14588 }
14589}
14590
14591#ifdef DEVELOPER
14593#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.