9634{
9636 {
9637 return true;
9638 }
9639};
9640
9642{
9643
9644};
9645
9646
9647
9649{
9653
9655
9658
9659
9660
9661
9662
9671
9677
9682
9687
9708 protected bool m_IsResultOfSplit
9709
9711
9716
9717
9718
9720
9724
9725
9726
9728
9731
9732
9733
9739
9740
9748
9751
9752
9754
9755
9757
9758
9763
9764
9769
9771
9772
9774
9775
9777 {
9782
9783 if (!
g_Game.IsDedicatedServer())
9784 {
9786 {
9788
9790 {
9792 }
9793 }
9794
9797 }
9798
9799 m_OldLocation = null;
9800
9802 {
9804 }
9805
9806 if (ConfigIsExisting("headSelectionsToHide"))
9807 {
9810 }
9811
9813 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9814 {
9816 }
9817
9819
9820 m_IsResultOfSplit = false;
9821
9823 }
9824
9826 {
9827 super.InitItemVariables();
9828
9834 m_Count = ConfigGetInt(
"count");
9835
9838
9843
9846
9851
9863
9867
9868
9871 if (ConfigIsExisting("canBeSplit"))
9872 {
9875 }
9876
9878 if (ConfigIsExisting("itemBehaviour"))
9880
9881
9884 RegisterNetSyncVariableInt("m_VarLiquidType");
9885 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9886
9887 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9888 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9889 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9890
9891 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9892 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9893 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9894 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9895
9896 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9897 RegisterNetSyncVariableBool("m_IsTakeable");
9898 RegisterNetSyncVariableBool("m_IsHologram");
9899
9902 {
9905 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9906 }
9907
9909
9911 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9913
9915 }
9916
9918 {
9920 }
9921
9923 {
9926 {
9931 }
9932 }
9933
9934 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9935 {
9937 {
9940 }
9941
9943 }
9944
9946 {
9952 }
9953
9955
9957 {
9959
9960 if (!action)
9961 {
9962 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9963 return;
9964 }
9965
9967 if (!ai)
9968 {
9970 return;
9971 }
9972
9974 if (!action_array)
9975 {
9976 action_array = new array<ActionBase_Basic>;
9978 }
9979 if (LogManager.IsActionLogEnable())
9980 {
9981 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9982 }
9983
9984 if (action_array.Find(action) != -1)
9985 {
9986 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9987 }
9988 else
9989 {
9990 action_array.Insert(action);
9991 }
9992 }
9993
9995 {
9996 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9997 ActionBase action = player.GetActionManager().GetAction(actionName);
10000
10001 if (action_array)
10002 {
10003 action_array.RemoveItem(action);
10004 }
10005 }
10006
10007
10008
10010 {
10011 ActionOverrideData overrideData = new ActionOverrideData();
10015
10017 if (!actionMap)
10018 {
10021 }
10022
10023 actionMap.Insert(this.
Type(), overrideData);
10024
10025 }
10026
10028
10030
10031
10033 {
10036
10039
10040 string config_to_search = "CfgVehicles";
10041 string muzzle_owner_config;
10042
10044 {
10045 if (IsInherited(Weapon))
10046 config_to_search = "CfgWeapons";
10047
10048 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10049
10050 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10051
10052 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10053
10054 if (config_OnFire_subclass_count > 0)
10055 {
10056 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10057
10058 for (int i = 0; i < config_OnFire_subclass_count; i++)
10059 {
10060 string particle_class = "";
10061 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10062 string config_OnFire_entry = config_OnFire_class + particle_class;
10063 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10064 WPOF_array.Insert(WPOF);
10065 }
10066
10067
10069 }
10070 }
10071
10073 {
10074 config_to_search = "CfgWeapons";
10075 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10076
10077 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10078
10079 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10080
10081 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10082 {
10083 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10084
10085 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10086 {
10087 string particle_class2 = "";
10088 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10089 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10090 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10091 WPOBE_array.Insert(WPOBE);
10092 }
10093
10094
10096 }
10097 }
10098 }
10099
10100
10102 {
10105
10107 {
10108 string config_to_search = "CfgVehicles";
10109
10110 if (IsInherited(Weapon))
10111 config_to_search = "CfgWeapons";
10112
10113 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10114 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10115
10116 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10117 {
10118
10120
10122 {
10124 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10126 return;
10127 }
10128
10131
10132
10133
10134 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10135 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10136
10137 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10138 {
10139 string particle_class = "";
10140 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10141 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10142 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10143
10144 if (entry_type == CT_CLASS)
10145 {
10146 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10147 WPOOH_array.Insert(WPOF);
10148 }
10149 }
10150
10151
10153 }
10154 }
10155 }
10156
10158 {
10160 }
10161
10163 {
10165 {
10167
10170
10173
10174 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10175 }
10176 }
10177
10179 {
10181 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10182
10184 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10185
10187 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10188
10190 {
10192 }
10193 }
10194
10196 {
10198 }
10199
10201 {
10204 else
10206
10208 {
10211 }
10212 else
10213 {
10216
10219 }
10220
10222 }
10223
10225 {
10227 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10228 }
10229
10231 {
10233 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10235 }
10236
10238 {
10240 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10241 }
10242
10244 {
10247
10248 OverheatingParticle OP = new OverheatingParticle();
10253
10255 }
10256
10258 {
10261
10262 return -1;
10263 }
10264
10266 {
10268 {
10271
10272 for (int i = count; i > 0; --i)
10273 {
10274 int id = i - 1;
10277
10280
10281 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10282 {
10283 if (p)
10284 {
10287 }
10288 }
10289 }
10290 }
10291 }
10292
10294 {
10296 {
10298 {
10299 int id = i - 1;
10301
10302 if (OP)
10303 {
10305
10306 if (p)
10307 {
10309 }
10310
10311 delete OP;
10312 }
10313 }
10314
10317 }
10318 }
10319
10322 {
10323 return 0.0;
10324 }
10325
10326
10328 {
10329 return 250;
10330 }
10331
10333 {
10334 return 0;
10335 }
10336
10339 {
10341 return true;
10342
10343 return false;
10344 }
10345
10348 {
10351
10353 {
10355 }
10356 else
10357 {
10358
10360 }
10361
10363 }
10364
10371 {
10372 return -1;
10373 }
10374
10375
10376
10377
10379 {
10381 {
10382 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10383 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10384
10385 if (r_index >= 0)
10386 {
10387 InventoryLocation r_il = new InventoryLocation;
10388 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10389
10390 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10393 {
10394 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10395 }
10397 {
10398 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10399 }
10400
10401 }
10402
10403 player.GetHumanInventory().ClearUserReservedLocation(this);
10404 }
10405
10408 }
10409
10410
10411
10412
10414 {
10415 return ItemBase.m_DebugActionsMask;
10416 }
10417
10419 {
10420 return ItemBase.m_DebugActionsMask & mask;
10421 }
10422
10424 {
10425 ItemBase.m_DebugActionsMask = mask;
10426 }
10427
10429 {
10430 ItemBase.m_DebugActionsMask |= mask;
10431 }
10432
10434 {
10435 ItemBase.m_DebugActionsMask &= ~mask;
10436 }
10437
10439 {
10441 {
10443 }
10444 else
10445 {
10447 }
10448 }
10449
10450
10452 {
10453 if (GetEconomyProfile())
10454 {
10455 float q_max = GetEconomyProfile().GetQuantityMax();
10456 if (q_max > 0)
10457 {
10458 float q_min = GetEconomyProfile().GetQuantityMin();
10459 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10460
10462 {
10463 ComponentEnergyManager comp = GetCompEM();
10465 {
10467 }
10468 }
10470 {
10472
10473 }
10474
10475 }
10476 }
10477 }
10478
10481 {
10482 EntityAI parent = GetHierarchyParent();
10483
10484 if (parent)
10485 {
10486 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10487 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10488 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10489 }
10490 }
10491
10494 {
10495 EntityAI parent = GetHierarchyParent();
10496
10497 if (parent)
10498 {
10499 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10500 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10501 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10502 }
10503 }
10504
10506 {
10507
10508
10509
10510
10512
10514 {
10515 if (ScriptInputUserData.CanStoreInputUserData())
10516 {
10517 ScriptInputUserData ctx = new ScriptInputUserData;
10523 ctx.
Write(use_stack_max);
10526
10528 {
10529 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10530 }
10531 }
10532 }
10533 else if (!
g_Game.IsMultiplayer())
10534 {
10536 }
10537 }
10538
10540 {
10542 }
10543
10545 {
10547 }
10548
10550 {
10552 }
10553
10555 {
10556
10557 return false;
10558 }
10559
10561 {
10562 return false;
10563 }
10564
10568 {
10569 return false;
10570 }
10571
10573 {
10574 return "";
10575 }
10576
10578
10580 {
10581 return false;
10582 }
10583
10585 {
10586 return true;
10587 }
10588
10589
10590
10592 {
10593 return true;
10594 }
10595
10597 {
10598 return true;
10599 }
10600
10602 {
10603 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10605 }
10606
10608 {
10610 }
10611
10613 {
10615 if (!is_being_placed)
10617 SetSynchDirty();
10618 }
10619
10620
10622
10624 {
10626 }
10627
10629 {
10631 }
10632
10634 {
10635 return 1;
10636 }
10637
10639 {
10640 return false;
10641 }
10642
10644 {
10646 SetSynchDirty();
10647 }
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10684 {
10685 super.OnMovedInsideCargo(container);
10686
10687 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10688 }
10689
10690 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10691 {
10692 super.EEItemLocationChanged(oldLoc, newLoc);
10693
10694 PlayerBase newPlayer = null;
10695 PlayerBase oldPlayer = null;
10696
10697 if (newLoc.GetParent())
10698 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10699
10700 if (oldLoc.GetParent())
10701 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10702
10704 {
10705 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10706
10707 if (rIndex >= 0)
10708 {
10709 InventoryLocation rIl = new InventoryLocation;
10710 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10711
10712 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10715 {
10716 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10717 }
10719 {
10721 }
10722
10723 }
10724 }
10725
10727 {
10728 if (newPlayer)
10729 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10730
10731 if (newPlayer == oldPlayer)
10732 {
10733 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10734 {
10736 {
10737 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10738 {
10739 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10740 }
10741 }
10742 else
10743 {
10744 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10745 }
10746 }
10747
10748 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10749 {
10750 int type = oldLoc.GetType();
10752 {
10753 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10754 }
10756 {
10757 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10758 }
10759 }
10760 if (!m_OldLocation)
10761 {
10762 m_OldLocation = new InventoryLocation;
10763 }
10764 m_OldLocation.Copy(oldLoc);
10765 }
10766 else
10767 {
10768 if (m_OldLocation)
10769 {
10770 m_OldLocation.Reset();
10771 }
10772 }
10773
10774 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10775 }
10776 else
10777 {
10778 if (newPlayer)
10779 {
10780 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10781 if (resIndex >= 0)
10782 {
10783 InventoryLocation il = new InventoryLocation;
10784 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10786 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10789 {
10790 il.
GetParent().GetOnReleaseLock().Invoke(it);
10791 }
10793 {
10795 }
10796
10797 }
10798 }
10800 {
10801
10803 }
10804
10805 if (m_OldLocation)
10806 {
10807 m_OldLocation.Reset();
10808 }
10809 }
10810
10812 {
10813 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10814 }
10815
10817 {
10818 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10819 }
10820 }
10821
10822 override void EOnContact(IEntity other, Contact extra)
10823 {
10825 {
10826 int liquidType = -1;
10828 if (impactSpeed > 0.0)
10829 {
10831 #ifndef SERVER
10833 #else
10835 SetSynchDirty();
10836 #endif
10838 }
10839 }
10840
10841 #ifdef SERVER
10842 if (GetCompEM() && GetCompEM().IsPlugged())
10843 {
10844 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10845 GetCompEM().UnplugThis();
10846 }
10847 #endif
10848 }
10849
10851
10853 {
10855 }
10856
10858 {
10859
10860 }
10861
10863 {
10864 super.OnItemLocationChanged(old_owner, new_owner);
10865
10866 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10867 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10868
10869 if (!relatedPlayer && playerNew)
10870 relatedPlayer = playerNew;
10871
10872 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10873 {
10875 if (actionMgr)
10876 {
10877 ActionBase currentAction = actionMgr.GetRunningAction();
10878 if (currentAction)
10880 }
10881 }
10882
10883 Man ownerPlayerOld = null;
10884 Man ownerPlayerNew = null;
10885
10886 if (old_owner)
10887 {
10888 if (old_owner.
IsMan())
10889 {
10890 ownerPlayerOld = Man.Cast(old_owner);
10891 }
10892 else
10893 {
10894 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10895 }
10896 }
10897 else
10898 {
10900 {
10902
10903 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10904 {
10905 GetCompEM().UnplugThis();
10906 }
10907 }
10908 }
10909
10910 if (new_owner)
10911 {
10912 if (new_owner.
IsMan())
10913 {
10914 ownerPlayerNew = Man.Cast(new_owner);
10915 }
10916 else
10917 {
10918 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10919 }
10920 }
10921
10922 if (ownerPlayerOld != ownerPlayerNew)
10923 {
10924 if (ownerPlayerOld)
10925 {
10926 array<EntityAI> subItemsExit = new array<EntityAI>;
10928 for (int i = 0; i < subItemsExit.Count(); i++)
10929 {
10932 }
10933 }
10934
10935 if (ownerPlayerNew)
10936 {
10937 array<EntityAI> subItemsEnter = new array<EntityAI>;
10939 for (int j = 0; j < subItemsEnter.Count(); j++)
10940 {
10943 }
10944 }
10945 }
10946 else if (ownerPlayerNew != null)
10947 {
10948 PlayerBase nplayer;
10949 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10950 {
10951 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10953 for (int k = 0; k < subItemsUpdate.Count(); k++)
10954 {
10956 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10957 }
10958 }
10959 }
10960
10961 if (old_owner)
10962 old_owner.OnChildItemRemoved(this);
10963 if (new_owner)
10964 new_owner.OnChildItemReceived(this);
10965 }
10966
10967
10969 {
10970 super.EEDelete(parent);
10971 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10972 if (player)
10973 {
10975
10976 if (player.IsAlive())
10977 {
10978 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10979 if (r_index >= 0)
10980 {
10981 InventoryLocation r_il = new InventoryLocation;
10982 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10983
10984 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10987 {
10988 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10989 }
10991 {
10992 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10993 }
10994
10995 }
10996
10997 player.RemoveQuickBarEntityShortcut(this);
10998 }
10999 }
11000 }
11001
11003 {
11004 super.EEKilled(killer);
11005
11008 {
11009 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11010 {
11011 if (IsMagazine())
11012 {
11013 if (Magazine.Cast(this).GetAmmoCount() > 0)
11014 {
11016 }
11017 }
11018 else
11019 {
11021 }
11022 }
11023 }
11024 }
11025
11027 {
11028 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11029
11030 super.OnWasAttached(parent, slot_id);
11031
11034
11037 }
11038
11040 {
11041 super.OnWasDetached(parent, slot_id);
11042
11045
11048 }
11049
11051 {
11052 int idx;
11055
11056 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11057 if (inventory_slots.Count() < 1)
11058 {
11059 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11060 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11061 }
11062 else
11063 {
11064 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11065 }
11066
11067 idx = inventory_slots.Find(slot);
11068 if (idx < 0)
11069 return "";
11070
11071 return attach_types.Get(idx);
11072 }
11073
11075 {
11076 int idx = -1;
11077 string slot;
11078
11081
11082 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11083 if (inventory_slots.Count() < 1)
11084 {
11085 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11086 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11087 }
11088 else
11089 {
11090 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11091 if (detach_types.Count() < 1)
11092 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11093 }
11094
11095 for (int i = 0; i < inventory_slots.Count(); i++)
11096 {
11097 slot = inventory_slots.Get(i);
11098 }
11099
11100 if (slot != "")
11101 {
11102 if (detach_types.Count() == 1)
11103 idx = 0;
11104 else
11105 idx = inventory_slots.Find(slot);
11106 }
11107 if (idx < 0)
11108 return "";
11109
11110 return detach_types.Get(idx);
11111 }
11112
11114 {
11115
11117
11118
11119 float min_time = 1;
11120 float max_time = 3;
11121 float delay = Math.RandomFloat(min_time, max_time);
11122
11123 explode_timer.Run(delay, this, "DoAmmoExplosion");
11124 }
11125
11127 {
11128 Magazine magazine = Magazine.Cast(this);
11129 int pop_sounds_count = 6;
11130 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11131
11132
11133 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11134 string sound_name = pop_sounds[ sound_idx ];
11135 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11136
11137
11138 magazine.ServerAddAmmoCount(-1);
11139
11140
11141 float min_temp_to_explode = 100;
11142
11143 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11144 {
11146 }
11147 }
11148
11149
11150 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11151 {
11152 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11153
11154 const int CHANCE_DAMAGE_CARGO = 4;
11155 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11156 const int CHANCE_DAMAGE_NOTHING = 2;
11157
11159 {
11160 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11161 int chances;
11162 int rnd;
11163
11164 if (GetInventory().GetCargo())
11165 {
11166 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11167 rnd = Math.RandomInt(0,chances);
11168
11169 if (rnd < CHANCE_DAMAGE_CARGO)
11170 {
11172 }
11173 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11174 {
11176 }
11177 }
11178 else
11179 {
11180 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11181 rnd = Math.RandomInt(0,chances);
11182
11183 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11184 {
11186 }
11187 }
11188 }
11189 }
11190
11192 {
11193 CargoBase cargo = GetInventory().GetCargo();
11194 if (cargo)
11195 {
11197 if (item_count > 0)
11198 {
11199 int random_pick = Math.RandomInt(0, item_count);
11201 if (!item.IsExplosive())
11202 {
11203 item.AddHealth("","",damage);
11204 return true;
11205 }
11206 }
11207 }
11208 return false;
11209 }
11210
11212 {
11213 GameInventory inventory = GetInventory();
11215 if (attachment_count > 0)
11216 {
11217 int random_pick = Math.RandomInt(0, attachment_count);
11219 if (!attachment.IsExplosive())
11220 {
11221 attachment.AddHealth("","",damage);
11222 return true;
11223 }
11224 }
11225 return false;
11226 }
11227
11229 {
11231 }
11232
11234 {
11236 return GetInventory().CanRemoveEntity();
11237
11238 return false;
11239 }
11240
11242 {
11243
11245 return false;
11246
11247
11249 return false;
11250
11251
11252
11254 if (delta == 0)
11255 return false;
11256
11257
11258 return true;
11259 }
11260
11262 {
11264 {
11265 if (ScriptInputUserData.CanStoreInputUserData())
11266 {
11267 ScriptInputUserData ctx = new ScriptInputUserData;
11272 ctx.
Write(destination_entity);
11274 ctx.
Write(slot_id);
11276 }
11277 }
11278 else if (!
g_Game.IsMultiplayer())
11279 {
11281 }
11282 }
11283
11285 {
11286 float split_quantity_new;
11290 InventoryLocation loc = new InventoryLocation;
11291
11292 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11293 {
11295 split_quantity_new = stack_max;
11296 else
11298
11300 {
11301 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11302 if (new_item)
11303 {
11304 new_item.SetResultOfSplit(true);
11305 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11307 new_item.
SetQuantity(split_quantity_new,
false,
true);
11308 }
11309 }
11310 }
11311 else if (destination_entity && slot_id == -1)
11312 {
11313 if (quantity > stack_max)
11314 split_quantity_new = stack_max;
11315 else
11316 split_quantity_new = quantity;
11317
11319 {
11320 GameInventory destinationInventory = destination_entity.GetInventory();
11322 {
11325 }
11326
11327 if (new_item)
11328 {
11329 new_item.SetResultOfSplit(true);
11330 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11332 new_item.
SetQuantity(split_quantity_new,
false,
true);
11333 }
11334 }
11335 }
11336 else
11337 {
11338 if (stack_max != 0)
11339 {
11341 {
11343 }
11344
11345 if (split_quantity_new == 0)
11346 {
11347 if (!
g_Game.IsMultiplayer())
11348 player.PhysicalPredictiveDropItem(this);
11349 else
11350 player.ServerDropEntity(this);
11351 return;
11352 }
11353
11355 {
11357
11358 if (new_item)
11359 {
11360 new_item.SetResultOfSplit(true);
11361 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11364 new_item.PlaceOnSurface();
11365 }
11366 }
11367 }
11368 }
11369 }
11370
11372 {
11373 float split_quantity_new;
11377 InventoryLocation loc = new InventoryLocation;
11378
11379 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11380 {
11382 split_quantity_new = stack_max;
11383 else
11385
11387 {
11388 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11389 if (new_item)
11390 {
11391 new_item.SetResultOfSplit(true);
11392 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11394 new_item.
SetQuantity(split_quantity_new,
false,
true);
11395 }
11396 }
11397 }
11398 else if (destination_entity && slot_id == -1)
11399 {
11400 if (quantity > stack_max)
11401 split_quantity_new = stack_max;
11402 else
11403 split_quantity_new = quantity;
11404
11406 {
11407 GameInventory destinationInventory = destination_entity.GetInventory();
11409 {
11412 }
11413
11414 if (new_item)
11415 {
11416 new_item.SetResultOfSplit(true);
11417 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11419 new_item.
SetQuantity(split_quantity_new,
false,
true);
11420 }
11421 }
11422 }
11423 else
11424 {
11425 if (stack_max != 0)
11426 {
11428 {
11430 }
11431
11433 {
11435
11436 if (new_item)
11437 {
11438 new_item.SetResultOfSplit(true);
11439 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11442 new_item.PlaceOnSurface();
11443 }
11444 }
11445 }
11446 }
11447 }
11448
11450 {
11452 {
11453 if (ScriptInputUserData.CanStoreInputUserData())
11454 {
11455 ScriptInputUserData ctx = new ScriptInputUserData;
11460 dst.WriteToContext(ctx);
11462 }
11463 }
11464 else if (!
g_Game.IsMultiplayer())
11465 {
11467 }
11468 }
11469
11471 {
11473 {
11474 if (ScriptInputUserData.CanStoreInputUserData())
11475 {
11476 ScriptInputUserData ctx = new ScriptInputUserData;
11481 ctx.
Write(destination_entity);
11487 }
11488 }
11489 else if (!
g_Game.IsMultiplayer())
11490 {
11492 }
11493 }
11494
11496 {
11498 }
11499
11501 {
11503 float split_quantity_new;
11505 if (dst.IsValid())
11506 {
11507 int slot_id = dst.GetSlot();
11509
11510 if (quantity > stack_max)
11511 split_quantity_new = stack_max;
11512 else
11513 split_quantity_new = quantity;
11514
11516 {
11518
11519 if (new_item)
11520 {
11521 new_item.SetResultOfSplit(true);
11522 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11524 new_item.
SetQuantity(split_quantity_new,
false,
true);
11525 }
11526
11527 return new_item;
11528 }
11529 }
11530
11531 return null;
11532 }
11533
11535 {
11537 float split_quantity_new;
11539 if (destination_entity)
11540 {
11542 if (quantity > stackable)
11543 split_quantity_new = stackable;
11544 else
11545 split_quantity_new = quantity;
11546
11548 {
11549 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11550 if (new_item)
11551 {
11552 new_item.SetResultOfSplit(true);
11553 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11555 new_item.
SetQuantity(split_quantity_new,
false,
true);
11556 }
11557 }
11558 }
11559 }
11560
11562 {
11564 {
11565 if (ScriptInputUserData.CanStoreInputUserData())
11566 {
11567 ScriptInputUserData ctx = new ScriptInputUserData;
11572 ItemBase destination_entity =
this;
11573 ctx.
Write(destination_entity);
11577 }
11578 }
11579 else if (!
g_Game.IsMultiplayer())
11580 {
11582 }
11583 }
11584
11586 {
11588 float split_quantity_new;
11590 if (player)
11591 {
11593 if (quantity > stackable)
11594 split_quantity_new = stackable;
11595 else
11596 split_quantity_new = quantity;
11597
11599 {
11600 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11601 new_item =
ItemBase.Cast(in_hands);
11602 if (new_item)
11603 {
11604 new_item.SetResultOfSplit(true);
11605 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11607 new_item.SetQuantity(split_quantity_new, false, true);
11608 }
11609 }
11610 }
11611 }
11612
11614 {
11616 float split_quantity_new = Math.Floor(quantity * 0.5);
11617
11619 return;
11620
11622
11623 if (new_item)
11624 {
11625 if (new_item.GetQuantityMax() < split_quantity_new)
11626 {
11627 split_quantity_new = new_item.GetQuantityMax();
11628 }
11629
11630 new_item.SetResultOfSplit(true);
11631 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11632
11634 {
11637 }
11638 else
11639 {
11641 new_item.
SetQuantity(split_quantity_new,
false,
true);
11642 }
11643 }
11644 }
11645
11647 {
11649 float split_quantity_new = Math.Floor(quantity / 2);
11650
11652 return;
11653
11654 InventoryLocation invloc = new InventoryLocation;
11656
11658 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11659
11660 if (new_item)
11661 {
11662 if (new_item.GetQuantityMax() < split_quantity_new)
11663 {
11664 split_quantity_new = new_item.GetQuantityMax();
11665 }
11667 {
11670 }
11671 else if (split_quantity_new > 1)
11672 {
11674 new_item.
SetQuantity(split_quantity_new,
false,
true);
11675 }
11676 }
11677 }
11678
11681 {
11682 SetWeightDirty();
11684
11685 if (parent)
11686 parent.OnAttachmentQuantityChangedEx(this, delta);
11687
11689 {
11691 {
11693 }
11695 {
11696 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11698 }
11699 }
11700 }
11701
11704 {
11705
11706 }
11707
11710 {
11712 }
11713
11715 {
11716 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11717
11719 {
11720 if (newLevel == GameConstants.STATE_RUINED)
11721 {
11723 EntityAI parent = GetHierarchyParent();
11724 if (parent && parent.IsFireplace())
11725 {
11726 CargoBase cargo = GetInventory().GetCargo();
11727 if (cargo)
11728 {
11730 {
11732 }
11733 }
11734 }
11735 }
11736
11738 {
11739
11741 return;
11742 }
11743
11744 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11745 {
11747 }
11748 }
11749 }
11750
11751
11753 {
11754 super.OnRightClick();
11755
11757 {
11759 {
11760 if (ScriptInputUserData.CanStoreInputUserData())
11761 {
11762 EntityAI root = GetHierarchyRoot();
11763 Man playerOwner = GetHierarchyRootPlayer();
11764 InventoryLocation dst = new InventoryLocation;
11765
11766
11767 if (!playerOwner && root && root == this)
11768 {
11770 }
11771 else
11772 {
11773
11774 GetInventory().GetCurrentInventoryLocation(dst);
11776 {
11777 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11779 {
11781 }
11782 else
11783 {
11785
11786
11787 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11788 {
11790 }
11791 else
11792 {
11793 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11794 }
11795 }
11796 }
11797 }
11798
11799 ScriptInputUserData ctx = new ScriptInputUserData;
11807 }
11808 }
11809 else if (!
g_Game.IsMultiplayer())
11810 {
11812 }
11813 }
11814 }
11815
11817 {
11818 if (root)
11819 {
11820 vector m4[4];
11821 root.GetTransform(m4);
11822 dst.SetGround(this, m4);
11823 }
11824 else
11825 {
11826 GetInventory().GetCurrentInventoryLocation(dst);
11827 }
11828 }
11829
11830 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11831 {
11832
11833 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11834 return false;
11835
11836 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11837 return false;
11838
11839
11841 return false;
11842
11843
11844 Magazine mag = Magazine.Cast(this);
11845 if (mag)
11846 {
11847 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11848 return false;
11849
11850 if (stack_max_limit)
11851 {
11852 Magazine other_mag = Magazine.Cast(other_item);
11853 if (other_item)
11854 {
11855 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11856 return false;
11857 }
11858
11859 }
11860 }
11861 else
11862 {
11863
11865 return false;
11866
11868 return false;
11869 }
11870
11871 PlayerBase player = null;
11872 if (CastTo(player, GetHierarchyRootPlayer()))
11873 {
11874 if (player.GetInventory().HasAttachment(this))
11875 return false;
11876
11877 if (player.IsItemsToDelete())
11878 return false;
11879 }
11880
11881 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11882 return false;
11883
11884 int slotID;
11886 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11887 return false;
11888
11889 return true;
11890 }
11891
11893 {
11895 }
11896
11898 {
11899 return m_IsResultOfSplit;
11900 }
11901
11903 {
11904 m_IsResultOfSplit = value;
11905 }
11906
11908 {
11910 }
11911
11913 {
11914 float other_item_quantity = other_item.GetQuantity();
11915 float this_free_space;
11916
11918
11920
11921 if (other_item_quantity > this_free_space)
11922 {
11923 return this_free_space;
11924 }
11925 else
11926 {
11927 return other_item_quantity;
11928 }
11929 }
11930
11932 {
11934 }
11935
11937 {
11939 return;
11940
11941 if (!IsMagazine() && other_item)
11942 {
11944 if (quantity_used != 0)
11945 {
11946 float hp1 = GetHealth01("","");
11947 float hp2 = other_item.GetHealth01("","");
11948 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11949 hpResult = hpResult / (
GetQuantity() + quantity_used);
11950
11951 hpResult *= GetMaxHealth();
11952 Math.Round(hpResult);
11953 SetHealth("", "Health", hpResult);
11954
11956 other_item.AddQuantity(-quantity_used);
11957 }
11958 }
11960 }
11961
11963 {
11964 #ifdef SERVER
11965 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11966 GetHierarchyParent().IncreaseLifetimeUp();
11967 #endif
11968 };
11969
11971 {
11972 PlayerBase p = PlayerBase.Cast(player);
11973
11974 array<int> recipesIds = p.m_Recipes;
11975 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11976 if (moduleRecipesManager)
11977 {
11978 EntityAI itemInHands = player.GetEntityInHands();
11979 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11980 }
11981
11982 for (int i = 0;i < recipesIds.Count(); i++)
11983 {
11984 int key = recipesIds.Get(i);
11985 string recipeName = moduleRecipesManager.GetRecipeName(key);
11987 }
11988 }
11989
11990
11991 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11992 {
11993 super.GetDebugActions(outputList);
11994
11995
12001
12002
12007
12012
12013
12017
12018
12020 {
12024 }
12025
12028
12029
12033
12035
12036 InventoryLocation loc = new InventoryLocation();
12037 GetInventory().GetCurrentInventoryLocation(loc);
12039 {
12040 if (Gizmo_IsSupported())
12043 }
12044
12046 }
12047
12048
12049
12050
12052 {
12053 super.OnAction(action_id, player, ctx);
12054
12056 {
12057 switch (action_id)
12058 {
12062 return true;
12066 return true;
12067 }
12068 }
12069
12071 {
12072 switch (action_id)
12073 {
12075 Delete();
12076 return true;
12077 }
12078 }
12079
12080 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12081 {
12082 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12083 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12084 PlayerBase p = PlayerBase.Cast(player);
12085 if (
EActions.RECIPES_RANGE_START < 1000)
12086 {
12087 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12088 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12089 }
12090 }
12091 #ifndef SERVER
12092 else if (action_id ==
EActions.WATCH_PLAYER)
12093 {
12094 PluginDeveloper.SetDeveloperItemClientEx(player);
12095 }
12096 #endif
12098 {
12099 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12100 {
12101 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12102 OnDebugButtonPressServer(id + 1);
12103 }
12104
12105 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12106 {
12107 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12109 }
12110
12111 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12112 {
12113 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12115 }
12116
12117 else if (action_id ==
EActions.ADD_QUANTITY)
12118 {
12119 if (IsMagazine())
12120 {
12121 Magazine mag = Magazine.Cast(this);
12122 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12123 }
12124 else
12125 {
12127 }
12128
12129 if (m_EM)
12130 {
12131 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12132 }
12133
12134 }
12135
12136 else if (action_id ==
EActions.REMOVE_QUANTITY)
12137 {
12138 if (IsMagazine())
12139 {
12140 Magazine mag2 = Magazine.Cast(this);
12141 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12142 }
12143 else
12144 {
12146 }
12147 if (m_EM)
12148 {
12149 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12150 }
12151
12152 }
12153
12154 else if (action_id ==
EActions.SET_QUANTITY_0)
12155 {
12157
12158 if (m_EM)
12159 {
12160 m_EM.SetEnergy(0);
12161 }
12162 }
12163
12164 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12165 {
12167
12168 if (m_EM)
12169 {
12170 m_EM.SetEnergy(m_EM.GetEnergyMax());
12171 }
12172 }
12173
12174 else if (action_id ==
EActions.ADD_HEALTH)
12175 {
12176 AddHealth("","",GetMaxHealth("","Health")/5);
12177 }
12178 else if (action_id ==
EActions.REMOVE_HEALTH)
12179 {
12180 AddHealth("","",-GetMaxHealth("","Health")/5);
12181 }
12182 else if (action_id ==
EActions.DESTROY_HEALTH)
12183 {
12184 SetHealth01("","",0);
12185 }
12186 else if (action_id ==
EActions.WATCH_ITEM)
12187 {
12189 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12190 #ifdef DEVELOPER
12191 SetDebugDeveloper_item(this);
12192 #endif
12193 }
12194
12195 else if (action_id ==
EActions.ADD_TEMPERATURE)
12196 {
12197 AddTemperature(20);
12198
12199 }
12200
12201 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12202 {
12203 AddTemperature(-20);
12204
12205 }
12206
12207 else if (action_id ==
EActions.FLIP_FROZEN)
12208 {
12209 SetFrozen(!GetIsFrozen());
12210
12211 }
12212
12213 else if (action_id ==
EActions.ADD_WETNESS)
12214 {
12216
12217 }
12218
12219 else if (action_id ==
EActions.REMOVE_WETNESS)
12220 {
12222
12223 }
12224
12225 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12226 {
12229
12230
12231 }
12232
12233 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12234 {
12237 }
12238
12239 else if (action_id ==
EActions.MAKE_SPECIAL)
12240 {
12241 auto debugParams = DebugSpawnParams.WithPlayer(player);
12242 OnDebugSpawnEx(debugParams);
12243 }
12244
12245 }
12246
12247
12248 return false;
12249 }
12250
12251
12252
12253
12257
12260
12261
12262
12264 {
12265 return false;
12266 }
12267
12268
12270 {
12271 return true;
12272 }
12273
12274
12276 {
12277 return true;
12278 }
12279
12280
12281
12283 {
12284 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12285 return g_Game.ConfigIsExisting(config_path);
12286 }
12287
12290 {
12291 return null;
12292 }
12293
12295 {
12296 return false;
12297 }
12298
12300 {
12301 return false;
12302 }
12303
12307
12308
12310 {
12311 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12312 return module_repairing.CanRepair(this, item_repair_kit);
12313 }
12314
12315
12316 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12317 {
12318 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12319 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12320 }
12321
12322
12324 {
12325
12326
12327
12328
12329
12330
12331
12332
12333 return 1;
12334 }
12335
12336
12337
12339 {
12341 }
12342
12343
12344
12346 {
12348 }
12349
12350
12359 {
12360 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12361
12362 if (player)
12363 {
12364 player.MessageStatus(text);
12365 }
12366 }
12367
12368
12377 {
12378 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12379
12380 if (player)
12381 {
12382 player.MessageAction(text);
12383 }
12384 }
12385
12386
12395 {
12396 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12397
12398 if (player)
12399 {
12400 player.MessageFriendly(text);
12401 }
12402 }
12403
12404
12413 {
12414 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12415
12416 if (player)
12417 {
12418 player.MessageImportant(text);
12419 }
12420 }
12421
12423 {
12424 return true;
12425 }
12426
12427
12428 override bool KindOf(
string tag)
12429 {
12430 bool found = false;
12431 string item_name = this.
GetType();
12433 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12434
12435 int array_size = item_tag_array.Count();
12436 for (int i = 0; i < array_size; i++)
12437 {
12438 if (item_tag_array.Get(i) == tag)
12439 {
12440 found = true;
12441 break;
12442 }
12443 }
12444 return found;
12445 }
12446
12447
12449 {
12450
12451 super.OnRPC(sender, rpc_type,ctx);
12452
12453
12454 switch (rpc_type)
12455 {
12456 #ifndef SERVER
12457 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12458 Param2<bool, string> p = new Param2<bool, string>(false, "");
12459
12461 return;
12462
12463 bool play = p.param1;
12464 string soundSet = p.param2;
12465
12466 if (play)
12467 {
12469 {
12471 {
12473 }
12474 }
12475 else
12476 {
12478 }
12479 }
12480 else
12481 {
12483 }
12484
12485 break;
12486 #endif
12487
12488 }
12489
12491 {
12493 }
12494 }
12495
12496
12497
12498
12500 {
12501 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12502 return plugin.GetID(
name);
12503 }
12504
12506 {
12507 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12508 return plugin.GetName(id);
12509 }
12510
12513 {
12514
12515
12516 int varFlags;
12517 if (!ctx.
Read(varFlags))
12518 return;
12519
12520 if (varFlags & ItemVariableFlags.FLOAT)
12521 {
12523 }
12524 }
12525
12527 {
12528
12529 super.SerializeNumericalVars(floats_out);
12530
12531
12532
12534 {
12536 }
12537
12539 {
12541 }
12542
12544 {
12546 }
12547
12549 {
12554 }
12555
12557 {
12559 }
12560 }
12561
12563 {
12564
12565 super.DeSerializeNumericalVars(floats);
12566
12567
12568 int index = 0;
12569 int mask = Math.Round(floats.Get(index));
12570
12571 index++;
12572
12574 {
12576 {
12578 }
12579 else
12580 {
12581 float quantity = floats.Get(index);
12582 SetQuantity(quantity,
true,
false,
false,
false);
12583 }
12584 index++;
12585 }
12586
12588 {
12589 float wet = floats.Get(index);
12591 index++;
12592 }
12593
12595 {
12596 int liquidtype = Math.Round(floats.Get(index));
12598 index++;
12599 }
12600
12602 {
12604 index++;
12606 index++;
12608 index++;
12610 index++;
12611 }
12612
12614 {
12615 int cleanness = Math.Round(floats.Get(index));
12617 index++;
12618 }
12619 }
12620
12622 {
12623 super.WriteVarsToCTX(ctx);
12624
12625
12627 {
12629 }
12630
12632 {
12634 }
12635
12637 {
12639 }
12640
12642 {
12643 int r,g,b,a;
12649 }
12650
12652 {
12654 }
12655 }
12656
12658 {
12659 if (!super.ReadVarsFromCTX(ctx,version))
12660 return false;
12661
12662 int intValue;
12663 float value;
12664
12665 if (version < 140)
12666 {
12667 if (!ctx.
Read(intValue))
12668 return false;
12669
12670 m_VariablesMask = intValue;
12671 }
12672
12674 {
12675 if (!ctx.
Read(value))
12676 return false;
12677
12679 {
12681 }
12682 else
12683 {
12685 }
12686 }
12687
12688 if (version < 140)
12689 {
12691 {
12692 if (!ctx.
Read(value))
12693 return false;
12694 SetTemperatureDirect(value);
12695 }
12696 }
12697
12699 {
12700 if (!ctx.
Read(value))
12701 return false;
12703 }
12704
12706 {
12707 if (!ctx.
Read(intValue))
12708 return false;
12710 }
12711
12713 {
12714 int r,g,b,a;
12716 return false;
12718 return false;
12720 return false;
12722 return false;
12723
12725 }
12726
12728 {
12729 if (!ctx.
Read(intValue))
12730 return false;
12732 }
12733
12734 if (version >= 138 && version < 140)
12735 {
12737 {
12738 if (!ctx.
Read(intValue))
12739 return false;
12740 SetFrozen(intValue);
12741 }
12742 }
12743
12744 return true;
12745 }
12746
12747
12749 {
12752 {
12754 }
12755
12756 if (!super.OnStoreLoad(ctx, version))
12757 {
12759 return false;
12760 }
12761
12762 if (version >= 114)
12763 {
12764 bool hasQuickBarIndexSaved;
12765
12766 if (!ctx.
Read(hasQuickBarIndexSaved))
12767 {
12769 return false;
12770 }
12771
12772 if (hasQuickBarIndexSaved)
12773 {
12774 int itmQBIndex;
12775
12776
12777 if (!ctx.
Read(itmQBIndex))
12778 {
12780 return false;
12781 }
12782
12783 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12784 if (itmQBIndex != -1 && parentPlayer)
12785 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12786 }
12787 }
12788 else
12789 {
12790
12791 PlayerBase player;
12792 int itemQBIndex;
12793 if (version ==
int.
MAX)
12794 {
12795 if (!ctx.
Read(itemQBIndex))
12796 {
12798 return false;
12799 }
12800 }
12801 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12802 {
12803
12804 if (!ctx.
Read(itemQBIndex))
12805 {
12807 return false;
12808 }
12809 if (itemQBIndex != -1 && player)
12810 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12811 }
12812 }
12813
12814 if (version < 140)
12815 {
12816
12817 if (!LoadVariables(ctx, version))
12818 {
12820 return false;
12821 }
12822 }
12823
12824
12826 {
12828 return false;
12829 }
12830 if (version >= 132)
12831 {
12833 if (raib)
12834 {
12836 {
12838 return false;
12839 }
12840 }
12841 }
12842
12844 return true;
12845 }
12846
12847
12848
12850 {
12851 super.OnStoreSave(ctx);
12852
12853 PlayerBase player;
12854 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12855 {
12857
12858 int itemQBIndex = -1;
12859 itemQBIndex = player.FindQuickBarEntityIndex(this);
12860 ctx.
Write(itemQBIndex);
12861 }
12862 else
12863 {
12865 }
12866
12868
12870 if (raib)
12871 {
12873 }
12874 }
12875
12876
12878 {
12879 super.AfterStoreLoad();
12880
12882 {
12884 }
12885
12887 {
12890 }
12891 }
12892
12894 {
12895 super.EEOnAfterLoad();
12896
12898 {
12900 }
12901
12904 }
12905
12907 {
12908 return false;
12909 }
12910
12911
12912
12914 {
12916 {
12917 #ifdef PLATFORM_CONSOLE
12918
12920 {
12922 if (menu)
12923 {
12925 }
12926 }
12927 #endif
12928 }
12929
12931 {
12934 }
12935
12937 {
12938 SetWeightDirty();
12940 }
12942 {
12945 }
12946
12948 {
12951
12954 }
12956 {
12960 }
12961
12962 super.OnVariablesSynchronized();
12963 }
12964
12965
12966
12968 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12969 {
12970 if (!IsServerCheck(allow_client))
12971 return false;
12972
12974 return false;
12975
12978
12979 if (value <= (min + 0.001))
12980 value = min;
12981
12982 if (value == min)
12983 {
12984 if (destroy_config)
12985 {
12986 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12987 if (dstr)
12988 {
12990 this.Delete();
12991 return true;
12992 }
12993 }
12994 else if (destroy_forced)
12995 {
12997 this.Delete();
12998 return true;
12999 }
13000
13002 }
13003
13006
13008 {
13009 EntityAI parent = GetHierarchyRoot();
13010 InventoryLocation iLoc = new InventoryLocation();
13011 GetInventory().GetCurrentInventoryLocation(iLoc);
13013 {
13014 int iLocSlot = iLoc.
GetSlot();
13016 {
13018 }
13020 {
13022 }
13023 }
13024 }
13025
13027 {
13029
13030 if (delta)
13032 }
13033
13035
13036 return false;
13037 }
13038
13039
13041 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13042 {
13044 }
13045
13047 {
13050 }
13051
13053 {
13056 }
13057
13059 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13060 {
13061 float value_clamped = Math.Clamp(value, 0, 1);
13063 SetQuantity(result, destroy_config, destroy_forced);
13064 }
13065
13066
13069 {
13071 }
13072
13074 {
13076 }
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13088 {
13089 int slot = -1;
13090 GameInventory inventory = GetInventory();
13091 if (inventory)
13092 {
13093 InventoryLocation il = new InventoryLocation;
13096 }
13097
13099 }
13100
13102 {
13103 float quantity_max = 0;
13104
13106 {
13107 if (attSlotID != -1)
13108 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13109
13110 if (quantity_max <= 0)
13112 }
13113
13114 if (quantity_max <= 0)
13116
13117 return quantity_max;
13118 }
13119
13121 {
13123 }
13124
13126 {
13128 }
13129
13130
13132 {
13134 }
13135
13137 {
13139 }
13140
13142 {
13144 }
13145
13146
13148 {
13149
13150 float weightEx = GetWeightEx();
13151 float special = GetInventoryAndCargoWeight();
13152 return weightEx - special;
13153 }
13154
13155
13157 {
13159 }
13160
13162 {
13164 {
13165 #ifdef DEVELOPER
13166 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13167 {
13168 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13170 }
13171 #endif
13172
13173 return GetQuantity() * GetConfigWeightModified();
13174 }
13175 else if (HasEnergyManager())
13176 {
13177 #ifdef DEVELOPER
13178 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13179 {
13180 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13181 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13182 }
13183 #endif
13184 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13185 }
13186 else
13187 {
13188 #ifdef DEVELOPER
13189 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13190 {
13191 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13192 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13193 }
13194 #endif
13195 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13196 }
13197 }
13198
13201 {
13202 int item_count = 0;
13204
13205 GameInventory inventory = GetInventory();
13206 CargoBase cargo = inventory.
GetCargo();
13207 if (cargo != NULL)
13208 {
13210 }
13211
13213 for (int i = 0; i < nAttachments; ++i)
13214 {
13216 if (item)
13217 item_count += item.GetNumberOfItems();
13218 }
13219 return item_count;
13220 }
13221
13224 {
13225 float weight = 0;
13226 float wetness = 1;
13227 if (include_wetness)
13230 {
13231 weight = wetness * m_ConfigWeight;
13232 }
13234 {
13235 weight = 1;
13236 }
13237 return weight;
13238 }
13239
13240
13241
13243 {
13244 GameInventory inventory = GetInventory();
13245 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13246 {
13247 array<EntityAI> items = new array<EntityAI>;
13249 for (int i = 0; i < items.Count(); ++i)
13250 {
13252 if (item)
13253 {
13254 g_Game.ObjectDelete(item);
13255 }
13256 }
13257 }
13258 }
13259
13260
13261
13262
13264 {
13265 float energy = 0;
13266 if (HasEnergyManager())
13267 {
13268 energy = GetCompEM().GetEnergy();
13269 }
13270 return energy;
13271 }
13272
13273
13275 {
13276 super.OnEnergyConsumed();
13277
13279 }
13280
13282 {
13283 super.OnEnergyAdded();
13284
13286 }
13287
13288
13290 {
13291 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13292 {
13294 {
13295 float energy_0to1 = GetCompEM().GetEnergy0To1();
13297 }
13298 }
13299 }
13300
13301
13303 {
13304 return ConfigGetFloat("heatIsolation");
13305 }
13306
13308 {
13310 }
13311
13313 {
13314 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13315 if (
g_Game.ConfigIsExisting(paramPath))
13316 return g_Game.ConfigGetFloat(paramPath);
13317
13318 return 0.0;
13319 }
13320
13322 {
13323 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13324 if (
g_Game.ConfigIsExisting(paramPath))
13325 return g_Game.ConfigGetFloat(paramPath);
13326
13327 return 0.0;
13328 }
13329
13330 override void SetWet(
float value,
bool allow_client =
false)
13331 {
13332 if (!IsServerCheck(allow_client))
13333 return;
13334
13337
13339
13340 m_VarWet = Math.Clamp(value, min, max);
13341
13343 {
13346 }
13347 }
13348
13349 override void AddWet(
float value)
13350 {
13352 }
13353
13355 {
13357 }
13358
13360 {
13362 }
13363
13365 {
13367 }
13368
13370 {
13372 }
13373
13375 {
13377 }
13378
13379 override void OnWetChanged(
float newVal,
float oldVal)
13380 {
13383 if (newLevel != oldLevel)
13384 {
13386 }
13387 }
13388
13390 {
13391 SetWeightDirty();
13392 }
13393
13395 {
13396 return GetWetLevelInternal(
m_VarWet);
13397 }
13398
13399
13400
13402 {
13404 }
13405
13407 {
13409 }
13410
13412 {
13414 }
13415
13417 {
13419 }
13420
13421
13422
13424 {
13425 if (ConfigIsExisting("itemModelLength"))
13426 {
13427 return ConfigGetFloat("itemModelLength");
13428 }
13429 return 0;
13430 }
13431
13433 {
13434 if (ConfigIsExisting("itemAttachOffset"))
13435 {
13436 return ConfigGetFloat("itemAttachOffset");
13437 }
13438 return 0;
13439 }
13440
13441 override void SetCleanness(
int value,
bool allow_client =
false)
13442 {
13443 if (!IsServerCheck(allow_client))
13444 return;
13445
13447
13449
13452 }
13453
13455 {
13457 }
13458
13460 {
13461 return true;
13462 }
13463
13464
13465
13466
13468 {
13470 }
13471
13473 {
13475 }
13476
13477
13478
13479
13480 override void SetColor(
int r,
int g,
int b,
int a)
13481 {
13487 }
13489 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13490 {
13495 }
13496
13498 {
13500 }
13501
13504 {
13505 int r,g,b,a;
13507 r = r/255;
13508 g = g/255;
13509 b = b/255;
13510 a = a/255;
13511 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13512 }
13513
13514
13515
13516 override void SetLiquidType(
int value,
bool allow_client =
false)
13517 {
13518 if (!IsServerCheck(allow_client))
13519 return;
13520
13525 }
13526
13528 {
13529 return ConfigGetInt("varLiquidTypeInit");
13530 }
13531
13533 {
13535 }
13536
13538 {
13540 SetFrozen(false);
13541 }
13542
13545 {
13546 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13547 }
13548
13549
13552 {
13553 PlayerBase nplayer;
13554 if (PlayerBase.CastTo(nplayer, player))
13555 {
13557 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13558 }
13559 }
13560
13561
13564 {
13565 PlayerBase nplayer;
13566 if (PlayerBase.CastTo(nplayer,player))
13567 {
13568 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13569 }
13570
13571 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13572
13573 if (HasEnergyManager())
13574 {
13575 GetCompEM().UpdatePlugState();
13576 }
13577 }
13578
13579
13581 {
13582 super.OnPlacementStarted(player);
13583
13585 }
13586
13587 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13588 {
13590 {
13591 m_AdminLog.OnPlacementComplete(player,
this);
13592 }
13593
13594 super.OnPlacementComplete(player, position, orientation);
13595 }
13596
13597
13598
13599
13600
13602 {
13604 {
13605 return true;
13606 }
13607 else
13608 {
13609 return false;
13610 }
13611 }
13612
13613
13615 {
13617 {
13619 }
13620 }
13621
13622
13624 {
13626 }
13627
13629 {
13631 }
13632
13633 override void InsertAgent(
int agent,
float count = 1)
13634 {
13635 if (count < 1)
13636 return;
13637
13639 }
13640
13643 {
13645 }
13646
13647
13649 {
13651 }
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13695 {
13697 return false;
13698 return true;
13699 }
13700
13702 {
13703
13705 }
13706
13707
13710 {
13711 super.CheckForRoofLimited(timeTresholdMS);
13712
13713 float time =
g_Game.GetTime();
13714 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13715 {
13716 m_PreviousRoofTestTime = time;
13717 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13718 }
13719 }
13720
13721
13723 {
13725 {
13726 return 0;
13727 }
13728
13729 if (GetInventory().GetAttachmentSlotsCount() != 0)
13730 {
13731 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13732 if (filter)
13733 return filter.GetProtectionLevel(type, false, system);
13734 else
13735 return 0;
13736 }
13737
13738 string subclassPath, entryName;
13739
13740 switch (type)
13741 {
13743 entryName = "biological";
13744 break;
13746 entryName = "chemical";
13747 break;
13748 default:
13749 entryName = "biological";
13750 break;
13751 }
13752
13753 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13754
13755 return g_Game.ConfigGetFloat(subclassPath + entryName);
13756 }
13757
13758
13759
13762 {
13763 if (!IsMagazine())
13765
13767 }
13768
13769
13770
13771
13772
13777 {
13778 return true;
13779 }
13780
13782 {
13784 }
13785
13786
13787
13788
13789
13791 {
13792 if (parent)
13793 {
13794 if (parent.IsInherited(DayZInfected))
13795 return true;
13796
13797 if (!parent.IsRuined())
13798 return true;
13799 }
13800
13801 return true;
13802 }
13803
13805 {
13806 if (!super.CanPutAsAttachment(parent))
13807 {
13808 return false;
13809 }
13810
13811 if (!IsRuined() && !parent.IsRuined())
13812 {
13813 return true;
13814 }
13815
13816 return false;
13817 }
13818
13820 {
13821
13822
13823
13824
13825 return super.CanReceiveItemIntoCargo(item);
13826 }
13827
13829 {
13830
13831
13832
13833
13834 GameInventory attachmentInv = attachment.GetInventory();
13836 {
13837 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13838 return false;
13839 }
13840
13841 InventoryLocation loc = new InventoryLocation();
13842 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13843 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13844 return false;
13845
13846 return super.CanReceiveAttachment(attachment, slotId);
13847 }
13848
13850 {
13851 if (!super.CanReleaseAttachment(attachment))
13852 return false;
13853
13854 return GetInventory().AreChildrenAccessible();
13855 }
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13878 {
13879 int id = muzzle_owner.GetMuzzleID();
13880 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13881
13882 if (WPOF_array)
13883 {
13884 for (int i = 0; i < WPOF_array.Count(); i++)
13885 {
13886 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13887
13888 if (WPOF)
13889 {
13890 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13891 }
13892 }
13893 }
13894 }
13895
13896
13898 {
13899 int id = muzzle_owner.GetMuzzleID();
13901
13902 if (WPOBE_array)
13903 {
13904 for (int i = 0; i < WPOBE_array.Count(); i++)
13905 {
13906 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13907
13908 if (WPOBE)
13909 {
13910 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13911 }
13912 }
13913 }
13914 }
13915
13916
13918 {
13919 int id = muzzle_owner.GetMuzzleID();
13920 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13921
13922 if (WPOOH_array)
13923 {
13924 for (int i = 0; i < WPOOH_array.Count(); i++)
13925 {
13926 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13927
13928 if (WPOOH)
13929 {
13930 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13931 }
13932 }
13933 }
13934 }
13935
13936
13938 {
13939 int id = muzzle_owner.GetMuzzleID();
13940 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13941
13942 if (WPOOH_array)
13943 {
13944 for (int i = 0; i < WPOOH_array.Count(); i++)
13945 {
13946 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13947
13948 if (WPOOH)
13949 {
13950 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13951 }
13952 }
13953 }
13954 }
13955
13956
13958 {
13959 int id = muzzle_owner.GetMuzzleID();
13960 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13961
13962 if (WPOOH_array)
13963 {
13964 for (int i = 0; i < WPOOH_array.Count(); i++)
13965 {
13966 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13967
13968 if (WPOOH)
13969 {
13970 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13971 }
13972 }
13973 }
13974 }
13975
13976
13977
13979 {
13981 {
13982 return true;
13983 }
13984
13985 return false;
13986 }
13987
13989 {
13991 {
13992 return true;
13993 }
13994
13995 return false;
13996 }
13997
13999 {
14001 {
14002 return true;
14003 }
14004
14005 return false;
14006 }
14007
14009 {
14010 return false;
14011 }
14012
14015 {
14016 return UATimeSpent.DEFAULT_DEPLOY;
14017 }
14018
14019
14020
14021
14023 {
14025 SetSynchDirty();
14026 }
14027
14029 {
14031 }
14032
14033
14035 {
14036 return false;
14037 }
14038
14041 {
14042 string att_type = "None";
14043
14044 if (ConfigIsExisting("soundAttType"))
14045 {
14046 att_type = ConfigGetString("soundAttType");
14047 }
14048
14050 }
14051
14053 {
14055 }
14056
14057
14058
14059
14060
14066
14068 {
14071
14073 }
14074
14075
14077 {
14079 return;
14080
14082
14085
14088
14089 SoundParameters params = new SoundParameters();
14093 }
14094
14095
14097 {
14099 {
14102
14103 SetSynchDirty();
14104
14107 }
14108 }
14109
14111 {
14113 }
14114
14115
14117 {
14119 return;
14120
14122 SetSynchDirty();
14123
14126 }
14127
14129 {
14132 }
14133
14135 {
14137 }
14138
14139 void OnApply(PlayerBase player);
14140
14142 {
14143 return 1.0;
14144 };
14145
14147 {
14149 }
14150
14152 {
14154 }
14155
14157
14159 {
14160 SetDynamicPhysicsLifeTime(0.01);
14162 }
14163
14165 {
14166 array<string> zone_names = new array<string>;
14167 GetDamageZones(zone_names);
14168 for (int i = 0; i < zone_names.Count(); i++)
14169 {
14170 SetHealthMax(zone_names.Get(i),"Health");
14171 }
14172 SetHealthMax("","Health");
14173 }
14174
14177 {
14178 float global_health = GetHealth01("","Health");
14179 array<string> zones = new array<string>;
14180 GetDamageZones(zones);
14181
14182 for (int i = 0; i < zones.Count(); i++)
14183 {
14184 SetHealth01(zones.Get(i),"Health",global_health);
14185 }
14186 }
14187
14190 {
14191 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14192 }
14193
14195 {
14196 if (!hasRootAsPlayer)
14197 {
14198 if (refParentIB)
14199 {
14200
14201 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14202 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14203
14204 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14205 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14206
14209 }
14210 else
14211 {
14212
14215 }
14216 }
14217 }
14218
14220 {
14222 {
14223 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14224 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14225 {
14226 float heatPermCoef = 1.0;
14228 while (ent)
14229 {
14230 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14231 ent = ent.GetHierarchyParent();
14232 }
14233
14234 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14235 }
14236 }
14237 }
14238
14240 {
14241
14242 EntityAI parent = GetHierarchyParent();
14243 if (!parent)
14244 {
14245 hasParent = false;
14246 hasRootAsPlayer = false;
14247 }
14248 else
14249 {
14250 hasParent = true;
14251 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14252 refParentIB =
ItemBase.Cast(parent);
14253 }
14254 }
14255
14256 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14257 {
14258
14259 }
14260
14262 {
14263
14264 return false;
14265 }
14266
14268 {
14269
14270
14271 return false;
14272 }
14273
14275 {
14276
14277 return false;
14278 }
14279
14282 {
14283 return !GetIsFrozen() &&
IsOpen();
14284 }
14285
14287 {
14288 bool hasParent = false, hasRootAsPlayer = false;
14290
14291 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14292 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14293
14294 if (wwtu || foodDecay)
14295 {
14299
14300 if (processWetness || processTemperature || processDecay)
14301 {
14303
14304 if (processWetness)
14305 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14306
14307 if (processTemperature)
14309
14310 if (processDecay)
14311 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14312 }
14313 }
14314 }
14315
14318 {
14320 }
14321
14323 {
14326
14327 return super.GetTemperatureFreezeThreshold();
14328 }
14329
14331 {
14334
14335 return super.GetTemperatureThawThreshold();
14336 }
14337
14339 {
14342
14343 return super.GetItemOverheatThreshold();
14344 }
14345
14347 {
14349 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14350
14351 return super.GetTemperatureFreezeTime();
14352 }
14353
14355 {
14357 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14358
14359 return super.GetTemperatureThawTime();
14360 }
14361
14366
14368 {
14369 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14370 }
14371
14373 {
14374 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14375 }
14376
14379 {
14381 }
14382
14384 {
14386 }
14387
14389 {
14391 }
14392
14395 {
14396 return null;
14397 }
14398
14401 {
14402 return false;
14403 }
14404
14406 {
14408 {
14411 if (!trg)
14412 {
14414 explosive = this;
14415 }
14416
14417 explosive.PairRemote(trg);
14419
14420 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14421 trg.SetPersistentPairID(persistentID);
14422 explosive.SetPersistentPairID(persistentID);
14423
14424 return true;
14425 }
14426 return false;
14427 }
14428
14431 {
14432 float ret = 1.0;
14435 ret *= GetHealth01();
14436
14437 return ret;
14438 }
14439
14440 #ifdef DEVELOPER
14441 override void SetDebugItem()
14442 {
14443 super.SetDebugItem();
14444 _itemBase = this;
14445 }
14446
14448 {
14449 string text = super.GetDebugText();
14450
14452 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14453
14454 return text;
14455 }
14456 #endif
14457
14459 {
14460 return true;
14461 }
14462
14464
14466
14468 {
14471 }
14472
14473
14481
14497
14498 [
Obsolete(
"Use ItemSoundHandler instead")]
14501 {
14502 if (!
g_Game.IsDedicatedServer())
14503 {
14504 if (ConfigIsExisting("attachSoundSet"))
14505 {
14506 string cfg_path = "";
14507 string soundset = "";
14508 string type_name =
GetType();
14509
14512 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14513 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14514
14515 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14516 {
14517 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14518 {
14519 if (cfg_slot_array[i] == slot_type)
14520 {
14521 soundset = cfg_soundset_array[i];
14522 break;
14523 }
14524 }
14525 }
14526
14527 if (soundset != "")
14528 {
14529 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14531 }
14532 }
14533 }
14534 }
14535
14537}
14538
14540{
14542 if (entity)
14543 {
14544 bool is_item = entity.IsInherited(
ItemBase);
14545 if (is_item && full_quantity)
14546 {
14549 }
14550 }
14551 else
14552 {
14554 return NULL;
14555 }
14556 return entity;
14557}
14558
14560{
14561 if (item)
14562 {
14563 if (health > 0)
14564 item.SetHealth("", "", health);
14565
14566 if (item.CanHaveTemperature())
14567 {
14569 if (item.CanFreeze())
14570 item.SetFrozen(false);
14571 }
14572
14573 if (item.HasEnergyManager())
14574 {
14575 if (quantity >= 0)
14576 {
14577 item.GetCompEM().SetEnergy0To1(quantity);
14578 }
14579 else
14580 {
14582 }
14583 }
14584 else if (item.IsMagazine())
14585 {
14586 Magazine mag = Magazine.Cast(item);
14587 if (quantity >= 0)
14588 {
14589 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14590 }
14591 else
14592 {
14594 }
14595
14596 }
14597 else
14598 {
14599 if (quantity >= 0)
14600 {
14601 item.SetQuantityNormalized(quantity, false);
14602 }
14603 else
14604 {
14606 }
14607
14608 }
14609 }
14610}
14611
14612#ifdef DEVELOPER
14614#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.