9506{
9508 {
9509 return true;
9510 }
9511};
9512
9514{
9515
9516};
9517
9518
9519
9521{
9525
9527
9530
9531
9532
9533
9534
9543
9549
9554
9559
9580 protected bool m_IsResultOfSplit
9581
9583
9588
9589
9590
9592
9596
9597
9598
9600
9603
9604
9605
9611
9612
9620
9623
9624
9626
9627
9629
9630
9635
9636
9641
9643
9644
9646
9647
9649 {
9654
9655 if (!
g_Game.IsDedicatedServer())
9656 {
9658 {
9660
9662 {
9664 }
9665 }
9666
9669 }
9670
9671 m_OldLocation = null;
9672
9674 {
9676 }
9677
9678 if (ConfigIsExisting("headSelectionsToHide"))
9679 {
9682 }
9683
9685 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9686 {
9688 }
9689
9691
9692 m_IsResultOfSplit = false;
9693
9695 }
9696
9698 {
9699 super.InitItemVariables();
9700
9706 m_Count = ConfigGetInt(
"count");
9707
9710
9715
9718
9723
9735
9739
9740
9743 if (ConfigIsExisting("canBeSplit"))
9744 {
9747 }
9748
9750 if (ConfigIsExisting("itemBehaviour"))
9752
9753
9756 RegisterNetSyncVariableInt("m_VarLiquidType");
9757 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9758
9759 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9760 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9761 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9762
9763 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9764 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9765 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9766 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9767
9768 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9769 RegisterNetSyncVariableBool("m_IsTakeable");
9770 RegisterNetSyncVariableBool("m_IsHologram");
9771
9774 {
9777 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9778 }
9779
9781
9783 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9785
9787 }
9788
9790 {
9792 }
9793
9795 {
9798 {
9803 }
9804 }
9805
9806 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9807 {
9809 {
9812 }
9813
9815 }
9816
9818 {
9824 }
9825
9827
9829 {
9831
9832 if (!action)
9833 {
9834 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9835 return;
9836 }
9837
9839 if (!ai)
9840 {
9842 return;
9843 }
9844
9846 if (!action_array)
9847 {
9848 action_array = new array<ActionBase_Basic>;
9850 }
9851 if (LogManager.IsActionLogEnable())
9852 {
9853 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9854 }
9855
9856 if (action_array.Find(action) != -1)
9857 {
9858 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9859 }
9860 else
9861 {
9862 action_array.Insert(action);
9863 }
9864 }
9865
9867 {
9868 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9869 ActionBase action = player.GetActionManager().GetAction(actionName);
9872
9873 if (action_array)
9874 {
9875 action_array.RemoveItem(action);
9876 }
9877 }
9878
9879
9880
9882 {
9883 ActionOverrideData overrideData = new ActionOverrideData();
9887
9889 if (!actionMap)
9890 {
9893 }
9894
9895 actionMap.Insert(this.
Type(), overrideData);
9896
9897 }
9898
9900
9902
9903
9905 {
9908
9911
9912 string config_to_search = "CfgVehicles";
9913 string muzzle_owner_config;
9914
9916 {
9917 if (IsInherited(Weapon))
9918 config_to_search = "CfgWeapons";
9919
9920 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9921
9922 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9923
9924 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9925
9926 if (config_OnFire_subclass_count > 0)
9927 {
9928 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9929
9930 for (int i = 0; i < config_OnFire_subclass_count; i++)
9931 {
9932 string particle_class = "";
9933 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9934 string config_OnFire_entry = config_OnFire_class + particle_class;
9935 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9936 WPOF_array.Insert(WPOF);
9937 }
9938
9939
9941 }
9942 }
9943
9945 {
9946 config_to_search = "CfgWeapons";
9947 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9948
9949 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9950
9951 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9952
9953 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9954 {
9955 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9956
9957 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9958 {
9959 string particle_class2 = "";
9960 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9961 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9962 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9963 WPOBE_array.Insert(WPOBE);
9964 }
9965
9966
9968 }
9969 }
9970 }
9971
9972
9974 {
9977
9979 {
9980 string config_to_search = "CfgVehicles";
9981
9982 if (IsInherited(Weapon))
9983 config_to_search = "CfgWeapons";
9984
9985 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9986 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9987
9988 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9989 {
9990
9992
9994 {
9996 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9998 return;
9999 }
10000
10003
10004
10005
10006 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10007 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10008
10009 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10010 {
10011 string particle_class = "";
10012 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10013 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10014 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10015
10016 if (entry_type == CT_CLASS)
10017 {
10018 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10019 WPOOH_array.Insert(WPOF);
10020 }
10021 }
10022
10023
10025 }
10026 }
10027 }
10028
10030 {
10032 }
10033
10035 {
10037 {
10039
10042
10045
10046 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10047 }
10048 }
10049
10051 {
10053 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10054
10056 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10057
10059 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10060
10062 {
10064 }
10065 }
10066
10068 {
10070 }
10071
10073 {
10076 else
10078
10080 {
10083 }
10084 else
10085 {
10088
10091 }
10092
10094 }
10095
10097 {
10099 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10100 }
10101
10103 {
10105 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10107 }
10108
10110 {
10112 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10113 }
10114
10116 {
10119
10120 OverheatingParticle OP = new OverheatingParticle();
10125
10127 }
10128
10130 {
10133
10134 return -1;
10135 }
10136
10138 {
10140 {
10143
10144 for (int i = count; i > 0; --i)
10145 {
10146 int id = i - 1;
10149
10152
10153 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10154 {
10155 if (p)
10156 {
10159 }
10160 }
10161 }
10162 }
10163 }
10164
10166 {
10168 {
10170 {
10171 int id = i - 1;
10173
10174 if (OP)
10175 {
10177
10178 if (p)
10179 {
10181 }
10182
10183 delete OP;
10184 }
10185 }
10186
10189 }
10190 }
10191
10194 {
10195 return 0.0;
10196 }
10197
10198
10200 {
10201 return 250;
10202 }
10203
10205 {
10206 return 0;
10207 }
10208
10211 {
10213 return true;
10214
10215 return false;
10216 }
10217
10220 {
10223
10225 {
10227 }
10228 else
10229 {
10230
10232 }
10233
10235 }
10236
10243 {
10244 return -1;
10245 }
10246
10247
10248
10249
10251 {
10253 {
10254 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10255 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10256
10257 if (r_index >= 0)
10258 {
10259 InventoryLocation r_il = new InventoryLocation;
10260 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10261
10262 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10265 {
10266 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10267 }
10269 {
10270 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10271 }
10272
10273 }
10274
10275 player.GetHumanInventory().ClearUserReservedLocation(this);
10276 }
10277
10280 }
10281
10282
10283
10284
10286 {
10287 return ItemBase.m_DebugActionsMask;
10288 }
10289
10291 {
10292 return ItemBase.m_DebugActionsMask & mask;
10293 }
10294
10296 {
10297 ItemBase.m_DebugActionsMask = mask;
10298 }
10299
10301 {
10302 ItemBase.m_DebugActionsMask |= mask;
10303 }
10304
10306 {
10307 ItemBase.m_DebugActionsMask &= ~mask;
10308 }
10309
10311 {
10313 {
10315 }
10316 else
10317 {
10319 }
10320 }
10321
10322
10324 {
10325 if (GetEconomyProfile())
10326 {
10327 float q_max = GetEconomyProfile().GetQuantityMax();
10328 if (q_max > 0)
10329 {
10330 float q_min = GetEconomyProfile().GetQuantityMin();
10331 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10332
10334 {
10335 ComponentEnergyManager comp = GetCompEM();
10337 {
10339 }
10340 }
10342 {
10344
10345 }
10346
10347 }
10348 }
10349 }
10350
10353 {
10354 EntityAI parent = GetHierarchyParent();
10355
10356 if (parent)
10357 {
10358 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10359 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10360 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10361 }
10362 }
10363
10366 {
10367 EntityAI parent = GetHierarchyParent();
10368
10369 if (parent)
10370 {
10371 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10372 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10373 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10374 }
10375 }
10376
10378 {
10379
10380
10381
10382
10384
10386 {
10387 if (ScriptInputUserData.CanStoreInputUserData())
10388 {
10389 ScriptInputUserData ctx = new ScriptInputUserData;
10395 ctx.
Write(use_stack_max);
10398
10400 {
10401 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10402 }
10403 }
10404 }
10405 else if (!
g_Game.IsMultiplayer())
10406 {
10408 }
10409 }
10410
10412 {
10414 }
10415
10417 {
10419 }
10420
10422 {
10424 }
10425
10427 {
10428
10429 return false;
10430 }
10431
10433 {
10434 return false;
10435 }
10436
10440 {
10441 return false;
10442 }
10443
10445 {
10446 return "";
10447 }
10448
10450
10452 {
10453 return false;
10454 }
10455
10457 {
10458 return true;
10459 }
10460
10461
10462
10464 {
10465 return true;
10466 }
10467
10469 {
10470 return true;
10471 }
10472
10474 {
10475 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10477 }
10478
10480 {
10482 }
10483
10485 {
10487 if (!is_being_placed)
10489 SetSynchDirty();
10490 }
10491
10492
10494
10496 {
10498 }
10499
10501 {
10503 }
10504
10506 {
10507 return 1;
10508 }
10509
10511 {
10512 return false;
10513 }
10514
10516 {
10518 SetSynchDirty();
10519 }
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10556 {
10557 super.OnMovedInsideCargo(container);
10558
10559 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10560 }
10561
10562 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10563 {
10564 super.EEItemLocationChanged(oldLoc, newLoc);
10565
10566 PlayerBase newPlayer = null;
10567 PlayerBase oldPlayer = null;
10568
10569 if (newLoc.GetParent())
10570 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10571
10572 if (oldLoc.GetParent())
10573 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10574
10576 {
10577 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10578
10579 if (rIndex >= 0)
10580 {
10581 InventoryLocation rIl = new InventoryLocation;
10582 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10583
10584 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10587 {
10588 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10589 }
10591 {
10593 }
10594
10595 }
10596 }
10597
10599 {
10600 if (newPlayer)
10601 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10602
10603 if (newPlayer == oldPlayer)
10604 {
10605 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10606 {
10608 {
10609 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10610 {
10611 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10612 }
10613 }
10614 else
10615 {
10616 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10617 }
10618 }
10619
10620 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10621 {
10622 int type = oldLoc.GetType();
10624 {
10625 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10626 }
10628 {
10629 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10630 }
10631 }
10632 if (!m_OldLocation)
10633 {
10634 m_OldLocation = new InventoryLocation;
10635 }
10636 m_OldLocation.Copy(oldLoc);
10637 }
10638 else
10639 {
10640 if (m_OldLocation)
10641 {
10642 m_OldLocation.Reset();
10643 }
10644 }
10645
10646 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10647 }
10648 else
10649 {
10650 if (newPlayer)
10651 {
10652 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10653 if (resIndex >= 0)
10654 {
10655 InventoryLocation il = new InventoryLocation;
10656 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10658 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10661 {
10662 il.
GetParent().GetOnReleaseLock().Invoke(it);
10663 }
10665 {
10667 }
10668
10669 }
10670 }
10672 {
10673
10675 }
10676
10677 if (m_OldLocation)
10678 {
10679 m_OldLocation.Reset();
10680 }
10681 }
10682
10684 {
10685 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10686 }
10687
10689 {
10690 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10691 }
10692 }
10693
10694 override void EOnContact(IEntity other, Contact extra)
10695 {
10697 {
10698 int liquidType = -1;
10700 if (impactSpeed > 0.0)
10701 {
10703 #ifndef SERVER
10705 #else
10707 SetSynchDirty();
10708 #endif
10710 }
10711 }
10712
10713 #ifdef SERVER
10714 if (GetCompEM() && GetCompEM().IsPlugged())
10715 {
10716 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10717 GetCompEM().UnplugThis();
10718 }
10719 #endif
10720 }
10721
10723
10725 {
10727 }
10728
10730 {
10731
10732 }
10733
10735 {
10736 super.OnItemLocationChanged(old_owner, new_owner);
10737
10738 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10739 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10740
10741 if (!relatedPlayer && playerNew)
10742 relatedPlayer = playerNew;
10743
10744 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10745 {
10747 if (actionMgr)
10748 {
10749 ActionBase currentAction = actionMgr.GetRunningAction();
10750 if (currentAction)
10752 }
10753 }
10754
10755 Man ownerPlayerOld = null;
10756 Man ownerPlayerNew = null;
10757
10758 if (old_owner)
10759 {
10760 if (old_owner.
IsMan())
10761 {
10762 ownerPlayerOld = Man.Cast(old_owner);
10763 }
10764 else
10765 {
10766 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10767 }
10768 }
10769 else
10770 {
10772 {
10774
10775 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10776 {
10777 GetCompEM().UnplugThis();
10778 }
10779 }
10780 }
10781
10782 if (new_owner)
10783 {
10784 if (new_owner.
IsMan())
10785 {
10786 ownerPlayerNew = Man.Cast(new_owner);
10787 }
10788 else
10789 {
10790 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10791 }
10792 }
10793
10794 if (ownerPlayerOld != ownerPlayerNew)
10795 {
10796 if (ownerPlayerOld)
10797 {
10798 array<EntityAI> subItemsExit = new array<EntityAI>;
10800 for (int i = 0; i < subItemsExit.Count(); i++)
10801 {
10804 }
10805 }
10806
10807 if (ownerPlayerNew)
10808 {
10809 array<EntityAI> subItemsEnter = new array<EntityAI>;
10811 for (int j = 0; j < subItemsEnter.Count(); j++)
10812 {
10815 }
10816 }
10817 }
10818 else if (ownerPlayerNew != null)
10819 {
10820 PlayerBase nplayer;
10821 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10822 {
10823 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10825 for (int k = 0; k < subItemsUpdate.Count(); k++)
10826 {
10828 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10829 }
10830 }
10831 }
10832
10833 if (old_owner)
10834 old_owner.OnChildItemRemoved(this);
10835 if (new_owner)
10836 new_owner.OnChildItemReceived(this);
10837 }
10838
10839
10841 {
10842 super.EEDelete(parent);
10843 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10844 if (player)
10845 {
10847
10848 if (player.IsAlive())
10849 {
10850 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10851 if (r_index >= 0)
10852 {
10853 InventoryLocation r_il = new InventoryLocation;
10854 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10855
10856 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10859 {
10860 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10861 }
10863 {
10864 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10865 }
10866
10867 }
10868
10869 player.RemoveQuickBarEntityShortcut(this);
10870 }
10871 }
10872 }
10873
10875 {
10876 super.EEKilled(killer);
10877
10880 {
10881 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10882 {
10883 if (IsMagazine())
10884 {
10885 if (Magazine.Cast(this).GetAmmoCount() > 0)
10886 {
10888 }
10889 }
10890 else
10891 {
10893 }
10894 }
10895 }
10896 }
10897
10899 {
10900 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10901
10902 super.OnWasAttached(parent, slot_id);
10903
10906
10909 }
10910
10912 {
10913 super.OnWasDetached(parent, slot_id);
10914
10917
10920 }
10921
10923 {
10924 int idx;
10927
10928 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10929 if (inventory_slots.Count() < 1)
10930 {
10931 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10932 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10933 }
10934 else
10935 {
10936 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10937 }
10938
10939 idx = inventory_slots.Find(slot);
10940 if (idx < 0)
10941 return "";
10942
10943 return attach_types.Get(idx);
10944 }
10945
10947 {
10948 int idx = -1;
10949 string slot;
10950
10953
10954 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10955 if (inventory_slots.Count() < 1)
10956 {
10957 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10958 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10959 }
10960 else
10961 {
10962 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10963 if (detach_types.Count() < 1)
10964 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10965 }
10966
10967 for (int i = 0; i < inventory_slots.Count(); i++)
10968 {
10969 slot = inventory_slots.Get(i);
10970 }
10971
10972 if (slot != "")
10973 {
10974 if (detach_types.Count() == 1)
10975 idx = 0;
10976 else
10977 idx = inventory_slots.Find(slot);
10978 }
10979 if (idx < 0)
10980 return "";
10981
10982 return detach_types.Get(idx);
10983 }
10984
10986 {
10987
10989
10990
10991 float min_time = 1;
10992 float max_time = 3;
10993 float delay = Math.RandomFloat(min_time, max_time);
10994
10995 explode_timer.Run(delay, this, "DoAmmoExplosion");
10996 }
10997
10999 {
11000 Magazine magazine = Magazine.Cast(this);
11001 int pop_sounds_count = 6;
11002 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11003
11004
11005 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11006 string sound_name = pop_sounds[ sound_idx ];
11007 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11008
11009
11010 magazine.ServerAddAmmoCount(-1);
11011
11012
11013 float min_temp_to_explode = 100;
11014
11015 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11016 {
11018 }
11019 }
11020
11021
11022 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11023 {
11024 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11025
11026 const int CHANCE_DAMAGE_CARGO = 4;
11027 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11028 const int CHANCE_DAMAGE_NOTHING = 2;
11029
11031 {
11032 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11033 int chances;
11034 int rnd;
11035
11036 if (GetInventory().GetCargo())
11037 {
11038 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11039 rnd = Math.RandomInt(0,chances);
11040
11041 if (rnd < CHANCE_DAMAGE_CARGO)
11042 {
11044 }
11045 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11046 {
11048 }
11049 }
11050 else
11051 {
11052 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11053 rnd = Math.RandomInt(0,chances);
11054
11055 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11056 {
11058 }
11059 }
11060 }
11061 }
11062
11064 {
11065 CargoBase cargo = GetInventory().GetCargo();
11066 if (cargo)
11067 {
11069 if (item_count > 0)
11070 {
11071 int random_pick = Math.RandomInt(0, item_count);
11073 if (!item.IsExplosive())
11074 {
11075 item.AddHealth("","",damage);
11076 return true;
11077 }
11078 }
11079 }
11080 return false;
11081 }
11082
11084 {
11085 GameInventory inventory = GetInventory();
11087 if (attachment_count > 0)
11088 {
11089 int random_pick = Math.RandomInt(0, attachment_count);
11091 if (!attachment.IsExplosive())
11092 {
11093 attachment.AddHealth("","",damage);
11094 return true;
11095 }
11096 }
11097 return false;
11098 }
11099
11101 {
11103 }
11104
11106 {
11108 return GetInventory().CanRemoveEntity();
11109
11110 return false;
11111 }
11112
11114 {
11115
11117 return false;
11118
11119
11121 return false;
11122
11123
11124
11126 if (delta == 0)
11127 return false;
11128
11129
11130 return true;
11131 }
11132
11134 {
11136 {
11137 if (ScriptInputUserData.CanStoreInputUserData())
11138 {
11139 ScriptInputUserData ctx = new ScriptInputUserData;
11144 ctx.
Write(destination_entity);
11146 ctx.
Write(slot_id);
11148 }
11149 }
11150 else if (!
g_Game.IsMultiplayer())
11151 {
11153 }
11154 }
11155
11157 {
11158 float split_quantity_new;
11162 InventoryLocation loc = new InventoryLocation;
11163
11164 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11165 {
11167 split_quantity_new = stack_max;
11168 else
11170
11172 {
11173 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11174 if (new_item)
11175 {
11176 new_item.SetResultOfSplit(true);
11177 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11179 new_item.
SetQuantity(split_quantity_new,
false,
true);
11180 }
11181 }
11182 }
11183 else if (destination_entity && slot_id == -1)
11184 {
11185 if (quantity > stack_max)
11186 split_quantity_new = stack_max;
11187 else
11188 split_quantity_new = quantity;
11189
11191 {
11192 GameInventory destinationInventory = destination_entity.GetInventory();
11194 {
11197 }
11198
11199 if (new_item)
11200 {
11201 new_item.SetResultOfSplit(true);
11202 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11204 new_item.
SetQuantity(split_quantity_new,
false,
true);
11205 }
11206 }
11207 }
11208 else
11209 {
11210 if (stack_max != 0)
11211 {
11213 {
11215 }
11216
11217 if (split_quantity_new == 0)
11218 {
11219 if (!
g_Game.IsMultiplayer())
11220 player.PhysicalPredictiveDropItem(this);
11221 else
11222 player.ServerDropEntity(this);
11223 return;
11224 }
11225
11227 {
11229
11230 if (new_item)
11231 {
11232 new_item.SetResultOfSplit(true);
11233 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11236 new_item.PlaceOnSurface();
11237 }
11238 }
11239 }
11240 }
11241 }
11242
11244 {
11245 float split_quantity_new;
11249 InventoryLocation loc = new InventoryLocation;
11250
11251 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11252 {
11254 split_quantity_new = stack_max;
11255 else
11257
11259 {
11260 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11261 if (new_item)
11262 {
11263 new_item.SetResultOfSplit(true);
11264 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11266 new_item.
SetQuantity(split_quantity_new,
false,
true);
11267 }
11268 }
11269 }
11270 else if (destination_entity && slot_id == -1)
11271 {
11272 if (quantity > stack_max)
11273 split_quantity_new = stack_max;
11274 else
11275 split_quantity_new = quantity;
11276
11278 {
11279 GameInventory destinationInventory = destination_entity.GetInventory();
11281 {
11284 }
11285
11286 if (new_item)
11287 {
11288 new_item.SetResultOfSplit(true);
11289 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11291 new_item.
SetQuantity(split_quantity_new,
false,
true);
11292 }
11293 }
11294 }
11295 else
11296 {
11297 if (stack_max != 0)
11298 {
11300 {
11302 }
11303
11305 {
11307
11308 if (new_item)
11309 {
11310 new_item.SetResultOfSplit(true);
11311 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11314 new_item.PlaceOnSurface();
11315 }
11316 }
11317 }
11318 }
11319 }
11320
11322 {
11324 {
11325 if (ScriptInputUserData.CanStoreInputUserData())
11326 {
11327 ScriptInputUserData ctx = new ScriptInputUserData;
11332 dst.WriteToContext(ctx);
11334 }
11335 }
11336 else if (!
g_Game.IsMultiplayer())
11337 {
11339 }
11340 }
11341
11343 {
11345 {
11346 if (ScriptInputUserData.CanStoreInputUserData())
11347 {
11348 ScriptInputUserData ctx = new ScriptInputUserData;
11353 ctx.
Write(destination_entity);
11359 }
11360 }
11361 else if (!
g_Game.IsMultiplayer())
11362 {
11364 }
11365 }
11366
11368 {
11370 }
11371
11373 {
11375 float split_quantity_new;
11377 if (dst.IsValid())
11378 {
11379 int slot_id = dst.GetSlot();
11381
11382 if (quantity > stack_max)
11383 split_quantity_new = stack_max;
11384 else
11385 split_quantity_new = quantity;
11386
11388 {
11390
11391 if (new_item)
11392 {
11393 new_item.SetResultOfSplit(true);
11394 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11396 new_item.
SetQuantity(split_quantity_new,
false,
true);
11397 }
11398
11399 return new_item;
11400 }
11401 }
11402
11403 return null;
11404 }
11405
11407 {
11409 float split_quantity_new;
11411 if (destination_entity)
11412 {
11414 if (quantity > stackable)
11415 split_quantity_new = stackable;
11416 else
11417 split_quantity_new = quantity;
11418
11420 {
11421 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11422 if (new_item)
11423 {
11424 new_item.SetResultOfSplit(true);
11425 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11427 new_item.
SetQuantity(split_quantity_new,
false,
true);
11428 }
11429 }
11430 }
11431 }
11432
11434 {
11436 {
11437 if (ScriptInputUserData.CanStoreInputUserData())
11438 {
11439 ScriptInputUserData ctx = new ScriptInputUserData;
11444 ItemBase destination_entity =
this;
11445 ctx.
Write(destination_entity);
11449 }
11450 }
11451 else if (!
g_Game.IsMultiplayer())
11452 {
11454 }
11455 }
11456
11458 {
11460 float split_quantity_new;
11462 if (player)
11463 {
11465 if (quantity > stackable)
11466 split_quantity_new = stackable;
11467 else
11468 split_quantity_new = quantity;
11469
11471 {
11472 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11473 new_item =
ItemBase.Cast(in_hands);
11474 if (new_item)
11475 {
11476 new_item.SetResultOfSplit(true);
11477 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11479 new_item.SetQuantity(split_quantity_new, false, true);
11480 }
11481 }
11482 }
11483 }
11484
11486 {
11488 float split_quantity_new = Math.Floor(quantity * 0.5);
11489
11491 return;
11492
11494
11495 if (new_item)
11496 {
11497 if (new_item.GetQuantityMax() < split_quantity_new)
11498 {
11499 split_quantity_new = new_item.GetQuantityMax();
11500 }
11501
11502 new_item.SetResultOfSplit(true);
11503 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11504
11506 {
11509 }
11510 else
11511 {
11513 new_item.
SetQuantity(split_quantity_new,
false,
true);
11514 }
11515 }
11516 }
11517
11519 {
11521 float split_quantity_new = Math.Floor(quantity / 2);
11522
11524 return;
11525
11526 InventoryLocation invloc = new InventoryLocation;
11528
11530 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11531
11532 if (new_item)
11533 {
11534 if (new_item.GetQuantityMax() < split_quantity_new)
11535 {
11536 split_quantity_new = new_item.GetQuantityMax();
11537 }
11539 {
11542 }
11543 else if (split_quantity_new > 1)
11544 {
11546 new_item.
SetQuantity(split_quantity_new,
false,
true);
11547 }
11548 }
11549 }
11550
11553 {
11554 SetWeightDirty();
11556
11557 if (parent)
11558 parent.OnAttachmentQuantityChangedEx(this, delta);
11559
11561 {
11563 {
11565 }
11567 {
11568 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11570 }
11571 }
11572 }
11573
11576 {
11577
11578 }
11579
11582 {
11584 }
11585
11587 {
11588 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11589
11591 {
11592 if (newLevel == GameConstants.STATE_RUINED)
11593 {
11595 EntityAI parent = GetHierarchyParent();
11596 if (parent && parent.IsFireplace())
11597 {
11598 CargoBase cargo = GetInventory().GetCargo();
11599 if (cargo)
11600 {
11602 {
11604 }
11605 }
11606 }
11607 }
11608
11610 {
11611
11613 return;
11614 }
11615
11616 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11617 {
11619 }
11620 }
11621 }
11622
11623
11625 {
11626 super.OnRightClick();
11627
11629 {
11631 {
11632 if (ScriptInputUserData.CanStoreInputUserData())
11633 {
11634 EntityAI root = GetHierarchyRoot();
11635 Man playerOwner = GetHierarchyRootPlayer();
11636 InventoryLocation dst = new InventoryLocation;
11637
11638
11639 if (!playerOwner && root && root == this)
11640 {
11642 }
11643 else
11644 {
11645
11646 GetInventory().GetCurrentInventoryLocation(dst);
11648 {
11649 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11651 {
11653 }
11654 else
11655 {
11657
11658
11659 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11660 {
11662 }
11663 else
11664 {
11665 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11666 }
11667 }
11668 }
11669 }
11670
11671 ScriptInputUserData ctx = new ScriptInputUserData;
11679 }
11680 }
11681 else if (!
g_Game.IsMultiplayer())
11682 {
11684 }
11685 }
11686 }
11687
11689 {
11690 if (root)
11691 {
11692 vector m4[4];
11693 root.GetTransform(m4);
11694 dst.SetGround(this, m4);
11695 }
11696 else
11697 {
11698 GetInventory().GetCurrentInventoryLocation(dst);
11699 }
11700 }
11701
11702 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11703 {
11704
11705 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11706 return false;
11707
11708 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11709 return false;
11710
11711
11713 return false;
11714
11715
11716 Magazine mag = Magazine.Cast(this);
11717 if (mag)
11718 {
11719 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11720 return false;
11721
11722 if (stack_max_limit)
11723 {
11724 Magazine other_mag = Magazine.Cast(other_item);
11725 if (other_item)
11726 {
11727 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11728 return false;
11729 }
11730
11731 }
11732 }
11733 else
11734 {
11735
11737 return false;
11738
11740 return false;
11741 }
11742
11743 PlayerBase player = null;
11744 if (CastTo(player, GetHierarchyRootPlayer()))
11745 {
11746 if (player.GetInventory().HasAttachment(this))
11747 return false;
11748
11749 if (player.IsItemsToDelete())
11750 return false;
11751 }
11752
11753 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11754 return false;
11755
11756 int slotID;
11758 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11759 return false;
11760
11761 return true;
11762 }
11763
11765 {
11767 }
11768
11770 {
11771 return m_IsResultOfSplit;
11772 }
11773
11775 {
11776 m_IsResultOfSplit = value;
11777 }
11778
11780 {
11782 }
11783
11785 {
11786 float other_item_quantity = other_item.GetQuantity();
11787 float this_free_space;
11788
11790
11792
11793 if (other_item_quantity > this_free_space)
11794 {
11795 return this_free_space;
11796 }
11797 else
11798 {
11799 return other_item_quantity;
11800 }
11801 }
11802
11804 {
11806 }
11807
11809 {
11811 return;
11812
11813 if (!IsMagazine() && other_item)
11814 {
11816 if (quantity_used != 0)
11817 {
11818 float hp1 = GetHealth01("","");
11819 float hp2 = other_item.GetHealth01("","");
11820 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11821 hpResult = hpResult / (
GetQuantity() + quantity_used);
11822
11823 hpResult *= GetMaxHealth();
11824 Math.Round(hpResult);
11825 SetHealth("", "Health", hpResult);
11826
11828 other_item.AddQuantity(-quantity_used);
11829 }
11830 }
11832 }
11833
11835 {
11836 #ifdef SERVER
11837 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11838 GetHierarchyParent().IncreaseLifetimeUp();
11839 #endif
11840 };
11841
11843 {
11844 PlayerBase p = PlayerBase.Cast(player);
11845
11846 array<int> recipesIds = p.m_Recipes;
11847 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11848 if (moduleRecipesManager)
11849 {
11850 EntityAI itemInHands = player.GetEntityInHands();
11851 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11852 }
11853
11854 for (int i = 0;i < recipesIds.Count(); i++)
11855 {
11856 int key = recipesIds.Get(i);
11857 string recipeName = moduleRecipesManager.GetRecipeName(key);
11859 }
11860 }
11861
11862
11863 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11864 {
11865 super.GetDebugActions(outputList);
11866
11867
11873
11874
11879
11884
11885
11889
11890
11892 {
11896 }
11897
11900
11901
11905
11907
11908 InventoryLocation loc = new InventoryLocation();
11909 GetInventory().GetCurrentInventoryLocation(loc);
11911 {
11912 if (Gizmo_IsSupported())
11915 }
11916
11918 }
11919
11920
11921
11922
11924 {
11925 super.OnAction(action_id, player, ctx);
11926
11928 {
11929 switch (action_id)
11930 {
11934 return true;
11938 return true;
11939 }
11940 }
11941
11943 {
11944 switch (action_id)
11945 {
11947 Delete();
11948 return true;
11949 }
11950 }
11951
11952 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11953 {
11954 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11955 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11956 PlayerBase p = PlayerBase.Cast(player);
11957 if (
EActions.RECIPES_RANGE_START < 1000)
11958 {
11959 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11960 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11961 }
11962 }
11963 #ifndef SERVER
11964 else if (action_id ==
EActions.WATCH_PLAYER)
11965 {
11966 PluginDeveloper.SetDeveloperItemClientEx(player);
11967 }
11968 #endif
11970 {
11971 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11972 {
11973 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11974 OnDebugButtonPressServer(id + 1);
11975 }
11976
11977 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11978 {
11979 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11981 }
11982
11983 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11984 {
11985 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11987 }
11988
11989 else if (action_id ==
EActions.ADD_QUANTITY)
11990 {
11991 if (IsMagazine())
11992 {
11993 Magazine mag = Magazine.Cast(this);
11994 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11995 }
11996 else
11997 {
11999 }
12000
12001 if (m_EM)
12002 {
12003 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12004 }
12005
12006 }
12007
12008 else if (action_id ==
EActions.REMOVE_QUANTITY)
12009 {
12010 if (IsMagazine())
12011 {
12012 Magazine mag2 = Magazine.Cast(this);
12013 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12014 }
12015 else
12016 {
12018 }
12019 if (m_EM)
12020 {
12021 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12022 }
12023
12024 }
12025
12026 else if (action_id ==
EActions.SET_QUANTITY_0)
12027 {
12029
12030 if (m_EM)
12031 {
12032 m_EM.SetEnergy(0);
12033 }
12034 }
12035
12036 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12037 {
12039
12040 if (m_EM)
12041 {
12042 m_EM.SetEnergy(m_EM.GetEnergyMax());
12043 }
12044 }
12045
12046 else if (action_id ==
EActions.ADD_HEALTH)
12047 {
12048 AddHealth("","",GetMaxHealth("","Health")/5);
12049 }
12050 else if (action_id ==
EActions.REMOVE_HEALTH)
12051 {
12052 AddHealth("","",-GetMaxHealth("","Health")/5);
12053 }
12054 else if (action_id ==
EActions.DESTROY_HEALTH)
12055 {
12056 SetHealth01("","",0);
12057 }
12058 else if (action_id ==
EActions.WATCH_ITEM)
12059 {
12061 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12062 #ifdef DEVELOPER
12063 SetDebugDeveloper_item(this);
12064 #endif
12065 }
12066
12067 else if (action_id ==
EActions.ADD_TEMPERATURE)
12068 {
12069 AddTemperature(20);
12070
12071 }
12072
12073 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12074 {
12075 AddTemperature(-20);
12076
12077 }
12078
12079 else if (action_id ==
EActions.FLIP_FROZEN)
12080 {
12081 SetFrozen(!GetIsFrozen());
12082
12083 }
12084
12085 else if (action_id ==
EActions.ADD_WETNESS)
12086 {
12088
12089 }
12090
12091 else if (action_id ==
EActions.REMOVE_WETNESS)
12092 {
12094
12095 }
12096
12097 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12098 {
12101
12102
12103 }
12104
12105 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12106 {
12109 }
12110
12111 else if (action_id ==
EActions.MAKE_SPECIAL)
12112 {
12113 auto debugParams = DebugSpawnParams.WithPlayer(player);
12114 OnDebugSpawnEx(debugParams);
12115 }
12116
12117 }
12118
12119
12120 return false;
12121 }
12122
12123
12124
12125
12129
12132
12133
12134
12136 {
12137 return false;
12138 }
12139
12140
12142 {
12143 return true;
12144 }
12145
12146
12148 {
12149 return true;
12150 }
12151
12152
12153
12155 {
12156 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12157 return g_Game.ConfigIsExisting(config_path);
12158 }
12159
12162 {
12163 return null;
12164 }
12165
12167 {
12168 return false;
12169 }
12170
12172 {
12173 return false;
12174 }
12175
12179
12180
12182 {
12183 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12184 return module_repairing.CanRepair(this, item_repair_kit);
12185 }
12186
12187
12188 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12189 {
12190 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12191 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12192 }
12193
12194
12196 {
12197
12198
12199
12200
12201
12202
12203
12204
12205 return 1;
12206 }
12207
12208
12209
12211 {
12213 }
12214
12215
12216
12218 {
12220 }
12221
12222
12231 {
12232 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12233
12234 if (player)
12235 {
12236 player.MessageStatus(text);
12237 }
12238 }
12239
12240
12249 {
12250 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12251
12252 if (player)
12253 {
12254 player.MessageAction(text);
12255 }
12256 }
12257
12258
12267 {
12268 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12269
12270 if (player)
12271 {
12272 player.MessageFriendly(text);
12273 }
12274 }
12275
12276
12285 {
12286 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12287
12288 if (player)
12289 {
12290 player.MessageImportant(text);
12291 }
12292 }
12293
12295 {
12296 return true;
12297 }
12298
12299
12300 override bool KindOf(
string tag)
12301 {
12302 bool found = false;
12303 string item_name = this.
GetType();
12305 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12306
12307 int array_size = item_tag_array.Count();
12308 for (int i = 0; i < array_size; i++)
12309 {
12310 if (item_tag_array.Get(i) == tag)
12311 {
12312 found = true;
12313 break;
12314 }
12315 }
12316 return found;
12317 }
12318
12319
12321 {
12322
12323 super.OnRPC(sender, rpc_type,ctx);
12324
12325
12326 switch (rpc_type)
12327 {
12328 #ifndef SERVER
12329 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12330 Param2<bool, string> p = new Param2<bool, string>(false, "");
12331
12333 return;
12334
12335 bool play = p.param1;
12336 string soundSet = p.param2;
12337
12338 if (play)
12339 {
12341 {
12343 {
12345 }
12346 }
12347 else
12348 {
12350 }
12351 }
12352 else
12353 {
12355 }
12356
12357 break;
12358 #endif
12359
12360 }
12361
12363 {
12365 }
12366 }
12367
12368
12369
12370
12372 {
12373 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12374 return plugin.GetID(
name);
12375 }
12376
12378 {
12379 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12380 return plugin.GetName(id);
12381 }
12382
12385 {
12386
12387
12388 int varFlags;
12389 if (!ctx.
Read(varFlags))
12390 return;
12391
12392 if (varFlags & ItemVariableFlags.FLOAT)
12393 {
12395 }
12396 }
12397
12399 {
12400
12401 super.SerializeNumericalVars(floats_out);
12402
12403
12404
12406 {
12408 }
12409
12411 {
12413 }
12414
12416 {
12418 }
12419
12421 {
12426 }
12427
12429 {
12431 }
12432 }
12433
12435 {
12436
12437 super.DeSerializeNumericalVars(floats);
12438
12439
12440 int index = 0;
12441 int mask = Math.Round(floats.Get(index));
12442
12443 index++;
12444
12446 {
12448 {
12450 }
12451 else
12452 {
12453 float quantity = floats.Get(index);
12454 SetQuantity(quantity,
true,
false,
false,
false);
12455 }
12456 index++;
12457 }
12458
12460 {
12461 float wet = floats.Get(index);
12463 index++;
12464 }
12465
12467 {
12468 int liquidtype = Math.Round(floats.Get(index));
12470 index++;
12471 }
12472
12474 {
12476 index++;
12478 index++;
12480 index++;
12482 index++;
12483 }
12484
12486 {
12487 int cleanness = Math.Round(floats.Get(index));
12489 index++;
12490 }
12491 }
12492
12494 {
12495 super.WriteVarsToCTX(ctx);
12496
12497
12499 {
12501 }
12502
12504 {
12506 }
12507
12509 {
12511 }
12512
12514 {
12515 int r,g,b,a;
12521 }
12522
12524 {
12526 }
12527 }
12528
12530 {
12531 if (!super.ReadVarsFromCTX(ctx,version))
12532 return false;
12533
12534 int intValue;
12535 float value;
12536
12537 if (version < 140)
12538 {
12539 if (!ctx.
Read(intValue))
12540 return false;
12541
12542 m_VariablesMask = intValue;
12543 }
12544
12546 {
12547 if (!ctx.
Read(value))
12548 return false;
12549
12551 {
12553 }
12554 else
12555 {
12557 }
12558 }
12559
12560 if (version < 140)
12561 {
12563 {
12564 if (!ctx.
Read(value))
12565 return false;
12566 SetTemperatureDirect(value);
12567 }
12568 }
12569
12571 {
12572 if (!ctx.
Read(value))
12573 return false;
12575 }
12576
12578 {
12579 if (!ctx.
Read(intValue))
12580 return false;
12582 }
12583
12585 {
12586 int r,g,b,a;
12588 return false;
12590 return false;
12592 return false;
12594 return false;
12595
12597 }
12598
12600 {
12601 if (!ctx.
Read(intValue))
12602 return false;
12604 }
12605
12606 if (version >= 138 && version < 140)
12607 {
12609 {
12610 if (!ctx.
Read(intValue))
12611 return false;
12612 SetFrozen(intValue);
12613 }
12614 }
12615
12616 return true;
12617 }
12618
12619
12621 {
12624 {
12626 }
12627
12628 if (!super.OnStoreLoad(ctx, version))
12629 {
12631 return false;
12632 }
12633
12634 if (version >= 114)
12635 {
12636 bool hasQuickBarIndexSaved;
12637
12638 if (!ctx.
Read(hasQuickBarIndexSaved))
12639 {
12641 return false;
12642 }
12643
12644 if (hasQuickBarIndexSaved)
12645 {
12646 int itmQBIndex;
12647
12648
12649 if (!ctx.
Read(itmQBIndex))
12650 {
12652 return false;
12653 }
12654
12655 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12656 if (itmQBIndex != -1 && parentPlayer)
12657 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12658 }
12659 }
12660 else
12661 {
12662
12663 PlayerBase player;
12664 int itemQBIndex;
12665 if (version ==
int.
MAX)
12666 {
12667 if (!ctx.
Read(itemQBIndex))
12668 {
12670 return false;
12671 }
12672 }
12673 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12674 {
12675
12676 if (!ctx.
Read(itemQBIndex))
12677 {
12679 return false;
12680 }
12681 if (itemQBIndex != -1 && player)
12682 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12683 }
12684 }
12685
12686 if (version < 140)
12687 {
12688
12689 if (!LoadVariables(ctx, version))
12690 {
12692 return false;
12693 }
12694 }
12695
12696
12698 {
12700 return false;
12701 }
12702 if (version >= 132)
12703 {
12705 if (raib)
12706 {
12708 {
12710 return false;
12711 }
12712 }
12713 }
12714
12716 return true;
12717 }
12718
12719
12720
12722 {
12723 super.OnStoreSave(ctx);
12724
12725 PlayerBase player;
12726 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12727 {
12729
12730 int itemQBIndex = -1;
12731 itemQBIndex = player.FindQuickBarEntityIndex(this);
12732 ctx.
Write(itemQBIndex);
12733 }
12734 else
12735 {
12737 }
12738
12740
12742 if (raib)
12743 {
12745 }
12746 }
12747
12748
12750 {
12751 super.AfterStoreLoad();
12752
12754 {
12756 }
12757
12759 {
12762 }
12763 }
12764
12766 {
12767 super.EEOnAfterLoad();
12768
12770 {
12772 }
12773
12776 }
12777
12779 {
12780 return false;
12781 }
12782
12783
12784
12786 {
12788 {
12789 #ifdef PLATFORM_CONSOLE
12790
12792 {
12794 if (menu)
12795 {
12797 }
12798 }
12799 #endif
12800 }
12801
12803 {
12806 }
12807
12809 {
12810 SetWeightDirty();
12812 }
12814 {
12817 }
12818
12820 {
12823
12826 }
12828 {
12832 }
12833
12834 super.OnVariablesSynchronized();
12835 }
12836
12837
12838
12840 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12841 {
12842 if (!IsServerCheck(allow_client))
12843 return false;
12844
12846 return false;
12847
12850
12851 if (value <= (min + 0.001))
12852 value = min;
12853
12854 if (value == min)
12855 {
12856 if (destroy_config)
12857 {
12858 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12859 if (dstr)
12860 {
12862 this.Delete();
12863 return true;
12864 }
12865 }
12866 else if (destroy_forced)
12867 {
12869 this.Delete();
12870 return true;
12871 }
12872
12874 }
12875
12878
12880 {
12881 EntityAI parent = GetHierarchyRoot();
12882 InventoryLocation iLoc = new InventoryLocation();
12883 GetInventory().GetCurrentInventoryLocation(iLoc);
12885 {
12886 int iLocSlot = iLoc.
GetSlot();
12888 {
12890 }
12892 {
12894 }
12895 }
12896 }
12897
12899 {
12901
12902 if (delta)
12904 }
12905
12907
12908 return false;
12909 }
12910
12911
12913 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12914 {
12916 }
12917
12919 {
12922 }
12923
12925 {
12928 }
12929
12931 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12932 {
12933 float value_clamped = Math.Clamp(value, 0, 1);
12935 SetQuantity(result, destroy_config, destroy_forced);
12936 }
12937
12938
12941 {
12943 }
12944
12946 {
12948 }
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12960 {
12961 int slot = -1;
12962 GameInventory inventory = GetInventory();
12963 if (inventory)
12964 {
12965 InventoryLocation il = new InventoryLocation;
12968 }
12969
12971 }
12972
12974 {
12975 float quantity_max = 0;
12976
12978 {
12979 if (attSlotID != -1)
12980 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12981
12982 if (quantity_max <= 0)
12984 }
12985
12986 if (quantity_max <= 0)
12988
12989 return quantity_max;
12990 }
12991
12993 {
12995 }
12996
12998 {
13000 }
13001
13002
13004 {
13006 }
13007
13009 {
13011 }
13012
13014 {
13016 }
13017
13018
13020 {
13021
13022 float weightEx = GetWeightEx();
13023 float special = GetInventoryAndCargoWeight();
13024 return weightEx - special;
13025 }
13026
13027
13029 {
13031 }
13032
13034 {
13036 {
13037 #ifdef DEVELOPER
13038 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13039 {
13040 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13042 }
13043 #endif
13044
13045 return GetQuantity() * GetConfigWeightModified();
13046 }
13047 else if (HasEnergyManager())
13048 {
13049 #ifdef DEVELOPER
13050 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13051 {
13052 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13053 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13054 }
13055 #endif
13056 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13057 }
13058 else
13059 {
13060 #ifdef DEVELOPER
13061 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13062 {
13063 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13064 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13065 }
13066 #endif
13067 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13068 }
13069 }
13070
13073 {
13074 int item_count = 0;
13076
13077 GameInventory inventory = GetInventory();
13078 CargoBase cargo = inventory.
GetCargo();
13079 if (cargo != NULL)
13080 {
13082 }
13083
13085 for (int i = 0; i < nAttachments; ++i)
13086 {
13088 if (item)
13089 item_count += item.GetNumberOfItems();
13090 }
13091 return item_count;
13092 }
13093
13096 {
13097 float weight = 0;
13098 float wetness = 1;
13099 if (include_wetness)
13102 {
13103 weight = wetness * m_ConfigWeight;
13104 }
13106 {
13107 weight = 1;
13108 }
13109 return weight;
13110 }
13111
13112
13113
13115 {
13116 GameInventory inventory = GetInventory();
13117 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13118 {
13119 array<EntityAI> items = new array<EntityAI>;
13121 for (int i = 0; i < items.Count(); ++i)
13122 {
13124 if (item)
13125 {
13126 g_Game.ObjectDelete(item);
13127 }
13128 }
13129 }
13130 }
13131
13132
13133
13134
13136 {
13137 float energy = 0;
13138 if (HasEnergyManager())
13139 {
13140 energy = GetCompEM().GetEnergy();
13141 }
13142 return energy;
13143 }
13144
13145
13147 {
13148 super.OnEnergyConsumed();
13149
13151 }
13152
13154 {
13155 super.OnEnergyAdded();
13156
13158 }
13159
13160
13162 {
13163 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13164 {
13166 {
13167 float energy_0to1 = GetCompEM().GetEnergy0To1();
13169 }
13170 }
13171 }
13172
13173
13175 {
13176 return ConfigGetFloat("heatIsolation");
13177 }
13178
13180 {
13182 }
13183
13185 {
13186 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13187 if (
g_Game.ConfigIsExisting(paramPath))
13188 return g_Game.ConfigGetFloat(paramPath);
13189
13190 return 0.0;
13191 }
13192
13194 {
13195 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13196 if (
g_Game.ConfigIsExisting(paramPath))
13197 return g_Game.ConfigGetFloat(paramPath);
13198
13199 return 0.0;
13200 }
13201
13202 override void SetWet(
float value,
bool allow_client =
false)
13203 {
13204 if (!IsServerCheck(allow_client))
13205 return;
13206
13209
13211
13212 m_VarWet = Math.Clamp(value, min, max);
13213
13215 {
13218 }
13219 }
13220
13221 override void AddWet(
float value)
13222 {
13224 }
13225
13227 {
13229 }
13230
13232 {
13234 }
13235
13237 {
13239 }
13240
13242 {
13244 }
13245
13247 {
13249 }
13250
13251 override void OnWetChanged(
float newVal,
float oldVal)
13252 {
13255 if (newLevel != oldLevel)
13256 {
13258 }
13259 }
13260
13262 {
13263 SetWeightDirty();
13264 }
13265
13267 {
13268 return GetWetLevelInternal(
m_VarWet);
13269 }
13270
13271
13272
13274 {
13276 }
13277
13279 {
13281 }
13282
13284 {
13286 }
13287
13289 {
13291 }
13292
13293
13294
13296 {
13297 if (ConfigIsExisting("itemModelLength"))
13298 {
13299 return ConfigGetFloat("itemModelLength");
13300 }
13301 return 0;
13302 }
13303
13305 {
13306 if (ConfigIsExisting("itemAttachOffset"))
13307 {
13308 return ConfigGetFloat("itemAttachOffset");
13309 }
13310 return 0;
13311 }
13312
13313 override void SetCleanness(
int value,
bool allow_client =
false)
13314 {
13315 if (!IsServerCheck(allow_client))
13316 return;
13317
13319
13321
13324 }
13325
13327 {
13329 }
13330
13332 {
13333 return true;
13334 }
13335
13336
13337
13338
13340 {
13342 }
13343
13345 {
13347 }
13348
13349
13350
13351
13352 override void SetColor(
int r,
int g,
int b,
int a)
13353 {
13359 }
13361 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13362 {
13367 }
13368
13370 {
13372 }
13373
13376 {
13377 int r,g,b,a;
13379 r = r/255;
13380 g = g/255;
13381 b = b/255;
13382 a = a/255;
13383 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13384 }
13385
13386
13387
13388 override void SetLiquidType(
int value,
bool allow_client =
false)
13389 {
13390 if (!IsServerCheck(allow_client))
13391 return;
13392
13397 }
13398
13400 {
13401 return ConfigGetInt("varLiquidTypeInit");
13402 }
13403
13405 {
13407 }
13408
13410 {
13412 SetFrozen(false);
13413 }
13414
13417 {
13418 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13419 }
13420
13421
13424 {
13425 PlayerBase nplayer;
13426 if (PlayerBase.CastTo(nplayer, player))
13427 {
13429 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13430 }
13431 }
13432
13433
13436 {
13437 PlayerBase nplayer;
13438 if (PlayerBase.CastTo(nplayer,player))
13439 {
13440 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13441 }
13442
13443 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13444
13445 if (HasEnergyManager())
13446 {
13447 GetCompEM().UpdatePlugState();
13448 }
13449 }
13450
13451
13453 {
13454 super.OnPlacementStarted(player);
13455
13457 }
13458
13459 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13460 {
13462 {
13463 m_AdminLog.OnPlacementComplete(player,
this);
13464 }
13465
13466 super.OnPlacementComplete(player, position, orientation);
13467 }
13468
13469
13470
13471
13472
13474 {
13476 {
13477 return true;
13478 }
13479 else
13480 {
13481 return false;
13482 }
13483 }
13484
13485
13487 {
13489 {
13491 }
13492 }
13493
13494
13496 {
13498 }
13499
13501 {
13503 }
13504
13505 override void InsertAgent(
int agent,
float count = 1)
13506 {
13507 if (count < 1)
13508 return;
13509
13511 }
13512
13515 {
13517 }
13518
13519
13521 {
13523 }
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13567 {
13569 return false;
13570 return true;
13571 }
13572
13574 {
13575
13577 }
13578
13579
13582 {
13583 super.CheckForRoofLimited(timeTresholdMS);
13584
13585 float time =
g_Game.GetTime();
13586 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13587 {
13588 m_PreviousRoofTestTime = time;
13589 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13590 }
13591 }
13592
13593
13595 {
13597 {
13598 return 0;
13599 }
13600
13601 if (GetInventory().GetAttachmentSlotsCount() != 0)
13602 {
13603 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13604 if (filter)
13605 return filter.GetProtectionLevel(type, false, system);
13606 else
13607 return 0;
13608 }
13609
13610 string subclassPath, entryName;
13611
13612 switch (type)
13613 {
13615 entryName = "biological";
13616 break;
13618 entryName = "chemical";
13619 break;
13620 default:
13621 entryName = "biological";
13622 break;
13623 }
13624
13625 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13626
13627 return g_Game.ConfigGetFloat(subclassPath + entryName);
13628 }
13629
13630
13631
13634 {
13635 if (!IsMagazine())
13637
13639 }
13640
13641
13642
13643
13644
13649 {
13650 return true;
13651 }
13652
13654 {
13656 }
13657
13658
13659
13660
13661
13663 {
13664 if (parent)
13665 {
13666 if (parent.IsInherited(DayZInfected))
13667 return true;
13668
13669 if (!parent.IsRuined())
13670 return true;
13671 }
13672
13673 return true;
13674 }
13675
13677 {
13678 if (!super.CanPutAsAttachment(parent))
13679 {
13680 return false;
13681 }
13682
13683 if (!IsRuined() && !parent.IsRuined())
13684 {
13685 return true;
13686 }
13687
13688 return false;
13689 }
13690
13692 {
13693
13694
13695
13696
13697 return super.CanReceiveItemIntoCargo(item);
13698 }
13699
13701 {
13702
13703
13704
13705
13706 GameInventory attachmentInv = attachment.GetInventory();
13708 {
13709 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13710 return false;
13711 }
13712
13713 InventoryLocation loc = new InventoryLocation();
13714 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13715 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13716 return false;
13717
13718 return super.CanReceiveAttachment(attachment, slotId);
13719 }
13720
13722 {
13723 if (!super.CanReleaseAttachment(attachment))
13724 return false;
13725
13726 return GetInventory().AreChildrenAccessible();
13727 }
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13750 {
13751 int id = muzzle_owner.GetMuzzleID();
13752 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13753
13754 if (WPOF_array)
13755 {
13756 for (int i = 0; i < WPOF_array.Count(); i++)
13757 {
13758 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13759
13760 if (WPOF)
13761 {
13762 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13763 }
13764 }
13765 }
13766 }
13767
13768
13770 {
13771 int id = muzzle_owner.GetMuzzleID();
13773
13774 if (WPOBE_array)
13775 {
13776 for (int i = 0; i < WPOBE_array.Count(); i++)
13777 {
13778 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13779
13780 if (WPOBE)
13781 {
13782 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13783 }
13784 }
13785 }
13786 }
13787
13788
13790 {
13791 int id = muzzle_owner.GetMuzzleID();
13792 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13793
13794 if (WPOOH_array)
13795 {
13796 for (int i = 0; i < WPOOH_array.Count(); i++)
13797 {
13798 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13799
13800 if (WPOOH)
13801 {
13802 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13803 }
13804 }
13805 }
13806 }
13807
13808
13810 {
13811 int id = muzzle_owner.GetMuzzleID();
13812 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13813
13814 if (WPOOH_array)
13815 {
13816 for (int i = 0; i < WPOOH_array.Count(); i++)
13817 {
13818 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13819
13820 if (WPOOH)
13821 {
13822 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13823 }
13824 }
13825 }
13826 }
13827
13828
13830 {
13831 int id = muzzle_owner.GetMuzzleID();
13832 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13833
13834 if (WPOOH_array)
13835 {
13836 for (int i = 0; i < WPOOH_array.Count(); i++)
13837 {
13838 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13839
13840 if (WPOOH)
13841 {
13842 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13843 }
13844 }
13845 }
13846 }
13847
13848
13849
13851 {
13853 {
13854 return true;
13855 }
13856
13857 return false;
13858 }
13859
13861 {
13863 {
13864 return true;
13865 }
13866
13867 return false;
13868 }
13869
13871 {
13873 {
13874 return true;
13875 }
13876
13877 return false;
13878 }
13879
13881 {
13882 return false;
13883 }
13884
13887 {
13888 return UATimeSpent.DEFAULT_DEPLOY;
13889 }
13890
13891
13892
13893
13895 {
13897 SetSynchDirty();
13898 }
13899
13901 {
13903 }
13904
13905
13907 {
13908 return false;
13909 }
13910
13913 {
13914 string att_type = "None";
13915
13916 if (ConfigIsExisting("soundAttType"))
13917 {
13918 att_type = ConfigGetString("soundAttType");
13919 }
13920
13922 }
13923
13925 {
13927 }
13928
13929
13930
13931
13932
13938
13940 {
13943
13945 }
13946
13947
13949 {
13951 return;
13952
13954
13957
13960
13961 SoundParameters params = new SoundParameters();
13965 }
13966
13967
13969 {
13971 {
13974
13975 SetSynchDirty();
13976
13979 }
13980 }
13981
13983 {
13985 }
13986
13987
13989 {
13991 return;
13992
13994 SetSynchDirty();
13995
13998 }
13999
14001 {
14004 }
14005
14007 {
14009 }
14010
14011 void OnApply(PlayerBase player);
14012
14014 {
14015 return 1.0;
14016 };
14017
14019 {
14021 }
14022
14024 {
14026 }
14027
14029
14031 {
14032 SetDynamicPhysicsLifeTime(0.01);
14034 }
14035
14037 {
14038 array<string> zone_names = new array<string>;
14039 GetDamageZones(zone_names);
14040 for (int i = 0; i < zone_names.Count(); i++)
14041 {
14042 SetHealthMax(zone_names.Get(i),"Health");
14043 }
14044 SetHealthMax("","Health");
14045 }
14046
14049 {
14050 float global_health = GetHealth01("","Health");
14051 array<string> zones = new array<string>;
14052 GetDamageZones(zones);
14053
14054 for (int i = 0; i < zones.Count(); i++)
14055 {
14056 SetHealth01(zones.Get(i),"Health",global_health);
14057 }
14058 }
14059
14062 {
14063 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14064 }
14065
14067 {
14068 if (!hasRootAsPlayer)
14069 {
14070 if (refParentIB)
14071 {
14072
14073 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14074 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14075
14076 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14077 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14078
14081 }
14082 else
14083 {
14084
14087 }
14088 }
14089 }
14090
14092 {
14094 {
14095 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14096 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14097 {
14098 float heatPermCoef = 1.0;
14100 while (ent)
14101 {
14102 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14103 ent = ent.GetHierarchyParent();
14104 }
14105
14106 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14107 }
14108 }
14109 }
14110
14112 {
14113
14114 EntityAI parent = GetHierarchyParent();
14115 if (!parent)
14116 {
14117 hasParent = false;
14118 hasRootAsPlayer = false;
14119 }
14120 else
14121 {
14122 hasParent = true;
14123 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14124 refParentIB =
ItemBase.Cast(parent);
14125 }
14126 }
14127
14128 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14129 {
14130
14131 }
14132
14134 {
14135
14136 return false;
14137 }
14138
14140 {
14141
14142
14143 return false;
14144 }
14145
14147 {
14148
14149 return false;
14150 }
14151
14154 {
14155 return !GetIsFrozen() &&
IsOpen();
14156 }
14157
14159 {
14160 bool hasParent = false, hasRootAsPlayer = false;
14162
14163 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14164 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14165
14166 if (wwtu || foodDecay)
14167 {
14171
14172 if (processWetness || processTemperature || processDecay)
14173 {
14175
14176 if (processWetness)
14177 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14178
14179 if (processTemperature)
14181
14182 if (processDecay)
14183 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14184 }
14185 }
14186 }
14187
14190 {
14192 }
14193
14195 {
14198
14199 return super.GetTemperatureFreezeThreshold();
14200 }
14201
14203 {
14206
14207 return super.GetTemperatureThawThreshold();
14208 }
14209
14211 {
14214
14215 return super.GetItemOverheatThreshold();
14216 }
14217
14219 {
14221 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14222
14223 return super.GetTemperatureFreezeTime();
14224 }
14225
14227 {
14229 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14230
14231 return super.GetTemperatureThawTime();
14232 }
14233
14238
14240 {
14241 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14242 }
14243
14245 {
14246 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14247 }
14248
14251 {
14253 }
14254
14256 {
14258 }
14259
14261 {
14263 }
14264
14267 {
14268 return null;
14269 }
14270
14273 {
14274 return false;
14275 }
14276
14278 {
14280 {
14283 if (!trg)
14284 {
14286 explosive = this;
14287 }
14288
14289 explosive.PairRemote(trg);
14291
14292 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14293 trg.SetPersistentPairID(persistentID);
14294 explosive.SetPersistentPairID(persistentID);
14295
14296 return true;
14297 }
14298 return false;
14299 }
14300
14303 {
14304 float ret = 1.0;
14307 ret *= GetHealth01();
14308
14309 return ret;
14310 }
14311
14312 #ifdef DEVELOPER
14313 override void SetDebugItem()
14314 {
14315 super.SetDebugItem();
14316 _itemBase = this;
14317 }
14318
14320 {
14321 string text = super.GetDebugText();
14322
14324 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14325
14326 return text;
14327 }
14328 #endif
14329
14331 {
14332 return true;
14333 }
14334
14336
14338
14340 {
14343 }
14344
14345
14353
14369
14370 [
Obsolete(
"Use ItemSoundHandler instead")]
14373 {
14374 if (!
g_Game.IsDedicatedServer())
14375 {
14376 if (ConfigIsExisting("attachSoundSet"))
14377 {
14378 string cfg_path = "";
14379 string soundset = "";
14380 string type_name =
GetType();
14381
14384 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14385 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14386
14387 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14388 {
14389 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14390 {
14391 if (cfg_slot_array[i] == slot_type)
14392 {
14393 soundset = cfg_soundset_array[i];
14394 break;
14395 }
14396 }
14397 }
14398
14399 if (soundset != "")
14400 {
14401 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14403 }
14404 }
14405 }
14406 }
14407
14409}
14410
14412{
14414 if (entity)
14415 {
14416 bool is_item = entity.IsInherited(
ItemBase);
14417 if (is_item && full_quantity)
14418 {
14421 }
14422 }
14423 else
14424 {
14426 return NULL;
14427 }
14428 return entity;
14429}
14430
14432{
14433 if (item)
14434 {
14435 if (health > 0)
14436 item.SetHealth("", "", health);
14437
14438 if (item.CanHaveTemperature())
14439 {
14441 if (item.CanFreeze())
14442 item.SetFrozen(false);
14443 }
14444
14445 if (item.HasEnergyManager())
14446 {
14447 if (quantity >= 0)
14448 {
14449 item.GetCompEM().SetEnergy0To1(quantity);
14450 }
14451 else
14452 {
14454 }
14455 }
14456 else if (item.IsMagazine())
14457 {
14458 Magazine mag = Magazine.Cast(item);
14459 if (quantity >= 0)
14460 {
14461 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14462 }
14463 else
14464 {
14466 }
14467
14468 }
14469 else
14470 {
14471 if (quantity >= 0)
14472 {
14473 item.SetQuantityNormalized(quantity, false);
14474 }
14475 else
14476 {
14478 }
14479
14480 }
14481 }
14482}
14483
14484#ifdef DEVELOPER
14486#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.