If we need a different (handheld)item action widget displayed, the logic goes in here.
9600{
9602 {
9603 return true;
9604 }
9605};
9606
9607
9608
9610{
9614
9616
9619
9620
9621
9622
9623
9632
9638
9643
9648
9669 protected bool m_IsResultOfSplit
9670
9672
9677
9678
9679
9681
9685
9686
9687
9689
9692
9693
9694
9700
9701
9709
9712
9713
9715
9716
9718
9719
9724
9725
9730
9731
9733
9734
9736 {
9741
9742 if (!
GetGame().IsDedicatedServer())
9743 {
9745 {
9747
9749 {
9751 }
9752 }
9753
9756 }
9757
9758 m_OldLocation = null;
9759
9761 {
9763 }
9764
9765 if (ConfigIsExisting("headSelectionsToHide"))
9766 {
9769 }
9770
9772 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9773 {
9775 }
9776
9778
9779 m_IsResultOfSplit = false;
9780
9782 }
9783
9785 {
9786 super.InitItemVariables();
9787
9793 m_Count = ConfigGetInt(
"count");
9794
9797
9802
9805
9810
9822
9826
9827
9830 if (ConfigIsExisting("canBeSplit"))
9831 {
9834 }
9835
9837 if (ConfigIsExisting("itemBehaviour"))
9839
9840
9843 RegisterNetSyncVariableInt("m_VarLiquidType");
9844 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9845
9846 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9847 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9848 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9849
9850 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9851 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9852 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9853 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9854
9855 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9856 RegisterNetSyncVariableBool("m_IsTakeable");
9857 RegisterNetSyncVariableBool("m_IsHologram");
9858
9861 {
9864 }
9865
9867
9869 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9871
9872 }
9873
9875 {
9877 }
9878
9880 {
9883 {
9888 }
9889 }
9890
9891 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9892 {
9894 {
9897 }
9898
9900 }
9901
9903 {
9909 }
9910
9912
9914 {
9916
9917 if (!action)
9918 {
9919 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9920 return;
9921 }
9922
9924 if (!ai)
9925 {
9927 return;
9928 }
9929
9931 if (!action_array)
9932 {
9933 action_array = new array<ActionBase_Basic>;
9935 }
9936 if (LogManager.IsActionLogEnable())
9937 {
9938 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9939 }
9940
9941 if (action_array.Find(action) != -1)
9942 {
9943 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9944 }
9945 else
9946 {
9947 action_array.Insert(action);
9948 }
9949 }
9950
9952 {
9954 ActionBase action = player.GetActionManager().GetAction(actionName);
9957
9958 if (action_array)
9959 {
9960 action_array.RemoveItem(action);
9961 }
9962 }
9963
9964
9965
9967 {
9968 ActionOverrideData overrideData = new ActionOverrideData();
9972
9974 if (!actionMap)
9975 {
9978 }
9979
9980 actionMap.Insert(this.
Type(), overrideData);
9981
9982 }
9983
9985
9987
9988
9990 {
9993
9996
9997 string config_to_search = "CfgVehicles";
9998 string muzzle_owner_config;
9999
10001 {
10002 if (IsInherited(Weapon))
10003 config_to_search = "CfgWeapons";
10004
10005 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10006
10007 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10008
10010
10011 if (config_OnFire_subclass_count > 0)
10012 {
10013 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10014
10015 for (int i = 0; i < config_OnFire_subclass_count; i++)
10016 {
10017 string particle_class = "";
10019 string config_OnFire_entry = config_OnFire_class + particle_class;
10020 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10021 WPOF_array.Insert(WPOF);
10022 }
10023
10024
10026 }
10027 }
10028
10030 {
10031 config_to_search = "CfgWeapons";
10032 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10033
10034 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10035
10037
10038 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10039 {
10040 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10041
10042 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10043 {
10044 string particle_class2 = "";
10046 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10047 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10048 WPOBE_array.Insert(WPOBE);
10049 }
10050
10051
10053 }
10054 }
10055 }
10056
10057
10059 {
10062
10064 {
10065 string config_to_search = "CfgVehicles";
10066
10067 if (IsInherited(Weapon))
10068 config_to_search = "CfgWeapons";
10069
10070 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10071 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10072
10073 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
10074 {
10075
10077
10079 {
10081 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10083 return;
10084 }
10085
10088
10089
10090
10092 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10093
10094 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10095 {
10096 string particle_class = "";
10098 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10100
10101 if (entry_type == CT_CLASS)
10102 {
10103 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10104 WPOOH_array.Insert(WPOF);
10105 }
10106 }
10107
10108
10110 }
10111 }
10112 }
10113
10115 {
10117 }
10118
10120 {
10122 {
10124
10127
10130
10131 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10132 }
10133 }
10134
10136 {
10138 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10139
10141 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10142
10144 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10145
10147 {
10149 }
10150 }
10151
10153 {
10155 }
10156
10158 {
10161 else
10163
10165 {
10168 }
10169 else
10170 {
10173
10176 }
10177
10179 }
10180
10182 {
10184 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10185 }
10186
10188 {
10190 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10192 }
10193
10195 {
10197 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10198 }
10199
10201 {
10204
10205 OverheatingParticle OP = new OverheatingParticle();
10210
10212 }
10213
10215 {
10218
10219 return -1;
10220 }
10221
10223 {
10225 {
10228
10229 for (int i = count; i > 0; --i)
10230 {
10231 int id = i - 1;
10234
10237
10238 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10239 {
10240 if (p)
10241 {
10244 }
10245 }
10246 }
10247 }
10248 }
10249
10251 {
10253 {
10255 {
10256 int id = i - 1;
10258
10259 if (OP)
10260 {
10262
10263 if (p)
10264 {
10266 }
10267
10268 delete OP;
10269 }
10270 }
10271
10274 }
10275 }
10276
10279 {
10280 return 0.0;
10281 }
10282
10283
10285 {
10286 return 250;
10287 }
10288
10290 {
10291 return 0;
10292 }
10293
10296 {
10298 return true;
10299
10300 return false;
10301 }
10302
10305 {
10308
10310 {
10312 }
10313 else
10314 {
10315
10317 }
10318
10320 }
10321
10328 {
10329 return -1;
10330 }
10331
10332
10333
10334
10336 {
10338 {
10340 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10341
10342 if (r_index >= 0)
10343 {
10344 InventoryLocation r_il = new InventoryLocation;
10345 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10346
10347 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10350 {
10351 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10352 }
10354 {
10355 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10356 }
10357
10358 }
10359
10360 player.GetHumanInventory().ClearUserReservedLocation(this);
10361 }
10362
10365 }
10366
10367
10368
10369
10371 {
10372 return ItemBase.m_DebugActionsMask;
10373 }
10374
10376 {
10377 return ItemBase.m_DebugActionsMask & mask;
10378 }
10379
10381 {
10382 ItemBase.m_DebugActionsMask = mask;
10383 }
10384
10386 {
10387 ItemBase.m_DebugActionsMask |= mask;
10388 }
10389
10391 {
10392 ItemBase.m_DebugActionsMask &= ~mask;
10393 }
10394
10396 {
10398 {
10400 }
10401 else
10402 {
10404 }
10405 }
10406
10407
10409 {
10410 if (GetEconomyProfile())
10411 {
10412 float q_max = GetEconomyProfile().GetQuantityMax();
10413 if (q_max > 0)
10414 {
10415 float q_min = GetEconomyProfile().GetQuantityMin();
10416 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10417
10419 {
10420 ComponentEnergyManager comp = GetCompEM();
10422 {
10424 }
10425 }
10427 {
10429
10430 }
10431
10432 }
10433 }
10434 }
10435
10438 {
10439 EntityAI parent = GetHierarchyParent();
10440
10441 if (parent)
10442 {
10443 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10444 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10445 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10446 }
10447 }
10448
10451 {
10452 EntityAI parent = GetHierarchyParent();
10453
10454 if (parent)
10455 {
10456 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10457 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10458 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10459 }
10460 }
10461
10463 {
10464
10465
10466
10467
10469
10471 {
10472 if (ScriptInputUserData.CanStoreInputUserData())
10473 {
10474 ScriptInputUserData ctx = new ScriptInputUserData;
10480 ctx.
Write(use_stack_max);
10483
10485 {
10486 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10487 }
10488 }
10489 }
10490 else if (!
GetGame().IsMultiplayer())
10491 {
10493 }
10494 }
10495
10497 {
10499 }
10500
10502 {
10504 }
10505
10507 {
10509 }
10510
10512 {
10513
10514 return false;
10515 }
10516
10518 {
10519 return false;
10520 }
10521
10525 {
10526 return false;
10527 }
10528
10530 {
10531 return "";
10532 }
10533
10535
10537 {
10538 return false;
10539 }
10540
10542 {
10543 return true;
10544 }
10545
10546
10547
10549 {
10550 return true;
10551 }
10552
10554 {
10555 return true;
10556 }
10557
10559 {
10560 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10562 }
10563
10565 {
10567 }
10568
10570 {
10572 if (!is_being_placed)
10574 SetSynchDirty();
10575 }
10576
10577
10579
10581 {
10583 }
10584
10586 {
10588 }
10589
10591 {
10592 return 1;
10593 }
10594
10596 {
10597 return false;
10598 }
10599
10601 {
10603 SetSynchDirty();
10604 }
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10641 {
10642 super.OnMovedInsideCargo(container);
10643
10644 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10645 }
10646
10647 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10648 {
10649 super.EEItemLocationChanged(oldLoc,newLoc);
10650
10651 PlayerBase new_player = null;
10652 PlayerBase old_player = null;
10653
10654 if (newLoc.GetParent())
10655 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10656
10657 if (oldLoc.GetParent())
10658 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10659
10661 {
10662 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10663
10664 if (r_index >= 0)
10665 {
10666 InventoryLocation r_il = new InventoryLocation;
10667 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10668
10669 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10672 {
10673 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10674 }
10676 {
10677 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10678 }
10679
10680 }
10681 }
10682
10684 {
10685 if (new_player)
10686 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10687
10688 if (new_player == old_player)
10689 {
10690
10691 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10692 {
10694 {
10695 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10696 {
10697 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10698 }
10699 }
10700 else
10701 {
10702 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10703 }
10704 }
10705
10706 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10707 {
10708 int type = oldLoc.GetType();
10710 {
10711 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10712 }
10714 {
10715 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10716 }
10717 }
10718 if (!m_OldLocation)
10719 {
10720 m_OldLocation = new InventoryLocation;
10721 }
10722 m_OldLocation.Copy(oldLoc);
10723 }
10724 else
10725 {
10726 if (m_OldLocation)
10727 {
10728 m_OldLocation.Reset();
10729 }
10730 }
10731
10733 }
10734 else
10735 {
10736 if (new_player)
10737 {
10738 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10739 if (res_index >= 0)
10740 {
10741 InventoryLocation il = new InventoryLocation;
10742 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10744 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10747 {
10748 il.
GetParent().GetOnReleaseLock().Invoke(it);
10749 }
10751 {
10753 }
10754
10755 }
10756 }
10758 {
10759
10761 }
10762
10763 if (m_OldLocation)
10764 {
10765 m_OldLocation.Reset();
10766 }
10767 }
10768 }
10769
10770 override void EOnContact(IEntity other, Contact extra)
10771 {
10773 {
10774 int liquidType = -1;
10776 if (impactSpeed > 0.0)
10777 {
10779 #ifndef SERVER
10781 #else
10783 SetSynchDirty();
10784 #endif
10786 }
10787 }
10788
10789 #ifdef SERVER
10790 if (GetCompEM() && GetCompEM().IsPlugged())
10791 {
10792 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10793 GetCompEM().UnplugThis();
10794 }
10795 #endif
10796 }
10797
10799
10801 {
10803 }
10804
10806 {
10807
10808 }
10809
10811 {
10812 super.OnItemLocationChanged(old_owner, new_owner);
10813
10814 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10815 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10816
10817 if (!relatedPlayer && playerNew)
10818 relatedPlayer = playerNew;
10819
10820 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10821 {
10823 if (actionMgr)
10824 {
10825 ActionBase currentAction = actionMgr.GetRunningAction();
10826 if (currentAction)
10828 }
10829 }
10830
10831 Man ownerPlayerOld = null;
10832 Man ownerPlayerNew = null;
10833
10834 if (old_owner)
10835 {
10836 if (old_owner.
IsMan())
10837 {
10838 ownerPlayerOld = Man.Cast(old_owner);
10839 }
10840 else
10841 {
10842 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10843 }
10844 }
10845 else
10846 {
10848 {
10850
10851 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10852 {
10853 GetCompEM().UnplugThis();
10854 }
10855 }
10856 }
10857
10858 if (new_owner)
10859 {
10860 if (new_owner.
IsMan())
10861 {
10862 ownerPlayerNew = Man.Cast(new_owner);
10863 }
10864 else
10865 {
10866 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10867 }
10868 }
10869
10870 if (ownerPlayerOld != ownerPlayerNew)
10871 {
10872 if (ownerPlayerOld)
10873 {
10874 array<EntityAI> subItemsExit = new array<EntityAI>;
10876 for (int i = 0; i < subItemsExit.Count(); i++)
10877 {
10880 }
10881 }
10882
10883 if (ownerPlayerNew)
10884 {
10885 array<EntityAI> subItemsEnter = new array<EntityAI>;
10887 for (int j = 0; j < subItemsEnter.Count(); j++)
10888 {
10891 }
10892 }
10893 }
10894 else if (ownerPlayerNew != null)
10895 {
10896 PlayerBase nplayer;
10897 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10898 {
10899 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10901 for (int k = 0; k < subItemsUpdate.Count(); k++)
10902 {
10904 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10905 }
10906 }
10907 }
10908
10909 if (old_owner)
10910 old_owner.OnChildItemRemoved(this);
10911 if (new_owner)
10912 new_owner.OnChildItemReceived(this);
10913 }
10914
10915
10917 {
10918 super.EEDelete(parent);
10919 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10920 if (player)
10921 {
10923
10924 if (player.IsAlive())
10925 {
10926 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10927 if (r_index >= 0)
10928 {
10929 InventoryLocation r_il = new InventoryLocation;
10930 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10931
10932 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10935 {
10936 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10937 }
10939 {
10940 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10941 }
10942
10943 }
10944
10945 player.RemoveQuickBarEntityShortcut(this);
10946 }
10947 }
10948 }
10949
10951 {
10952 super.EEKilled(killer);
10953
10956 {
10957 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10958 {
10959 if (IsMagazine())
10960 {
10961 if (Magazine.Cast(this).GetAmmoCount() > 0)
10962 {
10964 }
10965 }
10966 else
10967 {
10969 }
10970 }
10971 }
10972 }
10973
10975 {
10976 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10977
10978 super.OnWasAttached(parent, slot_id);
10979
10982
10984 }
10985
10987 {
10988 super.OnWasDetached(parent, slot_id);
10989
10992 }
10993
10995 {
10996 int idx;
10999
11000 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11001 if (inventory_slots.Count() < 1)
11002 {
11003 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11004 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11005 }
11006 else
11007 {
11008 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11009 }
11010
11011 idx = inventory_slots.Find(slot);
11012 if (idx < 0)
11013 return "";
11014
11015 return attach_types.Get(idx);
11016 }
11017
11019 {
11020 int idx = -1;
11021 string slot;
11022
11025
11026 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11027 if (inventory_slots.Count() < 1)
11028 {
11029 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11030 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11031 }
11032 else
11033 {
11034 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11035 if (detach_types.Count() < 1)
11036 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11037 }
11038
11039 for (int i = 0; i < inventory_slots.Count(); i++)
11040 {
11041 slot = inventory_slots.Get(i);
11042 }
11043
11044 if (slot != "")
11045 {
11046 if (detach_types.Count() == 1)
11047 idx = 0;
11048 else
11049 idx = inventory_slots.Find(slot);
11050 }
11051 if (idx < 0)
11052 return "";
11053
11054 return detach_types.Get(idx);
11055 }
11056
11058 {
11059
11061
11062
11063 float min_time = 1;
11064 float max_time = 3;
11065 float delay = Math.RandomFloat(min_time, max_time);
11066
11067 explode_timer.Run(delay, this, "DoAmmoExplosion");
11068 }
11069
11071 {
11072 Magazine magazine = Magazine.Cast(this);
11073 int pop_sounds_count = 6;
11074 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11075
11076
11077 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11078 string sound_name = pop_sounds[ sound_idx ];
11080
11081
11082 magazine.ServerAddAmmoCount(-1);
11083
11084
11085 float min_temp_to_explode = 100;
11086
11087 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11088 {
11090 }
11091 }
11092
11093
11094 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11095 {
11096 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11097
11098 const int CHANCE_DAMAGE_CARGO = 4;
11099 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11100 const int CHANCE_DAMAGE_NOTHING = 2;
11101
11103 {
11104 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11105 int chances;
11106 int rnd;
11107
11108 if (GetInventory().GetCargo())
11109 {
11110 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11111 rnd = Math.RandomInt(0,chances);
11112
11113 if (rnd < CHANCE_DAMAGE_CARGO)
11114 {
11116 }
11117 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11118 {
11120 }
11121 }
11122 else
11123 {
11124 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11125 rnd = Math.RandomInt(0,chances);
11126
11127 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11128 {
11130 }
11131 }
11132 }
11133 }
11134
11136 {
11137 if (GetInventory().GetCargo())
11138 {
11139 int item_count = GetInventory().GetCargo().GetItemCount();
11140 if (item_count > 0)
11141 {
11142 int random_pick = Math.RandomInt(0, item_count);
11144 if (!item.IsExplosive())
11145 {
11146 item.AddHealth("","",damage);
11147 return true;
11148 }
11149 }
11150 }
11151 return false;
11152 }
11153
11155 {
11156 int attachment_count = GetInventory().AttachmentCount();
11157 if (attachment_count > 0)
11158 {
11159 int random_pick = Math.RandomInt(0, attachment_count);
11160 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
11161 if (!attachment.IsExplosive())
11162 {
11163 attachment.AddHealth("","",damage);
11164 return true;
11165 }
11166 }
11167 return false;
11168 }
11169
11171 {
11173 }
11174
11176 {
11178 return GetInventory().CanRemoveEntity();
11179
11180 return false;
11181 }
11182
11184 {
11185
11187 return false;
11188
11189
11191 return false;
11192
11193
11194
11196 if (delta == 0)
11197 return false;
11198
11199
11200 return true;
11201 }
11202
11204 {
11206 {
11207 if (ScriptInputUserData.CanStoreInputUserData())
11208 {
11209 ScriptInputUserData ctx = new ScriptInputUserData;
11214 ctx.
Write(destination_entity);
11216 ctx.
Write(slot_id);
11218 }
11219 }
11220 else if (!
GetGame().IsMultiplayer())
11221 {
11223 }
11224 }
11225
11227 {
11228 float split_quantity_new;
11232 InventoryLocation loc = new InventoryLocation;
11233
11234 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11235 {
11237 split_quantity_new = stack_max;
11238 else
11240
11242 {
11243 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11244 if (new_item)
11245 {
11246 new_item.SetResultOfSplit(true);
11247 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11249 new_item.
SetQuantity(split_quantity_new,
false,
true);
11250 }
11251 }
11252 }
11253 else if (destination_entity && slot_id == -1)
11254 {
11255 if (quantity > stack_max)
11256 split_quantity_new = stack_max;
11257 else
11258 split_quantity_new = quantity;
11259
11261 {
11263 {
11266 }
11267
11268 if (new_item)
11269 {
11270 new_item.SetResultOfSplit(true);
11271 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11273 new_item.
SetQuantity(split_quantity_new,
false,
true);
11274 }
11275 }
11276 }
11277 else
11278 {
11279 if (stack_max != 0)
11280 {
11282 {
11284 }
11285
11286 if (split_quantity_new == 0)
11287 {
11288 if (!
GetGame().IsMultiplayer())
11289 player.PhysicalPredictiveDropItem(this);
11290 else
11291 player.ServerDropEntity(this);
11292 return;
11293 }
11294
11296 {
11298
11299 if (new_item)
11300 {
11301 new_item.SetResultOfSplit(true);
11302 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11305 new_item.PlaceOnSurface();
11306 }
11307 }
11308 }
11309 }
11310 }
11311
11313 {
11314 float split_quantity_new;
11318 InventoryLocation loc = new InventoryLocation;
11319
11320 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11321 {
11323 split_quantity_new = stack_max;
11324 else
11326
11328 {
11329 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11330 if (new_item)
11331 {
11332 new_item.SetResultOfSplit(true);
11333 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11335 new_item.
SetQuantity(split_quantity_new,
false,
true);
11336 }
11337 }
11338 }
11339 else if (destination_entity && slot_id == -1)
11340 {
11341 if (quantity > stack_max)
11342 split_quantity_new = stack_max;
11343 else
11344 split_quantity_new = quantity;
11345
11347 {
11349 {
11352 }
11353
11354 if (new_item)
11355 {
11356 new_item.SetResultOfSplit(true);
11357 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11359 new_item.
SetQuantity(split_quantity_new,
false,
true);
11360 }
11361 }
11362 }
11363 else
11364 {
11365 if (stack_max != 0)
11366 {
11368 {
11370 }
11371
11373 {
11375
11376 if (new_item)
11377 {
11378 new_item.SetResultOfSplit(true);
11379 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11382 new_item.PlaceOnSurface();
11383 }
11384 }
11385 }
11386 }
11387 }
11388
11390 {
11392 {
11393 if (ScriptInputUserData.CanStoreInputUserData())
11394 {
11395 ScriptInputUserData ctx = new ScriptInputUserData;
11400 dst.WriteToContext(ctx);
11402 }
11403 }
11404 else if (!
GetGame().IsMultiplayer())
11405 {
11407 }
11408 }
11409
11411 {
11413 {
11414 if (ScriptInputUserData.CanStoreInputUserData())
11415 {
11416 ScriptInputUserData ctx = new ScriptInputUserData;
11421 ctx.
Write(destination_entity);
11427 }
11428 }
11429 else if (!
GetGame().IsMultiplayer())
11430 {
11432 }
11433 }
11434
11436 {
11438 }
11439
11441 {
11443 float split_quantity_new;
11445 if (dst.IsValid())
11446 {
11447 int slot_id = dst.GetSlot();
11449
11450 if (quantity > stack_max)
11451 split_quantity_new = stack_max;
11452 else
11453 split_quantity_new = quantity;
11454
11456 {
11458
11459 if (new_item)
11460 {
11461 new_item.SetResultOfSplit(true);
11462 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11464 new_item.
SetQuantity(split_quantity_new,
false,
true);
11465 }
11466
11467 return new_item;
11468 }
11469 }
11470
11471 return null;
11472 }
11473
11475 {
11477 float split_quantity_new;
11479 if (destination_entity)
11480 {
11482 if (quantity > stackable)
11483 split_quantity_new = stackable;
11484 else
11485 split_quantity_new = quantity;
11486
11488 {
11489 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11490 if (new_item)
11491 {
11492 new_item.SetResultOfSplit(true);
11493 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11495 new_item.
SetQuantity(split_quantity_new,
false,
true);
11496 }
11497 }
11498 }
11499 }
11500
11502 {
11504 {
11505 if (ScriptInputUserData.CanStoreInputUserData())
11506 {
11507 ScriptInputUserData ctx = new ScriptInputUserData;
11512 ItemBase destination_entity =
this;
11513 ctx.
Write(destination_entity);
11517 }
11518 }
11519 else if (!
GetGame().IsMultiplayer())
11520 {
11522 }
11523 }
11524
11526 {
11528 float split_quantity_new;
11530 if (player)
11531 {
11533 if (quantity > stackable)
11534 split_quantity_new = stackable;
11535 else
11536 split_quantity_new = quantity;
11537
11539 {
11540 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11541 new_item =
ItemBase.Cast(in_hands);
11542 if (new_item)
11543 {
11544 new_item.SetResultOfSplit(true);
11545 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11547 new_item.SetQuantity(split_quantity_new, false, true);
11548 }
11549 }
11550 }
11551 }
11552
11554 {
11556 float split_quantity_new = Math.Floor(quantity * 0.5);
11557
11559 return;
11560
11562
11563 if (new_item)
11564 {
11565 if (new_item.GetQuantityMax() < split_quantity_new)
11566 {
11567 split_quantity_new = new_item.GetQuantityMax();
11568 }
11569
11570 new_item.SetResultOfSplit(true);
11571 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11572
11574 {
11577 }
11578 else
11579 {
11581 new_item.
SetQuantity(split_quantity_new,
false,
true);
11582 }
11583 }
11584 }
11585
11587 {
11589 float split_quantity_new = Math.Floor(quantity / 2);
11590
11592 return;
11593
11594 InventoryLocation invloc = new InventoryLocation;
11596
11598 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11599
11600 if (new_item)
11601 {
11602 if (new_item.GetQuantityMax() < split_quantity_new)
11603 {
11604 split_quantity_new = new_item.GetQuantityMax();
11605 }
11607 {
11610 }
11611 else if (split_quantity_new > 1)
11612 {
11614 new_item.
SetQuantity(split_quantity_new,
false,
true);
11615 }
11616 }
11617 }
11618
11621 {
11622 SetWeightDirty();
11624
11625 if (parent)
11626 parent.OnAttachmentQuantityChangedEx(this, delta);
11627
11629 {
11631 {
11633 }
11635 {
11636 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11638 }
11639 }
11640
11641 }
11642
11645 {
11646
11647 }
11648
11651 {
11653 }
11654
11656 {
11657 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11658
11660 {
11661 if (newLevel == GameConstants.STATE_RUINED)
11662 {
11664 EntityAI parent = GetHierarchyParent();
11665 if (parent && parent.IsFireplace())
11666 {
11667 CargoBase cargo = GetInventory().GetCargo();
11668 if (cargo)
11669 {
11671 {
11673 }
11674 }
11675 }
11676 }
11677
11679 {
11680
11682 return;
11683 }
11684
11685 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11686 {
11688 }
11689 }
11690 }
11691
11692
11694 {
11695 super.OnRightClick();
11696
11698 {
11700 {
11701 if (ScriptInputUserData.CanStoreInputUserData())
11702 {
11703 EntityAI root = GetHierarchyRoot();
11704 Man playerOwner = GetHierarchyRootPlayer();
11705 InventoryLocation dst = new InventoryLocation;
11706
11707
11708 if (!playerOwner && root && root == this)
11709 {
11711 }
11712 else
11713 {
11714
11715 GetInventory().GetCurrentInventoryLocation(dst);
11717 {
11720 {
11722 }
11723 else
11724 {
11726
11727
11728 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11729 {
11731 }
11732 else
11733 {
11734 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11735 }
11736 }
11737 }
11738 }
11739
11740 ScriptInputUserData ctx = new ScriptInputUserData;
11748 }
11749 }
11750 else if (!
GetGame().IsMultiplayer())
11751 {
11753 }
11754 }
11755 }
11756
11758 {
11759 if (root)
11760 {
11761 vector m4[4];
11762 root.GetTransform(m4);
11763 dst.SetGround(this, m4);
11764 }
11765 else
11766 {
11767 GetInventory().GetCurrentInventoryLocation(dst);
11768 }
11769 }
11770
11771 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11772 {
11773
11774 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11775 return false;
11776
11777 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11778 return false;
11779
11780
11782 return false;
11783
11784
11785 Magazine mag = Magazine.Cast(this);
11786 if (mag)
11787 {
11788 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11789 return false;
11790
11791 if (stack_max_limit)
11792 {
11793 Magazine other_mag = Magazine.Cast(other_item);
11794 if (other_item)
11795 {
11796 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11797 return false;
11798 }
11799
11800 }
11801 }
11802 else
11803 {
11804
11806 return false;
11807
11809 return false;
11810 }
11811
11812 PlayerBase player = null;
11813 if (CastTo(player, GetHierarchyRootPlayer()))
11814 {
11815 if (player.GetInventory().HasAttachment(this))
11816 return false;
11817
11818 if (player.IsItemsToDelete())
11819 return false;
11820 }
11821
11822 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11823 return false;
11824
11825 int slotID;
11827 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11828 return false;
11829
11830 return true;
11831 }
11832
11834 {
11836 }
11837
11839 {
11840 return m_IsResultOfSplit;
11841 }
11842
11844 {
11845 m_IsResultOfSplit = value;
11846 }
11847
11849 {
11851 }
11852
11854 {
11855 float other_item_quantity = other_item.GetQuantity();
11856 float this_free_space;
11857
11859
11861
11862 if (other_item_quantity > this_free_space)
11863 {
11864 return this_free_space;
11865 }
11866 else
11867 {
11868 return other_item_quantity;
11869 }
11870 }
11871
11873 {
11875 }
11876
11878 {
11880 return;
11881
11882 if (!IsMagazine() && other_item)
11883 {
11885 if (quantity_used != 0)
11886 {
11887 float hp1 = GetHealth01("","");
11888 float hp2 = other_item.GetHealth01("","");
11889 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11890 hpResult = hpResult / (
GetQuantity() + quantity_used);
11891
11892 hpResult *= GetMaxHealth();
11893 Math.Round(hpResult);
11894 SetHealth("", "Health", hpResult);
11895
11897 other_item.AddQuantity(-quantity_used);
11898 }
11899 }
11901 }
11902
11904 {
11905 #ifdef SERVER
11906 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11907 GetHierarchyParent().IncreaseLifetimeUp();
11908 #endif
11909 };
11910
11912 {
11913 PlayerBase p = PlayerBase.Cast(player);
11914
11915 array<int> recipesIds = p.m_Recipes;
11916 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11917 if (moduleRecipesManager)
11918 {
11919 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11920 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11921 }
11922
11923 for (int i = 0;i < recipesIds.Count(); i++)
11924 {
11925 int key = recipesIds.Get(i);
11926 string recipeName = moduleRecipesManager.GetRecipeName(key);
11928 }
11929 }
11930
11931
11932 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11933 {
11934 super.GetDebugActions(outputList);
11935
11936
11942
11943
11948
11953
11954
11958
11959
11961 {
11965 }
11966
11969
11970
11974
11976
11977 InventoryLocation loc = new InventoryLocation();
11978 GetInventory().GetCurrentInventoryLocation(loc);
11980 {
11981 if (Gizmo_IsSupported())
11984 }
11985
11987 }
11988
11989
11990
11991
11993 {
11994 super.OnAction(action_id, player, ctx);
11995
11997 {
11998 switch (action_id)
11999 {
12002 return true;
12005 return true;
12006 }
12007 }
12008
12010 {
12011 switch (action_id)
12012 {
12014 Delete();
12015 return true;
12016 }
12017 }
12018
12019 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12020 {
12021 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12022 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12023 PlayerBase p = PlayerBase.Cast(player);
12024 if (
EActions.RECIPES_RANGE_START < 1000)
12025 {
12026 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12027 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12028 }
12029 }
12030 #ifndef SERVER
12031 else if (action_id ==
EActions.WATCH_PLAYER)
12032 {
12033 PluginDeveloper.SetDeveloperItemClientEx(player);
12034 }
12035 #endif
12037 {
12038 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12039 {
12040 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12041 OnDebugButtonPressServer(id + 1);
12042 }
12043
12044 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12045 {
12046 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12048 }
12049
12050 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12051 {
12052 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12054 }
12055
12056 else if (action_id ==
EActions.ADD_QUANTITY)
12057 {
12058 if (IsMagazine())
12059 {
12060 Magazine mag = Magazine.Cast(this);
12061 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12062 }
12063 else
12064 {
12066 }
12067
12068 if (m_EM)
12069 {
12070 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12071 }
12072
12073 }
12074
12075 else if (action_id ==
EActions.REMOVE_QUANTITY)
12076 {
12077 if (IsMagazine())
12078 {
12079 Magazine mag2 = Magazine.Cast(this);
12080 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12081 }
12082 else
12083 {
12085 }
12086 if (m_EM)
12087 {
12088 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12089 }
12090
12091 }
12092
12093 else if (action_id ==
EActions.SET_QUANTITY_0)
12094 {
12096
12097 if (m_EM)
12098 {
12099 m_EM.SetEnergy(0);
12100 }
12101 }
12102
12103 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12104 {
12106
12107 if (m_EM)
12108 {
12109 m_EM.SetEnergy(m_EM.GetEnergyMax());
12110 }
12111 }
12112
12113 else if (action_id ==
EActions.ADD_HEALTH)
12114 {
12115 AddHealth("","",GetMaxHealth("","Health")/5);
12116 }
12117 else if (action_id ==
EActions.REMOVE_HEALTH)
12118 {
12119 AddHealth("","",-GetMaxHealth("","Health")/5);
12120 }
12121 else if (action_id ==
EActions.DESTROY_HEALTH)
12122 {
12123 SetHealth01("","",0);
12124 }
12125 else if (action_id ==
EActions.WATCH_ITEM)
12126 {
12128 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12129 #ifdef DEVELOPER
12130 SetDebugDeveloper_item(this);
12131 #endif
12132 }
12133
12134 else if (action_id ==
EActions.ADD_TEMPERATURE)
12135 {
12136 AddTemperature(20);
12137
12138 }
12139
12140 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12141 {
12142 AddTemperature(-20);
12143
12144 }
12145
12146 else if (action_id ==
EActions.FLIP_FROZEN)
12147 {
12148 SetFrozen(!GetIsFrozen());
12149
12150 }
12151
12152 else if (action_id ==
EActions.ADD_WETNESS)
12153 {
12155
12156 }
12157
12158 else if (action_id ==
EActions.REMOVE_WETNESS)
12159 {
12161
12162 }
12163
12164 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12165 {
12168
12169
12170 }
12171
12172 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12173 {
12176 }
12177
12178 else if (action_id ==
EActions.MAKE_SPECIAL)
12179 {
12180 auto debugParams = DebugSpawnParams.WithPlayer(player);
12181 OnDebugSpawnEx(debugParams);
12182 }
12183
12184 }
12185
12186
12187 return false;
12188 }
12189
12190
12191
12192
12196
12199
12200
12201
12203 {
12204 return false;
12205 }
12206
12207
12209 {
12210 return true;
12211 }
12212
12213
12215 {
12216 return true;
12217 }
12218
12219
12220
12222 {
12223 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12225 }
12226
12229 {
12230 return null;
12231 }
12232
12234 {
12235 return false;
12236 }
12237
12239 {
12240 return false;
12241 }
12242
12246
12247
12249 {
12250 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12251 return module_repairing.CanRepair(this, item_repair_kit);
12252 }
12253
12254
12255 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12256 {
12257 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12258 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12259 }
12260
12261
12263 {
12264
12265
12266
12267
12268
12269
12270
12271
12272 return 1;
12273 }
12274
12275
12276
12278 {
12280 }
12281
12282
12283
12285 {
12287 }
12288
12289
12298 {
12299 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12300
12301 if (player)
12302 {
12303 player.MessageStatus(text);
12304 }
12305 }
12306
12307
12316 {
12317 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12318
12319 if (player)
12320 {
12321 player.MessageAction(text);
12322 }
12323 }
12324
12325
12334 {
12335 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12336
12337 if (player)
12338 {
12339 player.MessageFriendly(text);
12340 }
12341 }
12342
12343
12352 {
12353 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12354
12355 if (player)
12356 {
12357 player.MessageImportant(text);
12358 }
12359 }
12360
12362 {
12363 return true;
12364 }
12365
12366
12367 override bool KindOf(
string tag)
12368 {
12369 bool found = false;
12370 string item_name = this.
GetType();
12373
12374 int array_size = item_tag_array.Count();
12375 for (int i = 0; i < array_size; i++)
12376 {
12377 if (item_tag_array.Get(i) == tag)
12378 {
12379 found = true;
12380 break;
12381 }
12382 }
12383 return found;
12384 }
12385
12386
12388 {
12389
12390 super.OnRPC(sender, rpc_type,ctx);
12391
12392
12393 switch (rpc_type)
12394 {
12395 #ifndef SERVER
12396 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12397 Param2<bool, string> p = new Param2<bool, string>(false, "");
12398
12400 return;
12401
12402 bool play = p.param1;
12403 string soundSet = p.param2;
12404
12405 if (play)
12406 {
12408 {
12410 {
12412 }
12413 }
12414 else
12415 {
12417 }
12418 }
12419 else
12420 {
12422 }
12423
12424 break;
12425 #endif
12426
12427 }
12428
12430 {
12432 }
12433 }
12434
12435
12436
12437
12439 {
12440 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12441 return plugin.GetID(
name);
12442 }
12443
12445 {
12446 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12447 return plugin.GetName(id);
12448 }
12449
12452 {
12453
12454
12455 int varFlags;
12456 if (!ctx.
Read(varFlags))
12457 return;
12458
12459 if (varFlags & ItemVariableFlags.FLOAT)
12460 {
12462 }
12463 }
12464
12466 {
12467
12468 super.SerializeNumericalVars(floats_out);
12469
12470
12471
12473 {
12475 }
12476
12478 {
12480 }
12481
12483 {
12485 }
12486
12488 {
12493 }
12494
12496 {
12498 }
12499 }
12500
12502 {
12503
12504 super.DeSerializeNumericalVars(floats);
12505
12506
12507 int index = 0;
12508 int mask = Math.Round(floats.Get(index));
12509
12510 index++;
12511
12513 {
12515 {
12517 }
12518 else
12519 {
12520 float quantity = floats.Get(index);
12521 SetQuantity(quantity,
true,
false,
false,
false);
12522 }
12523 index++;
12524 }
12525
12527 {
12528 float wet = floats.Get(index);
12530 index++;
12531 }
12532
12534 {
12535 int liquidtype = Math.Round(floats.Get(index));
12537 index++;
12538 }
12539
12541 {
12543 index++;
12545 index++;
12547 index++;
12549 index++;
12550 }
12551
12553 {
12554 int cleanness = Math.Round(floats.Get(index));
12556 index++;
12557 }
12558 }
12559
12561 {
12562 super.WriteVarsToCTX(ctx);
12563
12564
12566 {
12568 }
12569
12571 {
12573 }
12574
12576 {
12578 }
12579
12581 {
12582 int r,g,b,a;
12588 }
12589
12591 {
12593 }
12594 }
12595
12597 {
12598 if (!super.ReadVarsFromCTX(ctx,version))
12599 return false;
12600
12601 int intValue;
12602 float value;
12603
12604 if (version < 140)
12605 {
12606 if (!ctx.
Read(intValue))
12607 return false;
12608
12609 m_VariablesMask = intValue;
12610 }
12611
12613 {
12614 if (!ctx.
Read(value))
12615 return false;
12616
12618 {
12620 }
12621 else
12622 {
12624 }
12625 }
12626
12627 if (version < 140)
12628 {
12630 {
12631 if (!ctx.
Read(value))
12632 return false;
12633 SetTemperatureDirect(value);
12634 }
12635 }
12636
12638 {
12639 if (!ctx.
Read(value))
12640 return false;
12642 }
12643
12645 {
12646 if (!ctx.
Read(intValue))
12647 return false;
12649 }
12650
12652 {
12653 int r,g,b,a;
12655 return false;
12657 return false;
12659 return false;
12661 return false;
12662
12664 }
12665
12667 {
12668 if (!ctx.
Read(intValue))
12669 return false;
12671 }
12672
12673 if (version >= 138 && version < 140)
12674 {
12676 {
12677 if (!ctx.
Read(intValue))
12678 return false;
12679 SetFrozen(intValue);
12680 }
12681 }
12682
12683 return true;
12684 }
12685
12686
12688 {
12691 {
12693 }
12694
12695 if (!super.OnStoreLoad(ctx, version))
12696 {
12698 return false;
12699 }
12700
12701 if (version >= 114)
12702 {
12703 bool hasQuickBarIndexSaved;
12704
12705 if (!ctx.
Read(hasQuickBarIndexSaved))
12706 {
12708 return false;
12709 }
12710
12711 if (hasQuickBarIndexSaved)
12712 {
12713 int itmQBIndex;
12714
12715
12716 if (!ctx.
Read(itmQBIndex))
12717 {
12719 return false;
12720 }
12721
12722 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12723 if (itmQBIndex != -1 && parentPlayer)
12724 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12725 }
12726 }
12727 else
12728 {
12729
12730 PlayerBase player;
12731 int itemQBIndex;
12732 if (version ==
int.
MAX)
12733 {
12734 if (!ctx.
Read(itemQBIndex))
12735 {
12737 return false;
12738 }
12739 }
12740 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12741 {
12742
12743 if (!ctx.
Read(itemQBIndex))
12744 {
12746 return false;
12747 }
12748 if (itemQBIndex != -1 && player)
12749 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12750 }
12751 }
12752
12753 if (version < 140)
12754 {
12755
12756 if (!LoadVariables(ctx, version))
12757 {
12759 return false;
12760 }
12761 }
12762
12763
12765 {
12767 return false;
12768 }
12769 if (version >= 132)
12770 {
12772 if (raib)
12773 {
12775 {
12777 return false;
12778 }
12779 }
12780 }
12781
12783 return true;
12784 }
12785
12786
12787
12789 {
12790 super.OnStoreSave(ctx);
12791
12792 PlayerBase player;
12793 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12794 {
12796
12797 int itemQBIndex = -1;
12798 itemQBIndex = player.FindQuickBarEntityIndex(this);
12799 ctx.
Write(itemQBIndex);
12800 }
12801 else
12802 {
12804 }
12805
12807
12809 if (raib)
12810 {
12812 }
12813 }
12814
12815
12817 {
12818 super.AfterStoreLoad();
12819
12821 {
12823 }
12824
12826 {
12829 }
12830 }
12831
12833 {
12834 super.EEOnAfterLoad();
12835
12837 {
12839 }
12840
12843 }
12844
12846 {
12847 return false;
12848 }
12849
12850
12851
12853 {
12855 {
12856 #ifdef PLATFORM_CONSOLE
12857
12859 {
12861 if (menu)
12862 {
12864 }
12865 }
12866 #endif
12867 }
12868
12870 {
12873 }
12874
12876 {
12877 SetWeightDirty();
12879 }
12881 {
12884 }
12885
12887 {
12890 }
12892 {
12895 }
12896
12897 super.OnVariablesSynchronized();
12898 }
12899
12900
12901
12903 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12904 {
12905 if (!IsServerCheck(allow_client))
12906 return false;
12907
12909 return false;
12910
12913
12914 if (value <= (min + 0.001))
12915 value = min;
12916
12917 if (value == min)
12918 {
12919 if (destroy_config)
12920 {
12921 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12922 if (dstr)
12923 {
12925 this.Delete();
12926 return true;
12927 }
12928 }
12929 else if (destroy_forced)
12930 {
12932 this.Delete();
12933 return true;
12934 }
12935
12937 }
12938
12941
12943 {
12945
12946 if (delta)
12948 }
12949
12951
12952 return false;
12953 }
12954
12955
12957 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12958 {
12960 }
12961
12963 {
12966 }
12967
12969 {
12972 }
12973
12975 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12976 {
12977 float value_clamped = Math.Clamp(value, 0, 1);
12979 SetQuantity(result, destroy_config, destroy_forced);
12980 }
12981
12982
12985 {
12987 }
12988
12990 {
12992 }
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13004 {
13005 int slot = -1;
13006 if (GetInventory())
13007 {
13008 InventoryLocation il = new InventoryLocation;
13009 GetInventory().GetCurrentInventoryLocation(il);
13011 }
13012
13014 }
13015
13017 {
13018 float quantity_max = 0;
13019
13021 {
13022 if (attSlotID != -1)
13023 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13024
13025 if (quantity_max <= 0)
13027 }
13028
13029 if (quantity_max <= 0)
13031
13032 return quantity_max;
13033 }
13034
13036 {
13038 }
13039
13041 {
13043 }
13044
13045
13047 {
13049 }
13050
13052 {
13054 }
13055
13057 {
13059 }
13060
13061
13063 {
13064
13065 float weightEx = GetWeightEx();
13066 float special = GetInventoryAndCargoWeight();
13067 return weightEx - special;
13068 }
13069
13070
13072 {
13074 }
13075
13077 {
13079 {
13080 #ifdef DEVELOPER
13081 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13082 {
13083 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13085 }
13086 #endif
13087
13088 return GetQuantity() * GetConfigWeightModified();
13089 }
13090 else if (HasEnergyManager())
13091 {
13092 #ifdef DEVELOPER
13093 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13094 {
13095 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13096 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13097 }
13098 #endif
13099 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13100 }
13101 else
13102 {
13103 #ifdef DEVELOPER
13104 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13105 {
13106 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13107 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13108 }
13109 #endif
13110 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13111 }
13112 }
13113
13116 {
13117 int item_count = 0;
13119
13120 if (GetInventory().GetCargo() != NULL)
13121 {
13122 item_count = GetInventory().GetCargo().GetItemCount();
13123 }
13124
13125 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
13126 {
13127 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
13128 if (item)
13129 item_count += item.GetNumberOfItems();
13130 }
13131 return item_count;
13132 }
13133
13136 {
13137 float weight = 0;
13138 float wetness = 1;
13139 if (include_wetness)
13142 {
13143 weight = wetness * m_ConfigWeight;
13144 }
13146 {
13147 weight = 1;
13148 }
13149 return weight;
13150 }
13151
13152
13153
13155 {
13156 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
13157 {
13158 GameInventory inv = GetInventory();
13159 array<EntityAI> items = new array<EntityAI>;
13161 for (int i = 0; i < items.Count(); i++)
13162 {
13164 if (item)
13165 {
13167 }
13168 }
13169 }
13170 }
13171
13172
13173
13174
13176 {
13177 float energy = 0;
13178 if (HasEnergyManager())
13179 {
13180 energy = GetCompEM().GetEnergy();
13181 }
13182 return energy;
13183 }
13184
13185
13187 {
13188 super.OnEnergyConsumed();
13189
13191 }
13192
13194 {
13195 super.OnEnergyAdded();
13196
13198 }
13199
13200
13202 {
13203 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13204 {
13206 {
13207 float energy_0to1 = GetCompEM().GetEnergy0To1();
13209 }
13210 }
13211 }
13212
13213
13215 {
13216 return ConfigGetFloat("heatIsolation");
13217 }
13218
13220 {
13222 }
13223
13225 {
13226 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13227 if (
GetGame().ConfigIsExisting(paramPath))
13229
13230 return 0.0;
13231 }
13232
13234 {
13235 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13236 if (
GetGame().ConfigIsExisting(paramPath))
13238
13239 return 0.0;
13240 }
13241
13242 override void SetWet(
float value,
bool allow_client =
false)
13243 {
13244 if (!IsServerCheck(allow_client))
13245 return;
13246
13249
13251
13252 m_VarWet = Math.Clamp(value, min, max);
13253
13255 {
13258 }
13259 }
13260
13261 override void AddWet(
float value)
13262 {
13264 }
13265
13267 {
13269 }
13270
13272 {
13274 }
13275
13277 {
13279 }
13280
13282 {
13284 }
13285
13287 {
13289 }
13290
13291 override void OnWetChanged(
float newVal,
float oldVal)
13292 {
13295 if (newLevel != oldLevel)
13296 {
13298 }
13299 }
13300
13302 {
13303 SetWeightDirty();
13304 }
13305
13307 {
13308 return GetWetLevelInternal(
m_VarWet);
13309 }
13310
13311
13312
13314 {
13316 }
13317
13319 {
13321 }
13322
13324 {
13326 }
13327
13329 {
13331 }
13332
13333
13334
13336 {
13337 if (ConfigIsExisting("itemModelLength"))
13338 {
13339 return ConfigGetFloat("itemModelLength");
13340 }
13341 return 0;
13342 }
13343
13345 {
13346 if (ConfigIsExisting("itemAttachOffset"))
13347 {
13348 return ConfigGetFloat("itemAttachOffset");
13349 }
13350 return 0;
13351 }
13352
13353 override void SetCleanness(
int value,
bool allow_client =
false)
13354 {
13355 if (!IsServerCheck(allow_client))
13356 return;
13357
13359
13361
13364 }
13365
13367 {
13369 }
13370
13372 {
13373 return true;
13374 }
13375
13376
13377
13378
13380 {
13382 }
13383
13385 {
13387 }
13388
13389
13390
13391
13392 override void SetColor(
int r,
int g,
int b,
int a)
13393 {
13399 }
13401 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13402 {
13407 }
13408
13410 {
13412 }
13413
13416 {
13417 int r,g,b,a;
13419 r = r/255;
13420 g = g/255;
13421 b = b/255;
13422 a = a/255;
13423 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13424 }
13425
13426
13427
13428 override void SetLiquidType(
int value,
bool allow_client =
false)
13429 {
13430 if (!IsServerCheck(allow_client))
13431 return;
13432
13437 }
13438
13440 {
13441 return ConfigGetInt("varLiquidTypeInit");
13442 }
13443
13445 {
13447 }
13448
13450 {
13452 SetFrozen(false);
13453 }
13454
13457 {
13458 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13459 }
13460
13461
13464 {
13465 PlayerBase nplayer;
13466 if (PlayerBase.CastTo(nplayer, player))
13467 {
13469
13470 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13471 }
13472 }
13473
13474
13477 {
13478 PlayerBase nplayer;
13479 if (PlayerBase.CastTo(nplayer,player))
13480 {
13481
13482 nplayer.SetEnableQuickBarEntityShortcut(this,false);
13483
13484 }
13485
13486
13487 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13488
13489
13490 if (HasEnergyManager())
13491 {
13492 GetCompEM().UpdatePlugState();
13493 }
13494 }
13495
13496
13498 {
13499 super.OnPlacementStarted(player);
13500
13502 }
13503
13504 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13505 {
13507 {
13508 m_AdminLog.OnPlacementComplete(player,
this);
13509 }
13510
13511 super.OnPlacementComplete(player, position, orientation);
13512 }
13513
13514
13515
13516
13517
13519 {
13521 {
13522 return true;
13523 }
13524 else
13525 {
13526 return false;
13527 }
13528 }
13529
13530
13532 {
13534 {
13536 }
13537 }
13538
13539
13541 {
13543 }
13544
13546 {
13548 }
13549
13550 override void InsertAgent(
int agent,
float count = 1)
13551 {
13552 if (count < 1)
13553 return;
13554
13556 }
13557
13560 {
13562 }
13563
13564
13566 {
13568 }
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13612 {
13614 return false;
13615 return true;
13616 }
13617
13619 {
13620
13622 }
13623
13624
13627 {
13628 super.CheckForRoofLimited(timeTresholdMS);
13629
13631 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13632 {
13633 m_PreviousRoofTestTime = time;
13634 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13635 }
13636 }
13637
13638
13640 {
13642 {
13643 return 0;
13644 }
13645
13646 if (GetInventory().GetAttachmentSlotsCount() != 0)
13647 {
13648 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13649 if (filter)
13650 return filter.GetProtectionLevel(type, false, system);
13651 else
13652 return 0;
13653 }
13654
13655 string subclassPath, entryName;
13656
13657 switch (type)
13658 {
13660 entryName = "biological";
13661 break;
13663 entryName = "chemical";
13664 break;
13665 default:
13666 entryName = "biological";
13667 break;
13668 }
13669
13670 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13671
13673 }
13674
13675
13676
13679 {
13680 if (!IsMagazine())
13682
13684 }
13685
13686
13687
13688
13689
13694 {
13695 return true;
13696 }
13697
13699 {
13701 }
13702
13703
13704
13705
13706
13708 {
13709 if (parent)
13710 {
13711 if (parent.IsInherited(DayZInfected))
13712 return true;
13713
13714 if (!parent.IsRuined())
13715 return true;
13716 }
13717
13718 return true;
13719 }
13720
13722 {
13723 if (!super.CanPutAsAttachment(parent))
13724 {
13725 return false;
13726 }
13727
13728 if (!IsRuined() && !parent.IsRuined())
13729 {
13730 return true;
13731 }
13732
13733 return false;
13734 }
13735
13737 {
13738
13739
13740
13741
13742 return super.CanReceiveItemIntoCargo(item);
13743 }
13744
13746 {
13747
13748
13749
13750
13751 GameInventory attachmentInv = attachment.GetInventory();
13753 {
13754 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13755 return false;
13756 }
13757
13758 InventoryLocation loc = new InventoryLocation();
13759 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13760 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13761 return false;
13762
13763 return super.CanReceiveAttachment(attachment, slotId);
13764 }
13765
13767 {
13768 if (!super.CanReleaseAttachment(attachment))
13769 return false;
13770
13771 return GetInventory().AreChildrenAccessible();
13772 }
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13795 {
13796 int id = muzzle_owner.GetMuzzleID();
13797 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13798
13799 if (WPOF_array)
13800 {
13801 for (int i = 0; i < WPOF_array.Count(); i++)
13802 {
13803 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13804
13805 if (WPOF)
13806 {
13807 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13808 }
13809 }
13810 }
13811 }
13812
13813
13815 {
13816 int id = muzzle_owner.GetMuzzleID();
13818
13819 if (WPOBE_array)
13820 {
13821 for (int i = 0; i < WPOBE_array.Count(); i++)
13822 {
13823 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13824
13825 if (WPOBE)
13826 {
13827 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13828 }
13829 }
13830 }
13831 }
13832
13833
13835 {
13836 int id = muzzle_owner.GetMuzzleID();
13837 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13838
13839 if (WPOOH_array)
13840 {
13841 for (int i = 0; i < WPOOH_array.Count(); i++)
13842 {
13843 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13844
13845 if (WPOOH)
13846 {
13847 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13848 }
13849 }
13850 }
13851 }
13852
13853
13855 {
13856 int id = muzzle_owner.GetMuzzleID();
13857 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13858
13859 if (WPOOH_array)
13860 {
13861 for (int i = 0; i < WPOOH_array.Count(); i++)
13862 {
13863 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13864
13865 if (WPOOH)
13866 {
13867 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13868 }
13869 }
13870 }
13871 }
13872
13873
13875 {
13876 int id = muzzle_owner.GetMuzzleID();
13877 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13878
13879 if (WPOOH_array)
13880 {
13881 for (int i = 0; i < WPOOH_array.Count(); i++)
13882 {
13883 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13884
13885 if (WPOOH)
13886 {
13887 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13888 }
13889 }
13890 }
13891 }
13892
13893
13894
13896 {
13898 {
13899 return true;
13900 }
13901
13902 return false;
13903 }
13904
13906 {
13908 {
13909 return true;
13910 }
13911
13912 return false;
13913 }
13914
13916 {
13918 {
13919 return true;
13920 }
13921
13922 return false;
13923 }
13924
13926 {
13927 return false;
13928 }
13929
13932 {
13933 return UATimeSpent.DEFAULT_DEPLOY;
13934 }
13935
13936
13937
13938
13940 {
13942 SetSynchDirty();
13943 }
13944
13946 {
13948 }
13949
13950
13952 {
13953 return false;
13954 }
13955
13958 {
13959 string att_type = "None";
13960
13961 if (ConfigIsExisting("soundAttType"))
13962 {
13963 att_type = ConfigGetString("soundAttType");
13964 }
13965
13967 }
13968
13970 {
13972 }
13973
13974
13975
13976
13977
13983
13985 {
13988
13990 }
13991
13992
13994 {
13996 return;
13997
13999
14002
14005
14006 SoundParameters params = new SoundParameters();
14010 }
14011
14012
14014 {
14016 return;
14017
14019 SetSynchDirty();
14020
14023 }
14024
14025
14027 {
14029 return;
14030
14032 SetSynchDirty();
14033
14036 }
14037
14039 {
14041 }
14042
14044 {
14046 }
14047
14050 {
14051 if (!
GetGame().IsDedicatedServer())
14052 {
14053 if (ConfigIsExisting("attachSoundSet"))
14054 {
14055 string cfg_path = "";
14056 string soundset = "";
14057 string type_name =
GetType();
14058
14061 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14062 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14063
14064 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14065 {
14066 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14067 {
14068 if (cfg_slot_array[i] == slot_type)
14069 {
14070 soundset = cfg_soundset_array[i];
14071 break;
14072 }
14073 }
14074 }
14075
14076 if (soundset != "")
14077 {
14078 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14080 }
14081 }
14082 }
14083 }
14084
14086 {
14087
14088 }
14089
14090 void OnApply(PlayerBase player);
14091
14093 {
14094 return 1.0;
14095 };
14096
14098 {
14100 }
14101
14103 {
14105 }
14106
14108
14110 {
14111 SetDynamicPhysicsLifeTime(0.01);
14113 }
14114
14116 {
14117 array<string> zone_names = new array<string>;
14118 GetDamageZones(zone_names);
14119 for (int i = 0; i < zone_names.Count(); i++)
14120 {
14121 SetHealthMax(zone_names.Get(i),"Health");
14122 }
14123 SetHealthMax("","Health");
14124 }
14125
14128 {
14129 float global_health = GetHealth01("","Health");
14130 array<string> zones = new array<string>;
14131 GetDamageZones(zones);
14132
14133 for (int i = 0; i < zones.Count(); i++)
14134 {
14135 SetHealth01(zones.Get(i),"Health",global_health);
14136 }
14137 }
14138
14141 {
14142 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14143 }
14144
14146 {
14147 if (!hasRootAsPlayer)
14148 {
14149 if (refParentIB)
14150 {
14151
14152 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14153 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14154
14155 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14156 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14157
14160 }
14161 else
14162 {
14163
14166 }
14167 }
14168 }
14169
14171 {
14173 {
14174 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14175 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14176 {
14177 float heatPermCoef = 1.0;
14179 while (ent)
14180 {
14181 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14182 ent = ent.GetHierarchyParent();
14183 }
14184
14185 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14186 }
14187 }
14188 }
14189
14191 {
14192
14193 EntityAI parent = GetHierarchyParent();
14194 if (!parent)
14195 {
14196 hasParent = false;
14197 hasRootAsPlayer = false;
14198 }
14199 else
14200 {
14201 hasParent = true;
14202 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14203 refParentIB =
ItemBase.Cast(parent);
14204 }
14205 }
14206
14207 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14208 {
14209
14210 }
14211
14213 {
14214
14215 return false;
14216 }
14217
14219 {
14220
14221
14222 return false;
14223 }
14224
14226 {
14227
14228 return false;
14229 }
14230
14233 {
14234 return !GetIsFrozen() &&
IsOpen();
14235 }
14236
14238 {
14239 bool hasParent = false, hasRootAsPlayer = false;
14241
14242 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14243 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14244
14245 if (wwtu || foodDecay)
14246 {
14250
14251 if (processWetness || processTemperature || processDecay)
14252 {
14254
14255 if (processWetness)
14256 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14257
14258 if (processTemperature)
14260
14261 if (processDecay)
14262 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14263 }
14264 }
14265 }
14266
14269 {
14271 }
14272
14274 {
14277
14278 return super.GetTemperatureFreezeThreshold();
14279 }
14280
14282 {
14285
14286 return super.GetTemperatureThawThreshold();
14287 }
14288
14290 {
14293
14294 return super.GetItemOverheatThreshold();
14295 }
14296
14298 {
14300 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14301
14302 return super.GetTemperatureFreezeTime();
14303 }
14304
14306 {
14308 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14309
14310 return super.GetTemperatureThawTime();
14311 }
14312
14317
14319 {
14320 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14321 }
14322
14324 {
14325 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14326 }
14327
14330 {
14332 }
14333
14335 {
14337 }
14338
14340 {
14342 }
14343
14346 {
14347 return null;
14348 }
14349
14352 {
14353 return false;
14354 }
14355
14357 {
14359 {
14362 if (!trg)
14363 {
14365 explosive = this;
14366 }
14367
14368 explosive.PairRemote(trg);
14370
14371 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14372 trg.SetPersistentPairID(persistentID);
14373 explosive.SetPersistentPairID(persistentID);
14374
14375 return true;
14376 }
14377 return false;
14378 }
14379
14382 {
14383 float ret = 1.0;
14386 ret *= GetHealth01();
14387
14388 return ret;
14389 }
14390
14391 #ifdef DEVELOPER
14392 override void SetDebugItem()
14393 {
14394 super.SetDebugItem();
14395 _itemBase = this;
14396 }
14397
14399 {
14400 string text = super.GetDebugText();
14401
14403 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14404
14405 return text;
14406 }
14407 #endif
14408
14410 {
14411 return true;
14412 }
14413
14415
14417
14419 {
14422 }
14423
14424
14432
14448}
14449
14451{
14453 if (entity)
14454 {
14455 bool is_item = entity.IsInherited(
ItemBase);
14456 if (is_item && full_quantity)
14457 {
14460 }
14461 }
14462 else
14463 {
14465 return NULL;
14466 }
14467 return entity;
14468}
14469
14471{
14472 if (item)
14473 {
14474 if (health > 0)
14475 item.SetHealth("", "", health);
14476
14477 if (item.CanHaveTemperature())
14478 {
14480 if (item.CanFreeze())
14481 item.SetFrozen(false);
14482 }
14483
14484 if (item.HasEnergyManager())
14485 {
14486 if (quantity >= 0)
14487 {
14488 item.GetCompEM().SetEnergy0To1(quantity);
14489 }
14490 else
14491 {
14493 }
14494 }
14495 else if (item.IsMagazine())
14496 {
14497 Magazine mag = Magazine.Cast(item);
14498 if (quantity >= 0)
14499 {
14500 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14501 }
14502 else
14503 {
14505 }
14506
14507 }
14508 else
14509 {
14510 if (quantity >= 0)
14511 {
14512 item.SetQuantityNormalized(quantity, false);
14513 }
14514 else
14515 {
14517 }
14518
14519 }
14520 }
14521}
14522
14523#ifdef DEVELOPER
14525#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.