9597{
9599 {
9600 return true;
9601 }
9602};
9603
9605{
9606
9607};
9608
9609
9610
9612{
9616
9618
9621
9622
9623
9624
9625
9634
9640
9645
9650
9671 protected bool m_IsResultOfSplit
9672
9674
9679
9680
9681
9683
9687
9688
9689
9691
9694
9695
9696
9702
9703
9711
9714
9715
9717
9718
9720
9721
9726
9727
9732
9734
9735
9737
9738
9740 {
9745
9746 if (!
g_Game.IsDedicatedServer())
9747 {
9749 {
9751
9753 {
9755 }
9756 }
9757
9760 }
9761
9762 m_OldLocation = null;
9763
9765 {
9767 }
9768
9769 if (ConfigIsExisting("headSelectionsToHide"))
9770 {
9773 }
9774
9776 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9777 {
9779 }
9780
9782
9783 m_IsResultOfSplit = false;
9784
9786 }
9787
9789 {
9790 super.InitItemVariables();
9791
9797 m_Count = ConfigGetInt(
"count");
9798
9801
9806
9809
9814
9826
9830
9831
9834 if (ConfigIsExisting("canBeSplit"))
9835 {
9838 }
9839
9841 if (ConfigIsExisting("itemBehaviour"))
9843
9844
9847 RegisterNetSyncVariableInt("m_VarLiquidType");
9848 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9849
9850 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9851 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9852 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9853
9854 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9855 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9856 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9857 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9858
9859 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9860 RegisterNetSyncVariableBool("m_IsTakeable");
9861 RegisterNetSyncVariableBool("m_IsHologram");
9862
9865 {
9868 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9869 }
9870
9872
9874 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9876
9878 }
9879
9881 {
9883 }
9884
9886 {
9889 {
9894 }
9895 }
9896
9897 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9898 {
9900 {
9903 }
9904
9906 }
9907
9909 {
9915 }
9916
9918
9920 {
9922
9923 if (!action)
9924 {
9925 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9926 return;
9927 }
9928
9930 if (!ai)
9931 {
9933 return;
9934 }
9935
9937 if (!action_array)
9938 {
9939 action_array = new array<ActionBase_Basic>;
9941 }
9942 if (LogManager.IsActionLogEnable())
9943 {
9944 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9945 }
9946
9947 if (action_array.Find(action) != -1)
9948 {
9949 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9950 }
9951 else
9952 {
9953 action_array.Insert(action);
9954 }
9955 }
9956
9958 {
9959 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9960 ActionBase action = player.GetActionManager().GetAction(actionName);
9963
9964 if (action_array)
9965 {
9966 action_array.RemoveItem(action);
9967 }
9968 }
9969
9970
9971
9973 {
9974 ActionOverrideData overrideData = new ActionOverrideData();
9978
9980 if (!actionMap)
9981 {
9984 }
9985
9986 actionMap.Insert(this.
Type(), overrideData);
9987
9988 }
9989
9991
9993
9994
9996 {
9999
10002
10003 string config_to_search = "CfgVehicles";
10004 string muzzle_owner_config;
10005
10007 {
10008 if (IsInherited(Weapon))
10009 config_to_search = "CfgWeapons";
10010
10011 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10012
10013 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10014
10015 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10016
10017 if (config_OnFire_subclass_count > 0)
10018 {
10019 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10020
10021 for (int i = 0; i < config_OnFire_subclass_count; i++)
10022 {
10023 string particle_class = "";
10024 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10025 string config_OnFire_entry = config_OnFire_class + particle_class;
10026 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10027 WPOF_array.Insert(WPOF);
10028 }
10029
10030
10032 }
10033 }
10034
10036 {
10037 config_to_search = "CfgWeapons";
10038 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10039
10040 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10041
10042 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10043
10044 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10045 {
10046 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10047
10048 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10049 {
10050 string particle_class2 = "";
10051 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10052 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10053 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10054 WPOBE_array.Insert(WPOBE);
10055 }
10056
10057
10059 }
10060 }
10061 }
10062
10063
10065 {
10068
10070 {
10071 string config_to_search = "CfgVehicles";
10072
10073 if (IsInherited(Weapon))
10074 config_to_search = "CfgWeapons";
10075
10076 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10077 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10078
10079 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10080 {
10081
10083
10085 {
10087 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10089 return;
10090 }
10091
10094
10095
10096
10097 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10098 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10099
10100 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10101 {
10102 string particle_class = "";
10103 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10104 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10105 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10106
10107 if (entry_type == CT_CLASS)
10108 {
10109 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10110 WPOOH_array.Insert(WPOF);
10111 }
10112 }
10113
10114
10116 }
10117 }
10118 }
10119
10121 {
10123 }
10124
10126 {
10128 {
10130
10133
10136
10137 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10138 }
10139 }
10140
10142 {
10144 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10145
10147 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10148
10150 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10151
10153 {
10155 }
10156 }
10157
10159 {
10161 }
10162
10164 {
10167 else
10169
10171 {
10174 }
10175 else
10176 {
10179
10182 }
10183
10185 }
10186
10188 {
10190 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10191 }
10192
10194 {
10196 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10198 }
10199
10201 {
10203 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10204 }
10205
10207 {
10210
10211 OverheatingParticle OP = new OverheatingParticle();
10216
10218 }
10219
10221 {
10224
10225 return -1;
10226 }
10227
10229 {
10231 {
10234
10235 for (int i = count; i > 0; --i)
10236 {
10237 int id = i - 1;
10240
10243
10244 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10245 {
10246 if (p)
10247 {
10250 }
10251 }
10252 }
10253 }
10254 }
10255
10257 {
10259 {
10261 {
10262 int id = i - 1;
10264
10265 if (OP)
10266 {
10268
10269 if (p)
10270 {
10272 }
10273
10274 delete OP;
10275 }
10276 }
10277
10280 }
10281 }
10282
10285 {
10286 return 0.0;
10287 }
10288
10289
10291 {
10292 return 250;
10293 }
10294
10296 {
10297 return 0;
10298 }
10299
10302 {
10304 return true;
10305
10306 return false;
10307 }
10308
10311 {
10314
10316 {
10318 }
10319 else
10320 {
10321
10323 }
10324
10326 }
10327
10334 {
10335 return -1;
10336 }
10337
10338
10339
10340
10342 {
10344 {
10345 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10346 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10347
10348 if (r_index >= 0)
10349 {
10350 InventoryLocation r_il = new InventoryLocation;
10351 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10352
10353 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10356 {
10357 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10358 }
10360 {
10361 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10362 }
10363
10364 }
10365
10366 player.GetHumanInventory().ClearUserReservedLocation(this);
10367 }
10368
10371 }
10372
10373
10374
10375
10377 {
10378 return ItemBase.m_DebugActionsMask;
10379 }
10380
10382 {
10383 return ItemBase.m_DebugActionsMask & mask;
10384 }
10385
10387 {
10388 ItemBase.m_DebugActionsMask = mask;
10389 }
10390
10392 {
10393 ItemBase.m_DebugActionsMask |= mask;
10394 }
10395
10397 {
10398 ItemBase.m_DebugActionsMask &= ~mask;
10399 }
10400
10402 {
10404 {
10406 }
10407 else
10408 {
10410 }
10411 }
10412
10413
10415 {
10416 if (GetEconomyProfile())
10417 {
10418 float q_max = GetEconomyProfile().GetQuantityMax();
10419 if (q_max > 0)
10420 {
10421 float q_min = GetEconomyProfile().GetQuantityMin();
10422 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10423
10425 {
10426 ComponentEnergyManager comp = GetCompEM();
10428 {
10430 }
10431 }
10433 {
10435
10436 }
10437
10438 }
10439 }
10440 }
10441
10444 {
10445 EntityAI parent = GetHierarchyParent();
10446
10447 if (parent)
10448 {
10449 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10450 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10451 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10452 }
10453 }
10454
10457 {
10458 EntityAI parent = GetHierarchyParent();
10459
10460 if (parent)
10461 {
10462 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10463 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10464 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10465 }
10466 }
10467
10469 {
10470
10471
10472
10473
10475
10477 {
10478 if (ScriptInputUserData.CanStoreInputUserData())
10479 {
10480 ScriptInputUserData ctx = new ScriptInputUserData;
10486 ctx.
Write(use_stack_max);
10489
10491 {
10492 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10493 }
10494 }
10495 }
10496 else if (!
g_Game.IsMultiplayer())
10497 {
10499 }
10500 }
10501
10503 {
10505 }
10506
10508 {
10510 }
10511
10513 {
10515 }
10516
10518 {
10519
10520 return false;
10521 }
10522
10524 {
10525 return false;
10526 }
10527
10531 {
10532 return false;
10533 }
10534
10536 {
10537 return "";
10538 }
10539
10541
10543 {
10544 return false;
10545 }
10546
10548 {
10549 return true;
10550 }
10551
10552
10553
10555 {
10556 return true;
10557 }
10558
10560 {
10561 return true;
10562 }
10563
10565 {
10566 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10568 }
10569
10571 {
10573 }
10574
10576 {
10578 if (!is_being_placed)
10580 SetSynchDirty();
10581 }
10582
10583
10585
10587 {
10589 }
10590
10592 {
10594 }
10595
10597 {
10598 return 1;
10599 }
10600
10602 {
10603 return false;
10604 }
10605
10607 {
10609 SetSynchDirty();
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
10638
10639
10640
10641
10642
10643
10644
10645
10647 {
10648 super.OnMovedInsideCargo(container);
10649
10650 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10651 }
10652
10653 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10654 {
10655 super.EEItemLocationChanged(oldLoc, newLoc);
10656
10657 PlayerBase newPlayer = null;
10658 PlayerBase oldPlayer = null;
10659
10660 if (newLoc.GetParent())
10661 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10662
10663 if (oldLoc.GetParent())
10664 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10665
10667 {
10668 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10669
10670 if (rIndex >= 0)
10671 {
10672 InventoryLocation rIl = new InventoryLocation;
10673 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10674
10675 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10678 {
10679 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10680 }
10682 {
10684 }
10685
10686 }
10687 }
10688
10690 {
10691 if (newPlayer)
10692 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10693
10694 if (newPlayer == oldPlayer)
10695 {
10696 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10697 {
10699 {
10700 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10701 {
10702 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10703 }
10704 }
10705 else
10706 {
10707 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10708 }
10709 }
10710
10711 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10712 {
10713 int type = oldLoc.GetType();
10715 {
10716 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10717 }
10719 {
10720 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10721 }
10722 }
10723 if (!m_OldLocation)
10724 {
10725 m_OldLocation = new InventoryLocation;
10726 }
10727 m_OldLocation.Copy(oldLoc);
10728 }
10729 else
10730 {
10731 if (m_OldLocation)
10732 {
10733 m_OldLocation.Reset();
10734 }
10735 }
10736
10737 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10738 }
10739 else
10740 {
10741 if (newPlayer)
10742 {
10743 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10744 if (resIndex >= 0)
10745 {
10746 InventoryLocation il = new InventoryLocation;
10747 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10749 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10752 {
10753 il.
GetParent().GetOnReleaseLock().Invoke(it);
10754 }
10756 {
10758 }
10759
10760 }
10761 }
10763 {
10764
10766 }
10767
10768 if (m_OldLocation)
10769 {
10770 m_OldLocation.Reset();
10771 }
10772 }
10773
10775 {
10776 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10777 }
10778
10780 {
10781 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10782 }
10783 }
10784
10785 override void EOnContact(IEntity other, Contact extra)
10786 {
10788 {
10789 int liquidType = -1;
10791 if (impactSpeed > 0.0)
10792 {
10794 #ifndef SERVER
10796 #else
10798 SetSynchDirty();
10799 #endif
10801 }
10802 }
10803
10804 #ifdef SERVER
10805 if (GetCompEM() && GetCompEM().IsPlugged())
10806 {
10807 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10808 GetCompEM().UnplugThis();
10809 }
10810 #endif
10811 }
10812
10814
10816 {
10818 }
10819
10821 {
10822
10823 }
10824
10826 {
10827 super.OnItemLocationChanged(old_owner, new_owner);
10828
10829 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10830 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10831
10832 if (!relatedPlayer && playerNew)
10833 relatedPlayer = playerNew;
10834
10835 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10836 {
10838 if (actionMgr)
10839 {
10840 ActionBase currentAction = actionMgr.GetRunningAction();
10841 if (currentAction)
10843 }
10844 }
10845
10846 Man ownerPlayerOld = null;
10847 Man ownerPlayerNew = null;
10848
10849 if (old_owner)
10850 {
10851 if (old_owner.
IsMan())
10852 {
10853 ownerPlayerOld = Man.Cast(old_owner);
10854 }
10855 else
10856 {
10857 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10858 }
10859 }
10860 else
10861 {
10863 {
10865
10866 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10867 {
10868 GetCompEM().UnplugThis();
10869 }
10870 }
10871 }
10872
10873 if (new_owner)
10874 {
10875 if (new_owner.
IsMan())
10876 {
10877 ownerPlayerNew = Man.Cast(new_owner);
10878 }
10879 else
10880 {
10881 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10882 }
10883 }
10884
10885 if (ownerPlayerOld != ownerPlayerNew)
10886 {
10887 if (ownerPlayerOld)
10888 {
10889 array<EntityAI> subItemsExit = new array<EntityAI>;
10891 for (int i = 0; i < subItemsExit.Count(); i++)
10892 {
10895 }
10896 }
10897
10898 if (ownerPlayerNew)
10899 {
10900 array<EntityAI> subItemsEnter = new array<EntityAI>;
10902 for (int j = 0; j < subItemsEnter.Count(); j++)
10903 {
10906 }
10907 }
10908 }
10909 else if (ownerPlayerNew != null)
10910 {
10911 PlayerBase nplayer;
10912 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10913 {
10914 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10916 for (int k = 0; k < subItemsUpdate.Count(); k++)
10917 {
10919 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10920 }
10921 }
10922 }
10923
10924 if (old_owner)
10925 old_owner.OnChildItemRemoved(this);
10926 if (new_owner)
10927 new_owner.OnChildItemReceived(this);
10928 }
10929
10930
10932 {
10933 super.EEDelete(parent);
10934 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10935 if (player)
10936 {
10938
10939 if (player.IsAlive())
10940 {
10941 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10942 if (r_index >= 0)
10943 {
10944 InventoryLocation r_il = new InventoryLocation;
10945 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10946
10947 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10950 {
10951 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10952 }
10954 {
10955 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10956 }
10957
10958 }
10959
10960 player.RemoveQuickBarEntityShortcut(this);
10961 }
10962 }
10963 }
10964
10966 {
10967 super.EEKilled(killer);
10968
10971 {
10972 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10973 {
10974 if (IsMagazine())
10975 {
10976 if (Magazine.Cast(this).GetAmmoCount() > 0)
10977 {
10979 }
10980 }
10981 else
10982 {
10984 }
10985 }
10986 }
10987 }
10988
10990 {
10991 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10992
10993 super.OnWasAttached(parent, slot_id);
10994
10997
11000 }
11001
11003 {
11004 super.OnWasDetached(parent, slot_id);
11005
11008
11011 }
11012
11014 {
11015 int idx;
11018
11019 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11020 if (inventory_slots.Count() < 1)
11021 {
11022 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11023 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11024 }
11025 else
11026 {
11027 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11028 }
11029
11030 idx = inventory_slots.Find(slot);
11031 if (idx < 0)
11032 return "";
11033
11034 return attach_types.Get(idx);
11035 }
11036
11038 {
11039 int idx = -1;
11040 string slot;
11041
11044
11045 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11046 if (inventory_slots.Count() < 1)
11047 {
11048 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11049 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11050 }
11051 else
11052 {
11053 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11054 if (detach_types.Count() < 1)
11055 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11056 }
11057
11058 for (int i = 0; i < inventory_slots.Count(); i++)
11059 {
11060 slot = inventory_slots.Get(i);
11061 }
11062
11063 if (slot != "")
11064 {
11065 if (detach_types.Count() == 1)
11066 idx = 0;
11067 else
11068 idx = inventory_slots.Find(slot);
11069 }
11070 if (idx < 0)
11071 return "";
11072
11073 return detach_types.Get(idx);
11074 }
11075
11077 {
11078
11080
11081
11082 float min_time = 1;
11083 float max_time = 3;
11084 float delay = Math.RandomFloat(min_time, max_time);
11085
11086 explode_timer.Run(delay, this, "DoAmmoExplosion");
11087 }
11088
11090 {
11091 Magazine magazine = Magazine.Cast(this);
11092 int pop_sounds_count = 6;
11093 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11094
11095
11096 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11097 string sound_name = pop_sounds[ sound_idx ];
11098 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11099
11100
11101 magazine.ServerAddAmmoCount(-1);
11102
11103
11104 float min_temp_to_explode = 100;
11105
11106 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11107 {
11109 }
11110 }
11111
11112
11113 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11114 {
11115 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11116
11117 const int CHANCE_DAMAGE_CARGO = 4;
11118 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11119 const int CHANCE_DAMAGE_NOTHING = 2;
11120
11122 {
11123 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11124 int chances;
11125 int rnd;
11126
11127 if (GetInventory().GetCargo())
11128 {
11129 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11130 rnd = Math.RandomInt(0,chances);
11131
11132 if (rnd < CHANCE_DAMAGE_CARGO)
11133 {
11135 }
11136 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11137 {
11139 }
11140 }
11141 else
11142 {
11143 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11144 rnd = Math.RandomInt(0,chances);
11145
11146 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11147 {
11149 }
11150 }
11151 }
11152 }
11153
11155 {
11156 CargoBase cargo = GetInventory().GetCargo();
11157 if (cargo)
11158 {
11160 if (item_count > 0)
11161 {
11162 int random_pick = Math.RandomInt(0, item_count);
11164 if (!item.IsExplosive())
11165 {
11166 item.AddHealth("","",damage);
11167 return true;
11168 }
11169 }
11170 }
11171 return false;
11172 }
11173
11175 {
11176 GameInventory inventory = GetInventory();
11178 if (attachment_count > 0)
11179 {
11180 int random_pick = Math.RandomInt(0, attachment_count);
11182 if (!attachment.IsExplosive())
11183 {
11184 attachment.AddHealth("","",damage);
11185 return true;
11186 }
11187 }
11188 return false;
11189 }
11190
11192 {
11194 }
11195
11197 {
11199 return GetInventory().CanRemoveEntity();
11200
11201 return false;
11202 }
11203
11205 {
11206
11208 return false;
11209
11210
11212 return false;
11213
11214
11215
11217 if (delta == 0)
11218 return false;
11219
11220
11221 return true;
11222 }
11223
11225 {
11227 {
11228 if (ScriptInputUserData.CanStoreInputUserData())
11229 {
11230 ScriptInputUserData ctx = new ScriptInputUserData;
11235 ctx.
Write(destination_entity);
11237 ctx.
Write(slot_id);
11239 }
11240 }
11241 else if (!
g_Game.IsMultiplayer())
11242 {
11244 }
11245 }
11246
11248 {
11249 float split_quantity_new;
11253 InventoryLocation loc = new InventoryLocation;
11254
11255 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11256 {
11258 split_quantity_new = stack_max;
11259 else
11261
11263 {
11264 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11265 if (new_item)
11266 {
11267 new_item.SetResultOfSplit(true);
11268 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11270 new_item.
SetQuantity(split_quantity_new,
false,
true);
11271 }
11272 }
11273 }
11274 else if (destination_entity && slot_id == -1)
11275 {
11276 if (quantity > stack_max)
11277 split_quantity_new = stack_max;
11278 else
11279 split_quantity_new = quantity;
11280
11282 {
11283 GameInventory destinationInventory = destination_entity.GetInventory();
11285 {
11288 }
11289
11290 if (new_item)
11291 {
11292 new_item.SetResultOfSplit(true);
11293 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11295 new_item.
SetQuantity(split_quantity_new,
false,
true);
11296 }
11297 }
11298 }
11299 else
11300 {
11301 if (stack_max != 0)
11302 {
11304 {
11306 }
11307
11308 if (split_quantity_new == 0)
11309 {
11310 if (!
g_Game.IsMultiplayer())
11311 player.PhysicalPredictiveDropItem(this);
11312 else
11313 player.ServerDropEntity(this);
11314 return;
11315 }
11316
11318 {
11320
11321 if (new_item)
11322 {
11323 new_item.SetResultOfSplit(true);
11324 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11327 new_item.PlaceOnSurface();
11328 }
11329 }
11330 }
11331 }
11332 }
11333
11335 {
11336 float split_quantity_new;
11340 InventoryLocation loc = new InventoryLocation;
11341
11342 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11343 {
11345 split_quantity_new = stack_max;
11346 else
11348
11350 {
11351 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11352 if (new_item)
11353 {
11354 new_item.SetResultOfSplit(true);
11355 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11357 new_item.
SetQuantity(split_quantity_new,
false,
true);
11358 }
11359 }
11360 }
11361 else if (destination_entity && slot_id == -1)
11362 {
11363 if (quantity > stack_max)
11364 split_quantity_new = stack_max;
11365 else
11366 split_quantity_new = quantity;
11367
11369 {
11370 GameInventory destinationInventory = destination_entity.GetInventory();
11372 {
11375 }
11376
11377 if (new_item)
11378 {
11379 new_item.SetResultOfSplit(true);
11380 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11382 new_item.
SetQuantity(split_quantity_new,
false,
true);
11383 }
11384 }
11385 }
11386 else
11387 {
11388 if (stack_max != 0)
11389 {
11391 {
11393 }
11394
11396 {
11398
11399 if (new_item)
11400 {
11401 new_item.SetResultOfSplit(true);
11402 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11405 new_item.PlaceOnSurface();
11406 }
11407 }
11408 }
11409 }
11410 }
11411
11413 {
11415 {
11416 if (ScriptInputUserData.CanStoreInputUserData())
11417 {
11418 ScriptInputUserData ctx = new ScriptInputUserData;
11423 dst.WriteToContext(ctx);
11425 }
11426 }
11427 else if (!
g_Game.IsMultiplayer())
11428 {
11430 }
11431 }
11432
11434 {
11436 {
11437 if (ScriptInputUserData.CanStoreInputUserData())
11438 {
11439 ScriptInputUserData ctx = new ScriptInputUserData;
11444 ctx.
Write(destination_entity);
11450 }
11451 }
11452 else if (!
g_Game.IsMultiplayer())
11453 {
11455 }
11456 }
11457
11459 {
11461 }
11462
11464 {
11466 float split_quantity_new;
11468 if (dst.IsValid())
11469 {
11470 int slot_id = dst.GetSlot();
11472
11473 if (quantity > stack_max)
11474 split_quantity_new = stack_max;
11475 else
11476 split_quantity_new = quantity;
11477
11479 {
11481
11482 if (new_item)
11483 {
11484 new_item.SetResultOfSplit(true);
11485 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11487 new_item.
SetQuantity(split_quantity_new,
false,
true);
11488 }
11489
11490 return new_item;
11491 }
11492 }
11493
11494 return null;
11495 }
11496
11498 {
11500 float split_quantity_new;
11502 if (destination_entity)
11503 {
11505 if (quantity > stackable)
11506 split_quantity_new = stackable;
11507 else
11508 split_quantity_new = quantity;
11509
11511 {
11512 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11513 if (new_item)
11514 {
11515 new_item.SetResultOfSplit(true);
11516 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11518 new_item.
SetQuantity(split_quantity_new,
false,
true);
11519 }
11520 }
11521 }
11522 }
11523
11525 {
11527 {
11528 if (ScriptInputUserData.CanStoreInputUserData())
11529 {
11530 ScriptInputUserData ctx = new ScriptInputUserData;
11535 ItemBase destination_entity =
this;
11536 ctx.
Write(destination_entity);
11540 }
11541 }
11542 else if (!
g_Game.IsMultiplayer())
11543 {
11545 }
11546 }
11547
11549 {
11551 float split_quantity_new;
11553 if (player)
11554 {
11556 if (quantity > stackable)
11557 split_quantity_new = stackable;
11558 else
11559 split_quantity_new = quantity;
11560
11562 {
11563 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11564 new_item =
ItemBase.Cast(in_hands);
11565 if (new_item)
11566 {
11567 new_item.SetResultOfSplit(true);
11568 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11570 new_item.SetQuantity(split_quantity_new, false, true);
11571 }
11572 }
11573 }
11574 }
11575
11577 {
11579 float split_quantity_new = Math.Floor(quantity * 0.5);
11580
11582 return;
11583
11585
11586 if (new_item)
11587 {
11588 if (new_item.GetQuantityMax() < split_quantity_new)
11589 {
11590 split_quantity_new = new_item.GetQuantityMax();
11591 }
11592
11593 new_item.SetResultOfSplit(true);
11594 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11595
11597 {
11600 }
11601 else
11602 {
11604 new_item.
SetQuantity(split_quantity_new,
false,
true);
11605 }
11606 }
11607 }
11608
11610 {
11612 float split_quantity_new = Math.Floor(quantity / 2);
11613
11615 return;
11616
11617 InventoryLocation invloc = new InventoryLocation;
11619
11621 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11622
11623 if (new_item)
11624 {
11625 if (new_item.GetQuantityMax() < split_quantity_new)
11626 {
11627 split_quantity_new = new_item.GetQuantityMax();
11628 }
11630 {
11633 }
11634 else if (split_quantity_new > 1)
11635 {
11637 new_item.
SetQuantity(split_quantity_new,
false,
true);
11638 }
11639 }
11640 }
11641
11644 {
11645 SetWeightDirty();
11647
11648 if (parent)
11649 parent.OnAttachmentQuantityChangedEx(this, delta);
11650
11652 {
11654 {
11656 }
11658 {
11659 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11661 }
11662 }
11663 }
11664
11667 {
11668
11669 }
11670
11673 {
11675 }
11676
11678 {
11679 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11680
11682 {
11683 if (newLevel == GameConstants.STATE_RUINED)
11684 {
11686 EntityAI parent = GetHierarchyParent();
11687 if (parent && parent.IsFireplace())
11688 {
11689 CargoBase cargo = GetInventory().GetCargo();
11690 if (cargo)
11691 {
11693 {
11695 }
11696 }
11697 }
11698 }
11699
11701 {
11702
11704 return;
11705 }
11706
11707 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11708 {
11710 }
11711 }
11712 }
11713
11714
11716 {
11717 super.OnRightClick();
11718
11720 {
11722 {
11723 if (ScriptInputUserData.CanStoreInputUserData())
11724 {
11725 EntityAI root = GetHierarchyRoot();
11726 Man playerOwner = GetHierarchyRootPlayer();
11727 InventoryLocation dst = new InventoryLocation;
11728
11729
11730 if (!playerOwner && root && root == this)
11731 {
11733 }
11734 else
11735 {
11736
11737 GetInventory().GetCurrentInventoryLocation(dst);
11739 {
11740 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11742 {
11744 }
11745 else
11746 {
11748
11749
11750 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11751 {
11753 }
11754 else
11755 {
11756 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11757 }
11758 }
11759 }
11760 }
11761
11762 ScriptInputUserData ctx = new ScriptInputUserData;
11770 }
11771 }
11772 else if (!
g_Game.IsMultiplayer())
11773 {
11775 }
11776 }
11777 }
11778
11780 {
11781 if (root)
11782 {
11783 vector m4[4];
11784 root.GetTransform(m4);
11785 dst.SetGround(this, m4);
11786 }
11787 else
11788 {
11789 GetInventory().GetCurrentInventoryLocation(dst);
11790 }
11791 }
11792
11793 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11794 {
11795
11796 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11797 return false;
11798
11799 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11800 return false;
11801
11802
11804 return false;
11805
11806
11807 Magazine mag = Magazine.Cast(this);
11808 if (mag)
11809 {
11810 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11811 return false;
11812
11813 if (stack_max_limit)
11814 {
11815 Magazine other_mag = Magazine.Cast(other_item);
11816 if (other_item)
11817 {
11818 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11819 return false;
11820 }
11821
11822 }
11823 }
11824 else
11825 {
11826
11828 return false;
11829
11831 return false;
11832 }
11833
11834 PlayerBase player = null;
11835 if (CastTo(player, GetHierarchyRootPlayer()))
11836 {
11837 if (player.GetInventory().HasAttachment(this))
11838 return false;
11839
11840 if (player.IsItemsToDelete())
11841 return false;
11842 }
11843
11844 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11845 return false;
11846
11847 int slotID;
11849 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11850 return false;
11851
11852 return true;
11853 }
11854
11856 {
11858 }
11859
11861 {
11862 return m_IsResultOfSplit;
11863 }
11864
11866 {
11867 m_IsResultOfSplit = value;
11868 }
11869
11871 {
11873 }
11874
11876 {
11877 float other_item_quantity = other_item.GetQuantity();
11878 float this_free_space;
11879
11881
11883
11884 if (other_item_quantity > this_free_space)
11885 {
11886 return this_free_space;
11887 }
11888 else
11889 {
11890 return other_item_quantity;
11891 }
11892 }
11893
11895 {
11897 }
11898
11900 {
11902 return;
11903
11904 if (!IsMagazine() && other_item)
11905 {
11907 if (quantity_used != 0)
11908 {
11909 float hp1 = GetHealth01("","");
11910 float hp2 = other_item.GetHealth01("","");
11911 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11912 hpResult = hpResult / (
GetQuantity() + quantity_used);
11913
11914 hpResult *= GetMaxHealth();
11915 Math.Round(hpResult);
11916 SetHealth("", "Health", hpResult);
11917
11919 other_item.AddQuantity(-quantity_used);
11920 }
11921 }
11923 }
11924
11926 {
11927 #ifdef SERVER
11928 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11929 GetHierarchyParent().IncreaseLifetimeUp();
11930 #endif
11931 };
11932
11934 {
11935 PlayerBase p = PlayerBase.Cast(player);
11936
11937 array<int> recipesIds = p.m_Recipes;
11938 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11939 if (moduleRecipesManager)
11940 {
11941 EntityAI itemInHands = player.GetEntityInHands();
11942 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11943 }
11944
11945 for (int i = 0;i < recipesIds.Count(); i++)
11946 {
11947 int key = recipesIds.Get(i);
11948 string recipeName = moduleRecipesManager.GetRecipeName(key);
11950 }
11951 }
11952
11953
11954 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11955 {
11956 super.GetDebugActions(outputList);
11957
11958
11964
11965
11970
11975
11976
11980
11981
11983 {
11987 }
11988
11991
11992
11996
11998
11999 InventoryLocation loc = new InventoryLocation();
12000 GetInventory().GetCurrentInventoryLocation(loc);
12002 {
12003 if (Gizmo_IsSupported())
12006 }
12007
12009 }
12010
12011
12012
12013
12015 {
12016 super.OnAction(action_id, player, ctx);
12017
12019 {
12020 switch (action_id)
12021 {
12025 return true;
12029 return true;
12030 }
12031 }
12032
12034 {
12035 switch (action_id)
12036 {
12038 Delete();
12039 return true;
12040 }
12041 }
12042
12043 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12044 {
12045 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12046 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12047 PlayerBase p = PlayerBase.Cast(player);
12048 if (
EActions.RECIPES_RANGE_START < 1000)
12049 {
12050 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12051 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12052 }
12053 }
12054 #ifndef SERVER
12055 else if (action_id ==
EActions.WATCH_PLAYER)
12056 {
12057 PluginDeveloper.SetDeveloperItemClientEx(player);
12058 }
12059 #endif
12061 {
12062 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12063 {
12064 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12065 OnDebugButtonPressServer(id + 1);
12066 }
12067
12068 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12069 {
12070 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12072 }
12073
12074 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12075 {
12076 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12078 }
12079
12080 else if (action_id ==
EActions.ADD_QUANTITY)
12081 {
12082 if (IsMagazine())
12083 {
12084 Magazine mag = Magazine.Cast(this);
12085 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12086 }
12087 else
12088 {
12090 }
12091
12092 if (m_EM)
12093 {
12094 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12095 }
12096
12097 }
12098
12099 else if (action_id ==
EActions.REMOVE_QUANTITY)
12100 {
12101 if (IsMagazine())
12102 {
12103 Magazine mag2 = Magazine.Cast(this);
12104 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12105 }
12106 else
12107 {
12109 }
12110 if (m_EM)
12111 {
12112 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12113 }
12114
12115 }
12116
12117 else if (action_id ==
EActions.SET_QUANTITY_0)
12118 {
12120
12121 if (m_EM)
12122 {
12123 m_EM.SetEnergy(0);
12124 }
12125 }
12126
12127 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12128 {
12130
12131 if (m_EM)
12132 {
12133 m_EM.SetEnergy(m_EM.GetEnergyMax());
12134 }
12135 }
12136
12137 else if (action_id ==
EActions.ADD_HEALTH)
12138 {
12139 AddHealth("","",GetMaxHealth("","Health")/5);
12140 }
12141 else if (action_id ==
EActions.REMOVE_HEALTH)
12142 {
12143 AddHealth("","",-GetMaxHealth("","Health")/5);
12144 }
12145 else if (action_id ==
EActions.DESTROY_HEALTH)
12146 {
12147 SetHealth01("","",0);
12148 }
12149 else if (action_id ==
EActions.WATCH_ITEM)
12150 {
12152 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12153 #ifdef DEVELOPER
12154 SetDebugDeveloper_item(this);
12155 #endif
12156 }
12157
12158 else if (action_id ==
EActions.ADD_TEMPERATURE)
12159 {
12160 AddTemperature(20);
12161
12162 }
12163
12164 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12165 {
12166 AddTemperature(-20);
12167
12168 }
12169
12170 else if (action_id ==
EActions.FLIP_FROZEN)
12171 {
12172 SetFrozen(!GetIsFrozen());
12173
12174 }
12175
12176 else if (action_id ==
EActions.ADD_WETNESS)
12177 {
12179
12180 }
12181
12182 else if (action_id ==
EActions.REMOVE_WETNESS)
12183 {
12185
12186 }
12187
12188 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12189 {
12192
12193
12194 }
12195
12196 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12197 {
12200 }
12201
12202 else if (action_id ==
EActions.MAKE_SPECIAL)
12203 {
12204 auto debugParams = DebugSpawnParams.WithPlayer(player);
12205 OnDebugSpawnEx(debugParams);
12206 }
12207
12208 }
12209
12210
12211 return false;
12212 }
12213
12214
12215
12216
12220
12223
12224
12225
12227 {
12228 return false;
12229 }
12230
12231
12233 {
12234 return true;
12235 }
12236
12237
12239 {
12240 return true;
12241 }
12242
12243
12244
12246 {
12247 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12248 return g_Game.ConfigIsExisting(config_path);
12249 }
12250
12253 {
12254 return null;
12255 }
12256
12258 {
12259 return false;
12260 }
12261
12263 {
12264 return false;
12265 }
12266
12270
12271
12273 {
12274 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12275 return module_repairing.CanRepair(this, item_repair_kit);
12276 }
12277
12278
12279 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12280 {
12281 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12282 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12283 }
12284
12285
12287 {
12288
12289
12290
12291
12292
12293
12294
12295
12296 return 1;
12297 }
12298
12299
12300
12302 {
12304 }
12305
12306
12307
12309 {
12311 }
12312
12313
12322 {
12323 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12324
12325 if (player)
12326 {
12327 player.MessageStatus(text);
12328 }
12329 }
12330
12331
12340 {
12341 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12342
12343 if (player)
12344 {
12345 player.MessageAction(text);
12346 }
12347 }
12348
12349
12358 {
12359 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12360
12361 if (player)
12362 {
12363 player.MessageFriendly(text);
12364 }
12365 }
12366
12367
12376 {
12377 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12378
12379 if (player)
12380 {
12381 player.MessageImportant(text);
12382 }
12383 }
12384
12386 {
12387 return true;
12388 }
12389
12390
12391 override bool KindOf(
string tag)
12392 {
12393 bool found = false;
12394 string item_name = this.
GetType();
12396 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12397
12398 int array_size = item_tag_array.Count();
12399 for (int i = 0; i < array_size; i++)
12400 {
12401 if (item_tag_array.Get(i) == tag)
12402 {
12403 found = true;
12404 break;
12405 }
12406 }
12407 return found;
12408 }
12409
12410
12412 {
12413
12414 super.OnRPC(sender, rpc_type,ctx);
12415
12416
12417 switch (rpc_type)
12418 {
12419 #ifndef SERVER
12420 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12421 Param2<bool, string> p = new Param2<bool, string>(false, "");
12422
12424 return;
12425
12426 bool play = p.param1;
12427 string soundSet = p.param2;
12428
12429 if (play)
12430 {
12432 {
12434 {
12436 }
12437 }
12438 else
12439 {
12441 }
12442 }
12443 else
12444 {
12446 }
12447
12448 break;
12449 #endif
12450
12451 }
12452
12454 {
12456 }
12457 }
12458
12459
12460
12461
12463 {
12464 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12465 return plugin.GetID(
name);
12466 }
12467
12469 {
12470 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12471 return plugin.GetName(id);
12472 }
12473
12476 {
12477
12478
12479 int varFlags;
12480 if (!ctx.
Read(varFlags))
12481 return;
12482
12483 if (varFlags & ItemVariableFlags.FLOAT)
12484 {
12486 }
12487 }
12488
12490 {
12491
12492 super.SerializeNumericalVars(floats_out);
12493
12494
12495
12497 {
12499 }
12500
12502 {
12504 }
12505
12507 {
12509 }
12510
12512 {
12517 }
12518
12520 {
12522 }
12523 }
12524
12526 {
12527
12528 super.DeSerializeNumericalVars(floats);
12529
12530
12531 int index = 0;
12532 int mask = Math.Round(floats.Get(index));
12533
12534 index++;
12535
12537 {
12539 {
12541 }
12542 else
12543 {
12544 float quantity = floats.Get(index);
12545 SetQuantity(quantity,
true,
false,
false,
false);
12546 }
12547 index++;
12548 }
12549
12551 {
12552 float wet = floats.Get(index);
12554 index++;
12555 }
12556
12558 {
12559 int liquidtype = Math.Round(floats.Get(index));
12561 index++;
12562 }
12563
12565 {
12567 index++;
12569 index++;
12571 index++;
12573 index++;
12574 }
12575
12577 {
12578 int cleanness = Math.Round(floats.Get(index));
12580 index++;
12581 }
12582 }
12583
12585 {
12586 super.WriteVarsToCTX(ctx);
12587
12588
12590 {
12592 }
12593
12595 {
12597 }
12598
12600 {
12602 }
12603
12605 {
12606 int r,g,b,a;
12612 }
12613
12615 {
12617 }
12618 }
12619
12621 {
12622 if (!super.ReadVarsFromCTX(ctx,version))
12623 return false;
12624
12625 int intValue;
12626 float value;
12627
12628 if (version < 140)
12629 {
12630 if (!ctx.
Read(intValue))
12631 return false;
12632
12633 m_VariablesMask = intValue;
12634 }
12635
12637 {
12638 if (!ctx.
Read(value))
12639 return false;
12640
12642 {
12644 }
12645 else
12646 {
12648 }
12649 }
12650
12651 if (version < 140)
12652 {
12654 {
12655 if (!ctx.
Read(value))
12656 return false;
12657 SetTemperatureDirect(value);
12658 }
12659 }
12660
12662 {
12663 if (!ctx.
Read(value))
12664 return false;
12666 }
12667
12669 {
12670 if (!ctx.
Read(intValue))
12671 return false;
12673 }
12674
12676 {
12677 int r,g,b,a;
12679 return false;
12681 return false;
12683 return false;
12685 return false;
12686
12688 }
12689
12691 {
12692 if (!ctx.
Read(intValue))
12693 return false;
12695 }
12696
12697 if (version >= 138 && version < 140)
12698 {
12700 {
12701 if (!ctx.
Read(intValue))
12702 return false;
12703 SetFrozen(intValue);
12704 }
12705 }
12706
12707 return true;
12708 }
12709
12710
12712 {
12715 {
12717 }
12718
12719 if (!super.OnStoreLoad(ctx, version))
12720 {
12722 return false;
12723 }
12724
12725 if (version >= 114)
12726 {
12727 bool hasQuickBarIndexSaved;
12728
12729 if (!ctx.
Read(hasQuickBarIndexSaved))
12730 {
12732 return false;
12733 }
12734
12735 if (hasQuickBarIndexSaved)
12736 {
12737 int itmQBIndex;
12738
12739
12740 if (!ctx.
Read(itmQBIndex))
12741 {
12743 return false;
12744 }
12745
12746 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12747 if (itmQBIndex != -1 && parentPlayer)
12748 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12749 }
12750 }
12751 else
12752 {
12753
12754 PlayerBase player;
12755 int itemQBIndex;
12756 if (version ==
int.
MAX)
12757 {
12758 if (!ctx.
Read(itemQBIndex))
12759 {
12761 return false;
12762 }
12763 }
12764 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12765 {
12766
12767 if (!ctx.
Read(itemQBIndex))
12768 {
12770 return false;
12771 }
12772 if (itemQBIndex != -1 && player)
12773 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12774 }
12775 }
12776
12777 if (version < 140)
12778 {
12779
12780 if (!LoadVariables(ctx, version))
12781 {
12783 return false;
12784 }
12785 }
12786
12787
12789 {
12791 return false;
12792 }
12793 if (version >= 132)
12794 {
12796 if (raib)
12797 {
12799 {
12801 return false;
12802 }
12803 }
12804 }
12805
12807 return true;
12808 }
12809
12810
12811
12813 {
12814 super.OnStoreSave(ctx);
12815
12816 PlayerBase player;
12817 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12818 {
12820
12821 int itemQBIndex = -1;
12822 itemQBIndex = player.FindQuickBarEntityIndex(this);
12823 ctx.
Write(itemQBIndex);
12824 }
12825 else
12826 {
12828 }
12829
12831
12833 if (raib)
12834 {
12836 }
12837 }
12838
12839
12841 {
12842 super.AfterStoreLoad();
12843
12845 {
12847 }
12848
12850 {
12853 }
12854 }
12855
12857 {
12858 super.EEOnAfterLoad();
12859
12861 {
12863 }
12864
12867 }
12868
12870 {
12871 return false;
12872 }
12873
12874
12875
12877 {
12879 {
12880 #ifdef PLATFORM_CONSOLE
12881
12883 {
12885 if (menu)
12886 {
12888 }
12889 }
12890 #endif
12891 }
12892
12894 {
12897 }
12898
12900 {
12901 SetWeightDirty();
12903 }
12905 {
12908 }
12909
12911 {
12914
12917 }
12919 {
12923 }
12924
12925 super.OnVariablesSynchronized();
12926 }
12927
12928
12929
12931 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12932 {
12933 if (!IsServerCheck(allow_client))
12934 return false;
12935
12937 return false;
12938
12941
12942 if (value <= (min + 0.001))
12943 value = min;
12944
12945 if (value == min)
12946 {
12947 if (destroy_config)
12948 {
12949 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12950 if (dstr)
12951 {
12953 this.Delete();
12954 return true;
12955 }
12956 }
12957 else if (destroy_forced)
12958 {
12960 this.Delete();
12961 return true;
12962 }
12963
12965 }
12966
12969
12971 {
12972 EntityAI parent = GetHierarchyRoot();
12973 InventoryLocation iLoc = new InventoryLocation();
12974 GetInventory().GetCurrentInventoryLocation(iLoc);
12976 {
12977 int iLocSlot = iLoc.
GetSlot();
12979 {
12981 }
12983 {
12985 }
12986 }
12987 }
12988
12990 {
12992
12993 if (delta)
12995 }
12996
12998
12999 return false;
13000 }
13001
13002
13004 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13005 {
13007 }
13008
13010 {
13013 }
13014
13016 {
13019 }
13020
13022 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13023 {
13024 float value_clamped = Math.Clamp(value, 0, 1);
13026 SetQuantity(result, destroy_config, destroy_forced);
13027 }
13028
13029
13032 {
13034 }
13035
13037 {
13039 }
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13051 {
13052 int slot = -1;
13053 GameInventory inventory = GetInventory();
13054 if (inventory)
13055 {
13056 InventoryLocation il = new InventoryLocation;
13059 }
13060
13062 }
13063
13065 {
13066 float quantity_max = 0;
13067
13069 {
13070 if (attSlotID != -1)
13071 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13072
13073 if (quantity_max <= 0)
13075 }
13076
13077 if (quantity_max <= 0)
13079
13080 return quantity_max;
13081 }
13082
13084 {
13086 }
13087
13089 {
13091 }
13092
13093
13095 {
13097 }
13098
13100 {
13102 }
13103
13105 {
13107 }
13108
13109
13111 {
13112
13113 float weightEx = GetWeightEx();
13114 float special = GetInventoryAndCargoWeight();
13115 return weightEx - special;
13116 }
13117
13118
13120 {
13122 }
13123
13125 {
13127 {
13128 #ifdef DEVELOPER
13129 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13130 {
13131 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13133 }
13134 #endif
13135
13136 return GetQuantity() * GetConfigWeightModified();
13137 }
13138 else if (HasEnergyManager())
13139 {
13140 #ifdef DEVELOPER
13141 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13142 {
13143 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13144 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13145 }
13146 #endif
13147 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13148 }
13149 else
13150 {
13151 #ifdef DEVELOPER
13152 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13153 {
13154 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13155 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13156 }
13157 #endif
13158 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13159 }
13160 }
13161
13164 {
13165 int item_count = 0;
13167
13168 GameInventory inventory = GetInventory();
13169 CargoBase cargo = inventory.
GetCargo();
13170 if (cargo != NULL)
13171 {
13173 }
13174
13176 for (int i = 0; i < nAttachments; ++i)
13177 {
13179 if (item)
13180 item_count += item.GetNumberOfItems();
13181 }
13182 return item_count;
13183 }
13184
13187 {
13188 float weight = 0;
13189 float wetness = 1;
13190 if (include_wetness)
13193 {
13194 weight = wetness * m_ConfigWeight;
13195 }
13197 {
13198 weight = 1;
13199 }
13200 return weight;
13201 }
13202
13203
13204
13206 {
13207 GameInventory inventory = GetInventory();
13208 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13209 {
13210 array<EntityAI> items = new array<EntityAI>;
13212 for (int i = 0; i < items.Count(); ++i)
13213 {
13215 if (item)
13216 {
13217 g_Game.ObjectDelete(item);
13218 }
13219 }
13220 }
13221 }
13222
13223
13224
13225
13227 {
13228 float energy = 0;
13229 if (HasEnergyManager())
13230 {
13231 energy = GetCompEM().GetEnergy();
13232 }
13233 return energy;
13234 }
13235
13236
13238 {
13239 super.OnEnergyConsumed();
13240
13242 }
13243
13245 {
13246 super.OnEnergyAdded();
13247
13249 }
13250
13251
13253 {
13254 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13255 {
13257 {
13258 float energy_0to1 = GetCompEM().GetEnergy0To1();
13260 }
13261 }
13262 }
13263
13264
13266 {
13267 return ConfigGetFloat("heatIsolation");
13268 }
13269
13271 {
13273 }
13274
13276 {
13277 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13278 if (
g_Game.ConfigIsExisting(paramPath))
13279 return g_Game.ConfigGetFloat(paramPath);
13280
13281 return 0.0;
13282 }
13283
13285 {
13286 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13287 if (
g_Game.ConfigIsExisting(paramPath))
13288 return g_Game.ConfigGetFloat(paramPath);
13289
13290 return 0.0;
13291 }
13292
13293 override void SetWet(
float value,
bool allow_client =
false)
13294 {
13295 if (!IsServerCheck(allow_client))
13296 return;
13297
13300
13302
13303 m_VarWet = Math.Clamp(value, min, max);
13304
13306 {
13309 }
13310 }
13311
13312 override void AddWet(
float value)
13313 {
13315 }
13316
13318 {
13320 }
13321
13323 {
13325 }
13326
13328 {
13330 }
13331
13333 {
13335 }
13336
13338 {
13340 }
13341
13342 override void OnWetChanged(
float newVal,
float oldVal)
13343 {
13346 if (newLevel != oldLevel)
13347 {
13349 }
13350 }
13351
13353 {
13354 SetWeightDirty();
13355 }
13356
13358 {
13359 return GetWetLevelInternal(
m_VarWet);
13360 }
13361
13362
13363
13365 {
13367 }
13368
13370 {
13372 }
13373
13375 {
13377 }
13378
13380 {
13382 }
13383
13384
13385
13387 {
13388 if (ConfigIsExisting("itemModelLength"))
13389 {
13390 return ConfigGetFloat("itemModelLength");
13391 }
13392 return 0;
13393 }
13394
13396 {
13397 if (ConfigIsExisting("itemAttachOffset"))
13398 {
13399 return ConfigGetFloat("itemAttachOffset");
13400 }
13401 return 0;
13402 }
13403
13404 override void SetCleanness(
int value,
bool allow_client =
false)
13405 {
13406 if (!IsServerCheck(allow_client))
13407 return;
13408
13410
13412
13415 }
13416
13418 {
13420 }
13421
13423 {
13424 return true;
13425 }
13426
13427
13428
13429
13431 {
13433 }
13434
13436 {
13438 }
13439
13440
13441
13442
13443 override void SetColor(
int r,
int g,
int b,
int a)
13444 {
13450 }
13452 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13453 {
13458 }
13459
13461 {
13463 }
13464
13467 {
13468 int r,g,b,a;
13470 r = r/255;
13471 g = g/255;
13472 b = b/255;
13473 a = a/255;
13474 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13475 }
13476
13477
13478
13479 override void SetLiquidType(
int value,
bool allow_client =
false)
13480 {
13481 if (!IsServerCheck(allow_client))
13482 return;
13483
13488 }
13489
13491 {
13492 return ConfigGetInt("varLiquidTypeInit");
13493 }
13494
13496 {
13498 }
13499
13501 {
13503 SetFrozen(false);
13504 }
13505
13508 {
13509 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13510 }
13511
13512
13515 {
13516 PlayerBase nplayer;
13517 if (PlayerBase.CastTo(nplayer, player))
13518 {
13520 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13521 }
13522 }
13523
13524
13527 {
13528 PlayerBase nplayer;
13529 if (PlayerBase.CastTo(nplayer,player))
13530 {
13531 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13532 }
13533
13534 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13535
13536 if (HasEnergyManager())
13537 {
13538 GetCompEM().UpdatePlugState();
13539 }
13540 }
13541
13542
13544 {
13545 super.OnPlacementStarted(player);
13546
13548 }
13549
13550 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13551 {
13553 {
13554 m_AdminLog.OnPlacementComplete(player,
this);
13555 }
13556
13557 super.OnPlacementComplete(player, position, orientation);
13558 }
13559
13560
13561
13562
13563
13565 {
13567 {
13568 return true;
13569 }
13570 else
13571 {
13572 return false;
13573 }
13574 }
13575
13576
13578 {
13580 {
13582 }
13583 }
13584
13585
13587 {
13589 }
13590
13592 {
13594 }
13595
13596 override void InsertAgent(
int agent,
float count = 1)
13597 {
13598 if (count < 1)
13599 return;
13600
13602 }
13603
13606 {
13608 }
13609
13610
13612 {
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
13649
13650
13651
13652
13653
13654
13655
13656
13658 {
13660 return false;
13661 return true;
13662 }
13663
13665 {
13666
13668 }
13669
13670
13673 {
13674 super.CheckForRoofLimited(timeTresholdMS);
13675
13676 float time =
g_Game.GetTime();
13677 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13678 {
13679 m_PreviousRoofTestTime = time;
13680 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13681 }
13682 }
13683
13684
13686 {
13688 {
13689 return 0;
13690 }
13691
13692 if (GetInventory().GetAttachmentSlotsCount() != 0)
13693 {
13694 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13695 if (filter)
13696 return filter.GetProtectionLevel(type, false, system);
13697 else
13698 return 0;
13699 }
13700
13701 string subclassPath, entryName;
13702
13703 switch (type)
13704 {
13706 entryName = "biological";
13707 break;
13709 entryName = "chemical";
13710 break;
13711 default:
13712 entryName = "biological";
13713 break;
13714 }
13715
13716 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13717
13718 return g_Game.ConfigGetFloat(subclassPath + entryName);
13719 }
13720
13721
13722
13725 {
13726 if (!IsMagazine())
13728
13730 }
13731
13732
13733
13734
13735
13740 {
13741 return true;
13742 }
13743
13745 {
13747 }
13748
13749
13750
13751
13752
13754 {
13755 if (parent)
13756 {
13757 if (parent.IsInherited(DayZInfected))
13758 return true;
13759
13760 if (!parent.IsRuined())
13761 return true;
13762 }
13763
13764 return true;
13765 }
13766
13768 {
13769 if (!super.CanPutAsAttachment(parent))
13770 {
13771 return false;
13772 }
13773
13774 if (!IsRuined() && !parent.IsRuined())
13775 {
13776 return true;
13777 }
13778
13779 return false;
13780 }
13781
13783 {
13784
13785
13786
13787
13788 return super.CanReceiveItemIntoCargo(item);
13789 }
13790
13792 {
13793
13794
13795
13796
13797 GameInventory attachmentInv = attachment.GetInventory();
13799 {
13800 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13801 return false;
13802 }
13803
13804 InventoryLocation loc = new InventoryLocation();
13805 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13806 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13807 return false;
13808
13809 return super.CanReceiveAttachment(attachment, slotId);
13810 }
13811
13813 {
13814 if (!super.CanReleaseAttachment(attachment))
13815 return false;
13816
13817 return GetInventory().AreChildrenAccessible();
13818 }
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13841 {
13842 int id = muzzle_owner.GetMuzzleID();
13843 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13844
13845 if (WPOF_array)
13846 {
13847 for (int i = 0; i < WPOF_array.Count(); i++)
13848 {
13849 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13850
13851 if (WPOF)
13852 {
13853 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13854 }
13855 }
13856 }
13857 }
13858
13859
13861 {
13862 int id = muzzle_owner.GetMuzzleID();
13864
13865 if (WPOBE_array)
13866 {
13867 for (int i = 0; i < WPOBE_array.Count(); i++)
13868 {
13869 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13870
13871 if (WPOBE)
13872 {
13873 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13874 }
13875 }
13876 }
13877 }
13878
13879
13881 {
13882 int id = muzzle_owner.GetMuzzleID();
13883 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13884
13885 if (WPOOH_array)
13886 {
13887 for (int i = 0; i < WPOOH_array.Count(); i++)
13888 {
13889 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13890
13891 if (WPOOH)
13892 {
13893 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13894 }
13895 }
13896 }
13897 }
13898
13899
13901 {
13902 int id = muzzle_owner.GetMuzzleID();
13903 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13904
13905 if (WPOOH_array)
13906 {
13907 for (int i = 0; i < WPOOH_array.Count(); i++)
13908 {
13909 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13910
13911 if (WPOOH)
13912 {
13913 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13914 }
13915 }
13916 }
13917 }
13918
13919
13921 {
13922 int id = muzzle_owner.GetMuzzleID();
13923 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13924
13925 if (WPOOH_array)
13926 {
13927 for (int i = 0; i < WPOOH_array.Count(); i++)
13928 {
13929 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13930
13931 if (WPOOH)
13932 {
13933 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13934 }
13935 }
13936 }
13937 }
13938
13939
13940
13942 {
13944 {
13945 return true;
13946 }
13947
13948 return false;
13949 }
13950
13952 {
13954 {
13955 return true;
13956 }
13957
13958 return false;
13959 }
13960
13962 {
13964 {
13965 return true;
13966 }
13967
13968 return false;
13969 }
13970
13972 {
13973 return false;
13974 }
13975
13978 {
13979 return UATimeSpent.DEFAULT_DEPLOY;
13980 }
13981
13982
13983
13984
13986 {
13988 SetSynchDirty();
13989 }
13990
13992 {
13994 }
13995
13996
13998 {
13999 return false;
14000 }
14001
14004 {
14005 string att_type = "None";
14006
14007 if (ConfigIsExisting("soundAttType"))
14008 {
14009 att_type = ConfigGetString("soundAttType");
14010 }
14011
14013 }
14014
14016 {
14018 }
14019
14020
14021
14022
14023
14029
14031 {
14034
14036 }
14037
14038
14040 {
14042 return;
14043
14045
14048
14051
14052 SoundParameters params = new SoundParameters();
14056 }
14057
14058
14060 {
14062 {
14065
14066 SetSynchDirty();
14067
14070 }
14071 }
14072
14074 {
14076 }
14077
14078
14080 {
14082 return;
14083
14085 SetSynchDirty();
14086
14089 }
14090
14092 {
14095 }
14096
14098 {
14100 }
14101
14102 void OnApply(PlayerBase player);
14103
14105 {
14106 return 1.0;
14107 };
14108
14110 {
14112 }
14113
14115 {
14117 }
14118
14120
14122 {
14123 SetDynamicPhysicsLifeTime(0.01);
14125 }
14126
14128 {
14129 array<string> zone_names = new array<string>;
14130 GetDamageZones(zone_names);
14131 for (int i = 0; i < zone_names.Count(); i++)
14132 {
14133 SetHealthMax(zone_names.Get(i),"Health");
14134 }
14135 SetHealthMax("","Health");
14136 }
14137
14140 {
14141 float global_health = GetHealth01("","Health");
14142 array<string> zones = new array<string>;
14143 GetDamageZones(zones);
14144
14145 for (int i = 0; i < zones.Count(); i++)
14146 {
14147 SetHealth01(zones.Get(i),"Health",global_health);
14148 }
14149 }
14150
14153 {
14154 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14155 }
14156
14158 {
14159 if (!hasRootAsPlayer)
14160 {
14161 if (refParentIB)
14162 {
14163
14164 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14165 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14166
14167 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14168 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14169
14172 }
14173 else
14174 {
14175
14178 }
14179 }
14180 }
14181
14183 {
14185 {
14186 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14187 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14188 {
14189 float heatPermCoef = 1.0;
14191 while (ent)
14192 {
14193 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14194 ent = ent.GetHierarchyParent();
14195 }
14196
14197 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14198 }
14199 }
14200 }
14201
14203 {
14204
14205 EntityAI parent = GetHierarchyParent();
14206 if (!parent)
14207 {
14208 hasParent = false;
14209 hasRootAsPlayer = false;
14210 }
14211 else
14212 {
14213 hasParent = true;
14214 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14215 refParentIB =
ItemBase.Cast(parent);
14216 }
14217 }
14218
14219 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14220 {
14221
14222 }
14223
14225 {
14226
14227 return false;
14228 }
14229
14231 {
14232
14233
14234 return false;
14235 }
14236
14238 {
14239
14240 return false;
14241 }
14242
14245 {
14246 return !GetIsFrozen() &&
IsOpen();
14247 }
14248
14250 {
14251 bool hasParent = false, hasRootAsPlayer = false;
14253
14254 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14255 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14256
14257 if (wwtu || foodDecay)
14258 {
14262
14263 if (processWetness || processTemperature || processDecay)
14264 {
14266
14267 if (processWetness)
14268 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14269
14270 if (processTemperature)
14272
14273 if (processDecay)
14274 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14275 }
14276 }
14277 }
14278
14281 {
14283 }
14284
14286 {
14289
14290 return super.GetTemperatureFreezeThreshold();
14291 }
14292
14294 {
14297
14298 return super.GetTemperatureThawThreshold();
14299 }
14300
14302 {
14305
14306 return super.GetItemOverheatThreshold();
14307 }
14308
14310 {
14312 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14313
14314 return super.GetTemperatureFreezeTime();
14315 }
14316
14318 {
14320 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14321
14322 return super.GetTemperatureThawTime();
14323 }
14324
14329
14331 {
14332 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14333 }
14334
14336 {
14337 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14338 }
14339
14342 {
14344 }
14345
14347 {
14349 }
14350
14352 {
14354 }
14355
14358 {
14359 return null;
14360 }
14361
14364 {
14365 return false;
14366 }
14367
14369 {
14371 {
14374 if (!trg)
14375 {
14377 explosive = this;
14378 }
14379
14380 explosive.PairRemote(trg);
14382
14383 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14384 trg.SetPersistentPairID(persistentID);
14385 explosive.SetPersistentPairID(persistentID);
14386
14387 return true;
14388 }
14389 return false;
14390 }
14391
14394 {
14395 float ret = 1.0;
14398 ret *= GetHealth01();
14399
14400 return ret;
14401 }
14402
14403 #ifdef DEVELOPER
14404 override void SetDebugItem()
14405 {
14406 super.SetDebugItem();
14407 _itemBase = this;
14408 }
14409
14411 {
14412 string text = super.GetDebugText();
14413
14415 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14416
14417 return text;
14418 }
14419 #endif
14420
14422 {
14423 return true;
14424 }
14425
14427
14429
14431 {
14434 }
14435
14436
14444
14460
14461 [
Obsolete(
"Use ItemSoundHandler instead")]
14464 {
14465 if (!
g_Game.IsDedicatedServer())
14466 {
14467 if (ConfigIsExisting("attachSoundSet"))
14468 {
14469 string cfg_path = "";
14470 string soundset = "";
14471 string type_name =
GetType();
14472
14475 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14476 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14477
14478 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14479 {
14480 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14481 {
14482 if (cfg_slot_array[i] == slot_type)
14483 {
14484 soundset = cfg_soundset_array[i];
14485 break;
14486 }
14487 }
14488 }
14489
14490 if (soundset != "")
14491 {
14492 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14494 }
14495 }
14496 }
14497 }
14498
14500}
14501
14503{
14505 if (entity)
14506 {
14507 bool is_item = entity.IsInherited(
ItemBase);
14508 if (is_item && full_quantity)
14509 {
14512 }
14513 }
14514 else
14515 {
14517 return NULL;
14518 }
14519 return entity;
14520}
14521
14523{
14524 if (item)
14525 {
14526 if (health > 0)
14527 item.SetHealth("", "", health);
14528
14529 if (item.CanHaveTemperature())
14530 {
14532 if (item.CanFreeze())
14533 item.SetFrozen(false);
14534 }
14535
14536 if (item.HasEnergyManager())
14537 {
14538 if (quantity >= 0)
14539 {
14540 item.GetCompEM().SetEnergy0To1(quantity);
14541 }
14542 else
14543 {
14545 }
14546 }
14547 else if (item.IsMagazine())
14548 {
14549 Magazine mag = Magazine.Cast(item);
14550 if (quantity >= 0)
14551 {
14552 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14553 }
14554 else
14555 {
14557 }
14558
14559 }
14560 else
14561 {
14562 if (quantity >= 0)
14563 {
14564 item.SetQuantityNormalized(quantity, false);
14565 }
14566 else
14567 {
14569 }
14570
14571 }
14572 }
14573}
14574
14575#ifdef DEVELOPER
14577#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.