9541{
9543 {
9544 return true;
9545 }
9546};
9547
9549{
9550
9551};
9552
9553
9554
9556{
9560
9562
9565
9566
9567
9568
9569
9578
9584
9589
9594
9615 protected bool m_IsResultOfSplit
9616
9618
9623
9624
9625
9627
9631
9632
9633
9635
9638
9639
9640
9646
9647
9655
9658
9659
9661
9662
9664
9665
9670
9671
9676
9678
9679
9681
9682
9684 {
9689
9690 if (!
g_Game.IsDedicatedServer())
9691 {
9693 {
9695
9697 {
9699 }
9700 }
9701
9704 }
9705
9706 m_OldLocation = null;
9707
9709 {
9711 }
9712
9713 if (ConfigIsExisting("headSelectionsToHide"))
9714 {
9717 }
9718
9720 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9721 {
9723 }
9724
9726
9727 m_IsResultOfSplit = false;
9728
9730 }
9731
9733 {
9734 super.InitItemVariables();
9735
9741 m_Count = ConfigGetInt(
"count");
9742
9745
9750
9753
9758
9770
9774
9775
9778 if (ConfigIsExisting("canBeSplit"))
9779 {
9782 }
9783
9785 if (ConfigIsExisting("itemBehaviour"))
9787
9788
9791 RegisterNetSyncVariableInt("m_VarLiquidType");
9792 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9793
9794 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9795 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9796 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9797
9798 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9799 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9800 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9801 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9802
9803 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9804 RegisterNetSyncVariableBool("m_IsTakeable");
9805 RegisterNetSyncVariableBool("m_IsHologram");
9806
9809 {
9812 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9813 }
9814
9816
9818 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9820
9822 }
9823
9825 {
9827 }
9828
9830 {
9833 {
9838 }
9839 }
9840
9841 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9842 {
9844 {
9847 }
9848
9850 }
9851
9853 {
9859 }
9860
9862
9864 {
9866
9867 if (!action)
9868 {
9869 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9870 return;
9871 }
9872
9874 if (!ai)
9875 {
9877 return;
9878 }
9879
9881 if (!action_array)
9882 {
9883 action_array = new array<ActionBase_Basic>;
9885 }
9886 if (LogManager.IsActionLogEnable())
9887 {
9888 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9889 }
9890
9891 if (action_array.Find(action) != -1)
9892 {
9893 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9894 }
9895 else
9896 {
9897 action_array.Insert(action);
9898 }
9899 }
9900
9902 {
9903 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9904 ActionBase action = player.GetActionManager().GetAction(actionName);
9907
9908 if (action_array)
9909 {
9910 action_array.RemoveItem(action);
9911 }
9912 }
9913
9914
9915
9917 {
9918 ActionOverrideData overrideData = new ActionOverrideData();
9922
9924 if (!actionMap)
9925 {
9928 }
9929
9930 actionMap.Insert(this.
Type(), overrideData);
9931
9932 }
9933
9935
9937
9938
9940 {
9943
9946
9947 string config_to_search = "CfgVehicles";
9948 string muzzle_owner_config;
9949
9951 {
9952 if (IsInherited(Weapon))
9953 config_to_search = "CfgWeapons";
9954
9955 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9956
9957 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9958
9959 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9960
9961 if (config_OnFire_subclass_count > 0)
9962 {
9963 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9964
9965 for (int i = 0; i < config_OnFire_subclass_count; i++)
9966 {
9967 string particle_class = "";
9968 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9969 string config_OnFire_entry = config_OnFire_class + particle_class;
9970 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9971 WPOF_array.Insert(WPOF);
9972 }
9973
9974
9976 }
9977 }
9978
9980 {
9981 config_to_search = "CfgWeapons";
9982 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9983
9984 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9985
9986 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9987
9988 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9989 {
9990 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9991
9992 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9993 {
9994 string particle_class2 = "";
9995 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9996 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9997 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9998 WPOBE_array.Insert(WPOBE);
9999 }
10000
10001
10003 }
10004 }
10005 }
10006
10007
10009 {
10012
10014 {
10015 string config_to_search = "CfgVehicles";
10016
10017 if (IsInherited(Weapon))
10018 config_to_search = "CfgWeapons";
10019
10020 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10021 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10022
10023 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10024 {
10025
10027
10029 {
10031 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10033 return;
10034 }
10035
10038
10039
10040
10041 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10042 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10043
10044 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10045 {
10046 string particle_class = "";
10047 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10048 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10049 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10050
10051 if (entry_type == CT_CLASS)
10052 {
10053 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10054 WPOOH_array.Insert(WPOF);
10055 }
10056 }
10057
10058
10060 }
10061 }
10062 }
10063
10065 {
10067 }
10068
10070 {
10072 {
10074
10077
10080
10081 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10082 }
10083 }
10084
10086 {
10088 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10089
10091 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10092
10094 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10095
10097 {
10099 }
10100 }
10101
10103 {
10105 }
10106
10108 {
10111 else
10113
10115 {
10118 }
10119 else
10120 {
10123
10126 }
10127
10129 }
10130
10132 {
10134 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10135 }
10136
10138 {
10140 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10142 }
10143
10145 {
10147 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10148 }
10149
10151 {
10154
10155 OverheatingParticle OP = new OverheatingParticle();
10160
10162 }
10163
10165 {
10168
10169 return -1;
10170 }
10171
10173 {
10175 {
10178
10179 for (int i = count; i > 0; --i)
10180 {
10181 int id = i - 1;
10184
10187
10188 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10189 {
10190 if (p)
10191 {
10194 }
10195 }
10196 }
10197 }
10198 }
10199
10201 {
10203 {
10205 {
10206 int id = i - 1;
10208
10209 if (OP)
10210 {
10212
10213 if (p)
10214 {
10216 }
10217
10218 delete OP;
10219 }
10220 }
10221
10224 }
10225 }
10226
10229 {
10230 return 0.0;
10231 }
10232
10233
10235 {
10236 return 250;
10237 }
10238
10240 {
10241 return 0;
10242 }
10243
10246 {
10248 return true;
10249
10250 return false;
10251 }
10252
10255 {
10258
10260 {
10262 }
10263 else
10264 {
10265
10267 }
10268
10270 }
10271
10278 {
10279 return -1;
10280 }
10281
10282
10283
10284
10286 {
10288 {
10289 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10290 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10291
10292 if (r_index >= 0)
10293 {
10294 InventoryLocation r_il = new InventoryLocation;
10295 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10296
10297 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10300 {
10301 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10302 }
10304 {
10305 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10306 }
10307
10308 }
10309
10310 player.GetHumanInventory().ClearUserReservedLocation(this);
10311 }
10312
10315 }
10316
10317
10318
10319
10321 {
10322 return ItemBase.m_DebugActionsMask;
10323 }
10324
10326 {
10327 return ItemBase.m_DebugActionsMask & mask;
10328 }
10329
10331 {
10332 ItemBase.m_DebugActionsMask = mask;
10333 }
10334
10336 {
10337 ItemBase.m_DebugActionsMask |= mask;
10338 }
10339
10341 {
10342 ItemBase.m_DebugActionsMask &= ~mask;
10343 }
10344
10346 {
10348 {
10350 }
10351 else
10352 {
10354 }
10355 }
10356
10357
10359 {
10360 if (GetEconomyProfile())
10361 {
10362 float q_max = GetEconomyProfile().GetQuantityMax();
10363 if (q_max > 0)
10364 {
10365 float q_min = GetEconomyProfile().GetQuantityMin();
10366 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10367
10369 {
10370 ComponentEnergyManager comp = GetCompEM();
10372 {
10374 }
10375 }
10377 {
10379
10380 }
10381
10382 }
10383 }
10384 }
10385
10388 {
10389 EntityAI parent = GetHierarchyParent();
10390
10391 if (parent)
10392 {
10393 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10394 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10395 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10396 }
10397 }
10398
10401 {
10402 EntityAI parent = GetHierarchyParent();
10403
10404 if (parent)
10405 {
10406 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10407 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10408 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10409 }
10410 }
10411
10413 {
10414
10415
10416
10417
10419
10421 {
10422 if (ScriptInputUserData.CanStoreInputUserData())
10423 {
10424 ScriptInputUserData ctx = new ScriptInputUserData;
10430 ctx.
Write(use_stack_max);
10433
10435 {
10436 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10437 }
10438 }
10439 }
10440 else if (!
g_Game.IsMultiplayer())
10441 {
10443 }
10444 }
10445
10447 {
10449 }
10450
10452 {
10454 }
10455
10457 {
10459 }
10460
10462 {
10463
10464 return false;
10465 }
10466
10468 {
10469 return false;
10470 }
10471
10475 {
10476 return false;
10477 }
10478
10480 {
10481 return "";
10482 }
10483
10485
10487 {
10488 return false;
10489 }
10490
10492 {
10493 return true;
10494 }
10495
10496
10497
10499 {
10500 return true;
10501 }
10502
10504 {
10505 return true;
10506 }
10507
10509 {
10510 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10512 }
10513
10515 {
10517 }
10518
10520 {
10522 if (!is_being_placed)
10524 SetSynchDirty();
10525 }
10526
10527
10529
10531 {
10533 }
10534
10536 {
10538 }
10539
10541 {
10542 return 1;
10543 }
10544
10546 {
10547 return false;
10548 }
10549
10551 {
10553 SetSynchDirty();
10554 }
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10591 {
10592 super.OnMovedInsideCargo(container);
10593
10594 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10595 }
10596
10597 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10598 {
10599 super.EEItemLocationChanged(oldLoc, newLoc);
10600
10601 PlayerBase newPlayer = null;
10602 PlayerBase oldPlayer = null;
10603
10604 if (newLoc.GetParent())
10605 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10606
10607 if (oldLoc.GetParent())
10608 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10609
10611 {
10612 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10613
10614 if (rIndex >= 0)
10615 {
10616 InventoryLocation rIl = new InventoryLocation;
10617 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10618
10619 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10622 {
10623 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10624 }
10626 {
10628 }
10629
10630 }
10631 }
10632
10634 {
10635 if (newPlayer)
10636 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10637
10638 if (newPlayer == oldPlayer)
10639 {
10640 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10641 {
10643 {
10644 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10645 {
10646 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10647 }
10648 }
10649 else
10650 {
10651 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10652 }
10653 }
10654
10655 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10656 {
10657 int type = oldLoc.GetType();
10659 {
10660 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10661 }
10663 {
10664 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10665 }
10666 }
10667 if (!m_OldLocation)
10668 {
10669 m_OldLocation = new InventoryLocation;
10670 }
10671 m_OldLocation.Copy(oldLoc);
10672 }
10673 else
10674 {
10675 if (m_OldLocation)
10676 {
10677 m_OldLocation.Reset();
10678 }
10679 }
10680
10681 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10682 }
10683 else
10684 {
10685 if (newPlayer)
10686 {
10687 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10688 if (resIndex >= 0)
10689 {
10690 InventoryLocation il = new InventoryLocation;
10691 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10693 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10696 {
10697 il.
GetParent().GetOnReleaseLock().Invoke(it);
10698 }
10700 {
10702 }
10703
10704 }
10705 }
10707 {
10708
10710 }
10711
10712 if (m_OldLocation)
10713 {
10714 m_OldLocation.Reset();
10715 }
10716 }
10717
10719 {
10720 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10721 }
10722
10724 {
10725 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10726 }
10727 }
10728
10729 override void EOnContact(IEntity other, Contact extra)
10730 {
10732 {
10733 int liquidType = -1;
10735 if (impactSpeed > 0.0)
10736 {
10738 #ifndef SERVER
10740 #else
10742 SetSynchDirty();
10743 #endif
10745 }
10746 }
10747
10748 #ifdef SERVER
10749 if (GetCompEM() && GetCompEM().IsPlugged())
10750 {
10751 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10752 GetCompEM().UnplugThis();
10753 }
10754 #endif
10755 }
10756
10758
10760 {
10762 }
10763
10765 {
10766
10767 }
10768
10770 {
10771 super.OnItemLocationChanged(old_owner, new_owner);
10772
10773 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10774 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10775
10776 if (!relatedPlayer && playerNew)
10777 relatedPlayer = playerNew;
10778
10779 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10780 {
10782 if (actionMgr)
10783 {
10784 ActionBase currentAction = actionMgr.GetRunningAction();
10785 if (currentAction)
10787 }
10788 }
10789
10790 Man ownerPlayerOld = null;
10791 Man ownerPlayerNew = null;
10792
10793 if (old_owner)
10794 {
10795 if (old_owner.
IsMan())
10796 {
10797 ownerPlayerOld = Man.Cast(old_owner);
10798 }
10799 else
10800 {
10801 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10802 }
10803 }
10804 else
10805 {
10807 {
10809
10810 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10811 {
10812 GetCompEM().UnplugThis();
10813 }
10814 }
10815 }
10816
10817 if (new_owner)
10818 {
10819 if (new_owner.
IsMan())
10820 {
10821 ownerPlayerNew = Man.Cast(new_owner);
10822 }
10823 else
10824 {
10825 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10826 }
10827 }
10828
10829 if (ownerPlayerOld != ownerPlayerNew)
10830 {
10831 if (ownerPlayerOld)
10832 {
10833 array<EntityAI> subItemsExit = new array<EntityAI>;
10835 for (int i = 0; i < subItemsExit.Count(); i++)
10836 {
10839 }
10840 }
10841
10842 if (ownerPlayerNew)
10843 {
10844 array<EntityAI> subItemsEnter = new array<EntityAI>;
10846 for (int j = 0; j < subItemsEnter.Count(); j++)
10847 {
10850 }
10851 }
10852 }
10853 else if (ownerPlayerNew != null)
10854 {
10855 PlayerBase nplayer;
10856 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10857 {
10858 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10860 for (int k = 0; k < subItemsUpdate.Count(); k++)
10861 {
10863 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10864 }
10865 }
10866 }
10867
10868 if (old_owner)
10869 old_owner.OnChildItemRemoved(this);
10870 if (new_owner)
10871 new_owner.OnChildItemReceived(this);
10872 }
10873
10874
10876 {
10877 super.EEDelete(parent);
10878 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10879 if (player)
10880 {
10882
10883 if (player.IsAlive())
10884 {
10885 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10886 if (r_index >= 0)
10887 {
10888 InventoryLocation r_il = new InventoryLocation;
10889 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10890
10891 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10894 {
10895 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10896 }
10898 {
10899 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10900 }
10901
10902 }
10903
10904 player.RemoveQuickBarEntityShortcut(this);
10905 }
10906 }
10907 }
10908
10910 {
10911 super.EEKilled(killer);
10912
10915 {
10916 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10917 {
10918 if (IsMagazine())
10919 {
10920 if (Magazine.Cast(this).GetAmmoCount() > 0)
10921 {
10923 }
10924 }
10925 else
10926 {
10928 }
10929 }
10930 }
10931 }
10932
10934 {
10935 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10936
10937 super.OnWasAttached(parent, slot_id);
10938
10941
10944 }
10945
10947 {
10948 super.OnWasDetached(parent, slot_id);
10949
10952
10955 }
10956
10958 {
10959 int idx;
10962
10963 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10964 if (inventory_slots.Count() < 1)
10965 {
10966 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10967 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10968 }
10969 else
10970 {
10971 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10972 }
10973
10974 idx = inventory_slots.Find(slot);
10975 if (idx < 0)
10976 return "";
10977
10978 return attach_types.Get(idx);
10979 }
10980
10982 {
10983 int idx = -1;
10984 string slot;
10985
10988
10989 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10990 if (inventory_slots.Count() < 1)
10991 {
10992 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10993 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10994 }
10995 else
10996 {
10997 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10998 if (detach_types.Count() < 1)
10999 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11000 }
11001
11002 for (int i = 0; i < inventory_slots.Count(); i++)
11003 {
11004 slot = inventory_slots.Get(i);
11005 }
11006
11007 if (slot != "")
11008 {
11009 if (detach_types.Count() == 1)
11010 idx = 0;
11011 else
11012 idx = inventory_slots.Find(slot);
11013 }
11014 if (idx < 0)
11015 return "";
11016
11017 return detach_types.Get(idx);
11018 }
11019
11021 {
11022
11024
11025
11026 float min_time = 1;
11027 float max_time = 3;
11028 float delay = Math.RandomFloat(min_time, max_time);
11029
11030 explode_timer.Run(delay, this, "DoAmmoExplosion");
11031 }
11032
11034 {
11035 Magazine magazine = Magazine.Cast(this);
11036 int pop_sounds_count = 6;
11037 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11038
11039
11040 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11041 string sound_name = pop_sounds[ sound_idx ];
11042 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11043
11044
11045 magazine.ServerAddAmmoCount(-1);
11046
11047
11048 float min_temp_to_explode = 100;
11049
11050 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11051 {
11053 }
11054 }
11055
11056
11057 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11058 {
11059 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11060
11061 const int CHANCE_DAMAGE_CARGO = 4;
11062 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11063 const int CHANCE_DAMAGE_NOTHING = 2;
11064
11066 {
11067 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11068 int chances;
11069 int rnd;
11070
11071 if (GetInventory().GetCargo())
11072 {
11073 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11074 rnd = Math.RandomInt(0,chances);
11075
11076 if (rnd < CHANCE_DAMAGE_CARGO)
11077 {
11079 }
11080 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11081 {
11083 }
11084 }
11085 else
11086 {
11087 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11088 rnd = Math.RandomInt(0,chances);
11089
11090 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11091 {
11093 }
11094 }
11095 }
11096 }
11097
11099 {
11100 CargoBase cargo = GetInventory().GetCargo();
11101 if (cargo)
11102 {
11104 if (item_count > 0)
11105 {
11106 int random_pick = Math.RandomInt(0, item_count);
11108 if (!item.IsExplosive())
11109 {
11110 item.AddHealth("","",damage);
11111 return true;
11112 }
11113 }
11114 }
11115 return false;
11116 }
11117
11119 {
11120 GameInventory inventory = GetInventory();
11122 if (attachment_count > 0)
11123 {
11124 int random_pick = Math.RandomInt(0, attachment_count);
11126 if (!attachment.IsExplosive())
11127 {
11128 attachment.AddHealth("","",damage);
11129 return true;
11130 }
11131 }
11132 return false;
11133 }
11134
11136 {
11138 }
11139
11141 {
11143 return GetInventory().CanRemoveEntity();
11144
11145 return false;
11146 }
11147
11149 {
11150
11152 return false;
11153
11154
11156 return false;
11157
11158
11159
11161 if (delta == 0)
11162 return false;
11163
11164
11165 return true;
11166 }
11167
11169 {
11171 {
11172 if (ScriptInputUserData.CanStoreInputUserData())
11173 {
11174 ScriptInputUserData ctx = new ScriptInputUserData;
11179 ctx.
Write(destination_entity);
11181 ctx.
Write(slot_id);
11183 }
11184 }
11185 else if (!
g_Game.IsMultiplayer())
11186 {
11188 }
11189 }
11190
11192 {
11193 float split_quantity_new;
11197 InventoryLocation loc = new InventoryLocation;
11198
11199 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11200 {
11202 split_quantity_new = stack_max;
11203 else
11205
11207 {
11208 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11209 if (new_item)
11210 {
11211 new_item.SetResultOfSplit(true);
11212 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11214 new_item.
SetQuantity(split_quantity_new,
false,
true);
11215 }
11216 }
11217 }
11218 else if (destination_entity && slot_id == -1)
11219 {
11220 if (quantity > stack_max)
11221 split_quantity_new = stack_max;
11222 else
11223 split_quantity_new = quantity;
11224
11226 {
11227 GameInventory destinationInventory = destination_entity.GetInventory();
11229 {
11232 }
11233
11234 if (new_item)
11235 {
11236 new_item.SetResultOfSplit(true);
11237 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11239 new_item.
SetQuantity(split_quantity_new,
false,
true);
11240 }
11241 }
11242 }
11243 else
11244 {
11245 if (stack_max != 0)
11246 {
11248 {
11250 }
11251
11252 if (split_quantity_new == 0)
11253 {
11254 if (!
g_Game.IsMultiplayer())
11255 player.PhysicalPredictiveDropItem(this);
11256 else
11257 player.ServerDropEntity(this);
11258 return;
11259 }
11260
11262 {
11264
11265 if (new_item)
11266 {
11267 new_item.SetResultOfSplit(true);
11268 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11271 new_item.PlaceOnSurface();
11272 }
11273 }
11274 }
11275 }
11276 }
11277
11279 {
11280 float split_quantity_new;
11284 InventoryLocation loc = new InventoryLocation;
11285
11286 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11287 {
11289 split_quantity_new = stack_max;
11290 else
11292
11294 {
11295 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11296 if (new_item)
11297 {
11298 new_item.SetResultOfSplit(true);
11299 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11301 new_item.
SetQuantity(split_quantity_new,
false,
true);
11302 }
11303 }
11304 }
11305 else if (destination_entity && slot_id == -1)
11306 {
11307 if (quantity > stack_max)
11308 split_quantity_new = stack_max;
11309 else
11310 split_quantity_new = quantity;
11311
11313 {
11314 GameInventory destinationInventory = destination_entity.GetInventory();
11316 {
11319 }
11320
11321 if (new_item)
11322 {
11323 new_item.SetResultOfSplit(true);
11324 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11326 new_item.
SetQuantity(split_quantity_new,
false,
true);
11327 }
11328 }
11329 }
11330 else
11331 {
11332 if (stack_max != 0)
11333 {
11335 {
11337 }
11338
11340 {
11342
11343 if (new_item)
11344 {
11345 new_item.SetResultOfSplit(true);
11346 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11349 new_item.PlaceOnSurface();
11350 }
11351 }
11352 }
11353 }
11354 }
11355
11357 {
11359 {
11360 if (ScriptInputUserData.CanStoreInputUserData())
11361 {
11362 ScriptInputUserData ctx = new ScriptInputUserData;
11367 dst.WriteToContext(ctx);
11369 }
11370 }
11371 else if (!
g_Game.IsMultiplayer())
11372 {
11374 }
11375 }
11376
11378 {
11380 {
11381 if (ScriptInputUserData.CanStoreInputUserData())
11382 {
11383 ScriptInputUserData ctx = new ScriptInputUserData;
11388 ctx.
Write(destination_entity);
11394 }
11395 }
11396 else if (!
g_Game.IsMultiplayer())
11397 {
11399 }
11400 }
11401
11403 {
11405 }
11406
11408 {
11410 float split_quantity_new;
11412 if (dst.IsValid())
11413 {
11414 int slot_id = dst.GetSlot();
11416
11417 if (quantity > stack_max)
11418 split_quantity_new = stack_max;
11419 else
11420 split_quantity_new = quantity;
11421
11423 {
11425
11426 if (new_item)
11427 {
11428 new_item.SetResultOfSplit(true);
11429 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11431 new_item.
SetQuantity(split_quantity_new,
false,
true);
11432 }
11433
11434 return new_item;
11435 }
11436 }
11437
11438 return null;
11439 }
11440
11442 {
11444 float split_quantity_new;
11446 if (destination_entity)
11447 {
11449 if (quantity > stackable)
11450 split_quantity_new = stackable;
11451 else
11452 split_quantity_new = quantity;
11453
11455 {
11456 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11457 if (new_item)
11458 {
11459 new_item.SetResultOfSplit(true);
11460 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11462 new_item.
SetQuantity(split_quantity_new,
false,
true);
11463 }
11464 }
11465 }
11466 }
11467
11469 {
11471 {
11472 if (ScriptInputUserData.CanStoreInputUserData())
11473 {
11474 ScriptInputUserData ctx = new ScriptInputUserData;
11479 ItemBase destination_entity =
this;
11480 ctx.
Write(destination_entity);
11484 }
11485 }
11486 else if (!
g_Game.IsMultiplayer())
11487 {
11489 }
11490 }
11491
11493 {
11495 float split_quantity_new;
11497 if (player)
11498 {
11500 if (quantity > stackable)
11501 split_quantity_new = stackable;
11502 else
11503 split_quantity_new = quantity;
11504
11506 {
11507 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11508 new_item =
ItemBase.Cast(in_hands);
11509 if (new_item)
11510 {
11511 new_item.SetResultOfSplit(true);
11512 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11514 new_item.SetQuantity(split_quantity_new, false, true);
11515 }
11516 }
11517 }
11518 }
11519
11521 {
11523 float split_quantity_new = Math.Floor(quantity * 0.5);
11524
11526 return;
11527
11529
11530 if (new_item)
11531 {
11532 if (new_item.GetQuantityMax() < split_quantity_new)
11533 {
11534 split_quantity_new = new_item.GetQuantityMax();
11535 }
11536
11537 new_item.SetResultOfSplit(true);
11538 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11539
11541 {
11544 }
11545 else
11546 {
11548 new_item.
SetQuantity(split_quantity_new,
false,
true);
11549 }
11550 }
11551 }
11552
11554 {
11556 float split_quantity_new = Math.Floor(quantity / 2);
11557
11559 return;
11560
11561 InventoryLocation invloc = new InventoryLocation;
11563
11565 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11566
11567 if (new_item)
11568 {
11569 if (new_item.GetQuantityMax() < split_quantity_new)
11570 {
11571 split_quantity_new = new_item.GetQuantityMax();
11572 }
11574 {
11577 }
11578 else if (split_quantity_new > 1)
11579 {
11581 new_item.
SetQuantity(split_quantity_new,
false,
true);
11582 }
11583 }
11584 }
11585
11588 {
11589 SetWeightDirty();
11591
11592 if (parent)
11593 parent.OnAttachmentQuantityChangedEx(this, delta);
11594
11596 {
11598 {
11600 }
11602 {
11603 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11605 }
11606 }
11607 }
11608
11611 {
11612
11613 }
11614
11617 {
11619 }
11620
11622 {
11623 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11624
11626 {
11627 if (newLevel == GameConstants.STATE_RUINED)
11628 {
11630 EntityAI parent = GetHierarchyParent();
11631 if (parent && parent.IsFireplace())
11632 {
11633 CargoBase cargo = GetInventory().GetCargo();
11634 if (cargo)
11635 {
11637 {
11639 }
11640 }
11641 }
11642 }
11643
11645 {
11646
11648 return;
11649 }
11650
11651 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11652 {
11654 }
11655 }
11656 }
11657
11658
11660 {
11661 super.OnRightClick();
11662
11664 {
11666 {
11667 if (ScriptInputUserData.CanStoreInputUserData())
11668 {
11669 EntityAI root = GetHierarchyRoot();
11670 Man playerOwner = GetHierarchyRootPlayer();
11671 InventoryLocation dst = new InventoryLocation;
11672
11673
11674 if (!playerOwner && root && root == this)
11675 {
11677 }
11678 else
11679 {
11680
11681 GetInventory().GetCurrentInventoryLocation(dst);
11683 {
11684 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11686 {
11688 }
11689 else
11690 {
11692
11693
11694 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11695 {
11697 }
11698 else
11699 {
11700 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11701 }
11702 }
11703 }
11704 }
11705
11706 ScriptInputUserData ctx = new ScriptInputUserData;
11714 }
11715 }
11716 else if (!
g_Game.IsMultiplayer())
11717 {
11719 }
11720 }
11721 }
11722
11724 {
11725 if (root)
11726 {
11727 vector m4[4];
11728 root.GetTransform(m4);
11729 dst.SetGround(this, m4);
11730 }
11731 else
11732 {
11733 GetInventory().GetCurrentInventoryLocation(dst);
11734 }
11735 }
11736
11737 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11738 {
11739
11740 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11741 return false;
11742
11743 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11744 return false;
11745
11746
11748 return false;
11749
11750
11751 Magazine mag = Magazine.Cast(this);
11752 if (mag)
11753 {
11754 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11755 return false;
11756
11757 if (stack_max_limit)
11758 {
11759 Magazine other_mag = Magazine.Cast(other_item);
11760 if (other_item)
11761 {
11762 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11763 return false;
11764 }
11765
11766 }
11767 }
11768 else
11769 {
11770
11772 return false;
11773
11775 return false;
11776 }
11777
11778 PlayerBase player = null;
11779 if (CastTo(player, GetHierarchyRootPlayer()))
11780 {
11781 if (player.GetInventory().HasAttachment(this))
11782 return false;
11783
11784 if (player.IsItemsToDelete())
11785 return false;
11786 }
11787
11788 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11789 return false;
11790
11791 int slotID;
11793 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11794 return false;
11795
11796 return true;
11797 }
11798
11800 {
11802 }
11803
11805 {
11806 return m_IsResultOfSplit;
11807 }
11808
11810 {
11811 m_IsResultOfSplit = value;
11812 }
11813
11815 {
11817 }
11818
11820 {
11821 float other_item_quantity = other_item.GetQuantity();
11822 float this_free_space;
11823
11825
11827
11828 if (other_item_quantity > this_free_space)
11829 {
11830 return this_free_space;
11831 }
11832 else
11833 {
11834 return other_item_quantity;
11835 }
11836 }
11837
11839 {
11841 }
11842
11844 {
11846 return;
11847
11848 if (!IsMagazine() && other_item)
11849 {
11851 if (quantity_used != 0)
11852 {
11853 float hp1 = GetHealth01("","");
11854 float hp2 = other_item.GetHealth01("","");
11855 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11856 hpResult = hpResult / (
GetQuantity() + quantity_used);
11857
11858 hpResult *= GetMaxHealth();
11859 Math.Round(hpResult);
11860 SetHealth("", "Health", hpResult);
11861
11863 other_item.AddQuantity(-quantity_used);
11864 }
11865 }
11867 }
11868
11870 {
11871 #ifdef SERVER
11872 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11873 GetHierarchyParent().IncreaseLifetimeUp();
11874 #endif
11875 };
11876
11878 {
11879 PlayerBase p = PlayerBase.Cast(player);
11880
11881 array<int> recipesIds = p.m_Recipes;
11882 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11883 if (moduleRecipesManager)
11884 {
11885 EntityAI itemInHands = player.GetEntityInHands();
11886 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11887 }
11888
11889 for (int i = 0;i < recipesIds.Count(); i++)
11890 {
11891 int key = recipesIds.Get(i);
11892 string recipeName = moduleRecipesManager.GetRecipeName(key);
11894 }
11895 }
11896
11897
11898 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11899 {
11900 super.GetDebugActions(outputList);
11901
11902
11908
11909
11914
11919
11920
11924
11925
11927 {
11931 }
11932
11935
11936
11940
11942
11943 InventoryLocation loc = new InventoryLocation();
11944 GetInventory().GetCurrentInventoryLocation(loc);
11946 {
11947 if (Gizmo_IsSupported())
11950 }
11951
11953 }
11954
11955
11956
11957
11959 {
11960 super.OnAction(action_id, player, ctx);
11961
11963 {
11964 switch (action_id)
11965 {
11969 return true;
11973 return true;
11974 }
11975 }
11976
11978 {
11979 switch (action_id)
11980 {
11982 Delete();
11983 return true;
11984 }
11985 }
11986
11987 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11988 {
11989 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11990 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11991 PlayerBase p = PlayerBase.Cast(player);
11992 if (
EActions.RECIPES_RANGE_START < 1000)
11993 {
11994 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11995 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11996 }
11997 }
11998 #ifndef SERVER
11999 else if (action_id ==
EActions.WATCH_PLAYER)
12000 {
12001 PluginDeveloper.SetDeveloperItemClientEx(player);
12002 }
12003 #endif
12005 {
12006 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12007 {
12008 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12009 OnDebugButtonPressServer(id + 1);
12010 }
12011
12012 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12013 {
12014 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12016 }
12017
12018 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12019 {
12020 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12022 }
12023
12024 else if (action_id ==
EActions.ADD_QUANTITY)
12025 {
12026 if (IsMagazine())
12027 {
12028 Magazine mag = Magazine.Cast(this);
12029 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12030 }
12031 else
12032 {
12034 }
12035
12036 if (m_EM)
12037 {
12038 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12039 }
12040
12041 }
12042
12043 else if (action_id ==
EActions.REMOVE_QUANTITY)
12044 {
12045 if (IsMagazine())
12046 {
12047 Magazine mag2 = Magazine.Cast(this);
12048 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12049 }
12050 else
12051 {
12053 }
12054 if (m_EM)
12055 {
12056 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12057 }
12058
12059 }
12060
12061 else if (action_id ==
EActions.SET_QUANTITY_0)
12062 {
12064
12065 if (m_EM)
12066 {
12067 m_EM.SetEnergy(0);
12068 }
12069 }
12070
12071 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12072 {
12074
12075 if (m_EM)
12076 {
12077 m_EM.SetEnergy(m_EM.GetEnergyMax());
12078 }
12079 }
12080
12081 else if (action_id ==
EActions.ADD_HEALTH)
12082 {
12083 AddHealth("","",GetMaxHealth("","Health")/5);
12084 }
12085 else if (action_id ==
EActions.REMOVE_HEALTH)
12086 {
12087 AddHealth("","",-GetMaxHealth("","Health")/5);
12088 }
12089 else if (action_id ==
EActions.DESTROY_HEALTH)
12090 {
12091 SetHealth01("","",0);
12092 }
12093 else if (action_id ==
EActions.WATCH_ITEM)
12094 {
12096 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12097 #ifdef DEVELOPER
12098 SetDebugDeveloper_item(this);
12099 #endif
12100 }
12101
12102 else if (action_id ==
EActions.ADD_TEMPERATURE)
12103 {
12104 AddTemperature(20);
12105
12106 }
12107
12108 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12109 {
12110 AddTemperature(-20);
12111
12112 }
12113
12114 else if (action_id ==
EActions.FLIP_FROZEN)
12115 {
12116 SetFrozen(!GetIsFrozen());
12117
12118 }
12119
12120 else if (action_id ==
EActions.ADD_WETNESS)
12121 {
12123
12124 }
12125
12126 else if (action_id ==
EActions.REMOVE_WETNESS)
12127 {
12129
12130 }
12131
12132 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12133 {
12136
12137
12138 }
12139
12140 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12141 {
12144 }
12145
12146 else if (action_id ==
EActions.MAKE_SPECIAL)
12147 {
12148 auto debugParams = DebugSpawnParams.WithPlayer(player);
12149 OnDebugSpawnEx(debugParams);
12150 }
12151
12152 }
12153
12154
12155 return false;
12156 }
12157
12158
12159
12160
12164
12167
12168
12169
12171 {
12172 return false;
12173 }
12174
12175
12177 {
12178 return true;
12179 }
12180
12181
12183 {
12184 return true;
12185 }
12186
12187
12188
12190 {
12191 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12192 return g_Game.ConfigIsExisting(config_path);
12193 }
12194
12197 {
12198 return null;
12199 }
12200
12202 {
12203 return false;
12204 }
12205
12207 {
12208 return false;
12209 }
12210
12214
12215
12217 {
12218 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12219 return module_repairing.CanRepair(this, item_repair_kit);
12220 }
12221
12222
12223 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12224 {
12225 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12226 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12227 }
12228
12229
12231 {
12232
12233
12234
12235
12236
12237
12238
12239
12240 return 1;
12241 }
12242
12243
12244
12246 {
12248 }
12249
12250
12251
12253 {
12255 }
12256
12257
12266 {
12267 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12268
12269 if (player)
12270 {
12271 player.MessageStatus(text);
12272 }
12273 }
12274
12275
12284 {
12285 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12286
12287 if (player)
12288 {
12289 player.MessageAction(text);
12290 }
12291 }
12292
12293
12302 {
12303 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12304
12305 if (player)
12306 {
12307 player.MessageFriendly(text);
12308 }
12309 }
12310
12311
12320 {
12321 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12322
12323 if (player)
12324 {
12325 player.MessageImportant(text);
12326 }
12327 }
12328
12330 {
12331 return true;
12332 }
12333
12334
12335 override bool KindOf(
string tag)
12336 {
12337 bool found = false;
12338 string item_name = this.
GetType();
12340 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12341
12342 int array_size = item_tag_array.Count();
12343 for (int i = 0; i < array_size; i++)
12344 {
12345 if (item_tag_array.Get(i) == tag)
12346 {
12347 found = true;
12348 break;
12349 }
12350 }
12351 return found;
12352 }
12353
12354
12356 {
12357
12358 super.OnRPC(sender, rpc_type,ctx);
12359
12360
12361 switch (rpc_type)
12362 {
12363 #ifndef SERVER
12364 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12365 Param2<bool, string> p = new Param2<bool, string>(false, "");
12366
12368 return;
12369
12370 bool play = p.param1;
12371 string soundSet = p.param2;
12372
12373 if (play)
12374 {
12376 {
12378 {
12380 }
12381 }
12382 else
12383 {
12385 }
12386 }
12387 else
12388 {
12390 }
12391
12392 break;
12393 #endif
12394
12395 }
12396
12398 {
12400 }
12401 }
12402
12403
12404
12405
12407 {
12408 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12409 return plugin.GetID(
name);
12410 }
12411
12413 {
12414 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12415 return plugin.GetName(id);
12416 }
12417
12420 {
12421
12422
12423 int varFlags;
12424 if (!ctx.
Read(varFlags))
12425 return;
12426
12427 if (varFlags & ItemVariableFlags.FLOAT)
12428 {
12430 }
12431 }
12432
12434 {
12435
12436 super.SerializeNumericalVars(floats_out);
12437
12438
12439
12441 {
12443 }
12444
12446 {
12448 }
12449
12451 {
12453 }
12454
12456 {
12461 }
12462
12464 {
12466 }
12467 }
12468
12470 {
12471
12472 super.DeSerializeNumericalVars(floats);
12473
12474
12475 int index = 0;
12476 int mask = Math.Round(floats.Get(index));
12477
12478 index++;
12479
12481 {
12483 {
12485 }
12486 else
12487 {
12488 float quantity = floats.Get(index);
12489 SetQuantity(quantity,
true,
false,
false,
false);
12490 }
12491 index++;
12492 }
12493
12495 {
12496 float wet = floats.Get(index);
12498 index++;
12499 }
12500
12502 {
12503 int liquidtype = Math.Round(floats.Get(index));
12505 index++;
12506 }
12507
12509 {
12511 index++;
12513 index++;
12515 index++;
12517 index++;
12518 }
12519
12521 {
12522 int cleanness = Math.Round(floats.Get(index));
12524 index++;
12525 }
12526 }
12527
12529 {
12530 super.WriteVarsToCTX(ctx);
12531
12532
12534 {
12536 }
12537
12539 {
12541 }
12542
12544 {
12546 }
12547
12549 {
12550 int r,g,b,a;
12556 }
12557
12559 {
12561 }
12562 }
12563
12565 {
12566 if (!super.ReadVarsFromCTX(ctx,version))
12567 return false;
12568
12569 int intValue;
12570 float value;
12571
12572 if (version < 140)
12573 {
12574 if (!ctx.
Read(intValue))
12575 return false;
12576
12577 m_VariablesMask = intValue;
12578 }
12579
12581 {
12582 if (!ctx.
Read(value))
12583 return false;
12584
12586 {
12588 }
12589 else
12590 {
12592 }
12593 }
12594
12595 if (version < 140)
12596 {
12598 {
12599 if (!ctx.
Read(value))
12600 return false;
12601 SetTemperatureDirect(value);
12602 }
12603 }
12604
12606 {
12607 if (!ctx.
Read(value))
12608 return false;
12610 }
12611
12613 {
12614 if (!ctx.
Read(intValue))
12615 return false;
12617 }
12618
12620 {
12621 int r,g,b,a;
12623 return false;
12625 return false;
12627 return false;
12629 return false;
12630
12632 }
12633
12635 {
12636 if (!ctx.
Read(intValue))
12637 return false;
12639 }
12640
12641 if (version >= 138 && version < 140)
12642 {
12644 {
12645 if (!ctx.
Read(intValue))
12646 return false;
12647 SetFrozen(intValue);
12648 }
12649 }
12650
12651 return true;
12652 }
12653
12654
12656 {
12659 {
12661 }
12662
12663 if (!super.OnStoreLoad(ctx, version))
12664 {
12666 return false;
12667 }
12668
12669 if (version >= 114)
12670 {
12671 bool hasQuickBarIndexSaved;
12672
12673 if (!ctx.
Read(hasQuickBarIndexSaved))
12674 {
12676 return false;
12677 }
12678
12679 if (hasQuickBarIndexSaved)
12680 {
12681 int itmQBIndex;
12682
12683
12684 if (!ctx.
Read(itmQBIndex))
12685 {
12687 return false;
12688 }
12689
12690 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12691 if (itmQBIndex != -1 && parentPlayer)
12692 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12693 }
12694 }
12695 else
12696 {
12697
12698 PlayerBase player;
12699 int itemQBIndex;
12700 if (version ==
int.
MAX)
12701 {
12702 if (!ctx.
Read(itemQBIndex))
12703 {
12705 return false;
12706 }
12707 }
12708 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12709 {
12710
12711 if (!ctx.
Read(itemQBIndex))
12712 {
12714 return false;
12715 }
12716 if (itemQBIndex != -1 && player)
12717 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12718 }
12719 }
12720
12721 if (version < 140)
12722 {
12723
12724 if (!LoadVariables(ctx, version))
12725 {
12727 return false;
12728 }
12729 }
12730
12731
12733 {
12735 return false;
12736 }
12737 if (version >= 132)
12738 {
12740 if (raib)
12741 {
12743 {
12745 return false;
12746 }
12747 }
12748 }
12749
12751 return true;
12752 }
12753
12754
12755
12757 {
12758 super.OnStoreSave(ctx);
12759
12760 PlayerBase player;
12761 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12762 {
12764
12765 int itemQBIndex = -1;
12766 itemQBIndex = player.FindQuickBarEntityIndex(this);
12767 ctx.
Write(itemQBIndex);
12768 }
12769 else
12770 {
12772 }
12773
12775
12777 if (raib)
12778 {
12780 }
12781 }
12782
12783
12785 {
12786 super.AfterStoreLoad();
12787
12789 {
12791 }
12792
12794 {
12797 }
12798 }
12799
12801 {
12802 super.EEOnAfterLoad();
12803
12805 {
12807 }
12808
12811 }
12812
12814 {
12815 return false;
12816 }
12817
12818
12819
12821 {
12823 {
12824 #ifdef PLATFORM_CONSOLE
12825
12827 {
12829 if (menu)
12830 {
12832 }
12833 }
12834 #endif
12835 }
12836
12838 {
12841 }
12842
12844 {
12845 SetWeightDirty();
12847 }
12849 {
12852 }
12853
12855 {
12858
12861 }
12863 {
12867 }
12868
12869 super.OnVariablesSynchronized();
12870 }
12871
12872
12873
12875 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12876 {
12877 if (!IsServerCheck(allow_client))
12878 return false;
12879
12881 return false;
12882
12885
12886 if (value <= (min + 0.001))
12887 value = min;
12888
12889 if (value == min)
12890 {
12891 if (destroy_config)
12892 {
12893 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12894 if (dstr)
12895 {
12897 this.Delete();
12898 return true;
12899 }
12900 }
12901 else if (destroy_forced)
12902 {
12904 this.Delete();
12905 return true;
12906 }
12907
12909 }
12910
12913
12915 {
12916 EntityAI parent = GetHierarchyRoot();
12917 InventoryLocation iLoc = new InventoryLocation();
12918 GetInventory().GetCurrentInventoryLocation(iLoc);
12920 {
12921 int iLocSlot = iLoc.
GetSlot();
12923 {
12925 }
12927 {
12929 }
12930 }
12931 }
12932
12934 {
12936
12937 if (delta)
12939 }
12940
12942
12943 return false;
12944 }
12945
12946
12948 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12949 {
12951 }
12952
12954 {
12957 }
12958
12960 {
12963 }
12964
12966 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12967 {
12968 float value_clamped = Math.Clamp(value, 0, 1);
12970 SetQuantity(result, destroy_config, destroy_forced);
12971 }
12972
12973
12976 {
12978 }
12979
12981 {
12983 }
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12995 {
12996 int slot = -1;
12997 GameInventory inventory = GetInventory();
12998 if (inventory)
12999 {
13000 InventoryLocation il = new InventoryLocation;
13003 }
13004
13006 }
13007
13009 {
13010 float quantity_max = 0;
13011
13013 {
13014 if (attSlotID != -1)
13015 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13016
13017 if (quantity_max <= 0)
13019 }
13020
13021 if (quantity_max <= 0)
13023
13024 return quantity_max;
13025 }
13026
13028 {
13030 }
13031
13033 {
13035 }
13036
13037
13039 {
13041 }
13042
13044 {
13046 }
13047
13049 {
13051 }
13052
13053
13055 {
13056
13057 float weightEx = GetWeightEx();
13058 float special = GetInventoryAndCargoWeight();
13059 return weightEx - special;
13060 }
13061
13062
13064 {
13066 }
13067
13069 {
13071 {
13072 #ifdef DEVELOPER
13073 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13074 {
13075 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13077 }
13078 #endif
13079
13080 return GetQuantity() * GetConfigWeightModified();
13081 }
13082 else if (HasEnergyManager())
13083 {
13084 #ifdef DEVELOPER
13085 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13086 {
13087 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13088 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13089 }
13090 #endif
13091 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13092 }
13093 else
13094 {
13095 #ifdef DEVELOPER
13096 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13097 {
13098 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13099 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13100 }
13101 #endif
13102 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13103 }
13104 }
13105
13108 {
13109 int item_count = 0;
13111
13112 GameInventory inventory = GetInventory();
13113 CargoBase cargo = inventory.
GetCargo();
13114 if (cargo != NULL)
13115 {
13117 }
13118
13120 for (int i = 0; i < nAttachments; ++i)
13121 {
13123 if (item)
13124 item_count += item.GetNumberOfItems();
13125 }
13126 return item_count;
13127 }
13128
13131 {
13132 float weight = 0;
13133 float wetness = 1;
13134 if (include_wetness)
13137 {
13138 weight = wetness * m_ConfigWeight;
13139 }
13141 {
13142 weight = 1;
13143 }
13144 return weight;
13145 }
13146
13147
13148
13150 {
13151 GameInventory inventory = GetInventory();
13152 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13153 {
13154 array<EntityAI> items = new array<EntityAI>;
13156 for (int i = 0; i < items.Count(); ++i)
13157 {
13159 if (item)
13160 {
13161 g_Game.ObjectDelete(item);
13162 }
13163 }
13164 }
13165 }
13166
13167
13168
13169
13171 {
13172 float energy = 0;
13173 if (HasEnergyManager())
13174 {
13175 energy = GetCompEM().GetEnergy();
13176 }
13177 return energy;
13178 }
13179
13180
13182 {
13183 super.OnEnergyConsumed();
13184
13186 }
13187
13189 {
13190 super.OnEnergyAdded();
13191
13193 }
13194
13195
13197 {
13198 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13199 {
13201 {
13202 float energy_0to1 = GetCompEM().GetEnergy0To1();
13204 }
13205 }
13206 }
13207
13208
13210 {
13211 return ConfigGetFloat("heatIsolation");
13212 }
13213
13215 {
13217 }
13218
13220 {
13221 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13222 if (
g_Game.ConfigIsExisting(paramPath))
13223 return g_Game.ConfigGetFloat(paramPath);
13224
13225 return 0.0;
13226 }
13227
13229 {
13230 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13231 if (
g_Game.ConfigIsExisting(paramPath))
13232 return g_Game.ConfigGetFloat(paramPath);
13233
13234 return 0.0;
13235 }
13236
13237 override void SetWet(
float value,
bool allow_client =
false)
13238 {
13239 if (!IsServerCheck(allow_client))
13240 return;
13241
13244
13246
13247 m_VarWet = Math.Clamp(value, min, max);
13248
13250 {
13253 }
13254 }
13255
13256 override void AddWet(
float value)
13257 {
13259 }
13260
13262 {
13264 }
13265
13267 {
13269 }
13270
13272 {
13274 }
13275
13277 {
13279 }
13280
13282 {
13284 }
13285
13286 override void OnWetChanged(
float newVal,
float oldVal)
13287 {
13290 if (newLevel != oldLevel)
13291 {
13293 }
13294 }
13295
13297 {
13298 SetWeightDirty();
13299 }
13300
13302 {
13303 return GetWetLevelInternal(
m_VarWet);
13304 }
13305
13306
13307
13309 {
13311 }
13312
13314 {
13316 }
13317
13319 {
13321 }
13322
13324 {
13326 }
13327
13328
13329
13331 {
13332 if (ConfigIsExisting("itemModelLength"))
13333 {
13334 return ConfigGetFloat("itemModelLength");
13335 }
13336 return 0;
13337 }
13338
13340 {
13341 if (ConfigIsExisting("itemAttachOffset"))
13342 {
13343 return ConfigGetFloat("itemAttachOffset");
13344 }
13345 return 0;
13346 }
13347
13348 override void SetCleanness(
int value,
bool allow_client =
false)
13349 {
13350 if (!IsServerCheck(allow_client))
13351 return;
13352
13354
13356
13359 }
13360
13362 {
13364 }
13365
13367 {
13368 return true;
13369 }
13370
13371
13372
13373
13375 {
13377 }
13378
13380 {
13382 }
13383
13384
13385
13386
13387 override void SetColor(
int r,
int g,
int b,
int a)
13388 {
13394 }
13396 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13397 {
13402 }
13403
13405 {
13407 }
13408
13411 {
13412 int r,g,b,a;
13414 r = r/255;
13415 g = g/255;
13416 b = b/255;
13417 a = a/255;
13418 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13419 }
13420
13421
13422
13423 override void SetLiquidType(
int value,
bool allow_client =
false)
13424 {
13425 if (!IsServerCheck(allow_client))
13426 return;
13427
13432 }
13433
13435 {
13436 return ConfigGetInt("varLiquidTypeInit");
13437 }
13438
13440 {
13442 }
13443
13445 {
13447 SetFrozen(false);
13448 }
13449
13452 {
13453 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13454 }
13455
13456
13459 {
13460 PlayerBase nplayer;
13461 if (PlayerBase.CastTo(nplayer, player))
13462 {
13464 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13465 }
13466 }
13467
13468
13471 {
13472 PlayerBase nplayer;
13473 if (PlayerBase.CastTo(nplayer,player))
13474 {
13475 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13476 }
13477
13478 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13479
13480 if (HasEnergyManager())
13481 {
13482 GetCompEM().UpdatePlugState();
13483 }
13484 }
13485
13486
13488 {
13489 super.OnPlacementStarted(player);
13490
13492 }
13493
13494 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13495 {
13497 {
13498 m_AdminLog.OnPlacementComplete(player,
this);
13499 }
13500
13501 super.OnPlacementComplete(player, position, orientation);
13502 }
13503
13504
13505
13506
13507
13509 {
13511 {
13512 return true;
13513 }
13514 else
13515 {
13516 return false;
13517 }
13518 }
13519
13520
13522 {
13524 {
13526 }
13527 }
13528
13529
13531 {
13533 }
13534
13536 {
13538 }
13539
13540 override void InsertAgent(
int agent,
float count = 1)
13541 {
13542 if (count < 1)
13543 return;
13544
13546 }
13547
13550 {
13552 }
13553
13554
13556 {
13558 }
13559
13560
13561
13562
13563
13564
13565
13566
13567
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
13602 {
13604 return false;
13605 return true;
13606 }
13607
13609 {
13610
13612 }
13613
13614
13617 {
13618 super.CheckForRoofLimited(timeTresholdMS);
13619
13620 float time =
g_Game.GetTime();
13621 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13622 {
13623 m_PreviousRoofTestTime = time;
13624 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13625 }
13626 }
13627
13628
13630 {
13632 {
13633 return 0;
13634 }
13635
13636 if (GetInventory().GetAttachmentSlotsCount() != 0)
13637 {
13638 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13639 if (filter)
13640 return filter.GetProtectionLevel(type, false, system);
13641 else
13642 return 0;
13643 }
13644
13645 string subclassPath, entryName;
13646
13647 switch (type)
13648 {
13650 entryName = "biological";
13651 break;
13653 entryName = "chemical";
13654 break;
13655 default:
13656 entryName = "biological";
13657 break;
13658 }
13659
13660 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13661
13662 return g_Game.ConfigGetFloat(subclassPath + entryName);
13663 }
13664
13665
13666
13669 {
13670 if (!IsMagazine())
13672
13674 }
13675
13676
13677
13678
13679
13684 {
13685 return true;
13686 }
13687
13689 {
13691 }
13692
13693
13694
13695
13696
13698 {
13699 if (parent)
13700 {
13701 if (parent.IsInherited(DayZInfected))
13702 return true;
13703
13704 if (!parent.IsRuined())
13705 return true;
13706 }
13707
13708 return true;
13709 }
13710
13712 {
13713 if (!super.CanPutAsAttachment(parent))
13714 {
13715 return false;
13716 }
13717
13718 if (!IsRuined() && !parent.IsRuined())
13719 {
13720 return true;
13721 }
13722
13723 return false;
13724 }
13725
13727 {
13728
13729
13730
13731
13732 return super.CanReceiveItemIntoCargo(item);
13733 }
13734
13736 {
13737
13738
13739
13740
13741 GameInventory attachmentInv = attachment.GetInventory();
13743 {
13744 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13745 return false;
13746 }
13747
13748 InventoryLocation loc = new InventoryLocation();
13749 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13750 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13751 return false;
13752
13753 return super.CanReceiveAttachment(attachment, slotId);
13754 }
13755
13757 {
13758 if (!super.CanReleaseAttachment(attachment))
13759 return false;
13760
13761 return GetInventory().AreChildrenAccessible();
13762 }
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13785 {
13786 int id = muzzle_owner.GetMuzzleID();
13787 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13788
13789 if (WPOF_array)
13790 {
13791 for (int i = 0; i < WPOF_array.Count(); i++)
13792 {
13793 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13794
13795 if (WPOF)
13796 {
13797 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13798 }
13799 }
13800 }
13801 }
13802
13803
13805 {
13806 int id = muzzle_owner.GetMuzzleID();
13808
13809 if (WPOBE_array)
13810 {
13811 for (int i = 0; i < WPOBE_array.Count(); i++)
13812 {
13813 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13814
13815 if (WPOBE)
13816 {
13817 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13818 }
13819 }
13820 }
13821 }
13822
13823
13825 {
13826 int id = muzzle_owner.GetMuzzleID();
13827 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13828
13829 if (WPOOH_array)
13830 {
13831 for (int i = 0; i < WPOOH_array.Count(); i++)
13832 {
13833 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13834
13835 if (WPOOH)
13836 {
13837 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13838 }
13839 }
13840 }
13841 }
13842
13843
13845 {
13846 int id = muzzle_owner.GetMuzzleID();
13847 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13848
13849 if (WPOOH_array)
13850 {
13851 for (int i = 0; i < WPOOH_array.Count(); i++)
13852 {
13853 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13854
13855 if (WPOOH)
13856 {
13857 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13858 }
13859 }
13860 }
13861 }
13862
13863
13865 {
13866 int id = muzzle_owner.GetMuzzleID();
13867 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13868
13869 if (WPOOH_array)
13870 {
13871 for (int i = 0; i < WPOOH_array.Count(); i++)
13872 {
13873 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13874
13875 if (WPOOH)
13876 {
13877 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13878 }
13879 }
13880 }
13881 }
13882
13883
13884
13886 {
13888 {
13889 return true;
13890 }
13891
13892 return false;
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 {
13917 return false;
13918 }
13919
13922 {
13923 return UATimeSpent.DEFAULT_DEPLOY;
13924 }
13925
13926
13927
13928
13930 {
13932 SetSynchDirty();
13933 }
13934
13936 {
13938 }
13939
13940
13942 {
13943 return false;
13944 }
13945
13948 {
13949 string att_type = "None";
13950
13951 if (ConfigIsExisting("soundAttType"))
13952 {
13953 att_type = ConfigGetString("soundAttType");
13954 }
13955
13957 }
13958
13960 {
13962 }
13963
13964
13965
13966
13967
13973
13975 {
13978
13980 }
13981
13982
13984 {
13986 return;
13987
13989
13992
13995
13996 SoundParameters params = new SoundParameters();
14000 }
14001
14002
14004 {
14006 {
14009
14010 SetSynchDirty();
14011
14014 }
14015 }
14016
14018 {
14020 }
14021
14022
14024 {
14026 return;
14027
14029 SetSynchDirty();
14030
14033 }
14034
14036 {
14039 }
14040
14042 {
14044 }
14045
14046 void OnApply(PlayerBase player);
14047
14049 {
14050 return 1.0;
14051 };
14052
14054 {
14056 }
14057
14059 {
14061 }
14062
14064
14066 {
14067 SetDynamicPhysicsLifeTime(0.01);
14069 }
14070
14072 {
14073 array<string> zone_names = new array<string>;
14074 GetDamageZones(zone_names);
14075 for (int i = 0; i < zone_names.Count(); i++)
14076 {
14077 SetHealthMax(zone_names.Get(i),"Health");
14078 }
14079 SetHealthMax("","Health");
14080 }
14081
14084 {
14085 float global_health = GetHealth01("","Health");
14086 array<string> zones = new array<string>;
14087 GetDamageZones(zones);
14088
14089 for (int i = 0; i < zones.Count(); i++)
14090 {
14091 SetHealth01(zones.Get(i),"Health",global_health);
14092 }
14093 }
14094
14097 {
14098 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14099 }
14100
14102 {
14103 if (!hasRootAsPlayer)
14104 {
14105 if (refParentIB)
14106 {
14107
14108 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14109 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14110
14111 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14112 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14113
14116 }
14117 else
14118 {
14119
14122 }
14123 }
14124 }
14125
14127 {
14129 {
14130 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14131 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14132 {
14133 float heatPermCoef = 1.0;
14135 while (ent)
14136 {
14137 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14138 ent = ent.GetHierarchyParent();
14139 }
14140
14141 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14142 }
14143 }
14144 }
14145
14147 {
14148
14149 EntityAI parent = GetHierarchyParent();
14150 if (!parent)
14151 {
14152 hasParent = false;
14153 hasRootAsPlayer = false;
14154 }
14155 else
14156 {
14157 hasParent = true;
14158 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14159 refParentIB =
ItemBase.Cast(parent);
14160 }
14161 }
14162
14163 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14164 {
14165
14166 }
14167
14169 {
14170
14171 return false;
14172 }
14173
14175 {
14176
14177
14178 return false;
14179 }
14180
14182 {
14183
14184 return false;
14185 }
14186
14189 {
14190 return !GetIsFrozen() &&
IsOpen();
14191 }
14192
14194 {
14195 bool hasParent = false, hasRootAsPlayer = false;
14197
14198 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14199 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14200
14201 if (wwtu || foodDecay)
14202 {
14206
14207 if (processWetness || processTemperature || processDecay)
14208 {
14210
14211 if (processWetness)
14212 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14213
14214 if (processTemperature)
14216
14217 if (processDecay)
14218 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14219 }
14220 }
14221 }
14222
14225 {
14227 }
14228
14230 {
14233
14234 return super.GetTemperatureFreezeThreshold();
14235 }
14236
14238 {
14241
14242 return super.GetTemperatureThawThreshold();
14243 }
14244
14246 {
14249
14250 return super.GetItemOverheatThreshold();
14251 }
14252
14254 {
14256 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14257
14258 return super.GetTemperatureFreezeTime();
14259 }
14260
14262 {
14264 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14265
14266 return super.GetTemperatureThawTime();
14267 }
14268
14273
14275 {
14276 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14277 }
14278
14280 {
14281 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14282 }
14283
14286 {
14288 }
14289
14291 {
14293 }
14294
14296 {
14298 }
14299
14302 {
14303 return null;
14304 }
14305
14308 {
14309 return false;
14310 }
14311
14313 {
14315 {
14318 if (!trg)
14319 {
14321 explosive = this;
14322 }
14323
14324 explosive.PairRemote(trg);
14326
14327 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14328 trg.SetPersistentPairID(persistentID);
14329 explosive.SetPersistentPairID(persistentID);
14330
14331 return true;
14332 }
14333 return false;
14334 }
14335
14338 {
14339 float ret = 1.0;
14342 ret *= GetHealth01();
14343
14344 return ret;
14345 }
14346
14347 #ifdef DEVELOPER
14348 override void SetDebugItem()
14349 {
14350 super.SetDebugItem();
14351 _itemBase = this;
14352 }
14353
14355 {
14356 string text = super.GetDebugText();
14357
14359 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14360
14361 return text;
14362 }
14363 #endif
14364
14366 {
14367 return true;
14368 }
14369
14371
14373
14375 {
14378 }
14379
14380
14388
14404
14405 [
Obsolete(
"Use ItemSoundHandler instead")]
14408 {
14409 if (!
g_Game.IsDedicatedServer())
14410 {
14411 if (ConfigIsExisting("attachSoundSet"))
14412 {
14413 string cfg_path = "";
14414 string soundset = "";
14415 string type_name =
GetType();
14416
14419 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14420 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14421
14422 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14423 {
14424 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14425 {
14426 if (cfg_slot_array[i] == slot_type)
14427 {
14428 soundset = cfg_soundset_array[i];
14429 break;
14430 }
14431 }
14432 }
14433
14434 if (soundset != "")
14435 {
14436 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14438 }
14439 }
14440 }
14441 }
14442
14444}
14445
14447{
14449 if (entity)
14450 {
14451 bool is_item = entity.IsInherited(
ItemBase);
14452 if (is_item && full_quantity)
14453 {
14456 }
14457 }
14458 else
14459 {
14461 return NULL;
14462 }
14463 return entity;
14464}
14465
14467{
14468 if (item)
14469 {
14470 if (health > 0)
14471 item.SetHealth("", "", health);
14472
14473 if (item.CanHaveTemperature())
14474 {
14476 if (item.CanFreeze())
14477 item.SetFrozen(false);
14478 }
14479
14480 if (item.HasEnergyManager())
14481 {
14482 if (quantity >= 0)
14483 {
14484 item.GetCompEM().SetEnergy0To1(quantity);
14485 }
14486 else
14487 {
14489 }
14490 }
14491 else if (item.IsMagazine())
14492 {
14493 Magazine mag = Magazine.Cast(item);
14494 if (quantity >= 0)
14495 {
14496 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14497 }
14498 else
14499 {
14501 }
14502
14503 }
14504 else
14505 {
14506 if (quantity >= 0)
14507 {
14508 item.SetQuantityNormalized(quantity, false);
14509 }
14510 else
14511 {
14513 }
14514
14515 }
14516 }
14517}
14518
14519#ifdef DEVELOPER
14521#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.