9534{
9536 {
9537 return true;
9538 }
9539};
9540
9542{
9543
9544};
9545
9546
9547
9549{
9553
9555
9558
9559
9560
9561
9562
9571
9577
9582
9587
9608 protected bool m_IsResultOfSplit
9609
9611
9616
9617
9618
9620
9624
9625
9626
9628
9631
9632
9633
9639
9640
9648
9651
9652
9654
9655
9657
9658
9663
9664
9669
9671
9672
9674
9675
9677 {
9682
9683 if (!
g_Game.IsDedicatedServer())
9684 {
9686 {
9688
9690 {
9692 }
9693 }
9694
9697 }
9698
9699 m_OldLocation = null;
9700
9702 {
9704 }
9705
9706 if (ConfigIsExisting("headSelectionsToHide"))
9707 {
9710 }
9711
9713 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9714 {
9716 }
9717
9719
9720 m_IsResultOfSplit = false;
9721
9723 }
9724
9726 {
9727 super.InitItemVariables();
9728
9734 m_Count = ConfigGetInt(
"count");
9735
9738
9743
9746
9751
9763
9767
9768
9771 if (ConfigIsExisting("canBeSplit"))
9772 {
9775 }
9776
9778 if (ConfigIsExisting("itemBehaviour"))
9780
9781
9784 RegisterNetSyncVariableInt("m_VarLiquidType");
9785 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9786
9787 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9788 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9789 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9790
9791 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9792 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9793 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9794 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9795
9796 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9797 RegisterNetSyncVariableBool("m_IsTakeable");
9798 RegisterNetSyncVariableBool("m_IsHologram");
9799
9802 {
9805 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9806 }
9807
9809
9811 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9813
9815 }
9816
9818 {
9820 }
9821
9823 {
9826 {
9831 }
9832 }
9833
9834 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9835 {
9837 {
9840 }
9841
9843 }
9844
9846 {
9852 }
9853
9855
9857 {
9859
9860 if (!action)
9861 {
9862 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9863 return;
9864 }
9865
9867 if (!ai)
9868 {
9870 return;
9871 }
9872
9874 if (!action_array)
9875 {
9876 action_array = new array<ActionBase_Basic>;
9878 }
9879 if (LogManager.IsActionLogEnable())
9880 {
9881 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9882 }
9883
9884 if (action_array.Find(action) != -1)
9885 {
9886 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9887 }
9888 else
9889 {
9890 action_array.Insert(action);
9891 }
9892 }
9893
9895 {
9896 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9897 ActionBase action = player.GetActionManager().GetAction(actionName);
9900
9901 if (action_array)
9902 {
9903 action_array.RemoveItem(action);
9904 }
9905 }
9906
9907
9908
9910 {
9911 ActionOverrideData overrideData = new ActionOverrideData();
9915
9917 if (!actionMap)
9918 {
9921 }
9922
9923 actionMap.Insert(this.
Type(), overrideData);
9924
9925 }
9926
9928
9930
9931
9933 {
9936
9939
9940 string config_to_search = "CfgVehicles";
9941 string muzzle_owner_config;
9942
9944 {
9945 if (IsInherited(Weapon))
9946 config_to_search = "CfgWeapons";
9947
9948 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9949
9950 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9951
9952 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9953
9954 if (config_OnFire_subclass_count > 0)
9955 {
9956 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9957
9958 for (int i = 0; i < config_OnFire_subclass_count; i++)
9959 {
9960 string particle_class = "";
9961 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9962 string config_OnFire_entry = config_OnFire_class + particle_class;
9963 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9964 WPOF_array.Insert(WPOF);
9965 }
9966
9967
9969 }
9970 }
9971
9973 {
9974 config_to_search = "CfgWeapons";
9975 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9976
9977 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9978
9979 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9980
9981 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9982 {
9983 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9984
9985 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9986 {
9987 string particle_class2 = "";
9988 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9989 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9990 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9991 WPOBE_array.Insert(WPOBE);
9992 }
9993
9994
9996 }
9997 }
9998 }
9999
10000
10002 {
10005
10007 {
10008 string config_to_search = "CfgVehicles";
10009
10010 if (IsInherited(Weapon))
10011 config_to_search = "CfgWeapons";
10012
10013 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10014 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10015
10016 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10017 {
10018
10020
10022 {
10024 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10026 return;
10027 }
10028
10031
10032
10033
10034 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10035 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10036
10037 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10038 {
10039 string particle_class = "";
10040 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10041 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10042 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10043
10044 if (entry_type == CT_CLASS)
10045 {
10046 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10047 WPOOH_array.Insert(WPOF);
10048 }
10049 }
10050
10051
10053 }
10054 }
10055 }
10056
10058 {
10060 }
10061
10063 {
10065 {
10067
10070
10073
10074 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10075 }
10076 }
10077
10079 {
10081 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10082
10084 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10085
10087 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10088
10090 {
10092 }
10093 }
10094
10096 {
10098 }
10099
10101 {
10104 else
10106
10108 {
10111 }
10112 else
10113 {
10116
10119 }
10120
10122 }
10123
10125 {
10127 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10128 }
10129
10131 {
10133 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10135 }
10136
10138 {
10140 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10141 }
10142
10144 {
10147
10148 OverheatingParticle OP = new OverheatingParticle();
10153
10155 }
10156
10158 {
10161
10162 return -1;
10163 }
10164
10166 {
10168 {
10171
10172 for (int i = count; i > 0; --i)
10173 {
10174 int id = i - 1;
10177
10180
10181 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10182 {
10183 if (p)
10184 {
10187 }
10188 }
10189 }
10190 }
10191 }
10192
10194 {
10196 {
10198 {
10199 int id = i - 1;
10201
10202 if (OP)
10203 {
10205
10206 if (p)
10207 {
10209 }
10210
10211 delete OP;
10212 }
10213 }
10214
10217 }
10218 }
10219
10222 {
10223 return 0.0;
10224 }
10225
10226
10228 {
10229 return 250;
10230 }
10231
10233 {
10234 return 0;
10235 }
10236
10239 {
10241 return true;
10242
10243 return false;
10244 }
10245
10248 {
10251
10253 {
10255 }
10256 else
10257 {
10258
10260 }
10261
10263 }
10264
10271 {
10272 return -1;
10273 }
10274
10275
10276
10277
10279 {
10281 {
10282 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10283 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10284
10285 if (r_index >= 0)
10286 {
10287 InventoryLocation r_il = new InventoryLocation;
10288 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10289
10290 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10293 {
10294 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10295 }
10297 {
10298 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10299 }
10300
10301 }
10302
10303 player.GetHumanInventory().ClearUserReservedLocation(this);
10304 }
10305
10308 }
10309
10310
10311
10312
10314 {
10315 return ItemBase.m_DebugActionsMask;
10316 }
10317
10319 {
10320 return ItemBase.m_DebugActionsMask & mask;
10321 }
10322
10324 {
10325 ItemBase.m_DebugActionsMask = mask;
10326 }
10327
10329 {
10330 ItemBase.m_DebugActionsMask |= mask;
10331 }
10332
10334 {
10335 ItemBase.m_DebugActionsMask &= ~mask;
10336 }
10337
10339 {
10341 {
10343 }
10344 else
10345 {
10347 }
10348 }
10349
10350
10352 {
10353 if (GetEconomyProfile())
10354 {
10355 float q_max = GetEconomyProfile().GetQuantityMax();
10356 if (q_max > 0)
10357 {
10358 float q_min = GetEconomyProfile().GetQuantityMin();
10359 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10360
10362 {
10363 ComponentEnergyManager comp = GetCompEM();
10365 {
10367 }
10368 }
10370 {
10372
10373 }
10374
10375 }
10376 }
10377 }
10378
10381 {
10382 EntityAI parent = GetHierarchyParent();
10383
10384 if (parent)
10385 {
10386 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10387 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10388 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10389 }
10390 }
10391
10394 {
10395 EntityAI parent = GetHierarchyParent();
10396
10397 if (parent)
10398 {
10399 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10400 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10401 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10402 }
10403 }
10404
10406 {
10407
10408
10409
10410
10412
10414 {
10415 if (ScriptInputUserData.CanStoreInputUserData())
10416 {
10417 ScriptInputUserData ctx = new ScriptInputUserData;
10423 ctx.
Write(use_stack_max);
10426
10428 {
10429 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10430 }
10431 }
10432 }
10433 else if (!
g_Game.IsMultiplayer())
10434 {
10436 }
10437 }
10438
10440 {
10442 }
10443
10445 {
10447 }
10448
10450 {
10452 }
10453
10455 {
10456
10457 return false;
10458 }
10459
10461 {
10462 return false;
10463 }
10464
10468 {
10469 return false;
10470 }
10471
10473 {
10474 return "";
10475 }
10476
10478
10480 {
10481 return false;
10482 }
10483
10485 {
10486 return true;
10487 }
10488
10489
10490
10492 {
10493 return true;
10494 }
10495
10497 {
10498 return true;
10499 }
10500
10502 {
10503 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10505 }
10506
10508 {
10510 }
10511
10513 {
10515 if (!is_being_placed)
10517 SetSynchDirty();
10518 }
10519
10520
10522
10524 {
10526 }
10527
10529 {
10531 }
10532
10534 {
10535 return 1;
10536 }
10537
10539 {
10540 return false;
10541 }
10542
10544 {
10546 SetSynchDirty();
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
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10584 {
10585 super.OnMovedInsideCargo(container);
10586
10587 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10588 }
10589
10590 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10591 {
10592 super.EEItemLocationChanged(oldLoc, newLoc);
10593
10594 PlayerBase newPlayer = null;
10595 PlayerBase oldPlayer = null;
10596
10597 if (newLoc.GetParent())
10598 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10599
10600 if (oldLoc.GetParent())
10601 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10602
10604 {
10605 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10606
10607 if (rIndex >= 0)
10608 {
10609 InventoryLocation rIl = new InventoryLocation;
10610 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10611
10612 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10615 {
10616 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10617 }
10619 {
10621 }
10622
10623 }
10624 }
10625
10627 {
10628 if (newPlayer)
10629 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10630
10631 if (newPlayer == oldPlayer)
10632 {
10633 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10634 {
10636 {
10637 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10638 {
10639 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10640 }
10641 }
10642 else
10643 {
10644 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10645 }
10646 }
10647
10648 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10649 {
10650 int type = oldLoc.GetType();
10652 {
10653 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10654 }
10656 {
10657 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10658 }
10659 }
10660 if (!m_OldLocation)
10661 {
10662 m_OldLocation = new InventoryLocation;
10663 }
10664 m_OldLocation.Copy(oldLoc);
10665 }
10666 else
10667 {
10668 if (m_OldLocation)
10669 {
10670 m_OldLocation.Reset();
10671 }
10672 }
10673
10674 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10675 }
10676 else
10677 {
10678 if (newPlayer)
10679 {
10680 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10681 if (resIndex >= 0)
10682 {
10683 InventoryLocation il = new InventoryLocation;
10684 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10686 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10689 {
10690 il.
GetParent().GetOnReleaseLock().Invoke(it);
10691 }
10693 {
10695 }
10696
10697 }
10698 }
10700 {
10701
10703 }
10704
10705 if (m_OldLocation)
10706 {
10707 m_OldLocation.Reset();
10708 }
10709 }
10710
10712 {
10713 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10714 }
10715
10717 {
10718 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10719 }
10720 }
10721
10722 override void EOnContact(IEntity other, Contact extra)
10723 {
10725 {
10726 int liquidType = -1;
10728 if (impactSpeed > 0.0)
10729 {
10731 #ifndef SERVER
10733 #else
10735 SetSynchDirty();
10736 #endif
10738 }
10739 }
10740
10741 #ifdef SERVER
10742 if (GetCompEM() && GetCompEM().IsPlugged())
10743 {
10744 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10745 GetCompEM().UnplugThis();
10746 }
10747 #endif
10748 }
10749
10751
10753 {
10755 }
10756
10758 {
10759
10760 }
10761
10763 {
10764 super.OnItemLocationChanged(old_owner, new_owner);
10765
10766 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10767 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10768
10769 if (!relatedPlayer && playerNew)
10770 relatedPlayer = playerNew;
10771
10772 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10773 {
10775 if (actionMgr)
10776 {
10777 ActionBase currentAction = actionMgr.GetRunningAction();
10778 if (currentAction)
10780 }
10781 }
10782
10783 Man ownerPlayerOld = null;
10784 Man ownerPlayerNew = null;
10785
10786 if (old_owner)
10787 {
10788 if (old_owner.
IsMan())
10789 {
10790 ownerPlayerOld = Man.Cast(old_owner);
10791 }
10792 else
10793 {
10794 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10795 }
10796 }
10797 else
10798 {
10800 {
10802
10803 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10804 {
10805 GetCompEM().UnplugThis();
10806 }
10807 }
10808 }
10809
10810 if (new_owner)
10811 {
10812 if (new_owner.
IsMan())
10813 {
10814 ownerPlayerNew = Man.Cast(new_owner);
10815 }
10816 else
10817 {
10818 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10819 }
10820 }
10821
10822 if (ownerPlayerOld != ownerPlayerNew)
10823 {
10824 if (ownerPlayerOld)
10825 {
10826 array<EntityAI> subItemsExit = new array<EntityAI>;
10828 for (int i = 0; i < subItemsExit.Count(); i++)
10829 {
10832 }
10833 }
10834
10835 if (ownerPlayerNew)
10836 {
10837 array<EntityAI> subItemsEnter = new array<EntityAI>;
10839 for (int j = 0; j < subItemsEnter.Count(); j++)
10840 {
10843 }
10844 }
10845 }
10846 else if (ownerPlayerNew != null)
10847 {
10848 PlayerBase nplayer;
10849 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10850 {
10851 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10853 for (int k = 0; k < subItemsUpdate.Count(); k++)
10854 {
10856 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10857 }
10858 }
10859 }
10860
10861 if (old_owner)
10862 old_owner.OnChildItemRemoved(this);
10863 if (new_owner)
10864 new_owner.OnChildItemReceived(this);
10865 }
10866
10867
10869 {
10870 super.EEDelete(parent);
10871 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10872 if (player)
10873 {
10875
10876 if (player.IsAlive())
10877 {
10878 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10879 if (r_index >= 0)
10880 {
10881 InventoryLocation r_il = new InventoryLocation;
10882 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10883
10884 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10887 {
10888 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10889 }
10891 {
10892 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10893 }
10894
10895 }
10896
10897 player.RemoveQuickBarEntityShortcut(this);
10898 }
10899 }
10900 }
10901
10903 {
10904 super.EEKilled(killer);
10905
10908 {
10909 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10910 {
10911 if (IsMagazine())
10912 {
10913 if (Magazine.Cast(this).GetAmmoCount() > 0)
10914 {
10916 }
10917 }
10918 else
10919 {
10921 }
10922 }
10923 }
10924 }
10925
10927 {
10928 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10929
10930 super.OnWasAttached(parent, slot_id);
10931
10934
10937 }
10938
10940 {
10941 super.OnWasDetached(parent, slot_id);
10942
10945
10948 }
10949
10951 {
10952 int idx;
10955
10956 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10957 if (inventory_slots.Count() < 1)
10958 {
10959 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10960 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10961 }
10962 else
10963 {
10964 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10965 }
10966
10967 idx = inventory_slots.Find(slot);
10968 if (idx < 0)
10969 return "";
10970
10971 return attach_types.Get(idx);
10972 }
10973
10975 {
10976 int idx = -1;
10977 string slot;
10978
10981
10982 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10983 if (inventory_slots.Count() < 1)
10984 {
10985 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10986 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10987 }
10988 else
10989 {
10990 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10991 if (detach_types.Count() < 1)
10992 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10993 }
10994
10995 for (int i = 0; i < inventory_slots.Count(); i++)
10996 {
10997 slot = inventory_slots.Get(i);
10998 }
10999
11000 if (slot != "")
11001 {
11002 if (detach_types.Count() == 1)
11003 idx = 0;
11004 else
11005 idx = inventory_slots.Find(slot);
11006 }
11007 if (idx < 0)
11008 return "";
11009
11010 return detach_types.Get(idx);
11011 }
11012
11014 {
11015
11017
11018
11019 float min_time = 1;
11020 float max_time = 3;
11021 float delay = Math.RandomFloat(min_time, max_time);
11022
11023 explode_timer.Run(delay, this, "DoAmmoExplosion");
11024 }
11025
11027 {
11028 Magazine magazine = Magazine.Cast(this);
11029 int pop_sounds_count = 6;
11030 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11031
11032
11033 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11034 string sound_name = pop_sounds[ sound_idx ];
11035 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11036
11037
11038 magazine.ServerAddAmmoCount(-1);
11039
11040
11041 float min_temp_to_explode = 100;
11042
11043 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11044 {
11046 }
11047 }
11048
11049
11050 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11051 {
11052 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11053
11054 const int CHANCE_DAMAGE_CARGO = 4;
11055 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11056 const int CHANCE_DAMAGE_NOTHING = 2;
11057
11059 {
11060 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11061 int chances;
11062 int rnd;
11063
11064 if (GetInventory().GetCargo())
11065 {
11066 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11067 rnd = Math.RandomInt(0,chances);
11068
11069 if (rnd < CHANCE_DAMAGE_CARGO)
11070 {
11072 }
11073 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11074 {
11076 }
11077 }
11078 else
11079 {
11080 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11081 rnd = Math.RandomInt(0,chances);
11082
11083 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11084 {
11086 }
11087 }
11088 }
11089 }
11090
11092 {
11093 CargoBase cargo = GetInventory().GetCargo();
11094 if (cargo)
11095 {
11097 if (item_count > 0)
11098 {
11099 int random_pick = Math.RandomInt(0, item_count);
11101 if (!item.IsExplosive())
11102 {
11103 item.AddHealth("","",damage);
11104 return true;
11105 }
11106 }
11107 }
11108 return false;
11109 }
11110
11112 {
11113 GameInventory inventory = GetInventory();
11115 if (attachment_count > 0)
11116 {
11117 int random_pick = Math.RandomInt(0, attachment_count);
11119 if (!attachment.IsExplosive())
11120 {
11121 attachment.AddHealth("","",damage);
11122 return true;
11123 }
11124 }
11125 return false;
11126 }
11127
11129 {
11131 }
11132
11134 {
11136 return GetInventory().CanRemoveEntity();
11137
11138 return false;
11139 }
11140
11142 {
11143
11145 return false;
11146
11147
11149 return false;
11150
11151
11152
11154 if (delta == 0)
11155 return false;
11156
11157
11158 return true;
11159 }
11160
11162 {
11164 {
11165 if (ScriptInputUserData.CanStoreInputUserData())
11166 {
11167 ScriptInputUserData ctx = new ScriptInputUserData;
11172 ctx.
Write(destination_entity);
11174 ctx.
Write(slot_id);
11176 }
11177 }
11178 else if (!
g_Game.IsMultiplayer())
11179 {
11181 }
11182 }
11183
11185 {
11186 float split_quantity_new;
11190 InventoryLocation loc = new InventoryLocation;
11191
11192 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11193 {
11195 split_quantity_new = stack_max;
11196 else
11198
11200 {
11201 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11202 if (new_item)
11203 {
11204 new_item.SetResultOfSplit(true);
11205 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11207 new_item.
SetQuantity(split_quantity_new,
false,
true);
11208 }
11209 }
11210 }
11211 else if (destination_entity && slot_id == -1)
11212 {
11213 if (quantity > stack_max)
11214 split_quantity_new = stack_max;
11215 else
11216 split_quantity_new = quantity;
11217
11219 {
11220 GameInventory destinationInventory = destination_entity.GetInventory();
11222 {
11225 }
11226
11227 if (new_item)
11228 {
11229 new_item.SetResultOfSplit(true);
11230 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11232 new_item.
SetQuantity(split_quantity_new,
false,
true);
11233 }
11234 }
11235 }
11236 else
11237 {
11238 if (stack_max != 0)
11239 {
11241 {
11243 }
11244
11245 if (split_quantity_new == 0)
11246 {
11247 if (!
g_Game.IsMultiplayer())
11248 player.PhysicalPredictiveDropItem(this);
11249 else
11250 player.ServerDropEntity(this);
11251 return;
11252 }
11253
11255 {
11257
11258 if (new_item)
11259 {
11260 new_item.SetResultOfSplit(true);
11261 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11264 new_item.PlaceOnSurface();
11265 }
11266 }
11267 }
11268 }
11269 }
11270
11272 {
11273 float split_quantity_new;
11277 InventoryLocation loc = new InventoryLocation;
11278
11279 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11280 {
11282 split_quantity_new = stack_max;
11283 else
11285
11287 {
11288 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11289 if (new_item)
11290 {
11291 new_item.SetResultOfSplit(true);
11292 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11294 new_item.
SetQuantity(split_quantity_new,
false,
true);
11295 }
11296 }
11297 }
11298 else if (destination_entity && slot_id == -1)
11299 {
11300 if (quantity > stack_max)
11301 split_quantity_new = stack_max;
11302 else
11303 split_quantity_new = quantity;
11304
11306 {
11307 GameInventory destinationInventory = destination_entity.GetInventory();
11309 {
11312 }
11313
11314 if (new_item)
11315 {
11316 new_item.SetResultOfSplit(true);
11317 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11319 new_item.
SetQuantity(split_quantity_new,
false,
true);
11320 }
11321 }
11322 }
11323 else
11324 {
11325 if (stack_max != 0)
11326 {
11328 {
11330 }
11331
11333 {
11335
11336 if (new_item)
11337 {
11338 new_item.SetResultOfSplit(true);
11339 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11342 new_item.PlaceOnSurface();
11343 }
11344 }
11345 }
11346 }
11347 }
11348
11350 {
11352 {
11353 if (ScriptInputUserData.CanStoreInputUserData())
11354 {
11355 ScriptInputUserData ctx = new ScriptInputUserData;
11360 dst.WriteToContext(ctx);
11362 }
11363 }
11364 else if (!
g_Game.IsMultiplayer())
11365 {
11367 }
11368 }
11369
11371 {
11373 {
11374 if (ScriptInputUserData.CanStoreInputUserData())
11375 {
11376 ScriptInputUserData ctx = new ScriptInputUserData;
11381 ctx.
Write(destination_entity);
11387 }
11388 }
11389 else if (!
g_Game.IsMultiplayer())
11390 {
11392 }
11393 }
11394
11396 {
11398 }
11399
11401 {
11403 float split_quantity_new;
11405 if (dst.IsValid())
11406 {
11407 int slot_id = dst.GetSlot();
11409
11410 if (quantity > stack_max)
11411 split_quantity_new = stack_max;
11412 else
11413 split_quantity_new = quantity;
11414
11416 {
11418
11419 if (new_item)
11420 {
11421 new_item.SetResultOfSplit(true);
11422 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11424 new_item.
SetQuantity(split_quantity_new,
false,
true);
11425 }
11426
11427 return new_item;
11428 }
11429 }
11430
11431 return null;
11432 }
11433
11435 {
11437 float split_quantity_new;
11439 if (destination_entity)
11440 {
11442 if (quantity > stackable)
11443 split_quantity_new = stackable;
11444 else
11445 split_quantity_new = quantity;
11446
11448 {
11449 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11450 if (new_item)
11451 {
11452 new_item.SetResultOfSplit(true);
11453 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11455 new_item.
SetQuantity(split_quantity_new,
false,
true);
11456 }
11457 }
11458 }
11459 }
11460
11462 {
11464 {
11465 if (ScriptInputUserData.CanStoreInputUserData())
11466 {
11467 ScriptInputUserData ctx = new ScriptInputUserData;
11472 ItemBase destination_entity =
this;
11473 ctx.
Write(destination_entity);
11477 }
11478 }
11479 else if (!
g_Game.IsMultiplayer())
11480 {
11482 }
11483 }
11484
11486 {
11488 float split_quantity_new;
11490 if (player)
11491 {
11493 if (quantity > stackable)
11494 split_quantity_new = stackable;
11495 else
11496 split_quantity_new = quantity;
11497
11499 {
11500 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11501 new_item =
ItemBase.Cast(in_hands);
11502 if (new_item)
11503 {
11504 new_item.SetResultOfSplit(true);
11505 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11507 new_item.SetQuantity(split_quantity_new, false, true);
11508 }
11509 }
11510 }
11511 }
11512
11514 {
11516 float split_quantity_new = Math.Floor(quantity * 0.5);
11517
11519 return;
11520
11522
11523 if (new_item)
11524 {
11525 if (new_item.GetQuantityMax() < split_quantity_new)
11526 {
11527 split_quantity_new = new_item.GetQuantityMax();
11528 }
11529
11530 new_item.SetResultOfSplit(true);
11531 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11532
11534 {
11537 }
11538 else
11539 {
11541 new_item.
SetQuantity(split_quantity_new,
false,
true);
11542 }
11543 }
11544 }
11545
11547 {
11549 float split_quantity_new = Math.Floor(quantity / 2);
11550
11552 return;
11553
11554 InventoryLocation invloc = new InventoryLocation;
11556
11558 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11559
11560 if (new_item)
11561 {
11562 if (new_item.GetQuantityMax() < split_quantity_new)
11563 {
11564 split_quantity_new = new_item.GetQuantityMax();
11565 }
11567 {
11570 }
11571 else if (split_quantity_new > 1)
11572 {
11574 new_item.
SetQuantity(split_quantity_new,
false,
true);
11575 }
11576 }
11577 }
11578
11581 {
11582 SetWeightDirty();
11584
11585 if (parent)
11586 parent.OnAttachmentQuantityChangedEx(this, delta);
11587
11589 {
11591 {
11593 }
11595 {
11596 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11598 }
11599 }
11600 }
11601
11604 {
11605
11606 }
11607
11610 {
11612 }
11613
11615 {
11616 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11617
11619 {
11620 if (newLevel == GameConstants.STATE_RUINED)
11621 {
11623 EntityAI parent = GetHierarchyParent();
11624 if (parent && parent.IsFireplace())
11625 {
11626 CargoBase cargo = GetInventory().GetCargo();
11627 if (cargo)
11628 {
11630 {
11632 }
11633 }
11634 }
11635 }
11636
11638 {
11639
11641 return;
11642 }
11643
11644 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11645 {
11647 }
11648 }
11649 }
11650
11651
11653 {
11654 super.OnRightClick();
11655
11657 {
11659 {
11660 if (ScriptInputUserData.CanStoreInputUserData())
11661 {
11662 EntityAI root = GetHierarchyRoot();
11663 Man playerOwner = GetHierarchyRootPlayer();
11664 InventoryLocation dst = new InventoryLocation;
11665
11666
11667 if (!playerOwner && root && root == this)
11668 {
11670 }
11671 else
11672 {
11673
11674 GetInventory().GetCurrentInventoryLocation(dst);
11676 {
11677 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11679 {
11681 }
11682 else
11683 {
11685
11686
11687 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11688 {
11690 }
11691 else
11692 {
11693 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11694 }
11695 }
11696 }
11697 }
11698
11699 ScriptInputUserData ctx = new ScriptInputUserData;
11707 }
11708 }
11709 else if (!
g_Game.IsMultiplayer())
11710 {
11712 }
11713 }
11714 }
11715
11717 {
11718 if (root)
11719 {
11720 vector m4[4];
11721 root.GetTransform(m4);
11722 dst.SetGround(this, m4);
11723 }
11724 else
11725 {
11726 GetInventory().GetCurrentInventoryLocation(dst);
11727 }
11728 }
11729
11730 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11731 {
11732
11733 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11734 return false;
11735
11736 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11737 return false;
11738
11739
11741 return false;
11742
11743
11744 Magazine mag = Magazine.Cast(this);
11745 if (mag)
11746 {
11747 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11748 return false;
11749
11750 if (stack_max_limit)
11751 {
11752 Magazine other_mag = Magazine.Cast(other_item);
11753 if (other_item)
11754 {
11755 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11756 return false;
11757 }
11758
11759 }
11760 }
11761 else
11762 {
11763
11765 return false;
11766
11768 return false;
11769 }
11770
11771 PlayerBase player = null;
11772 if (CastTo(player, GetHierarchyRootPlayer()))
11773 {
11774 if (player.GetInventory().HasAttachment(this))
11775 return false;
11776
11777 if (player.IsItemsToDelete())
11778 return false;
11779 }
11780
11781 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11782 return false;
11783
11784 int slotID;
11786 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11787 return false;
11788
11789 return true;
11790 }
11791
11793 {
11795 }
11796
11798 {
11799 return m_IsResultOfSplit;
11800 }
11801
11803 {
11804 m_IsResultOfSplit = value;
11805 }
11806
11808 {
11810 }
11811
11813 {
11814 float other_item_quantity = other_item.GetQuantity();
11815 float this_free_space;
11816
11818
11820
11821 if (other_item_quantity > this_free_space)
11822 {
11823 return this_free_space;
11824 }
11825 else
11826 {
11827 return other_item_quantity;
11828 }
11829 }
11830
11832 {
11834 }
11835
11837 {
11839 return;
11840
11841 if (!IsMagazine() && other_item)
11842 {
11844 if (quantity_used != 0)
11845 {
11846 float hp1 = GetHealth01("","");
11847 float hp2 = other_item.GetHealth01("","");
11848 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11849 hpResult = hpResult / (
GetQuantity() + quantity_used);
11850
11851 hpResult *= GetMaxHealth();
11852 Math.Round(hpResult);
11853 SetHealth("", "Health", hpResult);
11854
11856 other_item.AddQuantity(-quantity_used);
11857 }
11858 }
11860 }
11861
11863 {
11864 #ifdef SERVER
11865 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11866 GetHierarchyParent().IncreaseLifetimeUp();
11867 #endif
11868 };
11869
11871 {
11872 PlayerBase p = PlayerBase.Cast(player);
11873
11874 array<int> recipesIds = p.m_Recipes;
11875 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11876 if (moduleRecipesManager)
11877 {
11878 EntityAI itemInHands = player.GetEntityInHands();
11879 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11880 }
11881
11882 for (int i = 0;i < recipesIds.Count(); i++)
11883 {
11884 int key = recipesIds.Get(i);
11885 string recipeName = moduleRecipesManager.GetRecipeName(key);
11887 }
11888 }
11889
11890
11891 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11892 {
11893 super.GetDebugActions(outputList);
11894
11895
11901
11902
11907
11912
11913
11917
11918
11920 {
11924 }
11925
11928
11929
11933
11935
11936 InventoryLocation loc = new InventoryLocation();
11937 GetInventory().GetCurrentInventoryLocation(loc);
11939 {
11940 if (Gizmo_IsSupported())
11943 }
11944
11946 }
11947
11948
11949
11950
11952 {
11953 super.OnAction(action_id, player, ctx);
11954
11956 {
11957 switch (action_id)
11958 {
11962 return true;
11966 return true;
11967 }
11968 }
11969
11971 {
11972 switch (action_id)
11973 {
11975 Delete();
11976 return true;
11977 }
11978 }
11979
11980 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11981 {
11982 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11983 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11984 PlayerBase p = PlayerBase.Cast(player);
11985 if (
EActions.RECIPES_RANGE_START < 1000)
11986 {
11987 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11988 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11989 }
11990 }
11991 #ifndef SERVER
11992 else if (action_id ==
EActions.WATCH_PLAYER)
11993 {
11994 PluginDeveloper.SetDeveloperItemClientEx(player);
11995 }
11996 #endif
11998 {
11999 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12000 {
12001 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12002 OnDebugButtonPressServer(id + 1);
12003 }
12004
12005 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12006 {
12007 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12009 }
12010
12011 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12012 {
12013 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12015 }
12016
12017 else if (action_id ==
EActions.ADD_QUANTITY)
12018 {
12019 if (IsMagazine())
12020 {
12021 Magazine mag = Magazine.Cast(this);
12022 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12023 }
12024 else
12025 {
12027 }
12028
12029 if (m_EM)
12030 {
12031 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12032 }
12033
12034 }
12035
12036 else if (action_id ==
EActions.REMOVE_QUANTITY)
12037 {
12038 if (IsMagazine())
12039 {
12040 Magazine mag2 = Magazine.Cast(this);
12041 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12042 }
12043 else
12044 {
12046 }
12047 if (m_EM)
12048 {
12049 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12050 }
12051
12052 }
12053
12054 else if (action_id ==
EActions.SET_QUANTITY_0)
12055 {
12057
12058 if (m_EM)
12059 {
12060 m_EM.SetEnergy(0);
12061 }
12062 }
12063
12064 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12065 {
12067
12068 if (m_EM)
12069 {
12070 m_EM.SetEnergy(m_EM.GetEnergyMax());
12071 }
12072 }
12073
12074 else if (action_id ==
EActions.ADD_HEALTH)
12075 {
12076 AddHealth("","",GetMaxHealth("","Health")/5);
12077 }
12078 else if (action_id ==
EActions.REMOVE_HEALTH)
12079 {
12080 AddHealth("","",-GetMaxHealth("","Health")/5);
12081 }
12082 else if (action_id ==
EActions.DESTROY_HEALTH)
12083 {
12084 SetHealth01("","",0);
12085 }
12086 else if (action_id ==
EActions.WATCH_ITEM)
12087 {
12089 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12090 #ifdef DEVELOPER
12091 SetDebugDeveloper_item(this);
12092 #endif
12093 }
12094
12095 else if (action_id ==
EActions.ADD_TEMPERATURE)
12096 {
12097 AddTemperature(20);
12098
12099 }
12100
12101 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12102 {
12103 AddTemperature(-20);
12104
12105 }
12106
12107 else if (action_id ==
EActions.FLIP_FROZEN)
12108 {
12109 SetFrozen(!GetIsFrozen());
12110
12111 }
12112
12113 else if (action_id ==
EActions.ADD_WETNESS)
12114 {
12116
12117 }
12118
12119 else if (action_id ==
EActions.REMOVE_WETNESS)
12120 {
12122
12123 }
12124
12125 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12126 {
12129
12130
12131 }
12132
12133 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12134 {
12137 }
12138
12139 else if (action_id ==
EActions.MAKE_SPECIAL)
12140 {
12141 auto debugParams = DebugSpawnParams.WithPlayer(player);
12142 OnDebugSpawnEx(debugParams);
12143 }
12144
12145 }
12146
12147
12148 return false;
12149 }
12150
12151
12152
12153
12157
12160
12161
12162
12164 {
12165 return false;
12166 }
12167
12168
12170 {
12171 return true;
12172 }
12173
12174
12176 {
12177 return true;
12178 }
12179
12180
12181
12183 {
12184 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12185 return g_Game.ConfigIsExisting(config_path);
12186 }
12187
12190 {
12191 return null;
12192 }
12193
12195 {
12196 return false;
12197 }
12198
12200 {
12201 return false;
12202 }
12203
12207
12208
12210 {
12211 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12212 return module_repairing.CanRepair(this, item_repair_kit);
12213 }
12214
12215
12216 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12217 {
12218 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12219 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12220 }
12221
12222
12224 {
12225
12226
12227
12228
12229
12230
12231
12232
12233 return 1;
12234 }
12235
12236
12237
12239 {
12241 }
12242
12243
12244
12246 {
12248 }
12249
12250
12259 {
12260 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12261
12262 if (player)
12263 {
12264 player.MessageStatus(text);
12265 }
12266 }
12267
12268
12277 {
12278 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12279
12280 if (player)
12281 {
12282 player.MessageAction(text);
12283 }
12284 }
12285
12286
12295 {
12296 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12297
12298 if (player)
12299 {
12300 player.MessageFriendly(text);
12301 }
12302 }
12303
12304
12313 {
12314 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12315
12316 if (player)
12317 {
12318 player.MessageImportant(text);
12319 }
12320 }
12321
12323 {
12324 return true;
12325 }
12326
12327
12328 override bool KindOf(
string tag)
12329 {
12330 bool found = false;
12331 string item_name = this.
GetType();
12333 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12334
12335 int array_size = item_tag_array.Count();
12336 for (int i = 0; i < array_size; i++)
12337 {
12338 if (item_tag_array.Get(i) == tag)
12339 {
12340 found = true;
12341 break;
12342 }
12343 }
12344 return found;
12345 }
12346
12347
12349 {
12350
12351 super.OnRPC(sender, rpc_type,ctx);
12352
12353
12354 switch (rpc_type)
12355 {
12356 #ifndef SERVER
12357 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12358 Param2<bool, string> p = new Param2<bool, string>(false, "");
12359
12361 return;
12362
12363 bool play = p.param1;
12364 string soundSet = p.param2;
12365
12366 if (play)
12367 {
12369 {
12371 {
12373 }
12374 }
12375 else
12376 {
12378 }
12379 }
12380 else
12381 {
12383 }
12384
12385 break;
12386 #endif
12387
12388 }
12389
12391 {
12393 }
12394 }
12395
12396
12397
12398
12400 {
12401 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12402 return plugin.GetID(
name);
12403 }
12404
12406 {
12407 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12408 return plugin.GetName(id);
12409 }
12410
12413 {
12414
12415
12416 int varFlags;
12417 if (!ctx.
Read(varFlags))
12418 return;
12419
12420 if (varFlags & ItemVariableFlags.FLOAT)
12421 {
12423 }
12424 }
12425
12427 {
12428
12429 super.SerializeNumericalVars(floats_out);
12430
12431
12432
12434 {
12436 }
12437
12439 {
12441 }
12442
12444 {
12446 }
12447
12449 {
12454 }
12455
12457 {
12459 }
12460 }
12461
12463 {
12464
12465 super.DeSerializeNumericalVars(floats);
12466
12467
12468 int index = 0;
12469 int mask = Math.Round(floats.Get(index));
12470
12471 index++;
12472
12474 {
12476 {
12478 }
12479 else
12480 {
12481 float quantity = floats.Get(index);
12482 SetQuantity(quantity,
true,
false,
false,
false);
12483 }
12484 index++;
12485 }
12486
12488 {
12489 float wet = floats.Get(index);
12491 index++;
12492 }
12493
12495 {
12496 int liquidtype = Math.Round(floats.Get(index));
12498 index++;
12499 }
12500
12502 {
12504 index++;
12506 index++;
12508 index++;
12510 index++;
12511 }
12512
12514 {
12515 int cleanness = Math.Round(floats.Get(index));
12517 index++;
12518 }
12519 }
12520
12522 {
12523 super.WriteVarsToCTX(ctx);
12524
12525
12527 {
12529 }
12530
12532 {
12534 }
12535
12537 {
12539 }
12540
12542 {
12543 int r,g,b,a;
12549 }
12550
12552 {
12554 }
12555 }
12556
12558 {
12559 if (!super.ReadVarsFromCTX(ctx,version))
12560 return false;
12561
12562 int intValue;
12563 float value;
12564
12565 if (version < 140)
12566 {
12567 if (!ctx.
Read(intValue))
12568 return false;
12569
12570 m_VariablesMask = intValue;
12571 }
12572
12574 {
12575 if (!ctx.
Read(value))
12576 return false;
12577
12579 {
12581 }
12582 else
12583 {
12585 }
12586 }
12587
12588 if (version < 140)
12589 {
12591 {
12592 if (!ctx.
Read(value))
12593 return false;
12594 SetTemperatureDirect(value);
12595 }
12596 }
12597
12599 {
12600 if (!ctx.
Read(value))
12601 return false;
12603 }
12604
12606 {
12607 if (!ctx.
Read(intValue))
12608 return false;
12610 }
12611
12613 {
12614 int r,g,b,a;
12616 return false;
12618 return false;
12620 return false;
12622 return false;
12623
12625 }
12626
12628 {
12629 if (!ctx.
Read(intValue))
12630 return false;
12632 }
12633
12634 if (version >= 138 && version < 140)
12635 {
12637 {
12638 if (!ctx.
Read(intValue))
12639 return false;
12640 SetFrozen(intValue);
12641 }
12642 }
12643
12644 return true;
12645 }
12646
12647
12649 {
12652 {
12654 }
12655
12656 if (!super.OnStoreLoad(ctx, version))
12657 {
12659 return false;
12660 }
12661
12662 if (version >= 114)
12663 {
12664 bool hasQuickBarIndexSaved;
12665
12666 if (!ctx.
Read(hasQuickBarIndexSaved))
12667 {
12669 return false;
12670 }
12671
12672 if (hasQuickBarIndexSaved)
12673 {
12674 int itmQBIndex;
12675
12676
12677 if (!ctx.
Read(itmQBIndex))
12678 {
12680 return false;
12681 }
12682
12683 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12684 if (itmQBIndex != -1 && parentPlayer)
12685 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12686 }
12687 }
12688 else
12689 {
12690
12691 PlayerBase player;
12692 int itemQBIndex;
12693 if (version ==
int.
MAX)
12694 {
12695 if (!ctx.
Read(itemQBIndex))
12696 {
12698 return false;
12699 }
12700 }
12701 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12702 {
12703
12704 if (!ctx.
Read(itemQBIndex))
12705 {
12707 return false;
12708 }
12709 if (itemQBIndex != -1 && player)
12710 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12711 }
12712 }
12713
12714 if (version < 140)
12715 {
12716
12717 if (!LoadVariables(ctx, version))
12718 {
12720 return false;
12721 }
12722 }
12723
12724
12726 {
12728 return false;
12729 }
12730 if (version >= 132)
12731 {
12733 if (raib)
12734 {
12736 {
12738 return false;
12739 }
12740 }
12741 }
12742
12744 return true;
12745 }
12746
12747
12748
12750 {
12751 super.OnStoreSave(ctx);
12752
12753 PlayerBase player;
12754 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12755 {
12757
12758 int itemQBIndex = -1;
12759 itemQBIndex = player.FindQuickBarEntityIndex(this);
12760 ctx.
Write(itemQBIndex);
12761 }
12762 else
12763 {
12765 }
12766
12768
12770 if (raib)
12771 {
12773 }
12774 }
12775
12776
12778 {
12779 super.AfterStoreLoad();
12780
12782 {
12784 }
12785
12787 {
12790 }
12791 }
12792
12794 {
12795 super.EEOnAfterLoad();
12796
12798 {
12800 }
12801
12804 }
12805
12807 {
12808 return false;
12809 }
12810
12811
12812
12814 {
12816 {
12817 #ifdef PLATFORM_CONSOLE
12818
12820 {
12822 if (menu)
12823 {
12825 }
12826 }
12827 #endif
12828 }
12829
12831 {
12834 }
12835
12837 {
12838 SetWeightDirty();
12840 }
12842 {
12845 }
12846
12848 {
12851
12854 }
12856 {
12860 }
12861
12862 super.OnVariablesSynchronized();
12863 }
12864
12865
12866
12868 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12869 {
12870 if (!IsServerCheck(allow_client))
12871 return false;
12872
12874 return false;
12875
12878
12879 if (value <= (min + 0.001))
12880 value = min;
12881
12882 if (value == min)
12883 {
12884 if (destroy_config)
12885 {
12886 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12887 if (dstr)
12888 {
12890 this.Delete();
12891 return true;
12892 }
12893 }
12894 else if (destroy_forced)
12895 {
12897 this.Delete();
12898 return true;
12899 }
12900
12902 }
12903
12906
12908 {
12909 EntityAI parent = GetHierarchyRoot();
12910 InventoryLocation iLoc = new InventoryLocation();
12911 GetInventory().GetCurrentInventoryLocation(iLoc);
12913 {
12914 int iLocSlot = iLoc.
GetSlot();
12916 {
12918 }
12920 {
12922 }
12923 }
12924 }
12925
12927 {
12929
12930 if (delta)
12932 }
12933
12935
12936 return false;
12937 }
12938
12939
12941 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12942 {
12944 }
12945
12947 {
12950 }
12951
12953 {
12956 }
12957
12959 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12960 {
12961 float value_clamped = Math.Clamp(value, 0, 1);
12963 SetQuantity(result, destroy_config, destroy_forced);
12964 }
12965
12966
12969 {
12971 }
12972
12974 {
12976 }
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12988 {
12989 int slot = -1;
12990 GameInventory inventory = GetInventory();
12991 if (inventory)
12992 {
12993 InventoryLocation il = new InventoryLocation;
12996 }
12997
12999 }
13000
13002 {
13003 float quantity_max = 0;
13004
13006 {
13007 if (attSlotID != -1)
13008 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13009
13010 if (quantity_max <= 0)
13012 }
13013
13014 if (quantity_max <= 0)
13016
13017 return quantity_max;
13018 }
13019
13021 {
13023 }
13024
13026 {
13028 }
13029
13030
13032 {
13034 }
13035
13037 {
13039 }
13040
13042 {
13044 }
13045
13046
13048 {
13049
13050 float weightEx = GetWeightEx();
13051 float special = GetInventoryAndCargoWeight();
13052 return weightEx - special;
13053 }
13054
13055
13057 {
13059 }
13060
13062 {
13064 {
13065 #ifdef DEVELOPER
13066 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13067 {
13068 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13070 }
13071 #endif
13072
13073 return GetQuantity() * GetConfigWeightModified();
13074 }
13075 else if (HasEnergyManager())
13076 {
13077 #ifdef DEVELOPER
13078 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13079 {
13080 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13081 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13082 }
13083 #endif
13084 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13085 }
13086 else
13087 {
13088 #ifdef DEVELOPER
13089 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13090 {
13091 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13092 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13093 }
13094 #endif
13095 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13096 }
13097 }
13098
13101 {
13102 int item_count = 0;
13104
13105 GameInventory inventory = GetInventory();
13106 CargoBase cargo = inventory.
GetCargo();
13107 if (cargo != NULL)
13108 {
13110 }
13111
13113 for (int i = 0; i < nAttachments; ++i)
13114 {
13116 if (item)
13117 item_count += item.GetNumberOfItems();
13118 }
13119 return item_count;
13120 }
13121
13124 {
13125 float weight = 0;
13126 float wetness = 1;
13127 if (include_wetness)
13130 {
13131 weight = wetness * m_ConfigWeight;
13132 }
13134 {
13135 weight = 1;
13136 }
13137 return weight;
13138 }
13139
13140
13141
13143 {
13144 GameInventory inventory = GetInventory();
13145 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13146 {
13147 array<EntityAI> items = new array<EntityAI>;
13149 for (int i = 0; i < items.Count(); ++i)
13150 {
13152 if (item)
13153 {
13154 g_Game.ObjectDelete(item);
13155 }
13156 }
13157 }
13158 }
13159
13160
13161
13162
13164 {
13165 float energy = 0;
13166 if (HasEnergyManager())
13167 {
13168 energy = GetCompEM().GetEnergy();
13169 }
13170 return energy;
13171 }
13172
13173
13175 {
13176 super.OnEnergyConsumed();
13177
13179 }
13180
13182 {
13183 super.OnEnergyAdded();
13184
13186 }
13187
13188
13190 {
13191 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13192 {
13194 {
13195 float energy_0to1 = GetCompEM().GetEnergy0To1();
13197 }
13198 }
13199 }
13200
13201
13203 {
13204 return ConfigGetFloat("heatIsolation");
13205 }
13206
13208 {
13210 }
13211
13213 {
13214 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13215 if (
g_Game.ConfigIsExisting(paramPath))
13216 return g_Game.ConfigGetFloat(paramPath);
13217
13218 return 0.0;
13219 }
13220
13222 {
13223 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13224 if (
g_Game.ConfigIsExisting(paramPath))
13225 return g_Game.ConfigGetFloat(paramPath);
13226
13227 return 0.0;
13228 }
13229
13230 override void SetWet(
float value,
bool allow_client =
false)
13231 {
13232 if (!IsServerCheck(allow_client))
13233 return;
13234
13237
13239
13240 m_VarWet = Math.Clamp(value, min, max);
13241
13243 {
13246 }
13247 }
13248
13249 override void AddWet(
float value)
13250 {
13252 }
13253
13255 {
13257 }
13258
13260 {
13262 }
13263
13265 {
13267 }
13268
13270 {
13272 }
13273
13275 {
13277 }
13278
13279 override void OnWetChanged(
float newVal,
float oldVal)
13280 {
13283 if (newLevel != oldLevel)
13284 {
13286 }
13287 }
13288
13290 {
13291 SetWeightDirty();
13292 }
13293
13295 {
13296 return GetWetLevelInternal(
m_VarWet);
13297 }
13298
13299
13300
13302 {
13304 }
13305
13307 {
13309 }
13310
13312 {
13314 }
13315
13317 {
13319 }
13320
13321
13322
13324 {
13325 if (ConfigIsExisting("itemModelLength"))
13326 {
13327 return ConfigGetFloat("itemModelLength");
13328 }
13329 return 0;
13330 }
13331
13333 {
13334 if (ConfigIsExisting("itemAttachOffset"))
13335 {
13336 return ConfigGetFloat("itemAttachOffset");
13337 }
13338 return 0;
13339 }
13340
13341 override void SetCleanness(
int value,
bool allow_client =
false)
13342 {
13343 if (!IsServerCheck(allow_client))
13344 return;
13345
13347
13349
13352 }
13353
13355 {
13357 }
13358
13360 {
13361 return true;
13362 }
13363
13364
13365
13366
13368 {
13370 }
13371
13373 {
13375 }
13376
13377
13378
13379
13380 override void SetColor(
int r,
int g,
int b,
int a)
13381 {
13387 }
13389 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13390 {
13395 }
13396
13398 {
13400 }
13401
13404 {
13405 int r,g,b,a;
13407 r = r/255;
13408 g = g/255;
13409 b = b/255;
13410 a = a/255;
13411 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13412 }
13413
13414
13415
13416 override void SetLiquidType(
int value,
bool allow_client =
false)
13417 {
13418 if (!IsServerCheck(allow_client))
13419 return;
13420
13425 }
13426
13428 {
13429 return ConfigGetInt("varLiquidTypeInit");
13430 }
13431
13433 {
13435 }
13436
13438 {
13440 SetFrozen(false);
13441 }
13442
13445 {
13446 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13447 }
13448
13449
13452 {
13453 PlayerBase nplayer;
13454 if (PlayerBase.CastTo(nplayer, player))
13455 {
13457 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13458 }
13459 }
13460
13461
13464 {
13465 PlayerBase nplayer;
13466 if (PlayerBase.CastTo(nplayer,player))
13467 {
13468 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13469 }
13470
13471 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13472
13473 if (HasEnergyManager())
13474 {
13475 GetCompEM().UpdatePlugState();
13476 }
13477 }
13478
13479
13481 {
13482 super.OnPlacementStarted(player);
13483
13485 }
13486
13487 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13488 {
13490 {
13491 m_AdminLog.OnPlacementComplete(player,
this);
13492 }
13493
13494 super.OnPlacementComplete(player, position, orientation);
13495 }
13496
13497
13498
13499
13500
13502 {
13504 {
13505 return true;
13506 }
13507 else
13508 {
13509 return false;
13510 }
13511 }
13512
13513
13515 {
13517 {
13519 }
13520 }
13521
13522
13524 {
13526 }
13527
13529 {
13531 }
13532
13533 override void InsertAgent(
int agent,
float count = 1)
13534 {
13535 if (count < 1)
13536 return;
13537
13539 }
13540
13543 {
13545 }
13546
13547
13549 {
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
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13595 {
13597 return false;
13598 return true;
13599 }
13600
13602 {
13603
13605 }
13606
13607
13610 {
13611 super.CheckForRoofLimited(timeTresholdMS);
13612
13613 float time =
g_Game.GetTime();
13614 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13615 {
13616 m_PreviousRoofTestTime = time;
13617 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13618 }
13619 }
13620
13621
13623 {
13625 {
13626 return 0;
13627 }
13628
13629 if (GetInventory().GetAttachmentSlotsCount() != 0)
13630 {
13631 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13632 if (filter)
13633 return filter.GetProtectionLevel(type, false, system);
13634 else
13635 return 0;
13636 }
13637
13638 string subclassPath, entryName;
13639
13640 switch (type)
13641 {
13643 entryName = "biological";
13644 break;
13646 entryName = "chemical";
13647 break;
13648 default:
13649 entryName = "biological";
13650 break;
13651 }
13652
13653 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13654
13655 return g_Game.ConfigGetFloat(subclassPath + entryName);
13656 }
13657
13658
13659
13662 {
13663 if (!IsMagazine())
13665
13667 }
13668
13669
13670
13671
13672
13677 {
13678 return true;
13679 }
13680
13682 {
13684 }
13685
13686
13687
13688
13689
13691 {
13692 if (parent)
13693 {
13694 if (parent.IsInherited(DayZInfected))
13695 return true;
13696
13697 if (!parent.IsRuined())
13698 return true;
13699 }
13700
13701 return true;
13702 }
13703
13705 {
13706 if (!super.CanPutAsAttachment(parent))
13707 {
13708 return false;
13709 }
13710
13711 if (!IsRuined() && !parent.IsRuined())
13712 {
13713 return true;
13714 }
13715
13716 return false;
13717 }
13718
13720 {
13721
13722
13723
13724
13725 return super.CanReceiveItemIntoCargo(item);
13726 }
13727
13729 {
13730
13731
13732
13733
13734 GameInventory attachmentInv = attachment.GetInventory();
13736 {
13737 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13738 return false;
13739 }
13740
13741 InventoryLocation loc = new InventoryLocation();
13742 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13743 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13744 return false;
13745
13746 return super.CanReceiveAttachment(attachment, slotId);
13747 }
13748
13750 {
13751 if (!super.CanReleaseAttachment(attachment))
13752 return false;
13753
13754 return GetInventory().AreChildrenAccessible();
13755 }
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13778 {
13779 int id = muzzle_owner.GetMuzzleID();
13780 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13781
13782 if (WPOF_array)
13783 {
13784 for (int i = 0; i < WPOF_array.Count(); i++)
13785 {
13786 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13787
13788 if (WPOF)
13789 {
13790 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13791 }
13792 }
13793 }
13794 }
13795
13796
13798 {
13799 int id = muzzle_owner.GetMuzzleID();
13801
13802 if (WPOBE_array)
13803 {
13804 for (int i = 0; i < WPOBE_array.Count(); i++)
13805 {
13806 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13807
13808 if (WPOBE)
13809 {
13810 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13811 }
13812 }
13813 }
13814 }
13815
13816
13818 {
13819 int id = muzzle_owner.GetMuzzleID();
13820 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13821
13822 if (WPOOH_array)
13823 {
13824 for (int i = 0; i < WPOOH_array.Count(); i++)
13825 {
13826 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13827
13828 if (WPOOH)
13829 {
13830 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13831 }
13832 }
13833 }
13834 }
13835
13836
13838 {
13839 int id = muzzle_owner.GetMuzzleID();
13840 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13841
13842 if (WPOOH_array)
13843 {
13844 for (int i = 0; i < WPOOH_array.Count(); i++)
13845 {
13846 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13847
13848 if (WPOOH)
13849 {
13850 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13851 }
13852 }
13853 }
13854 }
13855
13856
13858 {
13859 int id = muzzle_owner.GetMuzzleID();
13860 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13861
13862 if (WPOOH_array)
13863 {
13864 for (int i = 0; i < WPOOH_array.Count(); i++)
13865 {
13866 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13867
13868 if (WPOOH)
13869 {
13870 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13871 }
13872 }
13873 }
13874 }
13875
13876
13877
13879 {
13881 {
13882 return true;
13883 }
13884
13885 return false;
13886 }
13887
13889 {
13891 {
13892 return true;
13893 }
13894
13895 return false;
13896 }
13897
13899 {
13901 {
13902 return true;
13903 }
13904
13905 return false;
13906 }
13907
13909 {
13910 return false;
13911 }
13912
13915 {
13916 return UATimeSpent.DEFAULT_DEPLOY;
13917 }
13918
13919
13920
13921
13923 {
13925 SetSynchDirty();
13926 }
13927
13929 {
13931 }
13932
13933
13935 {
13936 return false;
13937 }
13938
13941 {
13942 string att_type = "None";
13943
13944 if (ConfigIsExisting("soundAttType"))
13945 {
13946 att_type = ConfigGetString("soundAttType");
13947 }
13948
13950 }
13951
13953 {
13955 }
13956
13957
13958
13959
13960
13966
13968 {
13971
13973 }
13974
13975
13977 {
13979 return;
13980
13982
13985
13988
13989 SoundParameters params = new SoundParameters();
13993 }
13994
13995
13997 {
13999 {
14002
14003 SetSynchDirty();
14004
14007 }
14008 }
14009
14011 {
14013 }
14014
14015
14017 {
14019 return;
14020
14022 SetSynchDirty();
14023
14026 }
14027
14029 {
14032 }
14033
14035 {
14037 }
14038
14039 void OnApply(PlayerBase player);
14040
14042 {
14043 return 1.0;
14044 };
14045
14047 {
14049 }
14050
14052 {
14054 }
14055
14057
14059 {
14060 SetDynamicPhysicsLifeTime(0.01);
14062 }
14063
14065 {
14066 array<string> zone_names = new array<string>;
14067 GetDamageZones(zone_names);
14068 for (int i = 0; i < zone_names.Count(); i++)
14069 {
14070 SetHealthMax(zone_names.Get(i),"Health");
14071 }
14072 SetHealthMax("","Health");
14073 }
14074
14077 {
14078 float global_health = GetHealth01("","Health");
14079 array<string> zones = new array<string>;
14080 GetDamageZones(zones);
14081
14082 for (int i = 0; i < zones.Count(); i++)
14083 {
14084 SetHealth01(zones.Get(i),"Health",global_health);
14085 }
14086 }
14087
14090 {
14091 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14092 }
14093
14095 {
14096 if (!hasRootAsPlayer)
14097 {
14098 if (refParentIB)
14099 {
14100
14101 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14102 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14103
14104 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14105 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14106
14109 }
14110 else
14111 {
14112
14115 }
14116 }
14117 }
14118
14120 {
14122 {
14123 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14124 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14125 {
14126 float heatPermCoef = 1.0;
14128 while (ent)
14129 {
14130 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14131 ent = ent.GetHierarchyParent();
14132 }
14133
14134 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14135 }
14136 }
14137 }
14138
14140 {
14141
14142 EntityAI parent = GetHierarchyParent();
14143 if (!parent)
14144 {
14145 hasParent = false;
14146 hasRootAsPlayer = false;
14147 }
14148 else
14149 {
14150 hasParent = true;
14151 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14152 refParentIB =
ItemBase.Cast(parent);
14153 }
14154 }
14155
14156 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14157 {
14158
14159 }
14160
14162 {
14163
14164 return false;
14165 }
14166
14168 {
14169
14170
14171 return false;
14172 }
14173
14175 {
14176
14177 return false;
14178 }
14179
14182 {
14183 return !GetIsFrozen() &&
IsOpen();
14184 }
14185
14187 {
14188 bool hasParent = false, hasRootAsPlayer = false;
14190
14191 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14192 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14193
14194 if (wwtu || foodDecay)
14195 {
14199
14200 if (processWetness || processTemperature || processDecay)
14201 {
14203
14204 if (processWetness)
14205 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14206
14207 if (processTemperature)
14209
14210 if (processDecay)
14211 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14212 }
14213 }
14214 }
14215
14218 {
14220 }
14221
14223 {
14226
14227 return super.GetTemperatureFreezeThreshold();
14228 }
14229
14231 {
14234
14235 return super.GetTemperatureThawThreshold();
14236 }
14237
14239 {
14242
14243 return super.GetItemOverheatThreshold();
14244 }
14245
14247 {
14249 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14250
14251 return super.GetTemperatureFreezeTime();
14252 }
14253
14255 {
14257 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14258
14259 return super.GetTemperatureThawTime();
14260 }
14261
14266
14268 {
14269 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14270 }
14271
14273 {
14274 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14275 }
14276
14279 {
14281 }
14282
14284 {
14286 }
14287
14289 {
14291 }
14292
14295 {
14296 return null;
14297 }
14298
14301 {
14302 return false;
14303 }
14304
14306 {
14308 {
14311 if (!trg)
14312 {
14314 explosive = this;
14315 }
14316
14317 explosive.PairRemote(trg);
14319
14320 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14321 trg.SetPersistentPairID(persistentID);
14322 explosive.SetPersistentPairID(persistentID);
14323
14324 return true;
14325 }
14326 return false;
14327 }
14328
14331 {
14332 float ret = 1.0;
14335 ret *= GetHealth01();
14336
14337 return ret;
14338 }
14339
14340 #ifdef DEVELOPER
14341 override void SetDebugItem()
14342 {
14343 super.SetDebugItem();
14344 _itemBase = this;
14345 }
14346
14348 {
14349 string text = super.GetDebugText();
14350
14352 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14353
14354 return text;
14355 }
14356 #endif
14357
14359 {
14360 return true;
14361 }
14362
14364
14366
14368 {
14371 }
14372
14373
14381
14397
14398 [
Obsolete(
"Use ItemSoundHandler instead")]
14401 {
14402 if (!
g_Game.IsDedicatedServer())
14403 {
14404 if (ConfigIsExisting("attachSoundSet"))
14405 {
14406 string cfg_path = "";
14407 string soundset = "";
14408 string type_name =
GetType();
14409
14412 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14413 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14414
14415 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14416 {
14417 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14418 {
14419 if (cfg_slot_array[i] == slot_type)
14420 {
14421 soundset = cfg_soundset_array[i];
14422 break;
14423 }
14424 }
14425 }
14426
14427 if (soundset != "")
14428 {
14429 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14431 }
14432 }
14433 }
14434 }
14435
14437}
14438
14440{
14442 if (entity)
14443 {
14444 bool is_item = entity.IsInherited(
ItemBase);
14445 if (is_item && full_quantity)
14446 {
14449 }
14450 }
14451 else
14452 {
14454 return NULL;
14455 }
14456 return entity;
14457}
14458
14460{
14461 if (item)
14462 {
14463 if (health > 0)
14464 item.SetHealth("", "", health);
14465
14466 if (item.CanHaveTemperature())
14467 {
14469 if (item.CanFreeze())
14470 item.SetFrozen(false);
14471 }
14472
14473 if (item.HasEnergyManager())
14474 {
14475 if (quantity >= 0)
14476 {
14477 item.GetCompEM().SetEnergy0To1(quantity);
14478 }
14479 else
14480 {
14482 }
14483 }
14484 else if (item.IsMagazine())
14485 {
14486 Magazine mag = Magazine.Cast(item);
14487 if (quantity >= 0)
14488 {
14489 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14490 }
14491 else
14492 {
14494 }
14495
14496 }
14497 else
14498 {
14499 if (quantity >= 0)
14500 {
14501 item.SetQuantityNormalized(quantity, false);
14502 }
14503 else
14504 {
14506 }
14507
14508 }
14509 }
14510}
14511
14512#ifdef DEVELOPER
14514#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.