9639{
9641 {
9642 return true;
9643 }
9644};
9645
9647{
9648
9649};
9650
9651
9652
9654{
9658
9660
9663
9664
9665
9666
9667
9676
9682
9687
9692
9713 protected bool m_IsResultOfSplit
9714
9716
9721
9722
9723
9725
9729
9730
9731
9733
9736
9737
9738
9744
9745
9753
9756
9757
9759
9760
9762
9763
9768
9769
9774
9776
9777
9779
9780
9782 {
9787
9788 if (!
g_Game.IsDedicatedServer())
9789 {
9791 {
9793
9795 {
9797 }
9798 }
9799
9802 }
9803
9804 m_OldLocation = null;
9805
9807 {
9809 }
9810
9811 if (ConfigIsExisting("headSelectionsToHide"))
9812 {
9815 }
9816
9818 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9819 {
9821 }
9822
9824
9825 m_IsResultOfSplit = false;
9826
9828 }
9829
9831 {
9832 super.InitItemVariables();
9833
9839 m_Count = ConfigGetInt(
"count");
9840
9843
9848
9851
9856
9868
9872
9873
9876 if (ConfigIsExisting("canBeSplit"))
9877 {
9880 }
9881
9883 if (ConfigIsExisting("itemBehaviour"))
9885
9886
9889 RegisterNetSyncVariableInt("m_VarLiquidType");
9890 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9891
9892 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9893 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9894 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9895
9896 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9897 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9898 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9899 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9900
9901 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9902 RegisterNetSyncVariableBool("m_IsTakeable");
9903 RegisterNetSyncVariableBool("m_IsHologram");
9904
9907 {
9910 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9911 }
9912
9914
9916 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9918
9920 }
9921
9923 {
9925 }
9926
9928 {
9931 {
9936 }
9937 }
9938
9939 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9940 {
9942 {
9945 }
9946
9948 }
9949
9951 {
9957 }
9958
9960
9962 {
9964
9965 if (!action)
9966 {
9967 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9968 return;
9969 }
9970
9972 if (!ai)
9973 {
9975 return;
9976 }
9977
9979 if (!action_array)
9980 {
9981 action_array = new array<ActionBase_Basic>;
9983 }
9984 if (LogManager.IsActionLogEnable())
9985 {
9986 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9987 }
9988
9989 if (action_array.Find(action) != -1)
9990 {
9991 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9992 }
9993 else
9994 {
9995 action_array.Insert(action);
9996 }
9997 }
9998
10000 {
10001 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10002 ActionBase action = player.GetActionManager().GetAction(actionName);
10005
10006 if (action_array)
10007 {
10008 action_array.RemoveItem(action);
10009 }
10010 }
10011
10012
10013
10015 {
10016 ActionOverrideData overrideData = new ActionOverrideData();
10020
10022 if (!actionMap)
10023 {
10026 }
10027
10028 actionMap.Insert(this.
Type(), overrideData);
10029
10030 }
10031
10033
10035
10036
10038 {
10041
10044
10045 string config_to_search = "CfgVehicles";
10046 string muzzle_owner_config;
10047
10049 {
10050 if (IsInherited(Weapon))
10051 config_to_search = "CfgWeapons";
10052
10053 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10054
10055 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10056
10057 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10058
10059 if (config_OnFire_subclass_count > 0)
10060 {
10061 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10062
10063 for (int i = 0; i < config_OnFire_subclass_count; i++)
10064 {
10065 string particle_class = "";
10066 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10067 string config_OnFire_entry = config_OnFire_class + particle_class;
10068 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10069 WPOF_array.Insert(WPOF);
10070 }
10071
10072
10074 }
10075 }
10076
10078 {
10079 config_to_search = "CfgWeapons";
10080 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10081
10082 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10083
10084 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10085
10086 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10087 {
10088 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10089
10090 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10091 {
10092 string particle_class2 = "";
10093 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10094 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10095 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10096 WPOBE_array.Insert(WPOBE);
10097 }
10098
10099
10101 }
10102 }
10103 }
10104
10105
10107 {
10110
10112 {
10113 string config_to_search = "CfgVehicles";
10114
10115 if (IsInherited(Weapon))
10116 config_to_search = "CfgWeapons";
10117
10118 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10119 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10120
10121 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10122 {
10123
10125
10127 {
10129 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10131 return;
10132 }
10133
10136
10137
10138
10139 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10140 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10141
10142 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10143 {
10144 string particle_class = "";
10145 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10146 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10147 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10148
10149 if (entry_type == CT_CLASS)
10150 {
10151 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10152 WPOOH_array.Insert(WPOF);
10153 }
10154 }
10155
10156
10158 }
10159 }
10160 }
10161
10163 {
10165 }
10166
10168 {
10170 {
10172
10175
10178
10179 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10180 }
10181 }
10182
10184 {
10186 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10187
10189 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10190
10192 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10193
10195 {
10197 }
10198 }
10199
10201 {
10203 }
10204
10206 {
10209 else
10211
10213 {
10216 }
10217 else
10218 {
10221
10224 }
10225
10227 }
10228
10230 {
10232 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10233 }
10234
10236 {
10238 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10240 }
10241
10243 {
10245 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10246 }
10247
10249 {
10252
10253 OverheatingParticle OP = new OverheatingParticle();
10258
10260 }
10261
10263 {
10266
10267 return -1;
10268 }
10269
10271 {
10273 {
10276
10277 for (int i = count; i > 0; --i)
10278 {
10279 int id = i - 1;
10282
10285
10286 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10287 {
10288 if (p)
10289 {
10292 }
10293 }
10294 }
10295 }
10296 }
10297
10299 {
10301 {
10303 {
10304 int id = i - 1;
10306
10307 if (OP)
10308 {
10310
10311 if (p)
10312 {
10314 }
10315
10316 delete OP;
10317 }
10318 }
10319
10322 }
10323 }
10324
10327 {
10328 return 0.0;
10329 }
10330
10331
10333 {
10334 return 250;
10335 }
10336
10338 {
10339 return 0;
10340 }
10341
10344 {
10346 return true;
10347
10348 return false;
10349 }
10350
10353 {
10356
10358 {
10360 }
10361 else
10362 {
10363
10365 }
10366
10368 }
10369
10376 {
10377 return -1;
10378 }
10379
10380
10381
10382
10384 {
10386 {
10387 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10388 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10389
10390 if (r_index >= 0)
10391 {
10392 InventoryLocation r_il = new InventoryLocation;
10393 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10394
10395 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10398 {
10399 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10400 }
10402 {
10403 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10404 }
10405
10406 }
10407
10408 player.GetHumanInventory().ClearUserReservedLocation(this);
10409 }
10410
10413 }
10414
10415
10416
10417
10419 {
10420 return ItemBase.m_DebugActionsMask;
10421 }
10422
10424 {
10425 return ItemBase.m_DebugActionsMask & mask;
10426 }
10427
10429 {
10430 ItemBase.m_DebugActionsMask = mask;
10431 }
10432
10434 {
10435 ItemBase.m_DebugActionsMask |= mask;
10436 }
10437
10439 {
10440 ItemBase.m_DebugActionsMask &= ~mask;
10441 }
10442
10444 {
10446 {
10448 }
10449 else
10450 {
10452 }
10453 }
10454
10455
10457 {
10458 if (GetEconomyProfile())
10459 {
10460 float q_max = GetEconomyProfile().GetQuantityMax();
10461 if (q_max > 0)
10462 {
10463 float q_min = GetEconomyProfile().GetQuantityMin();
10464 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10465
10467 {
10468 ComponentEnergyManager comp = GetCompEM();
10470 {
10472 }
10473 }
10475 {
10477
10478 }
10479
10480 }
10481 }
10482 }
10483
10486 {
10487 EntityAI parent = GetHierarchyParent();
10488
10489 if (parent)
10490 {
10491 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10492 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10493 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10494 }
10495 }
10496
10499 {
10500 EntityAI parent = GetHierarchyParent();
10501
10502 if (parent)
10503 {
10504 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10505 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10506 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10507 }
10508 }
10509
10511 {
10512
10513
10514
10515
10517
10519 {
10520 if (ScriptInputUserData.CanStoreInputUserData())
10521 {
10522 ScriptInputUserData ctx = new ScriptInputUserData;
10528 ctx.
Write(use_stack_max);
10531
10533 {
10534 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10535 }
10536 }
10537 }
10538 else if (!
g_Game.IsMultiplayer())
10539 {
10541 }
10542 }
10543
10545 {
10547 }
10548
10550 {
10552 }
10553
10555 {
10557 }
10558
10560 {
10561
10562 return false;
10563 }
10564
10566 {
10567 return false;
10568 }
10569
10573 {
10574 return false;
10575 }
10576
10578 {
10579 return "";
10580 }
10581
10583
10585 {
10586 return false;
10587 }
10588
10590 {
10591 return true;
10592 }
10593
10594
10595
10597 {
10598 return true;
10599 }
10600
10602 {
10603 return true;
10604 }
10605
10607 {
10608 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10610 }
10611
10613 {
10615 }
10616
10618 {
10620 if (!is_being_placed)
10622 SetSynchDirty();
10623 }
10624
10625
10627
10629 {
10631 }
10632
10634 {
10636 }
10637
10639 {
10640 return 1;
10641 }
10642
10644 {
10645 return false;
10646 }
10647
10649 {
10651 SetSynchDirty();
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
10683
10684
10685
10686
10687
10689 {
10690 super.OnMovedInsideCargo(container);
10691
10692 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10693 }
10694
10695 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10696 {
10697 super.EEItemLocationChanged(oldLoc, newLoc);
10698
10699 PlayerBase newPlayer = null;
10700 PlayerBase oldPlayer = null;
10701
10702 if (newLoc.GetParent())
10703 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10704
10705 if (oldLoc.GetParent())
10706 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10707
10709 {
10710 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10711
10712 if (rIndex >= 0)
10713 {
10714 InventoryLocation rIl = new InventoryLocation;
10715 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10716
10717 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10720 {
10721 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10722 }
10724 {
10726 }
10727
10728 }
10729 }
10730
10732 {
10733 if (newPlayer)
10734 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10735
10736 if (newPlayer == oldPlayer)
10737 {
10738 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10739 {
10741 {
10742 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10743 {
10744 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10745 }
10746 }
10747 else
10748 {
10749 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10750 }
10751 }
10752
10753 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10754 {
10755 int type = oldLoc.GetType();
10757 {
10758 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10759 }
10761 {
10762 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10763 }
10764 }
10765 if (!m_OldLocation)
10766 {
10767 m_OldLocation = new InventoryLocation;
10768 }
10769 m_OldLocation.Copy(oldLoc);
10770 }
10771 else
10772 {
10773 if (m_OldLocation)
10774 {
10775 m_OldLocation.Reset();
10776 }
10777 }
10778
10779 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10780 }
10781 else
10782 {
10783 if (newPlayer)
10784 {
10785 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10786 if (resIndex >= 0)
10787 {
10788 InventoryLocation il = new InventoryLocation;
10789 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10791 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10794 {
10795 il.
GetParent().GetOnReleaseLock().Invoke(it);
10796 }
10798 {
10800 }
10801
10802 }
10803 }
10805 {
10806
10808 }
10809
10810 if (m_OldLocation)
10811 {
10812 m_OldLocation.Reset();
10813 }
10814 }
10815
10817 {
10818 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10819 }
10820
10822 {
10823 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10824 }
10825 }
10826
10827 override void EOnContact(IEntity other, Contact extra)
10828 {
10830 {
10831 int liquidType = -1;
10833 if (impactSpeed > 0.0)
10834 {
10836 #ifndef SERVER
10838 #else
10840 SetSynchDirty();
10841 #endif
10843 }
10844 }
10845
10846 #ifdef SERVER
10847 if (GetCompEM() && GetCompEM().IsPlugged())
10848 {
10849 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10850 GetCompEM().UnplugThis();
10851 }
10852 #endif
10853 }
10854
10856
10858 {
10860 }
10861
10863 {
10864
10865 }
10866
10868 {
10869 super.OnItemLocationChanged(old_owner, new_owner);
10870
10871 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10872 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10873
10874 if (!relatedPlayer && playerNew)
10875 relatedPlayer = playerNew;
10876
10877 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10878 {
10880 if (actionMgr)
10881 {
10882 ActionBase currentAction = actionMgr.GetRunningAction();
10883 if (currentAction)
10885 }
10886 }
10887
10888 Man ownerPlayerOld = null;
10889 Man ownerPlayerNew = null;
10890
10891 if (old_owner)
10892 {
10893 if (old_owner.
IsMan())
10894 {
10895 ownerPlayerOld = Man.Cast(old_owner);
10896 }
10897 else
10898 {
10899 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10900 }
10901 }
10902 else
10903 {
10905 {
10907
10908 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10909 {
10910 GetCompEM().UnplugThis();
10911 }
10912 }
10913 }
10914
10915 if (new_owner)
10916 {
10917 if (new_owner.
IsMan())
10918 {
10919 ownerPlayerNew = Man.Cast(new_owner);
10920 }
10921 else
10922 {
10923 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10924 }
10925 }
10926
10927 if (ownerPlayerOld != ownerPlayerNew)
10928 {
10929 if (ownerPlayerOld)
10930 {
10931 array<EntityAI> subItemsExit = new array<EntityAI>;
10933 for (int i = 0; i < subItemsExit.Count(); i++)
10934 {
10937 }
10938 }
10939
10940 if (ownerPlayerNew)
10941 {
10942 array<EntityAI> subItemsEnter = new array<EntityAI>;
10944 for (int j = 0; j < subItemsEnter.Count(); j++)
10945 {
10948 }
10949 }
10950 }
10951 else if (ownerPlayerNew != null)
10952 {
10953 PlayerBase nplayer;
10954 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10955 {
10956 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10958 for (int k = 0; k < subItemsUpdate.Count(); k++)
10959 {
10961 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10962 }
10963 }
10964 }
10965
10966 if (old_owner)
10967 old_owner.OnChildItemRemoved(this);
10968 if (new_owner)
10969 new_owner.OnChildItemReceived(this);
10970 }
10971
10972
10974 {
10975 super.EEDelete(parent);
10976 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10977 if (player)
10978 {
10980
10981 if (player.IsAlive())
10982 {
10983 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10984 if (r_index >= 0)
10985 {
10986 InventoryLocation r_il = new InventoryLocation;
10987 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10988
10989 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10992 {
10993 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10994 }
10996 {
10997 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10998 }
10999
11000 }
11001
11002 player.RemoveQuickBarEntityShortcut(this);
11003 }
11004 }
11005 }
11006
11008 {
11009 super.EEKilled(killer);
11010
11013 {
11014 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11015 {
11016 if (IsMagazine())
11017 {
11018 if (Magazine.Cast(this).GetAmmoCount() > 0)
11019 {
11021 }
11022 }
11023 else
11024 {
11026 }
11027 }
11028 }
11029 }
11030
11032 {
11033 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11034
11035 super.OnWasAttached(parent, slot_id);
11036
11039
11042 }
11043
11045 {
11046 super.OnWasDetached(parent, slot_id);
11047
11050
11053 }
11054
11056 {
11057 int idx;
11060
11061 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11062 if (inventory_slots.Count() < 1)
11063 {
11064 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11065 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11066 }
11067 else
11068 {
11069 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11070 }
11071
11072 idx = inventory_slots.Find(slot);
11073 if (idx < 0)
11074 return "";
11075
11076 return attach_types.Get(idx);
11077 }
11078
11080 {
11081 int idx = -1;
11082 string slot;
11083
11086
11087 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11088 if (inventory_slots.Count() < 1)
11089 {
11090 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11091 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11092 }
11093 else
11094 {
11095 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11096 if (detach_types.Count() < 1)
11097 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11098 }
11099
11100 for (int i = 0; i < inventory_slots.Count(); i++)
11101 {
11102 slot = inventory_slots.Get(i);
11103 }
11104
11105 if (slot != "")
11106 {
11107 if (detach_types.Count() == 1)
11108 idx = 0;
11109 else
11110 idx = inventory_slots.Find(slot);
11111 }
11112 if (idx < 0)
11113 return "";
11114
11115 return detach_types.Get(idx);
11116 }
11117
11119 {
11120
11122
11123
11124 float min_time = 1;
11125 float max_time = 3;
11126 float delay = Math.RandomFloat(min_time, max_time);
11127
11128 explode_timer.Run(delay, this, "DoAmmoExplosion");
11129 }
11130
11132 {
11133 Magazine magazine = Magazine.Cast(this);
11134 int pop_sounds_count = 6;
11135 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11136
11137
11138 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11139 string sound_name = pop_sounds[ sound_idx ];
11140 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11141
11142
11143 magazine.ServerAddAmmoCount(-1);
11144
11145
11146 float min_temp_to_explode = 100;
11147
11148 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11149 {
11151 }
11152 }
11153
11154
11155 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11156 {
11157 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11158
11159 const int CHANCE_DAMAGE_CARGO = 4;
11160 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11161 const int CHANCE_DAMAGE_NOTHING = 2;
11162
11164 {
11165 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11166 int chances;
11167 int rnd;
11168
11169 if (GetInventory().GetCargo())
11170 {
11171 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11172 rnd = Math.RandomInt(0,chances);
11173
11174 if (rnd < CHANCE_DAMAGE_CARGO)
11175 {
11177 }
11178 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11179 {
11181 }
11182 }
11183 else
11184 {
11185 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11186 rnd = Math.RandomInt(0,chances);
11187
11188 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11189 {
11191 }
11192 }
11193 }
11194 }
11195
11197 {
11198 CargoBase cargo = GetInventory().GetCargo();
11199 if (cargo)
11200 {
11202 if (item_count > 0)
11203 {
11204 int random_pick = Math.RandomInt(0, item_count);
11206 if (!item.IsExplosive())
11207 {
11208 item.AddHealth("","",damage);
11209 return true;
11210 }
11211 }
11212 }
11213 return false;
11214 }
11215
11217 {
11218 GameInventory inventory = GetInventory();
11220 if (attachment_count > 0)
11221 {
11222 int random_pick = Math.RandomInt(0, attachment_count);
11224 if (!attachment.IsExplosive())
11225 {
11226 attachment.AddHealth("","",damage);
11227 return true;
11228 }
11229 }
11230 return false;
11231 }
11232
11234 {
11236 }
11237
11239 {
11241 return GetInventory().CanRemoveEntity();
11242
11243 return false;
11244 }
11245
11247 {
11248
11250 return false;
11251
11252
11254 return false;
11255
11256
11257
11259 if (delta == 0)
11260 return false;
11261
11262
11263 return true;
11264 }
11265
11267 {
11269 {
11270 if (ScriptInputUserData.CanStoreInputUserData())
11271 {
11272 ScriptInputUserData ctx = new ScriptInputUserData;
11277 ctx.
Write(destination_entity);
11279 ctx.
Write(slot_id);
11281 }
11282 }
11283 else if (!
g_Game.IsMultiplayer())
11284 {
11286 }
11287 }
11288
11290 {
11291 float split_quantity_new;
11295 InventoryLocation loc = new InventoryLocation;
11296
11297 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11298 {
11300 split_quantity_new = stack_max;
11301 else
11303
11305 {
11306 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11307 if (new_item)
11308 {
11309 new_item.SetResultOfSplit(true);
11310 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11312 new_item.
SetQuantity(split_quantity_new,
false,
true);
11313 }
11314 }
11315 }
11316 else if (destination_entity && slot_id == -1)
11317 {
11318 if (quantity > stack_max)
11319 split_quantity_new = stack_max;
11320 else
11321 split_quantity_new = quantity;
11322
11324 {
11325 GameInventory destinationInventory = destination_entity.GetInventory();
11327 {
11330 }
11331
11332 if (new_item)
11333 {
11334 new_item.SetResultOfSplit(true);
11335 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11337 new_item.
SetQuantity(split_quantity_new,
false,
true);
11338 }
11339 }
11340 }
11341 else
11342 {
11343 if (stack_max != 0)
11344 {
11346 {
11348 }
11349
11350 if (split_quantity_new == 0)
11351 {
11352 if (!
g_Game.IsMultiplayer())
11353 player.PhysicalPredictiveDropItem(this);
11354 else
11355 player.ServerDropEntity(this);
11356 return;
11357 }
11358
11360 {
11362
11363 if (new_item)
11364 {
11365 new_item.SetResultOfSplit(true);
11366 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11369 new_item.PlaceOnSurface();
11370 }
11371 }
11372 }
11373 }
11374 }
11375
11377 {
11378 float split_quantity_new;
11382 InventoryLocation loc = new InventoryLocation;
11383
11384 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11385 {
11387 split_quantity_new = stack_max;
11388 else
11390
11392 {
11393 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11394 if (new_item)
11395 {
11396 new_item.SetResultOfSplit(true);
11397 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11399 new_item.
SetQuantity(split_quantity_new,
false,
true);
11400 }
11401 }
11402 }
11403 else if (destination_entity && slot_id == -1)
11404 {
11405 if (quantity > stack_max)
11406 split_quantity_new = stack_max;
11407 else
11408 split_quantity_new = quantity;
11409
11411 {
11412 GameInventory destinationInventory = destination_entity.GetInventory();
11414 {
11417 }
11418
11419 if (new_item)
11420 {
11421 new_item.SetResultOfSplit(true);
11422 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11424 new_item.
SetQuantity(split_quantity_new,
false,
true);
11425 }
11426 }
11427 }
11428 else
11429 {
11430 if (stack_max != 0)
11431 {
11433 {
11435 }
11436
11438 {
11440
11441 if (new_item)
11442 {
11443 new_item.SetResultOfSplit(true);
11444 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11447 new_item.PlaceOnSurface();
11448 }
11449 }
11450 }
11451 }
11452 }
11453
11455 {
11457 {
11458 if (ScriptInputUserData.CanStoreInputUserData())
11459 {
11460 ScriptInputUserData ctx = new ScriptInputUserData;
11465 dst.WriteToContext(ctx);
11467 }
11468 }
11469 else if (!
g_Game.IsMultiplayer())
11470 {
11472 }
11473 }
11474
11476 {
11478 {
11479 if (ScriptInputUserData.CanStoreInputUserData())
11480 {
11481 ScriptInputUserData ctx = new ScriptInputUserData;
11486 ctx.
Write(destination_entity);
11492 }
11493 }
11494 else if (!
g_Game.IsMultiplayer())
11495 {
11497 }
11498 }
11499
11501 {
11503 }
11504
11506 {
11508 float split_quantity_new;
11510 if (dst.IsValid())
11511 {
11512 int slot_id = dst.GetSlot();
11514
11515 if (quantity > stack_max)
11516 split_quantity_new = stack_max;
11517 else
11518 split_quantity_new = quantity;
11519
11521 {
11523
11524 if (new_item)
11525 {
11526 new_item.SetResultOfSplit(true);
11527 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11529 new_item.
SetQuantity(split_quantity_new,
false,
true);
11530 }
11531
11532 return new_item;
11533 }
11534 }
11535
11536 return null;
11537 }
11538
11540 {
11542 float split_quantity_new;
11544 if (destination_entity)
11545 {
11547 if (quantity > stackable)
11548 split_quantity_new = stackable;
11549 else
11550 split_quantity_new = quantity;
11551
11553 {
11554 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11555 if (new_item)
11556 {
11557 new_item.SetResultOfSplit(true);
11558 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11560 new_item.
SetQuantity(split_quantity_new,
false,
true);
11561 }
11562 }
11563 }
11564 }
11565
11567 {
11569 {
11570 if (ScriptInputUserData.CanStoreInputUserData())
11571 {
11572 ScriptInputUserData ctx = new ScriptInputUserData;
11577 ItemBase destination_entity =
this;
11578 ctx.
Write(destination_entity);
11582 }
11583 }
11584 else if (!
g_Game.IsMultiplayer())
11585 {
11587 }
11588 }
11589
11591 {
11593 float split_quantity_new;
11595 if (player)
11596 {
11598 if (quantity > stackable)
11599 split_quantity_new = stackable;
11600 else
11601 split_quantity_new = quantity;
11602
11604 {
11605 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11606 new_item =
ItemBase.Cast(in_hands);
11607 if (new_item)
11608 {
11609 new_item.SetResultOfSplit(true);
11610 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11612 new_item.SetQuantity(split_quantity_new, false, true);
11613 }
11614 }
11615 }
11616 }
11617
11619 {
11621 float split_quantity_new = Math.Floor(quantity * 0.5);
11622
11624 return;
11625
11627
11628 if (new_item)
11629 {
11630 if (new_item.GetQuantityMax() < split_quantity_new)
11631 {
11632 split_quantity_new = new_item.GetQuantityMax();
11633 }
11634
11635 new_item.SetResultOfSplit(true);
11636 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11637
11639 {
11642 }
11643 else
11644 {
11646 new_item.
SetQuantity(split_quantity_new,
false,
true);
11647 }
11648 }
11649 }
11650
11652 {
11654 float split_quantity_new = Math.Floor(quantity / 2);
11655
11657 return;
11658
11659 InventoryLocation invloc = new InventoryLocation;
11661
11663 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11664
11665 if (new_item)
11666 {
11667 if (new_item.GetQuantityMax() < split_quantity_new)
11668 {
11669 split_quantity_new = new_item.GetQuantityMax();
11670 }
11672 {
11675 }
11676 else if (split_quantity_new > 1)
11677 {
11679 new_item.
SetQuantity(split_quantity_new,
false,
true);
11680 }
11681 }
11682 }
11683
11686 {
11687 SetWeightDirty();
11689
11690 if (parent)
11691 parent.OnAttachmentQuantityChangedEx(this, delta);
11692
11694 {
11696 {
11698 }
11700 {
11701 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11703 }
11704 }
11705 }
11706
11709 {
11710
11711 }
11712
11715 {
11717 }
11718
11720 {
11721 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11722
11724 {
11725 if (newLevel == GameConstants.STATE_RUINED)
11726 {
11728 EntityAI parent = GetHierarchyParent();
11729 if (parent && parent.IsFireplace())
11730 {
11731 CargoBase cargo = GetInventory().GetCargo();
11732 if (cargo)
11733 {
11735 {
11737 }
11738 }
11739 }
11740 }
11741
11743 {
11744
11746 return;
11747 }
11748
11749 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11750 {
11752 }
11753 }
11754 }
11755
11756
11758 {
11759 super.OnRightClick();
11760
11762 {
11764 {
11765 if (ScriptInputUserData.CanStoreInputUserData())
11766 {
11767 EntityAI root = GetHierarchyRoot();
11768 Man playerOwner = GetHierarchyRootPlayer();
11769 InventoryLocation dst = new InventoryLocation;
11770
11771
11772 if (!playerOwner && root && root == this)
11773 {
11775 }
11776 else
11777 {
11778
11779 GetInventory().GetCurrentInventoryLocation(dst);
11781 {
11782 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11784 {
11786 }
11787 else
11788 {
11790
11791
11792 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11793 {
11795 }
11796 else
11797 {
11798 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11799 }
11800 }
11801 }
11802 }
11803
11804 ScriptInputUserData ctx = new ScriptInputUserData;
11812 }
11813 }
11814 else if (!
g_Game.IsMultiplayer())
11815 {
11817 }
11818 }
11819 }
11820
11822 {
11823 if (root)
11824 {
11825 vector m4[4];
11826 root.GetTransform(m4);
11827 dst.SetGround(this, m4);
11828 }
11829 else
11830 {
11831 GetInventory().GetCurrentInventoryLocation(dst);
11832 }
11833 }
11834
11835 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11836 {
11837
11838 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11839 return false;
11840
11841 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11842 return false;
11843
11844
11846 return false;
11847
11848
11849 Magazine mag = Magazine.Cast(this);
11850 if (mag)
11851 {
11852 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11853 return false;
11854
11855 if (stack_max_limit)
11856 {
11857 Magazine other_mag = Magazine.Cast(other_item);
11858 if (other_item)
11859 {
11860 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11861 return false;
11862 }
11863
11864 }
11865 }
11866 else
11867 {
11868
11870 return false;
11871
11873 return false;
11874 }
11875
11876 PlayerBase player = null;
11877 if (CastTo(player, GetHierarchyRootPlayer()))
11878 {
11879 if (player.GetInventory().HasAttachment(this))
11880 return false;
11881
11882 if (player.IsItemsToDelete())
11883 return false;
11884 }
11885
11886 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11887 return false;
11888
11889 int slotID;
11891 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11892 return false;
11893
11894 return true;
11895 }
11896
11898 {
11900 }
11901
11903 {
11904 return m_IsResultOfSplit;
11905 }
11906
11908 {
11909 m_IsResultOfSplit = value;
11910 }
11911
11913 {
11915 }
11916
11918 {
11919 float other_item_quantity = other_item.GetQuantity();
11920 float this_free_space;
11921
11923
11925
11926 if (other_item_quantity > this_free_space)
11927 {
11928 return this_free_space;
11929 }
11930 else
11931 {
11932 return other_item_quantity;
11933 }
11934 }
11935
11937 {
11939 }
11940
11942 {
11944 return;
11945
11946 if (!IsMagazine() && other_item)
11947 {
11949 if (quantity_used != 0)
11950 {
11951 float hp1 = GetHealth01("","");
11952 float hp2 = other_item.GetHealth01("","");
11953 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11954 hpResult = hpResult / (
GetQuantity() + quantity_used);
11955
11956 hpResult *= GetMaxHealth();
11957 Math.Round(hpResult);
11958 SetHealth("", "Health", hpResult);
11959
11961 other_item.AddQuantity(-quantity_used);
11962 }
11963 }
11965 }
11966
11968 {
11969 #ifdef SERVER
11970 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11971 GetHierarchyParent().IncreaseLifetimeUp();
11972 #endif
11973 };
11974
11976 {
11977 PlayerBase p = PlayerBase.Cast(player);
11978
11979 array<int> recipesIds = p.m_Recipes;
11980 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11981 if (moduleRecipesManager)
11982 {
11983 EntityAI itemInHands = player.GetEntityInHands();
11984 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11985 }
11986
11987 for (int i = 0;i < recipesIds.Count(); i++)
11988 {
11989 int key = recipesIds.Get(i);
11990 string recipeName = moduleRecipesManager.GetRecipeName(key);
11992 }
11993 }
11994
11995
11996 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11997 {
11998 super.GetDebugActions(outputList);
11999
12000
12006
12007
12012
12017
12018
12022
12023
12025 {
12029 }
12030
12033
12034
12038
12040
12041 InventoryLocation loc = new InventoryLocation();
12042 GetInventory().GetCurrentInventoryLocation(loc);
12044 {
12045 if (Gizmo_IsSupported())
12048 }
12049
12051 }
12052
12053
12054
12055
12057 {
12058 super.OnAction(action_id, player, ctx);
12059
12061 {
12062 switch (action_id)
12063 {
12067 return true;
12071 return true;
12072 }
12073 }
12074
12076 {
12077 switch (action_id)
12078 {
12080 Delete();
12081 return true;
12082 }
12083 }
12084
12085 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12086 {
12087 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12088 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12089 PlayerBase p = PlayerBase.Cast(player);
12090 if (
EActions.RECIPES_RANGE_START < 1000)
12091 {
12092 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12093 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12094 }
12095 }
12096 #ifndef SERVER
12097 else if (action_id ==
EActions.WATCH_PLAYER)
12098 {
12099 PluginDeveloper.SetDeveloperItemClientEx(player);
12100 }
12101 #endif
12103 {
12104 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12105 {
12106 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12107 OnDebugButtonPressServer(id + 1);
12108 }
12109
12110 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12111 {
12112 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12114 }
12115
12116 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12117 {
12118 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12120 }
12121
12122 else if (action_id ==
EActions.ADD_QUANTITY)
12123 {
12124 if (IsMagazine())
12125 {
12126 Magazine mag = Magazine.Cast(this);
12127 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12128 }
12129 else
12130 {
12132 }
12133
12134 if (m_EM)
12135 {
12136 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12137 }
12138
12139 }
12140
12141 else if (action_id ==
EActions.REMOVE_QUANTITY)
12142 {
12143 if (IsMagazine())
12144 {
12145 Magazine mag2 = Magazine.Cast(this);
12146 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12147 }
12148 else
12149 {
12151 }
12152 if (m_EM)
12153 {
12154 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12155 }
12156
12157 }
12158
12159 else if (action_id ==
EActions.SET_QUANTITY_0)
12160 {
12162
12163 if (m_EM)
12164 {
12165 m_EM.SetEnergy(0);
12166 }
12167 }
12168
12169 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12170 {
12172
12173 if (m_EM)
12174 {
12175 m_EM.SetEnergy(m_EM.GetEnergyMax());
12176 }
12177 }
12178
12179 else if (action_id ==
EActions.ADD_HEALTH)
12180 {
12181 AddHealth("","",GetMaxHealth("","Health")/5);
12182 }
12183 else if (action_id ==
EActions.REMOVE_HEALTH)
12184 {
12185 AddHealth("","",-GetMaxHealth("","Health")/5);
12186 }
12187 else if (action_id ==
EActions.DESTROY_HEALTH)
12188 {
12189 SetHealth01("","",0);
12190 }
12191 else if (action_id ==
EActions.WATCH_ITEM)
12192 {
12194 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12195 #ifdef DEVELOPER
12196 SetDebugDeveloper_item(this);
12197 #endif
12198 }
12199
12200 else if (action_id ==
EActions.ADD_TEMPERATURE)
12201 {
12202 AddTemperature(20);
12203
12204 }
12205
12206 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12207 {
12208 AddTemperature(-20);
12209
12210 }
12211
12212 else if (action_id ==
EActions.FLIP_FROZEN)
12213 {
12214 SetFrozen(!GetIsFrozen());
12215
12216 }
12217
12218 else if (action_id ==
EActions.ADD_WETNESS)
12219 {
12221
12222 }
12223
12224 else if (action_id ==
EActions.REMOVE_WETNESS)
12225 {
12227
12228 }
12229
12230 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12231 {
12234
12235
12236 }
12237
12238 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12239 {
12242 }
12243
12244 else if (action_id ==
EActions.MAKE_SPECIAL)
12245 {
12246 auto debugParams = DebugSpawnParams.WithPlayer(player);
12247 OnDebugSpawnEx(debugParams);
12248 }
12249
12250 }
12251
12252
12253 return false;
12254 }
12255
12256
12257
12258
12262
12265
12266
12267
12269 {
12270 return false;
12271 }
12272
12273
12275 {
12276 return true;
12277 }
12278
12279
12281 {
12282 return true;
12283 }
12284
12285
12286
12288 {
12289 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12290 return g_Game.ConfigIsExisting(config_path);
12291 }
12292
12295 {
12296 return null;
12297 }
12298
12300 {
12301 return false;
12302 }
12303
12305 {
12306 return false;
12307 }
12308
12312
12313
12315 {
12316 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12317 return module_repairing.CanRepair(this, item_repair_kit);
12318 }
12319
12320
12321 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12322 {
12323 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12324 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12325 }
12326
12327
12329 {
12330
12331
12332
12333
12334
12335
12336
12337
12338 return 1;
12339 }
12340
12341
12342
12344 {
12346 }
12347
12348
12349
12351 {
12353 }
12354
12355
12364 {
12365 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12366
12367 if (player)
12368 {
12369 player.MessageStatus(text);
12370 }
12371 }
12372
12373
12382 {
12383 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12384
12385 if (player)
12386 {
12387 player.MessageAction(text);
12388 }
12389 }
12390
12391
12400 {
12401 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12402
12403 if (player)
12404 {
12405 player.MessageFriendly(text);
12406 }
12407 }
12408
12409
12418 {
12419 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12420
12421 if (player)
12422 {
12423 player.MessageImportant(text);
12424 }
12425 }
12426
12428 {
12429 return true;
12430 }
12431
12432
12433 override bool KindOf(
string tag)
12434 {
12435 bool found = false;
12436 string item_name = this.
GetType();
12438 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12439
12440 int array_size = item_tag_array.Count();
12441 for (int i = 0; i < array_size; i++)
12442 {
12443 if (item_tag_array.Get(i) == tag)
12444 {
12445 found = true;
12446 break;
12447 }
12448 }
12449 return found;
12450 }
12451
12452
12454 {
12455
12456 super.OnRPC(sender, rpc_type,ctx);
12457
12458
12459 switch (rpc_type)
12460 {
12461 #ifndef SERVER
12462 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12463 Param2<bool, string> p = new Param2<bool, string>(false, "");
12464
12466 return;
12467
12468 bool play = p.param1;
12469 string soundSet = p.param2;
12470
12471 if (play)
12472 {
12474 {
12476 {
12478 }
12479 }
12480 else
12481 {
12483 }
12484 }
12485 else
12486 {
12488 }
12489
12490 break;
12491 #endif
12492
12493 }
12494
12496 {
12498 }
12499 }
12500
12501
12502
12503
12505 {
12506 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12507 return plugin.GetID(
name);
12508 }
12509
12511 {
12512 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12513 return plugin.GetName(id);
12514 }
12515
12518 {
12519
12520
12521 int varFlags;
12522 if (!ctx.
Read(varFlags))
12523 return;
12524
12525 if (varFlags & ItemVariableFlags.FLOAT)
12526 {
12528 }
12529 }
12530
12532 {
12533
12534 super.SerializeNumericalVars(floats_out);
12535
12536
12537
12539 {
12541 }
12542
12544 {
12546 }
12547
12549 {
12551 }
12552
12554 {
12559 }
12560
12562 {
12564 }
12565 }
12566
12568 {
12569
12570 super.DeSerializeNumericalVars(floats);
12571
12572
12573 int index = 0;
12574 int mask = Math.Round(floats.Get(index));
12575
12576 index++;
12577
12579 {
12581 {
12583 }
12584 else
12585 {
12586 float quantity = floats.Get(index);
12587 SetQuantity(quantity,
true,
false,
false,
false);
12588 }
12589 index++;
12590 }
12591
12593 {
12594 float wet = floats.Get(index);
12596 index++;
12597 }
12598
12600 {
12601 int liquidtype = Math.Round(floats.Get(index));
12603 index++;
12604 }
12605
12607 {
12609 index++;
12611 index++;
12613 index++;
12615 index++;
12616 }
12617
12619 {
12620 int cleanness = Math.Round(floats.Get(index));
12622 index++;
12623 }
12624 }
12625
12627 {
12628 super.WriteVarsToCTX(ctx);
12629
12630
12632 {
12634 }
12635
12637 {
12639 }
12640
12642 {
12644 }
12645
12647 {
12648 int r,g,b,a;
12654 }
12655
12657 {
12659 }
12660 }
12661
12663 {
12664 if (!super.ReadVarsFromCTX(ctx,version))
12665 return false;
12666
12667 int intValue;
12668 float value;
12669
12670 if (version < 140)
12671 {
12672 if (!ctx.
Read(intValue))
12673 return false;
12674
12675 m_VariablesMask = intValue;
12676 }
12677
12679 {
12680 if (!ctx.
Read(value))
12681 return false;
12682
12684 {
12686 }
12687 else
12688 {
12690 }
12691 }
12692
12693 if (version < 140)
12694 {
12696 {
12697 if (!ctx.
Read(value))
12698 return false;
12699 SetTemperatureDirect(value);
12700 }
12701 }
12702
12704 {
12705 if (!ctx.
Read(value))
12706 return false;
12708 }
12709
12711 {
12712 if (!ctx.
Read(intValue))
12713 return false;
12715 }
12716
12718 {
12719 int r,g,b,a;
12721 return false;
12723 return false;
12725 return false;
12727 return false;
12728
12730 }
12731
12733 {
12734 if (!ctx.
Read(intValue))
12735 return false;
12737 }
12738
12739 if (version >= 138 && version < 140)
12740 {
12742 {
12743 if (!ctx.
Read(intValue))
12744 return false;
12745 SetFrozen(intValue);
12746 }
12747 }
12748
12749 return true;
12750 }
12751
12752
12754 {
12757 {
12759 }
12760
12761 if (!super.OnStoreLoad(ctx, version))
12762 {
12764 return false;
12765 }
12766
12767 if (version >= 114)
12768 {
12769 bool hasQuickBarIndexSaved;
12770
12771 if (!ctx.
Read(hasQuickBarIndexSaved))
12772 {
12774 return false;
12775 }
12776
12777 if (hasQuickBarIndexSaved)
12778 {
12779 int itmQBIndex;
12780
12781
12782 if (!ctx.
Read(itmQBIndex))
12783 {
12785 return false;
12786 }
12787
12788 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12789 if (itmQBIndex != -1 && parentPlayer)
12790 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12791 }
12792 }
12793 else
12794 {
12795
12796 PlayerBase player;
12797 int itemQBIndex;
12798 if (version ==
int.
MAX)
12799 {
12800 if (!ctx.
Read(itemQBIndex))
12801 {
12803 return false;
12804 }
12805 }
12806 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12807 {
12808
12809 if (!ctx.
Read(itemQBIndex))
12810 {
12812 return false;
12813 }
12814 if (itemQBIndex != -1 && player)
12815 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12816 }
12817 }
12818
12819 if (version < 140)
12820 {
12821
12822 if (!LoadVariables(ctx, version))
12823 {
12825 return false;
12826 }
12827 }
12828
12829
12831 {
12833 return false;
12834 }
12835 if (version >= 132)
12836 {
12838 if (raib)
12839 {
12841 {
12843 return false;
12844 }
12845 }
12846 }
12847
12849 return true;
12850 }
12851
12852
12853
12855 {
12856 super.OnStoreSave(ctx);
12857
12858 PlayerBase player;
12859 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12860 {
12862
12863 int itemQBIndex = -1;
12864 itemQBIndex = player.FindQuickBarEntityIndex(this);
12865 ctx.
Write(itemQBIndex);
12866 }
12867 else
12868 {
12870 }
12871
12873
12875 if (raib)
12876 {
12878 }
12879 }
12880
12881
12883 {
12884 super.AfterStoreLoad();
12885
12887 {
12889 }
12890
12892 {
12895 }
12896 }
12897
12899 {
12900 super.EEOnAfterLoad();
12901
12903 {
12905 }
12906
12909 }
12910
12912 {
12913 return false;
12914 }
12915
12916
12917
12919 {
12921 {
12922 #ifdef PLATFORM_CONSOLE
12923
12925 {
12927 if (menu)
12928 {
12930 }
12931 }
12932 #endif
12933 }
12934
12936 {
12939 }
12940
12942 {
12943 SetWeightDirty();
12945 }
12947 {
12950 }
12951
12953 {
12956
12959 }
12961 {
12965 }
12966
12967 super.OnVariablesSynchronized();
12968 }
12969
12970
12971
12973 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12974 {
12975 if (!IsServerCheck(allow_client))
12976 return false;
12977
12979 return false;
12980
12983
12984 if (value <= (min + 0.001))
12985 value = min;
12986
12987 if (value == min)
12988 {
12989 if (destroy_config)
12990 {
12991 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12992 if (dstr)
12993 {
12995 this.Delete();
12996 return true;
12997 }
12998 }
12999 else if (destroy_forced)
13000 {
13002 this.Delete();
13003 return true;
13004 }
13005
13007 }
13008
13011
13013 {
13014 EntityAI parent = GetHierarchyRoot();
13015 InventoryLocation iLoc = new InventoryLocation();
13016 GetInventory().GetCurrentInventoryLocation(iLoc);
13018 {
13019 int iLocSlot = iLoc.
GetSlot();
13021 {
13023 }
13025 {
13027 }
13028 }
13029 }
13030
13032 {
13034
13035 if (delta)
13037 }
13038
13040
13041 return false;
13042 }
13043
13044
13046 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13047 {
13049 }
13050
13052 {
13055 }
13056
13058 {
13061 }
13062
13064 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13065 {
13066 float value_clamped = Math.Clamp(value, 0, 1);
13068 SetQuantity(result, destroy_config, destroy_forced);
13069 }
13070
13071
13074 {
13076 }
13077
13079 {
13081 }
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13093 {
13094 int slot = -1;
13095 GameInventory inventory = GetInventory();
13096 if (inventory)
13097 {
13098 InventoryLocation il = new InventoryLocation;
13101 }
13102
13104 }
13105
13107 {
13108 float quantity_max = 0;
13109
13111 {
13112 if (attSlotID != -1)
13113 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13114
13115 if (quantity_max <= 0)
13117 }
13118
13119 if (quantity_max <= 0)
13121
13122 return quantity_max;
13123 }
13124
13126 {
13128 }
13129
13131 {
13133 }
13134
13135
13137 {
13139 }
13140
13142 {
13144 }
13145
13147 {
13149 }
13150
13151
13153 {
13154
13155 float weightEx = GetWeightEx();
13156 float special = GetInventoryAndCargoWeight();
13157 return weightEx - special;
13158 }
13159
13160
13162 {
13164 }
13165
13167 {
13169 {
13170 #ifdef DEVELOPER
13171 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13172 {
13173 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13175 }
13176 #endif
13177
13178 return GetQuantity() * GetConfigWeightModified();
13179 }
13180 else if (HasEnergyManager())
13181 {
13182 #ifdef DEVELOPER
13183 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13184 {
13185 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13186 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13187 }
13188 #endif
13189 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13190 }
13191 else
13192 {
13193 #ifdef DEVELOPER
13194 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13195 {
13196 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13197 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13198 }
13199 #endif
13200 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13201 }
13202 }
13203
13206 {
13207 int item_count = 0;
13209
13210 GameInventory inventory = GetInventory();
13211 CargoBase cargo = inventory.
GetCargo();
13212 if (cargo != NULL)
13213 {
13215 }
13216
13218 for (int i = 0; i < nAttachments; ++i)
13219 {
13221 if (item)
13222 item_count += item.GetNumberOfItems();
13223 }
13224 return item_count;
13225 }
13226
13229 {
13230 float weight = 0;
13231 float wetness = 1;
13232 if (include_wetness)
13235 {
13236 weight = wetness * m_ConfigWeight;
13237 }
13239 {
13240 weight = 1;
13241 }
13242 return weight;
13243 }
13244
13245
13246
13248 {
13249 GameInventory inventory = GetInventory();
13250 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13251 {
13252 array<EntityAI> items = new array<EntityAI>;
13254 for (int i = 0; i < items.Count(); ++i)
13255 {
13257 if (item)
13258 {
13259 g_Game.ObjectDelete(item);
13260 }
13261 }
13262 }
13263 }
13264
13265
13266
13267
13269 {
13270 float energy = 0;
13271 if (HasEnergyManager())
13272 {
13273 energy = GetCompEM().GetEnergy();
13274 }
13275 return energy;
13276 }
13277
13278
13280 {
13281 super.OnEnergyConsumed();
13282
13284 }
13285
13287 {
13288 super.OnEnergyAdded();
13289
13291 }
13292
13293
13295 {
13296 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13297 {
13299 {
13300 float energy_0to1 = GetCompEM().GetEnergy0To1();
13302 }
13303 }
13304 }
13305
13306
13308 {
13309 return ConfigGetFloat("heatIsolation");
13310 }
13311
13313 {
13315 }
13316
13318 {
13319 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13320 if (
g_Game.ConfigIsExisting(paramPath))
13321 return g_Game.ConfigGetFloat(paramPath);
13322
13323 return 0.0;
13324 }
13325
13327 {
13328 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13329 if (
g_Game.ConfigIsExisting(paramPath))
13330 return g_Game.ConfigGetFloat(paramPath);
13331
13332 return 0.0;
13333 }
13334
13335 override void SetWet(
float value,
bool allow_client =
false)
13336 {
13337 if (!IsServerCheck(allow_client))
13338 return;
13339
13342
13344
13345 m_VarWet = Math.Clamp(value, min, max);
13346
13348 {
13351 }
13352 }
13353
13354 override void AddWet(
float value)
13355 {
13357 }
13358
13360 {
13362 }
13363
13365 {
13367 }
13368
13370 {
13372 }
13373
13375 {
13377 }
13378
13380 {
13382 }
13383
13384 override void OnWetChanged(
float newVal,
float oldVal)
13385 {
13388 if (newLevel != oldLevel)
13389 {
13391 }
13392 }
13393
13395 {
13396 SetWeightDirty();
13397 }
13398
13400 {
13401 return GetWetLevelInternal(
m_VarWet);
13402 }
13403
13404
13405
13407 {
13409 }
13410
13412 {
13414 }
13415
13417 {
13419 }
13420
13422 {
13424 }
13425
13426
13427
13429 {
13430 if (ConfigIsExisting("itemModelLength"))
13431 {
13432 return ConfigGetFloat("itemModelLength");
13433 }
13434 return 0;
13435 }
13436
13438 {
13439 if (ConfigIsExisting("itemAttachOffset"))
13440 {
13441 return ConfigGetFloat("itemAttachOffset");
13442 }
13443 return 0;
13444 }
13445
13446 override void SetCleanness(
int value,
bool allow_client =
false)
13447 {
13448 if (!IsServerCheck(allow_client))
13449 return;
13450
13452
13454
13457 }
13458
13460 {
13462 }
13463
13465 {
13466 return true;
13467 }
13468
13469
13470
13471
13473 {
13475 }
13476
13478 {
13480 }
13481
13482
13483
13484
13485 override void SetColor(
int r,
int g,
int b,
int a)
13486 {
13492 }
13494 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13495 {
13500 }
13501
13503 {
13505 }
13506
13509 {
13510 int r,g,b,a;
13512 r = r/255;
13513 g = g/255;
13514 b = b/255;
13515 a = a/255;
13516 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13517 }
13518
13519
13520
13521 override void SetLiquidType(
int value,
bool allow_client =
false)
13522 {
13523 if (!IsServerCheck(allow_client))
13524 return;
13525
13530 }
13531
13533 {
13534 return ConfigGetInt("varLiquidTypeInit");
13535 }
13536
13538 {
13540 }
13541
13543 {
13545 SetFrozen(false);
13546 }
13547
13550 {
13551 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13552 }
13553
13554
13557 {
13558 PlayerBase nplayer;
13559 if (PlayerBase.CastTo(nplayer, player))
13560 {
13562 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13563 }
13564 }
13565
13566
13569 {
13570 PlayerBase nplayer;
13571 if (PlayerBase.CastTo(nplayer,player))
13572 {
13573 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13574 }
13575
13576 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13577
13578 if (HasEnergyManager())
13579 {
13580 GetCompEM().UpdatePlugState();
13581 }
13582 }
13583
13584
13586 {
13587 super.OnPlacementStarted(player);
13588
13590 }
13591
13592 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13593 {
13595 {
13596 m_AdminLog.OnPlacementComplete(player,
this);
13597 }
13598
13599 super.OnPlacementComplete(player, position, orientation);
13600 }
13601
13602
13603
13604
13605
13607 {
13609 {
13610 return true;
13611 }
13612 else
13613 {
13614 return false;
13615 }
13616 }
13617
13618
13620 {
13622 {
13624 }
13625 }
13626
13627
13629 {
13631 }
13632
13634 {
13636 }
13637
13638 override void InsertAgent(
int agent,
float count = 1)
13639 {
13640 if (count < 1)
13641 return;
13642
13644 }
13645
13648 {
13650 }
13651
13652
13654 {
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
13694
13695
13696
13697
13698
13700 {
13702 return false;
13703 return true;
13704 }
13705
13707 {
13708
13710 }
13711
13712
13715 {
13716 super.CheckForRoofLimited(timeTresholdMS);
13717
13718 float time =
g_Game.GetTime();
13719 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13720 {
13721 m_PreviousRoofTestTime = time;
13722 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13723 }
13724 }
13725
13726
13728 {
13730 {
13731 return 0;
13732 }
13733
13734 if (GetInventory().GetAttachmentSlotsCount() != 0)
13735 {
13736 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13737 if (filter)
13738 return filter.GetProtectionLevel(type, false, system);
13739 else
13740 return 0;
13741 }
13742
13743 string subclassPath, entryName;
13744
13745 switch (type)
13746 {
13748 entryName = "biological";
13749 break;
13751 entryName = "chemical";
13752 break;
13753 default:
13754 entryName = "biological";
13755 break;
13756 }
13757
13758 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13759
13760 return g_Game.ConfigGetFloat(subclassPath + entryName);
13761 }
13762
13763
13764
13767 {
13768 if (!IsMagazine())
13770
13772 }
13773
13774
13775
13776
13777
13782 {
13783 return true;
13784 }
13785
13787 {
13789 }
13790
13791
13792
13793
13794
13796 {
13797 if (parent)
13798 {
13799 if (parent.IsInherited(DayZInfected))
13800 return true;
13801
13802 if (!parent.IsRuined())
13803 return true;
13804 }
13805
13806 return true;
13807 }
13808
13810 {
13811 if (!super.CanPutAsAttachment(parent))
13812 {
13813 return false;
13814 }
13815
13816 if (!IsRuined() && !parent.IsRuined())
13817 {
13818 return true;
13819 }
13820
13821 return false;
13822 }
13823
13825 {
13826
13827
13828
13829
13830 return super.CanReceiveItemIntoCargo(item);
13831 }
13832
13834 {
13835
13836
13837
13838
13839 GameInventory attachmentInv = attachment.GetInventory();
13841 {
13842 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13843 return false;
13844 }
13845
13846 InventoryLocation loc = new InventoryLocation();
13847 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13848 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13849 return false;
13850
13851 return super.CanReceiveAttachment(attachment, slotId);
13852 }
13853
13855 {
13856 if (!super.CanReleaseAttachment(attachment))
13857 return false;
13858
13859 return GetInventory().AreChildrenAccessible();
13860 }
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13883 {
13884 int id = muzzle_owner.GetMuzzleID();
13885 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13886
13887 if (WPOF_array)
13888 {
13889 for (int i = 0; i < WPOF_array.Count(); i++)
13890 {
13891 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13892
13893 if (WPOF)
13894 {
13895 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13896 }
13897 }
13898 }
13899 }
13900
13901
13903 {
13904 int id = muzzle_owner.GetMuzzleID();
13906
13907 if (WPOBE_array)
13908 {
13909 for (int i = 0; i < WPOBE_array.Count(); i++)
13910 {
13911 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13912
13913 if (WPOBE)
13914 {
13915 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13916 }
13917 }
13918 }
13919 }
13920
13921
13923 {
13924 int id = muzzle_owner.GetMuzzleID();
13925 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13926
13927 if (WPOOH_array)
13928 {
13929 for (int i = 0; i < WPOOH_array.Count(); i++)
13930 {
13931 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13932
13933 if (WPOOH)
13934 {
13935 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13936 }
13937 }
13938 }
13939 }
13940
13941
13943 {
13944 int id = muzzle_owner.GetMuzzleID();
13945 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13946
13947 if (WPOOH_array)
13948 {
13949 for (int i = 0; i < WPOOH_array.Count(); i++)
13950 {
13951 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13952
13953 if (WPOOH)
13954 {
13955 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13956 }
13957 }
13958 }
13959 }
13960
13961
13963 {
13964 int id = muzzle_owner.GetMuzzleID();
13965 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13966
13967 if (WPOOH_array)
13968 {
13969 for (int i = 0; i < WPOOH_array.Count(); i++)
13970 {
13971 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13972
13973 if (WPOOH)
13974 {
13975 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13976 }
13977 }
13978 }
13979 }
13980
13981
13982
13984 {
13986 {
13987 return true;
13988 }
13989
13990 return false;
13991 }
13992
13994 {
13996 {
13997 return true;
13998 }
13999
14000 return false;
14001 }
14002
14004 {
14006 {
14007 return true;
14008 }
14009
14010 return false;
14011 }
14012
14014 {
14015 return false;
14016 }
14017
14020 {
14021 return UATimeSpent.DEFAULT_DEPLOY;
14022 }
14023
14024
14025
14026
14028 {
14030 SetSynchDirty();
14031 }
14032
14034 {
14036 }
14037
14038
14040 {
14041 return false;
14042 }
14043
14046 {
14047 string att_type = "None";
14048
14049 if (ConfigIsExisting("soundAttType"))
14050 {
14051 att_type = ConfigGetString("soundAttType");
14052 }
14053
14055 }
14056
14058 {
14060 }
14061
14062
14063
14064
14065
14071
14073 {
14076
14078 }
14079
14080
14082 {
14084 return;
14085
14087
14090
14093
14094 SoundParameters params = new SoundParameters();
14098 }
14099
14100
14102 {
14104 {
14107
14108 SetSynchDirty();
14109
14112 }
14113 }
14114
14116 {
14118 }
14119
14120
14122 {
14124 return;
14125
14127 SetSynchDirty();
14128
14131 }
14132
14134 {
14137 }
14138
14140 {
14142 }
14143
14144 void OnApply(PlayerBase player);
14145
14147 {
14148 return 1.0;
14149 };
14150
14152 {
14154 }
14155
14157 {
14159 }
14160
14162
14164 {
14165 SetDynamicPhysicsLifeTime(0.01);
14167 }
14168
14170 {
14171 array<string> zone_names = new array<string>;
14172 GetDamageZones(zone_names);
14173 for (int i = 0; i < zone_names.Count(); i++)
14174 {
14175 SetHealthMax(zone_names.Get(i),"Health");
14176 }
14177 SetHealthMax("","Health");
14178 }
14179
14182 {
14183 float global_health = GetHealth01("","Health");
14184 array<string> zones = new array<string>;
14185 GetDamageZones(zones);
14186
14187 for (int i = 0; i < zones.Count(); i++)
14188 {
14189 SetHealth01(zones.Get(i),"Health",global_health);
14190 }
14191 }
14192
14195 {
14196 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14197 }
14198
14200 {
14201 if (!hasRootAsPlayer)
14202 {
14203 if (refParentIB)
14204 {
14205
14206 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14207 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14208
14209 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14210 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14211
14214 }
14215 else
14216 {
14217
14220 }
14221 }
14222 }
14223
14225 {
14227 {
14228 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14229 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14230 {
14231 float heatPermCoef = 1.0;
14233 while (ent)
14234 {
14235 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14236 ent = ent.GetHierarchyParent();
14237 }
14238
14239 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14240 }
14241 }
14242 }
14243
14245 {
14246
14247 EntityAI parent = GetHierarchyParent();
14248 if (!parent)
14249 {
14250 hasParent = false;
14251 hasRootAsPlayer = false;
14252 }
14253 else
14254 {
14255 hasParent = true;
14256 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14257 refParentIB =
ItemBase.Cast(parent);
14258 }
14259 }
14260
14261 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14262 {
14263
14264 }
14265
14267 {
14268
14269 return false;
14270 }
14271
14273 {
14274
14275
14276 return false;
14277 }
14278
14280 {
14281
14282 return false;
14283 }
14284
14287 {
14288 return !GetIsFrozen() &&
IsOpen();
14289 }
14290
14292 {
14293 bool hasParent = false, hasRootAsPlayer = false;
14295
14296 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14297 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14298
14299 if (wwtu || foodDecay)
14300 {
14304
14305 if (processWetness || processTemperature || processDecay)
14306 {
14308
14309 if (processWetness)
14310 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14311
14312 if (processTemperature)
14314
14315 if (processDecay)
14316 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14317 }
14318 }
14319 }
14320
14323 {
14325 }
14326
14328 {
14331
14332 return super.GetTemperatureFreezeThreshold();
14333 }
14334
14336 {
14339
14340 return super.GetTemperatureThawThreshold();
14341 }
14342
14344 {
14347
14348 return super.GetItemOverheatThreshold();
14349 }
14350
14352 {
14354 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14355
14356 return super.GetTemperatureFreezeTime();
14357 }
14358
14360 {
14362 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14363
14364 return super.GetTemperatureThawTime();
14365 }
14366
14371
14373 {
14374 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14375 }
14376
14378 {
14379 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14380 }
14381
14384 {
14386 }
14387
14389 {
14391 }
14392
14394 {
14396 }
14397
14400 {
14401 return null;
14402 }
14403
14406 {
14407 return false;
14408 }
14409
14411 {
14413 {
14416 if (!trg)
14417 {
14419 explosive = this;
14420 }
14421
14422 explosive.PairRemote(trg);
14424
14425 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14426 trg.SetPersistentPairID(persistentID);
14427 explosive.SetPersistentPairID(persistentID);
14428
14429 return true;
14430 }
14431 return false;
14432 }
14433
14436 {
14437 float ret = 1.0;
14440 ret *= GetHealth01();
14441
14442 return ret;
14443 }
14444
14445 #ifdef DEVELOPER
14446 override void SetDebugItem()
14447 {
14448 super.SetDebugItem();
14449 _itemBase = this;
14450 }
14451
14453 {
14454 string text = super.GetDebugText();
14455
14457 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14458
14459 return text;
14460 }
14461 #endif
14462
14464 {
14465 return true;
14466 }
14467
14469
14471
14473 {
14476 }
14477
14478
14486
14502
14503 [
Obsolete(
"Use ItemSoundHandler instead")]
14506 {
14507 if (!
g_Game.IsDedicatedServer())
14508 {
14509 if (ConfigIsExisting("attachSoundSet"))
14510 {
14511 string cfg_path = "";
14512 string soundset = "";
14513 string type_name =
GetType();
14514
14517 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14518 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14519
14520 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14521 {
14522 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14523 {
14524 if (cfg_slot_array[i] == slot_type)
14525 {
14526 soundset = cfg_soundset_array[i];
14527 break;
14528 }
14529 }
14530 }
14531
14532 if (soundset != "")
14533 {
14534 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14536 }
14537 }
14538 }
14539 }
14540
14542}
14543
14545{
14547 if (entity)
14548 {
14549 bool is_item = entity.IsInherited(
ItemBase);
14550 if (is_item && full_quantity)
14551 {
14554 }
14555 }
14556 else
14557 {
14559 return NULL;
14560 }
14561 return entity;
14562}
14563
14565{
14566 if (item)
14567 {
14568 if (health > 0)
14569 item.SetHealth("", "", health);
14570
14571 if (item.CanHaveTemperature())
14572 {
14574 if (item.CanFreeze())
14575 item.SetFrozen(false);
14576 }
14577
14578 if (item.HasEnergyManager())
14579 {
14580 if (quantity >= 0)
14581 {
14582 item.GetCompEM().SetEnergy0To1(quantity);
14583 }
14584 else
14585 {
14587 }
14588 }
14589 else if (item.IsMagazine())
14590 {
14591 Magazine mag = Magazine.Cast(item);
14592 if (quantity >= 0)
14593 {
14594 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14595 }
14596 else
14597 {
14599 }
14600
14601 }
14602 else
14603 {
14604 if (quantity >= 0)
14605 {
14606 item.SetQuantityNormalized(quantity, false);
14607 }
14608 else
14609 {
14611 }
14612
14613 }
14614 }
14615}
14616
14617#ifdef DEVELOPER
14619#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.