9759{
9761 {
9762 return true;
9763 }
9764};
9765
9767{
9768
9769};
9770
9771
9772
9774{
9778
9780
9783
9784
9785
9786
9787
9796
9802
9807
9812
9833 protected bool m_IsResultOfSplit
9834
9836
9841
9842
9843
9845
9849
9850
9851
9853
9856
9857
9858
9864
9865
9873
9876
9877
9879
9880
9882
9883
9888
9889
9894
9896
9897
9899
9900
9902 {
9907
9908 if (!
g_Game.IsDedicatedServer())
9909 {
9911 {
9913
9915 {
9917 }
9918 }
9919
9922 }
9923
9924 m_OldLocation = null;
9925
9927 {
9929 }
9930
9931 if (ConfigIsExisting("headSelectionsToHide"))
9932 {
9935 }
9936
9938 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9939 {
9941 }
9942
9944
9945 m_IsResultOfSplit = false;
9946
9948 }
9949
9951 {
9952 super.InitItemVariables();
9953
9959 m_Count = ConfigGetInt(
"count");
9960
9963
9968
9971
9976
9988
9992
9993
9996 if (ConfigIsExisting("canBeSplit"))
9997 {
10000 }
10001
10003 if (ConfigIsExisting("itemBehaviour"))
10005
10006
10009 RegisterNetSyncVariableInt("m_VarLiquidType");
10010 RegisterNetSyncVariableInt("m_Cleanness",0,1);
10011
10012 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
10013 RegisterNetSyncVariableFloat("m_ImpactSpeed");
10014 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
10015
10016 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
10017 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
10018 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
10019 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
10020
10021 RegisterNetSyncVariableBool("m_IsBeingPlaced");
10022 RegisterNetSyncVariableBool("m_IsTakeable");
10023 RegisterNetSyncVariableBool("m_IsHologram");
10024
10027 {
10030 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10031 }
10032
10034
10036 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10038
10040 }
10041
10043 {
10045 }
10046
10048 {
10051 {
10056 }
10057 }
10058
10059 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10060 {
10062 {
10065 }
10066
10068 }
10069
10071 {
10077 }
10078
10080
10082 {
10084
10085 if (!action)
10086 {
10087 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10088 return;
10089 }
10090
10092 if (!ai)
10093 {
10095 return;
10096 }
10097
10099 if (!action_array)
10100 {
10101 action_array = new array<ActionBase_Basic>;
10103 }
10104 if (LogManager.IsActionLogEnable())
10105 {
10106 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10107 }
10108
10109 if (action_array.Find(action) != -1)
10110 {
10111 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10112 }
10113 else
10114 {
10115 action_array.Insert(action);
10116 }
10117 }
10118
10120 {
10121 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10122 ActionBase action = player.GetActionManager().GetAction(actionName);
10125
10126 if (action_array)
10127 {
10128 action_array.RemoveItem(action);
10129 }
10130 }
10131
10132
10133
10135 {
10136 ActionOverrideData overrideData = new ActionOverrideData();
10140
10142 if (!actionMap)
10143 {
10146 }
10147
10148 actionMap.Insert(this.
Type(), overrideData);
10149
10150 }
10151
10153
10155
10156
10158 {
10161
10164
10165 string config_to_search = "CfgVehicles";
10166 string muzzle_owner_config;
10167
10169 {
10170 if (IsInherited(Weapon))
10171 config_to_search = "CfgWeapons";
10172
10173 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10174
10175 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10176
10177 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10178
10179 if (config_OnFire_subclass_count > 0)
10180 {
10181 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10182
10183 for (int i = 0; i < config_OnFire_subclass_count; i++)
10184 {
10185 string particle_class = "";
10186 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10187 string config_OnFire_entry = config_OnFire_class + particle_class;
10188 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10189 WPOF_array.Insert(WPOF);
10190 }
10191
10192
10194 }
10195 }
10196
10198 {
10199 config_to_search = "CfgWeapons";
10200 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10201
10202 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10203
10204 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10205
10206 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10207 {
10208 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10209
10210 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10211 {
10212 string particle_class2 = "";
10213 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10214 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10215 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10216 WPOBE_array.Insert(WPOBE);
10217 }
10218
10219
10221 }
10222 }
10223 }
10224
10225
10227 {
10230
10232 {
10233 string config_to_search = "CfgVehicles";
10234
10235 if (IsInherited(Weapon))
10236 config_to_search = "CfgWeapons";
10237
10238 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10239 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10240
10241 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10242 {
10243
10245
10247 {
10249 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10251 return;
10252 }
10253
10256
10257
10258
10259 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10260 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10261
10262 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10263 {
10264 string particle_class = "";
10265 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10266 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10267 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10268
10269 if (entry_type == CT_CLASS)
10270 {
10271 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10272 WPOOH_array.Insert(WPOF);
10273 }
10274 }
10275
10276
10278 }
10279 }
10280 }
10281
10283 {
10285 }
10286
10288 {
10290 {
10292
10295
10298
10299 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10300 }
10301 }
10302
10304 {
10306 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10307
10309 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10310
10312 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10313
10315 {
10317 }
10318 }
10319
10321 {
10323 }
10324
10326 {
10329 else
10331
10333 {
10336 }
10337 else
10338 {
10341
10344 }
10345
10347 }
10348
10350 {
10352 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10353 }
10354
10356 {
10358 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10360 }
10361
10363 {
10365 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10366 }
10367
10369 {
10372
10373 OverheatingParticle OP = new OverheatingParticle();
10378
10380 }
10381
10383 {
10386
10387 return -1;
10388 }
10389
10391 {
10393 {
10396
10397 for (int i = count; i > 0; --i)
10398 {
10399 int id = i - 1;
10402
10405
10406 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10407 {
10408 if (p)
10409 {
10412 }
10413 }
10414 }
10415 }
10416 }
10417
10419 {
10421 {
10423 {
10424 int id = i - 1;
10426
10427 if (OP)
10428 {
10430
10431 if (p)
10432 {
10434 }
10435
10436 delete OP;
10437 }
10438 }
10439
10442 }
10443 }
10444
10447 {
10448 return 0.0;
10449 }
10450
10451
10453 {
10454 return 250;
10455 }
10456
10458 {
10459 return 0;
10460 }
10461
10464 {
10466 return true;
10467
10468 return false;
10469 }
10470
10473 {
10476
10478 {
10480 }
10481 else
10482 {
10483
10485 }
10486
10488 }
10489
10496 {
10497 return -1;
10498 }
10499
10500
10501
10502
10504 {
10506 {
10507 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10508 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10509
10510 if (r_index >= 0)
10511 {
10512 InventoryLocation r_il = new InventoryLocation;
10513 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10514
10515 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10518 {
10519 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10520 }
10522 {
10523 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10524 }
10525
10526 }
10527
10528 player.GetHumanInventory().ClearUserReservedLocation(this);
10529 }
10530
10533 }
10534
10535
10536
10537
10539 {
10540 return ItemBase.m_DebugActionsMask;
10541 }
10542
10544 {
10545 return ItemBase.m_DebugActionsMask & mask;
10546 }
10547
10549 {
10550 ItemBase.m_DebugActionsMask = mask;
10551 }
10552
10554 {
10555 ItemBase.m_DebugActionsMask |= mask;
10556 }
10557
10559 {
10560 ItemBase.m_DebugActionsMask &= ~mask;
10561 }
10562
10564 {
10566 {
10568 }
10569 else
10570 {
10572 }
10573 }
10574
10575
10577 {
10578 if (GetEconomyProfile())
10579 {
10580 float q_max = GetEconomyProfile().GetQuantityMax();
10581 if (q_max > 0)
10582 {
10583 float q_min = GetEconomyProfile().GetQuantityMin();
10584 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10585
10587 {
10588 ComponentEnergyManager comp = GetCompEM();
10590 {
10592 }
10593 }
10595 {
10597
10598 }
10599
10600 }
10601 }
10602 }
10603
10606 {
10607 EntityAI parent = GetHierarchyParent();
10608
10609 if (parent)
10610 {
10611 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10612 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10613 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10614 }
10615 }
10616
10619 {
10620 EntityAI parent = GetHierarchyParent();
10621
10622 if (parent)
10623 {
10624 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10625 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10626 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10627 }
10628 }
10629
10631 {
10632
10633
10634
10635
10637
10639 {
10640 if (ScriptInputUserData.CanStoreInputUserData())
10641 {
10642 ScriptInputUserData ctx = new ScriptInputUserData;
10648 ctx.
Write(use_stack_max);
10651
10653 {
10654 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10655 }
10656 }
10657 }
10658 else if (!
g_Game.IsMultiplayer())
10659 {
10661 }
10662 }
10663
10665 {
10667 }
10668
10670 {
10672 }
10673
10675 {
10677 }
10678
10680 {
10681
10682 return false;
10683 }
10684
10686 {
10687 return false;
10688 }
10689
10693 {
10694 return false;
10695 }
10696
10698 {
10699 return "";
10700 }
10701
10703
10705 {
10706 return false;
10707 }
10708
10710 {
10711 return true;
10712 }
10713
10714
10715
10717 {
10718 return true;
10719 }
10720
10722 {
10723 return true;
10724 }
10725
10727 {
10728 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10730 }
10731
10733 {
10735 }
10736
10738 {
10740 if (!is_being_placed)
10742 SetSynchDirty();
10743 }
10744
10745
10747
10749 {
10751 }
10752
10754 {
10756 }
10757
10759 {
10760 return 1;
10761 }
10762
10764 {
10765 return false;
10766 }
10767
10769 {
10771 SetSynchDirty();
10772 }
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10809 {
10810 super.OnMovedInsideCargo(container);
10811
10812 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10813 }
10814
10815 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10816 {
10817 super.EEItemLocationChanged(oldLoc, newLoc);
10818
10819 PlayerBase newPlayer = null;
10820 PlayerBase oldPlayer = null;
10821
10822 if (newLoc.GetParent())
10823 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10824
10825 if (oldLoc.GetParent())
10826 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10827
10829 {
10830 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10831
10832 if (rIndex >= 0)
10833 {
10834 InventoryLocation rIl = new InventoryLocation;
10835 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10836
10837 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10840 {
10841 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10842 }
10844 {
10846 }
10847
10848 }
10849 }
10850
10852 {
10853 if (newPlayer)
10854 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10855
10856 if (newPlayer == oldPlayer)
10857 {
10858 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10859 {
10861 {
10862 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10863 {
10864 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10865 }
10866 }
10867 else
10868 {
10869 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10870 }
10871 }
10872
10873 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10874 {
10875 int type = oldLoc.GetType();
10877 {
10878 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10879 }
10881 {
10882 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10883 }
10884 }
10885 if (!m_OldLocation)
10886 {
10887 m_OldLocation = new InventoryLocation;
10888 }
10889 m_OldLocation.Copy(oldLoc);
10890 }
10891 else
10892 {
10893 if (m_OldLocation)
10894 {
10895 m_OldLocation.Reset();
10896 }
10897 }
10898
10899 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10900 }
10901 else
10902 {
10903 if (newPlayer)
10904 {
10905 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10906 if (resIndex >= 0)
10907 {
10908 InventoryLocation il = new InventoryLocation;
10909 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10911 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10914 {
10915 il.
GetParent().GetOnReleaseLock().Invoke(it);
10916 }
10918 {
10920 }
10921
10922 }
10923 }
10925 {
10926
10928 }
10929
10930 if (m_OldLocation)
10931 {
10932 m_OldLocation.Reset();
10933 }
10934 }
10935
10937 {
10938 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10939 }
10940
10942 {
10943 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10944 }
10945 }
10946
10947 override void EOnContact(IEntity other, Contact extra)
10948 {
10950 {
10951 int liquidType = -1;
10953 if (impactSpeed > 0.0)
10954 {
10956 #ifndef SERVER
10958 #else
10960 SetSynchDirty();
10961 #endif
10963 }
10964 }
10965
10966 #ifdef SERVER
10967 if (GetCompEM() && GetCompEM().IsPlugged())
10968 {
10969 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10970 GetCompEM().UnplugThis();
10971 }
10972 #endif
10973 }
10974
10976
10978 {
10980 }
10981
10983 {
10984
10985 }
10986
10988 {
10989 super.OnItemLocationChanged(old_owner, new_owner);
10990
10991 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10992 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10993
10994 if (!relatedPlayer && playerNew)
10995 relatedPlayer = playerNew;
10996
10997 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10998 {
11000 if (actionMgr)
11001 {
11002 ActionBase currentAction = actionMgr.GetRunningAction();
11003 if (currentAction)
11005 }
11006 }
11007
11008 Man ownerPlayerOld = null;
11009 Man ownerPlayerNew = null;
11010
11011 if (old_owner)
11012 {
11013 if (old_owner.
IsMan())
11014 {
11015 ownerPlayerOld = Man.Cast(old_owner);
11016 }
11017 else
11018 {
11019 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
11020 }
11021 }
11022 else
11023 {
11025 {
11027
11028 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11029 {
11030 GetCompEM().UnplugThis();
11031 }
11032 }
11033 }
11034
11035 if (new_owner)
11036 {
11037 if (new_owner.
IsMan())
11038 {
11039 ownerPlayerNew = Man.Cast(new_owner);
11040 }
11041 else
11042 {
11043 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11044 }
11045 }
11046
11047 if (ownerPlayerOld != ownerPlayerNew)
11048 {
11049 if (ownerPlayerOld)
11050 {
11051 array<EntityAI> subItemsExit = new array<EntityAI>;
11053 for (int i = 0; i < subItemsExit.Count(); i++)
11054 {
11057 }
11058 }
11059
11060 if (ownerPlayerNew)
11061 {
11062 array<EntityAI> subItemsEnter = new array<EntityAI>;
11064 for (int j = 0; j < subItemsEnter.Count(); j++)
11065 {
11068 }
11069 }
11070 }
11071 else if (ownerPlayerNew != null)
11072 {
11073 PlayerBase nplayer;
11074 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11075 {
11076 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11078 for (int k = 0; k < subItemsUpdate.Count(); k++)
11079 {
11081 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11082 }
11083 }
11084 }
11085
11086 if (old_owner)
11087 old_owner.OnChildItemRemoved(this);
11088 if (new_owner)
11089 new_owner.OnChildItemReceived(this);
11090 }
11091
11092
11094 {
11095 super.EEDelete(parent);
11096 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11097 if (player)
11098 {
11100
11101 if (player.IsAlive())
11102 {
11103 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11104 if (r_index >= 0)
11105 {
11106 InventoryLocation r_il = new InventoryLocation;
11107 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11108
11109 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11112 {
11113 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11114 }
11116 {
11117 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11118 }
11119
11120 }
11121
11122 player.RemoveQuickBarEntityShortcut(this);
11123 }
11124 }
11125 }
11126
11128 {
11129 super.EEKilled(killer);
11130
11133 {
11134 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11135 {
11136 if (IsMagazine())
11137 {
11138 if (Magazine.Cast(this).GetAmmoCount() > 0)
11139 {
11141 }
11142 }
11143 else
11144 {
11146 }
11147 }
11148 }
11149 }
11150
11152 {
11153 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11154
11155 super.OnWasAttached(parent, slot_id);
11156
11159
11162 }
11163
11165 {
11166 super.OnWasDetached(parent, slot_id);
11167
11170
11173 }
11174
11176 {
11177 int idx;
11180
11181 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11182 if (inventory_slots.Count() < 1)
11183 {
11184 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11185 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11186 }
11187 else
11188 {
11189 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11190 }
11191
11192 idx = inventory_slots.Find(slot);
11193 if (idx < 0)
11194 return "";
11195
11196 return attach_types.Get(idx);
11197 }
11198
11200 {
11201 int idx = -1;
11202 string slot;
11203
11206
11207 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11208 if (inventory_slots.Count() < 1)
11209 {
11210 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11211 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11212 }
11213 else
11214 {
11215 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11216 if (detach_types.Count() < 1)
11217 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11218 }
11219
11220 for (int i = 0; i < inventory_slots.Count(); i++)
11221 {
11222 slot = inventory_slots.Get(i);
11223 }
11224
11225 if (slot != "")
11226 {
11227 if (detach_types.Count() == 1)
11228 idx = 0;
11229 else
11230 idx = inventory_slots.Find(slot);
11231 }
11232 if (idx < 0)
11233 return "";
11234
11235 return detach_types.Get(idx);
11236 }
11237
11239 {
11240
11242
11243
11244 float min_time = 1;
11245 float max_time = 3;
11246 float delay = Math.RandomFloat(min_time, max_time);
11247
11248 explode_timer.Run(delay, this, "DoAmmoExplosion");
11249 }
11250
11252 {
11253 Magazine magazine = Magazine.Cast(this);
11254 int pop_sounds_count = 6;
11255 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11256
11257
11258 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11259 string sound_name = pop_sounds[ sound_idx ];
11260 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11261
11262
11263 magazine.ServerAddAmmoCount(-1);
11264
11265
11266 float min_temp_to_explode = 100;
11267
11268 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11269 {
11271 }
11272 }
11273
11274
11275 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11276 {
11277 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11278
11279 const int CHANCE_DAMAGE_CARGO = 4;
11280 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11281 const int CHANCE_DAMAGE_NOTHING = 2;
11282
11284 {
11285 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11286 int chances;
11287 int rnd;
11288
11289 if (GetInventory().GetCargo())
11290 {
11291 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11292 rnd = Math.RandomInt(0,chances);
11293
11294 if (rnd < CHANCE_DAMAGE_CARGO)
11295 {
11297 }
11298 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11299 {
11301 }
11302 }
11303 else
11304 {
11305 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11306 rnd = Math.RandomInt(0,chances);
11307
11308 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11309 {
11311 }
11312 }
11313 }
11314 }
11315
11317 {
11318 CargoBase cargo = GetInventory().GetCargo();
11319 if (cargo)
11320 {
11322 if (item_count > 0)
11323 {
11324 int random_pick = Math.RandomInt(0, item_count);
11326 if (!item.IsExplosive())
11327 {
11328 item.AddHealth("","",damage);
11329 return true;
11330 }
11331 }
11332 }
11333 return false;
11334 }
11335
11337 {
11338 GameInventory inventory = GetInventory();
11340 if (attachment_count > 0)
11341 {
11342 int random_pick = Math.RandomInt(0, attachment_count);
11344 if (!attachment.IsExplosive())
11345 {
11346 attachment.AddHealth("","",damage);
11347 return true;
11348 }
11349 }
11350 return false;
11351 }
11352
11354 {
11356 }
11357
11359 {
11361 return GetInventory().CanRemoveEntity();
11362
11363 return false;
11364 }
11365
11367 {
11368
11370 return false;
11371
11372
11374 return false;
11375
11376
11377
11379 if (delta == 0)
11380 return false;
11381
11382
11383 return true;
11384 }
11385
11387 {
11389 {
11390 if (ScriptInputUserData.CanStoreInputUserData())
11391 {
11392 ScriptInputUserData ctx = new ScriptInputUserData;
11397 ctx.
Write(destination_entity);
11399 ctx.
Write(slot_id);
11401 }
11402 }
11403 else if (!
g_Game.IsMultiplayer())
11404 {
11406 }
11407 }
11408
11410 {
11411 float split_quantity_new;
11415 InventoryLocation loc = new InventoryLocation;
11416
11417 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11418 {
11420 split_quantity_new = stack_max;
11421 else
11423
11425 {
11426 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11427 if (new_item)
11428 {
11429 new_item.SetResultOfSplit(true);
11430 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11432 new_item.
SetQuantity(split_quantity_new,
false,
true);
11433 }
11434 }
11435 }
11436 else if (destination_entity && slot_id == -1)
11437 {
11438 if (quantity > stack_max)
11439 split_quantity_new = stack_max;
11440 else
11441 split_quantity_new = quantity;
11442
11444 {
11445 GameInventory destinationInventory = destination_entity.GetInventory();
11447 {
11450 }
11451
11452 if (new_item)
11453 {
11454 new_item.SetResultOfSplit(true);
11455 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11457 new_item.
SetQuantity(split_quantity_new,
false,
true);
11458 }
11459 }
11460 }
11461 else
11462 {
11463 if (stack_max != 0)
11464 {
11466 {
11468 }
11469
11470 if (split_quantity_new == 0)
11471 {
11472 if (!
g_Game.IsMultiplayer())
11473 player.PhysicalPredictiveDropItem(this);
11474 else
11475 player.ServerDropEntity(this);
11476 return;
11477 }
11478
11480 {
11482
11483 if (new_item)
11484 {
11485 new_item.SetResultOfSplit(true);
11486 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11489 new_item.PlaceOnSurface();
11490 }
11491 }
11492 }
11493 }
11494 }
11495
11497 {
11498 float split_quantity_new;
11502 InventoryLocation loc = new InventoryLocation;
11503
11504 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11505 {
11507 split_quantity_new = stack_max;
11508 else
11510
11512 {
11513 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11514 if (new_item)
11515 {
11516 new_item.SetResultOfSplit(true);
11517 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11519 new_item.
SetQuantity(split_quantity_new,
false,
true);
11520 }
11521 }
11522 }
11523 else if (destination_entity && slot_id == -1)
11524 {
11525 if (quantity > stack_max)
11526 split_quantity_new = stack_max;
11527 else
11528 split_quantity_new = quantity;
11529
11531 {
11532 GameInventory destinationInventory = destination_entity.GetInventory();
11534 {
11537 }
11538
11539 if (new_item)
11540 {
11541 new_item.SetResultOfSplit(true);
11542 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11544 new_item.
SetQuantity(split_quantity_new,
false,
true);
11545 }
11546 }
11547 }
11548 else
11549 {
11550 if (stack_max != 0)
11551 {
11553 {
11555 }
11556
11558 {
11560
11561 if (new_item)
11562 {
11563 new_item.SetResultOfSplit(true);
11564 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11567 new_item.PlaceOnSurface();
11568 }
11569 }
11570 }
11571 }
11572 }
11573
11575 {
11577 {
11578 if (ScriptInputUserData.CanStoreInputUserData())
11579 {
11580 ScriptInputUserData ctx = new ScriptInputUserData;
11585 dst.WriteToContext(ctx);
11587 }
11588 }
11589 else if (!
g_Game.IsMultiplayer())
11590 {
11592 }
11593 }
11594
11596 {
11598 {
11599 if (ScriptInputUserData.CanStoreInputUserData())
11600 {
11601 ScriptInputUserData ctx = new ScriptInputUserData;
11606 ctx.
Write(destination_entity);
11612 }
11613 }
11614 else if (!
g_Game.IsMultiplayer())
11615 {
11617 }
11618 }
11619
11621 {
11623 }
11624
11626 {
11628 float split_quantity_new;
11630 if (dst.IsValid())
11631 {
11632 int slot_id = dst.GetSlot();
11634
11635 if (quantity > stack_max)
11636 split_quantity_new = stack_max;
11637 else
11638 split_quantity_new = quantity;
11639
11641 {
11643
11644 if (new_item)
11645 {
11646 new_item.SetResultOfSplit(true);
11647 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11649 new_item.
SetQuantity(split_quantity_new,
false,
true);
11650 }
11651
11652 return new_item;
11653 }
11654 }
11655
11656 return null;
11657 }
11658
11660 {
11662 float split_quantity_new;
11664 if (destination_entity)
11665 {
11667 if (quantity > stackable)
11668 split_quantity_new = stackable;
11669 else
11670 split_quantity_new = quantity;
11671
11673 {
11674 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11675 if (new_item)
11676 {
11677 new_item.SetResultOfSplit(true);
11678 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11680 new_item.
SetQuantity(split_quantity_new,
false,
true);
11681 }
11682 }
11683 }
11684 }
11685
11687 {
11689 {
11690 if (ScriptInputUserData.CanStoreInputUserData())
11691 {
11692 ScriptInputUserData ctx = new ScriptInputUserData;
11697 ItemBase destination_entity =
this;
11698 ctx.
Write(destination_entity);
11702 }
11703 }
11704 else if (!
g_Game.IsMultiplayer())
11705 {
11707 }
11708 }
11709
11711 {
11713 float split_quantity_new;
11715 if (player)
11716 {
11718 if (quantity > stackable)
11719 split_quantity_new = stackable;
11720 else
11721 split_quantity_new = quantity;
11722
11724 {
11725 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11726 new_item =
ItemBase.Cast(in_hands);
11727 if (new_item)
11728 {
11729 new_item.SetResultOfSplit(true);
11730 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11732 new_item.SetQuantity(split_quantity_new, false, true);
11733 }
11734 }
11735 }
11736 }
11737
11739 {
11741 float split_quantity_new = Math.Floor(quantity * 0.5);
11742
11744 return;
11745
11747
11748 if (new_item)
11749 {
11750 if (new_item.GetQuantityMax() < split_quantity_new)
11751 {
11752 split_quantity_new = new_item.GetQuantityMax();
11753 }
11754
11755 new_item.SetResultOfSplit(true);
11756 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11757
11759 {
11762 }
11763 else
11764 {
11766 new_item.
SetQuantity(split_quantity_new,
false,
true);
11767 }
11768 }
11769 }
11770
11772 {
11774 float split_quantity_new = Math.Floor(quantity / 2);
11775
11777 return;
11778
11779 InventoryLocation invloc = new InventoryLocation;
11781
11783 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11784
11785 if (new_item)
11786 {
11787 if (new_item.GetQuantityMax() < split_quantity_new)
11788 {
11789 split_quantity_new = new_item.GetQuantityMax();
11790 }
11792 {
11795 }
11796 else if (split_quantity_new > 1)
11797 {
11799 new_item.
SetQuantity(split_quantity_new,
false,
true);
11800 }
11801 }
11802 }
11803
11806 {
11807 SetWeightDirty();
11809
11810 if (parent)
11811 parent.OnAttachmentQuantityChangedEx(this, delta);
11812
11814 {
11816 {
11818 }
11820 {
11821 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11823 }
11824 }
11825 }
11826
11829 {
11830
11831 }
11832
11835 {
11837 }
11838
11840 {
11841 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11842
11844 {
11845 if (newLevel == GameConstants.STATE_RUINED)
11846 {
11848 EntityAI parent = GetHierarchyParent();
11849 if (parent && parent.IsFireplace())
11850 {
11851 CargoBase cargo = GetInventory().GetCargo();
11852 if (cargo)
11853 {
11855 {
11857 }
11858 }
11859 }
11860 }
11861
11863 {
11864
11866 return;
11867 }
11868
11869 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11870 {
11872 }
11873 }
11874 }
11875
11876
11878 {
11879 super.OnRightClick();
11880
11882 {
11884 {
11885 if (ScriptInputUserData.CanStoreInputUserData())
11886 {
11887 EntityAI root = GetHierarchyRoot();
11888 Man playerOwner = GetHierarchyRootPlayer();
11889 InventoryLocation dst = new InventoryLocation;
11890
11891
11892 if (!playerOwner && root && root == this)
11893 {
11895 }
11896 else
11897 {
11898
11899 GetInventory().GetCurrentInventoryLocation(dst);
11901 {
11902 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11904 {
11906 }
11907 else
11908 {
11910
11911
11912 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11913 {
11915 }
11916 else
11917 {
11918 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11919 }
11920 }
11921 }
11922 }
11923
11924 ScriptInputUserData ctx = new ScriptInputUserData;
11932 }
11933 }
11934 else if (!
g_Game.IsMultiplayer())
11935 {
11937 }
11938 }
11939 }
11940
11942 {
11943 if (root)
11944 {
11945 vector m4[4];
11946 root.GetTransform(m4);
11947 dst.SetGround(this, m4);
11948 }
11949 else
11950 {
11951 GetInventory().GetCurrentInventoryLocation(dst);
11952 }
11953 }
11954
11955 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11956 {
11957
11958 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11959 return false;
11960
11961 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11962 return false;
11963
11964
11966 return false;
11967
11968
11969 Magazine mag = Magazine.Cast(this);
11970 if (mag)
11971 {
11972 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11973 return false;
11974
11975 if (stack_max_limit)
11976 {
11977 Magazine other_mag = Magazine.Cast(other_item);
11978 if (other_item)
11979 {
11980 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11981 return false;
11982 }
11983
11984 }
11985 }
11986 else
11987 {
11988
11990 return false;
11991
11993 return false;
11994 }
11995
11996 PlayerBase player = null;
11997 if (CastTo(player, GetHierarchyRootPlayer()))
11998 {
11999 if (player.GetInventory().HasAttachment(this))
12000 return false;
12001
12002 if (player.IsItemsToDelete())
12003 return false;
12004 }
12005
12006 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
12007 return false;
12008
12009 int slotID;
12011 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
12012 return false;
12013
12014 return true;
12015 }
12016
12018 {
12020 }
12021
12023 {
12024 return m_IsResultOfSplit;
12025 }
12026
12028 {
12029 m_IsResultOfSplit = value;
12030 }
12031
12033 {
12035 }
12036
12038 {
12039 float other_item_quantity = other_item.GetQuantity();
12040 float this_free_space;
12041
12043
12045
12046 if (other_item_quantity > this_free_space)
12047 {
12048 return this_free_space;
12049 }
12050 else
12051 {
12052 return other_item_quantity;
12053 }
12054 }
12055
12057 {
12059 }
12060
12062 {
12064 return;
12065
12066 if (!IsMagazine() && other_item)
12067 {
12069 if (quantity_used != 0)
12070 {
12071 float hp1 = GetHealth01("","");
12072 float hp2 = other_item.GetHealth01("","");
12073 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12074 hpResult = hpResult / (
GetQuantity() + quantity_used);
12075
12076 hpResult *= GetMaxHealth();
12077 Math.Round(hpResult);
12078 SetHealth("", "Health", hpResult);
12079
12081 other_item.AddQuantity(-quantity_used);
12082 }
12083 }
12085 }
12086
12088 {
12089 #ifdef SERVER
12090 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12091 GetHierarchyParent().IncreaseLifetimeUp();
12092 #endif
12093 };
12094
12096 {
12097 PlayerBase p = PlayerBase.Cast(player);
12098
12099 array<int> recipesIds = p.m_Recipes;
12100 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12101 if (moduleRecipesManager)
12102 {
12103 EntityAI itemInHands = player.GetEntityInHands();
12104 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12105 }
12106
12107 for (int i = 0;i < recipesIds.Count(); i++)
12108 {
12109 int key = recipesIds.Get(i);
12110 string recipeName = moduleRecipesManager.GetRecipeName(key);
12112 }
12113 }
12114
12115
12116 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12117 {
12118 super.GetDebugActions(outputList);
12119
12120
12126
12127
12132
12137
12138
12142
12143
12145 {
12149 }
12150
12153
12154
12158
12160
12161 InventoryLocation loc = new InventoryLocation();
12162 GetInventory().GetCurrentInventoryLocation(loc);
12164 {
12165 if (Gizmo_IsSupported())
12168 }
12169
12171 }
12172
12173
12174
12175
12177 {
12178 super.OnAction(action_id, player, ctx);
12179
12181 {
12182 switch (action_id)
12183 {
12187 return true;
12191 return true;
12192 }
12193 }
12194
12196 {
12197 switch (action_id)
12198 {
12200 Delete();
12201 return true;
12202 }
12203 }
12204
12205 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12206 {
12207 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12208 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12209 PlayerBase p = PlayerBase.Cast(player);
12210 if (
EActions.RECIPES_RANGE_START < 1000)
12211 {
12212 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12213 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12214 }
12215 }
12216 #ifndef SERVER
12217 else if (action_id ==
EActions.WATCH_PLAYER)
12218 {
12219 PluginDeveloper.SetDeveloperItemClientEx(player);
12220 }
12221 #endif
12223 {
12224 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12225 {
12226 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12227 OnDebugButtonPressServer(id + 1);
12228 }
12229
12230 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12231 {
12232 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12234 }
12235
12236 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12237 {
12238 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12240 }
12241
12242 else if (action_id ==
EActions.ADD_QUANTITY)
12243 {
12244 if (IsMagazine())
12245 {
12246 Magazine mag = Magazine.Cast(this);
12247 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12248 }
12249 else
12250 {
12252 }
12253
12254 if (m_EM)
12255 {
12256 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12257 }
12258
12259 }
12260
12261 else if (action_id ==
EActions.REMOVE_QUANTITY)
12262 {
12263 if (IsMagazine())
12264 {
12265 Magazine mag2 = Magazine.Cast(this);
12266 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12267 }
12268 else
12269 {
12271 }
12272 if (m_EM)
12273 {
12274 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12275 }
12276
12277 }
12278
12279 else if (action_id ==
EActions.SET_QUANTITY_0)
12280 {
12282
12283 if (m_EM)
12284 {
12285 m_EM.SetEnergy(0);
12286 }
12287 }
12288
12289 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12290 {
12292
12293 if (m_EM)
12294 {
12295 m_EM.SetEnergy(m_EM.GetEnergyMax());
12296 }
12297 }
12298
12299 else if (action_id ==
EActions.ADD_HEALTH)
12300 {
12301 AddHealth("","",GetMaxHealth("","Health")/5);
12302 }
12303 else if (action_id ==
EActions.REMOVE_HEALTH)
12304 {
12305 AddHealth("","",-GetMaxHealth("","Health")/5);
12306 }
12307 else if (action_id ==
EActions.DESTROY_HEALTH)
12308 {
12309 SetHealth01("","",0);
12310 }
12311 else if (action_id ==
EActions.WATCH_ITEM)
12312 {
12314 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12315 #ifdef DEVELOPER
12316 SetDebugDeveloper_item(this);
12317 #endif
12318 }
12319
12320 else if (action_id ==
EActions.ADD_TEMPERATURE)
12321 {
12322 AddTemperature(20);
12323
12324 }
12325
12326 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12327 {
12328 AddTemperature(-20);
12329
12330 }
12331
12332 else if (action_id ==
EActions.FLIP_FROZEN)
12333 {
12334 SetFrozen(!GetIsFrozen());
12335
12336 }
12337
12338 else if (action_id ==
EActions.ADD_WETNESS)
12339 {
12341
12342 }
12343
12344 else if (action_id ==
EActions.REMOVE_WETNESS)
12345 {
12347
12348 }
12349
12350 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12351 {
12354
12355
12356 }
12357
12358 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12359 {
12362 }
12363
12364 else if (action_id ==
EActions.MAKE_SPECIAL)
12365 {
12366 auto debugParams = DebugSpawnParams.WithPlayer(player);
12367 OnDebugSpawnEx(debugParams);
12368 }
12369
12370 }
12371
12372
12373 return false;
12374 }
12375
12376
12377
12378
12382
12385
12386
12387
12389 {
12390 return false;
12391 }
12392
12393
12395 {
12396 return true;
12397 }
12398
12399
12401 {
12402 return true;
12403 }
12404
12405
12406
12408 {
12409 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12410 return g_Game.ConfigIsExisting(config_path);
12411 }
12412
12415 {
12416 return null;
12417 }
12418
12420 {
12421 return false;
12422 }
12423
12425 {
12426 return false;
12427 }
12428
12432
12433
12435 {
12436 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12437 return module_repairing.CanRepair(this, item_repair_kit);
12438 }
12439
12440
12441 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12442 {
12443 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12444 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12445 }
12446
12447
12449 {
12450
12451
12452
12453
12454
12455
12456
12457
12458 return 1;
12459 }
12460
12461
12462
12464 {
12466 }
12467
12468
12469
12471 {
12473 }
12474
12475
12484 {
12485 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12486
12487 if (player)
12488 {
12489 player.MessageStatus(text);
12490 }
12491 }
12492
12493
12502 {
12503 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12504
12505 if (player)
12506 {
12507 player.MessageAction(text);
12508 }
12509 }
12510
12511
12520 {
12521 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12522
12523 if (player)
12524 {
12525 player.MessageFriendly(text);
12526 }
12527 }
12528
12529
12538 {
12539 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12540
12541 if (player)
12542 {
12543 player.MessageImportant(text);
12544 }
12545 }
12546
12548 {
12549 return true;
12550 }
12551
12552
12553 override bool KindOf(
string tag)
12554 {
12555 bool found = false;
12556 string item_name = this.
GetType();
12558 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12559
12560 int array_size = item_tag_array.Count();
12561 for (int i = 0; i < array_size; i++)
12562 {
12563 if (item_tag_array.Get(i) == tag)
12564 {
12565 found = true;
12566 break;
12567 }
12568 }
12569 return found;
12570 }
12571
12572
12574 {
12575
12576 super.OnRPC(sender, rpc_type,ctx);
12577
12578
12579 switch (rpc_type)
12580 {
12581 #ifndef SERVER
12582 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12583 Param2<bool, string> p = new Param2<bool, string>(false, "");
12584
12586 return;
12587
12588 bool play = p.param1;
12589 string soundSet = p.param2;
12590
12591 if (play)
12592 {
12594 {
12596 {
12598 }
12599 }
12600 else
12601 {
12603 }
12604 }
12605 else
12606 {
12608 }
12609
12610 break;
12611 #endif
12612
12613 }
12614
12616 {
12618 }
12619 }
12620
12621
12622
12623
12625 {
12626 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12627 return plugin.GetID(
name);
12628 }
12629
12631 {
12632 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12633 return plugin.GetName(id);
12634 }
12635
12638 {
12639
12640
12641 int varFlags;
12642 if (!ctx.
Read(varFlags))
12643 return;
12644
12645 if (varFlags & ItemVariableFlags.FLOAT)
12646 {
12648 }
12649 }
12650
12652 {
12653
12654 super.SerializeNumericalVars(floats_out);
12655
12656
12657
12659 {
12661 }
12662
12664 {
12666 }
12667
12669 {
12671 }
12672
12674 {
12679 }
12680
12682 {
12684 }
12685 }
12686
12688 {
12689
12690 super.DeSerializeNumericalVars(floats);
12691
12692
12693 int index = 0;
12694 int mask = Math.Round(floats.Get(index));
12695
12696 index++;
12697
12699 {
12701 {
12703 }
12704 else
12705 {
12706 float quantity = floats.Get(index);
12707 SetQuantity(quantity,
true,
false,
false,
false);
12708 }
12709 index++;
12710 }
12711
12713 {
12714 float wet = floats.Get(index);
12716 index++;
12717 }
12718
12720 {
12721 int liquidtype = Math.Round(floats.Get(index));
12723 index++;
12724 }
12725
12727 {
12729 index++;
12731 index++;
12733 index++;
12735 index++;
12736 }
12737
12739 {
12740 int cleanness = Math.Round(floats.Get(index));
12742 index++;
12743 }
12744 }
12745
12747 {
12748 super.WriteVarsToCTX(ctx);
12749
12750
12752 {
12754 }
12755
12757 {
12759 }
12760
12762 {
12764 }
12765
12767 {
12768 int r,g,b,a;
12774 }
12775
12777 {
12779 }
12780 }
12781
12783 {
12784 if (!super.ReadVarsFromCTX(ctx,version))
12785 return false;
12786
12787 int intValue;
12788 float value;
12789
12790 if (version < 140)
12791 {
12792 if (!ctx.
Read(intValue))
12793 return false;
12794
12795 m_VariablesMask = intValue;
12796 }
12797
12799 {
12800 if (!ctx.
Read(value))
12801 return false;
12802
12804 {
12806 }
12807 else
12808 {
12810 }
12811 }
12812
12813 if (version < 140)
12814 {
12816 {
12817 if (!ctx.
Read(value))
12818 return false;
12819 SetTemperatureDirect(value);
12820 }
12821 }
12822
12824 {
12825 if (!ctx.
Read(value))
12826 return false;
12828 }
12829
12831 {
12832 if (!ctx.
Read(intValue))
12833 return false;
12835 }
12836
12838 {
12839 int r,g,b,a;
12841 return false;
12843 return false;
12845 return false;
12847 return false;
12848
12850 }
12851
12853 {
12854 if (!ctx.
Read(intValue))
12855 return false;
12857 }
12858
12859 if (version >= 138 && version < 140)
12860 {
12862 {
12863 if (!ctx.
Read(intValue))
12864 return false;
12865 SetFrozen(intValue);
12866 }
12867 }
12868
12869 return true;
12870 }
12871
12872
12874 {
12877 {
12879 }
12880
12881 if (!super.OnStoreLoad(ctx, version))
12882 {
12884 return false;
12885 }
12886
12887 if (version >= 114)
12888 {
12889 bool hasQuickBarIndexSaved;
12890
12891 if (!ctx.
Read(hasQuickBarIndexSaved))
12892 {
12894 return false;
12895 }
12896
12897 if (hasQuickBarIndexSaved)
12898 {
12899 int itmQBIndex;
12900
12901
12902 if (!ctx.
Read(itmQBIndex))
12903 {
12905 return false;
12906 }
12907
12908 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12909 if (itmQBIndex != -1 && parentPlayer)
12910 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12911 }
12912 }
12913 else
12914 {
12915
12916 PlayerBase player;
12917 int itemQBIndex;
12918 if (version ==
int.
MAX)
12919 {
12920 if (!ctx.
Read(itemQBIndex))
12921 {
12923 return false;
12924 }
12925 }
12926 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12927 {
12928
12929 if (!ctx.
Read(itemQBIndex))
12930 {
12932 return false;
12933 }
12934 if (itemQBIndex != -1 && player)
12935 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12936 }
12937 }
12938
12939 if (version < 140)
12940 {
12941
12942 if (!LoadVariables(ctx, version))
12943 {
12945 return false;
12946 }
12947 }
12948
12949
12951 {
12953 return false;
12954 }
12955 if (version >= 132)
12956 {
12958 if (raib)
12959 {
12961 {
12963 return false;
12964 }
12965 }
12966 }
12967
12969 return true;
12970 }
12971
12972
12973
12975 {
12976 super.OnStoreSave(ctx);
12977
12978 PlayerBase player;
12979 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12980 {
12982
12983 int itemQBIndex = -1;
12984 itemQBIndex = player.FindQuickBarEntityIndex(this);
12985 ctx.
Write(itemQBIndex);
12986 }
12987 else
12988 {
12990 }
12991
12993
12995 if (raib)
12996 {
12998 }
12999 }
13000
13001
13003 {
13004 super.AfterStoreLoad();
13005
13007 {
13009 }
13010
13012 {
13015 }
13016 }
13017
13019 {
13020 super.EEOnAfterLoad();
13021
13023 {
13025 }
13026
13029 }
13030
13032 {
13033 return false;
13034 }
13035
13036
13037
13039 {
13041 {
13042 #ifdef PLATFORM_CONSOLE
13043
13045 {
13047 if (menu)
13048 {
13050 }
13051 }
13052 #endif
13053 }
13054
13056 {
13059 }
13060
13062 {
13063 SetWeightDirty();
13065 }
13067 {
13070 }
13071
13073 {
13076
13079 }
13081 {
13085 }
13086
13087 super.OnVariablesSynchronized();
13088 }
13089
13090
13091
13093 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13094 {
13095 if (!IsServerCheck(allow_client))
13096 return false;
13097
13099 return false;
13100
13103
13104 if (value <= (min + 0.001))
13105 value = min;
13106
13107 if (value == min)
13108 {
13109 if (destroy_config)
13110 {
13111 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13112 if (dstr)
13113 {
13115 this.Delete();
13116 return true;
13117 }
13118 }
13119 else if (destroy_forced)
13120 {
13122 this.Delete();
13123 return true;
13124 }
13125
13127 }
13128
13131
13133 {
13134 EntityAI parent = GetHierarchyRoot();
13135 InventoryLocation iLoc = new InventoryLocation();
13136 GetInventory().GetCurrentInventoryLocation(iLoc);
13138 {
13139 int iLocSlot = iLoc.
GetSlot();
13141 {
13143 }
13145 {
13147 }
13148 }
13149 }
13150
13152 {
13154
13155 if (delta)
13157 }
13158
13160
13161 return false;
13162 }
13163
13164
13166 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13167 {
13169 }
13170
13172 {
13175 }
13176
13178 {
13181 }
13182
13184 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13185 {
13186 float value_clamped = Math.Clamp(value, 0, 1);
13188 SetQuantity(result, destroy_config, destroy_forced);
13189 }
13190
13191
13194 {
13196 }
13197
13199 {
13201 }
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13213 {
13214 int slot = -1;
13215 GameInventory inventory = GetInventory();
13216 if (inventory)
13217 {
13218 InventoryLocation il = new InventoryLocation;
13221 }
13222
13224 }
13225
13227 {
13228 float quantity_max = 0;
13229
13231 {
13232 if (attSlotID != -1)
13233 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13234
13235 if (quantity_max <= 0)
13237 }
13238
13239 if (quantity_max <= 0)
13241
13242 return quantity_max;
13243 }
13244
13246 {
13248 }
13249
13251 {
13253 }
13254
13255
13257 {
13259 }
13260
13262 {
13264 }
13265
13267 {
13269 }
13270
13271
13273 {
13274
13275 float weightEx = GetWeightEx();
13276 float special = GetInventoryAndCargoWeight();
13277 return weightEx - special;
13278 }
13279
13280
13282 {
13284 }
13285
13287 {
13289 {
13290 #ifdef DEVELOPER
13291 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13292 {
13293 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13295 }
13296 #endif
13297
13298 return GetQuantity() * GetConfigWeightModified();
13299 }
13300 else if (HasEnergyManager())
13301 {
13302 #ifdef DEVELOPER
13303 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13304 {
13305 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13306 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13307 }
13308 #endif
13309 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13310 }
13311 else
13312 {
13313 #ifdef DEVELOPER
13314 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13315 {
13316 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13317 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13318 }
13319 #endif
13320 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13321 }
13322 }
13323
13326 {
13327 int item_count = 0;
13329
13330 GameInventory inventory = GetInventory();
13331 CargoBase cargo = inventory.
GetCargo();
13332 if (cargo != NULL)
13333 {
13335 }
13336
13338 for (int i = 0; i < nAttachments; ++i)
13339 {
13341 if (item)
13342 item_count += item.GetNumberOfItems();
13343 }
13344 return item_count;
13345 }
13346
13349 {
13350 float weight = 0;
13351 float wetness = 1;
13352 if (include_wetness)
13355 {
13356 weight = wetness * m_ConfigWeight;
13357 }
13359 {
13360 weight = 1;
13361 }
13362 return weight;
13363 }
13364
13365
13366
13368 {
13369 GameInventory inventory = GetInventory();
13370 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13371 {
13372 array<EntityAI> items = new array<EntityAI>;
13374 for (int i = 0; i < items.Count(); ++i)
13375 {
13377 if (item)
13378 {
13379 g_Game.ObjectDelete(item);
13380 }
13381 }
13382 }
13383 }
13384
13385
13386
13387
13389 {
13390 float energy = 0;
13391 if (HasEnergyManager())
13392 {
13393 energy = GetCompEM().GetEnergy();
13394 }
13395 return energy;
13396 }
13397
13398
13400 {
13401 super.OnEnergyConsumed();
13402
13404 }
13405
13407 {
13408 super.OnEnergyAdded();
13409
13411 }
13412
13413
13415 {
13416 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13417 {
13419 {
13420 float energy_0to1 = GetCompEM().GetEnergy0To1();
13422 }
13423 }
13424 }
13425
13426
13428 {
13429 return ConfigGetFloat("heatIsolation");
13430 }
13431
13433 {
13435 }
13436
13438 {
13439 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13440 if (
g_Game.ConfigIsExisting(paramPath))
13441 return g_Game.ConfigGetFloat(paramPath);
13442
13443 return 0.0;
13444 }
13445
13447 {
13448 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13449 if (
g_Game.ConfigIsExisting(paramPath))
13450 return g_Game.ConfigGetFloat(paramPath);
13451
13452 return 0.0;
13453 }
13454
13455 override void SetWet(
float value,
bool allow_client =
false)
13456 {
13457 if (!IsServerCheck(allow_client))
13458 return;
13459
13462
13464
13465 m_VarWet = Math.Clamp(value, min, max);
13466
13468 {
13471 }
13472 }
13473
13474 override void AddWet(
float value)
13475 {
13477 }
13478
13480 {
13482 }
13483
13485 {
13487 }
13488
13490 {
13492 }
13493
13495 {
13497 }
13498
13500 {
13502 }
13503
13504 override void OnWetChanged(
float newVal,
float oldVal)
13505 {
13508 if (newLevel != oldLevel)
13509 {
13511 }
13512 }
13513
13515 {
13516 SetWeightDirty();
13517 }
13518
13520 {
13521 return GetWetLevelInternal(
m_VarWet);
13522 }
13523
13524
13525
13527 {
13529 }
13530
13532 {
13534 }
13535
13537 {
13539 }
13540
13542 {
13544 }
13545
13546
13547
13549 {
13550 if (ConfigIsExisting("itemModelLength"))
13551 {
13552 return ConfigGetFloat("itemModelLength");
13553 }
13554 return 0;
13555 }
13556
13558 {
13559 if (ConfigIsExisting("itemAttachOffset"))
13560 {
13561 return ConfigGetFloat("itemAttachOffset");
13562 }
13563 return 0;
13564 }
13565
13566 override void SetCleanness(
int value,
bool allow_client =
false)
13567 {
13568 if (!IsServerCheck(allow_client))
13569 return;
13570
13572
13574
13577 }
13578
13580 {
13582 }
13583
13585 {
13586 return true;
13587 }
13588
13589
13590
13591
13593 {
13595 }
13596
13598 {
13600 }
13601
13602
13603
13604
13605 override void SetColor(
int r,
int g,
int b,
int a)
13606 {
13612 }
13614 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13615 {
13620 }
13621
13623 {
13625 }
13626
13629 {
13630 int r,g,b,a;
13632 r = r/255;
13633 g = g/255;
13634 b = b/255;
13635 a = a/255;
13636 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13637 }
13638
13639
13640
13641 override void SetLiquidType(
int value,
bool allow_client =
false)
13642 {
13643 if (!IsServerCheck(allow_client))
13644 return;
13645
13650 }
13651
13653 {
13654 return ConfigGetInt("varLiquidTypeInit");
13655 }
13656
13658 {
13660 }
13661
13663 {
13665 SetFrozen(false);
13666 }
13667
13670 {
13671 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13672 }
13673
13674
13677 {
13678 PlayerBase nplayer;
13679 if (PlayerBase.CastTo(nplayer, player))
13680 {
13682 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13683 }
13684 }
13685
13686
13689 {
13690 PlayerBase nplayer;
13691 if (PlayerBase.CastTo(nplayer,player))
13692 {
13693 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13694 }
13695
13696 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13697
13698 if (HasEnergyManager())
13699 {
13700 GetCompEM().UpdatePlugState();
13701 }
13702 }
13703
13704
13706 {
13707 super.OnPlacementStarted(player);
13708
13710 }
13711
13712 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13713 {
13715 {
13716 m_AdminLog.OnPlacementComplete(player,
this);
13717 }
13718
13719 super.OnPlacementComplete(player, position, orientation);
13720 }
13721
13722
13723
13724
13725
13727 {
13729 {
13730 return true;
13731 }
13732 else
13733 {
13734 return false;
13735 }
13736 }
13737
13738
13740 {
13742 {
13744 }
13745 }
13746
13747
13749 {
13751 }
13752
13754 {
13756 }
13757
13758 override void InsertAgent(
int agent,
float count = 1)
13759 {
13760 if (count < 1)
13761 return;
13762
13764 }
13765
13768 {
13770 }
13771
13772
13774 {
13776 }
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13820 {
13822 return false;
13823 return true;
13824 }
13825
13827 {
13828
13830 }
13831
13832
13835 {
13836 super.CheckForRoofLimited(timeTresholdMS);
13837
13838 float time =
g_Game.GetTime();
13839 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13840 {
13841 m_PreviousRoofTestTime = time;
13842 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13843 }
13844 }
13845
13846
13848 {
13850 {
13851 return 0;
13852 }
13853
13854 if (GetInventory().GetAttachmentSlotsCount() != 0)
13855 {
13856 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13857 if (filter)
13858 return filter.GetProtectionLevel(type, false, system);
13859 else
13860 return 0;
13861 }
13862
13863 string subclassPath, entryName;
13864
13865 switch (type)
13866 {
13868 entryName = "biological";
13869 break;
13871 entryName = "chemical";
13872 break;
13873 default:
13874 entryName = "biological";
13875 break;
13876 }
13877
13878 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13879
13880 return g_Game.ConfigGetFloat(subclassPath + entryName);
13881 }
13882
13883
13884
13887 {
13888 if (!IsMagazine())
13890
13892 }
13893
13894
13895
13896
13897
13902 {
13903 return true;
13904 }
13905
13907 {
13909 }
13910
13911
13912
13913
13914
13916 {
13917 if (parent)
13918 {
13919 if (parent.IsInherited(DayZInfected))
13920 return true;
13921
13922 if (!parent.IsRuined())
13923 return true;
13924 }
13925
13926 return true;
13927 }
13928
13930 {
13931 if (!super.CanPutAsAttachment(parent))
13932 {
13933 return false;
13934 }
13935
13936 if (!IsRuined() && !parent.IsRuined())
13937 {
13938 return true;
13939 }
13940
13941 return false;
13942 }
13943
13945 {
13946
13947
13948
13949
13950 return super.CanReceiveItemIntoCargo(item);
13951 }
13952
13954 {
13955
13956
13957
13958
13959 GameInventory attachmentInv = attachment.GetInventory();
13961 {
13962 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13963 return false;
13964 }
13965
13966 InventoryLocation loc = new InventoryLocation();
13967 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13968 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13969 return false;
13970
13971 return super.CanReceiveAttachment(attachment, slotId);
13972 }
13973
13975 {
13976 if (!super.CanReleaseAttachment(attachment))
13977 return false;
13978
13979 return GetInventory().AreChildrenAccessible();
13980 }
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14003 {
14004 int id = muzzle_owner.GetMuzzleID();
14005 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
14006
14007 if (WPOF_array)
14008 {
14009 for (int i = 0; i < WPOF_array.Count(); i++)
14010 {
14011 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
14012
14013 if (WPOF)
14014 {
14015 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
14016 }
14017 }
14018 }
14019 }
14020
14021
14023 {
14024 int id = muzzle_owner.GetMuzzleID();
14026
14027 if (WPOBE_array)
14028 {
14029 for (int i = 0; i < WPOBE_array.Count(); i++)
14030 {
14031 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14032
14033 if (WPOBE)
14034 {
14035 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14036 }
14037 }
14038 }
14039 }
14040
14041
14043 {
14044 int id = muzzle_owner.GetMuzzleID();
14045 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14046
14047 if (WPOOH_array)
14048 {
14049 for (int i = 0; i < WPOOH_array.Count(); i++)
14050 {
14051 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14052
14053 if (WPOOH)
14054 {
14055 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14056 }
14057 }
14058 }
14059 }
14060
14061
14063 {
14064 int id = muzzle_owner.GetMuzzleID();
14065 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14066
14067 if (WPOOH_array)
14068 {
14069 for (int i = 0; i < WPOOH_array.Count(); i++)
14070 {
14071 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14072
14073 if (WPOOH)
14074 {
14075 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14076 }
14077 }
14078 }
14079 }
14080
14081
14083 {
14084 int id = muzzle_owner.GetMuzzleID();
14085 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14086
14087 if (WPOOH_array)
14088 {
14089 for (int i = 0; i < WPOOH_array.Count(); i++)
14090 {
14091 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14092
14093 if (WPOOH)
14094 {
14095 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14096 }
14097 }
14098 }
14099 }
14100
14101
14102
14104 {
14106 {
14107 return true;
14108 }
14109
14110 return false;
14111 }
14112
14114 {
14116 {
14117 return true;
14118 }
14119
14120 return false;
14121 }
14122
14124 {
14126 {
14127 return true;
14128 }
14129
14130 return false;
14131 }
14132
14134 {
14135 return false;
14136 }
14137
14140 {
14141 return UATimeSpent.DEFAULT_DEPLOY;
14142 }
14143
14144
14145
14146
14148 {
14150 SetSynchDirty();
14151 }
14152
14154 {
14156 }
14157
14158
14160 {
14161 return false;
14162 }
14163
14166 {
14167 string att_type = "None";
14168
14169 if (ConfigIsExisting("soundAttType"))
14170 {
14171 att_type = ConfigGetString("soundAttType");
14172 }
14173
14175 }
14176
14178 {
14180 }
14181
14182
14183
14184
14185
14191
14193 {
14196
14198 }
14199
14200
14202 {
14204 return;
14205
14207
14210
14213
14214 SoundParameters params = new SoundParameters();
14218 }
14219
14220
14222 {
14224 {
14227
14228 SetSynchDirty();
14229
14232 }
14233 }
14234
14236 {
14238 }
14239
14240
14242 {
14244 return;
14245
14247 SetSynchDirty();
14248
14251 }
14252
14254 {
14257 }
14258
14260 {
14262 }
14263
14264 void OnApply(PlayerBase player);
14265
14267 {
14268 return 1.0;
14269 };
14270
14272 {
14274 }
14275
14277 {
14279 }
14280
14282
14284 {
14285 SetDynamicPhysicsLifeTime(0.01);
14287 }
14288
14290 {
14291 array<string> zone_names = new array<string>;
14292 GetDamageZones(zone_names);
14293 for (int i = 0; i < zone_names.Count(); i++)
14294 {
14295 SetHealthMax(zone_names.Get(i),"Health");
14296 }
14297 SetHealthMax("","Health");
14298 }
14299
14302 {
14303 float global_health = GetHealth01("","Health");
14304 array<string> zones = new array<string>;
14305 GetDamageZones(zones);
14306
14307 for (int i = 0; i < zones.Count(); i++)
14308 {
14309 SetHealth01(zones.Get(i),"Health",global_health);
14310 }
14311 }
14312
14315 {
14316 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14317 }
14318
14320 {
14321 if (!hasRootAsPlayer)
14322 {
14323 if (refParentIB)
14324 {
14325
14326 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14327 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14328
14329 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14330 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14331
14334 }
14335 else
14336 {
14337
14340 }
14341 }
14342 }
14343
14345 {
14347 {
14348 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14349 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14350 {
14351 float heatPermCoef = 1.0;
14353 while (ent)
14354 {
14355 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14356 ent = ent.GetHierarchyParent();
14357 }
14358
14359 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14360 }
14361 }
14362 }
14363
14365 {
14366
14367 EntityAI parent = GetHierarchyParent();
14368 if (!parent)
14369 {
14370 hasParent = false;
14371 hasRootAsPlayer = false;
14372 }
14373 else
14374 {
14375 hasParent = true;
14376 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14377 refParentIB =
ItemBase.Cast(parent);
14378 }
14379 }
14380
14381 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14382 {
14383
14384 }
14385
14387 {
14388
14389 return false;
14390 }
14391
14393 {
14394
14395
14396 return false;
14397 }
14398
14400 {
14401
14402 return false;
14403 }
14404
14407 {
14408 return !GetIsFrozen() &&
IsOpen();
14409 }
14410
14412 {
14413 bool hasParent = false, hasRootAsPlayer = false;
14415
14416 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14417 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14418
14419 if (wwtu || foodDecay)
14420 {
14424
14425 if (processWetness || processTemperature || processDecay)
14426 {
14428
14429 if (processWetness)
14430 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14431
14432 if (processTemperature)
14434
14435 if (processDecay)
14436 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14437 }
14438 }
14439 }
14440
14443 {
14445 }
14446
14448 {
14451
14452 return super.GetTemperatureFreezeThreshold();
14453 }
14454
14456 {
14459
14460 return super.GetTemperatureThawThreshold();
14461 }
14462
14464 {
14467
14468 return super.GetItemOverheatThreshold();
14469 }
14470
14472 {
14474 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14475
14476 return super.GetTemperatureFreezeTime();
14477 }
14478
14480 {
14482 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14483
14484 return super.GetTemperatureThawTime();
14485 }
14486
14491
14493 {
14494 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14495 }
14496
14498 {
14499 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14500 }
14501
14504 {
14506 }
14507
14509 {
14511 }
14512
14514 {
14516 }
14517
14520 {
14521 return null;
14522 }
14523
14526 {
14527 return false;
14528 }
14529
14531 {
14533 {
14536 if (!trg)
14537 {
14539 explosive = this;
14540 }
14541
14542 explosive.PairRemote(trg);
14544
14545 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14546 trg.SetPersistentPairID(persistentID);
14547 explosive.SetPersistentPairID(persistentID);
14548
14549 return true;
14550 }
14551 return false;
14552 }
14553
14556 {
14557 float ret = 1.0;
14560 ret *= GetHealth01();
14561
14562 return ret;
14563 }
14564
14565 #ifdef DEVELOPER
14566 override void SetDebugItem()
14567 {
14568 super.SetDebugItem();
14569 _itemBase = this;
14570 }
14571
14573 {
14574 string text = super.GetDebugText();
14575
14577 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14578
14579 return text;
14580 }
14581 #endif
14582
14584 {
14585 return true;
14586 }
14587
14589
14591
14593 {
14596 }
14597
14598
14606
14622
14623 [
Obsolete(
"Use ItemSoundHandler instead")]
14626 {
14627 if (!
g_Game.IsDedicatedServer())
14628 {
14629 if (ConfigIsExisting("attachSoundSet"))
14630 {
14631 string cfg_path = "";
14632 string soundset = "";
14633 string type_name =
GetType();
14634
14637 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14638 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14639
14640 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14641 {
14642 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14643 {
14644 if (cfg_slot_array[i] == slot_type)
14645 {
14646 soundset = cfg_soundset_array[i];
14647 break;
14648 }
14649 }
14650 }
14651
14652 if (soundset != "")
14653 {
14654 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14656 }
14657 }
14658 }
14659 }
14660
14662}
14663
14665{
14667 if (entity)
14668 {
14669 bool is_item = entity.IsInherited(
ItemBase);
14670 if (is_item && full_quantity)
14671 {
14674 }
14675 }
14676 else
14677 {
14679 return NULL;
14680 }
14681 return entity;
14682}
14683
14685{
14686 if (item)
14687 {
14688 if (health > 0)
14689 item.SetHealth("", "", health);
14690
14691 if (item.CanHaveTemperature())
14692 {
14694 if (item.CanFreeze())
14695 item.SetFrozen(false);
14696 }
14697
14698 if (item.HasEnergyManager())
14699 {
14700 if (quantity >= 0)
14701 {
14702 item.GetCompEM().SetEnergy0To1(quantity);
14703 }
14704 else
14705 {
14707 }
14708 }
14709 else if (item.IsMagazine())
14710 {
14711 Magazine mag = Magazine.Cast(item);
14712 if (quantity >= 0)
14713 {
14714 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14715 }
14716 else
14717 {
14719 }
14720
14721 }
14722 else
14723 {
14724 if (quantity >= 0)
14725 {
14726 item.SetQuantityNormalized(quantity, false);
14727 }
14728 else
14729 {
14731 }
14732
14733 }
14734 }
14735}
14736
14737#ifdef DEVELOPER
14739#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.