9621{
9623 {
9624 return true;
9625 }
9626};
9627
9629{
9630
9631};
9632
9633
9634
9636{
9640
9642
9645
9646
9647
9648
9649
9658
9664
9669
9674
9695 protected bool m_IsResultOfSplit
9696
9698
9703
9704
9705
9707
9711
9712
9713
9715
9718
9719
9720
9726
9727
9735
9738
9739
9741
9742
9744
9745
9750
9751
9756
9758
9759
9761
9762
9764 {
9769
9770 if (!
g_Game.IsDedicatedServer())
9771 {
9773 {
9775
9777 {
9779 }
9780 }
9781
9784 }
9785
9786 m_OldLocation = null;
9787
9789 {
9791 }
9792
9793 if (ConfigIsExisting("headSelectionsToHide"))
9794 {
9797 }
9798
9800 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9801 {
9803 }
9804
9806
9807 m_IsResultOfSplit = false;
9808
9810 }
9811
9813 {
9814 super.InitItemVariables();
9815
9821 m_Count = ConfigGetInt(
"count");
9822
9825
9830
9833
9838
9850
9854
9855
9858 if (ConfigIsExisting("canBeSplit"))
9859 {
9862 }
9863
9865 if (ConfigIsExisting("itemBehaviour"))
9867
9868
9871 RegisterNetSyncVariableInt("m_VarLiquidType");
9872 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9873
9874 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9875 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9876 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9877
9878 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9879 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9880 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9881 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9882
9883 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9884 RegisterNetSyncVariableBool("m_IsTakeable");
9885 RegisterNetSyncVariableBool("m_IsHologram");
9886
9889 {
9892 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9893 }
9894
9896
9898 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9900
9902 }
9903
9905 {
9907 }
9908
9910 {
9913 {
9918 }
9919 }
9920
9921 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9922 {
9924 {
9927 }
9928
9930 }
9931
9933 {
9939 }
9940
9942
9944 {
9946
9947 if (!action)
9948 {
9949 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9950 return;
9951 }
9952
9954 if (!ai)
9955 {
9957 return;
9958 }
9959
9961 if (!action_array)
9962 {
9963 action_array = new array<ActionBase_Basic>;
9965 }
9966 if (LogManager.IsActionLogEnable())
9967 {
9968 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9969 }
9970
9971 if (action_array.Find(action) != -1)
9972 {
9973 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9974 }
9975 else
9976 {
9977 action_array.Insert(action);
9978 }
9979 }
9980
9982 {
9983 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9984 ActionBase action = player.GetActionManager().GetAction(actionName);
9987
9988 if (action_array)
9989 {
9990 action_array.RemoveItem(action);
9991 }
9992 }
9993
9994
9995
9997 {
9998 ActionOverrideData overrideData = new ActionOverrideData();
10002
10004 if (!actionMap)
10005 {
10008 }
10009
10010 actionMap.Insert(this.
Type(), overrideData);
10011
10012 }
10013
10015
10017
10018
10020 {
10023
10026
10027 string config_to_search = "CfgVehicles";
10028 string muzzle_owner_config;
10029
10031 {
10032 if (IsInherited(Weapon))
10033 config_to_search = "CfgWeapons";
10034
10035 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10036
10037 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10038
10039 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10040
10041 if (config_OnFire_subclass_count > 0)
10042 {
10043 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10044
10045 for (int i = 0; i < config_OnFire_subclass_count; i++)
10046 {
10047 string particle_class = "";
10048 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10049 string config_OnFire_entry = config_OnFire_class + particle_class;
10050 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10051 WPOF_array.Insert(WPOF);
10052 }
10053
10054
10056 }
10057 }
10058
10060 {
10061 config_to_search = "CfgWeapons";
10062 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10063
10064 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10065
10066 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10067
10068 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10069 {
10070 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10071
10072 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10073 {
10074 string particle_class2 = "";
10075 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10076 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10077 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10078 WPOBE_array.Insert(WPOBE);
10079 }
10080
10081
10083 }
10084 }
10085 }
10086
10087
10089 {
10092
10094 {
10095 string config_to_search = "CfgVehicles";
10096
10097 if (IsInherited(Weapon))
10098 config_to_search = "CfgWeapons";
10099
10100 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10101 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10102
10103 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10104 {
10105
10107
10109 {
10111 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10113 return;
10114 }
10115
10118
10119
10120
10121 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10122 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10123
10124 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10125 {
10126 string particle_class = "";
10127 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10128 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10129 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10130
10131 if (entry_type == CT_CLASS)
10132 {
10133 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10134 WPOOH_array.Insert(WPOF);
10135 }
10136 }
10137
10138
10140 }
10141 }
10142 }
10143
10145 {
10147 }
10148
10150 {
10152 {
10154
10157
10160
10161 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10162 }
10163 }
10164
10166 {
10168 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10169
10171 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10172
10174 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10175
10177 {
10179 }
10180 }
10181
10183 {
10185 }
10186
10188 {
10191 else
10193
10195 {
10198 }
10199 else
10200 {
10203
10206 }
10207
10209 }
10210
10212 {
10214 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10215 }
10216
10218 {
10220 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10222 }
10223
10225 {
10227 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10228 }
10229
10231 {
10234
10235 OverheatingParticle OP = new OverheatingParticle();
10240
10242 }
10243
10245 {
10248
10249 return -1;
10250 }
10251
10253 {
10255 {
10258
10259 for (int i = count; i > 0; --i)
10260 {
10261 int id = i - 1;
10264
10267
10268 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10269 {
10270 if (p)
10271 {
10274 }
10275 }
10276 }
10277 }
10278 }
10279
10281 {
10283 {
10285 {
10286 int id = i - 1;
10288
10289 if (OP)
10290 {
10292
10293 if (p)
10294 {
10296 }
10297
10298 delete OP;
10299 }
10300 }
10301
10304 }
10305 }
10306
10309 {
10310 return 0.0;
10311 }
10312
10313
10315 {
10316 return 250;
10317 }
10318
10320 {
10321 return 0;
10322 }
10323
10326 {
10328 return true;
10329
10330 return false;
10331 }
10332
10335 {
10338
10340 {
10342 }
10343 else
10344 {
10345
10347 }
10348
10350 }
10351
10358 {
10359 return -1;
10360 }
10361
10362
10363
10364
10366 {
10368 {
10369 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10370 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10371
10372 if (r_index >= 0)
10373 {
10374 InventoryLocation r_il = new InventoryLocation;
10375 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10376
10377 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10380 {
10381 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10382 }
10384 {
10385 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10386 }
10387
10388 }
10389
10390 player.GetHumanInventory().ClearUserReservedLocation(this);
10391 }
10392
10395 }
10396
10397
10398
10399
10401 {
10402 return ItemBase.m_DebugActionsMask;
10403 }
10404
10406 {
10407 return ItemBase.m_DebugActionsMask & mask;
10408 }
10409
10411 {
10412 ItemBase.m_DebugActionsMask = mask;
10413 }
10414
10416 {
10417 ItemBase.m_DebugActionsMask |= mask;
10418 }
10419
10421 {
10422 ItemBase.m_DebugActionsMask &= ~mask;
10423 }
10424
10426 {
10428 {
10430 }
10431 else
10432 {
10434 }
10435 }
10436
10437
10439 {
10440 if (GetEconomyProfile())
10441 {
10442 float q_max = GetEconomyProfile().GetQuantityMax();
10443 if (q_max > 0)
10444 {
10445 float q_min = GetEconomyProfile().GetQuantityMin();
10446 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10447
10449 {
10450 ComponentEnergyManager comp = GetCompEM();
10452 {
10454 }
10455 }
10457 {
10459
10460 }
10461
10462 }
10463 }
10464 }
10465
10468 {
10469 EntityAI parent = GetHierarchyParent();
10470
10471 if (parent)
10472 {
10473 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10474 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10475 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10476 }
10477 }
10478
10481 {
10482 EntityAI parent = GetHierarchyParent();
10483
10484 if (parent)
10485 {
10486 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10487 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10488 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10489 }
10490 }
10491
10493 {
10494
10495
10496
10497
10499
10501 {
10502 if (ScriptInputUserData.CanStoreInputUserData())
10503 {
10504 ScriptInputUserData ctx = new ScriptInputUserData;
10510 ctx.
Write(use_stack_max);
10513
10515 {
10516 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10517 }
10518 }
10519 }
10520 else if (!
g_Game.IsMultiplayer())
10521 {
10523 }
10524 }
10525
10527 {
10529 }
10530
10532 {
10534 }
10535
10537 {
10539 }
10540
10542 {
10543
10544 return false;
10545 }
10546
10548 {
10549 return false;
10550 }
10551
10555 {
10556 return false;
10557 }
10558
10560 {
10561 return "";
10562 }
10563
10565
10567 {
10568 return false;
10569 }
10570
10572 {
10573 return true;
10574 }
10575
10576
10577
10579 {
10580 return true;
10581 }
10582
10584 {
10585 return true;
10586 }
10587
10589 {
10590 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10592 }
10593
10595 {
10597 }
10598
10600 {
10602 if (!is_being_placed)
10604 SetSynchDirty();
10605 }
10606
10607
10609
10611 {
10613 }
10614
10616 {
10618 }
10619
10621 {
10622 return 1;
10623 }
10624
10626 {
10627 return false;
10628 }
10629
10631 {
10633 SetSynchDirty();
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
10662
10663
10664
10665
10666
10667
10668
10669
10671 {
10672 super.OnMovedInsideCargo(container);
10673
10674 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10675 }
10676
10677 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10678 {
10679 super.EEItemLocationChanged(oldLoc, newLoc);
10680
10681 PlayerBase newPlayer = null;
10682 PlayerBase oldPlayer = null;
10683
10684 if (newLoc.GetParent())
10685 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10686
10687 if (oldLoc.GetParent())
10688 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10689
10691 {
10692 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10693
10694 if (rIndex >= 0)
10695 {
10696 InventoryLocation rIl = new InventoryLocation;
10697 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10698
10699 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10702 {
10703 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10704 }
10706 {
10708 }
10709
10710 }
10711 }
10712
10714 {
10715 if (newPlayer)
10716 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10717
10718 if (newPlayer == oldPlayer)
10719 {
10720 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10721 {
10723 {
10724 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10725 {
10726 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10727 }
10728 }
10729 else
10730 {
10731 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10732 }
10733 }
10734
10735 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10736 {
10737 int type = oldLoc.GetType();
10739 {
10740 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10741 }
10743 {
10744 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10745 }
10746 }
10747 if (!m_OldLocation)
10748 {
10749 m_OldLocation = new InventoryLocation;
10750 }
10751 m_OldLocation.Copy(oldLoc);
10752 }
10753 else
10754 {
10755 if (m_OldLocation)
10756 {
10757 m_OldLocation.Reset();
10758 }
10759 }
10760
10761 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10762 }
10763 else
10764 {
10765 if (newPlayer)
10766 {
10767 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10768 if (resIndex >= 0)
10769 {
10770 InventoryLocation il = new InventoryLocation;
10771 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10773 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10776 {
10777 il.
GetParent().GetOnReleaseLock().Invoke(it);
10778 }
10780 {
10782 }
10783
10784 }
10785 }
10787 {
10788
10790 }
10791
10792 if (m_OldLocation)
10793 {
10794 m_OldLocation.Reset();
10795 }
10796 }
10797
10799 {
10800 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10801 }
10802
10804 {
10805 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10806 }
10807 }
10808
10809 override void EOnContact(IEntity other, Contact extra)
10810 {
10812 {
10813 int liquidType = -1;
10815 if (impactSpeed > 0.0)
10816 {
10818 #ifndef SERVER
10820 #else
10822 SetSynchDirty();
10823 #endif
10825 }
10826 }
10827
10828 #ifdef SERVER
10829 if (GetCompEM() && GetCompEM().IsPlugged())
10830 {
10831 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10832 GetCompEM().UnplugThis();
10833 }
10834 #endif
10835 }
10836
10838
10840 {
10842 }
10843
10845 {
10846
10847 }
10848
10850 {
10851 super.OnItemLocationChanged(old_owner, new_owner);
10852
10853 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10854 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10855
10856 if (!relatedPlayer && playerNew)
10857 relatedPlayer = playerNew;
10858
10859 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10860 {
10862 if (actionMgr)
10863 {
10864 ActionBase currentAction = actionMgr.GetRunningAction();
10865 if (currentAction)
10867 }
10868 }
10869
10870 Man ownerPlayerOld = null;
10871 Man ownerPlayerNew = null;
10872
10873 if (old_owner)
10874 {
10875 if (old_owner.
IsMan())
10876 {
10877 ownerPlayerOld = Man.Cast(old_owner);
10878 }
10879 else
10880 {
10881 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10882 }
10883 }
10884 else
10885 {
10887 {
10889
10890 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10891 {
10892 GetCompEM().UnplugThis();
10893 }
10894 }
10895 }
10896
10897 if (new_owner)
10898 {
10899 if (new_owner.
IsMan())
10900 {
10901 ownerPlayerNew = Man.Cast(new_owner);
10902 }
10903 else
10904 {
10905 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10906 }
10907 }
10908
10909 if (ownerPlayerOld != ownerPlayerNew)
10910 {
10911 if (ownerPlayerOld)
10912 {
10913 array<EntityAI> subItemsExit = new array<EntityAI>;
10915 for (int i = 0; i < subItemsExit.Count(); i++)
10916 {
10919 }
10920 }
10921
10922 if (ownerPlayerNew)
10923 {
10924 array<EntityAI> subItemsEnter = new array<EntityAI>;
10926 for (int j = 0; j < subItemsEnter.Count(); j++)
10927 {
10930 }
10931 }
10932 }
10933 else if (ownerPlayerNew != null)
10934 {
10935 PlayerBase nplayer;
10936 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10937 {
10938 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10940 for (int k = 0; k < subItemsUpdate.Count(); k++)
10941 {
10943 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10944 }
10945 }
10946 }
10947
10948 if (old_owner)
10949 old_owner.OnChildItemRemoved(this);
10950 if (new_owner)
10951 new_owner.OnChildItemReceived(this);
10952 }
10953
10954
10956 {
10957 super.EEDelete(parent);
10958 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10959 if (player)
10960 {
10962
10963 if (player.IsAlive())
10964 {
10965 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10966 if (r_index >= 0)
10967 {
10968 InventoryLocation r_il = new InventoryLocation;
10969 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10970
10971 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10974 {
10975 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10976 }
10978 {
10979 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10980 }
10981
10982 }
10983
10984 player.RemoveQuickBarEntityShortcut(this);
10985 }
10986 }
10987 }
10988
10990 {
10991 super.EEKilled(killer);
10992
10995 {
10996 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10997 {
10998 if (IsMagazine())
10999 {
11000 if (Magazine.Cast(this).GetAmmoCount() > 0)
11001 {
11003 }
11004 }
11005 else
11006 {
11008 }
11009 }
11010 }
11011 }
11012
11014 {
11015 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11016
11017 super.OnWasAttached(parent, slot_id);
11018
11021
11024 }
11025
11027 {
11028 super.OnWasDetached(parent, slot_id);
11029
11032
11035 }
11036
11038 {
11039 int idx;
11042
11043 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11044 if (inventory_slots.Count() < 1)
11045 {
11046 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11047 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11048 }
11049 else
11050 {
11051 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11052 }
11053
11054 idx = inventory_slots.Find(slot);
11055 if (idx < 0)
11056 return "";
11057
11058 return attach_types.Get(idx);
11059 }
11060
11062 {
11063 int idx = -1;
11064 string slot;
11065
11068
11069 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11070 if (inventory_slots.Count() < 1)
11071 {
11072 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11073 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11074 }
11075 else
11076 {
11077 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11078 if (detach_types.Count() < 1)
11079 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11080 }
11081
11082 for (int i = 0; i < inventory_slots.Count(); i++)
11083 {
11084 slot = inventory_slots.Get(i);
11085 }
11086
11087 if (slot != "")
11088 {
11089 if (detach_types.Count() == 1)
11090 idx = 0;
11091 else
11092 idx = inventory_slots.Find(slot);
11093 }
11094 if (idx < 0)
11095 return "";
11096
11097 return detach_types.Get(idx);
11098 }
11099
11101 {
11102
11104
11105
11106 float min_time = 1;
11107 float max_time = 3;
11108 float delay = Math.RandomFloat(min_time, max_time);
11109
11110 explode_timer.Run(delay, this, "DoAmmoExplosion");
11111 }
11112
11114 {
11115 Magazine magazine = Magazine.Cast(this);
11116 int pop_sounds_count = 6;
11117 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11118
11119
11120 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11121 string sound_name = pop_sounds[ sound_idx ];
11122 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11123
11124
11125 magazine.ServerAddAmmoCount(-1);
11126
11127
11128 float min_temp_to_explode = 100;
11129
11130 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11131 {
11133 }
11134 }
11135
11136
11137 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11138 {
11139 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11140
11141 const int CHANCE_DAMAGE_CARGO = 4;
11142 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11143 const int CHANCE_DAMAGE_NOTHING = 2;
11144
11146 {
11147 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11148 int chances;
11149 int rnd;
11150
11151 if (GetInventory().GetCargo())
11152 {
11153 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11154 rnd = Math.RandomInt(0,chances);
11155
11156 if (rnd < CHANCE_DAMAGE_CARGO)
11157 {
11159 }
11160 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11161 {
11163 }
11164 }
11165 else
11166 {
11167 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11168 rnd = Math.RandomInt(0,chances);
11169
11170 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11171 {
11173 }
11174 }
11175 }
11176 }
11177
11179 {
11180 CargoBase cargo = GetInventory().GetCargo();
11181 if (cargo)
11182 {
11184 if (item_count > 0)
11185 {
11186 int random_pick = Math.RandomInt(0, item_count);
11188 if (!item.IsExplosive())
11189 {
11190 item.AddHealth("","",damage);
11191 return true;
11192 }
11193 }
11194 }
11195 return false;
11196 }
11197
11199 {
11200 GameInventory inventory = GetInventory();
11202 if (attachment_count > 0)
11203 {
11204 int random_pick = Math.RandomInt(0, attachment_count);
11206 if (!attachment.IsExplosive())
11207 {
11208 attachment.AddHealth("","",damage);
11209 return true;
11210 }
11211 }
11212 return false;
11213 }
11214
11216 {
11218 }
11219
11221 {
11223 return GetInventory().CanRemoveEntity();
11224
11225 return false;
11226 }
11227
11229 {
11230
11232 return false;
11233
11234
11236 return false;
11237
11238
11239
11241 if (delta == 0)
11242 return false;
11243
11244
11245 return true;
11246 }
11247
11249 {
11251 {
11252 if (ScriptInputUserData.CanStoreInputUserData())
11253 {
11254 ScriptInputUserData ctx = new ScriptInputUserData;
11259 ctx.
Write(destination_entity);
11261 ctx.
Write(slot_id);
11263 }
11264 }
11265 else if (!
g_Game.IsMultiplayer())
11266 {
11268 }
11269 }
11270
11272 {
11273 float split_quantity_new;
11277 InventoryLocation loc = new InventoryLocation;
11278
11279 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11280 {
11282 split_quantity_new = stack_max;
11283 else
11285
11287 {
11288 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11289 if (new_item)
11290 {
11291 new_item.SetResultOfSplit(true);
11292 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11294 new_item.
SetQuantity(split_quantity_new,
false,
true);
11295 }
11296 }
11297 }
11298 else if (destination_entity && slot_id == -1)
11299 {
11300 if (quantity > stack_max)
11301 split_quantity_new = stack_max;
11302 else
11303 split_quantity_new = quantity;
11304
11306 {
11307 GameInventory destinationInventory = destination_entity.GetInventory();
11309 {
11312 }
11313
11314 if (new_item)
11315 {
11316 new_item.SetResultOfSplit(true);
11317 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11319 new_item.
SetQuantity(split_quantity_new,
false,
true);
11320 }
11321 }
11322 }
11323 else
11324 {
11325 if (stack_max != 0)
11326 {
11328 {
11330 }
11331
11332 if (split_quantity_new == 0)
11333 {
11334 if (!
g_Game.IsMultiplayer())
11335 player.PhysicalPredictiveDropItem(this);
11336 else
11337 player.ServerDropEntity(this);
11338 return;
11339 }
11340
11342 {
11344
11345 if (new_item)
11346 {
11347 new_item.SetResultOfSplit(true);
11348 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11351 new_item.PlaceOnSurface();
11352 }
11353 }
11354 }
11355 }
11356 }
11357
11359 {
11360 float split_quantity_new;
11364 InventoryLocation loc = new InventoryLocation;
11365
11366 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11367 {
11369 split_quantity_new = stack_max;
11370 else
11372
11374 {
11375 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11376 if (new_item)
11377 {
11378 new_item.SetResultOfSplit(true);
11379 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11381 new_item.
SetQuantity(split_quantity_new,
false,
true);
11382 }
11383 }
11384 }
11385 else if (destination_entity && slot_id == -1)
11386 {
11387 if (quantity > stack_max)
11388 split_quantity_new = stack_max;
11389 else
11390 split_quantity_new = quantity;
11391
11393 {
11394 GameInventory destinationInventory = destination_entity.GetInventory();
11396 {
11399 }
11400
11401 if (new_item)
11402 {
11403 new_item.SetResultOfSplit(true);
11404 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11406 new_item.
SetQuantity(split_quantity_new,
false,
true);
11407 }
11408 }
11409 }
11410 else
11411 {
11412 if (stack_max != 0)
11413 {
11415 {
11417 }
11418
11420 {
11422
11423 if (new_item)
11424 {
11425 new_item.SetResultOfSplit(true);
11426 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11429 new_item.PlaceOnSurface();
11430 }
11431 }
11432 }
11433 }
11434 }
11435
11437 {
11439 {
11440 if (ScriptInputUserData.CanStoreInputUserData())
11441 {
11442 ScriptInputUserData ctx = new ScriptInputUserData;
11447 dst.WriteToContext(ctx);
11449 }
11450 }
11451 else if (!
g_Game.IsMultiplayer())
11452 {
11454 }
11455 }
11456
11458 {
11460 {
11461 if (ScriptInputUserData.CanStoreInputUserData())
11462 {
11463 ScriptInputUserData ctx = new ScriptInputUserData;
11468 ctx.
Write(destination_entity);
11474 }
11475 }
11476 else if (!
g_Game.IsMultiplayer())
11477 {
11479 }
11480 }
11481
11483 {
11485 }
11486
11488 {
11490 float split_quantity_new;
11492 if (dst.IsValid())
11493 {
11494 int slot_id = dst.GetSlot();
11496
11497 if (quantity > stack_max)
11498 split_quantity_new = stack_max;
11499 else
11500 split_quantity_new = quantity;
11501
11503 {
11505
11506 if (new_item)
11507 {
11508 new_item.SetResultOfSplit(true);
11509 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11511 new_item.
SetQuantity(split_quantity_new,
false,
true);
11512 }
11513
11514 return new_item;
11515 }
11516 }
11517
11518 return null;
11519 }
11520
11522 {
11524 float split_quantity_new;
11526 if (destination_entity)
11527 {
11529 if (quantity > stackable)
11530 split_quantity_new = stackable;
11531 else
11532 split_quantity_new = quantity;
11533
11535 {
11536 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11537 if (new_item)
11538 {
11539 new_item.SetResultOfSplit(true);
11540 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11542 new_item.
SetQuantity(split_quantity_new,
false,
true);
11543 }
11544 }
11545 }
11546 }
11547
11549 {
11551 {
11552 if (ScriptInputUserData.CanStoreInputUserData())
11553 {
11554 ScriptInputUserData ctx = new ScriptInputUserData;
11559 ItemBase destination_entity =
this;
11560 ctx.
Write(destination_entity);
11564 }
11565 }
11566 else if (!
g_Game.IsMultiplayer())
11567 {
11569 }
11570 }
11571
11573 {
11575 float split_quantity_new;
11577 if (player)
11578 {
11580 if (quantity > stackable)
11581 split_quantity_new = stackable;
11582 else
11583 split_quantity_new = quantity;
11584
11586 {
11587 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11588 new_item =
ItemBase.Cast(in_hands);
11589 if (new_item)
11590 {
11591 new_item.SetResultOfSplit(true);
11592 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11594 new_item.SetQuantity(split_quantity_new, false, true);
11595 }
11596 }
11597 }
11598 }
11599
11601 {
11603 float split_quantity_new = Math.Floor(quantity * 0.5);
11604
11606 return;
11607
11609
11610 if (new_item)
11611 {
11612 if (new_item.GetQuantityMax() < split_quantity_new)
11613 {
11614 split_quantity_new = new_item.GetQuantityMax();
11615 }
11616
11617 new_item.SetResultOfSplit(true);
11618 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11619
11621 {
11624 }
11625 else
11626 {
11628 new_item.
SetQuantity(split_quantity_new,
false,
true);
11629 }
11630 }
11631 }
11632
11634 {
11636 float split_quantity_new = Math.Floor(quantity / 2);
11637
11639 return;
11640
11641 InventoryLocation invloc = new InventoryLocation;
11643
11645 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11646
11647 if (new_item)
11648 {
11649 if (new_item.GetQuantityMax() < split_quantity_new)
11650 {
11651 split_quantity_new = new_item.GetQuantityMax();
11652 }
11654 {
11657 }
11658 else if (split_quantity_new > 1)
11659 {
11661 new_item.
SetQuantity(split_quantity_new,
false,
true);
11662 }
11663 }
11664 }
11665
11668 {
11669 SetWeightDirty();
11671
11672 if (parent)
11673 parent.OnAttachmentQuantityChangedEx(this, delta);
11674
11676 {
11678 {
11680 }
11682 {
11683 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11685 }
11686 }
11687 }
11688
11691 {
11692
11693 }
11694
11697 {
11699 }
11700
11702 {
11703 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11704
11706 {
11707 if (newLevel == GameConstants.STATE_RUINED)
11708 {
11710 EntityAI parent = GetHierarchyParent();
11711 if (parent && parent.IsFireplace())
11712 {
11713 CargoBase cargo = GetInventory().GetCargo();
11714 if (cargo)
11715 {
11717 {
11719 }
11720 }
11721 }
11722 }
11723
11725 {
11726
11728 return;
11729 }
11730
11731 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11732 {
11734 }
11735 }
11736 }
11737
11738
11740 {
11741 super.OnRightClick();
11742
11744 {
11746 {
11747 if (ScriptInputUserData.CanStoreInputUserData())
11748 {
11749 EntityAI root = GetHierarchyRoot();
11750 Man playerOwner = GetHierarchyRootPlayer();
11751 InventoryLocation dst = new InventoryLocation;
11752
11753
11754 if (!playerOwner && root && root == this)
11755 {
11757 }
11758 else
11759 {
11760
11761 GetInventory().GetCurrentInventoryLocation(dst);
11763 {
11764 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11766 {
11768 }
11769 else
11770 {
11772
11773
11774 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11775 {
11777 }
11778 else
11779 {
11780 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11781 }
11782 }
11783 }
11784 }
11785
11786 ScriptInputUserData ctx = new ScriptInputUserData;
11794 }
11795 }
11796 else if (!
g_Game.IsMultiplayer())
11797 {
11799 }
11800 }
11801 }
11802
11804 {
11805 if (root)
11806 {
11807 vector m4[4];
11808 root.GetTransform(m4);
11809 dst.SetGround(this, m4);
11810 }
11811 else
11812 {
11813 GetInventory().GetCurrentInventoryLocation(dst);
11814 }
11815 }
11816
11817 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11818 {
11819
11820 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11821 return false;
11822
11823 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11824 return false;
11825
11826
11828 return false;
11829
11830
11831 Magazine mag = Magazine.Cast(this);
11832 if (mag)
11833 {
11834 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11835 return false;
11836
11837 if (stack_max_limit)
11838 {
11839 Magazine other_mag = Magazine.Cast(other_item);
11840 if (other_item)
11841 {
11842 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11843 return false;
11844 }
11845
11846 }
11847 }
11848 else
11849 {
11850
11852 return false;
11853
11855 return false;
11856 }
11857
11858 PlayerBase player = null;
11859 if (CastTo(player, GetHierarchyRootPlayer()))
11860 {
11861 if (player.GetInventory().HasAttachment(this))
11862 return false;
11863
11864 if (player.IsItemsToDelete())
11865 return false;
11866 }
11867
11868 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11869 return false;
11870
11871 int slotID;
11873 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11874 return false;
11875
11876 return true;
11877 }
11878
11880 {
11882 }
11883
11885 {
11886 return m_IsResultOfSplit;
11887 }
11888
11890 {
11891 m_IsResultOfSplit = value;
11892 }
11893
11895 {
11897 }
11898
11900 {
11901 float other_item_quantity = other_item.GetQuantity();
11902 float this_free_space;
11903
11905
11907
11908 if (other_item_quantity > this_free_space)
11909 {
11910 return this_free_space;
11911 }
11912 else
11913 {
11914 return other_item_quantity;
11915 }
11916 }
11917
11919 {
11921 }
11922
11924 {
11926 return;
11927
11928 if (!IsMagazine() && other_item)
11929 {
11931 if (quantity_used != 0)
11932 {
11933 float hp1 = GetHealth01("","");
11934 float hp2 = other_item.GetHealth01("","");
11935 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11936 hpResult = hpResult / (
GetQuantity() + quantity_used);
11937
11938 hpResult *= GetMaxHealth();
11939 Math.Round(hpResult);
11940 SetHealth("", "Health", hpResult);
11941
11943 other_item.AddQuantity(-quantity_used);
11944 }
11945 }
11947 }
11948
11950 {
11951 #ifdef SERVER
11952 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11953 GetHierarchyParent().IncreaseLifetimeUp();
11954 #endif
11955 };
11956
11958 {
11959 PlayerBase p = PlayerBase.Cast(player);
11960
11961 array<int> recipesIds = p.m_Recipes;
11962 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11963 if (moduleRecipesManager)
11964 {
11965 EntityAI itemInHands = player.GetEntityInHands();
11966 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11967 }
11968
11969 for (int i = 0;i < recipesIds.Count(); i++)
11970 {
11971 int key = recipesIds.Get(i);
11972 string recipeName = moduleRecipesManager.GetRecipeName(key);
11974 }
11975 }
11976
11977
11978 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11979 {
11980 super.GetDebugActions(outputList);
11981
11982
11988
11989
11994
11999
12000
12004
12005
12007 {
12011 }
12012
12015
12016
12020
12022
12023 InventoryLocation loc = new InventoryLocation();
12024 GetInventory().GetCurrentInventoryLocation(loc);
12026 {
12027 if (Gizmo_IsSupported())
12030 }
12031
12033 }
12034
12035
12036
12037
12039 {
12040 super.OnAction(action_id, player, ctx);
12041
12043 {
12044 switch (action_id)
12045 {
12049 return true;
12053 return true;
12054 }
12055 }
12056
12058 {
12059 switch (action_id)
12060 {
12062 Delete();
12063 return true;
12064 }
12065 }
12066
12067 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12068 {
12069 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12070 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12071 PlayerBase p = PlayerBase.Cast(player);
12072 if (
EActions.RECIPES_RANGE_START < 1000)
12073 {
12074 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12075 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12076 }
12077 }
12078 #ifndef SERVER
12079 else if (action_id ==
EActions.WATCH_PLAYER)
12080 {
12081 PluginDeveloper.SetDeveloperItemClientEx(player);
12082 }
12083 #endif
12085 {
12086 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12087 {
12088 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12089 OnDebugButtonPressServer(id + 1);
12090 }
12091
12092 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12093 {
12094 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12096 }
12097
12098 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12099 {
12100 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12102 }
12103
12104 else if (action_id ==
EActions.ADD_QUANTITY)
12105 {
12106 if (IsMagazine())
12107 {
12108 Magazine mag = Magazine.Cast(this);
12109 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12110 }
12111 else
12112 {
12114 }
12115
12116 if (m_EM)
12117 {
12118 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12119 }
12120
12121 }
12122
12123 else if (action_id ==
EActions.REMOVE_QUANTITY)
12124 {
12125 if (IsMagazine())
12126 {
12127 Magazine mag2 = Magazine.Cast(this);
12128 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12129 }
12130 else
12131 {
12133 }
12134 if (m_EM)
12135 {
12136 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12137 }
12138
12139 }
12140
12141 else if (action_id ==
EActions.SET_QUANTITY_0)
12142 {
12144
12145 if (m_EM)
12146 {
12147 m_EM.SetEnergy(0);
12148 }
12149 }
12150
12151 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12152 {
12154
12155 if (m_EM)
12156 {
12157 m_EM.SetEnergy(m_EM.GetEnergyMax());
12158 }
12159 }
12160
12161 else if (action_id ==
EActions.ADD_HEALTH)
12162 {
12163 AddHealth("","",GetMaxHealth("","Health")/5);
12164 }
12165 else if (action_id ==
EActions.REMOVE_HEALTH)
12166 {
12167 AddHealth("","",-GetMaxHealth("","Health")/5);
12168 }
12169 else if (action_id ==
EActions.DESTROY_HEALTH)
12170 {
12171 SetHealth01("","",0);
12172 }
12173 else if (action_id ==
EActions.WATCH_ITEM)
12174 {
12176 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12177 #ifdef DEVELOPER
12178 SetDebugDeveloper_item(this);
12179 #endif
12180 }
12181
12182 else if (action_id ==
EActions.ADD_TEMPERATURE)
12183 {
12184 AddTemperature(20);
12185
12186 }
12187
12188 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12189 {
12190 AddTemperature(-20);
12191
12192 }
12193
12194 else if (action_id ==
EActions.FLIP_FROZEN)
12195 {
12196 SetFrozen(!GetIsFrozen());
12197
12198 }
12199
12200 else if (action_id ==
EActions.ADD_WETNESS)
12201 {
12203
12204 }
12205
12206 else if (action_id ==
EActions.REMOVE_WETNESS)
12207 {
12209
12210 }
12211
12212 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12213 {
12216
12217
12218 }
12219
12220 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12221 {
12224 }
12225
12226 else if (action_id ==
EActions.MAKE_SPECIAL)
12227 {
12228 auto debugParams = DebugSpawnParams.WithPlayer(player);
12229 OnDebugSpawnEx(debugParams);
12230 }
12231
12232 }
12233
12234
12235 return false;
12236 }
12237
12238
12239
12240
12244
12247
12248
12249
12251 {
12252 return false;
12253 }
12254
12255
12257 {
12258 return true;
12259 }
12260
12261
12263 {
12264 return true;
12265 }
12266
12267
12268
12270 {
12271 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12272 return g_Game.ConfigIsExisting(config_path);
12273 }
12274
12277 {
12278 return null;
12279 }
12280
12282 {
12283 return false;
12284 }
12285
12287 {
12288 return false;
12289 }
12290
12294
12295
12297 {
12298 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12299 return module_repairing.CanRepair(this, item_repair_kit);
12300 }
12301
12302
12303 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12304 {
12305 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12306 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12307 }
12308
12309
12311 {
12312
12313
12314
12315
12316
12317
12318
12319
12320 return 1;
12321 }
12322
12323
12324
12326 {
12328 }
12329
12330
12331
12333 {
12335 }
12336
12337
12346 {
12347 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12348
12349 if (player)
12350 {
12351 player.MessageStatus(text);
12352 }
12353 }
12354
12355
12364 {
12365 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12366
12367 if (player)
12368 {
12369 player.MessageAction(text);
12370 }
12371 }
12372
12373
12382 {
12383 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12384
12385 if (player)
12386 {
12387 player.MessageFriendly(text);
12388 }
12389 }
12390
12391
12400 {
12401 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12402
12403 if (player)
12404 {
12405 player.MessageImportant(text);
12406 }
12407 }
12408
12410 {
12411 return true;
12412 }
12413
12414
12415 override bool KindOf(
string tag)
12416 {
12417 bool found = false;
12418 string item_name = this.
GetType();
12420 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12421
12422 int array_size = item_tag_array.Count();
12423 for (int i = 0; i < array_size; i++)
12424 {
12425 if (item_tag_array.Get(i) == tag)
12426 {
12427 found = true;
12428 break;
12429 }
12430 }
12431 return found;
12432 }
12433
12434
12436 {
12437
12438 super.OnRPC(sender, rpc_type,ctx);
12439
12440
12441 switch (rpc_type)
12442 {
12443 #ifndef SERVER
12444 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12445 Param2<bool, string> p = new Param2<bool, string>(false, "");
12446
12448 return;
12449
12450 bool play = p.param1;
12451 string soundSet = p.param2;
12452
12453 if (play)
12454 {
12456 {
12458 {
12460 }
12461 }
12462 else
12463 {
12465 }
12466 }
12467 else
12468 {
12470 }
12471
12472 break;
12473 #endif
12474
12475 }
12476
12478 {
12480 }
12481 }
12482
12483
12484
12485
12487 {
12488 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12489 return plugin.GetID(
name);
12490 }
12491
12493 {
12494 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12495 return plugin.GetName(id);
12496 }
12497
12500 {
12501
12502
12503 int varFlags;
12504 if (!ctx.
Read(varFlags))
12505 return;
12506
12507 if (varFlags & ItemVariableFlags.FLOAT)
12508 {
12510 }
12511 }
12512
12514 {
12515
12516 super.SerializeNumericalVars(floats_out);
12517
12518
12519
12521 {
12523 }
12524
12526 {
12528 }
12529
12531 {
12533 }
12534
12536 {
12541 }
12542
12544 {
12546 }
12547 }
12548
12550 {
12551
12552 super.DeSerializeNumericalVars(floats);
12553
12554
12555 int index = 0;
12556 int mask = Math.Round(floats.Get(index));
12557
12558 index++;
12559
12561 {
12563 {
12565 }
12566 else
12567 {
12568 float quantity = floats.Get(index);
12569 SetQuantity(quantity,
true,
false,
false,
false);
12570 }
12571 index++;
12572 }
12573
12575 {
12576 float wet = floats.Get(index);
12578 index++;
12579 }
12580
12582 {
12583 int liquidtype = Math.Round(floats.Get(index));
12585 index++;
12586 }
12587
12589 {
12591 index++;
12593 index++;
12595 index++;
12597 index++;
12598 }
12599
12601 {
12602 int cleanness = Math.Round(floats.Get(index));
12604 index++;
12605 }
12606 }
12607
12609 {
12610 super.WriteVarsToCTX(ctx);
12611
12612
12614 {
12616 }
12617
12619 {
12621 }
12622
12624 {
12626 }
12627
12629 {
12630 int r,g,b,a;
12636 }
12637
12639 {
12641 }
12642 }
12643
12645 {
12646 if (!super.ReadVarsFromCTX(ctx,version))
12647 return false;
12648
12649 int intValue;
12650 float value;
12651
12652 if (version < 140)
12653 {
12654 if (!ctx.
Read(intValue))
12655 return false;
12656
12657 m_VariablesMask = intValue;
12658 }
12659
12661 {
12662 if (!ctx.
Read(value))
12663 return false;
12664
12666 {
12668 }
12669 else
12670 {
12672 }
12673 }
12674
12675 if (version < 140)
12676 {
12678 {
12679 if (!ctx.
Read(value))
12680 return false;
12681 SetTemperatureDirect(value);
12682 }
12683 }
12684
12686 {
12687 if (!ctx.
Read(value))
12688 return false;
12690 }
12691
12693 {
12694 if (!ctx.
Read(intValue))
12695 return false;
12697 }
12698
12700 {
12701 int r,g,b,a;
12703 return false;
12705 return false;
12707 return false;
12709 return false;
12710
12712 }
12713
12715 {
12716 if (!ctx.
Read(intValue))
12717 return false;
12719 }
12720
12721 if (version >= 138 && version < 140)
12722 {
12724 {
12725 if (!ctx.
Read(intValue))
12726 return false;
12727 SetFrozen(intValue);
12728 }
12729 }
12730
12731 return true;
12732 }
12733
12734
12736 {
12739 {
12741 }
12742
12743 if (!super.OnStoreLoad(ctx, version))
12744 {
12746 return false;
12747 }
12748
12749 if (version >= 114)
12750 {
12751 bool hasQuickBarIndexSaved;
12752
12753 if (!ctx.
Read(hasQuickBarIndexSaved))
12754 {
12756 return false;
12757 }
12758
12759 if (hasQuickBarIndexSaved)
12760 {
12761 int itmQBIndex;
12762
12763
12764 if (!ctx.
Read(itmQBIndex))
12765 {
12767 return false;
12768 }
12769
12770 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12771 if (itmQBIndex != -1 && parentPlayer)
12772 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12773 }
12774 }
12775 else
12776 {
12777
12778 PlayerBase player;
12779 int itemQBIndex;
12780 if (version ==
int.
MAX)
12781 {
12782 if (!ctx.
Read(itemQBIndex))
12783 {
12785 return false;
12786 }
12787 }
12788 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12789 {
12790
12791 if (!ctx.
Read(itemQBIndex))
12792 {
12794 return false;
12795 }
12796 if (itemQBIndex != -1 && player)
12797 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12798 }
12799 }
12800
12801 if (version < 140)
12802 {
12803
12804 if (!LoadVariables(ctx, version))
12805 {
12807 return false;
12808 }
12809 }
12810
12811
12813 {
12815 return false;
12816 }
12817 if (version >= 132)
12818 {
12820 if (raib)
12821 {
12823 {
12825 return false;
12826 }
12827 }
12828 }
12829
12831 return true;
12832 }
12833
12834
12835
12837 {
12838 super.OnStoreSave(ctx);
12839
12840 PlayerBase player;
12841 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12842 {
12844
12845 int itemQBIndex = -1;
12846 itemQBIndex = player.FindQuickBarEntityIndex(this);
12847 ctx.
Write(itemQBIndex);
12848 }
12849 else
12850 {
12852 }
12853
12855
12857 if (raib)
12858 {
12860 }
12861 }
12862
12863
12865 {
12866 super.AfterStoreLoad();
12867
12869 {
12871 }
12872
12874 {
12877 }
12878 }
12879
12881 {
12882 super.EEOnAfterLoad();
12883
12885 {
12887 }
12888
12891 }
12892
12894 {
12895 return false;
12896 }
12897
12898
12899
12901 {
12903 {
12904 #ifdef PLATFORM_CONSOLE
12905
12907 {
12909 if (menu)
12910 {
12912 }
12913 }
12914 #endif
12915 }
12916
12918 {
12921 }
12922
12924 {
12925 SetWeightDirty();
12927 }
12929 {
12932 }
12933
12935 {
12938
12941 }
12943 {
12947 }
12948
12949 super.OnVariablesSynchronized();
12950 }
12951
12952
12953
12955 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12956 {
12957 if (!IsServerCheck(allow_client))
12958 return false;
12959
12961 return false;
12962
12965
12966 if (value <= (min + 0.001))
12967 value = min;
12968
12969 if (value == min)
12970 {
12971 if (destroy_config)
12972 {
12973 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12974 if (dstr)
12975 {
12977 this.Delete();
12978 return true;
12979 }
12980 }
12981 else if (destroy_forced)
12982 {
12984 this.Delete();
12985 return true;
12986 }
12987
12989 }
12990
12993
12995 {
12996 EntityAI parent = GetHierarchyRoot();
12997 InventoryLocation iLoc = new InventoryLocation();
12998 GetInventory().GetCurrentInventoryLocation(iLoc);
13000 {
13001 int iLocSlot = iLoc.
GetSlot();
13003 {
13005 }
13007 {
13009 }
13010 }
13011 }
13012
13014 {
13016
13017 if (delta)
13019 }
13020
13022
13023 return false;
13024 }
13025
13026
13028 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13029 {
13031 }
13032
13034 {
13037 }
13038
13040 {
13043 }
13044
13046 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13047 {
13048 float value_clamped = Math.Clamp(value, 0, 1);
13050 SetQuantity(result, destroy_config, destroy_forced);
13051 }
13052
13053
13056 {
13058 }
13059
13061 {
13063 }
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13075 {
13076 int slot = -1;
13077 GameInventory inventory = GetInventory();
13078 if (inventory)
13079 {
13080 InventoryLocation il = new InventoryLocation;
13083 }
13084
13086 }
13087
13089 {
13090 float quantity_max = 0;
13091
13093 {
13094 if (attSlotID != -1)
13095 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13096
13097 if (quantity_max <= 0)
13099 }
13100
13101 if (quantity_max <= 0)
13103
13104 return quantity_max;
13105 }
13106
13108 {
13110 }
13111
13113 {
13115 }
13116
13117
13119 {
13121 }
13122
13124 {
13126 }
13127
13129 {
13131 }
13132
13133
13135 {
13136
13137 float weightEx = GetWeightEx();
13138 float special = GetInventoryAndCargoWeight();
13139 return weightEx - special;
13140 }
13141
13142
13144 {
13146 }
13147
13149 {
13151 {
13152 #ifdef DEVELOPER
13153 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13154 {
13155 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13157 }
13158 #endif
13159
13160 return GetQuantity() * GetConfigWeightModified();
13161 }
13162 else if (HasEnergyManager())
13163 {
13164 #ifdef DEVELOPER
13165 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13166 {
13167 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13168 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13169 }
13170 #endif
13171 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13172 }
13173 else
13174 {
13175 #ifdef DEVELOPER
13176 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13177 {
13178 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13179 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13180 }
13181 #endif
13182 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13183 }
13184 }
13185
13188 {
13189 int item_count = 0;
13191
13192 GameInventory inventory = GetInventory();
13193 CargoBase cargo = inventory.
GetCargo();
13194 if (cargo != NULL)
13195 {
13197 }
13198
13200 for (int i = 0; i < nAttachments; ++i)
13201 {
13203 if (item)
13204 item_count += item.GetNumberOfItems();
13205 }
13206 return item_count;
13207 }
13208
13211 {
13212 float weight = 0;
13213 float wetness = 1;
13214 if (include_wetness)
13217 {
13218 weight = wetness * m_ConfigWeight;
13219 }
13221 {
13222 weight = 1;
13223 }
13224 return weight;
13225 }
13226
13227
13228
13230 {
13231 GameInventory inventory = GetInventory();
13232 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13233 {
13234 array<EntityAI> items = new array<EntityAI>;
13236 for (int i = 0; i < items.Count(); ++i)
13237 {
13239 if (item)
13240 {
13241 g_Game.ObjectDelete(item);
13242 }
13243 }
13244 }
13245 }
13246
13247
13248
13249
13251 {
13252 float energy = 0;
13253 if (HasEnergyManager())
13254 {
13255 energy = GetCompEM().GetEnergy();
13256 }
13257 return energy;
13258 }
13259
13260
13262 {
13263 super.OnEnergyConsumed();
13264
13266 }
13267
13269 {
13270 super.OnEnergyAdded();
13271
13273 }
13274
13275
13277 {
13278 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13279 {
13281 {
13282 float energy_0to1 = GetCompEM().GetEnergy0To1();
13284 }
13285 }
13286 }
13287
13288
13290 {
13291 return ConfigGetFloat("heatIsolation");
13292 }
13293
13295 {
13297 }
13298
13300 {
13301 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13302 if (
g_Game.ConfigIsExisting(paramPath))
13303 return g_Game.ConfigGetFloat(paramPath);
13304
13305 return 0.0;
13306 }
13307
13309 {
13310 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13311 if (
g_Game.ConfigIsExisting(paramPath))
13312 return g_Game.ConfigGetFloat(paramPath);
13313
13314 return 0.0;
13315 }
13316
13317 override void SetWet(
float value,
bool allow_client =
false)
13318 {
13319 if (!IsServerCheck(allow_client))
13320 return;
13321
13324
13326
13327 m_VarWet = Math.Clamp(value, min, max);
13328
13330 {
13333 }
13334 }
13335
13336 override void AddWet(
float value)
13337 {
13339 }
13340
13342 {
13344 }
13345
13347 {
13349 }
13350
13352 {
13354 }
13355
13357 {
13359 }
13360
13362 {
13364 }
13365
13366 override void OnWetChanged(
float newVal,
float oldVal)
13367 {
13370 if (newLevel != oldLevel)
13371 {
13373 }
13374 }
13375
13377 {
13378 SetWeightDirty();
13379 }
13380
13382 {
13383 return GetWetLevelInternal(
m_VarWet);
13384 }
13385
13386
13387
13389 {
13391 }
13392
13394 {
13396 }
13397
13399 {
13401 }
13402
13404 {
13406 }
13407
13408
13409
13411 {
13412 if (ConfigIsExisting("itemModelLength"))
13413 {
13414 return ConfigGetFloat("itemModelLength");
13415 }
13416 return 0;
13417 }
13418
13420 {
13421 if (ConfigIsExisting("itemAttachOffset"))
13422 {
13423 return ConfigGetFloat("itemAttachOffset");
13424 }
13425 return 0;
13426 }
13427
13428 override void SetCleanness(
int value,
bool allow_client =
false)
13429 {
13430 if (!IsServerCheck(allow_client))
13431 return;
13432
13434
13436
13439 }
13440
13442 {
13444 }
13445
13447 {
13448 return true;
13449 }
13450
13451
13452
13453
13455 {
13457 }
13458
13460 {
13462 }
13463
13464
13465
13466
13467 override void SetColor(
int r,
int g,
int b,
int a)
13468 {
13474 }
13476 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13477 {
13482 }
13483
13485 {
13487 }
13488
13491 {
13492 int r,g,b,a;
13494 r = r/255;
13495 g = g/255;
13496 b = b/255;
13497 a = a/255;
13498 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13499 }
13500
13501
13502
13503 override void SetLiquidType(
int value,
bool allow_client =
false)
13504 {
13505 if (!IsServerCheck(allow_client))
13506 return;
13507
13512 }
13513
13515 {
13516 return ConfigGetInt("varLiquidTypeInit");
13517 }
13518
13520 {
13522 }
13523
13525 {
13527 SetFrozen(false);
13528 }
13529
13532 {
13533 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13534 }
13535
13536
13539 {
13540 PlayerBase nplayer;
13541 if (PlayerBase.CastTo(nplayer, player))
13542 {
13544 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13545 }
13546 }
13547
13548
13551 {
13552 PlayerBase nplayer;
13553 if (PlayerBase.CastTo(nplayer,player))
13554 {
13555 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13556 }
13557
13558 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13559
13560 if (HasEnergyManager())
13561 {
13562 GetCompEM().UpdatePlugState();
13563 }
13564 }
13565
13566
13568 {
13569 super.OnPlacementStarted(player);
13570
13572 }
13573
13574 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13575 {
13577 {
13578 m_AdminLog.OnPlacementComplete(player,
this);
13579 }
13580
13581 super.OnPlacementComplete(player, position, orientation);
13582 }
13583
13584
13585
13586
13587
13589 {
13591 {
13592 return true;
13593 }
13594 else
13595 {
13596 return false;
13597 }
13598 }
13599
13600
13602 {
13604 {
13606 }
13607 }
13608
13609
13611 {
13613 }
13614
13616 {
13618 }
13619
13620 override void InsertAgent(
int agent,
float count = 1)
13621 {
13622 if (count < 1)
13623 return;
13624
13626 }
13627
13630 {
13632 }
13633
13634
13636 {
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
13673
13674
13675
13676
13677
13678
13679
13680
13682 {
13684 return false;
13685 return true;
13686 }
13687
13689 {
13690
13692 }
13693
13694
13697 {
13698 super.CheckForRoofLimited(timeTresholdMS);
13699
13700 float time =
g_Game.GetTime();
13701 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13702 {
13703 m_PreviousRoofTestTime = time;
13704 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13705 }
13706 }
13707
13708
13710 {
13712 {
13713 return 0;
13714 }
13715
13716 if (GetInventory().GetAttachmentSlotsCount() != 0)
13717 {
13718 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13719 if (filter)
13720 return filter.GetProtectionLevel(type, false, system);
13721 else
13722 return 0;
13723 }
13724
13725 string subclassPath, entryName;
13726
13727 switch (type)
13728 {
13730 entryName = "biological";
13731 break;
13733 entryName = "chemical";
13734 break;
13735 default:
13736 entryName = "biological";
13737 break;
13738 }
13739
13740 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13741
13742 return g_Game.ConfigGetFloat(subclassPath + entryName);
13743 }
13744
13745
13746
13749 {
13750 if (!IsMagazine())
13752
13754 }
13755
13756
13757
13758
13759
13764 {
13765 return true;
13766 }
13767
13769 {
13771 }
13772
13773
13774
13775
13776
13778 {
13779 if (parent)
13780 {
13781 if (parent.IsInherited(DayZInfected))
13782 return true;
13783
13784 if (!parent.IsRuined())
13785 return true;
13786 }
13787
13788 return true;
13789 }
13790
13792 {
13793 if (!super.CanPutAsAttachment(parent))
13794 {
13795 return false;
13796 }
13797
13798 if (!IsRuined() && !parent.IsRuined())
13799 {
13800 return true;
13801 }
13802
13803 return false;
13804 }
13805
13807 {
13808
13809
13810
13811
13812 return super.CanReceiveItemIntoCargo(item);
13813 }
13814
13816 {
13817
13818
13819
13820
13821 GameInventory attachmentInv = attachment.GetInventory();
13823 {
13824 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13825 return false;
13826 }
13827
13828 InventoryLocation loc = new InventoryLocation();
13829 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13830 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13831 return false;
13832
13833 return super.CanReceiveAttachment(attachment, slotId);
13834 }
13835
13837 {
13838 if (!super.CanReleaseAttachment(attachment))
13839 return false;
13840
13841 return GetInventory().AreChildrenAccessible();
13842 }
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13865 {
13866 int id = muzzle_owner.GetMuzzleID();
13867 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13868
13869 if (WPOF_array)
13870 {
13871 for (int i = 0; i < WPOF_array.Count(); i++)
13872 {
13873 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13874
13875 if (WPOF)
13876 {
13877 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13878 }
13879 }
13880 }
13881 }
13882
13883
13885 {
13886 int id = muzzle_owner.GetMuzzleID();
13888
13889 if (WPOBE_array)
13890 {
13891 for (int i = 0; i < WPOBE_array.Count(); i++)
13892 {
13893 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13894
13895 if (WPOBE)
13896 {
13897 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13898 }
13899 }
13900 }
13901 }
13902
13903
13905 {
13906 int id = muzzle_owner.GetMuzzleID();
13907 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13908
13909 if (WPOOH_array)
13910 {
13911 for (int i = 0; i < WPOOH_array.Count(); i++)
13912 {
13913 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13914
13915 if (WPOOH)
13916 {
13917 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13918 }
13919 }
13920 }
13921 }
13922
13923
13925 {
13926 int id = muzzle_owner.GetMuzzleID();
13927 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13928
13929 if (WPOOH_array)
13930 {
13931 for (int i = 0; i < WPOOH_array.Count(); i++)
13932 {
13933 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13934
13935 if (WPOOH)
13936 {
13937 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13938 }
13939 }
13940 }
13941 }
13942
13943
13945 {
13946 int id = muzzle_owner.GetMuzzleID();
13947 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13948
13949 if (WPOOH_array)
13950 {
13951 for (int i = 0; i < WPOOH_array.Count(); i++)
13952 {
13953 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13954
13955 if (WPOOH)
13956 {
13957 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13958 }
13959 }
13960 }
13961 }
13962
13963
13964
13966 {
13968 {
13969 return true;
13970 }
13971
13972 return false;
13973 }
13974
13976 {
13978 {
13979 return true;
13980 }
13981
13982 return false;
13983 }
13984
13986 {
13988 {
13989 return true;
13990 }
13991
13992 return false;
13993 }
13994
13996 {
13997 return false;
13998 }
13999
14002 {
14003 return UATimeSpent.DEFAULT_DEPLOY;
14004 }
14005
14006
14007
14008
14010 {
14012 SetSynchDirty();
14013 }
14014
14016 {
14018 }
14019
14020
14022 {
14023 return false;
14024 }
14025
14028 {
14029 string att_type = "None";
14030
14031 if (ConfigIsExisting("soundAttType"))
14032 {
14033 att_type = ConfigGetString("soundAttType");
14034 }
14035
14037 }
14038
14040 {
14042 }
14043
14044
14045
14046
14047
14053
14055 {
14058
14060 }
14061
14062
14064 {
14066 return;
14067
14069
14072
14075
14076 SoundParameters params = new SoundParameters();
14080 }
14081
14082
14084 {
14086 {
14089
14090 SetSynchDirty();
14091
14094 }
14095 }
14096
14098 {
14100 }
14101
14102
14104 {
14106 return;
14107
14109 SetSynchDirty();
14110
14113 }
14114
14116 {
14119 }
14120
14122 {
14124 }
14125
14126 void OnApply(PlayerBase player);
14127
14129 {
14130 return 1.0;
14131 };
14132
14134 {
14136 }
14137
14139 {
14141 }
14142
14144
14146 {
14147 SetDynamicPhysicsLifeTime(0.01);
14149 }
14150
14152 {
14153 array<string> zone_names = new array<string>;
14154 GetDamageZones(zone_names);
14155 for (int i = 0; i < zone_names.Count(); i++)
14156 {
14157 SetHealthMax(zone_names.Get(i),"Health");
14158 }
14159 SetHealthMax("","Health");
14160 }
14161
14164 {
14165 float global_health = GetHealth01("","Health");
14166 array<string> zones = new array<string>;
14167 GetDamageZones(zones);
14168
14169 for (int i = 0; i < zones.Count(); i++)
14170 {
14171 SetHealth01(zones.Get(i),"Health",global_health);
14172 }
14173 }
14174
14177 {
14178 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14179 }
14180
14182 {
14183 if (!hasRootAsPlayer)
14184 {
14185 if (refParentIB)
14186 {
14187
14188 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14189 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14190
14191 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14192 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14193
14196 }
14197 else
14198 {
14199
14202 }
14203 }
14204 }
14205
14207 {
14209 {
14210 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14211 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14212 {
14213 float heatPermCoef = 1.0;
14215 while (ent)
14216 {
14217 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14218 ent = ent.GetHierarchyParent();
14219 }
14220
14221 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14222 }
14223 }
14224 }
14225
14227 {
14228
14229 EntityAI parent = GetHierarchyParent();
14230 if (!parent)
14231 {
14232 hasParent = false;
14233 hasRootAsPlayer = false;
14234 }
14235 else
14236 {
14237 hasParent = true;
14238 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14239 refParentIB =
ItemBase.Cast(parent);
14240 }
14241 }
14242
14243 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14244 {
14245
14246 }
14247
14249 {
14250
14251 return false;
14252 }
14253
14255 {
14256
14257
14258 return false;
14259 }
14260
14262 {
14263
14264 return false;
14265 }
14266
14269 {
14270 return !GetIsFrozen() &&
IsOpen();
14271 }
14272
14274 {
14275 bool hasParent = false, hasRootAsPlayer = false;
14277
14278 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14279 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14280
14281 if (wwtu || foodDecay)
14282 {
14286
14287 if (processWetness || processTemperature || processDecay)
14288 {
14290
14291 if (processWetness)
14292 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14293
14294 if (processTemperature)
14296
14297 if (processDecay)
14298 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14299 }
14300 }
14301 }
14302
14305 {
14307 }
14308
14310 {
14313
14314 return super.GetTemperatureFreezeThreshold();
14315 }
14316
14318 {
14321
14322 return super.GetTemperatureThawThreshold();
14323 }
14324
14326 {
14329
14330 return super.GetItemOverheatThreshold();
14331 }
14332
14334 {
14336 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14337
14338 return super.GetTemperatureFreezeTime();
14339 }
14340
14342 {
14344 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14345
14346 return super.GetTemperatureThawTime();
14347 }
14348
14353
14355 {
14356 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14357 }
14358
14360 {
14361 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14362 }
14363
14366 {
14368 }
14369
14371 {
14373 }
14374
14376 {
14378 }
14379
14382 {
14383 return null;
14384 }
14385
14388 {
14389 return false;
14390 }
14391
14393 {
14395 {
14398 if (!trg)
14399 {
14401 explosive = this;
14402 }
14403
14404 explosive.PairRemote(trg);
14406
14407 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14408 trg.SetPersistentPairID(persistentID);
14409 explosive.SetPersistentPairID(persistentID);
14410
14411 return true;
14412 }
14413 return false;
14414 }
14415
14418 {
14419 float ret = 1.0;
14422 ret *= GetHealth01();
14423
14424 return ret;
14425 }
14426
14427 #ifdef DEVELOPER
14428 override void SetDebugItem()
14429 {
14430 super.SetDebugItem();
14431 _itemBase = this;
14432 }
14433
14435 {
14436 string text = super.GetDebugText();
14437
14439 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14440
14441 return text;
14442 }
14443 #endif
14444
14446 {
14447 return true;
14448 }
14449
14451
14453
14455 {
14458 }
14459
14460
14468
14484
14485 [
Obsolete(
"Use ItemSoundHandler instead")]
14488 {
14489 if (!
g_Game.IsDedicatedServer())
14490 {
14491 if (ConfigIsExisting("attachSoundSet"))
14492 {
14493 string cfg_path = "";
14494 string soundset = "";
14495 string type_name =
GetType();
14496
14499 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14500 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14501
14502 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14503 {
14504 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14505 {
14506 if (cfg_slot_array[i] == slot_type)
14507 {
14508 soundset = cfg_soundset_array[i];
14509 break;
14510 }
14511 }
14512 }
14513
14514 if (soundset != "")
14515 {
14516 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14518 }
14519 }
14520 }
14521 }
14522
14524}
14525
14527{
14529 if (entity)
14530 {
14531 bool is_item = entity.IsInherited(
ItemBase);
14532 if (is_item && full_quantity)
14533 {
14536 }
14537 }
14538 else
14539 {
14541 return NULL;
14542 }
14543 return entity;
14544}
14545
14547{
14548 if (item)
14549 {
14550 if (health > 0)
14551 item.SetHealth("", "", health);
14552
14553 if (item.CanHaveTemperature())
14554 {
14556 if (item.CanFreeze())
14557 item.SetFrozen(false);
14558 }
14559
14560 if (item.HasEnergyManager())
14561 {
14562 if (quantity >= 0)
14563 {
14564 item.GetCompEM().SetEnergy0To1(quantity);
14565 }
14566 else
14567 {
14569 }
14570 }
14571 else if (item.IsMagazine())
14572 {
14573 Magazine mag = Magazine.Cast(item);
14574 if (quantity >= 0)
14575 {
14576 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14577 }
14578 else
14579 {
14581 }
14582
14583 }
14584 else
14585 {
14586 if (quantity >= 0)
14587 {
14588 item.SetQuantityNormalized(quantity, false);
14589 }
14590 else
14591 {
14593 }
14594
14595 }
14596 }
14597}
14598
14599#ifdef DEVELOPER
14601#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.