9803{
9805 {
9806 return true;
9807 }
9808};
9809
9811{
9812
9813};
9814
9815
9816
9818{
9822
9824
9827
9828
9829
9830
9831
9840
9846
9851
9856
9877 protected bool m_IsResultOfSplit
9878
9880
9885
9886
9887
9889
9893
9894
9895
9897
9900
9901
9902
9908
9909
9917
9920
9921
9923
9924
9926
9927
9932
9933
9938
9940
9941
9943
9944
9946 {
9951
9952 if (!
g_Game.IsDedicatedServer())
9953 {
9955 {
9957
9959 {
9961 }
9962 }
9963
9966 }
9967
9968 m_OldLocation = null;
9969
9971 {
9973 }
9974
9975 if (ConfigIsExisting("headSelectionsToHide"))
9976 {
9979 }
9980
9982 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9983 {
9985 }
9986
9988
9989 m_IsResultOfSplit = false;
9990
9992 }
9993
9995 {
9996 super.InitItemVariables();
9997
10003 m_Count = ConfigGetInt(
"count");
10004
10007
10012
10015
10020
10032
10036
10037
10040 if (ConfigIsExisting("canBeSplit"))
10041 {
10044 }
10045
10047 if (ConfigIsExisting("itemBehaviour"))
10049
10050
10053 RegisterNetSyncVariableInt("m_VarLiquidType");
10054 RegisterNetSyncVariableInt("m_Cleanness",0,1);
10055
10056 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
10057 RegisterNetSyncVariableFloat("m_ImpactSpeed");
10058 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
10059
10060 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
10061 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
10062 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
10063 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
10064
10065 RegisterNetSyncVariableBool("m_IsBeingPlaced");
10066 RegisterNetSyncVariableBool("m_IsTakeable");
10067 RegisterNetSyncVariableBool("m_IsHologram");
10068
10071 {
10074 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
10075 }
10076
10078
10080 if (ConfigIsExisting("temperaturePerQuantityWeight"))
10082
10084 }
10085
10087 {
10089 }
10090
10092 {
10095 {
10100 }
10101 }
10102
10103 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
10104 {
10106 {
10109 }
10110
10112 }
10113
10115 {
10121 }
10122
10124
10126 {
10128
10129 if (!action)
10130 {
10131 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
10132 return;
10133 }
10134
10136 if (!ai)
10137 {
10139 return;
10140 }
10141
10143 if (!action_array)
10144 {
10145 action_array = new array<ActionBase_Basic>;
10147 }
10148 if (LogManager.IsActionLogEnable())
10149 {
10150 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
10151 }
10152
10153 if (action_array.Find(action) != -1)
10154 {
10155 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
10156 }
10157 else
10158 {
10159 action_array.Insert(action);
10160 }
10161 }
10162
10164 {
10165 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10166 ActionBase action = player.GetActionManager().GetAction(actionName);
10169
10170 if (action_array)
10171 {
10172 action_array.RemoveItem(action);
10173 }
10174 }
10175
10176
10177
10179 {
10180 ActionOverrideData overrideData = new ActionOverrideData();
10184
10186 if (!actionMap)
10187 {
10190 }
10191
10192 actionMap.Insert(this.
Type(), overrideData);
10193
10194 }
10195
10197
10199
10200
10202 {
10205
10208
10209 string config_to_search = "CfgVehicles";
10210 string muzzle_owner_config;
10211
10213 {
10214 if (IsInherited(Weapon))
10215 config_to_search = "CfgWeapons";
10216
10217 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10218
10219 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
10220
10221 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
10222
10223 if (config_OnFire_subclass_count > 0)
10224 {
10225 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
10226
10227 for (int i = 0; i < config_OnFire_subclass_count; i++)
10228 {
10229 string particle_class = "";
10230 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
10231 string config_OnFire_entry = config_OnFire_class + particle_class;
10232 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
10233 WPOF_array.Insert(WPOF);
10234 }
10235
10236
10238 }
10239 }
10240
10242 {
10243 config_to_search = "CfgWeapons";
10244 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10245
10246 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10247
10248 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10249
10250 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10251 {
10252 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10253
10254 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10255 {
10256 string particle_class2 = "";
10257 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10258 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10259 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10260 WPOBE_array.Insert(WPOBE);
10261 }
10262
10263
10265 }
10266 }
10267 }
10268
10269
10271 {
10274
10276 {
10277 string config_to_search = "CfgVehicles";
10278
10279 if (IsInherited(Weapon))
10280 config_to_search = "CfgWeapons";
10281
10282 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10283 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10284
10285 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10286 {
10287
10289
10291 {
10293 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10295 return;
10296 }
10297
10300
10301
10302
10303 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10304 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10305
10306 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10307 {
10308 string particle_class = "";
10309 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10310 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10311 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10312
10313 if (entry_type == CT_CLASS)
10314 {
10315 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10316 WPOOH_array.Insert(WPOF);
10317 }
10318 }
10319
10320
10322 }
10323 }
10324 }
10325
10327 {
10329 }
10330
10332 {
10334 {
10336
10339
10342
10343 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10344 }
10345 }
10346
10348 {
10350 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10351
10353 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10354
10356 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10357
10359 {
10361 }
10362 }
10363
10365 {
10367 }
10368
10370 {
10373 else
10375
10377 {
10380 }
10381 else
10382 {
10385
10388 }
10389
10391 }
10392
10394 {
10396 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10397 }
10398
10400 {
10402 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10404 }
10405
10407 {
10409 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10410 }
10411
10413 {
10416
10417 OverheatingParticle OP = new OverheatingParticle();
10422
10424 }
10425
10427 {
10430
10431 return -1;
10432 }
10433
10435 {
10437 {
10440
10441 for (int i = count; i > 0; --i)
10442 {
10443 int id = i - 1;
10446
10449
10450 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10451 {
10452 if (p)
10453 {
10456 }
10457 }
10458 }
10459 }
10460 }
10461
10463 {
10465 {
10467 {
10468 int id = i - 1;
10470
10471 if (OP)
10472 {
10474
10475 if (p)
10476 {
10478 }
10479
10480 delete OP;
10481 }
10482 }
10483
10486 }
10487 }
10488
10491 {
10492 return 0.0;
10493 }
10494
10495
10497 {
10498 return 250;
10499 }
10500
10502 {
10503 return 0;
10504 }
10505
10508 {
10510 return true;
10511
10512 return false;
10513 }
10514
10517 {
10520
10522 {
10524 }
10525 else
10526 {
10527
10529 }
10530
10532 }
10533
10540 {
10541 return -1;
10542 }
10543
10544
10545
10546
10548 {
10550 {
10551 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10552 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10553
10554 if (r_index >= 0)
10555 {
10556 InventoryLocation r_il = new InventoryLocation;
10557 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10558
10559 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10562 {
10563 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10564 }
10566 {
10567 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10568 }
10569
10570 }
10571
10572 player.GetHumanInventory().ClearUserReservedLocation(this);
10573 }
10574
10577 }
10578
10579
10580
10581
10583 {
10584 return ItemBase.m_DebugActionsMask;
10585 }
10586
10588 {
10589 return ItemBase.m_DebugActionsMask & mask;
10590 }
10591
10593 {
10594 ItemBase.m_DebugActionsMask = mask;
10595 }
10596
10598 {
10599 ItemBase.m_DebugActionsMask |= mask;
10600 }
10601
10603 {
10604 ItemBase.m_DebugActionsMask &= ~mask;
10605 }
10606
10608 {
10610 {
10612 }
10613 else
10614 {
10616 }
10617 }
10618
10619
10621 {
10622 if (GetEconomyProfile())
10623 {
10624 float q_max = GetEconomyProfile().GetQuantityMax();
10625 if (q_max > 0)
10626 {
10627 float q_min = GetEconomyProfile().GetQuantityMin();
10628 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10629
10631 {
10632 ComponentEnergyManager comp = GetCompEM();
10634 {
10636 }
10637 }
10639 {
10641
10642 }
10643
10644 }
10645 }
10646 }
10647
10650 {
10651 EntityAI parent = GetHierarchyParent();
10652
10653 if (parent)
10654 {
10655 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10656 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10657 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10658 }
10659 }
10660
10663 {
10664 EntityAI parent = GetHierarchyParent();
10665
10666 if (parent)
10667 {
10668 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10669 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10670 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10671 }
10672 }
10673
10675 {
10676
10677
10678
10679
10681
10683 {
10684 if (ScriptInputUserData.CanStoreInputUserData())
10685 {
10686 ScriptInputUserData ctx = new ScriptInputUserData;
10692 ctx.
Write(use_stack_max);
10695
10697 {
10698 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10699 }
10700 }
10701 }
10702 else if (!
g_Game.IsMultiplayer())
10703 {
10705 }
10706 }
10707
10709 {
10711 }
10712
10714 {
10716 }
10717
10719 {
10721 }
10722
10724 {
10725
10726 return false;
10727 }
10728
10730 {
10731 return false;
10732 }
10733
10737 {
10738 return false;
10739 }
10740
10742 {
10743 return "";
10744 }
10745
10747
10749 {
10750 return false;
10751 }
10752
10754 {
10755 return true;
10756 }
10757
10758
10759
10761 {
10762 return true;
10763 }
10764
10766 {
10767 return true;
10768 }
10769
10771 {
10772 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10774 }
10775
10777 {
10779 }
10780
10782 {
10784 if (!is_being_placed)
10786 SetSynchDirty();
10787 }
10788
10789
10791
10793 {
10795 }
10796
10798 {
10800 }
10801
10803 {
10804 return 1;
10805 }
10806
10808 {
10809 return false;
10810 }
10811
10813 {
10815 SetSynchDirty();
10816 }
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10853 {
10854 super.OnMovedInsideCargo(container);
10855
10856 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10857 }
10858
10859 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10860 {
10861 super.EEItemLocationChanged(oldLoc, newLoc);
10862
10863 PlayerBase newPlayer = null;
10864 PlayerBase oldPlayer = null;
10865
10866 if (newLoc.GetParent())
10867 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10868
10869 if (oldLoc.GetParent())
10870 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10871
10873 {
10874 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10875
10876 if (rIndex >= 0)
10877 {
10878 InventoryLocation rIl = new InventoryLocation;
10879 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10880
10881 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10884 {
10885 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10886 }
10888 {
10890 }
10891
10892 }
10893 }
10894
10896 {
10897 if (newPlayer)
10898 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10899
10900 if (newPlayer == oldPlayer)
10901 {
10902 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10903 {
10905 {
10906 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10907 {
10908 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10909 }
10910 }
10911 else
10912 {
10913 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10914 }
10915 }
10916
10917 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10918 {
10919 int type = oldLoc.GetType();
10921 {
10922 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10923 }
10925 {
10926 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10927 }
10928 }
10929 if (!m_OldLocation)
10930 {
10931 m_OldLocation = new InventoryLocation;
10932 }
10933 m_OldLocation.Copy(oldLoc);
10934 }
10935 else
10936 {
10937 if (m_OldLocation)
10938 {
10939 m_OldLocation.Reset();
10940 }
10941 }
10942
10943 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10944 }
10945 else
10946 {
10947 if (newPlayer)
10948 {
10949 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10950 if (resIndex >= 0)
10951 {
10952 InventoryLocation il = new InventoryLocation;
10953 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10955 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10958 {
10959 il.
GetParent().GetOnReleaseLock().Invoke(it);
10960 }
10962 {
10964 }
10965
10966 }
10967 }
10969 {
10970
10972 }
10973
10974 if (m_OldLocation)
10975 {
10976 m_OldLocation.Reset();
10977 }
10978 }
10979
10981 {
10982 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10983 }
10984
10986 {
10987 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10988 }
10989 }
10990
10991 override void EOnContact(IEntity other, Contact extra)
10992 {
10994 {
10995 int liquidType = -1;
10997 if (impactSpeed > 0.0)
10998 {
11000 #ifndef SERVER
11002 #else
11004 SetSynchDirty();
11005 #endif
11007 }
11008 }
11009
11010 #ifdef SERVER
11011 if (GetCompEM() && GetCompEM().IsPlugged())
11012 {
11013 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
11014 GetCompEM().UnplugThis();
11015 }
11016 #endif
11017 }
11018
11020
11022 {
11024 }
11025
11027 {
11028
11029 }
11030
11032 {
11033 super.OnItemLocationChanged(old_owner, new_owner);
11034
11035 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
11036 PlayerBase playerNew = PlayerBase.Cast(new_owner);
11037
11038 if (!relatedPlayer && playerNew)
11039 relatedPlayer = playerNew;
11040
11041 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
11042 {
11044 if (actionMgr)
11045 {
11046 ActionBase currentAction = actionMgr.GetRunningAction();
11047 if (currentAction)
11049 }
11050 }
11051
11052 Man ownerPlayerOld = null;
11053 Man ownerPlayerNew = null;
11054
11055 if (old_owner)
11056 {
11057 if (old_owner.
IsMan())
11058 {
11059 ownerPlayerOld = Man.Cast(old_owner);
11060 }
11061 else
11062 {
11063 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
11064 }
11065 }
11066 else
11067 {
11069 {
11071
11072 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
11073 {
11074 GetCompEM().UnplugThis();
11075 }
11076 }
11077 }
11078
11079 if (new_owner)
11080 {
11081 if (new_owner.
IsMan())
11082 {
11083 ownerPlayerNew = Man.Cast(new_owner);
11084 }
11085 else
11086 {
11087 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
11088 }
11089 }
11090
11091 if (ownerPlayerOld != ownerPlayerNew)
11092 {
11093 if (ownerPlayerOld)
11094 {
11095 array<EntityAI> subItemsExit = new array<EntityAI>;
11097 for (int i = 0; i < subItemsExit.Count(); i++)
11098 {
11101 }
11102 }
11103
11104 if (ownerPlayerNew)
11105 {
11106 array<EntityAI> subItemsEnter = new array<EntityAI>;
11108 for (int j = 0; j < subItemsEnter.Count(); j++)
11109 {
11112 }
11113 }
11114 }
11115 else if (ownerPlayerNew != null)
11116 {
11117 PlayerBase nplayer;
11118 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
11119 {
11120 array<EntityAI> subItemsUpdate = new array<EntityAI>;
11122 for (int k = 0; k < subItemsUpdate.Count(); k++)
11123 {
11125 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
11126 }
11127 }
11128 }
11129
11130 if (old_owner)
11131 old_owner.OnChildItemRemoved(this);
11132 if (new_owner)
11133 new_owner.OnChildItemReceived(this);
11134 }
11135
11136
11138 {
11139 super.EEDelete(parent);
11140 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
11141 if (player)
11142 {
11144
11145 if (player.IsAlive())
11146 {
11147 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
11148 if (r_index >= 0)
11149 {
11150 InventoryLocation r_il = new InventoryLocation;
11151 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
11152
11153 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
11156 {
11157 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
11158 }
11160 {
11161 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
11162 }
11163
11164 }
11165
11166 player.RemoveQuickBarEntityShortcut(this);
11167 }
11168 }
11169 }
11170
11172 {
11173 super.EEKilled(killer);
11174
11177 {
11178 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
11179 {
11180 if (IsMagazine())
11181 {
11182 if (Magazine.Cast(this).GetAmmoCount() > 0)
11183 {
11185 }
11186 }
11187 else
11188 {
11190 }
11191 }
11192 }
11193 }
11194
11196 {
11197 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
11198
11199 super.OnWasAttached(parent, slot_id);
11200
11203
11206 }
11207
11209 {
11210 super.OnWasDetached(parent, slot_id);
11211
11214
11217 }
11218
11220 {
11221 int idx;
11224
11225 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11226 if (inventory_slots.Count() < 1)
11227 {
11228 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
11229 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
11230 }
11231 else
11232 {
11233 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
11234 }
11235
11236 idx = inventory_slots.Find(slot);
11237 if (idx < 0)
11238 return "";
11239
11240 return attach_types.Get(idx);
11241 }
11242
11244 {
11245 int idx = -1;
11246 string slot;
11247
11250
11251 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11252 if (inventory_slots.Count() < 1)
11253 {
11254 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11255 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11256 }
11257 else
11258 {
11259 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11260 if (detach_types.Count() < 1)
11261 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11262 }
11263
11264 for (int i = 0; i < inventory_slots.Count(); i++)
11265 {
11266 slot = inventory_slots.Get(i);
11267 }
11268
11269 if (slot != "")
11270 {
11271 if (detach_types.Count() == 1)
11272 idx = 0;
11273 else
11274 idx = inventory_slots.Find(slot);
11275 }
11276 if (idx < 0)
11277 return "";
11278
11279 return detach_types.Get(idx);
11280 }
11281
11283 {
11284
11286
11287
11288 float min_time = 1;
11289 float max_time = 3;
11290 float delay = Math.RandomFloat(min_time, max_time);
11291
11292 explode_timer.Run(delay, this, "DoAmmoExplosion");
11293 }
11294
11296 {
11297 Magazine magazine = Magazine.Cast(this);
11298 int pop_sounds_count = 6;
11299 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11300
11301
11302 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11303 string sound_name = pop_sounds[ sound_idx ];
11304 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11305
11306
11307 magazine.ServerAddAmmoCount(-1);
11308
11309
11310 float min_temp_to_explode = 100;
11311
11312 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11313 {
11315 }
11316 }
11317
11318
11319 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11320 {
11321 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11322
11323 const int CHANCE_DAMAGE_CARGO = 4;
11324 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11325 const int CHANCE_DAMAGE_NOTHING = 2;
11326
11328 {
11329 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11330 int chances;
11331 int rnd;
11332
11333 if (GetInventory().GetCargo())
11334 {
11335 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11336 rnd = Math.RandomInt(0,chances);
11337
11338 if (rnd < CHANCE_DAMAGE_CARGO)
11339 {
11341 }
11342 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11343 {
11345 }
11346 }
11347 else
11348 {
11349 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11350 rnd = Math.RandomInt(0,chances);
11351
11352 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11353 {
11355 }
11356 }
11357 }
11358 }
11359
11361 {
11362 CargoBase cargo = GetInventory().GetCargo();
11363 if (cargo)
11364 {
11366 if (item_count > 0)
11367 {
11368 int random_pick = Math.RandomInt(0, item_count);
11370 if (!item.IsExplosive())
11371 {
11372 item.AddHealth("","",damage);
11373 return true;
11374 }
11375 }
11376 }
11377 return false;
11378 }
11379
11381 {
11382 GameInventory inventory = GetInventory();
11384 if (attachment_count > 0)
11385 {
11386 int random_pick = Math.RandomInt(0, attachment_count);
11388 if (!attachment.IsExplosive())
11389 {
11390 attachment.AddHealth("","",damage);
11391 return true;
11392 }
11393 }
11394 return false;
11395 }
11396
11398 {
11400 }
11401
11403 {
11405 return GetInventory().CanRemoveEntity();
11406
11407 return false;
11408 }
11409
11411 {
11412
11414 return false;
11415
11416
11418 return false;
11419
11420
11421
11423 if (delta == 0)
11424 return false;
11425
11426
11427 return true;
11428 }
11429
11431 {
11433 {
11434 if (ScriptInputUserData.CanStoreInputUserData())
11435 {
11436 ScriptInputUserData ctx = new ScriptInputUserData;
11441 ctx.
Write(destination_entity);
11443 ctx.
Write(slot_id);
11445 }
11446 }
11447 else if (!
g_Game.IsMultiplayer())
11448 {
11450 }
11451 }
11452
11454 {
11455 float split_quantity_new;
11459 InventoryLocation loc = new InventoryLocation;
11460
11461 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11462 {
11464 split_quantity_new = stack_max;
11465 else
11467
11469 {
11470 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11471 if (new_item)
11472 {
11473 new_item.SetResultOfSplit(true);
11474 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11476 new_item.
SetQuantity(split_quantity_new,
false,
true);
11477 }
11478 }
11479 }
11480 else if (destination_entity && slot_id == -1)
11481 {
11482 if (quantity > stack_max)
11483 split_quantity_new = stack_max;
11484 else
11485 split_quantity_new = quantity;
11486
11488 {
11489 GameInventory destinationInventory = destination_entity.GetInventory();
11491 {
11494 }
11495
11496 if (new_item)
11497 {
11498 new_item.SetResultOfSplit(true);
11499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11501 new_item.
SetQuantity(split_quantity_new,
false,
true);
11502 }
11503 }
11504 }
11505 else
11506 {
11507 if (stack_max != 0)
11508 {
11510 {
11512 }
11513
11514 if (split_quantity_new == 0)
11515 {
11516 if (!
g_Game.IsMultiplayer())
11517 player.PhysicalPredictiveDropItem(this);
11518 else
11519 player.ServerDropEntity(this);
11520 return;
11521 }
11522
11524 {
11526
11527 if (new_item)
11528 {
11529 new_item.SetResultOfSplit(true);
11530 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11533 new_item.PlaceOnSurface();
11534 }
11535 }
11536 }
11537 }
11538 }
11539
11541 {
11542 float split_quantity_new;
11546 InventoryLocation loc = new InventoryLocation;
11547
11548 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11549 {
11551 split_quantity_new = stack_max;
11552 else
11554
11556 {
11557 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11558 if (new_item)
11559 {
11560 new_item.SetResultOfSplit(true);
11561 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11563 new_item.
SetQuantity(split_quantity_new,
false,
true);
11564 }
11565 }
11566 }
11567 else if (destination_entity && slot_id == -1)
11568 {
11569 if (quantity > stack_max)
11570 split_quantity_new = stack_max;
11571 else
11572 split_quantity_new = quantity;
11573
11575 {
11576 GameInventory destinationInventory = destination_entity.GetInventory();
11578 {
11581 }
11582
11583 if (new_item)
11584 {
11585 new_item.SetResultOfSplit(true);
11586 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11588 new_item.
SetQuantity(split_quantity_new,
false,
true);
11589 }
11590 }
11591 }
11592 else
11593 {
11594 if (stack_max != 0)
11595 {
11597 {
11599 }
11600
11602 {
11604
11605 if (new_item)
11606 {
11607 new_item.SetResultOfSplit(true);
11608 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11611 new_item.PlaceOnSurface();
11612 }
11613 }
11614 }
11615 }
11616 }
11617
11619 {
11621 {
11622 if (ScriptInputUserData.CanStoreInputUserData())
11623 {
11624 ScriptInputUserData ctx = new ScriptInputUserData;
11629 dst.WriteToContext(ctx);
11631 }
11632 }
11633 else if (!
g_Game.IsMultiplayer())
11634 {
11636 }
11637 }
11638
11640 {
11642 {
11643 if (ScriptInputUserData.CanStoreInputUserData())
11644 {
11645 ScriptInputUserData ctx = new ScriptInputUserData;
11650 ctx.
Write(destination_entity);
11656 }
11657 }
11658 else if (!
g_Game.IsMultiplayer())
11659 {
11661 }
11662 }
11663
11665 {
11667 }
11668
11670 {
11672 float split_quantity_new;
11674 if (dst.IsValid())
11675 {
11676 int slot_id = dst.GetSlot();
11678
11679 if (quantity > stack_max)
11680 split_quantity_new = stack_max;
11681 else
11682 split_quantity_new = quantity;
11683
11685 {
11687
11688 if (new_item)
11689 {
11690 new_item.SetResultOfSplit(true);
11691 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11693 new_item.
SetQuantity(split_quantity_new,
false,
true);
11694 }
11695
11696 return new_item;
11697 }
11698 }
11699
11700 return null;
11701 }
11702
11704 {
11706 float split_quantity_new;
11708 if (destination_entity)
11709 {
11711 if (quantity > stackable)
11712 split_quantity_new = stackable;
11713 else
11714 split_quantity_new = quantity;
11715
11717 {
11718 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11719 if (new_item)
11720 {
11721 new_item.SetResultOfSplit(true);
11722 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11724 new_item.
SetQuantity(split_quantity_new,
false,
true);
11725 }
11726 }
11727 }
11728 }
11729
11731 {
11733 {
11734 if (ScriptInputUserData.CanStoreInputUserData())
11735 {
11736 ScriptInputUserData ctx = new ScriptInputUserData;
11741 ItemBase destination_entity =
this;
11742 ctx.
Write(destination_entity);
11746 }
11747 }
11748 else if (!
g_Game.IsMultiplayer())
11749 {
11751 }
11752 }
11753
11755 {
11757 float split_quantity_new;
11759 if (player)
11760 {
11762 if (quantity > stackable)
11763 split_quantity_new = stackable;
11764 else
11765 split_quantity_new = quantity;
11766
11768 {
11769 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11770 new_item =
ItemBase.Cast(in_hands);
11771 if (new_item)
11772 {
11773 new_item.SetResultOfSplit(true);
11774 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11776 new_item.SetQuantity(split_quantity_new, false, true);
11777 }
11778 }
11779 }
11780 }
11781
11783 {
11785 float split_quantity_new = Math.Floor(quantity * 0.5);
11786
11788 return;
11789
11791
11792 if (new_item)
11793 {
11794 if (new_item.GetQuantityMax() < split_quantity_new)
11795 {
11796 split_quantity_new = new_item.GetQuantityMax();
11797 }
11798
11799 new_item.SetResultOfSplit(true);
11800 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11801
11803 {
11806 }
11807 else
11808 {
11810 new_item.
SetQuantity(split_quantity_new,
false,
true);
11811 }
11812 }
11813 }
11814
11816 {
11818 float split_quantity_new = Math.Floor(quantity / 2);
11819
11821 return;
11822
11823 InventoryLocation invloc = new InventoryLocation;
11825
11827 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11828
11829 if (new_item)
11830 {
11831 if (new_item.GetQuantityMax() < split_quantity_new)
11832 {
11833 split_quantity_new = new_item.GetQuantityMax();
11834 }
11836 {
11839 }
11840 else if (split_quantity_new > 1)
11841 {
11843 new_item.
SetQuantity(split_quantity_new,
false,
true);
11844 }
11845 }
11846 }
11847
11850 {
11851 SetWeightDirty();
11853
11854 if (parent)
11855 parent.OnAttachmentQuantityChangedEx(this, delta);
11856
11858 {
11860 {
11862 }
11864 {
11865 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11867 }
11868 }
11869 }
11870
11873 {
11874
11875 }
11876
11879 {
11881 }
11882
11884 {
11885 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11886
11888 {
11889 if (newLevel == GameConstants.STATE_RUINED)
11890 {
11892 EntityAI parent = GetHierarchyParent();
11893 if (parent && parent.IsFireplace())
11894 {
11895 CargoBase cargo = GetInventory().GetCargo();
11896 if (cargo)
11897 {
11899 {
11901 }
11902 }
11903 }
11904 }
11905
11907 {
11908
11910 return;
11911 }
11912
11913 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11914 {
11916 }
11917 }
11918 }
11919
11920
11922 {
11923 super.OnRightClick();
11924
11926 {
11928 {
11929 if (ScriptInputUserData.CanStoreInputUserData())
11930 {
11931 EntityAI root = GetHierarchyRoot();
11932 Man playerOwner = GetHierarchyRootPlayer();
11933 InventoryLocation dst = new InventoryLocation;
11934
11935
11936 if (!playerOwner && root && root == this)
11937 {
11939 }
11940 else
11941 {
11942
11943 GetInventory().GetCurrentInventoryLocation(dst);
11945 {
11946 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11948 {
11950 }
11951 else
11952 {
11954
11955
11956 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11957 {
11959 }
11960 else
11961 {
11962 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11963 }
11964 }
11965 }
11966 }
11967
11968 ScriptInputUserData ctx = new ScriptInputUserData;
11976 }
11977 }
11978 else if (!
g_Game.IsMultiplayer())
11979 {
11981 }
11982 }
11983 }
11984
11986 {
11987 if (root)
11988 {
11989 vector m4[4];
11990 root.GetTransform(m4);
11991 dst.SetGround(this, m4);
11992 }
11993 else
11994 {
11995 GetInventory().GetCurrentInventoryLocation(dst);
11996 }
11997 }
11998
11999 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
12000 {
12001
12002 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
12003 return false;
12004
12005 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
12006 return false;
12007
12008
12010 return false;
12011
12012
12013 Magazine mag = Magazine.Cast(this);
12014 if (mag)
12015 {
12016 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
12017 return false;
12018
12019 if (stack_max_limit)
12020 {
12021 Magazine other_mag = Magazine.Cast(other_item);
12022 if (other_item)
12023 {
12024 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
12025 return false;
12026 }
12027
12028 }
12029 }
12030 else
12031 {
12032
12034 return false;
12035
12037 return false;
12038 }
12039
12040 PlayerBase player = null;
12041 if (CastTo(player, GetHierarchyRootPlayer()))
12042 {
12043 if (player.GetInventory().HasAttachment(this))
12044 return false;
12045
12046 if (player.IsItemsToDelete())
12047 return false;
12048 }
12049
12050 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
12051 return false;
12052
12053 int slotID;
12055 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
12056 return false;
12057
12058 return true;
12059 }
12060
12062 {
12064 }
12065
12067 {
12068 return m_IsResultOfSplit;
12069 }
12070
12072 {
12073 m_IsResultOfSplit = value;
12074 }
12075
12077 {
12079 }
12080
12082 {
12083 float other_item_quantity = other_item.GetQuantity();
12084 float this_free_space;
12085
12087
12089
12090 if (other_item_quantity > this_free_space)
12091 {
12092 return this_free_space;
12093 }
12094 else
12095 {
12096 return other_item_quantity;
12097 }
12098 }
12099
12101 {
12103 }
12104
12106 {
12108 return;
12109
12110 if (!IsMagazine() && other_item)
12111 {
12113 if (quantity_used != 0)
12114 {
12115 float hp1 = GetHealth01("","");
12116 float hp2 = other_item.GetHealth01("","");
12117 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
12118 hpResult = hpResult / (
GetQuantity() + quantity_used);
12119
12120 hpResult *= GetMaxHealth();
12121 Math.Round(hpResult);
12122 SetHealth("", "Health", hpResult);
12123
12125 other_item.AddQuantity(-quantity_used);
12126 }
12127 }
12129 }
12130
12132 {
12133 #ifdef SERVER
12134 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
12135 GetHierarchyParent().IncreaseLifetimeUp();
12136 #endif
12137 };
12138
12140 {
12141 PlayerBase p = PlayerBase.Cast(player);
12142
12143 array<int> recipesIds = p.m_Recipes;
12144 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12145 if (moduleRecipesManager)
12146 {
12147 EntityAI itemInHands = player.GetEntityInHands();
12148 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
12149 }
12150
12151 for (int i = 0;i < recipesIds.Count(); i++)
12152 {
12153 int key = recipesIds.Get(i);
12154 string recipeName = moduleRecipesManager.GetRecipeName(key);
12156 }
12157 }
12158
12159
12160 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
12161 {
12162 super.GetDebugActions(outputList);
12163
12164
12170
12171
12176
12181
12182
12186
12187
12189 {
12193 }
12194
12197
12198
12202
12204
12205 InventoryLocation loc = new InventoryLocation();
12206 GetInventory().GetCurrentInventoryLocation(loc);
12208 {
12209 if (Gizmo_IsSupported())
12212 }
12213
12215 }
12216
12217
12218
12219
12221 {
12222 super.OnAction(action_id, player, ctx);
12223
12225 {
12226 switch (action_id)
12227 {
12231 return true;
12235 return true;
12236 }
12237 }
12238
12240 {
12241 switch (action_id)
12242 {
12244 Delete();
12245 return true;
12246 }
12247 }
12248
12249 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12250 {
12251 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12252 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12253 PlayerBase p = PlayerBase.Cast(player);
12254 if (
EActions.RECIPES_RANGE_START < 1000)
12255 {
12256 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12257 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12258 }
12259 }
12260 #ifndef SERVER
12261 else if (action_id ==
EActions.WATCH_PLAYER)
12262 {
12263 PluginDeveloper.SetDeveloperItemClientEx(player);
12264 }
12265 #endif
12267 {
12268 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12269 {
12270 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12271 OnDebugButtonPressServer(id + 1);
12272 }
12273
12274 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12275 {
12276 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12278 }
12279
12280 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12281 {
12282 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12284 }
12285
12286 else if (action_id ==
EActions.ADD_QUANTITY)
12287 {
12288 if (IsMagazine())
12289 {
12290 Magazine mag = Magazine.Cast(this);
12291 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12292 }
12293 else
12294 {
12296 }
12297
12298 if (m_EM)
12299 {
12300 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12301 }
12302
12303 }
12304
12305 else if (action_id ==
EActions.REMOVE_QUANTITY)
12306 {
12307 if (IsMagazine())
12308 {
12309 Magazine mag2 = Magazine.Cast(this);
12310 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12311 }
12312 else
12313 {
12315 }
12316 if (m_EM)
12317 {
12318 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12319 }
12320
12321 }
12322
12323 else if (action_id ==
EActions.SET_QUANTITY_0)
12324 {
12326
12327 if (m_EM)
12328 {
12329 m_EM.SetEnergy(0);
12330 }
12331 }
12332
12333 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12334 {
12336
12337 if (m_EM)
12338 {
12339 m_EM.SetEnergy(m_EM.GetEnergyMax());
12340 }
12341 }
12342
12343 else if (action_id ==
EActions.ADD_HEALTH)
12344 {
12345 AddHealth("","",GetMaxHealth("","Health")/5);
12346 }
12347 else if (action_id ==
EActions.REMOVE_HEALTH)
12348 {
12349 AddHealth("","",-GetMaxHealth("","Health")/5);
12350 }
12351 else if (action_id ==
EActions.DESTROY_HEALTH)
12352 {
12353 SetHealth01("","",0);
12354 }
12355 else if (action_id ==
EActions.WATCH_ITEM)
12356 {
12358 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12359 #ifdef DEVELOPER
12360 SetDebugDeveloper_item(this);
12361 #endif
12362 }
12363
12364 else if (action_id ==
EActions.ADD_TEMPERATURE)
12365 {
12366 AddTemperature(20);
12367
12368 }
12369
12370 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12371 {
12372 AddTemperature(-20);
12373
12374 }
12375
12376 else if (action_id ==
EActions.FLIP_FROZEN)
12377 {
12378 SetFrozen(!GetIsFrozen());
12379
12380 }
12381
12382 else if (action_id ==
EActions.ADD_WETNESS)
12383 {
12385
12386 }
12387
12388 else if (action_id ==
EActions.REMOVE_WETNESS)
12389 {
12391
12392 }
12393
12394 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12395 {
12398
12399
12400 }
12401
12402 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12403 {
12406 }
12407
12408 else if (action_id ==
EActions.MAKE_SPECIAL)
12409 {
12410 auto debugParams = DebugSpawnParams.WithPlayer(player);
12411 OnDebugSpawnEx(debugParams);
12412 }
12413
12414 }
12415
12416
12417 return false;
12418 }
12419
12420
12421
12422
12426
12429
12430
12431
12433 {
12434 return false;
12435 }
12436
12437
12439 {
12440 return true;
12441 }
12442
12443
12445 {
12446 return true;
12447 }
12448
12449
12450
12452 {
12453 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12454 return g_Game.ConfigIsExisting(config_path);
12455 }
12456
12459 {
12460 return null;
12461 }
12462
12464 {
12465 return false;
12466 }
12467
12469 {
12470 return false;
12471 }
12472
12476
12477
12479 {
12480 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12481 return module_repairing.CanRepair(this, item_repair_kit);
12482 }
12483
12484
12485 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12486 {
12487 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12488 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12489 }
12490
12491
12493 {
12494
12495
12496
12497
12498
12499
12500
12501
12502 return 1;
12503 }
12504
12505
12506
12508 {
12510 }
12511
12512
12513
12515 {
12517 }
12518
12519
12528 {
12529 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12530
12531 if (player)
12532 {
12533 player.MessageStatus(text);
12534 }
12535 }
12536
12537
12546 {
12547 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12548
12549 if (player)
12550 {
12551 player.MessageAction(text);
12552 }
12553 }
12554
12555
12564 {
12565 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12566
12567 if (player)
12568 {
12569 player.MessageFriendly(text);
12570 }
12571 }
12572
12573
12582 {
12583 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12584
12585 if (player)
12586 {
12587 player.MessageImportant(text);
12588 }
12589 }
12590
12592 {
12593 return true;
12594 }
12595
12596
12597 override bool KindOf(
string tag)
12598 {
12599 bool found = false;
12600 string item_name = this.
GetType();
12602 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12603
12604 int array_size = item_tag_array.Count();
12605 for (int i = 0; i < array_size; i++)
12606 {
12607 if (item_tag_array.Get(i) == tag)
12608 {
12609 found = true;
12610 break;
12611 }
12612 }
12613 return found;
12614 }
12615
12616
12618 {
12619
12620 super.OnRPC(sender, rpc_type,ctx);
12621
12622
12623 switch (rpc_type)
12624 {
12625 #ifndef SERVER
12626 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12627 Param2<bool, string> p = new Param2<bool, string>(false, "");
12628
12630 return;
12631
12632 bool play = p.param1;
12633 string soundSet = p.param2;
12634
12635 if (play)
12636 {
12638 {
12640 {
12642 }
12643 }
12644 else
12645 {
12647 }
12648 }
12649 else
12650 {
12652 }
12653
12654 break;
12655 #endif
12656
12657 }
12658
12660 {
12662 }
12663 }
12664
12665
12666
12667
12669 {
12670 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12671 return plugin.GetID(
name);
12672 }
12673
12675 {
12676 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12677 return plugin.GetName(id);
12678 }
12679
12682 {
12683
12684
12685 int varFlags;
12686 if (!ctx.
Read(varFlags))
12687 return;
12688
12689 if (varFlags & ItemVariableFlags.FLOAT)
12690 {
12692 }
12693 }
12694
12696 {
12697
12698 super.SerializeNumericalVars(floats_out);
12699
12700
12701
12703 {
12705 }
12706
12708 {
12710 }
12711
12713 {
12715 }
12716
12718 {
12723 }
12724
12726 {
12728 }
12729 }
12730
12732 {
12733
12734 super.DeSerializeNumericalVars(floats);
12735
12736
12737 int index = 0;
12738 int mask = Math.Round(floats.Get(index));
12739
12740 index++;
12741
12743 {
12745 {
12747 }
12748 else
12749 {
12750 float quantity = floats.Get(index);
12751 SetQuantity(quantity,
true,
false,
false,
false);
12752 }
12753 index++;
12754 }
12755
12757 {
12758 float wet = floats.Get(index);
12760 index++;
12761 }
12762
12764 {
12765 int liquidtype = Math.Round(floats.Get(index));
12767 index++;
12768 }
12769
12771 {
12773 index++;
12775 index++;
12777 index++;
12779 index++;
12780 }
12781
12783 {
12784 int cleanness = Math.Round(floats.Get(index));
12786 index++;
12787 }
12788 }
12789
12791 {
12792 super.WriteVarsToCTX(ctx);
12793
12794
12796 {
12798 }
12799
12801 {
12803 }
12804
12806 {
12808 }
12809
12811 {
12812 int r,g,b,a;
12818 }
12819
12821 {
12823 }
12824 }
12825
12827 {
12828 if (!super.ReadVarsFromCTX(ctx,version))
12829 return false;
12830
12831 int intValue;
12832 float value;
12833
12834 if (version < 140)
12835 {
12836 if (!ctx.
Read(intValue))
12837 return false;
12838
12839 m_VariablesMask = intValue;
12840 }
12841
12843 {
12844 if (!ctx.
Read(value))
12845 return false;
12846
12848 {
12850 }
12851 else
12852 {
12854 }
12855 }
12856
12857 if (version < 140)
12858 {
12860 {
12861 if (!ctx.
Read(value))
12862 return false;
12863 SetTemperatureDirect(value);
12864 }
12865 }
12866
12868 {
12869 if (!ctx.
Read(value))
12870 return false;
12872 }
12873
12875 {
12876 if (!ctx.
Read(intValue))
12877 return false;
12879 }
12880
12882 {
12883 int r,g,b,a;
12885 return false;
12887 return false;
12889 return false;
12891 return false;
12892
12894 }
12895
12897 {
12898 if (!ctx.
Read(intValue))
12899 return false;
12901 }
12902
12903 if (version >= 138 && version < 140)
12904 {
12906 {
12907 if (!ctx.
Read(intValue))
12908 return false;
12909 SetFrozen(intValue);
12910 }
12911 }
12912
12913 return true;
12914 }
12915
12916
12918 {
12921 {
12923 }
12924
12925 if (!super.OnStoreLoad(ctx, version))
12926 {
12928 return false;
12929 }
12930
12931 if (version >= 114)
12932 {
12933 bool hasQuickBarIndexSaved;
12934
12935 if (!ctx.
Read(hasQuickBarIndexSaved))
12936 {
12938 return false;
12939 }
12940
12941 if (hasQuickBarIndexSaved)
12942 {
12943 int itmQBIndex;
12944
12945
12946 if (!ctx.
Read(itmQBIndex))
12947 {
12949 return false;
12950 }
12951
12952 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12953 if (itmQBIndex != -1 && parentPlayer)
12954 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12955 }
12956 }
12957 else
12958 {
12959
12960 PlayerBase player;
12961 int itemQBIndex;
12962 if (version ==
int.
MAX)
12963 {
12964 if (!ctx.
Read(itemQBIndex))
12965 {
12967 return false;
12968 }
12969 }
12970 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12971 {
12972
12973 if (!ctx.
Read(itemQBIndex))
12974 {
12976 return false;
12977 }
12978 if (itemQBIndex != -1 && player)
12979 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12980 }
12981 }
12982
12983 if (version < 140)
12984 {
12985
12986 if (!LoadVariables(ctx, version))
12987 {
12989 return false;
12990 }
12991 }
12992
12993
12995 {
12997 return false;
12998 }
12999 if (version >= 132)
13000 {
13002 if (raib)
13003 {
13005 {
13007 return false;
13008 }
13009 }
13010 }
13011
13013 return true;
13014 }
13015
13016
13017
13019 {
13020 super.OnStoreSave(ctx);
13021
13022 PlayerBase player;
13023 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
13024 {
13026
13027 int itemQBIndex = -1;
13028 itemQBIndex = player.FindQuickBarEntityIndex(this);
13029 ctx.
Write(itemQBIndex);
13030 }
13031 else
13032 {
13034 }
13035
13037
13039 if (raib)
13040 {
13042 }
13043 }
13044
13045
13047 {
13048 super.AfterStoreLoad();
13049
13051 {
13053 }
13054
13056 {
13059 }
13060 }
13061
13063 {
13064 super.EEOnAfterLoad();
13065
13067 {
13069 }
13070
13073 }
13074
13076 {
13077 return false;
13078 }
13079
13080
13081
13083 {
13085 {
13086 #ifdef PLATFORM_CONSOLE
13087
13089 {
13091 if (menu)
13092 {
13094 }
13095 }
13096 #endif
13097 }
13098
13100 {
13103 }
13104
13106 {
13107 SetWeightDirty();
13109 }
13111 {
13114 }
13115
13117 {
13120
13123 }
13125 {
13129 }
13130
13131 super.OnVariablesSynchronized();
13132 }
13133
13134
13135
13137 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
13138 {
13139 if (!IsServerCheck(allow_client))
13140 return false;
13141
13143 return false;
13144
13147
13148 if (value <= (min + 0.001))
13149 value = min;
13150
13151 if (value == min)
13152 {
13153 if (destroy_config)
13154 {
13155 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
13156 if (dstr)
13157 {
13159 this.Delete();
13160 return true;
13161 }
13162 }
13163 else if (destroy_forced)
13164 {
13166 this.Delete();
13167 return true;
13168 }
13169
13171 }
13172
13175
13177 {
13178 EntityAI parent = GetHierarchyRoot();
13179 InventoryLocation iLoc = new InventoryLocation();
13180 GetInventory().GetCurrentInventoryLocation(iLoc);
13182 {
13183 int iLocSlot = iLoc.
GetSlot();
13185 {
13187 }
13189 {
13191 }
13192 }
13193 }
13194
13196 {
13198
13199 if (delta)
13201 }
13202
13204
13205 return false;
13206 }
13207
13208
13210 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13211 {
13213 }
13214
13216 {
13219 }
13220
13222 {
13225 }
13226
13228 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
13229 {
13230 float value_clamped = Math.Clamp(value, 0, 1);
13232 SetQuantity(result, destroy_config, destroy_forced);
13233 }
13234
13235
13238 {
13240 }
13241
13243 {
13245 }
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13257 {
13258 int slot = -1;
13259 GameInventory inventory = GetInventory();
13260 if (inventory)
13261 {
13262 InventoryLocation il = new InventoryLocation;
13265 }
13266
13268 }
13269
13271 {
13272 float quantity_max = 0;
13273
13275 {
13276 if (attSlotID != -1)
13277 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13278
13279 if (quantity_max <= 0)
13281 }
13282
13283 if (quantity_max <= 0)
13285
13286 return quantity_max;
13287 }
13288
13290 {
13292 }
13293
13295 {
13297 }
13298
13299
13301 {
13303 }
13304
13306 {
13308 }
13309
13311 {
13313 }
13314
13315
13317 {
13318
13319 float weightEx = GetWeightEx();
13320 float special = GetInventoryAndCargoWeight();
13321 return weightEx - special;
13322 }
13323
13324
13326 {
13328 }
13329
13331 {
13333 {
13334 #ifdef DEVELOPER
13335 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13336 {
13337 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13339 }
13340 #endif
13341
13342 return GetQuantity() * GetConfigWeightModified();
13343 }
13344 else if (HasEnergyManager())
13345 {
13346 #ifdef DEVELOPER
13347 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13348 {
13349 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13350 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13351 }
13352 #endif
13353 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13354 }
13355 else
13356 {
13357 #ifdef DEVELOPER
13358 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13359 {
13360 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13361 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13362 }
13363 #endif
13364 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13365 }
13366 }
13367
13370 {
13371 int item_count = 0;
13373
13374 GameInventory inventory = GetInventory();
13375 CargoBase cargo = inventory.
GetCargo();
13376 if (cargo != NULL)
13377 {
13379 }
13380
13382 for (int i = 0; i < nAttachments; ++i)
13383 {
13385 if (item)
13386 item_count += item.GetNumberOfItems();
13387 }
13388 return item_count;
13389 }
13390
13393 {
13394 float weight = 0;
13395 float wetness = 1;
13396 if (include_wetness)
13399 {
13400 weight = wetness * m_ConfigWeight;
13401 }
13403 {
13404 weight = 1;
13405 }
13406 return weight;
13407 }
13408
13409
13410
13412 {
13413 GameInventory inventory = GetInventory();
13414 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13415 {
13416 array<EntityAI> items = new array<EntityAI>;
13418 for (int i = 0; i < items.Count(); ++i)
13419 {
13421 if (item)
13422 {
13423 g_Game.ObjectDelete(item);
13424 }
13425 }
13426 }
13427 }
13428
13429
13430
13431
13433 {
13434 float energy = 0;
13435 if (HasEnergyManager())
13436 {
13437 energy = GetCompEM().GetEnergy();
13438 }
13439 return energy;
13440 }
13441
13442
13444 {
13445 super.OnEnergyConsumed();
13446
13448 }
13449
13451 {
13452 super.OnEnergyAdded();
13453
13455 }
13456
13457
13459 {
13460 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13461 {
13463 {
13464 float energy_0to1 = GetCompEM().GetEnergy0To1();
13466 }
13467 }
13468 }
13469
13470
13472 {
13473 return ConfigGetFloat("heatIsolation");
13474 }
13475
13477 {
13479 }
13480
13482 {
13483 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13484 if (
g_Game.ConfigIsExisting(paramPath))
13485 return g_Game.ConfigGetFloat(paramPath);
13486
13487 return 0.0;
13488 }
13489
13491 {
13492 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13493 if (
g_Game.ConfigIsExisting(paramPath))
13494 return g_Game.ConfigGetFloat(paramPath);
13495
13496 return 0.0;
13497 }
13498
13499 override void SetWet(
float value,
bool allow_client =
false)
13500 {
13501 if (!IsServerCheck(allow_client))
13502 return;
13503
13506
13508
13509 m_VarWet = Math.Clamp(value, min, max);
13510
13512 {
13515 }
13516 }
13517
13518 override void AddWet(
float value)
13519 {
13521 }
13522
13524 {
13526 }
13527
13529 {
13531 }
13532
13534 {
13536 }
13537
13539 {
13541 }
13542
13544 {
13546 }
13547
13548 override void OnWetChanged(
float newVal,
float oldVal)
13549 {
13552 if (newLevel != oldLevel)
13553 {
13555 }
13556 }
13557
13559 {
13560 SetWeightDirty();
13561 }
13562
13564 {
13565 return GetWetLevelInternal(
m_VarWet);
13566 }
13567
13568
13569
13571 {
13573 }
13574
13576 {
13578 }
13579
13581 {
13583 }
13584
13586 {
13588 }
13589
13590
13591
13593 {
13594 if (ConfigIsExisting("itemModelLength"))
13595 {
13596 return ConfigGetFloat("itemModelLength");
13597 }
13598 return 0;
13599 }
13600
13602 {
13603 if (ConfigIsExisting("itemAttachOffset"))
13604 {
13605 return ConfigGetFloat("itemAttachOffset");
13606 }
13607 return 0;
13608 }
13609
13610 override void SetCleanness(
int value,
bool allow_client =
false)
13611 {
13612 if (!IsServerCheck(allow_client))
13613 return;
13614
13616
13618
13621 }
13622
13624 {
13626 }
13627
13629 {
13630 return true;
13631 }
13632
13633
13634
13635
13637 {
13639 }
13640
13642 {
13644 }
13645
13646
13647
13648
13649 override void SetColor(
int r,
int g,
int b,
int a)
13650 {
13656 }
13658 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13659 {
13664 }
13665
13667 {
13669 }
13670
13673 {
13674 int r,g,b,a;
13676 r = r/255;
13677 g = g/255;
13678 b = b/255;
13679 a = a/255;
13680 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13681 }
13682
13683
13684
13685 override void SetLiquidType(
int value,
bool allow_client =
false)
13686 {
13687 if (!IsServerCheck(allow_client))
13688 return;
13689
13694 }
13695
13697 {
13698 return ConfigGetInt("varLiquidTypeInit");
13699 }
13700
13702 {
13704 }
13705
13707 {
13709 SetFrozen(false);
13710 }
13711
13714 {
13715 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13716 }
13717
13718
13721 {
13722 PlayerBase nplayer;
13723 if (PlayerBase.CastTo(nplayer, player))
13724 {
13726 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13727 }
13728 }
13729
13730
13733 {
13734 PlayerBase nplayer;
13735 if (PlayerBase.CastTo(nplayer,player))
13736 {
13737 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13738 }
13739
13740 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13741
13742 if (HasEnergyManager())
13743 {
13744 GetCompEM().UpdatePlugState();
13745 }
13746 }
13747
13748
13750 {
13751 super.OnPlacementStarted(player);
13752
13754 }
13755
13756 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13757 {
13759 {
13760 m_AdminLog.OnPlacementComplete(player,
this);
13761 }
13762
13763 super.OnPlacementComplete(player, position, orientation);
13764 }
13765
13766
13767
13768
13769
13771 {
13773 {
13774 return true;
13775 }
13776 else
13777 {
13778 return false;
13779 }
13780 }
13781
13782
13784 {
13786 {
13788 }
13789 }
13790
13791
13793 {
13795 }
13796
13798 {
13800 }
13801
13802 override void InsertAgent(
int agent,
float count = 1)
13803 {
13804 if (count < 1)
13805 return;
13806
13808 }
13809
13812 {
13814 }
13815
13816
13818 {
13820 }
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13864 {
13866 return false;
13867 return true;
13868 }
13869
13871 {
13872
13874 }
13875
13876
13879 {
13880 super.CheckForRoofLimited(timeTresholdMS);
13881
13882 float time =
g_Game.GetTime();
13883 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13884 {
13885 m_PreviousRoofTestTime = time;
13886 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13887 }
13888 }
13889
13890
13892 {
13894 {
13895 return 0;
13896 }
13897
13898 if (GetInventory().GetAttachmentSlotsCount() != 0)
13899 {
13900 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13901 if (filter)
13902 return filter.GetProtectionLevel(type, false, system);
13903 else
13904 return 0;
13905 }
13906
13907 string subclassPath, entryName;
13908
13909 switch (type)
13910 {
13912 entryName = "biological";
13913 break;
13915 entryName = "chemical";
13916 break;
13917 default:
13918 entryName = "biological";
13919 break;
13920 }
13921
13922 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13923
13924 return g_Game.ConfigGetFloat(subclassPath + entryName);
13925 }
13926
13927
13928
13931 {
13932 if (!IsMagazine())
13934
13936 }
13937
13938
13939
13940
13941
13946 {
13947 return true;
13948 }
13949
13951 {
13953 }
13954
13955
13956
13957
13958
13960 {
13961 if (parent)
13962 {
13963 if (parent.IsInherited(DayZInfected))
13964 return true;
13965
13966 if (!parent.IsRuined())
13967 return true;
13968 }
13969
13970 return true;
13971 }
13972
13974 {
13975 if (!super.CanPutAsAttachment(parent))
13976 {
13977 return false;
13978 }
13979
13980 if (!IsRuined() && !parent.IsRuined())
13981 {
13982 return true;
13983 }
13984
13985 return false;
13986 }
13987
13989 {
13990
13991
13992
13993
13994 return super.CanReceiveItemIntoCargo(item);
13995 }
13996
13998 {
13999
14000
14001
14002
14003 GameInventory attachmentInv = attachment.GetInventory();
14005 {
14006 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
14007 return false;
14008 }
14009
14010 InventoryLocation loc = new InventoryLocation();
14011 attachment.GetInventory().GetCurrentInventoryLocation(loc);
14012 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
14013 return false;
14014
14015 return super.CanReceiveAttachment(attachment, slotId);
14016 }
14017
14019 {
14020 if (!super.CanReleaseAttachment(attachment))
14021 return false;
14022
14023 return GetInventory().AreChildrenAccessible();
14024 }
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14047 {
14048 int id = muzzle_owner.GetMuzzleID();
14049 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
14050
14051 if (WPOF_array)
14052 {
14053 for (int i = 0; i < WPOF_array.Count(); i++)
14054 {
14055 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
14056
14057 if (WPOF)
14058 {
14059 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
14060 }
14061 }
14062 }
14063 }
14064
14065
14067 {
14068 int id = muzzle_owner.GetMuzzleID();
14070
14071 if (WPOBE_array)
14072 {
14073 for (int i = 0; i < WPOBE_array.Count(); i++)
14074 {
14075 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
14076
14077 if (WPOBE)
14078 {
14079 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14080 }
14081 }
14082 }
14083 }
14084
14085
14087 {
14088 int id = muzzle_owner.GetMuzzleID();
14089 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14090
14091 if (WPOOH_array)
14092 {
14093 for (int i = 0; i < WPOOH_array.Count(); i++)
14094 {
14095 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14096
14097 if (WPOOH)
14098 {
14099 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
14100 }
14101 }
14102 }
14103 }
14104
14105
14107 {
14108 int id = muzzle_owner.GetMuzzleID();
14109 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14110
14111 if (WPOOH_array)
14112 {
14113 for (int i = 0; i < WPOOH_array.Count(); i++)
14114 {
14115 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14116
14117 if (WPOOH)
14118 {
14119 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14120 }
14121 }
14122 }
14123 }
14124
14125
14127 {
14128 int id = muzzle_owner.GetMuzzleID();
14129 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
14130
14131 if (WPOOH_array)
14132 {
14133 for (int i = 0; i < WPOOH_array.Count(); i++)
14134 {
14135 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
14136
14137 if (WPOOH)
14138 {
14139 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
14140 }
14141 }
14142 }
14143 }
14144
14145
14146
14148 {
14150 {
14151 return true;
14152 }
14153
14154 return false;
14155 }
14156
14158 {
14160 {
14161 return true;
14162 }
14163
14164 return false;
14165 }
14166
14168 {
14170 {
14171 return true;
14172 }
14173
14174 return false;
14175 }
14176
14178 {
14179 return false;
14180 }
14181
14184 {
14185 return UATimeSpent.DEFAULT_DEPLOY;
14186 }
14187
14188
14189
14190
14192 {
14194 SetSynchDirty();
14195 }
14196
14198 {
14200 }
14201
14202
14204 {
14205 return false;
14206 }
14207
14210 {
14211 string att_type = "None";
14212
14213 if (ConfigIsExisting("soundAttType"))
14214 {
14215 att_type = ConfigGetString("soundAttType");
14216 }
14217
14219 }
14220
14222 {
14224 }
14225
14226
14227
14228
14229
14235
14237 {
14240
14242 }
14243
14244
14246 {
14248 return;
14249
14251
14254
14257
14258 SoundParameters params = new SoundParameters();
14262 }
14263
14264
14266 {
14268 {
14271
14272 SetSynchDirty();
14273
14276 }
14277 }
14278
14280 {
14282 }
14283
14284
14286 {
14288 return;
14289
14291 SetSynchDirty();
14292
14295 }
14296
14298 {
14301 }
14302
14304 {
14306 }
14307
14308 void OnApply(PlayerBase player);
14309
14311 {
14312 return 1.0;
14313 };
14314
14316 {
14318 }
14319
14321 {
14323 }
14324
14326
14328 {
14329 SetDynamicPhysicsLifeTime(0.01);
14331 }
14332
14334 {
14335 array<string> zone_names = new array<string>;
14336 GetDamageZones(zone_names);
14337 for (int i = 0; i < zone_names.Count(); i++)
14338 {
14339 SetHealthMax(zone_names.Get(i),"Health");
14340 }
14341 SetHealthMax("","Health");
14342 }
14343
14346 {
14347 float global_health = GetHealth01("","Health");
14348 array<string> zones = new array<string>;
14349 GetDamageZones(zones);
14350
14351 for (int i = 0; i < zones.Count(); i++)
14352 {
14353 SetHealth01(zones.Get(i),"Health",global_health);
14354 }
14355 }
14356
14359 {
14360 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14361 }
14362
14364 {
14365 if (!hasRootAsPlayer)
14366 {
14367 if (refParentIB)
14368 {
14369
14370 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14371 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14372
14373 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14374 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14375
14378 }
14379 else
14380 {
14381
14384 }
14385 }
14386 }
14387
14389 {
14391 {
14392 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14393 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14394 {
14395 float heatPermCoef = 1.0;
14397 while (ent)
14398 {
14399 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14400 ent = ent.GetHierarchyParent();
14401 }
14402
14403 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14404 }
14405 }
14406 }
14407
14409 {
14410
14411 EntityAI parent = GetHierarchyParent();
14412 if (!parent)
14413 {
14414 hasParent = false;
14415 hasRootAsPlayer = false;
14416 }
14417 else
14418 {
14419 hasParent = true;
14420 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14421 refParentIB =
ItemBase.Cast(parent);
14422 }
14423 }
14424
14425 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14426 {
14427
14428 }
14429
14431 {
14432
14433 return false;
14434 }
14435
14437 {
14438
14439
14440 return false;
14441 }
14442
14444 {
14445
14446 return false;
14447 }
14448
14451 {
14452 return !GetIsFrozen() &&
IsOpen();
14453 }
14454
14456 {
14457 bool hasParent = false, hasRootAsPlayer = false;
14459
14460 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14461 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14462
14463 if (wwtu || foodDecay)
14464 {
14468
14469 if (processWetness || processTemperature || processDecay)
14470 {
14472
14473 if (processWetness)
14474 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14475
14476 if (processTemperature)
14478
14479 if (processDecay)
14480 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14481 }
14482 }
14483 }
14484
14487 {
14489 }
14490
14492 {
14495
14496 return super.GetTemperatureFreezeThreshold();
14497 }
14498
14500 {
14503
14504 return super.GetTemperatureThawThreshold();
14505 }
14506
14508 {
14511
14512 return super.GetItemOverheatThreshold();
14513 }
14514
14516 {
14518 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14519
14520 return super.GetTemperatureFreezeTime();
14521 }
14522
14524 {
14526 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14527
14528 return super.GetTemperatureThawTime();
14529 }
14530
14535
14537 {
14538 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14539 }
14540
14542 {
14543 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14544 }
14545
14548 {
14550 }
14551
14553 {
14555 }
14556
14558 {
14560 }
14561
14564 {
14565 return null;
14566 }
14567
14570 {
14571 return false;
14572 }
14573
14575 {
14577 {
14580 if (!trg)
14581 {
14583 explosive = this;
14584 }
14585
14586 explosive.PairRemote(trg);
14588
14589 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14590 trg.SetPersistentPairID(persistentID);
14591 explosive.SetPersistentPairID(persistentID);
14592
14593 return true;
14594 }
14595 return false;
14596 }
14597
14600 {
14601 float ret = 1.0;
14604 ret *= GetHealth01();
14605
14606 return ret;
14607 }
14608
14609 #ifdef DEVELOPER
14610 override void SetDebugItem()
14611 {
14612 super.SetDebugItem();
14613 _itemBase = this;
14614 }
14615
14617 {
14618 string text = super.GetDebugText();
14619
14621 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14622
14623 return text;
14624 }
14625 #endif
14626
14628 {
14629 return true;
14630 }
14631
14633
14635
14637 {
14640 }
14641
14642
14650
14666
14667 [
Obsolete(
"Use ItemSoundHandler instead")]
14670 {
14671 if (!
g_Game.IsDedicatedServer())
14672 {
14673 if (ConfigIsExisting("attachSoundSet"))
14674 {
14675 string cfg_path = "";
14676 string soundset = "";
14677 string type_name =
GetType();
14678
14681 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14682 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14683
14684 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14685 {
14686 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14687 {
14688 if (cfg_slot_array[i] == slot_type)
14689 {
14690 soundset = cfg_soundset_array[i];
14691 break;
14692 }
14693 }
14694 }
14695
14696 if (soundset != "")
14697 {
14698 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14700 }
14701 }
14702 }
14703 }
14704
14706}
14707
14709{
14711 if (entity)
14712 {
14713 bool is_item = entity.IsInherited(
ItemBase);
14714 if (is_item && full_quantity)
14715 {
14718 }
14719 }
14720 else
14721 {
14723 return NULL;
14724 }
14725 return entity;
14726}
14727
14729{
14730 if (item)
14731 {
14732 if (health > 0)
14733 item.SetHealth("", "", health);
14734
14735 if (item.CanHaveTemperature())
14736 {
14738 if (item.CanFreeze())
14739 item.SetFrozen(false);
14740 }
14741
14742 if (item.HasEnergyManager())
14743 {
14744 if (quantity >= 0)
14745 {
14746 item.GetCompEM().SetEnergy0To1(quantity);
14747 }
14748 else
14749 {
14751 }
14752 }
14753 else if (item.IsMagazine())
14754 {
14755 Magazine mag = Magazine.Cast(item);
14756 if (quantity >= 0)
14757 {
14758 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14759 }
14760 else
14761 {
14763 }
14764
14765 }
14766 else
14767 {
14768 if (quantity >= 0)
14769 {
14770 item.SetQuantityNormalized(quantity, false);
14771 }
14772 else
14773 {
14775 }
14776
14777 }
14778 }
14779}
14780
14781#ifdef DEVELOPER
14783#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.