9523{
9525 {
9526 return true;
9527 }
9528};
9529
9531{
9532
9533};
9534
9535
9536
9538{
9542
9544
9547
9548
9549
9550
9551
9560
9566
9571
9576
9597 protected bool m_IsResultOfSplit
9598
9600
9605
9606
9607
9609
9613
9614
9615
9617
9620
9621
9622
9628
9629
9637
9640
9641
9643
9644
9646
9647
9652
9653
9658
9660
9661
9663
9664
9666 {
9671
9672 if (!
g_Game.IsDedicatedServer())
9673 {
9675 {
9677
9679 {
9681 }
9682 }
9683
9686 }
9687
9688 m_OldLocation = null;
9689
9691 {
9693 }
9694
9695 if (ConfigIsExisting("headSelectionsToHide"))
9696 {
9699 }
9700
9702 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9703 {
9705 }
9706
9708
9709 m_IsResultOfSplit = false;
9710
9712 }
9713
9715 {
9716 super.InitItemVariables();
9717
9723 m_Count = ConfigGetInt(
"count");
9724
9727
9732
9735
9740
9752
9756
9757
9760 if (ConfigIsExisting("canBeSplit"))
9761 {
9764 }
9765
9767 if (ConfigIsExisting("itemBehaviour"))
9769
9770
9773 RegisterNetSyncVariableInt("m_VarLiquidType");
9774 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9775
9776 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9777 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9778 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9779
9780 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9781 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9782 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9783 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9784
9785 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9786 RegisterNetSyncVariableBool("m_IsTakeable");
9787 RegisterNetSyncVariableBool("m_IsHologram");
9788
9791 {
9794 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9795 }
9796
9798
9800 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9802
9804 }
9805
9807 {
9809 }
9810
9812 {
9815 {
9820 }
9821 }
9822
9823 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9824 {
9826 {
9829 }
9830
9832 }
9833
9835 {
9841 }
9842
9844
9846 {
9848
9849 if (!action)
9850 {
9851 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9852 return;
9853 }
9854
9856 if (!ai)
9857 {
9859 return;
9860 }
9861
9863 if (!action_array)
9864 {
9865 action_array = new array<ActionBase_Basic>;
9867 }
9868 if (LogManager.IsActionLogEnable())
9869 {
9870 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9871 }
9872
9873 if (action_array.Find(action) != -1)
9874 {
9875 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9876 }
9877 else
9878 {
9879 action_array.Insert(action);
9880 }
9881 }
9882
9884 {
9885 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9886 ActionBase action = player.GetActionManager().GetAction(actionName);
9889
9890 if (action_array)
9891 {
9892 action_array.RemoveItem(action);
9893 }
9894 }
9895
9896
9897
9899 {
9900 ActionOverrideData overrideData = new ActionOverrideData();
9904
9906 if (!actionMap)
9907 {
9910 }
9911
9912 actionMap.Insert(this.
Type(), overrideData);
9913
9914 }
9915
9917
9919
9920
9922 {
9925
9928
9929 string config_to_search = "CfgVehicles";
9930 string muzzle_owner_config;
9931
9933 {
9934 if (IsInherited(Weapon))
9935 config_to_search = "CfgWeapons";
9936
9937 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9938
9939 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9940
9941 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9942
9943 if (config_OnFire_subclass_count > 0)
9944 {
9945 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9946
9947 for (int i = 0; i < config_OnFire_subclass_count; i++)
9948 {
9949 string particle_class = "";
9950 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9951 string config_OnFire_entry = config_OnFire_class + particle_class;
9952 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9953 WPOF_array.Insert(WPOF);
9954 }
9955
9956
9958 }
9959 }
9960
9962 {
9963 config_to_search = "CfgWeapons";
9964 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9965
9966 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9967
9968 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9969
9970 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9971 {
9972 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9973
9974 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9975 {
9976 string particle_class2 = "";
9977 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9978 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9979 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9980 WPOBE_array.Insert(WPOBE);
9981 }
9982
9983
9985 }
9986 }
9987 }
9988
9989
9991 {
9994
9996 {
9997 string config_to_search = "CfgVehicles";
9998
9999 if (IsInherited(Weapon))
10000 config_to_search = "CfgWeapons";
10001
10002 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10003 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10004
10005 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10006 {
10007
10009
10011 {
10013 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10015 return;
10016 }
10017
10020
10021
10022
10023 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10024 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10025
10026 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10027 {
10028 string particle_class = "";
10029 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10030 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10031 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10032
10033 if (entry_type == CT_CLASS)
10034 {
10035 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10036 WPOOH_array.Insert(WPOF);
10037 }
10038 }
10039
10040
10042 }
10043 }
10044 }
10045
10047 {
10049 }
10050
10052 {
10054 {
10056
10059
10062
10063 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10064 }
10065 }
10066
10068 {
10070 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10071
10073 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10074
10076 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10077
10079 {
10081 }
10082 }
10083
10085 {
10087 }
10088
10090 {
10093 else
10095
10097 {
10100 }
10101 else
10102 {
10105
10108 }
10109
10111 }
10112
10114 {
10116 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10117 }
10118
10120 {
10122 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10124 }
10125
10127 {
10129 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10130 }
10131
10133 {
10136
10137 OverheatingParticle OP = new OverheatingParticle();
10142
10144 }
10145
10147 {
10150
10151 return -1;
10152 }
10153
10155 {
10157 {
10160
10161 for (int i = count; i > 0; --i)
10162 {
10163 int id = i - 1;
10166
10169
10170 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10171 {
10172 if (p)
10173 {
10176 }
10177 }
10178 }
10179 }
10180 }
10181
10183 {
10185 {
10187 {
10188 int id = i - 1;
10190
10191 if (OP)
10192 {
10194
10195 if (p)
10196 {
10198 }
10199
10200 delete OP;
10201 }
10202 }
10203
10206 }
10207 }
10208
10211 {
10212 return 0.0;
10213 }
10214
10215
10217 {
10218 return 250;
10219 }
10220
10222 {
10223 return 0;
10224 }
10225
10228 {
10230 return true;
10231
10232 return false;
10233 }
10234
10237 {
10240
10242 {
10244 }
10245 else
10246 {
10247
10249 }
10250
10252 }
10253
10260 {
10261 return -1;
10262 }
10263
10264
10265
10266
10268 {
10270 {
10271 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10272 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10273
10274 if (r_index >= 0)
10275 {
10276 InventoryLocation r_il = new InventoryLocation;
10277 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10278
10279 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10282 {
10283 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10284 }
10286 {
10287 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10288 }
10289
10290 }
10291
10292 player.GetHumanInventory().ClearUserReservedLocation(this);
10293 }
10294
10297 }
10298
10299
10300
10301
10303 {
10304 return ItemBase.m_DebugActionsMask;
10305 }
10306
10308 {
10309 return ItemBase.m_DebugActionsMask & mask;
10310 }
10311
10313 {
10314 ItemBase.m_DebugActionsMask = mask;
10315 }
10316
10318 {
10319 ItemBase.m_DebugActionsMask |= mask;
10320 }
10321
10323 {
10324 ItemBase.m_DebugActionsMask &= ~mask;
10325 }
10326
10328 {
10330 {
10332 }
10333 else
10334 {
10336 }
10337 }
10338
10339
10341 {
10342 if (GetEconomyProfile())
10343 {
10344 float q_max = GetEconomyProfile().GetQuantityMax();
10345 if (q_max > 0)
10346 {
10347 float q_min = GetEconomyProfile().GetQuantityMin();
10348 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10349
10351 {
10352 ComponentEnergyManager comp = GetCompEM();
10354 {
10356 }
10357 }
10359 {
10361
10362 }
10363
10364 }
10365 }
10366 }
10367
10370 {
10371 EntityAI parent = GetHierarchyParent();
10372
10373 if (parent)
10374 {
10375 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10376 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10377 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10378 }
10379 }
10380
10383 {
10384 EntityAI parent = GetHierarchyParent();
10385
10386 if (parent)
10387 {
10388 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10389 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10390 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10391 }
10392 }
10393
10395 {
10396
10397
10398
10399
10401
10403 {
10404 if (ScriptInputUserData.CanStoreInputUserData())
10405 {
10406 ScriptInputUserData ctx = new ScriptInputUserData;
10412 ctx.
Write(use_stack_max);
10415
10417 {
10418 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10419 }
10420 }
10421 }
10422 else if (!
g_Game.IsMultiplayer())
10423 {
10425 }
10426 }
10427
10429 {
10431 }
10432
10434 {
10436 }
10437
10439 {
10441 }
10442
10444 {
10445
10446 return false;
10447 }
10448
10450 {
10451 return false;
10452 }
10453
10457 {
10458 return false;
10459 }
10460
10462 {
10463 return "";
10464 }
10465
10467
10469 {
10470 return false;
10471 }
10472
10474 {
10475 return true;
10476 }
10477
10478
10479
10481 {
10482 return true;
10483 }
10484
10486 {
10487 return true;
10488 }
10489
10491 {
10492 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10494 }
10495
10497 {
10499 }
10500
10502 {
10504 if (!is_being_placed)
10506 SetSynchDirty();
10507 }
10508
10509
10511
10513 {
10515 }
10516
10518 {
10520 }
10521
10523 {
10524 return 1;
10525 }
10526
10528 {
10529 return false;
10530 }
10531
10533 {
10535 SetSynchDirty();
10536 }
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10573 {
10574 super.OnMovedInsideCargo(container);
10575
10576 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10577 }
10578
10579 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10580 {
10581 super.EEItemLocationChanged(oldLoc, newLoc);
10582
10583 PlayerBase newPlayer = null;
10584 PlayerBase oldPlayer = null;
10585
10586 if (newLoc.GetParent())
10587 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10588
10589 if (oldLoc.GetParent())
10590 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10591
10593 {
10594 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10595
10596 if (rIndex >= 0)
10597 {
10598 InventoryLocation rIl = new InventoryLocation;
10599 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10600
10601 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10604 {
10605 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10606 }
10608 {
10610 }
10611
10612 }
10613 }
10614
10616 {
10617 if (newPlayer)
10618 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10619
10620 if (newPlayer == oldPlayer)
10621 {
10622 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10623 {
10625 {
10626 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10627 {
10628 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10629 }
10630 }
10631 else
10632 {
10633 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10634 }
10635 }
10636
10637 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10638 {
10639 int type = oldLoc.GetType();
10641 {
10642 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10643 }
10645 {
10646 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10647 }
10648 }
10649 if (!m_OldLocation)
10650 {
10651 m_OldLocation = new InventoryLocation;
10652 }
10653 m_OldLocation.Copy(oldLoc);
10654 }
10655 else
10656 {
10657 if (m_OldLocation)
10658 {
10659 m_OldLocation.Reset();
10660 }
10661 }
10662
10663 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10664 }
10665 else
10666 {
10667 if (newPlayer)
10668 {
10669 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10670 if (resIndex >= 0)
10671 {
10672 InventoryLocation il = new InventoryLocation;
10673 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10675 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10678 {
10679 il.
GetParent().GetOnReleaseLock().Invoke(it);
10680 }
10682 {
10684 }
10685
10686 }
10687 }
10689 {
10690
10692 }
10693
10694 if (m_OldLocation)
10695 {
10696 m_OldLocation.Reset();
10697 }
10698 }
10699
10701 {
10702 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10703 }
10704
10706 {
10707 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10708 }
10709 }
10710
10711 override void EOnContact(IEntity other, Contact extra)
10712 {
10714 {
10715 int liquidType = -1;
10717 if (impactSpeed > 0.0)
10718 {
10720 #ifndef SERVER
10722 #else
10724 SetSynchDirty();
10725 #endif
10727 }
10728 }
10729
10730 #ifdef SERVER
10731 if (GetCompEM() && GetCompEM().IsPlugged())
10732 {
10733 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10734 GetCompEM().UnplugThis();
10735 }
10736 #endif
10737 }
10738
10740
10742 {
10744 }
10745
10747 {
10748
10749 }
10750
10752 {
10753 super.OnItemLocationChanged(old_owner, new_owner);
10754
10755 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10756 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10757
10758 if (!relatedPlayer && playerNew)
10759 relatedPlayer = playerNew;
10760
10761 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10762 {
10764 if (actionMgr)
10765 {
10766 ActionBase currentAction = actionMgr.GetRunningAction();
10767 if (currentAction)
10769 }
10770 }
10771
10772 Man ownerPlayerOld = null;
10773 Man ownerPlayerNew = null;
10774
10775 if (old_owner)
10776 {
10777 if (old_owner.
IsMan())
10778 {
10779 ownerPlayerOld = Man.Cast(old_owner);
10780 }
10781 else
10782 {
10783 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10784 }
10785 }
10786 else
10787 {
10789 {
10791
10792 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10793 {
10794 GetCompEM().UnplugThis();
10795 }
10796 }
10797 }
10798
10799 if (new_owner)
10800 {
10801 if (new_owner.
IsMan())
10802 {
10803 ownerPlayerNew = Man.Cast(new_owner);
10804 }
10805 else
10806 {
10807 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10808 }
10809 }
10810
10811 if (ownerPlayerOld != ownerPlayerNew)
10812 {
10813 if (ownerPlayerOld)
10814 {
10815 array<EntityAI> subItemsExit = new array<EntityAI>;
10817 for (int i = 0; i < subItemsExit.Count(); i++)
10818 {
10821 }
10822 }
10823
10824 if (ownerPlayerNew)
10825 {
10826 array<EntityAI> subItemsEnter = new array<EntityAI>;
10828 for (int j = 0; j < subItemsEnter.Count(); j++)
10829 {
10832 }
10833 }
10834 }
10835 else if (ownerPlayerNew != null)
10836 {
10837 PlayerBase nplayer;
10838 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10839 {
10840 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10842 for (int k = 0; k < subItemsUpdate.Count(); k++)
10843 {
10845 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10846 }
10847 }
10848 }
10849
10850 if (old_owner)
10851 old_owner.OnChildItemRemoved(this);
10852 if (new_owner)
10853 new_owner.OnChildItemReceived(this);
10854 }
10855
10856
10858 {
10859 super.EEDelete(parent);
10860 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10861 if (player)
10862 {
10864
10865 if (player.IsAlive())
10866 {
10867 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10868 if (r_index >= 0)
10869 {
10870 InventoryLocation r_il = new InventoryLocation;
10871 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10872
10873 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10876 {
10877 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10878 }
10880 {
10881 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10882 }
10883
10884 }
10885
10886 player.RemoveQuickBarEntityShortcut(this);
10887 }
10888 }
10889 }
10890
10892 {
10893 super.EEKilled(killer);
10894
10897 {
10898 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10899 {
10900 if (IsMagazine())
10901 {
10902 if (Magazine.Cast(this).GetAmmoCount() > 0)
10903 {
10905 }
10906 }
10907 else
10908 {
10910 }
10911 }
10912 }
10913 }
10914
10916 {
10917 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10918
10919 super.OnWasAttached(parent, slot_id);
10920
10923
10926 }
10927
10929 {
10930 super.OnWasDetached(parent, slot_id);
10931
10934
10937 }
10938
10940 {
10941 int idx;
10944
10945 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10946 if (inventory_slots.Count() < 1)
10947 {
10948 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10949 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10950 }
10951 else
10952 {
10953 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10954 }
10955
10956 idx = inventory_slots.Find(slot);
10957 if (idx < 0)
10958 return "";
10959
10960 return attach_types.Get(idx);
10961 }
10962
10964 {
10965 int idx = -1;
10966 string slot;
10967
10970
10971 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10972 if (inventory_slots.Count() < 1)
10973 {
10974 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10975 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10976 }
10977 else
10978 {
10979 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10980 if (detach_types.Count() < 1)
10981 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10982 }
10983
10984 for (int i = 0; i < inventory_slots.Count(); i++)
10985 {
10986 slot = inventory_slots.Get(i);
10987 }
10988
10989 if (slot != "")
10990 {
10991 if (detach_types.Count() == 1)
10992 idx = 0;
10993 else
10994 idx = inventory_slots.Find(slot);
10995 }
10996 if (idx < 0)
10997 return "";
10998
10999 return detach_types.Get(idx);
11000 }
11001
11003 {
11004
11006
11007
11008 float min_time = 1;
11009 float max_time = 3;
11010 float delay = Math.RandomFloat(min_time, max_time);
11011
11012 explode_timer.Run(delay, this, "DoAmmoExplosion");
11013 }
11014
11016 {
11017 Magazine magazine = Magazine.Cast(this);
11018 int pop_sounds_count = 6;
11019 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11020
11021
11022 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11023 string sound_name = pop_sounds[ sound_idx ];
11024 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11025
11026
11027 magazine.ServerAddAmmoCount(-1);
11028
11029
11030 float min_temp_to_explode = 100;
11031
11032 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11033 {
11035 }
11036 }
11037
11038
11039 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11040 {
11041 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11042
11043 const int CHANCE_DAMAGE_CARGO = 4;
11044 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11045 const int CHANCE_DAMAGE_NOTHING = 2;
11046
11048 {
11049 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11050 int chances;
11051 int rnd;
11052
11053 if (GetInventory().GetCargo())
11054 {
11055 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11056 rnd = Math.RandomInt(0,chances);
11057
11058 if (rnd < CHANCE_DAMAGE_CARGO)
11059 {
11061 }
11062 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11063 {
11065 }
11066 }
11067 else
11068 {
11069 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11070 rnd = Math.RandomInt(0,chances);
11071
11072 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11073 {
11075 }
11076 }
11077 }
11078 }
11079
11081 {
11082 CargoBase cargo = GetInventory().GetCargo();
11083 if (cargo)
11084 {
11086 if (item_count > 0)
11087 {
11088 int random_pick = Math.RandomInt(0, item_count);
11090 if (!item.IsExplosive())
11091 {
11092 item.AddHealth("","",damage);
11093 return true;
11094 }
11095 }
11096 }
11097 return false;
11098 }
11099
11101 {
11102 GameInventory inventory = GetInventory();
11104 if (attachment_count > 0)
11105 {
11106 int random_pick = Math.RandomInt(0, attachment_count);
11108 if (!attachment.IsExplosive())
11109 {
11110 attachment.AddHealth("","",damage);
11111 return true;
11112 }
11113 }
11114 return false;
11115 }
11116
11118 {
11120 }
11121
11123 {
11125 return GetInventory().CanRemoveEntity();
11126
11127 return false;
11128 }
11129
11131 {
11132
11134 return false;
11135
11136
11138 return false;
11139
11140
11141
11143 if (delta == 0)
11144 return false;
11145
11146
11147 return true;
11148 }
11149
11151 {
11153 {
11154 if (ScriptInputUserData.CanStoreInputUserData())
11155 {
11156 ScriptInputUserData ctx = new ScriptInputUserData;
11161 ctx.
Write(destination_entity);
11163 ctx.
Write(slot_id);
11165 }
11166 }
11167 else if (!
g_Game.IsMultiplayer())
11168 {
11170 }
11171 }
11172
11174 {
11175 float split_quantity_new;
11179 InventoryLocation loc = new InventoryLocation;
11180
11181 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11182 {
11184 split_quantity_new = stack_max;
11185 else
11187
11189 {
11190 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11191 if (new_item)
11192 {
11193 new_item.SetResultOfSplit(true);
11194 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11196 new_item.
SetQuantity(split_quantity_new,
false,
true);
11197 }
11198 }
11199 }
11200 else if (destination_entity && slot_id == -1)
11201 {
11202 if (quantity > stack_max)
11203 split_quantity_new = stack_max;
11204 else
11205 split_quantity_new = quantity;
11206
11208 {
11209 GameInventory destinationInventory = destination_entity.GetInventory();
11211 {
11214 }
11215
11216 if (new_item)
11217 {
11218 new_item.SetResultOfSplit(true);
11219 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11221 new_item.
SetQuantity(split_quantity_new,
false,
true);
11222 }
11223 }
11224 }
11225 else
11226 {
11227 if (stack_max != 0)
11228 {
11230 {
11232 }
11233
11234 if (split_quantity_new == 0)
11235 {
11236 if (!
g_Game.IsMultiplayer())
11237 player.PhysicalPredictiveDropItem(this);
11238 else
11239 player.ServerDropEntity(this);
11240 return;
11241 }
11242
11244 {
11246
11247 if (new_item)
11248 {
11249 new_item.SetResultOfSplit(true);
11250 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11253 new_item.PlaceOnSurface();
11254 }
11255 }
11256 }
11257 }
11258 }
11259
11261 {
11262 float split_quantity_new;
11266 InventoryLocation loc = new InventoryLocation;
11267
11268 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11269 {
11271 split_quantity_new = stack_max;
11272 else
11274
11276 {
11277 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11278 if (new_item)
11279 {
11280 new_item.SetResultOfSplit(true);
11281 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11283 new_item.
SetQuantity(split_quantity_new,
false,
true);
11284 }
11285 }
11286 }
11287 else if (destination_entity && slot_id == -1)
11288 {
11289 if (quantity > stack_max)
11290 split_quantity_new = stack_max;
11291 else
11292 split_quantity_new = quantity;
11293
11295 {
11296 GameInventory destinationInventory = destination_entity.GetInventory();
11298 {
11301 }
11302
11303 if (new_item)
11304 {
11305 new_item.SetResultOfSplit(true);
11306 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11308 new_item.
SetQuantity(split_quantity_new,
false,
true);
11309 }
11310 }
11311 }
11312 else
11313 {
11314 if (stack_max != 0)
11315 {
11317 {
11319 }
11320
11322 {
11324
11325 if (new_item)
11326 {
11327 new_item.SetResultOfSplit(true);
11328 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11331 new_item.PlaceOnSurface();
11332 }
11333 }
11334 }
11335 }
11336 }
11337
11339 {
11341 {
11342 if (ScriptInputUserData.CanStoreInputUserData())
11343 {
11344 ScriptInputUserData ctx = new ScriptInputUserData;
11349 dst.WriteToContext(ctx);
11351 }
11352 }
11353 else if (!
g_Game.IsMultiplayer())
11354 {
11356 }
11357 }
11358
11360 {
11362 {
11363 if (ScriptInputUserData.CanStoreInputUserData())
11364 {
11365 ScriptInputUserData ctx = new ScriptInputUserData;
11370 ctx.
Write(destination_entity);
11376 }
11377 }
11378 else if (!
g_Game.IsMultiplayer())
11379 {
11381 }
11382 }
11383
11385 {
11387 }
11388
11390 {
11392 float split_quantity_new;
11394 if (dst.IsValid())
11395 {
11396 int slot_id = dst.GetSlot();
11398
11399 if (quantity > stack_max)
11400 split_quantity_new = stack_max;
11401 else
11402 split_quantity_new = quantity;
11403
11405 {
11407
11408 if (new_item)
11409 {
11410 new_item.SetResultOfSplit(true);
11411 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11413 new_item.
SetQuantity(split_quantity_new,
false,
true);
11414 }
11415
11416 return new_item;
11417 }
11418 }
11419
11420 return null;
11421 }
11422
11424 {
11426 float split_quantity_new;
11428 if (destination_entity)
11429 {
11431 if (quantity > stackable)
11432 split_quantity_new = stackable;
11433 else
11434 split_quantity_new = quantity;
11435
11437 {
11438 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11439 if (new_item)
11440 {
11441 new_item.SetResultOfSplit(true);
11442 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11444 new_item.
SetQuantity(split_quantity_new,
false,
true);
11445 }
11446 }
11447 }
11448 }
11449
11451 {
11453 {
11454 if (ScriptInputUserData.CanStoreInputUserData())
11455 {
11456 ScriptInputUserData ctx = new ScriptInputUserData;
11461 ItemBase destination_entity =
this;
11462 ctx.
Write(destination_entity);
11466 }
11467 }
11468 else if (!
g_Game.IsMultiplayer())
11469 {
11471 }
11472 }
11473
11475 {
11477 float split_quantity_new;
11479 if (player)
11480 {
11482 if (quantity > stackable)
11483 split_quantity_new = stackable;
11484 else
11485 split_quantity_new = quantity;
11486
11488 {
11489 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11490 new_item =
ItemBase.Cast(in_hands);
11491 if (new_item)
11492 {
11493 new_item.SetResultOfSplit(true);
11494 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11496 new_item.SetQuantity(split_quantity_new, false, true);
11497 }
11498 }
11499 }
11500 }
11501
11503 {
11505 float split_quantity_new = Math.Floor(quantity * 0.5);
11506
11508 return;
11509
11511
11512 if (new_item)
11513 {
11514 if (new_item.GetQuantityMax() < split_quantity_new)
11515 {
11516 split_quantity_new = new_item.GetQuantityMax();
11517 }
11518
11519 new_item.SetResultOfSplit(true);
11520 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11521
11523 {
11526 }
11527 else
11528 {
11530 new_item.
SetQuantity(split_quantity_new,
false,
true);
11531 }
11532 }
11533 }
11534
11536 {
11538 float split_quantity_new = Math.Floor(quantity / 2);
11539
11541 return;
11542
11543 InventoryLocation invloc = new InventoryLocation;
11545
11547 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11548
11549 if (new_item)
11550 {
11551 if (new_item.GetQuantityMax() < split_quantity_new)
11552 {
11553 split_quantity_new = new_item.GetQuantityMax();
11554 }
11556 {
11559 }
11560 else if (split_quantity_new > 1)
11561 {
11563 new_item.
SetQuantity(split_quantity_new,
false,
true);
11564 }
11565 }
11566 }
11567
11570 {
11571 SetWeightDirty();
11573
11574 if (parent)
11575 parent.OnAttachmentQuantityChangedEx(this, delta);
11576
11578 {
11580 {
11582 }
11584 {
11585 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11587 }
11588 }
11589 }
11590
11593 {
11594
11595 }
11596
11599 {
11601 }
11602
11604 {
11605 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11606
11608 {
11609 if (newLevel == GameConstants.STATE_RUINED)
11610 {
11612 EntityAI parent = GetHierarchyParent();
11613 if (parent && parent.IsFireplace())
11614 {
11615 CargoBase cargo = GetInventory().GetCargo();
11616 if (cargo)
11617 {
11619 {
11621 }
11622 }
11623 }
11624 }
11625
11627 {
11628
11630 return;
11631 }
11632
11633 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11634 {
11636 }
11637 }
11638 }
11639
11640
11642 {
11643 super.OnRightClick();
11644
11646 {
11648 {
11649 if (ScriptInputUserData.CanStoreInputUserData())
11650 {
11651 EntityAI root = GetHierarchyRoot();
11652 Man playerOwner = GetHierarchyRootPlayer();
11653 InventoryLocation dst = new InventoryLocation;
11654
11655
11656 if (!playerOwner && root && root == this)
11657 {
11659 }
11660 else
11661 {
11662
11663 GetInventory().GetCurrentInventoryLocation(dst);
11665 {
11666 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11668 {
11670 }
11671 else
11672 {
11674
11675
11676 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11677 {
11679 }
11680 else
11681 {
11682 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11683 }
11684 }
11685 }
11686 }
11687
11688 ScriptInputUserData ctx = new ScriptInputUserData;
11696 }
11697 }
11698 else if (!
g_Game.IsMultiplayer())
11699 {
11701 }
11702 }
11703 }
11704
11706 {
11707 if (root)
11708 {
11709 vector m4[4];
11710 root.GetTransform(m4);
11711 dst.SetGround(this, m4);
11712 }
11713 else
11714 {
11715 GetInventory().GetCurrentInventoryLocation(dst);
11716 }
11717 }
11718
11719 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11720 {
11721
11722 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11723 return false;
11724
11725 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11726 return false;
11727
11728
11730 return false;
11731
11732
11733 Magazine mag = Magazine.Cast(this);
11734 if (mag)
11735 {
11736 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11737 return false;
11738
11739 if (stack_max_limit)
11740 {
11741 Magazine other_mag = Magazine.Cast(other_item);
11742 if (other_item)
11743 {
11744 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11745 return false;
11746 }
11747
11748 }
11749 }
11750 else
11751 {
11752
11754 return false;
11755
11757 return false;
11758 }
11759
11760 PlayerBase player = null;
11761 if (CastTo(player, GetHierarchyRootPlayer()))
11762 {
11763 if (player.GetInventory().HasAttachment(this))
11764 return false;
11765
11766 if (player.IsItemsToDelete())
11767 return false;
11768 }
11769
11770 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11771 return false;
11772
11773 int slotID;
11775 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11776 return false;
11777
11778 return true;
11779 }
11780
11782 {
11784 }
11785
11787 {
11788 return m_IsResultOfSplit;
11789 }
11790
11792 {
11793 m_IsResultOfSplit = value;
11794 }
11795
11797 {
11799 }
11800
11802 {
11803 float other_item_quantity = other_item.GetQuantity();
11804 float this_free_space;
11805
11807
11809
11810 if (other_item_quantity > this_free_space)
11811 {
11812 return this_free_space;
11813 }
11814 else
11815 {
11816 return other_item_quantity;
11817 }
11818 }
11819
11821 {
11823 }
11824
11826 {
11828 return;
11829
11830 if (!IsMagazine() && other_item)
11831 {
11833 if (quantity_used != 0)
11834 {
11835 float hp1 = GetHealth01("","");
11836 float hp2 = other_item.GetHealth01("","");
11837 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11838 hpResult = hpResult / (
GetQuantity() + quantity_used);
11839
11840 hpResult *= GetMaxHealth();
11841 Math.Round(hpResult);
11842 SetHealth("", "Health", hpResult);
11843
11845 other_item.AddQuantity(-quantity_used);
11846 }
11847 }
11849 }
11850
11852 {
11853 #ifdef SERVER
11854 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11855 GetHierarchyParent().IncreaseLifetimeUp();
11856 #endif
11857 };
11858
11860 {
11861 PlayerBase p = PlayerBase.Cast(player);
11862
11863 array<int> recipesIds = p.m_Recipes;
11864 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11865 if (moduleRecipesManager)
11866 {
11867 EntityAI itemInHands = player.GetEntityInHands();
11868 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11869 }
11870
11871 for (int i = 0;i < recipesIds.Count(); i++)
11872 {
11873 int key = recipesIds.Get(i);
11874 string recipeName = moduleRecipesManager.GetRecipeName(key);
11876 }
11877 }
11878
11879
11880 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11881 {
11882 super.GetDebugActions(outputList);
11883
11884
11890
11891
11896
11901
11902
11906
11907
11909 {
11913 }
11914
11917
11918
11922
11924
11925 InventoryLocation loc = new InventoryLocation();
11926 GetInventory().GetCurrentInventoryLocation(loc);
11928 {
11929 if (Gizmo_IsSupported())
11932 }
11933
11935 }
11936
11937
11938
11939
11941 {
11942 super.OnAction(action_id, player, ctx);
11943
11945 {
11946 switch (action_id)
11947 {
11951 return true;
11955 return true;
11956 }
11957 }
11958
11960 {
11961 switch (action_id)
11962 {
11964 Delete();
11965 return true;
11966 }
11967 }
11968
11969 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11970 {
11971 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11972 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11973 PlayerBase p = PlayerBase.Cast(player);
11974 if (
EActions.RECIPES_RANGE_START < 1000)
11975 {
11976 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11977 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11978 }
11979 }
11980 #ifndef SERVER
11981 else if (action_id ==
EActions.WATCH_PLAYER)
11982 {
11983 PluginDeveloper.SetDeveloperItemClientEx(player);
11984 }
11985 #endif
11987 {
11988 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11989 {
11990 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11991 OnDebugButtonPressServer(id + 1);
11992 }
11993
11994 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11995 {
11996 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11998 }
11999
12000 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12001 {
12002 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12004 }
12005
12006 else if (action_id ==
EActions.ADD_QUANTITY)
12007 {
12008 if (IsMagazine())
12009 {
12010 Magazine mag = Magazine.Cast(this);
12011 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12012 }
12013 else
12014 {
12016 }
12017
12018 if (m_EM)
12019 {
12020 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12021 }
12022
12023 }
12024
12025 else if (action_id ==
EActions.REMOVE_QUANTITY)
12026 {
12027 if (IsMagazine())
12028 {
12029 Magazine mag2 = Magazine.Cast(this);
12030 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12031 }
12032 else
12033 {
12035 }
12036 if (m_EM)
12037 {
12038 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12039 }
12040
12041 }
12042
12043 else if (action_id ==
EActions.SET_QUANTITY_0)
12044 {
12046
12047 if (m_EM)
12048 {
12049 m_EM.SetEnergy(0);
12050 }
12051 }
12052
12053 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12054 {
12056
12057 if (m_EM)
12058 {
12059 m_EM.SetEnergy(m_EM.GetEnergyMax());
12060 }
12061 }
12062
12063 else if (action_id ==
EActions.ADD_HEALTH)
12064 {
12065 AddHealth("","",GetMaxHealth("","Health")/5);
12066 }
12067 else if (action_id ==
EActions.REMOVE_HEALTH)
12068 {
12069 AddHealth("","",-GetMaxHealth("","Health")/5);
12070 }
12071 else if (action_id ==
EActions.DESTROY_HEALTH)
12072 {
12073 SetHealth01("","",0);
12074 }
12075 else if (action_id ==
EActions.WATCH_ITEM)
12076 {
12078 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12079 #ifdef DEVELOPER
12080 SetDebugDeveloper_item(this);
12081 #endif
12082 }
12083
12084 else if (action_id ==
EActions.ADD_TEMPERATURE)
12085 {
12086 AddTemperature(20);
12087
12088 }
12089
12090 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12091 {
12092 AddTemperature(-20);
12093
12094 }
12095
12096 else if (action_id ==
EActions.FLIP_FROZEN)
12097 {
12098 SetFrozen(!GetIsFrozen());
12099
12100 }
12101
12102 else if (action_id ==
EActions.ADD_WETNESS)
12103 {
12105
12106 }
12107
12108 else if (action_id ==
EActions.REMOVE_WETNESS)
12109 {
12111
12112 }
12113
12114 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12115 {
12118
12119
12120 }
12121
12122 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12123 {
12126 }
12127
12128 else if (action_id ==
EActions.MAKE_SPECIAL)
12129 {
12130 auto debugParams = DebugSpawnParams.WithPlayer(player);
12131 OnDebugSpawnEx(debugParams);
12132 }
12133
12134 }
12135
12136
12137 return false;
12138 }
12139
12140
12141
12142
12146
12149
12150
12151
12153 {
12154 return false;
12155 }
12156
12157
12159 {
12160 return true;
12161 }
12162
12163
12165 {
12166 return true;
12167 }
12168
12169
12170
12172 {
12173 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12174 return g_Game.ConfigIsExisting(config_path);
12175 }
12176
12179 {
12180 return null;
12181 }
12182
12184 {
12185 return false;
12186 }
12187
12189 {
12190 return false;
12191 }
12192
12196
12197
12199 {
12200 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12201 return module_repairing.CanRepair(this, item_repair_kit);
12202 }
12203
12204
12205 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12206 {
12207 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12208 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12209 }
12210
12211
12213 {
12214
12215
12216
12217
12218
12219
12220
12221
12222 return 1;
12223 }
12224
12225
12226
12228 {
12230 }
12231
12232
12233
12235 {
12237 }
12238
12239
12248 {
12249 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12250
12251 if (player)
12252 {
12253 player.MessageStatus(text);
12254 }
12255 }
12256
12257
12266 {
12267 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12268
12269 if (player)
12270 {
12271 player.MessageAction(text);
12272 }
12273 }
12274
12275
12284 {
12285 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12286
12287 if (player)
12288 {
12289 player.MessageFriendly(text);
12290 }
12291 }
12292
12293
12302 {
12303 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12304
12305 if (player)
12306 {
12307 player.MessageImportant(text);
12308 }
12309 }
12310
12312 {
12313 return true;
12314 }
12315
12316
12317 override bool KindOf(
string tag)
12318 {
12319 bool found = false;
12320 string item_name = this.
GetType();
12322 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12323
12324 int array_size = item_tag_array.Count();
12325 for (int i = 0; i < array_size; i++)
12326 {
12327 if (item_tag_array.Get(i) == tag)
12328 {
12329 found = true;
12330 break;
12331 }
12332 }
12333 return found;
12334 }
12335
12336
12338 {
12339
12340 super.OnRPC(sender, rpc_type,ctx);
12341
12342
12343 switch (rpc_type)
12344 {
12345 #ifndef SERVER
12346 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12347 Param2<bool, string> p = new Param2<bool, string>(false, "");
12348
12350 return;
12351
12352 bool play = p.param1;
12353 string soundSet = p.param2;
12354
12355 if (play)
12356 {
12358 {
12360 {
12362 }
12363 }
12364 else
12365 {
12367 }
12368 }
12369 else
12370 {
12372 }
12373
12374 break;
12375 #endif
12376
12377 }
12378
12380 {
12382 }
12383 }
12384
12385
12386
12387
12389 {
12390 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12391 return plugin.GetID(
name);
12392 }
12393
12395 {
12396 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12397 return plugin.GetName(id);
12398 }
12399
12402 {
12403
12404
12405 int varFlags;
12406 if (!ctx.
Read(varFlags))
12407 return;
12408
12409 if (varFlags & ItemVariableFlags.FLOAT)
12410 {
12412 }
12413 }
12414
12416 {
12417
12418 super.SerializeNumericalVars(floats_out);
12419
12420
12421
12423 {
12425 }
12426
12428 {
12430 }
12431
12433 {
12435 }
12436
12438 {
12443 }
12444
12446 {
12448 }
12449 }
12450
12452 {
12453
12454 super.DeSerializeNumericalVars(floats);
12455
12456
12457 int index = 0;
12458 int mask = Math.Round(floats.Get(index));
12459
12460 index++;
12461
12463 {
12465 {
12467 }
12468 else
12469 {
12470 float quantity = floats.Get(index);
12471 SetQuantity(quantity,
true,
false,
false,
false);
12472 }
12473 index++;
12474 }
12475
12477 {
12478 float wet = floats.Get(index);
12480 index++;
12481 }
12482
12484 {
12485 int liquidtype = Math.Round(floats.Get(index));
12487 index++;
12488 }
12489
12491 {
12493 index++;
12495 index++;
12497 index++;
12499 index++;
12500 }
12501
12503 {
12504 int cleanness = Math.Round(floats.Get(index));
12506 index++;
12507 }
12508 }
12509
12511 {
12512 super.WriteVarsToCTX(ctx);
12513
12514
12516 {
12518 }
12519
12521 {
12523 }
12524
12526 {
12528 }
12529
12531 {
12532 int r,g,b,a;
12538 }
12539
12541 {
12543 }
12544 }
12545
12547 {
12548 if (!super.ReadVarsFromCTX(ctx,version))
12549 return false;
12550
12551 int intValue;
12552 float value;
12553
12554 if (version < 140)
12555 {
12556 if (!ctx.
Read(intValue))
12557 return false;
12558
12559 m_VariablesMask = intValue;
12560 }
12561
12563 {
12564 if (!ctx.
Read(value))
12565 return false;
12566
12568 {
12570 }
12571 else
12572 {
12574 }
12575 }
12576
12577 if (version < 140)
12578 {
12580 {
12581 if (!ctx.
Read(value))
12582 return false;
12583 SetTemperatureDirect(value);
12584 }
12585 }
12586
12588 {
12589 if (!ctx.
Read(value))
12590 return false;
12592 }
12593
12595 {
12596 if (!ctx.
Read(intValue))
12597 return false;
12599 }
12600
12602 {
12603 int r,g,b,a;
12605 return false;
12607 return false;
12609 return false;
12611 return false;
12612
12614 }
12615
12617 {
12618 if (!ctx.
Read(intValue))
12619 return false;
12621 }
12622
12623 if (version >= 138 && version < 140)
12624 {
12626 {
12627 if (!ctx.
Read(intValue))
12628 return false;
12629 SetFrozen(intValue);
12630 }
12631 }
12632
12633 return true;
12634 }
12635
12636
12638 {
12641 {
12643 }
12644
12645 if (!super.OnStoreLoad(ctx, version))
12646 {
12648 return false;
12649 }
12650
12651 if (version >= 114)
12652 {
12653 bool hasQuickBarIndexSaved;
12654
12655 if (!ctx.
Read(hasQuickBarIndexSaved))
12656 {
12658 return false;
12659 }
12660
12661 if (hasQuickBarIndexSaved)
12662 {
12663 int itmQBIndex;
12664
12665
12666 if (!ctx.
Read(itmQBIndex))
12667 {
12669 return false;
12670 }
12671
12672 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12673 if (itmQBIndex != -1 && parentPlayer)
12674 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12675 }
12676 }
12677 else
12678 {
12679
12680 PlayerBase player;
12681 int itemQBIndex;
12682 if (version ==
int.
MAX)
12683 {
12684 if (!ctx.
Read(itemQBIndex))
12685 {
12687 return false;
12688 }
12689 }
12690 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12691 {
12692
12693 if (!ctx.
Read(itemQBIndex))
12694 {
12696 return false;
12697 }
12698 if (itemQBIndex != -1 && player)
12699 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12700 }
12701 }
12702
12703 if (version < 140)
12704 {
12705
12706 if (!LoadVariables(ctx, version))
12707 {
12709 return false;
12710 }
12711 }
12712
12713
12715 {
12717 return false;
12718 }
12719 if (version >= 132)
12720 {
12722 if (raib)
12723 {
12725 {
12727 return false;
12728 }
12729 }
12730 }
12731
12733 return true;
12734 }
12735
12736
12737
12739 {
12740 super.OnStoreSave(ctx);
12741
12742 PlayerBase player;
12743 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12744 {
12746
12747 int itemQBIndex = -1;
12748 itemQBIndex = player.FindQuickBarEntityIndex(this);
12749 ctx.
Write(itemQBIndex);
12750 }
12751 else
12752 {
12754 }
12755
12757
12759 if (raib)
12760 {
12762 }
12763 }
12764
12765
12767 {
12768 super.AfterStoreLoad();
12769
12771 {
12773 }
12774
12776 {
12779 }
12780 }
12781
12783 {
12784 super.EEOnAfterLoad();
12785
12787 {
12789 }
12790
12793 }
12794
12796 {
12797 return false;
12798 }
12799
12800
12801
12803 {
12805 {
12806 #ifdef PLATFORM_CONSOLE
12807
12809 {
12811 if (menu)
12812 {
12814 }
12815 }
12816 #endif
12817 }
12818
12820 {
12823 }
12824
12826 {
12827 SetWeightDirty();
12829 }
12831 {
12834 }
12835
12837 {
12840
12843 }
12845 {
12849 }
12850
12851 super.OnVariablesSynchronized();
12852 }
12853
12854
12855
12857 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12858 {
12859 if (!IsServerCheck(allow_client))
12860 return false;
12861
12863 return false;
12864
12867
12868 if (value <= (min + 0.001))
12869 value = min;
12870
12871 if (value == min)
12872 {
12873 if (destroy_config)
12874 {
12875 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12876 if (dstr)
12877 {
12879 this.Delete();
12880 return true;
12881 }
12882 }
12883 else if (destroy_forced)
12884 {
12886 this.Delete();
12887 return true;
12888 }
12889
12891 }
12892
12895
12897 {
12898 EntityAI parent = GetHierarchyRoot();
12899 InventoryLocation iLoc = new InventoryLocation();
12900 GetInventory().GetCurrentInventoryLocation(iLoc);
12902 {
12903 int iLocSlot = iLoc.
GetSlot();
12905 {
12907 }
12909 {
12911 }
12912 }
12913 }
12914
12916 {
12918
12919 if (delta)
12921 }
12922
12924
12925 return false;
12926 }
12927
12928
12930 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12931 {
12933 }
12934
12936 {
12939 }
12940
12942 {
12945 }
12946
12948 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12949 {
12950 float value_clamped = Math.Clamp(value, 0, 1);
12952 SetQuantity(result, destroy_config, destroy_forced);
12953 }
12954
12955
12958 {
12960 }
12961
12963 {
12965 }
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12977 {
12978 int slot = -1;
12979 GameInventory inventory = GetInventory();
12980 if (inventory)
12981 {
12982 InventoryLocation il = new InventoryLocation;
12985 }
12986
12988 }
12989
12991 {
12992 float quantity_max = 0;
12993
12995 {
12996 if (attSlotID != -1)
12997 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12998
12999 if (quantity_max <= 0)
13001 }
13002
13003 if (quantity_max <= 0)
13005
13006 return quantity_max;
13007 }
13008
13010 {
13012 }
13013
13015 {
13017 }
13018
13019
13021 {
13023 }
13024
13026 {
13028 }
13029
13031 {
13033 }
13034
13035
13037 {
13038
13039 float weightEx = GetWeightEx();
13040 float special = GetInventoryAndCargoWeight();
13041 return weightEx - special;
13042 }
13043
13044
13046 {
13048 }
13049
13051 {
13053 {
13054 #ifdef DEVELOPER
13055 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13056 {
13057 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13059 }
13060 #endif
13061
13062 return GetQuantity() * GetConfigWeightModified();
13063 }
13064 else if (HasEnergyManager())
13065 {
13066 #ifdef DEVELOPER
13067 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13068 {
13069 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13070 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13071 }
13072 #endif
13073 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13074 }
13075 else
13076 {
13077 #ifdef DEVELOPER
13078 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13079 {
13080 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13081 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13082 }
13083 #endif
13084 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13085 }
13086 }
13087
13090 {
13091 int item_count = 0;
13093
13094 GameInventory inventory = GetInventory();
13095 CargoBase cargo = inventory.
GetCargo();
13096 if (cargo != NULL)
13097 {
13099 }
13100
13102 for (int i = 0; i < nAttachments; ++i)
13103 {
13105 if (item)
13106 item_count += item.GetNumberOfItems();
13107 }
13108 return item_count;
13109 }
13110
13113 {
13114 float weight = 0;
13115 float wetness = 1;
13116 if (include_wetness)
13119 {
13120 weight = wetness * m_ConfigWeight;
13121 }
13123 {
13124 weight = 1;
13125 }
13126 return weight;
13127 }
13128
13129
13130
13132 {
13133 GameInventory inventory = GetInventory();
13134 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13135 {
13136 array<EntityAI> items = new array<EntityAI>;
13138 for (int i = 0; i < items.Count(); ++i)
13139 {
13141 if (item)
13142 {
13143 g_Game.ObjectDelete(item);
13144 }
13145 }
13146 }
13147 }
13148
13149
13150
13151
13153 {
13154 float energy = 0;
13155 if (HasEnergyManager())
13156 {
13157 energy = GetCompEM().GetEnergy();
13158 }
13159 return energy;
13160 }
13161
13162
13164 {
13165 super.OnEnergyConsumed();
13166
13168 }
13169
13171 {
13172 super.OnEnergyAdded();
13173
13175 }
13176
13177
13179 {
13180 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13181 {
13183 {
13184 float energy_0to1 = GetCompEM().GetEnergy0To1();
13186 }
13187 }
13188 }
13189
13190
13192 {
13193 return ConfigGetFloat("heatIsolation");
13194 }
13195
13197 {
13199 }
13200
13202 {
13203 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13204 if (
g_Game.ConfigIsExisting(paramPath))
13205 return g_Game.ConfigGetFloat(paramPath);
13206
13207 return 0.0;
13208 }
13209
13211 {
13212 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13213 if (
g_Game.ConfigIsExisting(paramPath))
13214 return g_Game.ConfigGetFloat(paramPath);
13215
13216 return 0.0;
13217 }
13218
13219 override void SetWet(
float value,
bool allow_client =
false)
13220 {
13221 if (!IsServerCheck(allow_client))
13222 return;
13223
13226
13228
13229 m_VarWet = Math.Clamp(value, min, max);
13230
13232 {
13235 }
13236 }
13237
13238 override void AddWet(
float value)
13239 {
13241 }
13242
13244 {
13246 }
13247
13249 {
13251 }
13252
13254 {
13256 }
13257
13259 {
13261 }
13262
13264 {
13266 }
13267
13268 override void OnWetChanged(
float newVal,
float oldVal)
13269 {
13272 if (newLevel != oldLevel)
13273 {
13275 }
13276 }
13277
13279 {
13280 SetWeightDirty();
13281 }
13282
13284 {
13285 return GetWetLevelInternal(
m_VarWet);
13286 }
13287
13288
13289
13291 {
13293 }
13294
13296 {
13298 }
13299
13301 {
13303 }
13304
13306 {
13308 }
13309
13310
13311
13313 {
13314 if (ConfigIsExisting("itemModelLength"))
13315 {
13316 return ConfigGetFloat("itemModelLength");
13317 }
13318 return 0;
13319 }
13320
13322 {
13323 if (ConfigIsExisting("itemAttachOffset"))
13324 {
13325 return ConfigGetFloat("itemAttachOffset");
13326 }
13327 return 0;
13328 }
13329
13330 override void SetCleanness(
int value,
bool allow_client =
false)
13331 {
13332 if (!IsServerCheck(allow_client))
13333 return;
13334
13336
13338
13341 }
13342
13344 {
13346 }
13347
13349 {
13350 return true;
13351 }
13352
13353
13354
13355
13357 {
13359 }
13360
13362 {
13364 }
13365
13366
13367
13368
13369 override void SetColor(
int r,
int g,
int b,
int a)
13370 {
13376 }
13378 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13379 {
13384 }
13385
13387 {
13389 }
13390
13393 {
13394 int r,g,b,a;
13396 r = r/255;
13397 g = g/255;
13398 b = b/255;
13399 a = a/255;
13400 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13401 }
13402
13403
13404
13405 override void SetLiquidType(
int value,
bool allow_client =
false)
13406 {
13407 if (!IsServerCheck(allow_client))
13408 return;
13409
13414 }
13415
13417 {
13418 return ConfigGetInt("varLiquidTypeInit");
13419 }
13420
13422 {
13424 }
13425
13427 {
13429 SetFrozen(false);
13430 }
13431
13434 {
13435 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13436 }
13437
13438
13441 {
13442 PlayerBase nplayer;
13443 if (PlayerBase.CastTo(nplayer, player))
13444 {
13446 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13447 }
13448 }
13449
13450
13453 {
13454 PlayerBase nplayer;
13455 if (PlayerBase.CastTo(nplayer,player))
13456 {
13457 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13458 }
13459
13460 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13461
13462 if (HasEnergyManager())
13463 {
13464 GetCompEM().UpdatePlugState();
13465 }
13466 }
13467
13468
13470 {
13471 super.OnPlacementStarted(player);
13472
13474 }
13475
13476 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13477 {
13479 {
13480 m_AdminLog.OnPlacementComplete(player,
this);
13481 }
13482
13483 super.OnPlacementComplete(player, position, orientation);
13484 }
13485
13486
13487
13488
13489
13491 {
13493 {
13494 return true;
13495 }
13496 else
13497 {
13498 return false;
13499 }
13500 }
13501
13502
13504 {
13506 {
13508 }
13509 }
13510
13511
13513 {
13515 }
13516
13518 {
13520 }
13521
13522 override void InsertAgent(
int agent,
float count = 1)
13523 {
13524 if (count < 1)
13525 return;
13526
13528 }
13529
13532 {
13534 }
13535
13536
13538 {
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
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13584 {
13586 return false;
13587 return true;
13588 }
13589
13591 {
13592
13594 }
13595
13596
13599 {
13600 super.CheckForRoofLimited(timeTresholdMS);
13601
13602 float time =
g_Game.GetTime();
13603 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13604 {
13605 m_PreviousRoofTestTime = time;
13606 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13607 }
13608 }
13609
13610
13612 {
13614 {
13615 return 0;
13616 }
13617
13618 if (GetInventory().GetAttachmentSlotsCount() != 0)
13619 {
13620 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13621 if (filter)
13622 return filter.GetProtectionLevel(type, false, system);
13623 else
13624 return 0;
13625 }
13626
13627 string subclassPath, entryName;
13628
13629 switch (type)
13630 {
13632 entryName = "biological";
13633 break;
13635 entryName = "chemical";
13636 break;
13637 default:
13638 entryName = "biological";
13639 break;
13640 }
13641
13642 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13643
13644 return g_Game.ConfigGetFloat(subclassPath + entryName);
13645 }
13646
13647
13648
13651 {
13652 if (!IsMagazine())
13654
13656 }
13657
13658
13659
13660
13661
13666 {
13667 return true;
13668 }
13669
13671 {
13673 }
13674
13675
13676
13677
13678
13680 {
13681 if (parent)
13682 {
13683 if (parent.IsInherited(DayZInfected))
13684 return true;
13685
13686 if (!parent.IsRuined())
13687 return true;
13688 }
13689
13690 return true;
13691 }
13692
13694 {
13695 if (!super.CanPutAsAttachment(parent))
13696 {
13697 return false;
13698 }
13699
13700 if (!IsRuined() && !parent.IsRuined())
13701 {
13702 return true;
13703 }
13704
13705 return false;
13706 }
13707
13709 {
13710
13711
13712
13713
13714 return super.CanReceiveItemIntoCargo(item);
13715 }
13716
13718 {
13719
13720
13721
13722
13723 GameInventory attachmentInv = attachment.GetInventory();
13725 {
13726 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13727 return false;
13728 }
13729
13730 InventoryLocation loc = new InventoryLocation();
13731 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13732 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13733 return false;
13734
13735 return super.CanReceiveAttachment(attachment, slotId);
13736 }
13737
13739 {
13740 if (!super.CanReleaseAttachment(attachment))
13741 return false;
13742
13743 return GetInventory().AreChildrenAccessible();
13744 }
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13767 {
13768 int id = muzzle_owner.GetMuzzleID();
13769 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13770
13771 if (WPOF_array)
13772 {
13773 for (int i = 0; i < WPOF_array.Count(); i++)
13774 {
13775 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13776
13777 if (WPOF)
13778 {
13779 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13780 }
13781 }
13782 }
13783 }
13784
13785
13787 {
13788 int id = muzzle_owner.GetMuzzleID();
13790
13791 if (WPOBE_array)
13792 {
13793 for (int i = 0; i < WPOBE_array.Count(); i++)
13794 {
13795 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13796
13797 if (WPOBE)
13798 {
13799 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13800 }
13801 }
13802 }
13803 }
13804
13805
13807 {
13808 int id = muzzle_owner.GetMuzzleID();
13809 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13810
13811 if (WPOOH_array)
13812 {
13813 for (int i = 0; i < WPOOH_array.Count(); i++)
13814 {
13815 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13816
13817 if (WPOOH)
13818 {
13819 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13820 }
13821 }
13822 }
13823 }
13824
13825
13827 {
13828 int id = muzzle_owner.GetMuzzleID();
13829 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13830
13831 if (WPOOH_array)
13832 {
13833 for (int i = 0; i < WPOOH_array.Count(); i++)
13834 {
13835 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13836
13837 if (WPOOH)
13838 {
13839 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13840 }
13841 }
13842 }
13843 }
13844
13845
13847 {
13848 int id = muzzle_owner.GetMuzzleID();
13849 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13850
13851 if (WPOOH_array)
13852 {
13853 for (int i = 0; i < WPOOH_array.Count(); i++)
13854 {
13855 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13856
13857 if (WPOOH)
13858 {
13859 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13860 }
13861 }
13862 }
13863 }
13864
13865
13866
13868 {
13870 {
13871 return true;
13872 }
13873
13874 return false;
13875 }
13876
13878 {
13880 {
13881 return true;
13882 }
13883
13884 return false;
13885 }
13886
13888 {
13890 {
13891 return true;
13892 }
13893
13894 return false;
13895 }
13896
13898 {
13899 return false;
13900 }
13901
13904 {
13905 return UATimeSpent.DEFAULT_DEPLOY;
13906 }
13907
13908
13909
13910
13912 {
13914 SetSynchDirty();
13915 }
13916
13918 {
13920 }
13921
13922
13924 {
13925 return false;
13926 }
13927
13930 {
13931 string att_type = "None";
13932
13933 if (ConfigIsExisting("soundAttType"))
13934 {
13935 att_type = ConfigGetString("soundAttType");
13936 }
13937
13939 }
13940
13942 {
13944 }
13945
13946
13947
13948
13949
13955
13957 {
13960
13962 }
13963
13964
13966 {
13968 return;
13969
13971
13974
13977
13978 SoundParameters params = new SoundParameters();
13982 }
13983
13984
13986 {
13988 {
13991
13992 SetSynchDirty();
13993
13996 }
13997 }
13998
14000 {
14002 }
14003
14004
14006 {
14008 return;
14009
14011 SetSynchDirty();
14012
14015 }
14016
14018 {
14021 }
14022
14024 {
14026 }
14027
14028 void OnApply(PlayerBase player);
14029
14031 {
14032 return 1.0;
14033 };
14034
14036 {
14038 }
14039
14041 {
14043 }
14044
14046
14048 {
14049 SetDynamicPhysicsLifeTime(0.01);
14051 }
14052
14054 {
14055 array<string> zone_names = new array<string>;
14056 GetDamageZones(zone_names);
14057 for (int i = 0; i < zone_names.Count(); i++)
14058 {
14059 SetHealthMax(zone_names.Get(i),"Health");
14060 }
14061 SetHealthMax("","Health");
14062 }
14063
14066 {
14067 float global_health = GetHealth01("","Health");
14068 array<string> zones = new array<string>;
14069 GetDamageZones(zones);
14070
14071 for (int i = 0; i < zones.Count(); i++)
14072 {
14073 SetHealth01(zones.Get(i),"Health",global_health);
14074 }
14075 }
14076
14079 {
14080 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14081 }
14082
14084 {
14085 if (!hasRootAsPlayer)
14086 {
14087 if (refParentIB)
14088 {
14089
14090 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14091 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14092
14093 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14094 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14095
14098 }
14099 else
14100 {
14101
14104 }
14105 }
14106 }
14107
14109 {
14111 {
14112 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14113 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14114 {
14115 float heatPermCoef = 1.0;
14117 while (ent)
14118 {
14119 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14120 ent = ent.GetHierarchyParent();
14121 }
14122
14123 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14124 }
14125 }
14126 }
14127
14129 {
14130
14131 EntityAI parent = GetHierarchyParent();
14132 if (!parent)
14133 {
14134 hasParent = false;
14135 hasRootAsPlayer = false;
14136 }
14137 else
14138 {
14139 hasParent = true;
14140 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14141 refParentIB =
ItemBase.Cast(parent);
14142 }
14143 }
14144
14145 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14146 {
14147
14148 }
14149
14151 {
14152
14153 return false;
14154 }
14155
14157 {
14158
14159
14160 return false;
14161 }
14162
14164 {
14165
14166 return false;
14167 }
14168
14171 {
14172 return !GetIsFrozen() &&
IsOpen();
14173 }
14174
14176 {
14177 bool hasParent = false, hasRootAsPlayer = false;
14179
14180 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14181 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14182
14183 if (wwtu || foodDecay)
14184 {
14188
14189 if (processWetness || processTemperature || processDecay)
14190 {
14192
14193 if (processWetness)
14194 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14195
14196 if (processTemperature)
14198
14199 if (processDecay)
14200 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14201 }
14202 }
14203 }
14204
14207 {
14209 }
14210
14212 {
14215
14216 return super.GetTemperatureFreezeThreshold();
14217 }
14218
14220 {
14223
14224 return super.GetTemperatureThawThreshold();
14225 }
14226
14228 {
14231
14232 return super.GetItemOverheatThreshold();
14233 }
14234
14236 {
14238 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14239
14240 return super.GetTemperatureFreezeTime();
14241 }
14242
14244 {
14246 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14247
14248 return super.GetTemperatureThawTime();
14249 }
14250
14255
14257 {
14258 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14259 }
14260
14262 {
14263 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14264 }
14265
14268 {
14270 }
14271
14273 {
14275 }
14276
14278 {
14280 }
14281
14284 {
14285 return null;
14286 }
14287
14290 {
14291 return false;
14292 }
14293
14295 {
14297 {
14300 if (!trg)
14301 {
14303 explosive = this;
14304 }
14305
14306 explosive.PairRemote(trg);
14308
14309 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14310 trg.SetPersistentPairID(persistentID);
14311 explosive.SetPersistentPairID(persistentID);
14312
14313 return true;
14314 }
14315 return false;
14316 }
14317
14320 {
14321 float ret = 1.0;
14324 ret *= GetHealth01();
14325
14326 return ret;
14327 }
14328
14329 #ifdef DEVELOPER
14330 override void SetDebugItem()
14331 {
14332 super.SetDebugItem();
14333 _itemBase = this;
14334 }
14335
14337 {
14338 string text = super.GetDebugText();
14339
14341 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14342
14343 return text;
14344 }
14345 #endif
14346
14348 {
14349 return true;
14350 }
14351
14353
14355
14357 {
14360 }
14361
14362
14370
14386
14387 [
Obsolete(
"Use ItemSoundHandler instead")]
14390 {
14391 if (!
g_Game.IsDedicatedServer())
14392 {
14393 if (ConfigIsExisting("attachSoundSet"))
14394 {
14395 string cfg_path = "";
14396 string soundset = "";
14397 string type_name =
GetType();
14398
14401 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14402 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14403
14404 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14405 {
14406 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14407 {
14408 if (cfg_slot_array[i] == slot_type)
14409 {
14410 soundset = cfg_soundset_array[i];
14411 break;
14412 }
14413 }
14414 }
14415
14416 if (soundset != "")
14417 {
14418 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14420 }
14421 }
14422 }
14423 }
14424
14426}
14427
14429{
14431 if (entity)
14432 {
14433 bool is_item = entity.IsInherited(
ItemBase);
14434 if (is_item && full_quantity)
14435 {
14438 }
14439 }
14440 else
14441 {
14443 return NULL;
14444 }
14445 return entity;
14446}
14447
14449{
14450 if (item)
14451 {
14452 if (health > 0)
14453 item.SetHealth("", "", health);
14454
14455 if (item.CanHaveTemperature())
14456 {
14458 if (item.CanFreeze())
14459 item.SetFrozen(false);
14460 }
14461
14462 if (item.HasEnergyManager())
14463 {
14464 if (quantity >= 0)
14465 {
14466 item.GetCompEM().SetEnergy0To1(quantity);
14467 }
14468 else
14469 {
14471 }
14472 }
14473 else if (item.IsMagazine())
14474 {
14475 Magazine mag = Magazine.Cast(item);
14476 if (quantity >= 0)
14477 {
14478 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14479 }
14480 else
14481 {
14483 }
14484
14485 }
14486 else
14487 {
14488 if (quantity >= 0)
14489 {
14490 item.SetQuantityNormalized(quantity, false);
14491 }
14492 else
14493 {
14495 }
14496
14497 }
14498 }
14499}
14500
14501#ifdef DEVELOPER
14503#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.