9605{
9607 {
9608 return true;
9609 }
9610};
9611
9613{
9614
9615};
9616
9617
9618
9620{
9624
9626
9629
9630
9631
9632
9633
9642
9648
9653
9658
9679 protected bool m_IsResultOfSplit
9680
9682
9687
9688
9689
9691
9695
9696
9697
9699
9702
9703
9704
9710
9711
9719
9722
9723
9725
9726
9728
9729
9734
9735
9740
9742
9743
9745
9746
9748 {
9753
9754 if (!
g_Game.IsDedicatedServer())
9755 {
9757 {
9759
9761 {
9763 }
9764 }
9765
9768 }
9769
9770 m_OldLocation = null;
9771
9773 {
9775 }
9776
9777 if (ConfigIsExisting("headSelectionsToHide"))
9778 {
9781 }
9782
9784 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9785 {
9787 }
9788
9790
9791 m_IsResultOfSplit = false;
9792
9794 }
9795
9797 {
9798 super.InitItemVariables();
9799
9805 m_Count = ConfigGetInt(
"count");
9806
9809
9814
9817
9822
9834
9838
9839
9842 if (ConfigIsExisting("canBeSplit"))
9843 {
9846 }
9847
9849 if (ConfigIsExisting("itemBehaviour"))
9851
9852
9855 RegisterNetSyncVariableInt("m_VarLiquidType");
9856 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9857
9858 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9859 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9860 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9861
9862 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9863 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9864 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9865 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9866
9867 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9868 RegisterNetSyncVariableBool("m_IsTakeable");
9869 RegisterNetSyncVariableBool("m_IsHologram");
9870
9873 {
9876 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9877 }
9878
9880
9882 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9884
9886 }
9887
9889 {
9891 }
9892
9894 {
9897 {
9902 }
9903 }
9904
9905 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9906 {
9908 {
9911 }
9912
9914 }
9915
9917 {
9923 }
9924
9926
9928 {
9930
9931 if (!action)
9932 {
9933 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9934 return;
9935 }
9936
9938 if (!ai)
9939 {
9941 return;
9942 }
9943
9945 if (!action_array)
9946 {
9947 action_array = new array<ActionBase_Basic>;
9949 }
9950 if (LogManager.IsActionLogEnable())
9951 {
9952 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9953 }
9954
9955 if (action_array.Find(action) != -1)
9956 {
9957 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9958 }
9959 else
9960 {
9961 action_array.Insert(action);
9962 }
9963 }
9964
9966 {
9967 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9968 ActionBase action = player.GetActionManager().GetAction(actionName);
9971
9972 if (action_array)
9973 {
9974 action_array.RemoveItem(action);
9975 }
9976 }
9977
9978
9979
9981 {
9982 ActionOverrideData overrideData = new ActionOverrideData();
9986
9988 if (!actionMap)
9989 {
9992 }
9993
9994 actionMap.Insert(this.
Type(), overrideData);
9995
9996 }
9997
9999
10001
10002
10004 {
10007
10010
10011 string config_to_search = "CfgVehicles";
10012 string muzzle_owner_config;
10013
10015 {
10016 if (IsInherited(Weapon))
10017 config_to_search = "CfgWeapons";
10018
10019 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10020
10021 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10022
10023 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10024
10025 if (config_OnFire_subclass_count > 0)
10026 {
10027 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10028
10029 for (int i = 0; i < config_OnFire_subclass_count; i++)
10030 {
10031 string particle_class = "";
10032 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10033 string config_OnFire_entry = config_OnFire_class + particle_class;
10034 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10035 WPOF_array.Insert(WPOF);
10036 }
10037
10038
10040 }
10041 }
10042
10044 {
10045 config_to_search = "CfgWeapons";
10046 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10047
10048 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10049
10050 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10051
10052 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10053 {
10054 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10055
10056 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10057 {
10058 string particle_class2 = "";
10059 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10060 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10061 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10062 WPOBE_array.Insert(WPOBE);
10063 }
10064
10065
10067 }
10068 }
10069 }
10070
10071
10073 {
10076
10078 {
10079 string config_to_search = "CfgVehicles";
10080
10081 if (IsInherited(Weapon))
10082 config_to_search = "CfgWeapons";
10083
10084 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10085 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10086
10087 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10088 {
10089
10091
10093 {
10095 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10097 return;
10098 }
10099
10102
10103
10104
10105 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10106 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10107
10108 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10109 {
10110 string particle_class = "";
10111 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10112 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10113 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10114
10115 if (entry_type == CT_CLASS)
10116 {
10117 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10118 WPOOH_array.Insert(WPOF);
10119 }
10120 }
10121
10122
10124 }
10125 }
10126 }
10127
10129 {
10131 }
10132
10134 {
10136 {
10138
10141
10144
10145 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10146 }
10147 }
10148
10150 {
10152 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10153
10155 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10156
10158 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10159
10161 {
10163 }
10164 }
10165
10167 {
10169 }
10170
10172 {
10175 else
10177
10179 {
10182 }
10183 else
10184 {
10187
10190 }
10191
10193 }
10194
10196 {
10198 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10199 }
10200
10202 {
10204 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10206 }
10207
10209 {
10211 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10212 }
10213
10215 {
10218
10219 OverheatingParticle OP = new OverheatingParticle();
10224
10226 }
10227
10229 {
10232
10233 return -1;
10234 }
10235
10237 {
10239 {
10242
10243 for (int i = count; i > 0; --i)
10244 {
10245 int id = i - 1;
10248
10251
10252 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10253 {
10254 if (p)
10255 {
10258 }
10259 }
10260 }
10261 }
10262 }
10263
10265 {
10267 {
10269 {
10270 int id = i - 1;
10272
10273 if (OP)
10274 {
10276
10277 if (p)
10278 {
10280 }
10281
10282 delete OP;
10283 }
10284 }
10285
10288 }
10289 }
10290
10293 {
10294 return 0.0;
10295 }
10296
10297
10299 {
10300 return 250;
10301 }
10302
10304 {
10305 return 0;
10306 }
10307
10310 {
10312 return true;
10313
10314 return false;
10315 }
10316
10319 {
10322
10324 {
10326 }
10327 else
10328 {
10329
10331 }
10332
10334 }
10335
10342 {
10343 return -1;
10344 }
10345
10346
10347
10348
10350 {
10352 {
10353 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10354 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10355
10356 if (r_index >= 0)
10357 {
10358 InventoryLocation r_il = new InventoryLocation;
10359 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10360
10361 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10364 {
10365 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10366 }
10368 {
10369 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10370 }
10371
10372 }
10373
10374 player.GetHumanInventory().ClearUserReservedLocation(this);
10375 }
10376
10379 }
10380
10381
10382
10383
10385 {
10386 return ItemBase.m_DebugActionsMask;
10387 }
10388
10390 {
10391 return ItemBase.m_DebugActionsMask & mask;
10392 }
10393
10395 {
10396 ItemBase.m_DebugActionsMask = mask;
10397 }
10398
10400 {
10401 ItemBase.m_DebugActionsMask |= mask;
10402 }
10403
10405 {
10406 ItemBase.m_DebugActionsMask &= ~mask;
10407 }
10408
10410 {
10412 {
10414 }
10415 else
10416 {
10418 }
10419 }
10420
10421
10423 {
10424 if (GetEconomyProfile())
10425 {
10426 float q_max = GetEconomyProfile().GetQuantityMax();
10427 if (q_max > 0)
10428 {
10429 float q_min = GetEconomyProfile().GetQuantityMin();
10430 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10431
10433 {
10434 ComponentEnergyManager comp = GetCompEM();
10436 {
10438 }
10439 }
10441 {
10443
10444 }
10445
10446 }
10447 }
10448 }
10449
10452 {
10453 EntityAI parent = GetHierarchyParent();
10454
10455 if (parent)
10456 {
10457 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10458 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10459 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10460 }
10461 }
10462
10465 {
10466 EntityAI parent = GetHierarchyParent();
10467
10468 if (parent)
10469 {
10470 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10471 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10472 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10473 }
10474 }
10475
10477 {
10478
10479
10480
10481
10483
10485 {
10486 if (ScriptInputUserData.CanStoreInputUserData())
10487 {
10488 ScriptInputUserData ctx = new ScriptInputUserData;
10494 ctx.
Write(use_stack_max);
10497
10499 {
10500 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10501 }
10502 }
10503 }
10504 else if (!
g_Game.IsMultiplayer())
10505 {
10507 }
10508 }
10509
10511 {
10513 }
10514
10516 {
10518 }
10519
10521 {
10523 }
10524
10526 {
10527
10528 return false;
10529 }
10530
10532 {
10533 return false;
10534 }
10535
10539 {
10540 return false;
10541 }
10542
10544 {
10545 return "";
10546 }
10547
10549
10551 {
10552 return false;
10553 }
10554
10556 {
10557 return true;
10558 }
10559
10560
10561
10563 {
10564 return true;
10565 }
10566
10568 {
10569 return true;
10570 }
10571
10573 {
10574 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10576 }
10577
10579 {
10581 }
10582
10584 {
10586 if (!is_being_placed)
10588 SetSynchDirty();
10589 }
10590
10591
10593
10595 {
10597 }
10598
10600 {
10602 }
10603
10605 {
10606 return 1;
10607 }
10608
10610 {
10611 return false;
10612 }
10613
10615 {
10617 SetSynchDirty();
10618 }
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10655 {
10656 super.OnMovedInsideCargo(container);
10657
10658 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10659 }
10660
10661 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10662 {
10663 super.EEItemLocationChanged(oldLoc, newLoc);
10664
10665 PlayerBase newPlayer = null;
10666 PlayerBase oldPlayer = null;
10667
10668 if (newLoc.GetParent())
10669 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10670
10671 if (oldLoc.GetParent())
10672 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10673
10675 {
10676 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10677
10678 if (rIndex >= 0)
10679 {
10680 InventoryLocation rIl = new InventoryLocation;
10681 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10682
10683 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10686 {
10687 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10688 }
10690 {
10692 }
10693
10694 }
10695 }
10696
10698 {
10699 if (newPlayer)
10700 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10701
10702 if (newPlayer == oldPlayer)
10703 {
10704 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10705 {
10707 {
10708 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10709 {
10710 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10711 }
10712 }
10713 else
10714 {
10715 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10716 }
10717 }
10718
10719 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10720 {
10721 int type = oldLoc.GetType();
10723 {
10724 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10725 }
10727 {
10728 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10729 }
10730 }
10731 if (!m_OldLocation)
10732 {
10733 m_OldLocation = new InventoryLocation;
10734 }
10735 m_OldLocation.Copy(oldLoc);
10736 }
10737 else
10738 {
10739 if (m_OldLocation)
10740 {
10741 m_OldLocation.Reset();
10742 }
10743 }
10744
10745 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10746 }
10747 else
10748 {
10749 if (newPlayer)
10750 {
10751 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10752 if (resIndex >= 0)
10753 {
10754 InventoryLocation il = new InventoryLocation;
10755 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10757 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10760 {
10761 il.
GetParent().GetOnReleaseLock().Invoke(it);
10762 }
10764 {
10766 }
10767
10768 }
10769 }
10771 {
10772
10774 }
10775
10776 if (m_OldLocation)
10777 {
10778 m_OldLocation.Reset();
10779 }
10780 }
10781
10783 {
10784 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10785 }
10786
10788 {
10789 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10790 }
10791 }
10792
10793 override void EOnContact(IEntity other, Contact extra)
10794 {
10796 {
10797 int liquidType = -1;
10799 if (impactSpeed > 0.0)
10800 {
10802 #ifndef SERVER
10804 #else
10806 SetSynchDirty();
10807 #endif
10809 }
10810 }
10811
10812 #ifdef SERVER
10813 if (GetCompEM() && GetCompEM().IsPlugged())
10814 {
10815 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10816 GetCompEM().UnplugThis();
10817 }
10818 #endif
10819 }
10820
10822
10824 {
10826 }
10827
10829 {
10830
10831 }
10832
10834 {
10835 super.OnItemLocationChanged(old_owner, new_owner);
10836
10837 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10838 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10839
10840 if (!relatedPlayer && playerNew)
10841 relatedPlayer = playerNew;
10842
10843 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10844 {
10846 if (actionMgr)
10847 {
10848 ActionBase currentAction = actionMgr.GetRunningAction();
10849 if (currentAction)
10851 }
10852 }
10853
10854 Man ownerPlayerOld = null;
10855 Man ownerPlayerNew = null;
10856
10857 if (old_owner)
10858 {
10859 if (old_owner.
IsMan())
10860 {
10861 ownerPlayerOld = Man.Cast(old_owner);
10862 }
10863 else
10864 {
10865 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10866 }
10867 }
10868 else
10869 {
10871 {
10873
10874 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10875 {
10876 GetCompEM().UnplugThis();
10877 }
10878 }
10879 }
10880
10881 if (new_owner)
10882 {
10883 if (new_owner.
IsMan())
10884 {
10885 ownerPlayerNew = Man.Cast(new_owner);
10886 }
10887 else
10888 {
10889 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10890 }
10891 }
10892
10893 if (ownerPlayerOld != ownerPlayerNew)
10894 {
10895 if (ownerPlayerOld)
10896 {
10897 array<EntityAI> subItemsExit = new array<EntityAI>;
10899 for (int i = 0; i < subItemsExit.Count(); i++)
10900 {
10903 }
10904 }
10905
10906 if (ownerPlayerNew)
10907 {
10908 array<EntityAI> subItemsEnter = new array<EntityAI>;
10910 for (int j = 0; j < subItemsEnter.Count(); j++)
10911 {
10914 }
10915 }
10916 }
10917 else if (ownerPlayerNew != null)
10918 {
10919 PlayerBase nplayer;
10920 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10921 {
10922 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10924 for (int k = 0; k < subItemsUpdate.Count(); k++)
10925 {
10927 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10928 }
10929 }
10930 }
10931
10932 if (old_owner)
10933 old_owner.OnChildItemRemoved(this);
10934 if (new_owner)
10935 new_owner.OnChildItemReceived(this);
10936 }
10937
10938
10940 {
10941 super.EEDelete(parent);
10942 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10943 if (player)
10944 {
10946
10947 if (player.IsAlive())
10948 {
10949 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10950 if (r_index >= 0)
10951 {
10952 InventoryLocation r_il = new InventoryLocation;
10953 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10954
10955 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10958 {
10959 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10960 }
10962 {
10963 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10964 }
10965
10966 }
10967
10968 player.RemoveQuickBarEntityShortcut(this);
10969 }
10970 }
10971 }
10972
10974 {
10975 super.EEKilled(killer);
10976
10979 {
10980 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10981 {
10982 if (IsMagazine())
10983 {
10984 if (Magazine.Cast(this).GetAmmoCount() > 0)
10985 {
10987 }
10988 }
10989 else
10990 {
10992 }
10993 }
10994 }
10995 }
10996
10998 {
10999 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11000
11001 super.OnWasAttached(parent, slot_id);
11002
11005
11008 }
11009
11011 {
11012 super.OnWasDetached(parent, slot_id);
11013
11016
11019 }
11020
11022 {
11023 int idx;
11026
11027 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11028 if (inventory_slots.Count() < 1)
11029 {
11030 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11031 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11032 }
11033 else
11034 {
11035 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11036 }
11037
11038 idx = inventory_slots.Find(slot);
11039 if (idx < 0)
11040 return "";
11041
11042 return attach_types.Get(idx);
11043 }
11044
11046 {
11047 int idx = -1;
11048 string slot;
11049
11052
11053 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11054 if (inventory_slots.Count() < 1)
11055 {
11056 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11057 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11058 }
11059 else
11060 {
11061 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11062 if (detach_types.Count() < 1)
11063 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11064 }
11065
11066 for (int i = 0; i < inventory_slots.Count(); i++)
11067 {
11068 slot = inventory_slots.Get(i);
11069 }
11070
11071 if (slot != "")
11072 {
11073 if (detach_types.Count() == 1)
11074 idx = 0;
11075 else
11076 idx = inventory_slots.Find(slot);
11077 }
11078 if (idx < 0)
11079 return "";
11080
11081 return detach_types.Get(idx);
11082 }
11083
11085 {
11086
11088
11089
11090 float min_time = 1;
11091 float max_time = 3;
11092 float delay = Math.RandomFloat(min_time, max_time);
11093
11094 explode_timer.Run(delay, this, "DoAmmoExplosion");
11095 }
11096
11098 {
11099 Magazine magazine = Magazine.Cast(this);
11100 int pop_sounds_count = 6;
11101 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11102
11103
11104 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11105 string sound_name = pop_sounds[ sound_idx ];
11106 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11107
11108
11109 magazine.ServerAddAmmoCount(-1);
11110
11111
11112 float min_temp_to_explode = 100;
11113
11114 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11115 {
11117 }
11118 }
11119
11120
11121 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11122 {
11123 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11124
11125 const int CHANCE_DAMAGE_CARGO = 4;
11126 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11127 const int CHANCE_DAMAGE_NOTHING = 2;
11128
11130 {
11131 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11132 int chances;
11133 int rnd;
11134
11135 if (GetInventory().GetCargo())
11136 {
11137 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11138 rnd = Math.RandomInt(0,chances);
11139
11140 if (rnd < CHANCE_DAMAGE_CARGO)
11141 {
11143 }
11144 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11145 {
11147 }
11148 }
11149 else
11150 {
11151 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11152 rnd = Math.RandomInt(0,chances);
11153
11154 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11155 {
11157 }
11158 }
11159 }
11160 }
11161
11163 {
11164 CargoBase cargo = GetInventory().GetCargo();
11165 if (cargo)
11166 {
11168 if (item_count > 0)
11169 {
11170 int random_pick = Math.RandomInt(0, item_count);
11172 if (!item.IsExplosive())
11173 {
11174 item.AddHealth("","",damage);
11175 return true;
11176 }
11177 }
11178 }
11179 return false;
11180 }
11181
11183 {
11184 GameInventory inventory = GetInventory();
11186 if (attachment_count > 0)
11187 {
11188 int random_pick = Math.RandomInt(0, attachment_count);
11190 if (!attachment.IsExplosive())
11191 {
11192 attachment.AddHealth("","",damage);
11193 return true;
11194 }
11195 }
11196 return false;
11197 }
11198
11200 {
11202 }
11203
11205 {
11207 return GetInventory().CanRemoveEntity();
11208
11209 return false;
11210 }
11211
11213 {
11214
11216 return false;
11217
11218
11220 return false;
11221
11222
11223
11225 if (delta == 0)
11226 return false;
11227
11228
11229 return true;
11230 }
11231
11233 {
11235 {
11236 if (ScriptInputUserData.CanStoreInputUserData())
11237 {
11238 ScriptInputUserData ctx = new ScriptInputUserData;
11243 ctx.
Write(destination_entity);
11245 ctx.
Write(slot_id);
11247 }
11248 }
11249 else if (!
g_Game.IsMultiplayer())
11250 {
11252 }
11253 }
11254
11256 {
11257 float split_quantity_new;
11261 InventoryLocation loc = new InventoryLocation;
11262
11263 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11264 {
11266 split_quantity_new = stack_max;
11267 else
11269
11271 {
11272 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11273 if (new_item)
11274 {
11275 new_item.SetResultOfSplit(true);
11276 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11278 new_item.
SetQuantity(split_quantity_new,
false,
true);
11279 }
11280 }
11281 }
11282 else if (destination_entity && slot_id == -1)
11283 {
11284 if (quantity > stack_max)
11285 split_quantity_new = stack_max;
11286 else
11287 split_quantity_new = quantity;
11288
11290 {
11291 GameInventory destinationInventory = destination_entity.GetInventory();
11293 {
11296 }
11297
11298 if (new_item)
11299 {
11300 new_item.SetResultOfSplit(true);
11301 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11303 new_item.
SetQuantity(split_quantity_new,
false,
true);
11304 }
11305 }
11306 }
11307 else
11308 {
11309 if (stack_max != 0)
11310 {
11312 {
11314 }
11315
11316 if (split_quantity_new == 0)
11317 {
11318 if (!
g_Game.IsMultiplayer())
11319 player.PhysicalPredictiveDropItem(this);
11320 else
11321 player.ServerDropEntity(this);
11322 return;
11323 }
11324
11326 {
11328
11329 if (new_item)
11330 {
11331 new_item.SetResultOfSplit(true);
11332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11335 new_item.PlaceOnSurface();
11336 }
11337 }
11338 }
11339 }
11340 }
11341
11343 {
11344 float split_quantity_new;
11348 InventoryLocation loc = new InventoryLocation;
11349
11350 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11351 {
11353 split_quantity_new = stack_max;
11354 else
11356
11358 {
11359 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11360 if (new_item)
11361 {
11362 new_item.SetResultOfSplit(true);
11363 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11365 new_item.
SetQuantity(split_quantity_new,
false,
true);
11366 }
11367 }
11368 }
11369 else if (destination_entity && slot_id == -1)
11370 {
11371 if (quantity > stack_max)
11372 split_quantity_new = stack_max;
11373 else
11374 split_quantity_new = quantity;
11375
11377 {
11378 GameInventory destinationInventory = destination_entity.GetInventory();
11380 {
11383 }
11384
11385 if (new_item)
11386 {
11387 new_item.SetResultOfSplit(true);
11388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11390 new_item.
SetQuantity(split_quantity_new,
false,
true);
11391 }
11392 }
11393 }
11394 else
11395 {
11396 if (stack_max != 0)
11397 {
11399 {
11401 }
11402
11404 {
11406
11407 if (new_item)
11408 {
11409 new_item.SetResultOfSplit(true);
11410 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11413 new_item.PlaceOnSurface();
11414 }
11415 }
11416 }
11417 }
11418 }
11419
11421 {
11423 {
11424 if (ScriptInputUserData.CanStoreInputUserData())
11425 {
11426 ScriptInputUserData ctx = new ScriptInputUserData;
11431 dst.WriteToContext(ctx);
11433 }
11434 }
11435 else if (!
g_Game.IsMultiplayer())
11436 {
11438 }
11439 }
11440
11442 {
11444 {
11445 if (ScriptInputUserData.CanStoreInputUserData())
11446 {
11447 ScriptInputUserData ctx = new ScriptInputUserData;
11452 ctx.
Write(destination_entity);
11458 }
11459 }
11460 else if (!
g_Game.IsMultiplayer())
11461 {
11463 }
11464 }
11465
11467 {
11469 }
11470
11472 {
11474 float split_quantity_new;
11476 if (dst.IsValid())
11477 {
11478 int slot_id = dst.GetSlot();
11480
11481 if (quantity > stack_max)
11482 split_quantity_new = stack_max;
11483 else
11484 split_quantity_new = quantity;
11485
11487 {
11489
11490 if (new_item)
11491 {
11492 new_item.SetResultOfSplit(true);
11493 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11495 new_item.
SetQuantity(split_quantity_new,
false,
true);
11496 }
11497
11498 return new_item;
11499 }
11500 }
11501
11502 return null;
11503 }
11504
11506 {
11508 float split_quantity_new;
11510 if (destination_entity)
11511 {
11513 if (quantity > stackable)
11514 split_quantity_new = stackable;
11515 else
11516 split_quantity_new = quantity;
11517
11519 {
11520 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11521 if (new_item)
11522 {
11523 new_item.SetResultOfSplit(true);
11524 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11526 new_item.
SetQuantity(split_quantity_new,
false,
true);
11527 }
11528 }
11529 }
11530 }
11531
11533 {
11535 {
11536 if (ScriptInputUserData.CanStoreInputUserData())
11537 {
11538 ScriptInputUserData ctx = new ScriptInputUserData;
11543 ItemBase destination_entity =
this;
11544 ctx.
Write(destination_entity);
11548 }
11549 }
11550 else if (!
g_Game.IsMultiplayer())
11551 {
11553 }
11554 }
11555
11557 {
11559 float split_quantity_new;
11561 if (player)
11562 {
11564 if (quantity > stackable)
11565 split_quantity_new = stackable;
11566 else
11567 split_quantity_new = quantity;
11568
11570 {
11571 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11572 new_item =
ItemBase.Cast(in_hands);
11573 if (new_item)
11574 {
11575 new_item.SetResultOfSplit(true);
11576 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11578 new_item.SetQuantity(split_quantity_new, false, true);
11579 }
11580 }
11581 }
11582 }
11583
11585 {
11587 float split_quantity_new = Math.Floor(quantity * 0.5);
11588
11590 return;
11591
11593
11594 if (new_item)
11595 {
11596 if (new_item.GetQuantityMax() < split_quantity_new)
11597 {
11598 split_quantity_new = new_item.GetQuantityMax();
11599 }
11600
11601 new_item.SetResultOfSplit(true);
11602 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11603
11605 {
11608 }
11609 else
11610 {
11612 new_item.
SetQuantity(split_quantity_new,
false,
true);
11613 }
11614 }
11615 }
11616
11618 {
11620 float split_quantity_new = Math.Floor(quantity / 2);
11621
11623 return;
11624
11625 InventoryLocation invloc = new InventoryLocation;
11627
11629 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11630
11631 if (new_item)
11632 {
11633 if (new_item.GetQuantityMax() < split_quantity_new)
11634 {
11635 split_quantity_new = new_item.GetQuantityMax();
11636 }
11638 {
11641 }
11642 else if (split_quantity_new > 1)
11643 {
11645 new_item.
SetQuantity(split_quantity_new,
false,
true);
11646 }
11647 }
11648 }
11649
11652 {
11653 SetWeightDirty();
11655
11656 if (parent)
11657 parent.OnAttachmentQuantityChangedEx(this, delta);
11658
11660 {
11662 {
11664 }
11666 {
11667 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11669 }
11670 }
11671 }
11672
11675 {
11676
11677 }
11678
11681 {
11683 }
11684
11686 {
11687 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11688
11690 {
11691 if (newLevel == GameConstants.STATE_RUINED)
11692 {
11694 EntityAI parent = GetHierarchyParent();
11695 if (parent && parent.IsFireplace())
11696 {
11697 CargoBase cargo = GetInventory().GetCargo();
11698 if (cargo)
11699 {
11701 {
11703 }
11704 }
11705 }
11706 }
11707
11709 {
11710
11712 return;
11713 }
11714
11715 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11716 {
11718 }
11719 }
11720 }
11721
11722
11724 {
11725 super.OnRightClick();
11726
11728 {
11730 {
11731 if (ScriptInputUserData.CanStoreInputUserData())
11732 {
11733 EntityAI root = GetHierarchyRoot();
11734 Man playerOwner = GetHierarchyRootPlayer();
11735 InventoryLocation dst = new InventoryLocation;
11736
11737
11738 if (!playerOwner && root && root == this)
11739 {
11741 }
11742 else
11743 {
11744
11745 GetInventory().GetCurrentInventoryLocation(dst);
11747 {
11748 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11750 {
11752 }
11753 else
11754 {
11756
11757
11758 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11759 {
11761 }
11762 else
11763 {
11764 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11765 }
11766 }
11767 }
11768 }
11769
11770 ScriptInputUserData ctx = new ScriptInputUserData;
11778 }
11779 }
11780 else if (!
g_Game.IsMultiplayer())
11781 {
11783 }
11784 }
11785 }
11786
11788 {
11789 if (root)
11790 {
11791 vector m4[4];
11792 root.GetTransform(m4);
11793 dst.SetGround(this, m4);
11794 }
11795 else
11796 {
11797 GetInventory().GetCurrentInventoryLocation(dst);
11798 }
11799 }
11800
11801 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11802 {
11803
11804 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11805 return false;
11806
11807 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11808 return false;
11809
11810
11812 return false;
11813
11814
11815 Magazine mag = Magazine.Cast(this);
11816 if (mag)
11817 {
11818 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11819 return false;
11820
11821 if (stack_max_limit)
11822 {
11823 Magazine other_mag = Magazine.Cast(other_item);
11824 if (other_item)
11825 {
11826 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11827 return false;
11828 }
11829
11830 }
11831 }
11832 else
11833 {
11834
11836 return false;
11837
11839 return false;
11840 }
11841
11842 PlayerBase player = null;
11843 if (CastTo(player, GetHierarchyRootPlayer()))
11844 {
11845 if (player.GetInventory().HasAttachment(this))
11846 return false;
11847
11848 if (player.IsItemsToDelete())
11849 return false;
11850 }
11851
11852 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11853 return false;
11854
11855 int slotID;
11857 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11858 return false;
11859
11860 return true;
11861 }
11862
11864 {
11866 }
11867
11869 {
11870 return m_IsResultOfSplit;
11871 }
11872
11874 {
11875 m_IsResultOfSplit = value;
11876 }
11877
11879 {
11881 }
11882
11884 {
11885 float other_item_quantity = other_item.GetQuantity();
11886 float this_free_space;
11887
11889
11891
11892 if (other_item_quantity > this_free_space)
11893 {
11894 return this_free_space;
11895 }
11896 else
11897 {
11898 return other_item_quantity;
11899 }
11900 }
11901
11903 {
11905 }
11906
11908 {
11910 return;
11911
11912 if (!IsMagazine() && other_item)
11913 {
11915 if (quantity_used != 0)
11916 {
11917 float hp1 = GetHealth01("","");
11918 float hp2 = other_item.GetHealth01("","");
11919 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11920 hpResult = hpResult / (
GetQuantity() + quantity_used);
11921
11922 hpResult *= GetMaxHealth();
11923 Math.Round(hpResult);
11924 SetHealth("", "Health", hpResult);
11925
11927 other_item.AddQuantity(-quantity_used);
11928 }
11929 }
11931 }
11932
11934 {
11935 #ifdef SERVER
11936 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11937 GetHierarchyParent().IncreaseLifetimeUp();
11938 #endif
11939 };
11940
11942 {
11943 PlayerBase p = PlayerBase.Cast(player);
11944
11945 array<int> recipesIds = p.m_Recipes;
11946 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11947 if (moduleRecipesManager)
11948 {
11949 EntityAI itemInHands = player.GetEntityInHands();
11950 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11951 }
11952
11953 for (int i = 0;i < recipesIds.Count(); i++)
11954 {
11955 int key = recipesIds.Get(i);
11956 string recipeName = moduleRecipesManager.GetRecipeName(key);
11958 }
11959 }
11960
11961
11962 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11963 {
11964 super.GetDebugActions(outputList);
11965
11966
11972
11973
11978
11983
11984
11988
11989
11991 {
11995 }
11996
11999
12000
12004
12006
12007 InventoryLocation loc = new InventoryLocation();
12008 GetInventory().GetCurrentInventoryLocation(loc);
12010 {
12011 if (Gizmo_IsSupported())
12014 }
12015
12017 }
12018
12019
12020
12021
12023 {
12024 super.OnAction(action_id, player, ctx);
12025
12027 {
12028 switch (action_id)
12029 {
12033 return true;
12037 return true;
12038 }
12039 }
12040
12042 {
12043 switch (action_id)
12044 {
12046 Delete();
12047 return true;
12048 }
12049 }
12050
12051 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12052 {
12053 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12054 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12055 PlayerBase p = PlayerBase.Cast(player);
12056 if (
EActions.RECIPES_RANGE_START < 1000)
12057 {
12058 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12059 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12060 }
12061 }
12062 #ifndef SERVER
12063 else if (action_id ==
EActions.WATCH_PLAYER)
12064 {
12065 PluginDeveloper.SetDeveloperItemClientEx(player);
12066 }
12067 #endif
12069 {
12070 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12071 {
12072 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12073 OnDebugButtonPressServer(id + 1);
12074 }
12075
12076 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12077 {
12078 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12080 }
12081
12082 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12083 {
12084 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12086 }
12087
12088 else if (action_id ==
EActions.ADD_QUANTITY)
12089 {
12090 if (IsMagazine())
12091 {
12092 Magazine mag = Magazine.Cast(this);
12093 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12094 }
12095 else
12096 {
12098 }
12099
12100 if (m_EM)
12101 {
12102 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12103 }
12104
12105 }
12106
12107 else if (action_id ==
EActions.REMOVE_QUANTITY)
12108 {
12109 if (IsMagazine())
12110 {
12111 Magazine mag2 = Magazine.Cast(this);
12112 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12113 }
12114 else
12115 {
12117 }
12118 if (m_EM)
12119 {
12120 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12121 }
12122
12123 }
12124
12125 else if (action_id ==
EActions.SET_QUANTITY_0)
12126 {
12128
12129 if (m_EM)
12130 {
12131 m_EM.SetEnergy(0);
12132 }
12133 }
12134
12135 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12136 {
12138
12139 if (m_EM)
12140 {
12141 m_EM.SetEnergy(m_EM.GetEnergyMax());
12142 }
12143 }
12144
12145 else if (action_id ==
EActions.ADD_HEALTH)
12146 {
12147 AddHealth("","",GetMaxHealth("","Health")/5);
12148 }
12149 else if (action_id ==
EActions.REMOVE_HEALTH)
12150 {
12151 AddHealth("","",-GetMaxHealth("","Health")/5);
12152 }
12153 else if (action_id ==
EActions.DESTROY_HEALTH)
12154 {
12155 SetHealth01("","",0);
12156 }
12157 else if (action_id ==
EActions.WATCH_ITEM)
12158 {
12160 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12161 #ifdef DEVELOPER
12162 SetDebugDeveloper_item(this);
12163 #endif
12164 }
12165
12166 else if (action_id ==
EActions.ADD_TEMPERATURE)
12167 {
12168 AddTemperature(20);
12169
12170 }
12171
12172 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12173 {
12174 AddTemperature(-20);
12175
12176 }
12177
12178 else if (action_id ==
EActions.FLIP_FROZEN)
12179 {
12180 SetFrozen(!GetIsFrozen());
12181
12182 }
12183
12184 else if (action_id ==
EActions.ADD_WETNESS)
12185 {
12187
12188 }
12189
12190 else if (action_id ==
EActions.REMOVE_WETNESS)
12191 {
12193
12194 }
12195
12196 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12197 {
12200
12201
12202 }
12203
12204 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12205 {
12208 }
12209
12210 else if (action_id ==
EActions.MAKE_SPECIAL)
12211 {
12212 auto debugParams = DebugSpawnParams.WithPlayer(player);
12213 OnDebugSpawnEx(debugParams);
12214 }
12215
12216 }
12217
12218
12219 return false;
12220 }
12221
12222
12223
12224
12228
12231
12232
12233
12235 {
12236 return false;
12237 }
12238
12239
12241 {
12242 return true;
12243 }
12244
12245
12247 {
12248 return true;
12249 }
12250
12251
12252
12254 {
12255 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12256 return g_Game.ConfigIsExisting(config_path);
12257 }
12258
12261 {
12262 return null;
12263 }
12264
12266 {
12267 return false;
12268 }
12269
12271 {
12272 return false;
12273 }
12274
12278
12279
12281 {
12282 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12283 return module_repairing.CanRepair(this, item_repair_kit);
12284 }
12285
12286
12287 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12288 {
12289 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12290 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12291 }
12292
12293
12295 {
12296
12297
12298
12299
12300
12301
12302
12303
12304 return 1;
12305 }
12306
12307
12308
12310 {
12312 }
12313
12314
12315
12317 {
12319 }
12320
12321
12330 {
12331 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12332
12333 if (player)
12334 {
12335 player.MessageStatus(text);
12336 }
12337 }
12338
12339
12348 {
12349 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12350
12351 if (player)
12352 {
12353 player.MessageAction(text);
12354 }
12355 }
12356
12357
12366 {
12367 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12368
12369 if (player)
12370 {
12371 player.MessageFriendly(text);
12372 }
12373 }
12374
12375
12384 {
12385 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12386
12387 if (player)
12388 {
12389 player.MessageImportant(text);
12390 }
12391 }
12392
12394 {
12395 return true;
12396 }
12397
12398
12399 override bool KindOf(
string tag)
12400 {
12401 bool found = false;
12402 string item_name = this.
GetType();
12404 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12405
12406 int array_size = item_tag_array.Count();
12407 for (int i = 0; i < array_size; i++)
12408 {
12409 if (item_tag_array.Get(i) == tag)
12410 {
12411 found = true;
12412 break;
12413 }
12414 }
12415 return found;
12416 }
12417
12418
12420 {
12421
12422 super.OnRPC(sender, rpc_type,ctx);
12423
12424
12425 switch (rpc_type)
12426 {
12427 #ifndef SERVER
12428 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12429 Param2<bool, string> p = new Param2<bool, string>(false, "");
12430
12432 return;
12433
12434 bool play = p.param1;
12435 string soundSet = p.param2;
12436
12437 if (play)
12438 {
12440 {
12442 {
12444 }
12445 }
12446 else
12447 {
12449 }
12450 }
12451 else
12452 {
12454 }
12455
12456 break;
12457 #endif
12458
12459 }
12460
12462 {
12464 }
12465 }
12466
12467
12468
12469
12471 {
12472 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12473 return plugin.GetID(
name);
12474 }
12475
12477 {
12478 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12479 return plugin.GetName(id);
12480 }
12481
12484 {
12485
12486
12487 int varFlags;
12488 if (!ctx.
Read(varFlags))
12489 return;
12490
12491 if (varFlags & ItemVariableFlags.FLOAT)
12492 {
12494 }
12495 }
12496
12498 {
12499
12500 super.SerializeNumericalVars(floats_out);
12501
12502
12503
12505 {
12507 }
12508
12510 {
12512 }
12513
12515 {
12517 }
12518
12520 {
12525 }
12526
12528 {
12530 }
12531 }
12532
12534 {
12535
12536 super.DeSerializeNumericalVars(floats);
12537
12538
12539 int index = 0;
12540 int mask = Math.Round(floats.Get(index));
12541
12542 index++;
12543
12545 {
12547 {
12549 }
12550 else
12551 {
12552 float quantity = floats.Get(index);
12553 SetQuantity(quantity,
true,
false,
false,
false);
12554 }
12555 index++;
12556 }
12557
12559 {
12560 float wet = floats.Get(index);
12562 index++;
12563 }
12564
12566 {
12567 int liquidtype = Math.Round(floats.Get(index));
12569 index++;
12570 }
12571
12573 {
12575 index++;
12577 index++;
12579 index++;
12581 index++;
12582 }
12583
12585 {
12586 int cleanness = Math.Round(floats.Get(index));
12588 index++;
12589 }
12590 }
12591
12593 {
12594 super.WriteVarsToCTX(ctx);
12595
12596
12598 {
12600 }
12601
12603 {
12605 }
12606
12608 {
12610 }
12611
12613 {
12614 int r,g,b,a;
12620 }
12621
12623 {
12625 }
12626 }
12627
12629 {
12630 if (!super.ReadVarsFromCTX(ctx,version))
12631 return false;
12632
12633 int intValue;
12634 float value;
12635
12636 if (version < 140)
12637 {
12638 if (!ctx.
Read(intValue))
12639 return false;
12640
12641 m_VariablesMask = intValue;
12642 }
12643
12645 {
12646 if (!ctx.
Read(value))
12647 return false;
12648
12650 {
12652 }
12653 else
12654 {
12656 }
12657 }
12658
12659 if (version < 140)
12660 {
12662 {
12663 if (!ctx.
Read(value))
12664 return false;
12665 SetTemperatureDirect(value);
12666 }
12667 }
12668
12670 {
12671 if (!ctx.
Read(value))
12672 return false;
12674 }
12675
12677 {
12678 if (!ctx.
Read(intValue))
12679 return false;
12681 }
12682
12684 {
12685 int r,g,b,a;
12687 return false;
12689 return false;
12691 return false;
12693 return false;
12694
12696 }
12697
12699 {
12700 if (!ctx.
Read(intValue))
12701 return false;
12703 }
12704
12705 if (version >= 138 && version < 140)
12706 {
12708 {
12709 if (!ctx.
Read(intValue))
12710 return false;
12711 SetFrozen(intValue);
12712 }
12713 }
12714
12715 return true;
12716 }
12717
12718
12720 {
12723 {
12725 }
12726
12727 if (!super.OnStoreLoad(ctx, version))
12728 {
12730 return false;
12731 }
12732
12733 if (version >= 114)
12734 {
12735 bool hasQuickBarIndexSaved;
12736
12737 if (!ctx.
Read(hasQuickBarIndexSaved))
12738 {
12740 return false;
12741 }
12742
12743 if (hasQuickBarIndexSaved)
12744 {
12745 int itmQBIndex;
12746
12747
12748 if (!ctx.
Read(itmQBIndex))
12749 {
12751 return false;
12752 }
12753
12754 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12755 if (itmQBIndex != -1 && parentPlayer)
12756 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12757 }
12758 }
12759 else
12760 {
12761
12762 PlayerBase player;
12763 int itemQBIndex;
12764 if (version ==
int.
MAX)
12765 {
12766 if (!ctx.
Read(itemQBIndex))
12767 {
12769 return false;
12770 }
12771 }
12772 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12773 {
12774
12775 if (!ctx.
Read(itemQBIndex))
12776 {
12778 return false;
12779 }
12780 if (itemQBIndex != -1 && player)
12781 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12782 }
12783 }
12784
12785 if (version < 140)
12786 {
12787
12788 if (!LoadVariables(ctx, version))
12789 {
12791 return false;
12792 }
12793 }
12794
12795
12797 {
12799 return false;
12800 }
12801 if (version >= 132)
12802 {
12804 if (raib)
12805 {
12807 {
12809 return false;
12810 }
12811 }
12812 }
12813
12815 return true;
12816 }
12817
12818
12819
12821 {
12822 super.OnStoreSave(ctx);
12823
12824 PlayerBase player;
12825 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12826 {
12828
12829 int itemQBIndex = -1;
12830 itemQBIndex = player.FindQuickBarEntityIndex(this);
12831 ctx.
Write(itemQBIndex);
12832 }
12833 else
12834 {
12836 }
12837
12839
12841 if (raib)
12842 {
12844 }
12845 }
12846
12847
12849 {
12850 super.AfterStoreLoad();
12851
12853 {
12855 }
12856
12858 {
12861 }
12862 }
12863
12865 {
12866 super.EEOnAfterLoad();
12867
12869 {
12871 }
12872
12875 }
12876
12878 {
12879 return false;
12880 }
12881
12882
12883
12885 {
12887 {
12888 #ifdef PLATFORM_CONSOLE
12889
12891 {
12893 if (menu)
12894 {
12896 }
12897 }
12898 #endif
12899 }
12900
12902 {
12905 }
12906
12908 {
12909 SetWeightDirty();
12911 }
12913 {
12916 }
12917
12919 {
12922
12925 }
12927 {
12931 }
12932
12933 super.OnVariablesSynchronized();
12934 }
12935
12936
12937
12939 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12940 {
12941 if (!IsServerCheck(allow_client))
12942 return false;
12943
12945 return false;
12946
12949
12950 if (value <= (min + 0.001))
12951 value = min;
12952
12953 if (value == min)
12954 {
12955 if (destroy_config)
12956 {
12957 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12958 if (dstr)
12959 {
12961 this.Delete();
12962 return true;
12963 }
12964 }
12965 else if (destroy_forced)
12966 {
12968 this.Delete();
12969 return true;
12970 }
12971
12973 }
12974
12977
12979 {
12980 EntityAI parent = GetHierarchyRoot();
12981 InventoryLocation iLoc = new InventoryLocation();
12982 GetInventory().GetCurrentInventoryLocation(iLoc);
12984 {
12985 int iLocSlot = iLoc.
GetSlot();
12987 {
12989 }
12991 {
12993 }
12994 }
12995 }
12996
12998 {
13000
13001 if (delta)
13003 }
13004
13006
13007 return false;
13008 }
13009
13010
13012 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13013 {
13015 }
13016
13018 {
13021 }
13022
13024 {
13027 }
13028
13030 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13031 {
13032 float value_clamped = Math.Clamp(value, 0, 1);
13034 SetQuantity(result, destroy_config, destroy_forced);
13035 }
13036
13037
13040 {
13042 }
13043
13045 {
13047 }
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13059 {
13060 int slot = -1;
13061 GameInventory inventory = GetInventory();
13062 if (inventory)
13063 {
13064 InventoryLocation il = new InventoryLocation;
13067 }
13068
13070 }
13071
13073 {
13074 float quantity_max = 0;
13075
13077 {
13078 if (attSlotID != -1)
13079 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13080
13081 if (quantity_max <= 0)
13083 }
13084
13085 if (quantity_max <= 0)
13087
13088 return quantity_max;
13089 }
13090
13092 {
13094 }
13095
13097 {
13099 }
13100
13101
13103 {
13105 }
13106
13108 {
13110 }
13111
13113 {
13115 }
13116
13117
13119 {
13120
13121 float weightEx = GetWeightEx();
13122 float special = GetInventoryAndCargoWeight();
13123 return weightEx - special;
13124 }
13125
13126
13128 {
13130 }
13131
13133 {
13135 {
13136 #ifdef DEVELOPER
13137 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13138 {
13139 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13141 }
13142 #endif
13143
13144 return GetQuantity() * GetConfigWeightModified();
13145 }
13146 else if (HasEnergyManager())
13147 {
13148 #ifdef DEVELOPER
13149 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13150 {
13151 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13152 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13153 }
13154 #endif
13155 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13156 }
13157 else
13158 {
13159 #ifdef DEVELOPER
13160 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13161 {
13162 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13163 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13164 }
13165 #endif
13166 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13167 }
13168 }
13169
13172 {
13173 int item_count = 0;
13175
13176 GameInventory inventory = GetInventory();
13177 CargoBase cargo = inventory.
GetCargo();
13178 if (cargo != NULL)
13179 {
13181 }
13182
13184 for (int i = 0; i < nAttachments; ++i)
13185 {
13187 if (item)
13188 item_count += item.GetNumberOfItems();
13189 }
13190 return item_count;
13191 }
13192
13195 {
13196 float weight = 0;
13197 float wetness = 1;
13198 if (include_wetness)
13201 {
13202 weight = wetness * m_ConfigWeight;
13203 }
13205 {
13206 weight = 1;
13207 }
13208 return weight;
13209 }
13210
13211
13212
13214 {
13215 GameInventory inventory = GetInventory();
13216 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13217 {
13218 array<EntityAI> items = new array<EntityAI>;
13220 for (int i = 0; i < items.Count(); ++i)
13221 {
13223 if (item)
13224 {
13225 g_Game.ObjectDelete(item);
13226 }
13227 }
13228 }
13229 }
13230
13231
13232
13233
13235 {
13236 float energy = 0;
13237 if (HasEnergyManager())
13238 {
13239 energy = GetCompEM().GetEnergy();
13240 }
13241 return energy;
13242 }
13243
13244
13246 {
13247 super.OnEnergyConsumed();
13248
13250 }
13251
13253 {
13254 super.OnEnergyAdded();
13255
13257 }
13258
13259
13261 {
13262 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13263 {
13265 {
13266 float energy_0to1 = GetCompEM().GetEnergy0To1();
13268 }
13269 }
13270 }
13271
13272
13274 {
13275 return ConfigGetFloat("heatIsolation");
13276 }
13277
13279 {
13281 }
13282
13284 {
13285 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13286 if (
g_Game.ConfigIsExisting(paramPath))
13287 return g_Game.ConfigGetFloat(paramPath);
13288
13289 return 0.0;
13290 }
13291
13293 {
13294 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13295 if (
g_Game.ConfigIsExisting(paramPath))
13296 return g_Game.ConfigGetFloat(paramPath);
13297
13298 return 0.0;
13299 }
13300
13301 override void SetWet(
float value,
bool allow_client =
false)
13302 {
13303 if (!IsServerCheck(allow_client))
13304 return;
13305
13308
13310
13311 m_VarWet = Math.Clamp(value, min, max);
13312
13314 {
13317 }
13318 }
13319
13320 override void AddWet(
float value)
13321 {
13323 }
13324
13326 {
13328 }
13329
13331 {
13333 }
13334
13336 {
13338 }
13339
13341 {
13343 }
13344
13346 {
13348 }
13349
13350 override void OnWetChanged(
float newVal,
float oldVal)
13351 {
13354 if (newLevel != oldLevel)
13355 {
13357 }
13358 }
13359
13361 {
13362 SetWeightDirty();
13363 }
13364
13366 {
13367 return GetWetLevelInternal(
m_VarWet);
13368 }
13369
13370
13371
13373 {
13375 }
13376
13378 {
13380 }
13381
13383 {
13385 }
13386
13388 {
13390 }
13391
13392
13393
13395 {
13396 if (ConfigIsExisting("itemModelLength"))
13397 {
13398 return ConfigGetFloat("itemModelLength");
13399 }
13400 return 0;
13401 }
13402
13404 {
13405 if (ConfigIsExisting("itemAttachOffset"))
13406 {
13407 return ConfigGetFloat("itemAttachOffset");
13408 }
13409 return 0;
13410 }
13411
13412 override void SetCleanness(
int value,
bool allow_client =
false)
13413 {
13414 if (!IsServerCheck(allow_client))
13415 return;
13416
13418
13420
13423 }
13424
13426 {
13428 }
13429
13431 {
13432 return true;
13433 }
13434
13435
13436
13437
13439 {
13441 }
13442
13444 {
13446 }
13447
13448
13449
13450
13451 override void SetColor(
int r,
int g,
int b,
int a)
13452 {
13458 }
13460 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13461 {
13466 }
13467
13469 {
13471 }
13472
13475 {
13476 int r,g,b,a;
13478 r = r/255;
13479 g = g/255;
13480 b = b/255;
13481 a = a/255;
13482 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13483 }
13484
13485
13486
13487 override void SetLiquidType(
int value,
bool allow_client =
false)
13488 {
13489 if (!IsServerCheck(allow_client))
13490 return;
13491
13496 }
13497
13499 {
13500 return ConfigGetInt("varLiquidTypeInit");
13501 }
13502
13504 {
13506 }
13507
13509 {
13511 SetFrozen(false);
13512 }
13513
13516 {
13517 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13518 }
13519
13520
13523 {
13524 PlayerBase nplayer;
13525 if (PlayerBase.CastTo(nplayer, player))
13526 {
13528 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13529 }
13530 }
13531
13532
13535 {
13536 PlayerBase nplayer;
13537 if (PlayerBase.CastTo(nplayer,player))
13538 {
13539 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13540 }
13541
13542 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13543
13544 if (HasEnergyManager())
13545 {
13546 GetCompEM().UpdatePlugState();
13547 }
13548 }
13549
13550
13552 {
13553 super.OnPlacementStarted(player);
13554
13556 }
13557
13558 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13559 {
13561 {
13562 m_AdminLog.OnPlacementComplete(player,
this);
13563 }
13564
13565 super.OnPlacementComplete(player, position, orientation);
13566 }
13567
13568
13569
13570
13571
13573 {
13575 {
13576 return true;
13577 }
13578 else
13579 {
13580 return false;
13581 }
13582 }
13583
13584
13586 {
13588 {
13590 }
13591 }
13592
13593
13595 {
13597 }
13598
13600 {
13602 }
13603
13604 override void InsertAgent(
int agent,
float count = 1)
13605 {
13606 if (count < 1)
13607 return;
13608
13610 }
13611
13614 {
13616 }
13617
13618
13620 {
13622 }
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13666 {
13668 return false;
13669 return true;
13670 }
13671
13673 {
13674
13676 }
13677
13678
13681 {
13682 super.CheckForRoofLimited(timeTresholdMS);
13683
13684 float time =
g_Game.GetTime();
13685 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13686 {
13687 m_PreviousRoofTestTime = time;
13688 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13689 }
13690 }
13691
13692
13694 {
13696 {
13697 return 0;
13698 }
13699
13700 if (GetInventory().GetAttachmentSlotsCount() != 0)
13701 {
13702 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13703 if (filter)
13704 return filter.GetProtectionLevel(type, false, system);
13705 else
13706 return 0;
13707 }
13708
13709 string subclassPath, entryName;
13710
13711 switch (type)
13712 {
13714 entryName = "biological";
13715 break;
13717 entryName = "chemical";
13718 break;
13719 default:
13720 entryName = "biological";
13721 break;
13722 }
13723
13724 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13725
13726 return g_Game.ConfigGetFloat(subclassPath + entryName);
13727 }
13728
13729
13730
13733 {
13734 if (!IsMagazine())
13736
13738 }
13739
13740
13741
13742
13743
13748 {
13749 return true;
13750 }
13751
13753 {
13755 }
13756
13757
13758
13759
13760
13762 {
13763 if (parent)
13764 {
13765 if (parent.IsInherited(DayZInfected))
13766 return true;
13767
13768 if (!parent.IsRuined())
13769 return true;
13770 }
13771
13772 return true;
13773 }
13774
13776 {
13777 if (!super.CanPutAsAttachment(parent))
13778 {
13779 return false;
13780 }
13781
13782 if (!IsRuined() && !parent.IsRuined())
13783 {
13784 return true;
13785 }
13786
13787 return false;
13788 }
13789
13791 {
13792
13793
13794
13795
13796 return super.CanReceiveItemIntoCargo(item);
13797 }
13798
13800 {
13801
13802
13803
13804
13805 GameInventory attachmentInv = attachment.GetInventory();
13807 {
13808 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13809 return false;
13810 }
13811
13812 InventoryLocation loc = new InventoryLocation();
13813 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13814 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13815 return false;
13816
13817 return super.CanReceiveAttachment(attachment, slotId);
13818 }
13819
13821 {
13822 if (!super.CanReleaseAttachment(attachment))
13823 return false;
13824
13825 return GetInventory().AreChildrenAccessible();
13826 }
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13849 {
13850 int id = muzzle_owner.GetMuzzleID();
13851 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13852
13853 if (WPOF_array)
13854 {
13855 for (int i = 0; i < WPOF_array.Count(); i++)
13856 {
13857 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13858
13859 if (WPOF)
13860 {
13861 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13862 }
13863 }
13864 }
13865 }
13866
13867
13869 {
13870 int id = muzzle_owner.GetMuzzleID();
13872
13873 if (WPOBE_array)
13874 {
13875 for (int i = 0; i < WPOBE_array.Count(); i++)
13876 {
13877 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13878
13879 if (WPOBE)
13880 {
13881 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13882 }
13883 }
13884 }
13885 }
13886
13887
13889 {
13890 int id = muzzle_owner.GetMuzzleID();
13891 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13892
13893 if (WPOOH_array)
13894 {
13895 for (int i = 0; i < WPOOH_array.Count(); i++)
13896 {
13897 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13898
13899 if (WPOOH)
13900 {
13901 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13902 }
13903 }
13904 }
13905 }
13906
13907
13909 {
13910 int id = muzzle_owner.GetMuzzleID();
13911 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13912
13913 if (WPOOH_array)
13914 {
13915 for (int i = 0; i < WPOOH_array.Count(); i++)
13916 {
13917 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13918
13919 if (WPOOH)
13920 {
13921 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13922 }
13923 }
13924 }
13925 }
13926
13927
13929 {
13930 int id = muzzle_owner.GetMuzzleID();
13931 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13932
13933 if (WPOOH_array)
13934 {
13935 for (int i = 0; i < WPOOH_array.Count(); i++)
13936 {
13937 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13938
13939 if (WPOOH)
13940 {
13941 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13942 }
13943 }
13944 }
13945 }
13946
13947
13948
13950 {
13952 {
13953 return true;
13954 }
13955
13956 return false;
13957 }
13958
13960 {
13962 {
13963 return true;
13964 }
13965
13966 return false;
13967 }
13968
13970 {
13972 {
13973 return true;
13974 }
13975
13976 return false;
13977 }
13978
13980 {
13981 return false;
13982 }
13983
13986 {
13987 return UATimeSpent.DEFAULT_DEPLOY;
13988 }
13989
13990
13991
13992
13994 {
13996 SetSynchDirty();
13997 }
13998
14000 {
14002 }
14003
14004
14006 {
14007 return false;
14008 }
14009
14012 {
14013 string att_type = "None";
14014
14015 if (ConfigIsExisting("soundAttType"))
14016 {
14017 att_type = ConfigGetString("soundAttType");
14018 }
14019
14021 }
14022
14024 {
14026 }
14027
14028
14029
14030
14031
14037
14039 {
14042
14044 }
14045
14046
14048 {
14050 return;
14051
14053
14056
14059
14060 SoundParameters params = new SoundParameters();
14064 }
14065
14066
14068 {
14070 {
14073
14074 SetSynchDirty();
14075
14078 }
14079 }
14080
14082 {
14084 }
14085
14086
14088 {
14090 return;
14091
14093 SetSynchDirty();
14094
14097 }
14098
14100 {
14103 }
14104
14106 {
14108 }
14109
14110 void OnApply(PlayerBase player);
14111
14113 {
14114 return 1.0;
14115 };
14116
14118 {
14120 }
14121
14123 {
14125 }
14126
14128
14130 {
14131 SetDynamicPhysicsLifeTime(0.01);
14133 }
14134
14136 {
14137 array<string> zone_names = new array<string>;
14138 GetDamageZones(zone_names);
14139 for (int i = 0; i < zone_names.Count(); i++)
14140 {
14141 SetHealthMax(zone_names.Get(i),"Health");
14142 }
14143 SetHealthMax("","Health");
14144 }
14145
14148 {
14149 float global_health = GetHealth01("","Health");
14150 array<string> zones = new array<string>;
14151 GetDamageZones(zones);
14152
14153 for (int i = 0; i < zones.Count(); i++)
14154 {
14155 SetHealth01(zones.Get(i),"Health",global_health);
14156 }
14157 }
14158
14161 {
14162 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14163 }
14164
14166 {
14167 if (!hasRootAsPlayer)
14168 {
14169 if (refParentIB)
14170 {
14171
14172 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14173 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14174
14175 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14176 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14177
14180 }
14181 else
14182 {
14183
14186 }
14187 }
14188 }
14189
14191 {
14193 {
14194 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14195 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14196 {
14197 float heatPermCoef = 1.0;
14199 while (ent)
14200 {
14201 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14202 ent = ent.GetHierarchyParent();
14203 }
14204
14205 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14206 }
14207 }
14208 }
14209
14211 {
14212
14213 EntityAI parent = GetHierarchyParent();
14214 if (!parent)
14215 {
14216 hasParent = false;
14217 hasRootAsPlayer = false;
14218 }
14219 else
14220 {
14221 hasParent = true;
14222 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14223 refParentIB =
ItemBase.Cast(parent);
14224 }
14225 }
14226
14227 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14228 {
14229
14230 }
14231
14233 {
14234
14235 return false;
14236 }
14237
14239 {
14240
14241
14242 return false;
14243 }
14244
14246 {
14247
14248 return false;
14249 }
14250
14253 {
14254 return !GetIsFrozen() &&
IsOpen();
14255 }
14256
14258 {
14259 bool hasParent = false, hasRootAsPlayer = false;
14261
14262 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14263 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14264
14265 if (wwtu || foodDecay)
14266 {
14270
14271 if (processWetness || processTemperature || processDecay)
14272 {
14274
14275 if (processWetness)
14276 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14277
14278 if (processTemperature)
14280
14281 if (processDecay)
14282 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14283 }
14284 }
14285 }
14286
14289 {
14291 }
14292
14294 {
14297
14298 return super.GetTemperatureFreezeThreshold();
14299 }
14300
14302 {
14305
14306 return super.GetTemperatureThawThreshold();
14307 }
14308
14310 {
14313
14314 return super.GetItemOverheatThreshold();
14315 }
14316
14318 {
14320 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14321
14322 return super.GetTemperatureFreezeTime();
14323 }
14324
14326 {
14328 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14329
14330 return super.GetTemperatureThawTime();
14331 }
14332
14337
14339 {
14340 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14341 }
14342
14344 {
14345 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14346 }
14347
14350 {
14352 }
14353
14355 {
14357 }
14358
14360 {
14362 }
14363
14366 {
14367 return null;
14368 }
14369
14372 {
14373 return false;
14374 }
14375
14377 {
14379 {
14382 if (!trg)
14383 {
14385 explosive = this;
14386 }
14387
14388 explosive.PairRemote(trg);
14390
14391 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14392 trg.SetPersistentPairID(persistentID);
14393 explosive.SetPersistentPairID(persistentID);
14394
14395 return true;
14396 }
14397 return false;
14398 }
14399
14402 {
14403 float ret = 1.0;
14406 ret *= GetHealth01();
14407
14408 return ret;
14409 }
14410
14411 #ifdef DEVELOPER
14412 override void SetDebugItem()
14413 {
14414 super.SetDebugItem();
14415 _itemBase = this;
14416 }
14417
14419 {
14420 string text = super.GetDebugText();
14421
14423 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14424
14425 return text;
14426 }
14427 #endif
14428
14430 {
14431 return true;
14432 }
14433
14435
14437
14439 {
14442 }
14443
14444
14452
14468
14469 [
Obsolete(
"Use ItemSoundHandler instead")]
14472 {
14473 if (!
g_Game.IsDedicatedServer())
14474 {
14475 if (ConfigIsExisting("attachSoundSet"))
14476 {
14477 string cfg_path = "";
14478 string soundset = "";
14479 string type_name =
GetType();
14480
14483 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14484 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14485
14486 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14487 {
14488 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14489 {
14490 if (cfg_slot_array[i] == slot_type)
14491 {
14492 soundset = cfg_soundset_array[i];
14493 break;
14494 }
14495 }
14496 }
14497
14498 if (soundset != "")
14499 {
14500 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14502 }
14503 }
14504 }
14505 }
14506
14508}
14509
14511{
14513 if (entity)
14514 {
14515 bool is_item = entity.IsInherited(
ItemBase);
14516 if (is_item && full_quantity)
14517 {
14520 }
14521 }
14522 else
14523 {
14525 return NULL;
14526 }
14527 return entity;
14528}
14529
14531{
14532 if (item)
14533 {
14534 if (health > 0)
14535 item.SetHealth("", "", health);
14536
14537 if (item.CanHaveTemperature())
14538 {
14540 if (item.CanFreeze())
14541 item.SetFrozen(false);
14542 }
14543
14544 if (item.HasEnergyManager())
14545 {
14546 if (quantity >= 0)
14547 {
14548 item.GetCompEM().SetEnergy0To1(quantity);
14549 }
14550 else
14551 {
14553 }
14554 }
14555 else if (item.IsMagazine())
14556 {
14557 Magazine mag = Magazine.Cast(item);
14558 if (quantity >= 0)
14559 {
14560 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14561 }
14562 else
14563 {
14565 }
14566
14567 }
14568 else
14569 {
14570 if (quantity >= 0)
14571 {
14572 item.SetQuantityNormalized(quantity, false);
14573 }
14574 else
14575 {
14577 }
14578
14579 }
14580 }
14581}
14582
14583#ifdef DEVELOPER
14585#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.