9584{
9586 {
9587 return true;
9588 }
9589};
9590
9592{
9593
9594};
9595
9596
9597
9599{
9603
9605
9608
9609
9610
9611
9612
9621
9627
9632
9637
9658 protected bool m_IsResultOfSplit
9659
9661
9666
9667
9668
9670
9674
9675
9676
9678
9681
9682
9683
9689
9690
9698
9701
9702
9704
9705
9707
9708
9713
9714
9719
9721
9722
9724
9725
9727 {
9732
9733 if (!
g_Game.IsDedicatedServer())
9734 {
9736 {
9738
9740 {
9742 }
9743 }
9744
9747 }
9748
9749 m_OldLocation = null;
9750
9752 {
9754 }
9755
9756 if (ConfigIsExisting("headSelectionsToHide"))
9757 {
9760 }
9761
9763 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9764 {
9766 }
9767
9769
9770 m_IsResultOfSplit = false;
9771
9773 }
9774
9776 {
9777 super.InitItemVariables();
9778
9784 m_Count = ConfigGetInt(
"count");
9785
9788
9793
9796
9801
9813
9817
9818
9821 if (ConfigIsExisting("canBeSplit"))
9822 {
9825 }
9826
9828 if (ConfigIsExisting("itemBehaviour"))
9830
9831
9834 RegisterNetSyncVariableInt("m_VarLiquidType");
9835 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9836
9837 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9838 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9839 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9840
9841 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9842 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9843 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9844 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9845
9846 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9847 RegisterNetSyncVariableBool("m_IsTakeable");
9848 RegisterNetSyncVariableBool("m_IsHologram");
9849
9852 {
9855 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9856 }
9857
9859
9861 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9863
9865 }
9866
9868 {
9870 }
9871
9873 {
9876 {
9881 }
9882 }
9883
9884 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9885 {
9887 {
9890 }
9891
9893 }
9894
9896 {
9902 }
9903
9905
9907 {
9909
9910 if (!action)
9911 {
9912 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9913 return;
9914 }
9915
9917 if (!ai)
9918 {
9920 return;
9921 }
9922
9924 if (!action_array)
9925 {
9926 action_array = new array<ActionBase_Basic>;
9928 }
9929 if (LogManager.IsActionLogEnable())
9930 {
9931 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9932 }
9933
9934 if (action_array.Find(action) != -1)
9935 {
9936 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9937 }
9938 else
9939 {
9940 action_array.Insert(action);
9941 }
9942 }
9943
9945 {
9946 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9947 ActionBase action = player.GetActionManager().GetAction(actionName);
9950
9951 if (action_array)
9952 {
9953 action_array.RemoveItem(action);
9954 }
9955 }
9956
9957
9958
9960 {
9961 ActionOverrideData overrideData = new ActionOverrideData();
9965
9967 if (!actionMap)
9968 {
9971 }
9972
9973 actionMap.Insert(this.
Type(), overrideData);
9974
9975 }
9976
9978
9980
9981
9983 {
9986
9989
9990 string config_to_search = "CfgVehicles";
9991 string muzzle_owner_config;
9992
9994 {
9995 if (IsInherited(Weapon))
9996 config_to_search = "CfgWeapons";
9997
9998 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9999
10000 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10001
10002 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10003
10004 if (config_OnFire_subclass_count > 0)
10005 {
10006 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10007
10008 for (int i = 0; i < config_OnFire_subclass_count; i++)
10009 {
10010 string particle_class = "";
10011 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10012 string config_OnFire_entry = config_OnFire_class + particle_class;
10013 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10014 WPOF_array.Insert(WPOF);
10015 }
10016
10017
10019 }
10020 }
10021
10023 {
10024 config_to_search = "CfgWeapons";
10025 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10026
10027 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10028
10029 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10030
10031 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10032 {
10033 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10034
10035 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10036 {
10037 string particle_class2 = "";
10038 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10039 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10040 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10041 WPOBE_array.Insert(WPOBE);
10042 }
10043
10044
10046 }
10047 }
10048 }
10049
10050
10052 {
10055
10057 {
10058 string config_to_search = "CfgVehicles";
10059
10060 if (IsInherited(Weapon))
10061 config_to_search = "CfgWeapons";
10062
10063 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10064 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10065
10066 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10067 {
10068
10070
10072 {
10074 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10076 return;
10077 }
10078
10081
10082
10083
10084 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10085 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10086
10087 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10088 {
10089 string particle_class = "";
10090 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10091 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10092 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10093
10094 if (entry_type == CT_CLASS)
10095 {
10096 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10097 WPOOH_array.Insert(WPOF);
10098 }
10099 }
10100
10101
10103 }
10104 }
10105 }
10106
10108 {
10110 }
10111
10113 {
10115 {
10117
10120
10123
10124 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10125 }
10126 }
10127
10129 {
10131 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10132
10134 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10135
10137 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10138
10140 {
10142 }
10143 }
10144
10146 {
10148 }
10149
10151 {
10154 else
10156
10158 {
10161 }
10162 else
10163 {
10166
10169 }
10170
10172 }
10173
10175 {
10177 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10178 }
10179
10181 {
10183 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10185 }
10186
10188 {
10190 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10191 }
10192
10194 {
10197
10198 OverheatingParticle OP = new OverheatingParticle();
10203
10205 }
10206
10208 {
10211
10212 return -1;
10213 }
10214
10216 {
10218 {
10221
10222 for (int i = count; i > 0; --i)
10223 {
10224 int id = i - 1;
10227
10230
10231 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10232 {
10233 if (p)
10234 {
10237 }
10238 }
10239 }
10240 }
10241 }
10242
10244 {
10246 {
10248 {
10249 int id = i - 1;
10251
10252 if (OP)
10253 {
10255
10256 if (p)
10257 {
10259 }
10260
10261 delete OP;
10262 }
10263 }
10264
10267 }
10268 }
10269
10272 {
10273 return 0.0;
10274 }
10275
10276
10278 {
10279 return 250;
10280 }
10281
10283 {
10284 return 0;
10285 }
10286
10289 {
10291 return true;
10292
10293 return false;
10294 }
10295
10298 {
10301
10303 {
10305 }
10306 else
10307 {
10308
10310 }
10311
10313 }
10314
10321 {
10322 return -1;
10323 }
10324
10325
10326
10327
10329 {
10331 {
10332 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10333 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10334
10335 if (r_index >= 0)
10336 {
10337 InventoryLocation r_il = new InventoryLocation;
10338 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10339
10340 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10343 {
10344 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10345 }
10347 {
10348 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10349 }
10350
10351 }
10352
10353 player.GetHumanInventory().ClearUserReservedLocation(this);
10354 }
10355
10358 }
10359
10360
10361
10362
10364 {
10365 return ItemBase.m_DebugActionsMask;
10366 }
10367
10369 {
10370 return ItemBase.m_DebugActionsMask & mask;
10371 }
10372
10374 {
10375 ItemBase.m_DebugActionsMask = mask;
10376 }
10377
10379 {
10380 ItemBase.m_DebugActionsMask |= mask;
10381 }
10382
10384 {
10385 ItemBase.m_DebugActionsMask &= ~mask;
10386 }
10387
10389 {
10391 {
10393 }
10394 else
10395 {
10397 }
10398 }
10399
10400
10402 {
10403 if (GetEconomyProfile())
10404 {
10405 float q_max = GetEconomyProfile().GetQuantityMax();
10406 if (q_max > 0)
10407 {
10408 float q_min = GetEconomyProfile().GetQuantityMin();
10409 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10410
10412 {
10413 ComponentEnergyManager comp = GetCompEM();
10415 {
10417 }
10418 }
10420 {
10422
10423 }
10424
10425 }
10426 }
10427 }
10428
10431 {
10432 EntityAI parent = GetHierarchyParent();
10433
10434 if (parent)
10435 {
10436 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10437 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10438 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10439 }
10440 }
10441
10444 {
10445 EntityAI parent = GetHierarchyParent();
10446
10447 if (parent)
10448 {
10449 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10450 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10451 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10452 }
10453 }
10454
10456 {
10457
10458
10459
10460
10462
10464 {
10465 if (ScriptInputUserData.CanStoreInputUserData())
10466 {
10467 ScriptInputUserData ctx = new ScriptInputUserData;
10473 ctx.
Write(use_stack_max);
10476
10478 {
10479 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10480 }
10481 }
10482 }
10483 else if (!
g_Game.IsMultiplayer())
10484 {
10486 }
10487 }
10488
10490 {
10492 }
10493
10495 {
10497 }
10498
10500 {
10502 }
10503
10505 {
10506
10507 return false;
10508 }
10509
10511 {
10512 return false;
10513 }
10514
10518 {
10519 return false;
10520 }
10521
10523 {
10524 return "";
10525 }
10526
10528
10530 {
10531 return false;
10532 }
10533
10535 {
10536 return true;
10537 }
10538
10539
10540
10542 {
10543 return true;
10544 }
10545
10547 {
10548 return true;
10549 }
10550
10552 {
10553 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10555 }
10556
10558 {
10560 }
10561
10563 {
10565 if (!is_being_placed)
10567 SetSynchDirty();
10568 }
10569
10570
10572
10574 {
10576 }
10577
10579 {
10581 }
10582
10584 {
10585 return 1;
10586 }
10587
10589 {
10590 return false;
10591 }
10592
10594 {
10596 SetSynchDirty();
10597 }
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10634 {
10635 super.OnMovedInsideCargo(container);
10636
10637 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10638 }
10639
10640 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10641 {
10642 super.EEItemLocationChanged(oldLoc, newLoc);
10643
10644 PlayerBase newPlayer = null;
10645 PlayerBase oldPlayer = null;
10646
10647 if (newLoc.GetParent())
10648 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10649
10650 if (oldLoc.GetParent())
10651 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10652
10654 {
10655 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10656
10657 if (rIndex >= 0)
10658 {
10659 InventoryLocation rIl = new InventoryLocation;
10660 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10661
10662 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10665 {
10666 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10667 }
10669 {
10671 }
10672
10673 }
10674 }
10675
10677 {
10678 if (newPlayer)
10679 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10680
10681 if (newPlayer == oldPlayer)
10682 {
10683 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10684 {
10686 {
10687 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10688 {
10689 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10690 }
10691 }
10692 else
10693 {
10694 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10695 }
10696 }
10697
10698 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10699 {
10700 int type = oldLoc.GetType();
10702 {
10703 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10704 }
10706 {
10707 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10708 }
10709 }
10710 if (!m_OldLocation)
10711 {
10712 m_OldLocation = new InventoryLocation;
10713 }
10714 m_OldLocation.Copy(oldLoc);
10715 }
10716 else
10717 {
10718 if (m_OldLocation)
10719 {
10720 m_OldLocation.Reset();
10721 }
10722 }
10723
10724 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10725 }
10726 else
10727 {
10728 if (newPlayer)
10729 {
10730 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10731 if (resIndex >= 0)
10732 {
10733 InventoryLocation il = new InventoryLocation;
10734 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10736 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10739 {
10740 il.
GetParent().GetOnReleaseLock().Invoke(it);
10741 }
10743 {
10745 }
10746
10747 }
10748 }
10750 {
10751
10753 }
10754
10755 if (m_OldLocation)
10756 {
10757 m_OldLocation.Reset();
10758 }
10759 }
10760
10762 {
10763 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10764 }
10765
10767 {
10768 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10769 }
10770 }
10771
10772 override void EOnContact(IEntity other, Contact extra)
10773 {
10775 {
10776 int liquidType = -1;
10778 if (impactSpeed > 0.0)
10779 {
10781 #ifndef SERVER
10783 #else
10785 SetSynchDirty();
10786 #endif
10788 }
10789 }
10790
10791 #ifdef SERVER
10792 if (GetCompEM() && GetCompEM().IsPlugged())
10793 {
10794 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10795 GetCompEM().UnplugThis();
10796 }
10797 #endif
10798 }
10799
10801
10803 {
10805 }
10806
10808 {
10809
10810 }
10811
10813 {
10814 super.OnItemLocationChanged(old_owner, new_owner);
10815
10816 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10817 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10818
10819 if (!relatedPlayer && playerNew)
10820 relatedPlayer = playerNew;
10821
10822 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10823 {
10825 if (actionMgr)
10826 {
10827 ActionBase currentAction = actionMgr.GetRunningAction();
10828 if (currentAction)
10830 }
10831 }
10832
10833 Man ownerPlayerOld = null;
10834 Man ownerPlayerNew = null;
10835
10836 if (old_owner)
10837 {
10838 if (old_owner.
IsMan())
10839 {
10840 ownerPlayerOld = Man.Cast(old_owner);
10841 }
10842 else
10843 {
10844 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10845 }
10846 }
10847 else
10848 {
10850 {
10852
10853 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10854 {
10855 GetCompEM().UnplugThis();
10856 }
10857 }
10858 }
10859
10860 if (new_owner)
10861 {
10862 if (new_owner.
IsMan())
10863 {
10864 ownerPlayerNew = Man.Cast(new_owner);
10865 }
10866 else
10867 {
10868 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10869 }
10870 }
10871
10872 if (ownerPlayerOld != ownerPlayerNew)
10873 {
10874 if (ownerPlayerOld)
10875 {
10876 array<EntityAI> subItemsExit = new array<EntityAI>;
10878 for (int i = 0; i < subItemsExit.Count(); i++)
10879 {
10882 }
10883 }
10884
10885 if (ownerPlayerNew)
10886 {
10887 array<EntityAI> subItemsEnter = new array<EntityAI>;
10889 for (int j = 0; j < subItemsEnter.Count(); j++)
10890 {
10893 }
10894 }
10895 }
10896 else if (ownerPlayerNew != null)
10897 {
10898 PlayerBase nplayer;
10899 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10900 {
10901 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10903 for (int k = 0; k < subItemsUpdate.Count(); k++)
10904 {
10906 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10907 }
10908 }
10909 }
10910
10911 if (old_owner)
10912 old_owner.OnChildItemRemoved(this);
10913 if (new_owner)
10914 new_owner.OnChildItemReceived(this);
10915 }
10916
10917
10919 {
10920 super.EEDelete(parent);
10921 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10922 if (player)
10923 {
10925
10926 if (player.IsAlive())
10927 {
10928 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10929 if (r_index >= 0)
10930 {
10931 InventoryLocation r_il = new InventoryLocation;
10932 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10933
10934 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10937 {
10938 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10939 }
10941 {
10942 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10943 }
10944
10945 }
10946
10947 player.RemoveQuickBarEntityShortcut(this);
10948 }
10949 }
10950 }
10951
10953 {
10954 super.EEKilled(killer);
10955
10958 {
10959 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10960 {
10961 if (IsMagazine())
10962 {
10963 if (Magazine.Cast(this).GetAmmoCount() > 0)
10964 {
10966 }
10967 }
10968 else
10969 {
10971 }
10972 }
10973 }
10974 }
10975
10977 {
10978 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10979
10980 super.OnWasAttached(parent, slot_id);
10981
10984
10987 }
10988
10990 {
10991 super.OnWasDetached(parent, slot_id);
10992
10995
10998 }
10999
11001 {
11002 int idx;
11005
11006 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11007 if (inventory_slots.Count() < 1)
11008 {
11009 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11010 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11011 }
11012 else
11013 {
11014 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11015 }
11016
11017 idx = inventory_slots.Find(slot);
11018 if (idx < 0)
11019 return "";
11020
11021 return attach_types.Get(idx);
11022 }
11023
11025 {
11026 int idx = -1;
11027 string slot;
11028
11031
11032 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11033 if (inventory_slots.Count() < 1)
11034 {
11035 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11036 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11037 }
11038 else
11039 {
11040 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11041 if (detach_types.Count() < 1)
11042 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11043 }
11044
11045 for (int i = 0; i < inventory_slots.Count(); i++)
11046 {
11047 slot = inventory_slots.Get(i);
11048 }
11049
11050 if (slot != "")
11051 {
11052 if (detach_types.Count() == 1)
11053 idx = 0;
11054 else
11055 idx = inventory_slots.Find(slot);
11056 }
11057 if (idx < 0)
11058 return "";
11059
11060 return detach_types.Get(idx);
11061 }
11062
11064 {
11065
11067
11068
11069 float min_time = 1;
11070 float max_time = 3;
11071 float delay = Math.RandomFloat(min_time, max_time);
11072
11073 explode_timer.Run(delay, this, "DoAmmoExplosion");
11074 }
11075
11077 {
11078 Magazine magazine = Magazine.Cast(this);
11079 int pop_sounds_count = 6;
11080 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11081
11082
11083 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11084 string sound_name = pop_sounds[ sound_idx ];
11085 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11086
11087
11088 magazine.ServerAddAmmoCount(-1);
11089
11090
11091 float min_temp_to_explode = 100;
11092
11093 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11094 {
11096 }
11097 }
11098
11099
11100 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11101 {
11102 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11103
11104 const int CHANCE_DAMAGE_CARGO = 4;
11105 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11106 const int CHANCE_DAMAGE_NOTHING = 2;
11107
11109 {
11110 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11111 int chances;
11112 int rnd;
11113
11114 if (GetInventory().GetCargo())
11115 {
11116 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11117 rnd = Math.RandomInt(0,chances);
11118
11119 if (rnd < CHANCE_DAMAGE_CARGO)
11120 {
11122 }
11123 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11124 {
11126 }
11127 }
11128 else
11129 {
11130 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11131 rnd = Math.RandomInt(0,chances);
11132
11133 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11134 {
11136 }
11137 }
11138 }
11139 }
11140
11142 {
11143 CargoBase cargo = GetInventory().GetCargo();
11144 if (cargo)
11145 {
11147 if (item_count > 0)
11148 {
11149 int random_pick = Math.RandomInt(0, item_count);
11151 if (!item.IsExplosive())
11152 {
11153 item.AddHealth("","",damage);
11154 return true;
11155 }
11156 }
11157 }
11158 return false;
11159 }
11160
11162 {
11163 GameInventory inventory = GetInventory();
11165 if (attachment_count > 0)
11166 {
11167 int random_pick = Math.RandomInt(0, attachment_count);
11169 if (!attachment.IsExplosive())
11170 {
11171 attachment.AddHealth("","",damage);
11172 return true;
11173 }
11174 }
11175 return false;
11176 }
11177
11179 {
11181 }
11182
11184 {
11186 return GetInventory().CanRemoveEntity();
11187
11188 return false;
11189 }
11190
11192 {
11193
11195 return false;
11196
11197
11199 return false;
11200
11201
11202
11204 if (delta == 0)
11205 return false;
11206
11207
11208 return true;
11209 }
11210
11212 {
11214 {
11215 if (ScriptInputUserData.CanStoreInputUserData())
11216 {
11217 ScriptInputUserData ctx = new ScriptInputUserData;
11222 ctx.
Write(destination_entity);
11224 ctx.
Write(slot_id);
11226 }
11227 }
11228 else if (!
g_Game.IsMultiplayer())
11229 {
11231 }
11232 }
11233
11235 {
11236 float split_quantity_new;
11240 InventoryLocation loc = new InventoryLocation;
11241
11242 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11243 {
11245 split_quantity_new = stack_max;
11246 else
11248
11250 {
11251 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11252 if (new_item)
11253 {
11254 new_item.SetResultOfSplit(true);
11255 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11257 new_item.
SetQuantity(split_quantity_new,
false,
true);
11258 }
11259 }
11260 }
11261 else if (destination_entity && slot_id == -1)
11262 {
11263 if (quantity > stack_max)
11264 split_quantity_new = stack_max;
11265 else
11266 split_quantity_new = quantity;
11267
11269 {
11270 GameInventory destinationInventory = destination_entity.GetInventory();
11272 {
11275 }
11276
11277 if (new_item)
11278 {
11279 new_item.SetResultOfSplit(true);
11280 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11282 new_item.
SetQuantity(split_quantity_new,
false,
true);
11283 }
11284 }
11285 }
11286 else
11287 {
11288 if (stack_max != 0)
11289 {
11291 {
11293 }
11294
11295 if (split_quantity_new == 0)
11296 {
11297 if (!
g_Game.IsMultiplayer())
11298 player.PhysicalPredictiveDropItem(this);
11299 else
11300 player.ServerDropEntity(this);
11301 return;
11302 }
11303
11305 {
11307
11308 if (new_item)
11309 {
11310 new_item.SetResultOfSplit(true);
11311 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11314 new_item.PlaceOnSurface();
11315 }
11316 }
11317 }
11318 }
11319 }
11320
11322 {
11323 float split_quantity_new;
11327 InventoryLocation loc = new InventoryLocation;
11328
11329 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11330 {
11332 split_quantity_new = stack_max;
11333 else
11335
11337 {
11338 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11339 if (new_item)
11340 {
11341 new_item.SetResultOfSplit(true);
11342 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11344 new_item.
SetQuantity(split_quantity_new,
false,
true);
11345 }
11346 }
11347 }
11348 else if (destination_entity && slot_id == -1)
11349 {
11350 if (quantity > stack_max)
11351 split_quantity_new = stack_max;
11352 else
11353 split_quantity_new = quantity;
11354
11356 {
11357 GameInventory destinationInventory = destination_entity.GetInventory();
11359 {
11362 }
11363
11364 if (new_item)
11365 {
11366 new_item.SetResultOfSplit(true);
11367 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11369 new_item.
SetQuantity(split_quantity_new,
false,
true);
11370 }
11371 }
11372 }
11373 else
11374 {
11375 if (stack_max != 0)
11376 {
11378 {
11380 }
11381
11383 {
11385
11386 if (new_item)
11387 {
11388 new_item.SetResultOfSplit(true);
11389 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11392 new_item.PlaceOnSurface();
11393 }
11394 }
11395 }
11396 }
11397 }
11398
11400 {
11402 {
11403 if (ScriptInputUserData.CanStoreInputUserData())
11404 {
11405 ScriptInputUserData ctx = new ScriptInputUserData;
11410 dst.WriteToContext(ctx);
11412 }
11413 }
11414 else if (!
g_Game.IsMultiplayer())
11415 {
11417 }
11418 }
11419
11421 {
11423 {
11424 if (ScriptInputUserData.CanStoreInputUserData())
11425 {
11426 ScriptInputUserData ctx = new ScriptInputUserData;
11431 ctx.
Write(destination_entity);
11437 }
11438 }
11439 else if (!
g_Game.IsMultiplayer())
11440 {
11442 }
11443 }
11444
11446 {
11448 }
11449
11451 {
11453 float split_quantity_new;
11455 if (dst.IsValid())
11456 {
11457 int slot_id = dst.GetSlot();
11459
11460 if (quantity > stack_max)
11461 split_quantity_new = stack_max;
11462 else
11463 split_quantity_new = quantity;
11464
11466 {
11468
11469 if (new_item)
11470 {
11471 new_item.SetResultOfSplit(true);
11472 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11474 new_item.
SetQuantity(split_quantity_new,
false,
true);
11475 }
11476
11477 return new_item;
11478 }
11479 }
11480
11481 return null;
11482 }
11483
11485 {
11487 float split_quantity_new;
11489 if (destination_entity)
11490 {
11492 if (quantity > stackable)
11493 split_quantity_new = stackable;
11494 else
11495 split_quantity_new = quantity;
11496
11498 {
11499 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11500 if (new_item)
11501 {
11502 new_item.SetResultOfSplit(true);
11503 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11505 new_item.
SetQuantity(split_quantity_new,
false,
true);
11506 }
11507 }
11508 }
11509 }
11510
11512 {
11514 {
11515 if (ScriptInputUserData.CanStoreInputUserData())
11516 {
11517 ScriptInputUserData ctx = new ScriptInputUserData;
11522 ItemBase destination_entity =
this;
11523 ctx.
Write(destination_entity);
11527 }
11528 }
11529 else if (!
g_Game.IsMultiplayer())
11530 {
11532 }
11533 }
11534
11536 {
11538 float split_quantity_new;
11540 if (player)
11541 {
11543 if (quantity > stackable)
11544 split_quantity_new = stackable;
11545 else
11546 split_quantity_new = quantity;
11547
11549 {
11550 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11551 new_item =
ItemBase.Cast(in_hands);
11552 if (new_item)
11553 {
11554 new_item.SetResultOfSplit(true);
11555 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11557 new_item.SetQuantity(split_quantity_new, false, true);
11558 }
11559 }
11560 }
11561 }
11562
11564 {
11566 float split_quantity_new = Math.Floor(quantity * 0.5);
11567
11569 return;
11570
11572
11573 if (new_item)
11574 {
11575 if (new_item.GetQuantityMax() < split_quantity_new)
11576 {
11577 split_quantity_new = new_item.GetQuantityMax();
11578 }
11579
11580 new_item.SetResultOfSplit(true);
11581 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11582
11584 {
11587 }
11588 else
11589 {
11591 new_item.
SetQuantity(split_quantity_new,
false,
true);
11592 }
11593 }
11594 }
11595
11597 {
11599 float split_quantity_new = Math.Floor(quantity / 2);
11600
11602 return;
11603
11604 InventoryLocation invloc = new InventoryLocation;
11606
11608 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11609
11610 if (new_item)
11611 {
11612 if (new_item.GetQuantityMax() < split_quantity_new)
11613 {
11614 split_quantity_new = new_item.GetQuantityMax();
11615 }
11617 {
11620 }
11621 else if (split_quantity_new > 1)
11622 {
11624 new_item.
SetQuantity(split_quantity_new,
false,
true);
11625 }
11626 }
11627 }
11628
11631 {
11632 SetWeightDirty();
11634
11635 if (parent)
11636 parent.OnAttachmentQuantityChangedEx(this, delta);
11637
11639 {
11641 {
11643 }
11645 {
11646 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11648 }
11649 }
11650 }
11651
11654 {
11655
11656 }
11657
11660 {
11662 }
11663
11665 {
11666 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11667
11669 {
11670 if (newLevel == GameConstants.STATE_RUINED)
11671 {
11673 EntityAI parent = GetHierarchyParent();
11674 if (parent && parent.IsFireplace())
11675 {
11676 CargoBase cargo = GetInventory().GetCargo();
11677 if (cargo)
11678 {
11680 {
11682 }
11683 }
11684 }
11685 }
11686
11688 {
11689
11691 return;
11692 }
11693
11694 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11695 {
11697 }
11698 }
11699 }
11700
11701
11703 {
11704 super.OnRightClick();
11705
11707 {
11709 {
11710 if (ScriptInputUserData.CanStoreInputUserData())
11711 {
11712 EntityAI root = GetHierarchyRoot();
11713 Man playerOwner = GetHierarchyRootPlayer();
11714 InventoryLocation dst = new InventoryLocation;
11715
11716
11717 if (!playerOwner && root && root == this)
11718 {
11720 }
11721 else
11722 {
11723
11724 GetInventory().GetCurrentInventoryLocation(dst);
11726 {
11727 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11729 {
11731 }
11732 else
11733 {
11735
11736
11737 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11738 {
11740 }
11741 else
11742 {
11743 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11744 }
11745 }
11746 }
11747 }
11748
11749 ScriptInputUserData ctx = new ScriptInputUserData;
11757 }
11758 }
11759 else if (!
g_Game.IsMultiplayer())
11760 {
11762 }
11763 }
11764 }
11765
11767 {
11768 if (root)
11769 {
11770 vector m4[4];
11771 root.GetTransform(m4);
11772 dst.SetGround(this, m4);
11773 }
11774 else
11775 {
11776 GetInventory().GetCurrentInventoryLocation(dst);
11777 }
11778 }
11779
11780 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11781 {
11782
11783 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11784 return false;
11785
11786 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11787 return false;
11788
11789
11791 return false;
11792
11793
11794 Magazine mag = Magazine.Cast(this);
11795 if (mag)
11796 {
11797 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11798 return false;
11799
11800 if (stack_max_limit)
11801 {
11802 Magazine other_mag = Magazine.Cast(other_item);
11803 if (other_item)
11804 {
11805 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11806 return false;
11807 }
11808
11809 }
11810 }
11811 else
11812 {
11813
11815 return false;
11816
11818 return false;
11819 }
11820
11821 PlayerBase player = null;
11822 if (CastTo(player, GetHierarchyRootPlayer()))
11823 {
11824 if (player.GetInventory().HasAttachment(this))
11825 return false;
11826
11827 if (player.IsItemsToDelete())
11828 return false;
11829 }
11830
11831 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11832 return false;
11833
11834 int slotID;
11836 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11837 return false;
11838
11839 return true;
11840 }
11841
11843 {
11845 }
11846
11848 {
11849 return m_IsResultOfSplit;
11850 }
11851
11853 {
11854 m_IsResultOfSplit = value;
11855 }
11856
11858 {
11860 }
11861
11863 {
11864 float other_item_quantity = other_item.GetQuantity();
11865 float this_free_space;
11866
11868
11870
11871 if (other_item_quantity > this_free_space)
11872 {
11873 return this_free_space;
11874 }
11875 else
11876 {
11877 return other_item_quantity;
11878 }
11879 }
11880
11882 {
11884 }
11885
11887 {
11889 return;
11890
11891 if (!IsMagazine() && other_item)
11892 {
11894 if (quantity_used != 0)
11895 {
11896 float hp1 = GetHealth01("","");
11897 float hp2 = other_item.GetHealth01("","");
11898 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11899 hpResult = hpResult / (
GetQuantity() + quantity_used);
11900
11901 hpResult *= GetMaxHealth();
11902 Math.Round(hpResult);
11903 SetHealth("", "Health", hpResult);
11904
11906 other_item.AddQuantity(-quantity_used);
11907 }
11908 }
11910 }
11911
11913 {
11914 #ifdef SERVER
11915 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11916 GetHierarchyParent().IncreaseLifetimeUp();
11917 #endif
11918 };
11919
11921 {
11922 PlayerBase p = PlayerBase.Cast(player);
11923
11924 array<int> recipesIds = p.m_Recipes;
11925 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11926 if (moduleRecipesManager)
11927 {
11928 EntityAI itemInHands = player.GetEntityInHands();
11929 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11930 }
11931
11932 for (int i = 0;i < recipesIds.Count(); i++)
11933 {
11934 int key = recipesIds.Get(i);
11935 string recipeName = moduleRecipesManager.GetRecipeName(key);
11937 }
11938 }
11939
11940
11941 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11942 {
11943 super.GetDebugActions(outputList);
11944
11945
11951
11952
11957
11962
11963
11967
11968
11970 {
11974 }
11975
11978
11979
11983
11985
11986 InventoryLocation loc = new InventoryLocation();
11987 GetInventory().GetCurrentInventoryLocation(loc);
11989 {
11990 if (Gizmo_IsSupported())
11993 }
11994
11996 }
11997
11998
11999
12000
12002 {
12003 super.OnAction(action_id, player, ctx);
12004
12006 {
12007 switch (action_id)
12008 {
12012 return true;
12016 return true;
12017 }
12018 }
12019
12021 {
12022 switch (action_id)
12023 {
12025 Delete();
12026 return true;
12027 }
12028 }
12029
12030 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12031 {
12032 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12033 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12034 PlayerBase p = PlayerBase.Cast(player);
12035 if (
EActions.RECIPES_RANGE_START < 1000)
12036 {
12037 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12038 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12039 }
12040 }
12041 #ifndef SERVER
12042 else if (action_id ==
EActions.WATCH_PLAYER)
12043 {
12044 PluginDeveloper.SetDeveloperItemClientEx(player);
12045 }
12046 #endif
12048 {
12049 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12050 {
12051 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12052 OnDebugButtonPressServer(id + 1);
12053 }
12054
12055 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12056 {
12057 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12059 }
12060
12061 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12062 {
12063 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12065 }
12066
12067 else if (action_id ==
EActions.ADD_QUANTITY)
12068 {
12069 if (IsMagazine())
12070 {
12071 Magazine mag = Magazine.Cast(this);
12072 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12073 }
12074 else
12075 {
12077 }
12078
12079 if (m_EM)
12080 {
12081 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12082 }
12083
12084 }
12085
12086 else if (action_id ==
EActions.REMOVE_QUANTITY)
12087 {
12088 if (IsMagazine())
12089 {
12090 Magazine mag2 = Magazine.Cast(this);
12091 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12092 }
12093 else
12094 {
12096 }
12097 if (m_EM)
12098 {
12099 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12100 }
12101
12102 }
12103
12104 else if (action_id ==
EActions.SET_QUANTITY_0)
12105 {
12107
12108 if (m_EM)
12109 {
12110 m_EM.SetEnergy(0);
12111 }
12112 }
12113
12114 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12115 {
12117
12118 if (m_EM)
12119 {
12120 m_EM.SetEnergy(m_EM.GetEnergyMax());
12121 }
12122 }
12123
12124 else if (action_id ==
EActions.ADD_HEALTH)
12125 {
12126 AddHealth("","",GetMaxHealth("","Health")/5);
12127 }
12128 else if (action_id ==
EActions.REMOVE_HEALTH)
12129 {
12130 AddHealth("","",-GetMaxHealth("","Health")/5);
12131 }
12132 else if (action_id ==
EActions.DESTROY_HEALTH)
12133 {
12134 SetHealth01("","",0);
12135 }
12136 else if (action_id ==
EActions.WATCH_ITEM)
12137 {
12139 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12140 #ifdef DEVELOPER
12141 SetDebugDeveloper_item(this);
12142 #endif
12143 }
12144
12145 else if (action_id ==
EActions.ADD_TEMPERATURE)
12146 {
12147 AddTemperature(20);
12148
12149 }
12150
12151 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12152 {
12153 AddTemperature(-20);
12154
12155 }
12156
12157 else if (action_id ==
EActions.FLIP_FROZEN)
12158 {
12159 SetFrozen(!GetIsFrozen());
12160
12161 }
12162
12163 else if (action_id ==
EActions.ADD_WETNESS)
12164 {
12166
12167 }
12168
12169 else if (action_id ==
EActions.REMOVE_WETNESS)
12170 {
12172
12173 }
12174
12175 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12176 {
12179
12180
12181 }
12182
12183 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12184 {
12187 }
12188
12189 else if (action_id ==
EActions.MAKE_SPECIAL)
12190 {
12191 auto debugParams = DebugSpawnParams.WithPlayer(player);
12192 OnDebugSpawnEx(debugParams);
12193 }
12194
12195 }
12196
12197
12198 return false;
12199 }
12200
12201
12202
12203
12207
12210
12211
12212
12214 {
12215 return false;
12216 }
12217
12218
12220 {
12221 return true;
12222 }
12223
12224
12226 {
12227 return true;
12228 }
12229
12230
12231
12233 {
12234 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12235 return g_Game.ConfigIsExisting(config_path);
12236 }
12237
12240 {
12241 return null;
12242 }
12243
12245 {
12246 return false;
12247 }
12248
12250 {
12251 return false;
12252 }
12253
12257
12258
12260 {
12261 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12262 return module_repairing.CanRepair(this, item_repair_kit);
12263 }
12264
12265
12266 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12267 {
12268 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12269 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12270 }
12271
12272
12274 {
12275
12276
12277
12278
12279
12280
12281
12282
12283 return 1;
12284 }
12285
12286
12287
12289 {
12291 }
12292
12293
12294
12296 {
12298 }
12299
12300
12309 {
12310 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12311
12312 if (player)
12313 {
12314 player.MessageStatus(text);
12315 }
12316 }
12317
12318
12327 {
12328 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12329
12330 if (player)
12331 {
12332 player.MessageAction(text);
12333 }
12334 }
12335
12336
12345 {
12346 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12347
12348 if (player)
12349 {
12350 player.MessageFriendly(text);
12351 }
12352 }
12353
12354
12363 {
12364 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12365
12366 if (player)
12367 {
12368 player.MessageImportant(text);
12369 }
12370 }
12371
12373 {
12374 return true;
12375 }
12376
12377
12378 override bool KindOf(
string tag)
12379 {
12380 bool found = false;
12381 string item_name = this.
GetType();
12383 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12384
12385 int array_size = item_tag_array.Count();
12386 for (int i = 0; i < array_size; i++)
12387 {
12388 if (item_tag_array.Get(i) == tag)
12389 {
12390 found = true;
12391 break;
12392 }
12393 }
12394 return found;
12395 }
12396
12397
12399 {
12400
12401 super.OnRPC(sender, rpc_type,ctx);
12402
12403
12404 switch (rpc_type)
12405 {
12406 #ifndef SERVER
12407 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12408 Param2<bool, string> p = new Param2<bool, string>(false, "");
12409
12411 return;
12412
12413 bool play = p.param1;
12414 string soundSet = p.param2;
12415
12416 if (play)
12417 {
12419 {
12421 {
12423 }
12424 }
12425 else
12426 {
12428 }
12429 }
12430 else
12431 {
12433 }
12434
12435 break;
12436 #endif
12437
12438 }
12439
12441 {
12443 }
12444 }
12445
12446
12447
12448
12450 {
12451 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12452 return plugin.GetID(
name);
12453 }
12454
12456 {
12457 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12458 return plugin.GetName(id);
12459 }
12460
12463 {
12464
12465
12466 int varFlags;
12467 if (!ctx.
Read(varFlags))
12468 return;
12469
12470 if (varFlags & ItemVariableFlags.FLOAT)
12471 {
12473 }
12474 }
12475
12477 {
12478
12479 super.SerializeNumericalVars(floats_out);
12480
12481
12482
12484 {
12486 }
12487
12489 {
12491 }
12492
12494 {
12496 }
12497
12499 {
12504 }
12505
12507 {
12509 }
12510 }
12511
12513 {
12514
12515 super.DeSerializeNumericalVars(floats);
12516
12517
12518 int index = 0;
12519 int mask = Math.Round(floats.Get(index));
12520
12521 index++;
12522
12524 {
12526 {
12528 }
12529 else
12530 {
12531 float quantity = floats.Get(index);
12532 SetQuantity(quantity,
true,
false,
false,
false);
12533 }
12534 index++;
12535 }
12536
12538 {
12539 float wet = floats.Get(index);
12541 index++;
12542 }
12543
12545 {
12546 int liquidtype = Math.Round(floats.Get(index));
12548 index++;
12549 }
12550
12552 {
12554 index++;
12556 index++;
12558 index++;
12560 index++;
12561 }
12562
12564 {
12565 int cleanness = Math.Round(floats.Get(index));
12567 index++;
12568 }
12569 }
12570
12572 {
12573 super.WriteVarsToCTX(ctx);
12574
12575
12577 {
12579 }
12580
12582 {
12584 }
12585
12587 {
12589 }
12590
12592 {
12593 int r,g,b,a;
12599 }
12600
12602 {
12604 }
12605 }
12606
12608 {
12609 if (!super.ReadVarsFromCTX(ctx,version))
12610 return false;
12611
12612 int intValue;
12613 float value;
12614
12615 if (version < 140)
12616 {
12617 if (!ctx.
Read(intValue))
12618 return false;
12619
12620 m_VariablesMask = intValue;
12621 }
12622
12624 {
12625 if (!ctx.
Read(value))
12626 return false;
12627
12629 {
12631 }
12632 else
12633 {
12635 }
12636 }
12637
12638 if (version < 140)
12639 {
12641 {
12642 if (!ctx.
Read(value))
12643 return false;
12644 SetTemperatureDirect(value);
12645 }
12646 }
12647
12649 {
12650 if (!ctx.
Read(value))
12651 return false;
12653 }
12654
12656 {
12657 if (!ctx.
Read(intValue))
12658 return false;
12660 }
12661
12663 {
12664 int r,g,b,a;
12666 return false;
12668 return false;
12670 return false;
12672 return false;
12673
12675 }
12676
12678 {
12679 if (!ctx.
Read(intValue))
12680 return false;
12682 }
12683
12684 if (version >= 138 && version < 140)
12685 {
12687 {
12688 if (!ctx.
Read(intValue))
12689 return false;
12690 SetFrozen(intValue);
12691 }
12692 }
12693
12694 return true;
12695 }
12696
12697
12699 {
12702 {
12704 }
12705
12706 if (!super.OnStoreLoad(ctx, version))
12707 {
12709 return false;
12710 }
12711
12712 if (version >= 114)
12713 {
12714 bool hasQuickBarIndexSaved;
12715
12716 if (!ctx.
Read(hasQuickBarIndexSaved))
12717 {
12719 return false;
12720 }
12721
12722 if (hasQuickBarIndexSaved)
12723 {
12724 int itmQBIndex;
12725
12726
12727 if (!ctx.
Read(itmQBIndex))
12728 {
12730 return false;
12731 }
12732
12733 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12734 if (itmQBIndex != -1 && parentPlayer)
12735 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12736 }
12737 }
12738 else
12739 {
12740
12741 PlayerBase player;
12742 int itemQBIndex;
12743 if (version ==
int.
MAX)
12744 {
12745 if (!ctx.
Read(itemQBIndex))
12746 {
12748 return false;
12749 }
12750 }
12751 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12752 {
12753
12754 if (!ctx.
Read(itemQBIndex))
12755 {
12757 return false;
12758 }
12759 if (itemQBIndex != -1 && player)
12760 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12761 }
12762 }
12763
12764 if (version < 140)
12765 {
12766
12767 if (!LoadVariables(ctx, version))
12768 {
12770 return false;
12771 }
12772 }
12773
12774
12776 {
12778 return false;
12779 }
12780 if (version >= 132)
12781 {
12783 if (raib)
12784 {
12786 {
12788 return false;
12789 }
12790 }
12791 }
12792
12794 return true;
12795 }
12796
12797
12798
12800 {
12801 super.OnStoreSave(ctx);
12802
12803 PlayerBase player;
12804 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12805 {
12807
12808 int itemQBIndex = -1;
12809 itemQBIndex = player.FindQuickBarEntityIndex(this);
12810 ctx.
Write(itemQBIndex);
12811 }
12812 else
12813 {
12815 }
12816
12818
12820 if (raib)
12821 {
12823 }
12824 }
12825
12826
12828 {
12829 super.AfterStoreLoad();
12830
12832 {
12834 }
12835
12837 {
12840 }
12841 }
12842
12844 {
12845 super.EEOnAfterLoad();
12846
12848 {
12850 }
12851
12854 }
12855
12857 {
12858 return false;
12859 }
12860
12861
12862
12864 {
12866 {
12867 #ifdef PLATFORM_CONSOLE
12868
12870 {
12872 if (menu)
12873 {
12875 }
12876 }
12877 #endif
12878 }
12879
12881 {
12884 }
12885
12887 {
12888 SetWeightDirty();
12890 }
12892 {
12895 }
12896
12898 {
12901
12904 }
12906 {
12910 }
12911
12912 super.OnVariablesSynchronized();
12913 }
12914
12915
12916
12918 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12919 {
12920 if (!IsServerCheck(allow_client))
12921 return false;
12922
12924 return false;
12925
12928
12929 if (value <= (min + 0.001))
12930 value = min;
12931
12932 if (value == min)
12933 {
12934 if (destroy_config)
12935 {
12936 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12937 if (dstr)
12938 {
12940 this.Delete();
12941 return true;
12942 }
12943 }
12944 else if (destroy_forced)
12945 {
12947 this.Delete();
12948 return true;
12949 }
12950
12952 }
12953
12956
12958 {
12959 EntityAI parent = GetHierarchyRoot();
12960 InventoryLocation iLoc = new InventoryLocation();
12961 GetInventory().GetCurrentInventoryLocation(iLoc);
12963 {
12964 int iLocSlot = iLoc.
GetSlot();
12966 {
12968 }
12970 {
12972 }
12973 }
12974 }
12975
12977 {
12979
12980 if (delta)
12982 }
12983
12985
12986 return false;
12987 }
12988
12989
12991 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12992 {
12994 }
12995
12997 {
13000 }
13001
13003 {
13006 }
13007
13009 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13010 {
13011 float value_clamped = Math.Clamp(value, 0, 1);
13013 SetQuantity(result, destroy_config, destroy_forced);
13014 }
13015
13016
13019 {
13021 }
13022
13024 {
13026 }
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13038 {
13039 int slot = -1;
13040 GameInventory inventory = GetInventory();
13041 if (inventory)
13042 {
13043 InventoryLocation il = new InventoryLocation;
13046 }
13047
13049 }
13050
13052 {
13053 float quantity_max = 0;
13054
13056 {
13057 if (attSlotID != -1)
13058 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13059
13060 if (quantity_max <= 0)
13062 }
13063
13064 if (quantity_max <= 0)
13066
13067 return quantity_max;
13068 }
13069
13071 {
13073 }
13074
13076 {
13078 }
13079
13080
13082 {
13084 }
13085
13087 {
13089 }
13090
13092 {
13094 }
13095
13096
13098 {
13099
13100 float weightEx = GetWeightEx();
13101 float special = GetInventoryAndCargoWeight();
13102 return weightEx - special;
13103 }
13104
13105
13107 {
13109 }
13110
13112 {
13114 {
13115 #ifdef DEVELOPER
13116 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13117 {
13118 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13120 }
13121 #endif
13122
13123 return GetQuantity() * GetConfigWeightModified();
13124 }
13125 else if (HasEnergyManager())
13126 {
13127 #ifdef DEVELOPER
13128 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13129 {
13130 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13131 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13132 }
13133 #endif
13134 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13135 }
13136 else
13137 {
13138 #ifdef DEVELOPER
13139 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13140 {
13141 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13142 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13143 }
13144 #endif
13145 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13146 }
13147 }
13148
13151 {
13152 int item_count = 0;
13154
13155 GameInventory inventory = GetInventory();
13156 CargoBase cargo = inventory.
GetCargo();
13157 if (cargo != NULL)
13158 {
13160 }
13161
13163 for (int i = 0; i < nAttachments; ++i)
13164 {
13166 if (item)
13167 item_count += item.GetNumberOfItems();
13168 }
13169 return item_count;
13170 }
13171
13174 {
13175 float weight = 0;
13176 float wetness = 1;
13177 if (include_wetness)
13180 {
13181 weight = wetness * m_ConfigWeight;
13182 }
13184 {
13185 weight = 1;
13186 }
13187 return weight;
13188 }
13189
13190
13191
13193 {
13194 GameInventory inventory = GetInventory();
13195 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13196 {
13197 array<EntityAI> items = new array<EntityAI>;
13199 for (int i = 0; i < items.Count(); ++i)
13200 {
13202 if (item)
13203 {
13204 g_Game.ObjectDelete(item);
13205 }
13206 }
13207 }
13208 }
13209
13210
13211
13212
13214 {
13215 float energy = 0;
13216 if (HasEnergyManager())
13217 {
13218 energy = GetCompEM().GetEnergy();
13219 }
13220 return energy;
13221 }
13222
13223
13225 {
13226 super.OnEnergyConsumed();
13227
13229 }
13230
13232 {
13233 super.OnEnergyAdded();
13234
13236 }
13237
13238
13240 {
13241 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13242 {
13244 {
13245 float energy_0to1 = GetCompEM().GetEnergy0To1();
13247 }
13248 }
13249 }
13250
13251
13253 {
13254 return ConfigGetFloat("heatIsolation");
13255 }
13256
13258 {
13260 }
13261
13263 {
13264 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13265 if (
g_Game.ConfigIsExisting(paramPath))
13266 return g_Game.ConfigGetFloat(paramPath);
13267
13268 return 0.0;
13269 }
13270
13272 {
13273 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13274 if (
g_Game.ConfigIsExisting(paramPath))
13275 return g_Game.ConfigGetFloat(paramPath);
13276
13277 return 0.0;
13278 }
13279
13280 override void SetWet(
float value,
bool allow_client =
false)
13281 {
13282 if (!IsServerCheck(allow_client))
13283 return;
13284
13287
13289
13290 m_VarWet = Math.Clamp(value, min, max);
13291
13293 {
13296 }
13297 }
13298
13299 override void AddWet(
float value)
13300 {
13302 }
13303
13305 {
13307 }
13308
13310 {
13312 }
13313
13315 {
13317 }
13318
13320 {
13322 }
13323
13325 {
13327 }
13328
13329 override void OnWetChanged(
float newVal,
float oldVal)
13330 {
13333 if (newLevel != oldLevel)
13334 {
13336 }
13337 }
13338
13340 {
13341 SetWeightDirty();
13342 }
13343
13345 {
13346 return GetWetLevelInternal(
m_VarWet);
13347 }
13348
13349
13350
13352 {
13354 }
13355
13357 {
13359 }
13360
13362 {
13364 }
13365
13367 {
13369 }
13370
13371
13372
13374 {
13375 if (ConfigIsExisting("itemModelLength"))
13376 {
13377 return ConfigGetFloat("itemModelLength");
13378 }
13379 return 0;
13380 }
13381
13383 {
13384 if (ConfigIsExisting("itemAttachOffset"))
13385 {
13386 return ConfigGetFloat("itemAttachOffset");
13387 }
13388 return 0;
13389 }
13390
13391 override void SetCleanness(
int value,
bool allow_client =
false)
13392 {
13393 if (!IsServerCheck(allow_client))
13394 return;
13395
13397
13399
13402 }
13403
13405 {
13407 }
13408
13410 {
13411 return true;
13412 }
13413
13414
13415
13416
13418 {
13420 }
13421
13423 {
13425 }
13426
13427
13428
13429
13430 override void SetColor(
int r,
int g,
int b,
int a)
13431 {
13437 }
13439 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13440 {
13445 }
13446
13448 {
13450 }
13451
13454 {
13455 int r,g,b,a;
13457 r = r/255;
13458 g = g/255;
13459 b = b/255;
13460 a = a/255;
13461 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13462 }
13463
13464
13465
13466 override void SetLiquidType(
int value,
bool allow_client =
false)
13467 {
13468 if (!IsServerCheck(allow_client))
13469 return;
13470
13475 }
13476
13478 {
13479 return ConfigGetInt("varLiquidTypeInit");
13480 }
13481
13483 {
13485 }
13486
13488 {
13490 SetFrozen(false);
13491 }
13492
13495 {
13496 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13497 }
13498
13499
13502 {
13503 PlayerBase nplayer;
13504 if (PlayerBase.CastTo(nplayer, player))
13505 {
13507 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13508 }
13509 }
13510
13511
13514 {
13515 PlayerBase nplayer;
13516 if (PlayerBase.CastTo(nplayer,player))
13517 {
13518 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13519 }
13520
13521 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13522
13523 if (HasEnergyManager())
13524 {
13525 GetCompEM().UpdatePlugState();
13526 }
13527 }
13528
13529
13531 {
13532 super.OnPlacementStarted(player);
13533
13535 }
13536
13537 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13538 {
13540 {
13541 m_AdminLog.OnPlacementComplete(player,
this);
13542 }
13543
13544 super.OnPlacementComplete(player, position, orientation);
13545 }
13546
13547
13548
13549
13550
13552 {
13554 {
13555 return true;
13556 }
13557 else
13558 {
13559 return false;
13560 }
13561 }
13562
13563
13565 {
13567 {
13569 }
13570 }
13571
13572
13574 {
13576 }
13577
13579 {
13581 }
13582
13583 override void InsertAgent(
int agent,
float count = 1)
13584 {
13585 if (count < 1)
13586 return;
13587
13589 }
13590
13593 {
13595 }
13596
13597
13599 {
13601 }
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13645 {
13647 return false;
13648 return true;
13649 }
13650
13652 {
13653
13655 }
13656
13657
13660 {
13661 super.CheckForRoofLimited(timeTresholdMS);
13662
13663 float time =
g_Game.GetTime();
13664 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13665 {
13666 m_PreviousRoofTestTime = time;
13667 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13668 }
13669 }
13670
13671
13673 {
13675 {
13676 return 0;
13677 }
13678
13679 if (GetInventory().GetAttachmentSlotsCount() != 0)
13680 {
13681 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13682 if (filter)
13683 return filter.GetProtectionLevel(type, false, system);
13684 else
13685 return 0;
13686 }
13687
13688 string subclassPath, entryName;
13689
13690 switch (type)
13691 {
13693 entryName = "biological";
13694 break;
13696 entryName = "chemical";
13697 break;
13698 default:
13699 entryName = "biological";
13700 break;
13701 }
13702
13703 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13704
13705 return g_Game.ConfigGetFloat(subclassPath + entryName);
13706 }
13707
13708
13709
13712 {
13713 if (!IsMagazine())
13715
13717 }
13718
13719
13720
13721
13722
13727 {
13728 return true;
13729 }
13730
13732 {
13734 }
13735
13736
13737
13738
13739
13741 {
13742 if (parent)
13743 {
13744 if (parent.IsInherited(DayZInfected))
13745 return true;
13746
13747 if (!parent.IsRuined())
13748 return true;
13749 }
13750
13751 return true;
13752 }
13753
13755 {
13756 if (!super.CanPutAsAttachment(parent))
13757 {
13758 return false;
13759 }
13760
13761 if (!IsRuined() && !parent.IsRuined())
13762 {
13763 return true;
13764 }
13765
13766 return false;
13767 }
13768
13770 {
13771
13772
13773
13774
13775 return super.CanReceiveItemIntoCargo(item);
13776 }
13777
13779 {
13780
13781
13782
13783
13784 GameInventory attachmentInv = attachment.GetInventory();
13786 {
13787 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13788 return false;
13789 }
13790
13791 InventoryLocation loc = new InventoryLocation();
13792 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13793 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13794 return false;
13795
13796 return super.CanReceiveAttachment(attachment, slotId);
13797 }
13798
13800 {
13801 if (!super.CanReleaseAttachment(attachment))
13802 return false;
13803
13804 return GetInventory().AreChildrenAccessible();
13805 }
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13828 {
13829 int id = muzzle_owner.GetMuzzleID();
13830 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13831
13832 if (WPOF_array)
13833 {
13834 for (int i = 0; i < WPOF_array.Count(); i++)
13835 {
13836 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13837
13838 if (WPOF)
13839 {
13840 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13841 }
13842 }
13843 }
13844 }
13845
13846
13848 {
13849 int id = muzzle_owner.GetMuzzleID();
13851
13852 if (WPOBE_array)
13853 {
13854 for (int i = 0; i < WPOBE_array.Count(); i++)
13855 {
13856 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13857
13858 if (WPOBE)
13859 {
13860 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13861 }
13862 }
13863 }
13864 }
13865
13866
13868 {
13869 int id = muzzle_owner.GetMuzzleID();
13870 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13871
13872 if (WPOOH_array)
13873 {
13874 for (int i = 0; i < WPOOH_array.Count(); i++)
13875 {
13876 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13877
13878 if (WPOOH)
13879 {
13880 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13881 }
13882 }
13883 }
13884 }
13885
13886
13888 {
13889 int id = muzzle_owner.GetMuzzleID();
13890 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13891
13892 if (WPOOH_array)
13893 {
13894 for (int i = 0; i < WPOOH_array.Count(); i++)
13895 {
13896 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13897
13898 if (WPOOH)
13899 {
13900 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13901 }
13902 }
13903 }
13904 }
13905
13906
13908 {
13909 int id = muzzle_owner.GetMuzzleID();
13910 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13911
13912 if (WPOOH_array)
13913 {
13914 for (int i = 0; i < WPOOH_array.Count(); i++)
13915 {
13916 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13917
13918 if (WPOOH)
13919 {
13920 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13921 }
13922 }
13923 }
13924 }
13925
13926
13927
13929 {
13931 {
13932 return true;
13933 }
13934
13935 return false;
13936 }
13937
13939 {
13941 {
13942 return true;
13943 }
13944
13945 return false;
13946 }
13947
13949 {
13951 {
13952 return true;
13953 }
13954
13955 return false;
13956 }
13957
13959 {
13960 return false;
13961 }
13962
13965 {
13966 return UATimeSpent.DEFAULT_DEPLOY;
13967 }
13968
13969
13970
13971
13973 {
13975 SetSynchDirty();
13976 }
13977
13979 {
13981 }
13982
13983
13985 {
13986 return false;
13987 }
13988
13991 {
13992 string att_type = "None";
13993
13994 if (ConfigIsExisting("soundAttType"))
13995 {
13996 att_type = ConfigGetString("soundAttType");
13997 }
13998
14000 }
14001
14003 {
14005 }
14006
14007
14008
14009
14010
14016
14018 {
14021
14023 }
14024
14025
14027 {
14029 return;
14030
14032
14035
14038
14039 SoundParameters params = new SoundParameters();
14043 }
14044
14045
14047 {
14049 {
14052
14053 SetSynchDirty();
14054
14057 }
14058 }
14059
14061 {
14063 }
14064
14065
14067 {
14069 return;
14070
14072 SetSynchDirty();
14073
14076 }
14077
14079 {
14082 }
14083
14085 {
14087 }
14088
14089 void OnApply(PlayerBase player);
14090
14092 {
14093 return 1.0;
14094 };
14095
14097 {
14099 }
14100
14102 {
14104 }
14105
14107
14109 {
14110 SetDynamicPhysicsLifeTime(0.01);
14112 }
14113
14115 {
14116 array<string> zone_names = new array<string>;
14117 GetDamageZones(zone_names);
14118 for (int i = 0; i < zone_names.Count(); i++)
14119 {
14120 SetHealthMax(zone_names.Get(i),"Health");
14121 }
14122 SetHealthMax("","Health");
14123 }
14124
14127 {
14128 float global_health = GetHealth01("","Health");
14129 array<string> zones = new array<string>;
14130 GetDamageZones(zones);
14131
14132 for (int i = 0; i < zones.Count(); i++)
14133 {
14134 SetHealth01(zones.Get(i),"Health",global_health);
14135 }
14136 }
14137
14140 {
14141 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14142 }
14143
14145 {
14146 if (!hasRootAsPlayer)
14147 {
14148 if (refParentIB)
14149 {
14150
14151 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14152 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14153
14154 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14155 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14156
14159 }
14160 else
14161 {
14162
14165 }
14166 }
14167 }
14168
14170 {
14172 {
14173 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14174 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14175 {
14176 float heatPermCoef = 1.0;
14178 while (ent)
14179 {
14180 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14181 ent = ent.GetHierarchyParent();
14182 }
14183
14184 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14185 }
14186 }
14187 }
14188
14190 {
14191
14192 EntityAI parent = GetHierarchyParent();
14193 if (!parent)
14194 {
14195 hasParent = false;
14196 hasRootAsPlayer = false;
14197 }
14198 else
14199 {
14200 hasParent = true;
14201 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14202 refParentIB =
ItemBase.Cast(parent);
14203 }
14204 }
14205
14206 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14207 {
14208
14209 }
14210
14212 {
14213
14214 return false;
14215 }
14216
14218 {
14219
14220
14221 return false;
14222 }
14223
14225 {
14226
14227 return false;
14228 }
14229
14232 {
14233 return !GetIsFrozen() &&
IsOpen();
14234 }
14235
14237 {
14238 bool hasParent = false, hasRootAsPlayer = false;
14240
14241 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14242 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14243
14244 if (wwtu || foodDecay)
14245 {
14249
14250 if (processWetness || processTemperature || processDecay)
14251 {
14253
14254 if (processWetness)
14255 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14256
14257 if (processTemperature)
14259
14260 if (processDecay)
14261 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14262 }
14263 }
14264 }
14265
14268 {
14270 }
14271
14273 {
14276
14277 return super.GetTemperatureFreezeThreshold();
14278 }
14279
14281 {
14284
14285 return super.GetTemperatureThawThreshold();
14286 }
14287
14289 {
14292
14293 return super.GetItemOverheatThreshold();
14294 }
14295
14297 {
14299 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14300
14301 return super.GetTemperatureFreezeTime();
14302 }
14303
14305 {
14307 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14308
14309 return super.GetTemperatureThawTime();
14310 }
14311
14316
14318 {
14319 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14320 }
14321
14323 {
14324 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14325 }
14326
14329 {
14331 }
14332
14334 {
14336 }
14337
14339 {
14341 }
14342
14345 {
14346 return null;
14347 }
14348
14351 {
14352 return false;
14353 }
14354
14356 {
14358 {
14361 if (!trg)
14362 {
14364 explosive = this;
14365 }
14366
14367 explosive.PairRemote(trg);
14369
14370 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14371 trg.SetPersistentPairID(persistentID);
14372 explosive.SetPersistentPairID(persistentID);
14373
14374 return true;
14375 }
14376 return false;
14377 }
14378
14381 {
14382 float ret = 1.0;
14385 ret *= GetHealth01();
14386
14387 return ret;
14388 }
14389
14390 #ifdef DEVELOPER
14391 override void SetDebugItem()
14392 {
14393 super.SetDebugItem();
14394 _itemBase = this;
14395 }
14396
14398 {
14399 string text = super.GetDebugText();
14400
14402 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14403
14404 return text;
14405 }
14406 #endif
14407
14409 {
14410 return true;
14411 }
14412
14414
14416
14418 {
14421 }
14422
14423
14431
14447
14448 [
Obsolete(
"Use ItemSoundHandler instead")]
14451 {
14452 if (!
g_Game.IsDedicatedServer())
14453 {
14454 if (ConfigIsExisting("attachSoundSet"))
14455 {
14456 string cfg_path = "";
14457 string soundset = "";
14458 string type_name =
GetType();
14459
14462 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14463 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14464
14465 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14466 {
14467 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14468 {
14469 if (cfg_slot_array[i] == slot_type)
14470 {
14471 soundset = cfg_soundset_array[i];
14472 break;
14473 }
14474 }
14475 }
14476
14477 if (soundset != "")
14478 {
14479 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14481 }
14482 }
14483 }
14484 }
14485
14487}
14488
14490{
14492 if (entity)
14493 {
14494 bool is_item = entity.IsInherited(
ItemBase);
14495 if (is_item && full_quantity)
14496 {
14499 }
14500 }
14501 else
14502 {
14504 return NULL;
14505 }
14506 return entity;
14507}
14508
14510{
14511 if (item)
14512 {
14513 if (health > 0)
14514 item.SetHealth("", "", health);
14515
14516 if (item.CanHaveTemperature())
14517 {
14519 if (item.CanFreeze())
14520 item.SetFrozen(false);
14521 }
14522
14523 if (item.HasEnergyManager())
14524 {
14525 if (quantity >= 0)
14526 {
14527 item.GetCompEM().SetEnergy0To1(quantity);
14528 }
14529 else
14530 {
14532 }
14533 }
14534 else if (item.IsMagazine())
14535 {
14536 Magazine mag = Magazine.Cast(item);
14537 if (quantity >= 0)
14538 {
14539 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14540 }
14541 else
14542 {
14544 }
14545
14546 }
14547 else
14548 {
14549 if (quantity >= 0)
14550 {
14551 item.SetQuantityNormalized(quantity, false);
14552 }
14553 else
14554 {
14556 }
14557
14558 }
14559 }
14560}
14561
14562#ifdef DEVELOPER
14564#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.