9589{
9591 {
9592 return true;
9593 }
9594};
9595
9597{
9598
9599};
9600
9601
9602
9604{
9608
9610
9613
9614
9615
9616
9617
9626
9632
9637
9642
9663 protected bool m_IsResultOfSplit
9664
9666
9671
9672
9673
9675
9679
9680
9681
9683
9686
9687
9688
9694
9695
9703
9706
9707
9709
9710
9712
9713
9718
9719
9724
9726
9727
9729
9730
9732 {
9737
9738 if (!
g_Game.IsDedicatedServer())
9739 {
9741 {
9743
9745 {
9747 }
9748 }
9749
9752 }
9753
9754 m_OldLocation = null;
9755
9757 {
9759 }
9760
9761 if (ConfigIsExisting("headSelectionsToHide"))
9762 {
9765 }
9766
9768 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9769 {
9771 }
9772
9774
9775 m_IsResultOfSplit = false;
9776
9778 }
9779
9781 {
9782 super.InitItemVariables();
9783
9789 m_Count = ConfigGetInt(
"count");
9790
9793
9798
9801
9806
9818
9822
9823
9826 if (ConfigIsExisting("canBeSplit"))
9827 {
9830 }
9831
9833 if (ConfigIsExisting("itemBehaviour"))
9835
9836
9839 RegisterNetSyncVariableInt("m_VarLiquidType");
9840 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9841
9842 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9843 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9844 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9845
9846 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9847 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9848 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9849 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9850
9851 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9852 RegisterNetSyncVariableBool("m_IsTakeable");
9853 RegisterNetSyncVariableBool("m_IsHologram");
9854
9857 {
9860 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9861 }
9862
9864
9866 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9868
9870 }
9871
9873 {
9875 }
9876
9878 {
9881 {
9886 }
9887 }
9888
9889 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9890 {
9892 {
9895 }
9896
9898 }
9899
9901 {
9907 }
9908
9910
9912 {
9914
9915 if (!action)
9916 {
9917 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9918 return;
9919 }
9920
9922 if (!ai)
9923 {
9925 return;
9926 }
9927
9929 if (!action_array)
9930 {
9931 action_array = new array<ActionBase_Basic>;
9933 }
9934 if (LogManager.IsActionLogEnable())
9935 {
9936 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9937 }
9938
9939 if (action_array.Find(action) != -1)
9940 {
9941 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9942 }
9943 else
9944 {
9945 action_array.Insert(action);
9946 }
9947 }
9948
9950 {
9951 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9952 ActionBase action = player.GetActionManager().GetAction(actionName);
9955
9956 if (action_array)
9957 {
9958 action_array.RemoveItem(action);
9959 }
9960 }
9961
9962
9963
9965 {
9966 ActionOverrideData overrideData = new ActionOverrideData();
9970
9972 if (!actionMap)
9973 {
9976 }
9977
9978 actionMap.Insert(this.
Type(), overrideData);
9979
9980 }
9981
9983
9985
9986
9988 {
9991
9994
9995 string config_to_search = "CfgVehicles";
9996 string muzzle_owner_config;
9997
9999 {
10000 if (IsInherited(Weapon))
10001 config_to_search = "CfgWeapons";
10002
10003 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10004
10005 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10006
10007 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10008
10009 if (config_OnFire_subclass_count > 0)
10010 {
10011 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10012
10013 for (int i = 0; i < config_OnFire_subclass_count; i++)
10014 {
10015 string particle_class = "";
10016 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10017 string config_OnFire_entry = config_OnFire_class + particle_class;
10018 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10019 WPOF_array.Insert(WPOF);
10020 }
10021
10022
10024 }
10025 }
10026
10028 {
10029 config_to_search = "CfgWeapons";
10030 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10031
10032 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10033
10034 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10035
10036 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10037 {
10038 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10039
10040 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10041 {
10042 string particle_class2 = "";
10043 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10044 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10045 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10046 WPOBE_array.Insert(WPOBE);
10047 }
10048
10049
10051 }
10052 }
10053 }
10054
10055
10057 {
10060
10062 {
10063 string config_to_search = "CfgVehicles";
10064
10065 if (IsInherited(Weapon))
10066 config_to_search = "CfgWeapons";
10067
10068 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10069 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10070
10071 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10072 {
10073
10075
10077 {
10079 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10081 return;
10082 }
10083
10086
10087
10088
10089 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10090 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10091
10092 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10093 {
10094 string particle_class = "";
10095 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10096 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10097 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10098
10099 if (entry_type == CT_CLASS)
10100 {
10101 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10102 WPOOH_array.Insert(WPOF);
10103 }
10104 }
10105
10106
10108 }
10109 }
10110 }
10111
10113 {
10115 }
10116
10118 {
10120 {
10122
10125
10128
10129 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10130 }
10131 }
10132
10134 {
10136 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10137
10139 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10140
10142 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10143
10145 {
10147 }
10148 }
10149
10151 {
10153 }
10154
10156 {
10159 else
10161
10163 {
10166 }
10167 else
10168 {
10171
10174 }
10175
10177 }
10178
10180 {
10182 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10183 }
10184
10186 {
10188 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10190 }
10191
10193 {
10195 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10196 }
10197
10199 {
10202
10203 OverheatingParticle OP = new OverheatingParticle();
10208
10210 }
10211
10213 {
10216
10217 return -1;
10218 }
10219
10221 {
10223 {
10226
10227 for (int i = count; i > 0; --i)
10228 {
10229 int id = i - 1;
10232
10235
10236 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10237 {
10238 if (p)
10239 {
10242 }
10243 }
10244 }
10245 }
10246 }
10247
10249 {
10251 {
10253 {
10254 int id = i - 1;
10256
10257 if (OP)
10258 {
10260
10261 if (p)
10262 {
10264 }
10265
10266 delete OP;
10267 }
10268 }
10269
10272 }
10273 }
10274
10277 {
10278 return 0.0;
10279 }
10280
10281
10283 {
10284 return 250;
10285 }
10286
10288 {
10289 return 0;
10290 }
10291
10294 {
10296 return true;
10297
10298 return false;
10299 }
10300
10303 {
10306
10308 {
10310 }
10311 else
10312 {
10313
10315 }
10316
10318 }
10319
10326 {
10327 return -1;
10328 }
10329
10330
10331
10332
10334 {
10336 {
10337 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10338 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10339
10340 if (r_index >= 0)
10341 {
10342 InventoryLocation r_il = new InventoryLocation;
10343 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10344
10345 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10348 {
10349 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10350 }
10352 {
10353 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10354 }
10355
10356 }
10357
10358 player.GetHumanInventory().ClearUserReservedLocation(this);
10359 }
10360
10363 }
10364
10365
10366
10367
10369 {
10370 return ItemBase.m_DebugActionsMask;
10371 }
10372
10374 {
10375 return ItemBase.m_DebugActionsMask & mask;
10376 }
10377
10379 {
10380 ItemBase.m_DebugActionsMask = mask;
10381 }
10382
10384 {
10385 ItemBase.m_DebugActionsMask |= mask;
10386 }
10387
10389 {
10390 ItemBase.m_DebugActionsMask &= ~mask;
10391 }
10392
10394 {
10396 {
10398 }
10399 else
10400 {
10402 }
10403 }
10404
10405
10407 {
10408 if (GetEconomyProfile())
10409 {
10410 float q_max = GetEconomyProfile().GetQuantityMax();
10411 if (q_max > 0)
10412 {
10413 float q_min = GetEconomyProfile().GetQuantityMin();
10414 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10415
10417 {
10418 ComponentEnergyManager comp = GetCompEM();
10420 {
10422 }
10423 }
10425 {
10427
10428 }
10429
10430 }
10431 }
10432 }
10433
10436 {
10437 EntityAI parent = GetHierarchyParent();
10438
10439 if (parent)
10440 {
10441 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10442 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10443 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10444 }
10445 }
10446
10449 {
10450 EntityAI parent = GetHierarchyParent();
10451
10452 if (parent)
10453 {
10454 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10455 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10456 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10457 }
10458 }
10459
10461 {
10462
10463
10464
10465
10467
10469 {
10470 if (ScriptInputUserData.CanStoreInputUserData())
10471 {
10472 ScriptInputUserData ctx = new ScriptInputUserData;
10478 ctx.
Write(use_stack_max);
10481
10483 {
10484 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10485 }
10486 }
10487 }
10488 else if (!
g_Game.IsMultiplayer())
10489 {
10491 }
10492 }
10493
10495 {
10497 }
10498
10500 {
10502 }
10503
10505 {
10507 }
10508
10510 {
10511
10512 return false;
10513 }
10514
10516 {
10517 return false;
10518 }
10519
10523 {
10524 return false;
10525 }
10526
10528 {
10529 return "";
10530 }
10531
10533
10535 {
10536 return false;
10537 }
10538
10540 {
10541 return true;
10542 }
10543
10544
10545
10547 {
10548 return true;
10549 }
10550
10552 {
10553 return true;
10554 }
10555
10557 {
10558 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10560 }
10561
10563 {
10565 }
10566
10568 {
10570 if (!is_being_placed)
10572 SetSynchDirty();
10573 }
10574
10575
10577
10579 {
10581 }
10582
10584 {
10586 }
10587
10589 {
10590 return 1;
10591 }
10592
10594 {
10595 return false;
10596 }
10597
10599 {
10601 SetSynchDirty();
10602 }
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10639 {
10640 super.OnMovedInsideCargo(container);
10641
10642 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10643 }
10644
10645 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10646 {
10647 super.EEItemLocationChanged(oldLoc, newLoc);
10648
10649 PlayerBase newPlayer = null;
10650 PlayerBase oldPlayer = null;
10651
10652 if (newLoc.GetParent())
10653 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10654
10655 if (oldLoc.GetParent())
10656 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10657
10659 {
10660 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10661
10662 if (rIndex >= 0)
10663 {
10664 InventoryLocation rIl = new InventoryLocation;
10665 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10666
10667 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10670 {
10671 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10672 }
10674 {
10676 }
10677
10678 }
10679 }
10680
10682 {
10683 if (newPlayer)
10684 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10685
10686 if (newPlayer == oldPlayer)
10687 {
10688 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10689 {
10691 {
10692 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10693 {
10694 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10695 }
10696 }
10697 else
10698 {
10699 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10700 }
10701 }
10702
10703 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10704 {
10705 int type = oldLoc.GetType();
10707 {
10708 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10709 }
10711 {
10712 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10713 }
10714 }
10715 if (!m_OldLocation)
10716 {
10717 m_OldLocation = new InventoryLocation;
10718 }
10719 m_OldLocation.Copy(oldLoc);
10720 }
10721 else
10722 {
10723 if (m_OldLocation)
10724 {
10725 m_OldLocation.Reset();
10726 }
10727 }
10728
10729 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10730 }
10731 else
10732 {
10733 if (newPlayer)
10734 {
10735 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10736 if (resIndex >= 0)
10737 {
10738 InventoryLocation il = new InventoryLocation;
10739 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10741 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10744 {
10745 il.
GetParent().GetOnReleaseLock().Invoke(it);
10746 }
10748 {
10750 }
10751
10752 }
10753 }
10755 {
10756
10758 }
10759
10760 if (m_OldLocation)
10761 {
10762 m_OldLocation.Reset();
10763 }
10764 }
10765
10767 {
10768 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10769 }
10770
10772 {
10773 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10774 }
10775 }
10776
10777 override void EOnContact(IEntity other, Contact extra)
10778 {
10780 {
10781 int liquidType = -1;
10783 if (impactSpeed > 0.0)
10784 {
10786 #ifndef SERVER
10788 #else
10790 SetSynchDirty();
10791 #endif
10793 }
10794 }
10795
10796 #ifdef SERVER
10797 if (GetCompEM() && GetCompEM().IsPlugged())
10798 {
10799 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10800 GetCompEM().UnplugThis();
10801 }
10802 #endif
10803 }
10804
10806
10808 {
10810 }
10811
10813 {
10814
10815 }
10816
10818 {
10819 super.OnItemLocationChanged(old_owner, new_owner);
10820
10821 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10822 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10823
10824 if (!relatedPlayer && playerNew)
10825 relatedPlayer = playerNew;
10826
10827 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10828 {
10830 if (actionMgr)
10831 {
10832 ActionBase currentAction = actionMgr.GetRunningAction();
10833 if (currentAction)
10835 }
10836 }
10837
10838 Man ownerPlayerOld = null;
10839 Man ownerPlayerNew = null;
10840
10841 if (old_owner)
10842 {
10843 if (old_owner.
IsMan())
10844 {
10845 ownerPlayerOld = Man.Cast(old_owner);
10846 }
10847 else
10848 {
10849 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10850 }
10851 }
10852 else
10853 {
10855 {
10857
10858 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10859 {
10860 GetCompEM().UnplugThis();
10861 }
10862 }
10863 }
10864
10865 if (new_owner)
10866 {
10867 if (new_owner.
IsMan())
10868 {
10869 ownerPlayerNew = Man.Cast(new_owner);
10870 }
10871 else
10872 {
10873 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10874 }
10875 }
10876
10877 if (ownerPlayerOld != ownerPlayerNew)
10878 {
10879 if (ownerPlayerOld)
10880 {
10881 array<EntityAI> subItemsExit = new array<EntityAI>;
10883 for (int i = 0; i < subItemsExit.Count(); i++)
10884 {
10887 }
10888 }
10889
10890 if (ownerPlayerNew)
10891 {
10892 array<EntityAI> subItemsEnter = new array<EntityAI>;
10894 for (int j = 0; j < subItemsEnter.Count(); j++)
10895 {
10898 }
10899 }
10900 }
10901 else if (ownerPlayerNew != null)
10902 {
10903 PlayerBase nplayer;
10904 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10905 {
10906 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10908 for (int k = 0; k < subItemsUpdate.Count(); k++)
10909 {
10911 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10912 }
10913 }
10914 }
10915
10916 if (old_owner)
10917 old_owner.OnChildItemRemoved(this);
10918 if (new_owner)
10919 new_owner.OnChildItemReceived(this);
10920 }
10921
10922
10924 {
10925 super.EEDelete(parent);
10926 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10927 if (player)
10928 {
10930
10931 if (player.IsAlive())
10932 {
10933 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10934 if (r_index >= 0)
10935 {
10936 InventoryLocation r_il = new InventoryLocation;
10937 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10938
10939 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10942 {
10943 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10944 }
10946 {
10947 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10948 }
10949
10950 }
10951
10952 player.RemoveQuickBarEntityShortcut(this);
10953 }
10954 }
10955 }
10956
10958 {
10959 super.EEKilled(killer);
10960
10963 {
10964 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10965 {
10966 if (IsMagazine())
10967 {
10968 if (Magazine.Cast(this).GetAmmoCount() > 0)
10969 {
10971 }
10972 }
10973 else
10974 {
10976 }
10977 }
10978 }
10979 }
10980
10982 {
10983 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10984
10985 super.OnWasAttached(parent, slot_id);
10986
10989
10992 }
10993
10995 {
10996 super.OnWasDetached(parent, slot_id);
10997
11000
11003 }
11004
11006 {
11007 int idx;
11010
11011 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11012 if (inventory_slots.Count() < 1)
11013 {
11014 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11015 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11016 }
11017 else
11018 {
11019 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11020 }
11021
11022 idx = inventory_slots.Find(slot);
11023 if (idx < 0)
11024 return "";
11025
11026 return attach_types.Get(idx);
11027 }
11028
11030 {
11031 int idx = -1;
11032 string slot;
11033
11036
11037 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11038 if (inventory_slots.Count() < 1)
11039 {
11040 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11041 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11042 }
11043 else
11044 {
11045 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11046 if (detach_types.Count() < 1)
11047 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11048 }
11049
11050 for (int i = 0; i < inventory_slots.Count(); i++)
11051 {
11052 slot = inventory_slots.Get(i);
11053 }
11054
11055 if (slot != "")
11056 {
11057 if (detach_types.Count() == 1)
11058 idx = 0;
11059 else
11060 idx = inventory_slots.Find(slot);
11061 }
11062 if (idx < 0)
11063 return "";
11064
11065 return detach_types.Get(idx);
11066 }
11067
11069 {
11070
11072
11073
11074 float min_time = 1;
11075 float max_time = 3;
11076 float delay = Math.RandomFloat(min_time, max_time);
11077
11078 explode_timer.Run(delay, this, "DoAmmoExplosion");
11079 }
11080
11082 {
11083 Magazine magazine = Magazine.Cast(this);
11084 int pop_sounds_count = 6;
11085 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11086
11087
11088 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11089 string sound_name = pop_sounds[ sound_idx ];
11090 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11091
11092
11093 magazine.ServerAddAmmoCount(-1);
11094
11095
11096 float min_temp_to_explode = 100;
11097
11098 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11099 {
11101 }
11102 }
11103
11104
11105 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11106 {
11107 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11108
11109 const int CHANCE_DAMAGE_CARGO = 4;
11110 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11111 const int CHANCE_DAMAGE_NOTHING = 2;
11112
11114 {
11115 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11116 int chances;
11117 int rnd;
11118
11119 if (GetInventory().GetCargo())
11120 {
11121 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11122 rnd = Math.RandomInt(0,chances);
11123
11124 if (rnd < CHANCE_DAMAGE_CARGO)
11125 {
11127 }
11128 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11129 {
11131 }
11132 }
11133 else
11134 {
11135 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11136 rnd = Math.RandomInt(0,chances);
11137
11138 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11139 {
11141 }
11142 }
11143 }
11144 }
11145
11147 {
11148 CargoBase cargo = GetInventory().GetCargo();
11149 if (cargo)
11150 {
11152 if (item_count > 0)
11153 {
11154 int random_pick = Math.RandomInt(0, item_count);
11156 if (!item.IsExplosive())
11157 {
11158 item.AddHealth("","",damage);
11159 return true;
11160 }
11161 }
11162 }
11163 return false;
11164 }
11165
11167 {
11168 GameInventory inventory = GetInventory();
11170 if (attachment_count > 0)
11171 {
11172 int random_pick = Math.RandomInt(0, attachment_count);
11174 if (!attachment.IsExplosive())
11175 {
11176 attachment.AddHealth("","",damage);
11177 return true;
11178 }
11179 }
11180 return false;
11181 }
11182
11184 {
11186 }
11187
11189 {
11191 return GetInventory().CanRemoveEntity();
11192
11193 return false;
11194 }
11195
11197 {
11198
11200 return false;
11201
11202
11204 return false;
11205
11206
11207
11209 if (delta == 0)
11210 return false;
11211
11212
11213 return true;
11214 }
11215
11217 {
11219 {
11220 if (ScriptInputUserData.CanStoreInputUserData())
11221 {
11222 ScriptInputUserData ctx = new ScriptInputUserData;
11227 ctx.
Write(destination_entity);
11229 ctx.
Write(slot_id);
11231 }
11232 }
11233 else if (!
g_Game.IsMultiplayer())
11234 {
11236 }
11237 }
11238
11240 {
11241 float split_quantity_new;
11245 InventoryLocation loc = new InventoryLocation;
11246
11247 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11248 {
11250 split_quantity_new = stack_max;
11251 else
11253
11255 {
11256 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11257 if (new_item)
11258 {
11259 new_item.SetResultOfSplit(true);
11260 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11262 new_item.
SetQuantity(split_quantity_new,
false,
true);
11263 }
11264 }
11265 }
11266 else if (destination_entity && slot_id == -1)
11267 {
11268 if (quantity > stack_max)
11269 split_quantity_new = stack_max;
11270 else
11271 split_quantity_new = quantity;
11272
11274 {
11275 GameInventory destinationInventory = destination_entity.GetInventory();
11277 {
11280 }
11281
11282 if (new_item)
11283 {
11284 new_item.SetResultOfSplit(true);
11285 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11287 new_item.
SetQuantity(split_quantity_new,
false,
true);
11288 }
11289 }
11290 }
11291 else
11292 {
11293 if (stack_max != 0)
11294 {
11296 {
11298 }
11299
11300 if (split_quantity_new == 0)
11301 {
11302 if (!
g_Game.IsMultiplayer())
11303 player.PhysicalPredictiveDropItem(this);
11304 else
11305 player.ServerDropEntity(this);
11306 return;
11307 }
11308
11310 {
11312
11313 if (new_item)
11314 {
11315 new_item.SetResultOfSplit(true);
11316 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11319 new_item.PlaceOnSurface();
11320 }
11321 }
11322 }
11323 }
11324 }
11325
11327 {
11328 float split_quantity_new;
11332 InventoryLocation loc = new InventoryLocation;
11333
11334 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11335 {
11337 split_quantity_new = stack_max;
11338 else
11340
11342 {
11343 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11344 if (new_item)
11345 {
11346 new_item.SetResultOfSplit(true);
11347 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11349 new_item.
SetQuantity(split_quantity_new,
false,
true);
11350 }
11351 }
11352 }
11353 else if (destination_entity && slot_id == -1)
11354 {
11355 if (quantity > stack_max)
11356 split_quantity_new = stack_max;
11357 else
11358 split_quantity_new = quantity;
11359
11361 {
11362 GameInventory destinationInventory = destination_entity.GetInventory();
11364 {
11367 }
11368
11369 if (new_item)
11370 {
11371 new_item.SetResultOfSplit(true);
11372 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11374 new_item.
SetQuantity(split_quantity_new,
false,
true);
11375 }
11376 }
11377 }
11378 else
11379 {
11380 if (stack_max != 0)
11381 {
11383 {
11385 }
11386
11388 {
11390
11391 if (new_item)
11392 {
11393 new_item.SetResultOfSplit(true);
11394 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11397 new_item.PlaceOnSurface();
11398 }
11399 }
11400 }
11401 }
11402 }
11403
11405 {
11407 {
11408 if (ScriptInputUserData.CanStoreInputUserData())
11409 {
11410 ScriptInputUserData ctx = new ScriptInputUserData;
11415 dst.WriteToContext(ctx);
11417 }
11418 }
11419 else if (!
g_Game.IsMultiplayer())
11420 {
11422 }
11423 }
11424
11426 {
11428 {
11429 if (ScriptInputUserData.CanStoreInputUserData())
11430 {
11431 ScriptInputUserData ctx = new ScriptInputUserData;
11436 ctx.
Write(destination_entity);
11442 }
11443 }
11444 else if (!
g_Game.IsMultiplayer())
11445 {
11447 }
11448 }
11449
11451 {
11453 }
11454
11456 {
11458 float split_quantity_new;
11460 if (dst.IsValid())
11461 {
11462 int slot_id = dst.GetSlot();
11464
11465 if (quantity > stack_max)
11466 split_quantity_new = stack_max;
11467 else
11468 split_quantity_new = quantity;
11469
11471 {
11473
11474 if (new_item)
11475 {
11476 new_item.SetResultOfSplit(true);
11477 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11479 new_item.
SetQuantity(split_quantity_new,
false,
true);
11480 }
11481
11482 return new_item;
11483 }
11484 }
11485
11486 return null;
11487 }
11488
11490 {
11492 float split_quantity_new;
11494 if (destination_entity)
11495 {
11497 if (quantity > stackable)
11498 split_quantity_new = stackable;
11499 else
11500 split_quantity_new = quantity;
11501
11503 {
11504 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11505 if (new_item)
11506 {
11507 new_item.SetResultOfSplit(true);
11508 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11510 new_item.
SetQuantity(split_quantity_new,
false,
true);
11511 }
11512 }
11513 }
11514 }
11515
11517 {
11519 {
11520 if (ScriptInputUserData.CanStoreInputUserData())
11521 {
11522 ScriptInputUserData ctx = new ScriptInputUserData;
11527 ItemBase destination_entity =
this;
11528 ctx.
Write(destination_entity);
11532 }
11533 }
11534 else if (!
g_Game.IsMultiplayer())
11535 {
11537 }
11538 }
11539
11541 {
11543 float split_quantity_new;
11545 if (player)
11546 {
11548 if (quantity > stackable)
11549 split_quantity_new = stackable;
11550 else
11551 split_quantity_new = quantity;
11552
11554 {
11555 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11556 new_item =
ItemBase.Cast(in_hands);
11557 if (new_item)
11558 {
11559 new_item.SetResultOfSplit(true);
11560 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11562 new_item.SetQuantity(split_quantity_new, false, true);
11563 }
11564 }
11565 }
11566 }
11567
11569 {
11571 float split_quantity_new = Math.Floor(quantity * 0.5);
11572
11574 return;
11575
11577
11578 if (new_item)
11579 {
11580 if (new_item.GetQuantityMax() < split_quantity_new)
11581 {
11582 split_quantity_new = new_item.GetQuantityMax();
11583 }
11584
11585 new_item.SetResultOfSplit(true);
11586 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11587
11589 {
11592 }
11593 else
11594 {
11596 new_item.
SetQuantity(split_quantity_new,
false,
true);
11597 }
11598 }
11599 }
11600
11602 {
11604 float split_quantity_new = Math.Floor(quantity / 2);
11605
11607 return;
11608
11609 InventoryLocation invloc = new InventoryLocation;
11611
11613 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11614
11615 if (new_item)
11616 {
11617 if (new_item.GetQuantityMax() < split_quantity_new)
11618 {
11619 split_quantity_new = new_item.GetQuantityMax();
11620 }
11622 {
11625 }
11626 else if (split_quantity_new > 1)
11627 {
11629 new_item.
SetQuantity(split_quantity_new,
false,
true);
11630 }
11631 }
11632 }
11633
11636 {
11637 SetWeightDirty();
11639
11640 if (parent)
11641 parent.OnAttachmentQuantityChangedEx(this, delta);
11642
11644 {
11646 {
11648 }
11650 {
11651 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11653 }
11654 }
11655 }
11656
11659 {
11660
11661 }
11662
11665 {
11667 }
11668
11670 {
11671 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11672
11674 {
11675 if (newLevel == GameConstants.STATE_RUINED)
11676 {
11678 EntityAI parent = GetHierarchyParent();
11679 if (parent && parent.IsFireplace())
11680 {
11681 CargoBase cargo = GetInventory().GetCargo();
11682 if (cargo)
11683 {
11685 {
11687 }
11688 }
11689 }
11690 }
11691
11693 {
11694
11696 return;
11697 }
11698
11699 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11700 {
11702 }
11703 }
11704 }
11705
11706
11708 {
11709 super.OnRightClick();
11710
11712 {
11714 {
11715 if (ScriptInputUserData.CanStoreInputUserData())
11716 {
11717 EntityAI root = GetHierarchyRoot();
11718 Man playerOwner = GetHierarchyRootPlayer();
11719 InventoryLocation dst = new InventoryLocation;
11720
11721
11722 if (!playerOwner && root && root == this)
11723 {
11725 }
11726 else
11727 {
11728
11729 GetInventory().GetCurrentInventoryLocation(dst);
11731 {
11732 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11734 {
11736 }
11737 else
11738 {
11740
11741
11742 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11743 {
11745 }
11746 else
11747 {
11748 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11749 }
11750 }
11751 }
11752 }
11753
11754 ScriptInputUserData ctx = new ScriptInputUserData;
11762 }
11763 }
11764 else if (!
g_Game.IsMultiplayer())
11765 {
11767 }
11768 }
11769 }
11770
11772 {
11773 if (root)
11774 {
11775 vector m4[4];
11776 root.GetTransform(m4);
11777 dst.SetGround(this, m4);
11778 }
11779 else
11780 {
11781 GetInventory().GetCurrentInventoryLocation(dst);
11782 }
11783 }
11784
11785 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11786 {
11787
11788 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11789 return false;
11790
11791 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11792 return false;
11793
11794
11796 return false;
11797
11798
11799 Magazine mag = Magazine.Cast(this);
11800 if (mag)
11801 {
11802 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11803 return false;
11804
11805 if (stack_max_limit)
11806 {
11807 Magazine other_mag = Magazine.Cast(other_item);
11808 if (other_item)
11809 {
11810 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11811 return false;
11812 }
11813
11814 }
11815 }
11816 else
11817 {
11818
11820 return false;
11821
11823 return false;
11824 }
11825
11826 PlayerBase player = null;
11827 if (CastTo(player, GetHierarchyRootPlayer()))
11828 {
11829 if (player.GetInventory().HasAttachment(this))
11830 return false;
11831
11832 if (player.IsItemsToDelete())
11833 return false;
11834 }
11835
11836 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11837 return false;
11838
11839 int slotID;
11841 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11842 return false;
11843
11844 return true;
11845 }
11846
11848 {
11850 }
11851
11853 {
11854 return m_IsResultOfSplit;
11855 }
11856
11858 {
11859 m_IsResultOfSplit = value;
11860 }
11861
11863 {
11865 }
11866
11868 {
11869 float other_item_quantity = other_item.GetQuantity();
11870 float this_free_space;
11871
11873
11875
11876 if (other_item_quantity > this_free_space)
11877 {
11878 return this_free_space;
11879 }
11880 else
11881 {
11882 return other_item_quantity;
11883 }
11884 }
11885
11887 {
11889 }
11890
11892 {
11894 return;
11895
11896 if (!IsMagazine() && other_item)
11897 {
11899 if (quantity_used != 0)
11900 {
11901 float hp1 = GetHealth01("","");
11902 float hp2 = other_item.GetHealth01("","");
11903 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11904 hpResult = hpResult / (
GetQuantity() + quantity_used);
11905
11906 hpResult *= GetMaxHealth();
11907 Math.Round(hpResult);
11908 SetHealth("", "Health", hpResult);
11909
11911 other_item.AddQuantity(-quantity_used);
11912 }
11913 }
11915 }
11916
11918 {
11919 #ifdef SERVER
11920 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11921 GetHierarchyParent().IncreaseLifetimeUp();
11922 #endif
11923 };
11924
11926 {
11927 PlayerBase p = PlayerBase.Cast(player);
11928
11929 array<int> recipesIds = p.m_Recipes;
11930 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11931 if (moduleRecipesManager)
11932 {
11933 EntityAI itemInHands = player.GetEntityInHands();
11934 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11935 }
11936
11937 for (int i = 0;i < recipesIds.Count(); i++)
11938 {
11939 int key = recipesIds.Get(i);
11940 string recipeName = moduleRecipesManager.GetRecipeName(key);
11942 }
11943 }
11944
11945
11946 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11947 {
11948 super.GetDebugActions(outputList);
11949
11950
11956
11957
11962
11967
11968
11972
11973
11975 {
11979 }
11980
11983
11984
11988
11990
11991 InventoryLocation loc = new InventoryLocation();
11992 GetInventory().GetCurrentInventoryLocation(loc);
11994 {
11995 if (Gizmo_IsSupported())
11998 }
11999
12001 }
12002
12003
12004
12005
12007 {
12008 super.OnAction(action_id, player, ctx);
12009
12011 {
12012 switch (action_id)
12013 {
12017 return true;
12021 return true;
12022 }
12023 }
12024
12026 {
12027 switch (action_id)
12028 {
12030 Delete();
12031 return true;
12032 }
12033 }
12034
12035 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12036 {
12037 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12038 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12039 PlayerBase p = PlayerBase.Cast(player);
12040 if (
EActions.RECIPES_RANGE_START < 1000)
12041 {
12042 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12043 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12044 }
12045 }
12046 #ifndef SERVER
12047 else if (action_id ==
EActions.WATCH_PLAYER)
12048 {
12049 PluginDeveloper.SetDeveloperItemClientEx(player);
12050 }
12051 #endif
12053 {
12054 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12055 {
12056 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12057 OnDebugButtonPressServer(id + 1);
12058 }
12059
12060 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12061 {
12062 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12064 }
12065
12066 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12067 {
12068 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12070 }
12071
12072 else if (action_id ==
EActions.ADD_QUANTITY)
12073 {
12074 if (IsMagazine())
12075 {
12076 Magazine mag = Magazine.Cast(this);
12077 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12078 }
12079 else
12080 {
12082 }
12083
12084 if (m_EM)
12085 {
12086 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12087 }
12088
12089 }
12090
12091 else if (action_id ==
EActions.REMOVE_QUANTITY)
12092 {
12093 if (IsMagazine())
12094 {
12095 Magazine mag2 = Magazine.Cast(this);
12096 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12097 }
12098 else
12099 {
12101 }
12102 if (m_EM)
12103 {
12104 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12105 }
12106
12107 }
12108
12109 else if (action_id ==
EActions.SET_QUANTITY_0)
12110 {
12112
12113 if (m_EM)
12114 {
12115 m_EM.SetEnergy(0);
12116 }
12117 }
12118
12119 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12120 {
12122
12123 if (m_EM)
12124 {
12125 m_EM.SetEnergy(m_EM.GetEnergyMax());
12126 }
12127 }
12128
12129 else if (action_id ==
EActions.ADD_HEALTH)
12130 {
12131 AddHealth("","",GetMaxHealth("","Health")/5);
12132 }
12133 else if (action_id ==
EActions.REMOVE_HEALTH)
12134 {
12135 AddHealth("","",-GetMaxHealth("","Health")/5);
12136 }
12137 else if (action_id ==
EActions.DESTROY_HEALTH)
12138 {
12139 SetHealth01("","",0);
12140 }
12141 else if (action_id ==
EActions.WATCH_ITEM)
12142 {
12144 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12145 #ifdef DEVELOPER
12146 SetDebugDeveloper_item(this);
12147 #endif
12148 }
12149
12150 else if (action_id ==
EActions.ADD_TEMPERATURE)
12151 {
12152 AddTemperature(20);
12153
12154 }
12155
12156 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12157 {
12158 AddTemperature(-20);
12159
12160 }
12161
12162 else if (action_id ==
EActions.FLIP_FROZEN)
12163 {
12164 SetFrozen(!GetIsFrozen());
12165
12166 }
12167
12168 else if (action_id ==
EActions.ADD_WETNESS)
12169 {
12171
12172 }
12173
12174 else if (action_id ==
EActions.REMOVE_WETNESS)
12175 {
12177
12178 }
12179
12180 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12181 {
12184
12185
12186 }
12187
12188 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12189 {
12192 }
12193
12194 else if (action_id ==
EActions.MAKE_SPECIAL)
12195 {
12196 auto debugParams = DebugSpawnParams.WithPlayer(player);
12197 OnDebugSpawnEx(debugParams);
12198 }
12199
12200 }
12201
12202
12203 return false;
12204 }
12205
12206
12207
12208
12212
12215
12216
12217
12219 {
12220 return false;
12221 }
12222
12223
12225 {
12226 return true;
12227 }
12228
12229
12231 {
12232 return true;
12233 }
12234
12235
12236
12238 {
12239 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12240 return g_Game.ConfigIsExisting(config_path);
12241 }
12242
12245 {
12246 return null;
12247 }
12248
12250 {
12251 return false;
12252 }
12253
12255 {
12256 return false;
12257 }
12258
12262
12263
12265 {
12266 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12267 return module_repairing.CanRepair(this, item_repair_kit);
12268 }
12269
12270
12271 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12272 {
12273 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12274 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12275 }
12276
12277
12279 {
12280
12281
12282
12283
12284
12285
12286
12287
12288 return 1;
12289 }
12290
12291
12292
12294 {
12296 }
12297
12298
12299
12301 {
12303 }
12304
12305
12314 {
12315 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12316
12317 if (player)
12318 {
12319 player.MessageStatus(text);
12320 }
12321 }
12322
12323
12332 {
12333 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12334
12335 if (player)
12336 {
12337 player.MessageAction(text);
12338 }
12339 }
12340
12341
12350 {
12351 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12352
12353 if (player)
12354 {
12355 player.MessageFriendly(text);
12356 }
12357 }
12358
12359
12368 {
12369 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12370
12371 if (player)
12372 {
12373 player.MessageImportant(text);
12374 }
12375 }
12376
12378 {
12379 return true;
12380 }
12381
12382
12383 override bool KindOf(
string tag)
12384 {
12385 bool found = false;
12386 string item_name = this.
GetType();
12388 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12389
12390 int array_size = item_tag_array.Count();
12391 for (int i = 0; i < array_size; i++)
12392 {
12393 if (item_tag_array.Get(i) == tag)
12394 {
12395 found = true;
12396 break;
12397 }
12398 }
12399 return found;
12400 }
12401
12402
12404 {
12405
12406 super.OnRPC(sender, rpc_type,ctx);
12407
12408
12409 switch (rpc_type)
12410 {
12411 #ifndef SERVER
12412 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12413 Param2<bool, string> p = new Param2<bool, string>(false, "");
12414
12416 return;
12417
12418 bool play = p.param1;
12419 string soundSet = p.param2;
12420
12421 if (play)
12422 {
12424 {
12426 {
12428 }
12429 }
12430 else
12431 {
12433 }
12434 }
12435 else
12436 {
12438 }
12439
12440 break;
12441 #endif
12442
12443 }
12444
12446 {
12448 }
12449 }
12450
12451
12452
12453
12455 {
12456 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12457 return plugin.GetID(
name);
12458 }
12459
12461 {
12462 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12463 return plugin.GetName(id);
12464 }
12465
12468 {
12469
12470
12471 int varFlags;
12472 if (!ctx.
Read(varFlags))
12473 return;
12474
12475 if (varFlags & ItemVariableFlags.FLOAT)
12476 {
12478 }
12479 }
12480
12482 {
12483
12484 super.SerializeNumericalVars(floats_out);
12485
12486
12487
12489 {
12491 }
12492
12494 {
12496 }
12497
12499 {
12501 }
12502
12504 {
12509 }
12510
12512 {
12514 }
12515 }
12516
12518 {
12519
12520 super.DeSerializeNumericalVars(floats);
12521
12522
12523 int index = 0;
12524 int mask = Math.Round(floats.Get(index));
12525
12526 index++;
12527
12529 {
12531 {
12533 }
12534 else
12535 {
12536 float quantity = floats.Get(index);
12537 SetQuantity(quantity,
true,
false,
false,
false);
12538 }
12539 index++;
12540 }
12541
12543 {
12544 float wet = floats.Get(index);
12546 index++;
12547 }
12548
12550 {
12551 int liquidtype = Math.Round(floats.Get(index));
12553 index++;
12554 }
12555
12557 {
12559 index++;
12561 index++;
12563 index++;
12565 index++;
12566 }
12567
12569 {
12570 int cleanness = Math.Round(floats.Get(index));
12572 index++;
12573 }
12574 }
12575
12577 {
12578 super.WriteVarsToCTX(ctx);
12579
12580
12582 {
12584 }
12585
12587 {
12589 }
12590
12592 {
12594 }
12595
12597 {
12598 int r,g,b,a;
12604 }
12605
12607 {
12609 }
12610 }
12611
12613 {
12614 if (!super.ReadVarsFromCTX(ctx,version))
12615 return false;
12616
12617 int intValue;
12618 float value;
12619
12620 if (version < 140)
12621 {
12622 if (!ctx.
Read(intValue))
12623 return false;
12624
12625 m_VariablesMask = intValue;
12626 }
12627
12629 {
12630 if (!ctx.
Read(value))
12631 return false;
12632
12634 {
12636 }
12637 else
12638 {
12640 }
12641 }
12642
12643 if (version < 140)
12644 {
12646 {
12647 if (!ctx.
Read(value))
12648 return false;
12649 SetTemperatureDirect(value);
12650 }
12651 }
12652
12654 {
12655 if (!ctx.
Read(value))
12656 return false;
12658 }
12659
12661 {
12662 if (!ctx.
Read(intValue))
12663 return false;
12665 }
12666
12668 {
12669 int r,g,b,a;
12671 return false;
12673 return false;
12675 return false;
12677 return false;
12678
12680 }
12681
12683 {
12684 if (!ctx.
Read(intValue))
12685 return false;
12687 }
12688
12689 if (version >= 138 && version < 140)
12690 {
12692 {
12693 if (!ctx.
Read(intValue))
12694 return false;
12695 SetFrozen(intValue);
12696 }
12697 }
12698
12699 return true;
12700 }
12701
12702
12704 {
12707 {
12709 }
12710
12711 if (!super.OnStoreLoad(ctx, version))
12712 {
12714 return false;
12715 }
12716
12717 if (version >= 114)
12718 {
12719 bool hasQuickBarIndexSaved;
12720
12721 if (!ctx.
Read(hasQuickBarIndexSaved))
12722 {
12724 return false;
12725 }
12726
12727 if (hasQuickBarIndexSaved)
12728 {
12729 int itmQBIndex;
12730
12731
12732 if (!ctx.
Read(itmQBIndex))
12733 {
12735 return false;
12736 }
12737
12738 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12739 if (itmQBIndex != -1 && parentPlayer)
12740 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12741 }
12742 }
12743 else
12744 {
12745
12746 PlayerBase player;
12747 int itemQBIndex;
12748 if (version ==
int.
MAX)
12749 {
12750 if (!ctx.
Read(itemQBIndex))
12751 {
12753 return false;
12754 }
12755 }
12756 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12757 {
12758
12759 if (!ctx.
Read(itemQBIndex))
12760 {
12762 return false;
12763 }
12764 if (itemQBIndex != -1 && player)
12765 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12766 }
12767 }
12768
12769 if (version < 140)
12770 {
12771
12772 if (!LoadVariables(ctx, version))
12773 {
12775 return false;
12776 }
12777 }
12778
12779
12781 {
12783 return false;
12784 }
12785 if (version >= 132)
12786 {
12788 if (raib)
12789 {
12791 {
12793 return false;
12794 }
12795 }
12796 }
12797
12799 return true;
12800 }
12801
12802
12803
12805 {
12806 super.OnStoreSave(ctx);
12807
12808 PlayerBase player;
12809 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12810 {
12812
12813 int itemQBIndex = -1;
12814 itemQBIndex = player.FindQuickBarEntityIndex(this);
12815 ctx.
Write(itemQBIndex);
12816 }
12817 else
12818 {
12820 }
12821
12823
12825 if (raib)
12826 {
12828 }
12829 }
12830
12831
12833 {
12834 super.AfterStoreLoad();
12835
12837 {
12839 }
12840
12842 {
12845 }
12846 }
12847
12849 {
12850 super.EEOnAfterLoad();
12851
12853 {
12855 }
12856
12859 }
12860
12862 {
12863 return false;
12864 }
12865
12866
12867
12869 {
12871 {
12872 #ifdef PLATFORM_CONSOLE
12873
12875 {
12877 if (menu)
12878 {
12880 }
12881 }
12882 #endif
12883 }
12884
12886 {
12889 }
12890
12892 {
12893 SetWeightDirty();
12895 }
12897 {
12900 }
12901
12903 {
12906
12909 }
12911 {
12915 }
12916
12917 super.OnVariablesSynchronized();
12918 }
12919
12920
12921
12923 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12924 {
12925 if (!IsServerCheck(allow_client))
12926 return false;
12927
12929 return false;
12930
12933
12934 if (value <= (min + 0.001))
12935 value = min;
12936
12937 if (value == min)
12938 {
12939 if (destroy_config)
12940 {
12941 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12942 if (dstr)
12943 {
12945 this.Delete();
12946 return true;
12947 }
12948 }
12949 else if (destroy_forced)
12950 {
12952 this.Delete();
12953 return true;
12954 }
12955
12957 }
12958
12961
12963 {
12964 EntityAI parent = GetHierarchyRoot();
12965 InventoryLocation iLoc = new InventoryLocation();
12966 GetInventory().GetCurrentInventoryLocation(iLoc);
12968 {
12969 int iLocSlot = iLoc.
GetSlot();
12971 {
12973 }
12975 {
12977 }
12978 }
12979 }
12980
12982 {
12984
12985 if (delta)
12987 }
12988
12990
12991 return false;
12992 }
12993
12994
12996 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12997 {
12999 }
13000
13002 {
13005 }
13006
13008 {
13011 }
13012
13014 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13015 {
13016 float value_clamped = Math.Clamp(value, 0, 1);
13018 SetQuantity(result, destroy_config, destroy_forced);
13019 }
13020
13021
13024 {
13026 }
13027
13029 {
13031 }
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13043 {
13044 int slot = -1;
13045 GameInventory inventory = GetInventory();
13046 if (inventory)
13047 {
13048 InventoryLocation il = new InventoryLocation;
13051 }
13052
13054 }
13055
13057 {
13058 float quantity_max = 0;
13059
13061 {
13062 if (attSlotID != -1)
13063 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13064
13065 if (quantity_max <= 0)
13067 }
13068
13069 if (quantity_max <= 0)
13071
13072 return quantity_max;
13073 }
13074
13076 {
13078 }
13079
13081 {
13083 }
13084
13085
13087 {
13089 }
13090
13092 {
13094 }
13095
13097 {
13099 }
13100
13101
13103 {
13104
13105 float weightEx = GetWeightEx();
13106 float special = GetInventoryAndCargoWeight();
13107 return weightEx - special;
13108 }
13109
13110
13112 {
13114 }
13115
13117 {
13119 {
13120 #ifdef DEVELOPER
13121 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13122 {
13123 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13125 }
13126 #endif
13127
13128 return GetQuantity() * GetConfigWeightModified();
13129 }
13130 else if (HasEnergyManager())
13131 {
13132 #ifdef DEVELOPER
13133 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13134 {
13135 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13136 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13137 }
13138 #endif
13139 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13140 }
13141 else
13142 {
13143 #ifdef DEVELOPER
13144 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13145 {
13146 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13147 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13148 }
13149 #endif
13150 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13151 }
13152 }
13153
13156 {
13157 int item_count = 0;
13159
13160 GameInventory inventory = GetInventory();
13161 CargoBase cargo = inventory.
GetCargo();
13162 if (cargo != NULL)
13163 {
13165 }
13166
13168 for (int i = 0; i < nAttachments; ++i)
13169 {
13171 if (item)
13172 item_count += item.GetNumberOfItems();
13173 }
13174 return item_count;
13175 }
13176
13179 {
13180 float weight = 0;
13181 float wetness = 1;
13182 if (include_wetness)
13185 {
13186 weight = wetness * m_ConfigWeight;
13187 }
13189 {
13190 weight = 1;
13191 }
13192 return weight;
13193 }
13194
13195
13196
13198 {
13199 GameInventory inventory = GetInventory();
13200 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13201 {
13202 array<EntityAI> items = new array<EntityAI>;
13204 for (int i = 0; i < items.Count(); ++i)
13205 {
13207 if (item)
13208 {
13209 g_Game.ObjectDelete(item);
13210 }
13211 }
13212 }
13213 }
13214
13215
13216
13217
13219 {
13220 float energy = 0;
13221 if (HasEnergyManager())
13222 {
13223 energy = GetCompEM().GetEnergy();
13224 }
13225 return energy;
13226 }
13227
13228
13230 {
13231 super.OnEnergyConsumed();
13232
13234 }
13235
13237 {
13238 super.OnEnergyAdded();
13239
13241 }
13242
13243
13245 {
13246 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13247 {
13249 {
13250 float energy_0to1 = GetCompEM().GetEnergy0To1();
13252 }
13253 }
13254 }
13255
13256
13258 {
13259 return ConfigGetFloat("heatIsolation");
13260 }
13261
13263 {
13265 }
13266
13268 {
13269 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13270 if (
g_Game.ConfigIsExisting(paramPath))
13271 return g_Game.ConfigGetFloat(paramPath);
13272
13273 return 0.0;
13274 }
13275
13277 {
13278 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13279 if (
g_Game.ConfigIsExisting(paramPath))
13280 return g_Game.ConfigGetFloat(paramPath);
13281
13282 return 0.0;
13283 }
13284
13285 override void SetWet(
float value,
bool allow_client =
false)
13286 {
13287 if (!IsServerCheck(allow_client))
13288 return;
13289
13292
13294
13295 m_VarWet = Math.Clamp(value, min, max);
13296
13298 {
13301 }
13302 }
13303
13304 override void AddWet(
float value)
13305 {
13307 }
13308
13310 {
13312 }
13313
13315 {
13317 }
13318
13320 {
13322 }
13323
13325 {
13327 }
13328
13330 {
13332 }
13333
13334 override void OnWetChanged(
float newVal,
float oldVal)
13335 {
13338 if (newLevel != oldLevel)
13339 {
13341 }
13342 }
13343
13345 {
13346 SetWeightDirty();
13347 }
13348
13350 {
13351 return GetWetLevelInternal(
m_VarWet);
13352 }
13353
13354
13355
13357 {
13359 }
13360
13362 {
13364 }
13365
13367 {
13369 }
13370
13372 {
13374 }
13375
13376
13377
13379 {
13380 if (ConfigIsExisting("itemModelLength"))
13381 {
13382 return ConfigGetFloat("itemModelLength");
13383 }
13384 return 0;
13385 }
13386
13388 {
13389 if (ConfigIsExisting("itemAttachOffset"))
13390 {
13391 return ConfigGetFloat("itemAttachOffset");
13392 }
13393 return 0;
13394 }
13395
13396 override void SetCleanness(
int value,
bool allow_client =
false)
13397 {
13398 if (!IsServerCheck(allow_client))
13399 return;
13400
13402
13404
13407 }
13408
13410 {
13412 }
13413
13415 {
13416 return true;
13417 }
13418
13419
13420
13421
13423 {
13425 }
13426
13428 {
13430 }
13431
13432
13433
13434
13435 override void SetColor(
int r,
int g,
int b,
int a)
13436 {
13442 }
13444 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13445 {
13450 }
13451
13453 {
13455 }
13456
13459 {
13460 int r,g,b,a;
13462 r = r/255;
13463 g = g/255;
13464 b = b/255;
13465 a = a/255;
13466 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13467 }
13468
13469
13470
13471 override void SetLiquidType(
int value,
bool allow_client =
false)
13472 {
13473 if (!IsServerCheck(allow_client))
13474 return;
13475
13480 }
13481
13483 {
13484 return ConfigGetInt("varLiquidTypeInit");
13485 }
13486
13488 {
13490 }
13491
13493 {
13495 SetFrozen(false);
13496 }
13497
13500 {
13501 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13502 }
13503
13504
13507 {
13508 PlayerBase nplayer;
13509 if (PlayerBase.CastTo(nplayer, player))
13510 {
13512 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13513 }
13514 }
13515
13516
13519 {
13520 PlayerBase nplayer;
13521 if (PlayerBase.CastTo(nplayer,player))
13522 {
13523 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13524 }
13525
13526 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13527
13528 if (HasEnergyManager())
13529 {
13530 GetCompEM().UpdatePlugState();
13531 }
13532 }
13533
13534
13536 {
13537 super.OnPlacementStarted(player);
13538
13540 }
13541
13542 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13543 {
13545 {
13546 m_AdminLog.OnPlacementComplete(player,
this);
13547 }
13548
13549 super.OnPlacementComplete(player, position, orientation);
13550 }
13551
13552
13553
13554
13555
13557 {
13559 {
13560 return true;
13561 }
13562 else
13563 {
13564 return false;
13565 }
13566 }
13567
13568
13570 {
13572 {
13574 }
13575 }
13576
13577
13579 {
13581 }
13582
13584 {
13586 }
13587
13588 override void InsertAgent(
int agent,
float count = 1)
13589 {
13590 if (count < 1)
13591 return;
13592
13594 }
13595
13598 {
13600 }
13601
13602
13604 {
13606 }
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13650 {
13652 return false;
13653 return true;
13654 }
13655
13657 {
13658
13660 }
13661
13662
13665 {
13666 super.CheckForRoofLimited(timeTresholdMS);
13667
13668 float time =
g_Game.GetTime();
13669 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13670 {
13671 m_PreviousRoofTestTime = time;
13672 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13673 }
13674 }
13675
13676
13678 {
13680 {
13681 return 0;
13682 }
13683
13684 if (GetInventory().GetAttachmentSlotsCount() != 0)
13685 {
13686 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13687 if (filter)
13688 return filter.GetProtectionLevel(type, false, system);
13689 else
13690 return 0;
13691 }
13692
13693 string subclassPath, entryName;
13694
13695 switch (type)
13696 {
13698 entryName = "biological";
13699 break;
13701 entryName = "chemical";
13702 break;
13703 default:
13704 entryName = "biological";
13705 break;
13706 }
13707
13708 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13709
13710 return g_Game.ConfigGetFloat(subclassPath + entryName);
13711 }
13712
13713
13714
13717 {
13718 if (!IsMagazine())
13720
13722 }
13723
13724
13725
13726
13727
13732 {
13733 return true;
13734 }
13735
13737 {
13739 }
13740
13741
13742
13743
13744
13746 {
13747 if (parent)
13748 {
13749 if (parent.IsInherited(DayZInfected))
13750 return true;
13751
13752 if (!parent.IsRuined())
13753 return true;
13754 }
13755
13756 return true;
13757 }
13758
13760 {
13761 if (!super.CanPutAsAttachment(parent))
13762 {
13763 return false;
13764 }
13765
13766 if (!IsRuined() && !parent.IsRuined())
13767 {
13768 return true;
13769 }
13770
13771 return false;
13772 }
13773
13775 {
13776
13777
13778
13779
13780 return super.CanReceiveItemIntoCargo(item);
13781 }
13782
13784 {
13785
13786
13787
13788
13789 GameInventory attachmentInv = attachment.GetInventory();
13791 {
13792 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13793 return false;
13794 }
13795
13796 InventoryLocation loc = new InventoryLocation();
13797 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13798 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13799 return false;
13800
13801 return super.CanReceiveAttachment(attachment, slotId);
13802 }
13803
13805 {
13806 if (!super.CanReleaseAttachment(attachment))
13807 return false;
13808
13809 return GetInventory().AreChildrenAccessible();
13810 }
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13833 {
13834 int id = muzzle_owner.GetMuzzleID();
13835 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13836
13837 if (WPOF_array)
13838 {
13839 for (int i = 0; i < WPOF_array.Count(); i++)
13840 {
13841 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13842
13843 if (WPOF)
13844 {
13845 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13846 }
13847 }
13848 }
13849 }
13850
13851
13853 {
13854 int id = muzzle_owner.GetMuzzleID();
13856
13857 if (WPOBE_array)
13858 {
13859 for (int i = 0; i < WPOBE_array.Count(); i++)
13860 {
13861 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13862
13863 if (WPOBE)
13864 {
13865 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13866 }
13867 }
13868 }
13869 }
13870
13871
13873 {
13874 int id = muzzle_owner.GetMuzzleID();
13875 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13876
13877 if (WPOOH_array)
13878 {
13879 for (int i = 0; i < WPOOH_array.Count(); i++)
13880 {
13881 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13882
13883 if (WPOOH)
13884 {
13885 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13886 }
13887 }
13888 }
13889 }
13890
13891
13893 {
13894 int id = muzzle_owner.GetMuzzleID();
13895 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13896
13897 if (WPOOH_array)
13898 {
13899 for (int i = 0; i < WPOOH_array.Count(); i++)
13900 {
13901 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13902
13903 if (WPOOH)
13904 {
13905 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13906 }
13907 }
13908 }
13909 }
13910
13911
13913 {
13914 int id = muzzle_owner.GetMuzzleID();
13915 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13916
13917 if (WPOOH_array)
13918 {
13919 for (int i = 0; i < WPOOH_array.Count(); i++)
13920 {
13921 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13922
13923 if (WPOOH)
13924 {
13925 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13926 }
13927 }
13928 }
13929 }
13930
13931
13932
13934 {
13936 {
13937 return true;
13938 }
13939
13940 return false;
13941 }
13942
13944 {
13946 {
13947 return true;
13948 }
13949
13950 return false;
13951 }
13952
13954 {
13956 {
13957 return true;
13958 }
13959
13960 return false;
13961 }
13962
13964 {
13965 return false;
13966 }
13967
13970 {
13971 return UATimeSpent.DEFAULT_DEPLOY;
13972 }
13973
13974
13975
13976
13978 {
13980 SetSynchDirty();
13981 }
13982
13984 {
13986 }
13987
13988
13990 {
13991 return false;
13992 }
13993
13996 {
13997 string att_type = "None";
13998
13999 if (ConfigIsExisting("soundAttType"))
14000 {
14001 att_type = ConfigGetString("soundAttType");
14002 }
14003
14005 }
14006
14008 {
14010 }
14011
14012
14013
14014
14015
14021
14023 {
14026
14028 }
14029
14030
14032 {
14034 return;
14035
14037
14040
14043
14044 SoundParameters params = new SoundParameters();
14048 }
14049
14050
14052 {
14054 {
14057
14058 SetSynchDirty();
14059
14062 }
14063 }
14064
14066 {
14068 }
14069
14070
14072 {
14074 return;
14075
14077 SetSynchDirty();
14078
14081 }
14082
14084 {
14087 }
14088
14090 {
14092 }
14093
14094 void OnApply(PlayerBase player);
14095
14097 {
14098 return 1.0;
14099 };
14100
14102 {
14104 }
14105
14107 {
14109 }
14110
14112
14114 {
14115 SetDynamicPhysicsLifeTime(0.01);
14117 }
14118
14120 {
14121 array<string> zone_names = new array<string>;
14122 GetDamageZones(zone_names);
14123 for (int i = 0; i < zone_names.Count(); i++)
14124 {
14125 SetHealthMax(zone_names.Get(i),"Health");
14126 }
14127 SetHealthMax("","Health");
14128 }
14129
14132 {
14133 float global_health = GetHealth01("","Health");
14134 array<string> zones = new array<string>;
14135 GetDamageZones(zones);
14136
14137 for (int i = 0; i < zones.Count(); i++)
14138 {
14139 SetHealth01(zones.Get(i),"Health",global_health);
14140 }
14141 }
14142
14145 {
14146 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14147 }
14148
14150 {
14151 if (!hasRootAsPlayer)
14152 {
14153 if (refParentIB)
14154 {
14155
14156 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14157 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14158
14159 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14160 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14161
14164 }
14165 else
14166 {
14167
14170 }
14171 }
14172 }
14173
14175 {
14177 {
14178 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14179 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14180 {
14181 float heatPermCoef = 1.0;
14183 while (ent)
14184 {
14185 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14186 ent = ent.GetHierarchyParent();
14187 }
14188
14189 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14190 }
14191 }
14192 }
14193
14195 {
14196
14197 EntityAI parent = GetHierarchyParent();
14198 if (!parent)
14199 {
14200 hasParent = false;
14201 hasRootAsPlayer = false;
14202 }
14203 else
14204 {
14205 hasParent = true;
14206 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14207 refParentIB =
ItemBase.Cast(parent);
14208 }
14209 }
14210
14211 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14212 {
14213
14214 }
14215
14217 {
14218
14219 return false;
14220 }
14221
14223 {
14224
14225
14226 return false;
14227 }
14228
14230 {
14231
14232 return false;
14233 }
14234
14237 {
14238 return !GetIsFrozen() &&
IsOpen();
14239 }
14240
14242 {
14243 bool hasParent = false, hasRootAsPlayer = false;
14245
14246 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14247 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14248
14249 if (wwtu || foodDecay)
14250 {
14254
14255 if (processWetness || processTemperature || processDecay)
14256 {
14258
14259 if (processWetness)
14260 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14261
14262 if (processTemperature)
14264
14265 if (processDecay)
14266 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14267 }
14268 }
14269 }
14270
14273 {
14275 }
14276
14278 {
14281
14282 return super.GetTemperatureFreezeThreshold();
14283 }
14284
14286 {
14289
14290 return super.GetTemperatureThawThreshold();
14291 }
14292
14294 {
14297
14298 return super.GetItemOverheatThreshold();
14299 }
14300
14302 {
14304 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14305
14306 return super.GetTemperatureFreezeTime();
14307 }
14308
14310 {
14312 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14313
14314 return super.GetTemperatureThawTime();
14315 }
14316
14321
14323 {
14324 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14325 }
14326
14328 {
14329 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14330 }
14331
14334 {
14336 }
14337
14339 {
14341 }
14342
14344 {
14346 }
14347
14350 {
14351 return null;
14352 }
14353
14356 {
14357 return false;
14358 }
14359
14361 {
14363 {
14366 if (!trg)
14367 {
14369 explosive = this;
14370 }
14371
14372 explosive.PairRemote(trg);
14374
14375 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14376 trg.SetPersistentPairID(persistentID);
14377 explosive.SetPersistentPairID(persistentID);
14378
14379 return true;
14380 }
14381 return false;
14382 }
14383
14386 {
14387 float ret = 1.0;
14390 ret *= GetHealth01();
14391
14392 return ret;
14393 }
14394
14395 #ifdef DEVELOPER
14396 override void SetDebugItem()
14397 {
14398 super.SetDebugItem();
14399 _itemBase = this;
14400 }
14401
14403 {
14404 string text = super.GetDebugText();
14405
14407 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14408
14409 return text;
14410 }
14411 #endif
14412
14414 {
14415 return true;
14416 }
14417
14419
14421
14423 {
14426 }
14427
14428
14436
14452
14453 [
Obsolete(
"Use ItemSoundHandler instead")]
14456 {
14457 if (!
g_Game.IsDedicatedServer())
14458 {
14459 if (ConfigIsExisting("attachSoundSet"))
14460 {
14461 string cfg_path = "";
14462 string soundset = "";
14463 string type_name =
GetType();
14464
14467 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14468 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14469
14470 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14471 {
14472 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14473 {
14474 if (cfg_slot_array[i] == slot_type)
14475 {
14476 soundset = cfg_soundset_array[i];
14477 break;
14478 }
14479 }
14480 }
14481
14482 if (soundset != "")
14483 {
14484 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14486 }
14487 }
14488 }
14489 }
14490
14492}
14493
14495{
14497 if (entity)
14498 {
14499 bool is_item = entity.IsInherited(
ItemBase);
14500 if (is_item && full_quantity)
14501 {
14504 }
14505 }
14506 else
14507 {
14509 return NULL;
14510 }
14511 return entity;
14512}
14513
14515{
14516 if (item)
14517 {
14518 if (health > 0)
14519 item.SetHealth("", "", health);
14520
14521 if (item.CanHaveTemperature())
14522 {
14524 if (item.CanFreeze())
14525 item.SetFrozen(false);
14526 }
14527
14528 if (item.HasEnergyManager())
14529 {
14530 if (quantity >= 0)
14531 {
14532 item.GetCompEM().SetEnergy0To1(quantity);
14533 }
14534 else
14535 {
14537 }
14538 }
14539 else if (item.IsMagazine())
14540 {
14541 Magazine mag = Magazine.Cast(item);
14542 if (quantity >= 0)
14543 {
14544 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14545 }
14546 else
14547 {
14549 }
14550
14551 }
14552 else
14553 {
14554 if (quantity >= 0)
14555 {
14556 item.SetQuantityNormalized(quantity, false);
14557 }
14558 else
14559 {
14561 }
14562
14563 }
14564 }
14565}
14566
14567#ifdef DEVELOPER
14569#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.