9661{
9663 {
9664 return true;
9665 }
9666};
9667
9669{
9670
9671};
9672
9673
9674
9676{
9680
9682
9685
9686
9687
9688
9689
9698
9704
9709
9714
9735 protected bool m_IsResultOfSplit
9736
9738
9743
9744
9745
9747
9751
9752
9753
9755
9758
9759
9760
9766
9767
9775
9778
9779
9781
9782
9784
9785
9790
9791
9796
9798
9799
9801
9802
9804 {
9809
9810 if (!
g_Game.IsDedicatedServer())
9811 {
9813 {
9815
9817 {
9819 }
9820 }
9821
9824 }
9825
9826 m_OldLocation = null;
9827
9829 {
9831 }
9832
9833 if (ConfigIsExisting("headSelectionsToHide"))
9834 {
9837 }
9838
9840 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9841 {
9843 }
9844
9846
9847 m_IsResultOfSplit = false;
9848
9850 }
9851
9853 {
9854 super.InitItemVariables();
9855
9861 m_Count = ConfigGetInt(
"count");
9862
9865
9870
9873
9878
9890
9894
9895
9898 if (ConfigIsExisting("canBeSplit"))
9899 {
9902 }
9903
9905 if (ConfigIsExisting("itemBehaviour"))
9907
9908
9911 RegisterNetSyncVariableInt("m_VarLiquidType");
9912 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9913
9914 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9915 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9916 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9917
9918 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9919 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9920 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9921 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9922
9923 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9924 RegisterNetSyncVariableBool("m_IsTakeable");
9925 RegisterNetSyncVariableBool("m_IsHologram");
9926
9929 {
9932 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9933 }
9934
9936
9938 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9940
9942 }
9943
9945 {
9947 }
9948
9950 {
9953 {
9958 }
9959 }
9960
9961 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9962 {
9964 {
9967 }
9968
9970 }
9971
9973 {
9979 }
9980
9982
9984 {
9986
9987 if (!action)
9988 {
9989 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9990 return;
9991 }
9992
9994 if (!ai)
9995 {
9997 return;
9998 }
9999
10001 if (!action_array)
10002 {
10003 action_array = new array<ActionBase_Basic>;
10005 }
10006 if (LogManager.IsActionLogEnable())
10007 {
10008 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10009 }
10010
10011 if (action_array.Find(action) != -1)
10012 {
10013 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10014 }
10015 else
10016 {
10017 action_array.Insert(action);
10018 }
10019 }
10020
10022 {
10023 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10024 ActionBase action = player.GetActionManager().GetAction(actionName);
10027
10028 if (action_array)
10029 {
10030 action_array.RemoveItem(action);
10031 }
10032 }
10033
10034
10035
10037 {
10038 ActionOverrideData overrideData = new ActionOverrideData();
10042
10044 if (!actionMap)
10045 {
10048 }
10049
10050 actionMap.Insert(this.
Type(), overrideData);
10051
10052 }
10053
10055
10057
10058
10060 {
10063
10066
10067 string config_to_search = "CfgVehicles";
10068 string muzzle_owner_config;
10069
10071 {
10072 if (IsInherited(Weapon))
10073 config_to_search = "CfgWeapons";
10074
10075 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10076
10077 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10078
10079 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10080
10081 if (config_OnFire_subclass_count > 0)
10082 {
10083 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10084
10085 for (int i = 0; i < config_OnFire_subclass_count; i++)
10086 {
10087 string particle_class = "";
10088 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10089 string config_OnFire_entry = config_OnFire_class + particle_class;
10090 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10091 WPOF_array.Insert(WPOF);
10092 }
10093
10094
10096 }
10097 }
10098
10100 {
10101 config_to_search = "CfgWeapons";
10102 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10103
10104 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10105
10106 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10107
10108 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10109 {
10110 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10111
10112 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10113 {
10114 string particle_class2 = "";
10115 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10116 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10117 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10118 WPOBE_array.Insert(WPOBE);
10119 }
10120
10121
10123 }
10124 }
10125 }
10126
10127
10129 {
10132
10134 {
10135 string config_to_search = "CfgVehicles";
10136
10137 if (IsInherited(Weapon))
10138 config_to_search = "CfgWeapons";
10139
10140 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10141 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10142
10143 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10144 {
10145
10147
10149 {
10151 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10153 return;
10154 }
10155
10158
10159
10160
10161 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10162 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10163
10164 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10165 {
10166 string particle_class = "";
10167 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10168 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10169 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10170
10171 if (entry_type == CT_CLASS)
10172 {
10173 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10174 WPOOH_array.Insert(WPOF);
10175 }
10176 }
10177
10178
10180 }
10181 }
10182 }
10183
10185 {
10187 }
10188
10190 {
10192 {
10194
10197
10200
10201 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10202 }
10203 }
10204
10206 {
10208 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10209
10211 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10212
10214 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10215
10217 {
10219 }
10220 }
10221
10223 {
10225 }
10226
10228 {
10231 else
10233
10235 {
10238 }
10239 else
10240 {
10243
10246 }
10247
10249 }
10250
10252 {
10254 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10255 }
10256
10258 {
10260 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10262 }
10263
10265 {
10267 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10268 }
10269
10271 {
10274
10275 OverheatingParticle OP = new OverheatingParticle();
10280
10282 }
10283
10285 {
10288
10289 return -1;
10290 }
10291
10293 {
10295 {
10298
10299 for (int i = count; i > 0; --i)
10300 {
10301 int id = i - 1;
10304
10307
10308 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10309 {
10310 if (p)
10311 {
10314 }
10315 }
10316 }
10317 }
10318 }
10319
10321 {
10323 {
10325 {
10326 int id = i - 1;
10328
10329 if (OP)
10330 {
10332
10333 if (p)
10334 {
10336 }
10337
10338 delete OP;
10339 }
10340 }
10341
10344 }
10345 }
10346
10349 {
10350 return 0.0;
10351 }
10352
10353
10355 {
10356 return 250;
10357 }
10358
10360 {
10361 return 0;
10362 }
10363
10366 {
10368 return true;
10369
10370 return false;
10371 }
10372
10375 {
10378
10380 {
10382 }
10383 else
10384 {
10385
10387 }
10388
10390 }
10391
10398 {
10399 return -1;
10400 }
10401
10402
10403
10404
10406 {
10408 {
10409 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10410 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10411
10412 if (r_index >= 0)
10413 {
10414 InventoryLocation r_il = new InventoryLocation;
10415 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10416
10417 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10420 {
10421 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10422 }
10424 {
10425 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10426 }
10427
10428 }
10429
10430 player.GetHumanInventory().ClearUserReservedLocation(this);
10431 }
10432
10435 }
10436
10437
10438
10439
10441 {
10442 return ItemBase.m_DebugActionsMask;
10443 }
10444
10446 {
10447 return ItemBase.m_DebugActionsMask & mask;
10448 }
10449
10451 {
10452 ItemBase.m_DebugActionsMask = mask;
10453 }
10454
10456 {
10457 ItemBase.m_DebugActionsMask |= mask;
10458 }
10459
10461 {
10462 ItemBase.m_DebugActionsMask &= ~mask;
10463 }
10464
10466 {
10468 {
10470 }
10471 else
10472 {
10474 }
10475 }
10476
10477
10479 {
10480 if (GetEconomyProfile())
10481 {
10482 float q_max = GetEconomyProfile().GetQuantityMax();
10483 if (q_max > 0)
10484 {
10485 float q_min = GetEconomyProfile().GetQuantityMin();
10486 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10487
10489 {
10490 ComponentEnergyManager comp = GetCompEM();
10492 {
10494 }
10495 }
10497 {
10499
10500 }
10501
10502 }
10503 }
10504 }
10505
10508 {
10509 EntityAI parent = GetHierarchyParent();
10510
10511 if (parent)
10512 {
10513 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10514 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10515 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10516 }
10517 }
10518
10521 {
10522 EntityAI parent = GetHierarchyParent();
10523
10524 if (parent)
10525 {
10526 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10527 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10528 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10529 }
10530 }
10531
10533 {
10534
10535
10536
10537
10539
10541 {
10542 if (ScriptInputUserData.CanStoreInputUserData())
10543 {
10544 ScriptInputUserData ctx = new ScriptInputUserData;
10550 ctx.
Write(use_stack_max);
10553
10555 {
10556 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10557 }
10558 }
10559 }
10560 else if (!
g_Game.IsMultiplayer())
10561 {
10563 }
10564 }
10565
10567 {
10569 }
10570
10572 {
10574 }
10575
10577 {
10579 }
10580
10582 {
10583
10584 return false;
10585 }
10586
10588 {
10589 return false;
10590 }
10591
10595 {
10596 return false;
10597 }
10598
10600 {
10601 return "";
10602 }
10603
10605
10607 {
10608 return false;
10609 }
10610
10612 {
10613 return true;
10614 }
10615
10616
10617
10619 {
10620 return true;
10621 }
10622
10624 {
10625 return true;
10626 }
10627
10629 {
10630 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10632 }
10633
10635 {
10637 }
10638
10640 {
10642 if (!is_being_placed)
10644 SetSynchDirty();
10645 }
10646
10647
10649
10651 {
10653 }
10654
10656 {
10658 }
10659
10661 {
10662 return 1;
10663 }
10664
10666 {
10667 return false;
10668 }
10669
10671 {
10673 SetSynchDirty();
10674 }
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10711 {
10712 super.OnMovedInsideCargo(container);
10713
10714 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10715 }
10716
10717 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10718 {
10719 super.EEItemLocationChanged(oldLoc, newLoc);
10720
10721 PlayerBase newPlayer = null;
10722 PlayerBase oldPlayer = null;
10723
10724 if (newLoc.GetParent())
10725 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10726
10727 if (oldLoc.GetParent())
10728 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10729
10731 {
10732 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10733
10734 if (rIndex >= 0)
10735 {
10736 InventoryLocation rIl = new InventoryLocation;
10737 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10738
10739 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10742 {
10743 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10744 }
10746 {
10748 }
10749
10750 }
10751 }
10752
10754 {
10755 if (newPlayer)
10756 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10757
10758 if (newPlayer == oldPlayer)
10759 {
10760 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10761 {
10763 {
10764 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10765 {
10766 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10767 }
10768 }
10769 else
10770 {
10771 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10772 }
10773 }
10774
10775 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10776 {
10777 int type = oldLoc.GetType();
10779 {
10780 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10781 }
10783 {
10784 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10785 }
10786 }
10787 if (!m_OldLocation)
10788 {
10789 m_OldLocation = new InventoryLocation;
10790 }
10791 m_OldLocation.Copy(oldLoc);
10792 }
10793 else
10794 {
10795 if (m_OldLocation)
10796 {
10797 m_OldLocation.Reset();
10798 }
10799 }
10800
10801 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10802 }
10803 else
10804 {
10805 if (newPlayer)
10806 {
10807 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10808 if (resIndex >= 0)
10809 {
10810 InventoryLocation il = new InventoryLocation;
10811 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10813 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10816 {
10817 il.
GetParent().GetOnReleaseLock().Invoke(it);
10818 }
10820 {
10822 }
10823
10824 }
10825 }
10827 {
10828
10830 }
10831
10832 if (m_OldLocation)
10833 {
10834 m_OldLocation.Reset();
10835 }
10836 }
10837
10839 {
10840 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10841 }
10842
10844 {
10845 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10846 }
10847 }
10848
10849 override void EOnContact(IEntity other, Contact extra)
10850 {
10852 {
10853 int liquidType = -1;
10855 if (impactSpeed > 0.0)
10856 {
10858 #ifndef SERVER
10860 #else
10862 SetSynchDirty();
10863 #endif
10865 }
10866 }
10867
10868 #ifdef SERVER
10869 if (GetCompEM() && GetCompEM().IsPlugged())
10870 {
10871 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10872 GetCompEM().UnplugThis();
10873 }
10874 #endif
10875 }
10876
10878
10880 {
10882 }
10883
10885 {
10886
10887 }
10888
10890 {
10891 super.OnItemLocationChanged(old_owner, new_owner);
10892
10893 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10894 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10895
10896 if (!relatedPlayer && playerNew)
10897 relatedPlayer = playerNew;
10898
10899 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10900 {
10902 if (actionMgr)
10903 {
10904 ActionBase currentAction = actionMgr.GetRunningAction();
10905 if (currentAction)
10907 }
10908 }
10909
10910 Man ownerPlayerOld = null;
10911 Man ownerPlayerNew = null;
10912
10913 if (old_owner)
10914 {
10915 if (old_owner.
IsMan())
10916 {
10917 ownerPlayerOld = Man.Cast(old_owner);
10918 }
10919 else
10920 {
10921 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10922 }
10923 }
10924 else
10925 {
10927 {
10929
10930 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10931 {
10932 GetCompEM().UnplugThis();
10933 }
10934 }
10935 }
10936
10937 if (new_owner)
10938 {
10939 if (new_owner.
IsMan())
10940 {
10941 ownerPlayerNew = Man.Cast(new_owner);
10942 }
10943 else
10944 {
10945 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10946 }
10947 }
10948
10949 if (ownerPlayerOld != ownerPlayerNew)
10950 {
10951 if (ownerPlayerOld)
10952 {
10953 array<EntityAI> subItemsExit = new array<EntityAI>;
10955 for (int i = 0; i < subItemsExit.Count(); i++)
10956 {
10959 }
10960 }
10961
10962 if (ownerPlayerNew)
10963 {
10964 array<EntityAI> subItemsEnter = new array<EntityAI>;
10966 for (int j = 0; j < subItemsEnter.Count(); j++)
10967 {
10970 }
10971 }
10972 }
10973 else if (ownerPlayerNew != null)
10974 {
10975 PlayerBase nplayer;
10976 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10977 {
10978 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10980 for (int k = 0; k < subItemsUpdate.Count(); k++)
10981 {
10983 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10984 }
10985 }
10986 }
10987
10988 if (old_owner)
10989 old_owner.OnChildItemRemoved(this);
10990 if (new_owner)
10991 new_owner.OnChildItemReceived(this);
10992 }
10993
10994
10996 {
10997 super.EEDelete(parent);
10998 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10999 if (player)
11000 {
11002
11003 if (player.IsAlive())
11004 {
11005 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11006 if (r_index >= 0)
11007 {
11008 InventoryLocation r_il = new InventoryLocation;
11009 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11010
11011 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11014 {
11015 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11016 }
11018 {
11019 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11020 }
11021
11022 }
11023
11024 player.RemoveQuickBarEntityShortcut(this);
11025 }
11026 }
11027 }
11028
11030 {
11031 super.EEKilled(killer);
11032
11035 {
11036 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11037 {
11038 if (IsMagazine())
11039 {
11040 if (Magazine.Cast(this).GetAmmoCount() > 0)
11041 {
11043 }
11044 }
11045 else
11046 {
11048 }
11049 }
11050 }
11051 }
11052
11054 {
11055 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11056
11057 super.OnWasAttached(parent, slot_id);
11058
11061
11064 }
11065
11067 {
11068 super.OnWasDetached(parent, slot_id);
11069
11072
11075 }
11076
11078 {
11079 int idx;
11082
11083 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11084 if (inventory_slots.Count() < 1)
11085 {
11086 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11087 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11088 }
11089 else
11090 {
11091 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11092 }
11093
11094 idx = inventory_slots.Find(slot);
11095 if (idx < 0)
11096 return "";
11097
11098 return attach_types.Get(idx);
11099 }
11100
11102 {
11103 int idx = -1;
11104 string slot;
11105
11108
11109 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11110 if (inventory_slots.Count() < 1)
11111 {
11112 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11113 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11114 }
11115 else
11116 {
11117 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11118 if (detach_types.Count() < 1)
11119 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11120 }
11121
11122 for (int i = 0; i < inventory_slots.Count(); i++)
11123 {
11124 slot = inventory_slots.Get(i);
11125 }
11126
11127 if (slot != "")
11128 {
11129 if (detach_types.Count() == 1)
11130 idx = 0;
11131 else
11132 idx = inventory_slots.Find(slot);
11133 }
11134 if (idx < 0)
11135 return "";
11136
11137 return detach_types.Get(idx);
11138 }
11139
11141 {
11142
11144
11145
11146 float min_time = 1;
11147 float max_time = 3;
11148 float delay = Math.RandomFloat(min_time, max_time);
11149
11150 explode_timer.Run(delay, this, "DoAmmoExplosion");
11151 }
11152
11154 {
11155 Magazine magazine = Magazine.Cast(this);
11156 int pop_sounds_count = 6;
11157 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11158
11159
11160 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11161 string sound_name = pop_sounds[ sound_idx ];
11162 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11163
11164
11165 magazine.ServerAddAmmoCount(-1);
11166
11167
11168 float min_temp_to_explode = 100;
11169
11170 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11171 {
11173 }
11174 }
11175
11176
11177 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11178 {
11179 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11180
11181 const int CHANCE_DAMAGE_CARGO = 4;
11182 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11183 const int CHANCE_DAMAGE_NOTHING = 2;
11184
11186 {
11187 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11188 int chances;
11189 int rnd;
11190
11191 if (GetInventory().GetCargo())
11192 {
11193 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11194 rnd = Math.RandomInt(0,chances);
11195
11196 if (rnd < CHANCE_DAMAGE_CARGO)
11197 {
11199 }
11200 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11201 {
11203 }
11204 }
11205 else
11206 {
11207 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11208 rnd = Math.RandomInt(0,chances);
11209
11210 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11211 {
11213 }
11214 }
11215 }
11216 }
11217
11219 {
11220 CargoBase cargo = GetInventory().GetCargo();
11221 if (cargo)
11222 {
11224 if (item_count > 0)
11225 {
11226 int random_pick = Math.RandomInt(0, item_count);
11228 if (!item.IsExplosive())
11229 {
11230 item.AddHealth("","",damage);
11231 return true;
11232 }
11233 }
11234 }
11235 return false;
11236 }
11237
11239 {
11240 GameInventory inventory = GetInventory();
11242 if (attachment_count > 0)
11243 {
11244 int random_pick = Math.RandomInt(0, attachment_count);
11246 if (!attachment.IsExplosive())
11247 {
11248 attachment.AddHealth("","",damage);
11249 return true;
11250 }
11251 }
11252 return false;
11253 }
11254
11256 {
11258 }
11259
11261 {
11263 return GetInventory().CanRemoveEntity();
11264
11265 return false;
11266 }
11267
11269 {
11270
11272 return false;
11273
11274
11276 return false;
11277
11278
11279
11281 if (delta == 0)
11282 return false;
11283
11284
11285 return true;
11286 }
11287
11289 {
11291 {
11292 if (ScriptInputUserData.CanStoreInputUserData())
11293 {
11294 ScriptInputUserData ctx = new ScriptInputUserData;
11299 ctx.
Write(destination_entity);
11301 ctx.
Write(slot_id);
11303 }
11304 }
11305 else if (!
g_Game.IsMultiplayer())
11306 {
11308 }
11309 }
11310
11312 {
11313 float split_quantity_new;
11317 InventoryLocation loc = new InventoryLocation;
11318
11319 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11320 {
11322 split_quantity_new = stack_max;
11323 else
11325
11327 {
11328 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11329 if (new_item)
11330 {
11331 new_item.SetResultOfSplit(true);
11332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11334 new_item.
SetQuantity(split_quantity_new,
false,
true);
11335 }
11336 }
11337 }
11338 else if (destination_entity && slot_id == -1)
11339 {
11340 if (quantity > stack_max)
11341 split_quantity_new = stack_max;
11342 else
11343 split_quantity_new = quantity;
11344
11346 {
11347 GameInventory destinationInventory = destination_entity.GetInventory();
11349 {
11352 }
11353
11354 if (new_item)
11355 {
11356 new_item.SetResultOfSplit(true);
11357 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11359 new_item.
SetQuantity(split_quantity_new,
false,
true);
11360 }
11361 }
11362 }
11363 else
11364 {
11365 if (stack_max != 0)
11366 {
11368 {
11370 }
11371
11372 if (split_quantity_new == 0)
11373 {
11374 if (!
g_Game.IsMultiplayer())
11375 player.PhysicalPredictiveDropItem(this);
11376 else
11377 player.ServerDropEntity(this);
11378 return;
11379 }
11380
11382 {
11384
11385 if (new_item)
11386 {
11387 new_item.SetResultOfSplit(true);
11388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11391 new_item.PlaceOnSurface();
11392 }
11393 }
11394 }
11395 }
11396 }
11397
11399 {
11400 float split_quantity_new;
11404 InventoryLocation loc = new InventoryLocation;
11405
11406 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11407 {
11409 split_quantity_new = stack_max;
11410 else
11412
11414 {
11415 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11416 if (new_item)
11417 {
11418 new_item.SetResultOfSplit(true);
11419 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11421 new_item.
SetQuantity(split_quantity_new,
false,
true);
11422 }
11423 }
11424 }
11425 else if (destination_entity && slot_id == -1)
11426 {
11427 if (quantity > stack_max)
11428 split_quantity_new = stack_max;
11429 else
11430 split_quantity_new = quantity;
11431
11433 {
11434 GameInventory destinationInventory = destination_entity.GetInventory();
11436 {
11439 }
11440
11441 if (new_item)
11442 {
11443 new_item.SetResultOfSplit(true);
11444 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11446 new_item.
SetQuantity(split_quantity_new,
false,
true);
11447 }
11448 }
11449 }
11450 else
11451 {
11452 if (stack_max != 0)
11453 {
11455 {
11457 }
11458
11460 {
11462
11463 if (new_item)
11464 {
11465 new_item.SetResultOfSplit(true);
11466 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11469 new_item.PlaceOnSurface();
11470 }
11471 }
11472 }
11473 }
11474 }
11475
11477 {
11479 {
11480 if (ScriptInputUserData.CanStoreInputUserData())
11481 {
11482 ScriptInputUserData ctx = new ScriptInputUserData;
11487 dst.WriteToContext(ctx);
11489 }
11490 }
11491 else if (!
g_Game.IsMultiplayer())
11492 {
11494 }
11495 }
11496
11498 {
11500 {
11501 if (ScriptInputUserData.CanStoreInputUserData())
11502 {
11503 ScriptInputUserData ctx = new ScriptInputUserData;
11508 ctx.
Write(destination_entity);
11514 }
11515 }
11516 else if (!
g_Game.IsMultiplayer())
11517 {
11519 }
11520 }
11521
11523 {
11525 }
11526
11528 {
11530 float split_quantity_new;
11532 if (dst.IsValid())
11533 {
11534 int slot_id = dst.GetSlot();
11536
11537 if (quantity > stack_max)
11538 split_quantity_new = stack_max;
11539 else
11540 split_quantity_new = quantity;
11541
11543 {
11545
11546 if (new_item)
11547 {
11548 new_item.SetResultOfSplit(true);
11549 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11551 new_item.
SetQuantity(split_quantity_new,
false,
true);
11552 }
11553
11554 return new_item;
11555 }
11556 }
11557
11558 return null;
11559 }
11560
11562 {
11564 float split_quantity_new;
11566 if (destination_entity)
11567 {
11569 if (quantity > stackable)
11570 split_quantity_new = stackable;
11571 else
11572 split_quantity_new = quantity;
11573
11575 {
11576 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11577 if (new_item)
11578 {
11579 new_item.SetResultOfSplit(true);
11580 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11582 new_item.
SetQuantity(split_quantity_new,
false,
true);
11583 }
11584 }
11585 }
11586 }
11587
11589 {
11591 {
11592 if (ScriptInputUserData.CanStoreInputUserData())
11593 {
11594 ScriptInputUserData ctx = new ScriptInputUserData;
11599 ItemBase destination_entity =
this;
11600 ctx.
Write(destination_entity);
11604 }
11605 }
11606 else if (!
g_Game.IsMultiplayer())
11607 {
11609 }
11610 }
11611
11613 {
11615 float split_quantity_new;
11617 if (player)
11618 {
11620 if (quantity > stackable)
11621 split_quantity_new = stackable;
11622 else
11623 split_quantity_new = quantity;
11624
11626 {
11627 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11628 new_item =
ItemBase.Cast(in_hands);
11629 if (new_item)
11630 {
11631 new_item.SetResultOfSplit(true);
11632 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11634 new_item.SetQuantity(split_quantity_new, false, true);
11635 }
11636 }
11637 }
11638 }
11639
11641 {
11643 float split_quantity_new = Math.Floor(quantity * 0.5);
11644
11646 return;
11647
11649
11650 if (new_item)
11651 {
11652 if (new_item.GetQuantityMax() < split_quantity_new)
11653 {
11654 split_quantity_new = new_item.GetQuantityMax();
11655 }
11656
11657 new_item.SetResultOfSplit(true);
11658 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11659
11661 {
11664 }
11665 else
11666 {
11668 new_item.
SetQuantity(split_quantity_new,
false,
true);
11669 }
11670 }
11671 }
11672
11674 {
11676 float split_quantity_new = Math.Floor(quantity / 2);
11677
11679 return;
11680
11681 InventoryLocation invloc = new InventoryLocation;
11683
11685 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11686
11687 if (new_item)
11688 {
11689 if (new_item.GetQuantityMax() < split_quantity_new)
11690 {
11691 split_quantity_new = new_item.GetQuantityMax();
11692 }
11694 {
11697 }
11698 else if (split_quantity_new > 1)
11699 {
11701 new_item.
SetQuantity(split_quantity_new,
false,
true);
11702 }
11703 }
11704 }
11705
11708 {
11709 SetWeightDirty();
11711
11712 if (parent)
11713 parent.OnAttachmentQuantityChangedEx(this, delta);
11714
11716 {
11718 {
11720 }
11722 {
11723 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11725 }
11726 }
11727 }
11728
11731 {
11732
11733 }
11734
11737 {
11739 }
11740
11742 {
11743 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11744
11746 {
11747 if (newLevel == GameConstants.STATE_RUINED)
11748 {
11750 EntityAI parent = GetHierarchyParent();
11751 if (parent && parent.IsFireplace())
11752 {
11753 CargoBase cargo = GetInventory().GetCargo();
11754 if (cargo)
11755 {
11757 {
11759 }
11760 }
11761 }
11762 }
11763
11765 {
11766
11768 return;
11769 }
11770
11771 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11772 {
11774 }
11775 }
11776 }
11777
11778
11780 {
11781 super.OnRightClick();
11782
11784 {
11786 {
11787 if (ScriptInputUserData.CanStoreInputUserData())
11788 {
11789 EntityAI root = GetHierarchyRoot();
11790 Man playerOwner = GetHierarchyRootPlayer();
11791 InventoryLocation dst = new InventoryLocation;
11792
11793
11794 if (!playerOwner && root && root == this)
11795 {
11797 }
11798 else
11799 {
11800
11801 GetInventory().GetCurrentInventoryLocation(dst);
11803 {
11804 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11806 {
11808 }
11809 else
11810 {
11812
11813
11814 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11815 {
11817 }
11818 else
11819 {
11820 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11821 }
11822 }
11823 }
11824 }
11825
11826 ScriptInputUserData ctx = new ScriptInputUserData;
11834 }
11835 }
11836 else if (!
g_Game.IsMultiplayer())
11837 {
11839 }
11840 }
11841 }
11842
11844 {
11845 if (root)
11846 {
11847 vector m4[4];
11848 root.GetTransform(m4);
11849 dst.SetGround(this, m4);
11850 }
11851 else
11852 {
11853 GetInventory().GetCurrentInventoryLocation(dst);
11854 }
11855 }
11856
11857 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11858 {
11859
11860 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11861 return false;
11862
11863 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11864 return false;
11865
11866
11868 return false;
11869
11870
11871 Magazine mag = Magazine.Cast(this);
11872 if (mag)
11873 {
11874 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11875 return false;
11876
11877 if (stack_max_limit)
11878 {
11879 Magazine other_mag = Magazine.Cast(other_item);
11880 if (other_item)
11881 {
11882 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11883 return false;
11884 }
11885
11886 }
11887 }
11888 else
11889 {
11890
11892 return false;
11893
11895 return false;
11896 }
11897
11898 PlayerBase player = null;
11899 if (CastTo(player, GetHierarchyRootPlayer()))
11900 {
11901 if (player.GetInventory().HasAttachment(this))
11902 return false;
11903
11904 if (player.IsItemsToDelete())
11905 return false;
11906 }
11907
11908 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11909 return false;
11910
11911 int slotID;
11913 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11914 return false;
11915
11916 return true;
11917 }
11918
11920 {
11922 }
11923
11925 {
11926 return m_IsResultOfSplit;
11927 }
11928
11930 {
11931 m_IsResultOfSplit = value;
11932 }
11933
11935 {
11937 }
11938
11940 {
11941 float other_item_quantity = other_item.GetQuantity();
11942 float this_free_space;
11943
11945
11947
11948 if (other_item_quantity > this_free_space)
11949 {
11950 return this_free_space;
11951 }
11952 else
11953 {
11954 return other_item_quantity;
11955 }
11956 }
11957
11959 {
11961 }
11962
11964 {
11966 return;
11967
11968 if (!IsMagazine() && other_item)
11969 {
11971 if (quantity_used != 0)
11972 {
11973 float hp1 = GetHealth01("","");
11974 float hp2 = other_item.GetHealth01("","");
11975 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11976 hpResult = hpResult / (
GetQuantity() + quantity_used);
11977
11978 hpResult *= GetMaxHealth();
11979 Math.Round(hpResult);
11980 SetHealth("", "Health", hpResult);
11981
11983 other_item.AddQuantity(-quantity_used);
11984 }
11985 }
11987 }
11988
11990 {
11991 #ifdef SERVER
11992 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11993 GetHierarchyParent().IncreaseLifetimeUp();
11994 #endif
11995 };
11996
11998 {
11999 PlayerBase p = PlayerBase.Cast(player);
12000
12001 array<int> recipesIds = p.m_Recipes;
12002 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12003 if (moduleRecipesManager)
12004 {
12005 EntityAI itemInHands = player.GetEntityInHands();
12006 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12007 }
12008
12009 for (int i = 0;i < recipesIds.Count(); i++)
12010 {
12011 int key = recipesIds.Get(i);
12012 string recipeName = moduleRecipesManager.GetRecipeName(key);
12014 }
12015 }
12016
12017
12018 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12019 {
12020 super.GetDebugActions(outputList);
12021
12022
12028
12029
12034
12039
12040
12044
12045
12047 {
12051 }
12052
12055
12056
12060
12062
12063 InventoryLocation loc = new InventoryLocation();
12064 GetInventory().GetCurrentInventoryLocation(loc);
12066 {
12067 if (Gizmo_IsSupported())
12070 }
12071
12073 }
12074
12075
12076
12077
12079 {
12080 super.OnAction(action_id, player, ctx);
12081
12083 {
12084 switch (action_id)
12085 {
12089 return true;
12093 return true;
12094 }
12095 }
12096
12098 {
12099 switch (action_id)
12100 {
12102 Delete();
12103 return true;
12104 }
12105 }
12106
12107 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12108 {
12109 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12110 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12111 PlayerBase p = PlayerBase.Cast(player);
12112 if (
EActions.RECIPES_RANGE_START < 1000)
12113 {
12114 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12115 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12116 }
12117 }
12118 #ifndef SERVER
12119 else if (action_id ==
EActions.WATCH_PLAYER)
12120 {
12121 PluginDeveloper.SetDeveloperItemClientEx(player);
12122 }
12123 #endif
12125 {
12126 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12127 {
12128 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12129 OnDebugButtonPressServer(id + 1);
12130 }
12131
12132 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12133 {
12134 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12136 }
12137
12138 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12139 {
12140 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12142 }
12143
12144 else if (action_id ==
EActions.ADD_QUANTITY)
12145 {
12146 if (IsMagazine())
12147 {
12148 Magazine mag = Magazine.Cast(this);
12149 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12150 }
12151 else
12152 {
12154 }
12155
12156 if (m_EM)
12157 {
12158 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12159 }
12160
12161 }
12162
12163 else if (action_id ==
EActions.REMOVE_QUANTITY)
12164 {
12165 if (IsMagazine())
12166 {
12167 Magazine mag2 = Magazine.Cast(this);
12168 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12169 }
12170 else
12171 {
12173 }
12174 if (m_EM)
12175 {
12176 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12177 }
12178
12179 }
12180
12181 else if (action_id ==
EActions.SET_QUANTITY_0)
12182 {
12184
12185 if (m_EM)
12186 {
12187 m_EM.SetEnergy(0);
12188 }
12189 }
12190
12191 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12192 {
12194
12195 if (m_EM)
12196 {
12197 m_EM.SetEnergy(m_EM.GetEnergyMax());
12198 }
12199 }
12200
12201 else if (action_id ==
EActions.ADD_HEALTH)
12202 {
12203 AddHealth("","",GetMaxHealth("","Health")/5);
12204 }
12205 else if (action_id ==
EActions.REMOVE_HEALTH)
12206 {
12207 AddHealth("","",-GetMaxHealth("","Health")/5);
12208 }
12209 else if (action_id ==
EActions.DESTROY_HEALTH)
12210 {
12211 SetHealth01("","",0);
12212 }
12213 else if (action_id ==
EActions.WATCH_ITEM)
12214 {
12216 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12217 #ifdef DEVELOPER
12218 SetDebugDeveloper_item(this);
12219 #endif
12220 }
12221
12222 else if (action_id ==
EActions.ADD_TEMPERATURE)
12223 {
12224 AddTemperature(20);
12225
12226 }
12227
12228 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12229 {
12230 AddTemperature(-20);
12231
12232 }
12233
12234 else if (action_id ==
EActions.FLIP_FROZEN)
12235 {
12236 SetFrozen(!GetIsFrozen());
12237
12238 }
12239
12240 else if (action_id ==
EActions.ADD_WETNESS)
12241 {
12243
12244 }
12245
12246 else if (action_id ==
EActions.REMOVE_WETNESS)
12247 {
12249
12250 }
12251
12252 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12253 {
12256
12257
12258 }
12259
12260 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12261 {
12264 }
12265
12266 else if (action_id ==
EActions.MAKE_SPECIAL)
12267 {
12268 auto debugParams = DebugSpawnParams.WithPlayer(player);
12269 OnDebugSpawnEx(debugParams);
12270 }
12271
12272 }
12273
12274
12275 return false;
12276 }
12277
12278
12279
12280
12284
12287
12288
12289
12291 {
12292 return false;
12293 }
12294
12295
12297 {
12298 return true;
12299 }
12300
12301
12303 {
12304 return true;
12305 }
12306
12307
12308
12310 {
12311 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12312 return g_Game.ConfigIsExisting(config_path);
12313 }
12314
12317 {
12318 return null;
12319 }
12320
12322 {
12323 return false;
12324 }
12325
12327 {
12328 return false;
12329 }
12330
12334
12335
12337 {
12338 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12339 return module_repairing.CanRepair(this, item_repair_kit);
12340 }
12341
12342
12343 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12344 {
12345 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12346 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12347 }
12348
12349
12351 {
12352
12353
12354
12355
12356
12357
12358
12359
12360 return 1;
12361 }
12362
12363
12364
12366 {
12368 }
12369
12370
12371
12373 {
12375 }
12376
12377
12386 {
12387 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12388
12389 if (player)
12390 {
12391 player.MessageStatus(text);
12392 }
12393 }
12394
12395
12404 {
12405 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12406
12407 if (player)
12408 {
12409 player.MessageAction(text);
12410 }
12411 }
12412
12413
12422 {
12423 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12424
12425 if (player)
12426 {
12427 player.MessageFriendly(text);
12428 }
12429 }
12430
12431
12440 {
12441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12442
12443 if (player)
12444 {
12445 player.MessageImportant(text);
12446 }
12447 }
12448
12450 {
12451 return true;
12452 }
12453
12454
12455 override bool KindOf(
string tag)
12456 {
12457 bool found = false;
12458 string item_name = this.
GetType();
12460 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12461
12462 int array_size = item_tag_array.Count();
12463 for (int i = 0; i < array_size; i++)
12464 {
12465 if (item_tag_array.Get(i) == tag)
12466 {
12467 found = true;
12468 break;
12469 }
12470 }
12471 return found;
12472 }
12473
12474
12476 {
12477
12478 super.OnRPC(sender, rpc_type,ctx);
12479
12480
12481 switch (rpc_type)
12482 {
12483 #ifndef SERVER
12484 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12485 Param2<bool, string> p = new Param2<bool, string>(false, "");
12486
12488 return;
12489
12490 bool play = p.param1;
12491 string soundSet = p.param2;
12492
12493 if (play)
12494 {
12496 {
12498 {
12500 }
12501 }
12502 else
12503 {
12505 }
12506 }
12507 else
12508 {
12510 }
12511
12512 break;
12513 #endif
12514
12515 }
12516
12518 {
12520 }
12521 }
12522
12523
12524
12525
12527 {
12528 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12529 return plugin.GetID(
name);
12530 }
12531
12533 {
12534 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12535 return plugin.GetName(id);
12536 }
12537
12540 {
12541
12542
12543 int varFlags;
12544 if (!ctx.
Read(varFlags))
12545 return;
12546
12547 if (varFlags & ItemVariableFlags.FLOAT)
12548 {
12550 }
12551 }
12552
12554 {
12555
12556 super.SerializeNumericalVars(floats_out);
12557
12558
12559
12561 {
12563 }
12564
12566 {
12568 }
12569
12571 {
12573 }
12574
12576 {
12581 }
12582
12584 {
12586 }
12587 }
12588
12590 {
12591
12592 super.DeSerializeNumericalVars(floats);
12593
12594
12595 int index = 0;
12596 int mask = Math.Round(floats.Get(index));
12597
12598 index++;
12599
12601 {
12603 {
12605 }
12606 else
12607 {
12608 float quantity = floats.Get(index);
12609 SetQuantity(quantity,
true,
false,
false,
false);
12610 }
12611 index++;
12612 }
12613
12615 {
12616 float wet = floats.Get(index);
12618 index++;
12619 }
12620
12622 {
12623 int liquidtype = Math.Round(floats.Get(index));
12625 index++;
12626 }
12627
12629 {
12631 index++;
12633 index++;
12635 index++;
12637 index++;
12638 }
12639
12641 {
12642 int cleanness = Math.Round(floats.Get(index));
12644 index++;
12645 }
12646 }
12647
12649 {
12650 super.WriteVarsToCTX(ctx);
12651
12652
12654 {
12656 }
12657
12659 {
12661 }
12662
12664 {
12666 }
12667
12669 {
12670 int r,g,b,a;
12676 }
12677
12679 {
12681 }
12682 }
12683
12685 {
12686 if (!super.ReadVarsFromCTX(ctx,version))
12687 return false;
12688
12689 int intValue;
12690 float value;
12691
12692 if (version < 140)
12693 {
12694 if (!ctx.
Read(intValue))
12695 return false;
12696
12697 m_VariablesMask = intValue;
12698 }
12699
12701 {
12702 if (!ctx.
Read(value))
12703 return false;
12704
12706 {
12708 }
12709 else
12710 {
12712 }
12713 }
12714
12715 if (version < 140)
12716 {
12718 {
12719 if (!ctx.
Read(value))
12720 return false;
12721 SetTemperatureDirect(value);
12722 }
12723 }
12724
12726 {
12727 if (!ctx.
Read(value))
12728 return false;
12730 }
12731
12733 {
12734 if (!ctx.
Read(intValue))
12735 return false;
12737 }
12738
12740 {
12741 int r,g,b,a;
12743 return false;
12745 return false;
12747 return false;
12749 return false;
12750
12752 }
12753
12755 {
12756 if (!ctx.
Read(intValue))
12757 return false;
12759 }
12760
12761 if (version >= 138 && version < 140)
12762 {
12764 {
12765 if (!ctx.
Read(intValue))
12766 return false;
12767 SetFrozen(intValue);
12768 }
12769 }
12770
12771 return true;
12772 }
12773
12774
12776 {
12779 {
12781 }
12782
12783 if (!super.OnStoreLoad(ctx, version))
12784 {
12786 return false;
12787 }
12788
12789 if (version >= 114)
12790 {
12791 bool hasQuickBarIndexSaved;
12792
12793 if (!ctx.
Read(hasQuickBarIndexSaved))
12794 {
12796 return false;
12797 }
12798
12799 if (hasQuickBarIndexSaved)
12800 {
12801 int itmQBIndex;
12802
12803
12804 if (!ctx.
Read(itmQBIndex))
12805 {
12807 return false;
12808 }
12809
12810 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12811 if (itmQBIndex != -1 && parentPlayer)
12812 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12813 }
12814 }
12815 else
12816 {
12817
12818 PlayerBase player;
12819 int itemQBIndex;
12820 if (version ==
int.
MAX)
12821 {
12822 if (!ctx.
Read(itemQBIndex))
12823 {
12825 return false;
12826 }
12827 }
12828 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12829 {
12830
12831 if (!ctx.
Read(itemQBIndex))
12832 {
12834 return false;
12835 }
12836 if (itemQBIndex != -1 && player)
12837 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12838 }
12839 }
12840
12841 if (version < 140)
12842 {
12843
12844 if (!LoadVariables(ctx, version))
12845 {
12847 return false;
12848 }
12849 }
12850
12851
12853 {
12855 return false;
12856 }
12857 if (version >= 132)
12858 {
12860 if (raib)
12861 {
12863 {
12865 return false;
12866 }
12867 }
12868 }
12869
12871 return true;
12872 }
12873
12874
12875
12877 {
12878 super.OnStoreSave(ctx);
12879
12880 PlayerBase player;
12881 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12882 {
12884
12885 int itemQBIndex = -1;
12886 itemQBIndex = player.FindQuickBarEntityIndex(this);
12887 ctx.
Write(itemQBIndex);
12888 }
12889 else
12890 {
12892 }
12893
12895
12897 if (raib)
12898 {
12900 }
12901 }
12902
12903
12905 {
12906 super.AfterStoreLoad();
12907
12909 {
12911 }
12912
12914 {
12917 }
12918 }
12919
12921 {
12922 super.EEOnAfterLoad();
12923
12925 {
12927 }
12928
12931 }
12932
12934 {
12935 return false;
12936 }
12937
12938
12939
12941 {
12943 {
12944 #ifdef PLATFORM_CONSOLE
12945
12947 {
12949 if (menu)
12950 {
12952 }
12953 }
12954 #endif
12955 }
12956
12958 {
12961 }
12962
12964 {
12965 SetWeightDirty();
12967 }
12969 {
12972 }
12973
12975 {
12978
12981 }
12983 {
12987 }
12988
12989 super.OnVariablesSynchronized();
12990 }
12991
12992
12993
12995 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12996 {
12997 if (!IsServerCheck(allow_client))
12998 return false;
12999
13001 return false;
13002
13005
13006 if (value <= (min + 0.001))
13007 value = min;
13008
13009 if (value == min)
13010 {
13011 if (destroy_config)
13012 {
13013 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13014 if (dstr)
13015 {
13017 this.Delete();
13018 return true;
13019 }
13020 }
13021 else if (destroy_forced)
13022 {
13024 this.Delete();
13025 return true;
13026 }
13027
13029 }
13030
13033
13035 {
13036 EntityAI parent = GetHierarchyRoot();
13037 InventoryLocation iLoc = new InventoryLocation();
13038 GetInventory().GetCurrentInventoryLocation(iLoc);
13040 {
13041 int iLocSlot = iLoc.
GetSlot();
13043 {
13045 }
13047 {
13049 }
13050 }
13051 }
13052
13054 {
13056
13057 if (delta)
13059 }
13060
13062
13063 return false;
13064 }
13065
13066
13068 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13069 {
13071 }
13072
13074 {
13077 }
13078
13080 {
13083 }
13084
13086 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13087 {
13088 float value_clamped = Math.Clamp(value, 0, 1);
13090 SetQuantity(result, destroy_config, destroy_forced);
13091 }
13092
13093
13096 {
13098 }
13099
13101 {
13103 }
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13115 {
13116 int slot = -1;
13117 GameInventory inventory = GetInventory();
13118 if (inventory)
13119 {
13120 InventoryLocation il = new InventoryLocation;
13123 }
13124
13126 }
13127
13129 {
13130 float quantity_max = 0;
13131
13133 {
13134 if (attSlotID != -1)
13135 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13136
13137 if (quantity_max <= 0)
13139 }
13140
13141 if (quantity_max <= 0)
13143
13144 return quantity_max;
13145 }
13146
13148 {
13150 }
13151
13153 {
13155 }
13156
13157
13159 {
13161 }
13162
13164 {
13166 }
13167
13169 {
13171 }
13172
13173
13175 {
13176
13177 float weightEx = GetWeightEx();
13178 float special = GetInventoryAndCargoWeight();
13179 return weightEx - special;
13180 }
13181
13182
13184 {
13186 }
13187
13189 {
13191 {
13192 #ifdef DEVELOPER
13193 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13194 {
13195 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13197 }
13198 #endif
13199
13200 return GetQuantity() * GetConfigWeightModified();
13201 }
13202 else if (HasEnergyManager())
13203 {
13204 #ifdef DEVELOPER
13205 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13206 {
13207 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13208 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13209 }
13210 #endif
13211 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13212 }
13213 else
13214 {
13215 #ifdef DEVELOPER
13216 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13217 {
13218 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13219 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13220 }
13221 #endif
13222 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13223 }
13224 }
13225
13228 {
13229 int item_count = 0;
13231
13232 GameInventory inventory = GetInventory();
13233 CargoBase cargo = inventory.
GetCargo();
13234 if (cargo != NULL)
13235 {
13237 }
13238
13240 for (int i = 0; i < nAttachments; ++i)
13241 {
13243 if (item)
13244 item_count += item.GetNumberOfItems();
13245 }
13246 return item_count;
13247 }
13248
13251 {
13252 float weight = 0;
13253 float wetness = 1;
13254 if (include_wetness)
13257 {
13258 weight = wetness * m_ConfigWeight;
13259 }
13261 {
13262 weight = 1;
13263 }
13264 return weight;
13265 }
13266
13267
13268
13270 {
13271 GameInventory inventory = GetInventory();
13272 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13273 {
13274 array<EntityAI> items = new array<EntityAI>;
13276 for (int i = 0; i < items.Count(); ++i)
13277 {
13279 if (item)
13280 {
13281 g_Game.ObjectDelete(item);
13282 }
13283 }
13284 }
13285 }
13286
13287
13288
13289
13291 {
13292 float energy = 0;
13293 if (HasEnergyManager())
13294 {
13295 energy = GetCompEM().GetEnergy();
13296 }
13297 return energy;
13298 }
13299
13300
13302 {
13303 super.OnEnergyConsumed();
13304
13306 }
13307
13309 {
13310 super.OnEnergyAdded();
13311
13313 }
13314
13315
13317 {
13318 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13319 {
13321 {
13322 float energy_0to1 = GetCompEM().GetEnergy0To1();
13324 }
13325 }
13326 }
13327
13328
13330 {
13331 return ConfigGetFloat("heatIsolation");
13332 }
13333
13335 {
13337 }
13338
13340 {
13341 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13342 if (
g_Game.ConfigIsExisting(paramPath))
13343 return g_Game.ConfigGetFloat(paramPath);
13344
13345 return 0.0;
13346 }
13347
13349 {
13350 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13351 if (
g_Game.ConfigIsExisting(paramPath))
13352 return g_Game.ConfigGetFloat(paramPath);
13353
13354 return 0.0;
13355 }
13356
13357 override void SetWet(
float value,
bool allow_client =
false)
13358 {
13359 if (!IsServerCheck(allow_client))
13360 return;
13361
13364
13366
13367 m_VarWet = Math.Clamp(value, min, max);
13368
13370 {
13373 }
13374 }
13375
13376 override void AddWet(
float value)
13377 {
13379 }
13380
13382 {
13384 }
13385
13387 {
13389 }
13390
13392 {
13394 }
13395
13397 {
13399 }
13400
13402 {
13404 }
13405
13406 override void OnWetChanged(
float newVal,
float oldVal)
13407 {
13410 if (newLevel != oldLevel)
13411 {
13413 }
13414 }
13415
13417 {
13418 SetWeightDirty();
13419 }
13420
13422 {
13423 return GetWetLevelInternal(
m_VarWet);
13424 }
13425
13426
13427
13429 {
13431 }
13432
13434 {
13436 }
13437
13439 {
13441 }
13442
13444 {
13446 }
13447
13448
13449
13451 {
13452 if (ConfigIsExisting("itemModelLength"))
13453 {
13454 return ConfigGetFloat("itemModelLength");
13455 }
13456 return 0;
13457 }
13458
13460 {
13461 if (ConfigIsExisting("itemAttachOffset"))
13462 {
13463 return ConfigGetFloat("itemAttachOffset");
13464 }
13465 return 0;
13466 }
13467
13468 override void SetCleanness(
int value,
bool allow_client =
false)
13469 {
13470 if (!IsServerCheck(allow_client))
13471 return;
13472
13474
13476
13479 }
13480
13482 {
13484 }
13485
13487 {
13488 return true;
13489 }
13490
13491
13492
13493
13495 {
13497 }
13498
13500 {
13502 }
13503
13504
13505
13506
13507 override void SetColor(
int r,
int g,
int b,
int a)
13508 {
13514 }
13516 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13517 {
13522 }
13523
13525 {
13527 }
13528
13531 {
13532 int r,g,b,a;
13534 r = r/255;
13535 g = g/255;
13536 b = b/255;
13537 a = a/255;
13538 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13539 }
13540
13541
13542
13543 override void SetLiquidType(
int value,
bool allow_client =
false)
13544 {
13545 if (!IsServerCheck(allow_client))
13546 return;
13547
13552 }
13553
13555 {
13556 return ConfigGetInt("varLiquidTypeInit");
13557 }
13558
13560 {
13562 }
13563
13565 {
13567 SetFrozen(false);
13568 }
13569
13572 {
13573 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13574 }
13575
13576
13579 {
13580 PlayerBase nplayer;
13581 if (PlayerBase.CastTo(nplayer, player))
13582 {
13584 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13585 }
13586 }
13587
13588
13591 {
13592 PlayerBase nplayer;
13593 if (PlayerBase.CastTo(nplayer,player))
13594 {
13595 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13596 }
13597
13598 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13599
13600 if (HasEnergyManager())
13601 {
13602 GetCompEM().UpdatePlugState();
13603 }
13604 }
13605
13606
13608 {
13609 super.OnPlacementStarted(player);
13610
13612 }
13613
13614 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13615 {
13617 {
13618 m_AdminLog.OnPlacementComplete(player,
this);
13619 }
13620
13621 super.OnPlacementComplete(player, position, orientation);
13622 }
13623
13624
13625
13626
13627
13629 {
13631 {
13632 return true;
13633 }
13634 else
13635 {
13636 return false;
13637 }
13638 }
13639
13640
13642 {
13644 {
13646 }
13647 }
13648
13649
13651 {
13653 }
13654
13656 {
13658 }
13659
13660 override void InsertAgent(
int agent,
float count = 1)
13661 {
13662 if (count < 1)
13663 return;
13664
13666 }
13667
13670 {
13672 }
13673
13674
13676 {
13678 }
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13722 {
13724 return false;
13725 return true;
13726 }
13727
13729 {
13730
13732 }
13733
13734
13737 {
13738 super.CheckForRoofLimited(timeTresholdMS);
13739
13740 float time =
g_Game.GetTime();
13741 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13742 {
13743 m_PreviousRoofTestTime = time;
13744 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13745 }
13746 }
13747
13748
13750 {
13752 {
13753 return 0;
13754 }
13755
13756 if (GetInventory().GetAttachmentSlotsCount() != 0)
13757 {
13758 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13759 if (filter)
13760 return filter.GetProtectionLevel(type, false, system);
13761 else
13762 return 0;
13763 }
13764
13765 string subclassPath, entryName;
13766
13767 switch (type)
13768 {
13770 entryName = "biological";
13771 break;
13773 entryName = "chemical";
13774 break;
13775 default:
13776 entryName = "biological";
13777 break;
13778 }
13779
13780 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13781
13782 return g_Game.ConfigGetFloat(subclassPath + entryName);
13783 }
13784
13785
13786
13789 {
13790 if (!IsMagazine())
13792
13794 }
13795
13796
13797
13798
13799
13804 {
13805 return true;
13806 }
13807
13809 {
13811 }
13812
13813
13814
13815
13816
13818 {
13819 if (parent)
13820 {
13821 if (parent.IsInherited(DayZInfected))
13822 return true;
13823
13824 if (!parent.IsRuined())
13825 return true;
13826 }
13827
13828 return true;
13829 }
13830
13832 {
13833 if (!super.CanPutAsAttachment(parent))
13834 {
13835 return false;
13836 }
13837
13838 if (!IsRuined() && !parent.IsRuined())
13839 {
13840 return true;
13841 }
13842
13843 return false;
13844 }
13845
13847 {
13848
13849
13850
13851
13852 return super.CanReceiveItemIntoCargo(item);
13853 }
13854
13856 {
13857
13858
13859
13860
13861 GameInventory attachmentInv = attachment.GetInventory();
13863 {
13864 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13865 return false;
13866 }
13867
13868 InventoryLocation loc = new InventoryLocation();
13869 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13870 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13871 return false;
13872
13873 return super.CanReceiveAttachment(attachment, slotId);
13874 }
13875
13877 {
13878 if (!super.CanReleaseAttachment(attachment))
13879 return false;
13880
13881 return GetInventory().AreChildrenAccessible();
13882 }
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13905 {
13906 int id = muzzle_owner.GetMuzzleID();
13907 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13908
13909 if (WPOF_array)
13910 {
13911 for (int i = 0; i < WPOF_array.Count(); i++)
13912 {
13913 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13914
13915 if (WPOF)
13916 {
13917 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13918 }
13919 }
13920 }
13921 }
13922
13923
13925 {
13926 int id = muzzle_owner.GetMuzzleID();
13928
13929 if (WPOBE_array)
13930 {
13931 for (int i = 0; i < WPOBE_array.Count(); i++)
13932 {
13933 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13934
13935 if (WPOBE)
13936 {
13937 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13938 }
13939 }
13940 }
13941 }
13942
13943
13945 {
13946 int id = muzzle_owner.GetMuzzleID();
13947 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13948
13949 if (WPOOH_array)
13950 {
13951 for (int i = 0; i < WPOOH_array.Count(); i++)
13952 {
13953 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13954
13955 if (WPOOH)
13956 {
13957 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13958 }
13959 }
13960 }
13961 }
13962
13963
13965 {
13966 int id = muzzle_owner.GetMuzzleID();
13967 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13968
13969 if (WPOOH_array)
13970 {
13971 for (int i = 0; i < WPOOH_array.Count(); i++)
13972 {
13973 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13974
13975 if (WPOOH)
13976 {
13977 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13978 }
13979 }
13980 }
13981 }
13982
13983
13985 {
13986 int id = muzzle_owner.GetMuzzleID();
13987 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13988
13989 if (WPOOH_array)
13990 {
13991 for (int i = 0; i < WPOOH_array.Count(); i++)
13992 {
13993 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13994
13995 if (WPOOH)
13996 {
13997 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13998 }
13999 }
14000 }
14001 }
14002
14003
14004
14006 {
14008 {
14009 return true;
14010 }
14011
14012 return false;
14013 }
14014
14016 {
14018 {
14019 return true;
14020 }
14021
14022 return false;
14023 }
14024
14026 {
14028 {
14029 return true;
14030 }
14031
14032 return false;
14033 }
14034
14036 {
14037 return false;
14038 }
14039
14042 {
14043 return UATimeSpent.DEFAULT_DEPLOY;
14044 }
14045
14046
14047
14048
14050 {
14052 SetSynchDirty();
14053 }
14054
14056 {
14058 }
14059
14060
14062 {
14063 return false;
14064 }
14065
14068 {
14069 string att_type = "None";
14070
14071 if (ConfigIsExisting("soundAttType"))
14072 {
14073 att_type = ConfigGetString("soundAttType");
14074 }
14075
14077 }
14078
14080 {
14082 }
14083
14084
14085
14086
14087
14093
14095 {
14098
14100 }
14101
14102
14104 {
14106 return;
14107
14109
14112
14115
14116 SoundParameters params = new SoundParameters();
14120 }
14121
14122
14124 {
14126 {
14129
14130 SetSynchDirty();
14131
14134 }
14135 }
14136
14138 {
14140 }
14141
14142
14144 {
14146 return;
14147
14149 SetSynchDirty();
14150
14153 }
14154
14156 {
14159 }
14160
14162 {
14164 }
14165
14166 void OnApply(PlayerBase player);
14167
14169 {
14170 return 1.0;
14171 };
14172
14174 {
14176 }
14177
14179 {
14181 }
14182
14184
14186 {
14187 SetDynamicPhysicsLifeTime(0.01);
14189 }
14190
14192 {
14193 array<string> zone_names = new array<string>;
14194 GetDamageZones(zone_names);
14195 for (int i = 0; i < zone_names.Count(); i++)
14196 {
14197 SetHealthMax(zone_names.Get(i),"Health");
14198 }
14199 SetHealthMax("","Health");
14200 }
14201
14204 {
14205 float global_health = GetHealth01("","Health");
14206 array<string> zones = new array<string>;
14207 GetDamageZones(zones);
14208
14209 for (int i = 0; i < zones.Count(); i++)
14210 {
14211 SetHealth01(zones.Get(i),"Health",global_health);
14212 }
14213 }
14214
14217 {
14218 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14219 }
14220
14222 {
14223 if (!hasRootAsPlayer)
14224 {
14225 if (refParentIB)
14226 {
14227
14228 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14229 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14230
14231 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14232 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14233
14236 }
14237 else
14238 {
14239
14242 }
14243 }
14244 }
14245
14247 {
14249 {
14250 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14251 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14252 {
14253 float heatPermCoef = 1.0;
14255 while (ent)
14256 {
14257 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14258 ent = ent.GetHierarchyParent();
14259 }
14260
14261 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14262 }
14263 }
14264 }
14265
14267 {
14268
14269 EntityAI parent = GetHierarchyParent();
14270 if (!parent)
14271 {
14272 hasParent = false;
14273 hasRootAsPlayer = false;
14274 }
14275 else
14276 {
14277 hasParent = true;
14278 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14279 refParentIB =
ItemBase.Cast(parent);
14280 }
14281 }
14282
14283 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14284 {
14285
14286 }
14287
14289 {
14290
14291 return false;
14292 }
14293
14295 {
14296
14297
14298 return false;
14299 }
14300
14302 {
14303
14304 return false;
14305 }
14306
14309 {
14310 return !GetIsFrozen() &&
IsOpen();
14311 }
14312
14314 {
14315 bool hasParent = false, hasRootAsPlayer = false;
14317
14318 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14319 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14320
14321 if (wwtu || foodDecay)
14322 {
14326
14327 if (processWetness || processTemperature || processDecay)
14328 {
14330
14331 if (processWetness)
14332 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14333
14334 if (processTemperature)
14336
14337 if (processDecay)
14338 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14339 }
14340 }
14341 }
14342
14345 {
14347 }
14348
14350 {
14353
14354 return super.GetTemperatureFreezeThreshold();
14355 }
14356
14358 {
14361
14362 return super.GetTemperatureThawThreshold();
14363 }
14364
14366 {
14369
14370 return super.GetItemOverheatThreshold();
14371 }
14372
14374 {
14376 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14377
14378 return super.GetTemperatureFreezeTime();
14379 }
14380
14382 {
14384 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14385
14386 return super.GetTemperatureThawTime();
14387 }
14388
14393
14395 {
14396 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14397 }
14398
14400 {
14401 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14402 }
14403
14406 {
14408 }
14409
14411 {
14413 }
14414
14416 {
14418 }
14419
14422 {
14423 return null;
14424 }
14425
14428 {
14429 return false;
14430 }
14431
14433 {
14435 {
14438 if (!trg)
14439 {
14441 explosive = this;
14442 }
14443
14444 explosive.PairRemote(trg);
14446
14447 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14448 trg.SetPersistentPairID(persistentID);
14449 explosive.SetPersistentPairID(persistentID);
14450
14451 return true;
14452 }
14453 return false;
14454 }
14455
14458 {
14459 float ret = 1.0;
14462 ret *= GetHealth01();
14463
14464 return ret;
14465 }
14466
14467 #ifdef DEVELOPER
14468 override void SetDebugItem()
14469 {
14470 super.SetDebugItem();
14471 _itemBase = this;
14472 }
14473
14475 {
14476 string text = super.GetDebugText();
14477
14479 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14480
14481 return text;
14482 }
14483 #endif
14484
14486 {
14487 return true;
14488 }
14489
14491
14493
14495 {
14498 }
14499
14500
14508
14524
14525 [
Obsolete(
"Use ItemSoundHandler instead")]
14528 {
14529 if (!
g_Game.IsDedicatedServer())
14530 {
14531 if (ConfigIsExisting("attachSoundSet"))
14532 {
14533 string cfg_path = "";
14534 string soundset = "";
14535 string type_name =
GetType();
14536
14539 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14540 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14541
14542 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14543 {
14544 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14545 {
14546 if (cfg_slot_array[i] == slot_type)
14547 {
14548 soundset = cfg_soundset_array[i];
14549 break;
14550 }
14551 }
14552 }
14553
14554 if (soundset != "")
14555 {
14556 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14558 }
14559 }
14560 }
14561 }
14562
14564}
14565
14567{
14569 if (entity)
14570 {
14571 bool is_item = entity.IsInherited(
ItemBase);
14572 if (is_item && full_quantity)
14573 {
14576 }
14577 }
14578 else
14579 {
14581 return NULL;
14582 }
14583 return entity;
14584}
14585
14587{
14588 if (item)
14589 {
14590 if (health > 0)
14591 item.SetHealth("", "", health);
14592
14593 if (item.CanHaveTemperature())
14594 {
14596 if (item.CanFreeze())
14597 item.SetFrozen(false);
14598 }
14599
14600 if (item.HasEnergyManager())
14601 {
14602 if (quantity >= 0)
14603 {
14604 item.GetCompEM().SetEnergy0To1(quantity);
14605 }
14606 else
14607 {
14609 }
14610 }
14611 else if (item.IsMagazine())
14612 {
14613 Magazine mag = Magazine.Cast(item);
14614 if (quantity >= 0)
14615 {
14616 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14617 }
14618 else
14619 {
14621 }
14622
14623 }
14624 else
14625 {
14626 if (quantity >= 0)
14627 {
14628 item.SetQuantityNormalized(quantity, false);
14629 }
14630 else
14631 {
14633 }
14634
14635 }
14636 }
14637}
14638
14639#ifdef DEVELOPER
14641#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.