9553{
9555 {
9556 return true;
9557 }
9558};
9559
9561{
9562
9563};
9564
9565
9566
9568{
9572
9574
9577
9578
9579
9580
9581
9590
9596
9601
9606
9627 protected bool m_IsResultOfSplit
9628
9630
9635
9636
9637
9639
9643
9644
9645
9647
9650
9651
9652
9658
9659
9667
9670
9671
9673
9674
9676
9677
9682
9683
9688
9690
9691
9693
9694
9696 {
9701
9702 if (!
g_Game.IsDedicatedServer())
9703 {
9705 {
9707
9709 {
9711 }
9712 }
9713
9716 }
9717
9718 m_OldLocation = null;
9719
9721 {
9723 }
9724
9725 if (ConfigIsExisting("headSelectionsToHide"))
9726 {
9729 }
9730
9732 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9733 {
9735 }
9736
9738
9739 m_IsResultOfSplit = false;
9740
9742 }
9743
9745 {
9746 super.InitItemVariables();
9747
9753 m_Count = ConfigGetInt(
"count");
9754
9757
9762
9765
9770
9782
9786
9787
9790 if (ConfigIsExisting("canBeSplit"))
9791 {
9794 }
9795
9797 if (ConfigIsExisting("itemBehaviour"))
9799
9800
9803 RegisterNetSyncVariableInt("m_VarLiquidType");
9804 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9805
9806 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9807 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9808 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9809
9810 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9811 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9812 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9813 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9814
9815 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9816 RegisterNetSyncVariableBool("m_IsTakeable");
9817 RegisterNetSyncVariableBool("m_IsHologram");
9818
9821 {
9824 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9825 }
9826
9828
9830 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9832
9834 }
9835
9837 {
9839 }
9840
9842 {
9845 {
9850 }
9851 }
9852
9853 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9854 {
9856 {
9859 }
9860
9862 }
9863
9865 {
9871 }
9872
9874
9876 {
9878
9879 if (!action)
9880 {
9881 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9882 return;
9883 }
9884
9886 if (!ai)
9887 {
9889 return;
9890 }
9891
9893 if (!action_array)
9894 {
9895 action_array = new array<ActionBase_Basic>;
9897 }
9898 if (LogManager.IsActionLogEnable())
9899 {
9900 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9901 }
9902
9903 if (action_array.Find(action) != -1)
9904 {
9905 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9906 }
9907 else
9908 {
9909 action_array.Insert(action);
9910 }
9911 }
9912
9914 {
9915 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9916 ActionBase action = player.GetActionManager().GetAction(actionName);
9919
9920 if (action_array)
9921 {
9922 action_array.RemoveItem(action);
9923 }
9924 }
9925
9926
9927
9929 {
9930 ActionOverrideData overrideData = new ActionOverrideData();
9934
9936 if (!actionMap)
9937 {
9940 }
9941
9942 actionMap.Insert(this.
Type(), overrideData);
9943
9944 }
9945
9947
9949
9950
9952 {
9955
9958
9959 string config_to_search = "CfgVehicles";
9960 string muzzle_owner_config;
9961
9963 {
9964 if (IsInherited(Weapon))
9965 config_to_search = "CfgWeapons";
9966
9967 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9968
9969 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9970
9971 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9972
9973 if (config_OnFire_subclass_count > 0)
9974 {
9975 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9976
9977 for (int i = 0; i < config_OnFire_subclass_count; i++)
9978 {
9979 string particle_class = "";
9980 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9981 string config_OnFire_entry = config_OnFire_class + particle_class;
9982 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9983 WPOF_array.Insert(WPOF);
9984 }
9985
9986
9988 }
9989 }
9990
9992 {
9993 config_to_search = "CfgWeapons";
9994 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9995
9996 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9997
9998 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9999
10000 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10001 {
10002 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10003
10004 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10005 {
10006 string particle_class2 = "";
10007 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10008 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10009 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10010 WPOBE_array.Insert(WPOBE);
10011 }
10012
10013
10015 }
10016 }
10017 }
10018
10019
10021 {
10024
10026 {
10027 string config_to_search = "CfgVehicles";
10028
10029 if (IsInherited(Weapon))
10030 config_to_search = "CfgWeapons";
10031
10032 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
10033 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10034
10035 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
10036 {
10037
10039
10041 {
10043 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10045 return;
10046 }
10047
10050
10051
10052
10053 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
10054 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10055
10056 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10057 {
10058 string particle_class = "";
10059 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10060 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10061 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
10062
10063 if (entry_type == CT_CLASS)
10064 {
10065 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10066 WPOOH_array.Insert(WPOF);
10067 }
10068 }
10069
10070
10072 }
10073 }
10074 }
10075
10077 {
10079 }
10080
10082 {
10084 {
10086
10089
10092
10093 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10094 }
10095 }
10096
10098 {
10100 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10101
10103 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10104
10106 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10107
10109 {
10111 }
10112 }
10113
10115 {
10117 }
10118
10120 {
10123 else
10125
10127 {
10130 }
10131 else
10132 {
10135
10138 }
10139
10141 }
10142
10144 {
10146 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10147 }
10148
10150 {
10152 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10154 }
10155
10157 {
10159 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10160 }
10161
10163 {
10166
10167 OverheatingParticle OP = new OverheatingParticle();
10172
10174 }
10175
10177 {
10180
10181 return -1;
10182 }
10183
10185 {
10187 {
10190
10191 for (int i = count; i > 0; --i)
10192 {
10193 int id = i - 1;
10196
10199
10200 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10201 {
10202 if (p)
10203 {
10206 }
10207 }
10208 }
10209 }
10210 }
10211
10213 {
10215 {
10217 {
10218 int id = i - 1;
10220
10221 if (OP)
10222 {
10224
10225 if (p)
10226 {
10228 }
10229
10230 delete OP;
10231 }
10232 }
10233
10236 }
10237 }
10238
10241 {
10242 return 0.0;
10243 }
10244
10245
10247 {
10248 return 250;
10249 }
10250
10252 {
10253 return 0;
10254 }
10255
10258 {
10260 return true;
10261
10262 return false;
10263 }
10264
10267 {
10270
10272 {
10274 }
10275 else
10276 {
10277
10279 }
10280
10282 }
10283
10290 {
10291 return -1;
10292 }
10293
10294
10295
10296
10298 {
10300 {
10301 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10302 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10303
10304 if (r_index >= 0)
10305 {
10306 InventoryLocation r_il = new InventoryLocation;
10307 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10308
10309 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10312 {
10313 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10314 }
10316 {
10317 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10318 }
10319
10320 }
10321
10322 player.GetHumanInventory().ClearUserReservedLocation(this);
10323 }
10324
10327 }
10328
10329
10330
10331
10333 {
10334 return ItemBase.m_DebugActionsMask;
10335 }
10336
10338 {
10339 return ItemBase.m_DebugActionsMask & mask;
10340 }
10341
10343 {
10344 ItemBase.m_DebugActionsMask = mask;
10345 }
10346
10348 {
10349 ItemBase.m_DebugActionsMask |= mask;
10350 }
10351
10353 {
10354 ItemBase.m_DebugActionsMask &= ~mask;
10355 }
10356
10358 {
10360 {
10362 }
10363 else
10364 {
10366 }
10367 }
10368
10369
10371 {
10372 if (GetEconomyProfile())
10373 {
10374 float q_max = GetEconomyProfile().GetQuantityMax();
10375 if (q_max > 0)
10376 {
10377 float q_min = GetEconomyProfile().GetQuantityMin();
10378 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10379
10381 {
10382 ComponentEnergyManager comp = GetCompEM();
10384 {
10386 }
10387 }
10389 {
10391
10392 }
10393
10394 }
10395 }
10396 }
10397
10400 {
10401 EntityAI parent = GetHierarchyParent();
10402
10403 if (parent)
10404 {
10405 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10406 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10407 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10408 }
10409 }
10410
10413 {
10414 EntityAI parent = GetHierarchyParent();
10415
10416 if (parent)
10417 {
10418 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10419 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10420 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10421 }
10422 }
10423
10425 {
10426
10427
10428
10429
10431
10433 {
10434 if (ScriptInputUserData.CanStoreInputUserData())
10435 {
10436 ScriptInputUserData ctx = new ScriptInputUserData;
10442 ctx.
Write(use_stack_max);
10445
10447 {
10448 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10449 }
10450 }
10451 }
10452 else if (!
g_Game.IsMultiplayer())
10453 {
10455 }
10456 }
10457
10459 {
10461 }
10462
10464 {
10466 }
10467
10469 {
10471 }
10472
10474 {
10475
10476 return false;
10477 }
10478
10480 {
10481 return false;
10482 }
10483
10487 {
10488 return false;
10489 }
10490
10492 {
10493 return "";
10494 }
10495
10497
10499 {
10500 return false;
10501 }
10502
10504 {
10505 return true;
10506 }
10507
10508
10509
10511 {
10512 return true;
10513 }
10514
10516 {
10517 return true;
10518 }
10519
10521 {
10522 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10524 }
10525
10527 {
10529 }
10530
10532 {
10534 if (!is_being_placed)
10536 SetSynchDirty();
10537 }
10538
10539
10541
10543 {
10545 }
10546
10548 {
10550 }
10551
10553 {
10554 return 1;
10555 }
10556
10558 {
10559 return false;
10560 }
10561
10563 {
10565 SetSynchDirty();
10566 }
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10603 {
10604 super.OnMovedInsideCargo(container);
10605
10606 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10607 }
10608
10609 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10610 {
10611 super.EEItemLocationChanged(oldLoc, newLoc);
10612
10613 PlayerBase newPlayer = null;
10614 PlayerBase oldPlayer = null;
10615
10616 if (newLoc.GetParent())
10617 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10618
10619 if (oldLoc.GetParent())
10620 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10621
10623 {
10624 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10625
10626 if (rIndex >= 0)
10627 {
10628 InventoryLocation rIl = new InventoryLocation;
10629 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10630
10631 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10634 {
10635 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10636 }
10638 {
10640 }
10641
10642 }
10643 }
10644
10646 {
10647 if (newPlayer)
10648 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10649
10650 if (newPlayer == oldPlayer)
10651 {
10652 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10653 {
10655 {
10656 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10657 {
10658 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10659 }
10660 }
10661 else
10662 {
10663 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10664 }
10665 }
10666
10667 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10668 {
10669 int type = oldLoc.GetType();
10671 {
10672 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10673 }
10675 {
10676 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10677 }
10678 }
10679 if (!m_OldLocation)
10680 {
10681 m_OldLocation = new InventoryLocation;
10682 }
10683 m_OldLocation.Copy(oldLoc);
10684 }
10685 else
10686 {
10687 if (m_OldLocation)
10688 {
10689 m_OldLocation.Reset();
10690 }
10691 }
10692
10693 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10694 }
10695 else
10696 {
10697 if (newPlayer)
10698 {
10699 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10700 if (resIndex >= 0)
10701 {
10702 InventoryLocation il = new InventoryLocation;
10703 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10705 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10708 {
10709 il.
GetParent().GetOnReleaseLock().Invoke(it);
10710 }
10712 {
10714 }
10715
10716 }
10717 }
10719 {
10720
10722 }
10723
10724 if (m_OldLocation)
10725 {
10726 m_OldLocation.Reset();
10727 }
10728 }
10729
10731 {
10732 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10733 }
10734
10736 {
10737 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10738 }
10739 }
10740
10741 override void EOnContact(IEntity other, Contact extra)
10742 {
10744 {
10745 int liquidType = -1;
10747 if (impactSpeed > 0.0)
10748 {
10750 #ifndef SERVER
10752 #else
10754 SetSynchDirty();
10755 #endif
10757 }
10758 }
10759
10760 #ifdef SERVER
10761 if (GetCompEM() && GetCompEM().IsPlugged())
10762 {
10763 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10764 GetCompEM().UnplugThis();
10765 }
10766 #endif
10767 }
10768
10770
10772 {
10774 }
10775
10777 {
10778
10779 }
10780
10782 {
10783 super.OnItemLocationChanged(old_owner, new_owner);
10784
10785 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10786 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10787
10788 if (!relatedPlayer && playerNew)
10789 relatedPlayer = playerNew;
10790
10791 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10792 {
10794 if (actionMgr)
10795 {
10796 ActionBase currentAction = actionMgr.GetRunningAction();
10797 if (currentAction)
10799 }
10800 }
10801
10802 Man ownerPlayerOld = null;
10803 Man ownerPlayerNew = null;
10804
10805 if (old_owner)
10806 {
10807 if (old_owner.
IsMan())
10808 {
10809 ownerPlayerOld = Man.Cast(old_owner);
10810 }
10811 else
10812 {
10813 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10814 }
10815 }
10816 else
10817 {
10819 {
10821
10822 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10823 {
10824 GetCompEM().UnplugThis();
10825 }
10826 }
10827 }
10828
10829 if (new_owner)
10830 {
10831 if (new_owner.
IsMan())
10832 {
10833 ownerPlayerNew = Man.Cast(new_owner);
10834 }
10835 else
10836 {
10837 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10838 }
10839 }
10840
10841 if (ownerPlayerOld != ownerPlayerNew)
10842 {
10843 if (ownerPlayerOld)
10844 {
10845 array<EntityAI> subItemsExit = new array<EntityAI>;
10847 for (int i = 0; i < subItemsExit.Count(); i++)
10848 {
10851 }
10852 }
10853
10854 if (ownerPlayerNew)
10855 {
10856 array<EntityAI> subItemsEnter = new array<EntityAI>;
10858 for (int j = 0; j < subItemsEnter.Count(); j++)
10859 {
10862 }
10863 }
10864 }
10865 else if (ownerPlayerNew != null)
10866 {
10867 PlayerBase nplayer;
10868 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10869 {
10870 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10872 for (int k = 0; k < subItemsUpdate.Count(); k++)
10873 {
10875 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10876 }
10877 }
10878 }
10879
10880 if (old_owner)
10881 old_owner.OnChildItemRemoved(this);
10882 if (new_owner)
10883 new_owner.OnChildItemReceived(this);
10884 }
10885
10886
10888 {
10889 super.EEDelete(parent);
10890 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10891 if (player)
10892 {
10894
10895 if (player.IsAlive())
10896 {
10897 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10898 if (r_index >= 0)
10899 {
10900 InventoryLocation r_il = new InventoryLocation;
10901 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10902
10903 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10906 {
10907 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10908 }
10910 {
10911 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10912 }
10913
10914 }
10915
10916 player.RemoveQuickBarEntityShortcut(this);
10917 }
10918 }
10919 }
10920
10922 {
10923 super.EEKilled(killer);
10924
10927 {
10928 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10929 {
10930 if (IsMagazine())
10931 {
10932 if (Magazine.Cast(this).GetAmmoCount() > 0)
10933 {
10935 }
10936 }
10937 else
10938 {
10940 }
10941 }
10942 }
10943 }
10944
10946 {
10947 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10948
10949 super.OnWasAttached(parent, slot_id);
10950
10953
10956 }
10957
10959 {
10960 super.OnWasDetached(parent, slot_id);
10961
10964
10967 }
10968
10970 {
10971 int idx;
10974
10975 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10976 if (inventory_slots.Count() < 1)
10977 {
10978 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10979 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10980 }
10981 else
10982 {
10983 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10984 }
10985
10986 idx = inventory_slots.Find(slot);
10987 if (idx < 0)
10988 return "";
10989
10990 return attach_types.Get(idx);
10991 }
10992
10994 {
10995 int idx = -1;
10996 string slot;
10997
11000
11001 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
11002 if (inventory_slots.Count() < 1)
11003 {
11004 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
11005 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11006 }
11007 else
11008 {
11009 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11010 if (detach_types.Count() < 1)
11011 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11012 }
11013
11014 for (int i = 0; i < inventory_slots.Count(); i++)
11015 {
11016 slot = inventory_slots.Get(i);
11017 }
11018
11019 if (slot != "")
11020 {
11021 if (detach_types.Count() == 1)
11022 idx = 0;
11023 else
11024 idx = inventory_slots.Find(slot);
11025 }
11026 if (idx < 0)
11027 return "";
11028
11029 return detach_types.Get(idx);
11030 }
11031
11033 {
11034
11036
11037
11038 float min_time = 1;
11039 float max_time = 3;
11040 float delay = Math.RandomFloat(min_time, max_time);
11041
11042 explode_timer.Run(delay, this, "DoAmmoExplosion");
11043 }
11044
11046 {
11047 Magazine magazine = Magazine.Cast(this);
11048 int pop_sounds_count = 6;
11049 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11050
11051
11052 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11053 string sound_name = pop_sounds[ sound_idx ];
11054 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
11055
11056
11057 magazine.ServerAddAmmoCount(-1);
11058
11059
11060 float min_temp_to_explode = 100;
11061
11062 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
11063 {
11065 }
11066 }
11067
11068
11069 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
11070 {
11071 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
11072
11073 const int CHANCE_DAMAGE_CARGO = 4;
11074 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11075 const int CHANCE_DAMAGE_NOTHING = 2;
11076
11078 {
11079 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
11080 int chances;
11081 int rnd;
11082
11083 if (GetInventory().GetCargo())
11084 {
11085 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11086 rnd = Math.RandomInt(0,chances);
11087
11088 if (rnd < CHANCE_DAMAGE_CARGO)
11089 {
11091 }
11092 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11093 {
11095 }
11096 }
11097 else
11098 {
11099 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11100 rnd = Math.RandomInt(0,chances);
11101
11102 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11103 {
11105 }
11106 }
11107 }
11108 }
11109
11111 {
11112 CargoBase cargo = GetInventory().GetCargo();
11113 if (cargo)
11114 {
11116 if (item_count > 0)
11117 {
11118 int random_pick = Math.RandomInt(0, item_count);
11120 if (!item.IsExplosive())
11121 {
11122 item.AddHealth("","",damage);
11123 return true;
11124 }
11125 }
11126 }
11127 return false;
11128 }
11129
11131 {
11132 GameInventory inventory = GetInventory();
11134 if (attachment_count > 0)
11135 {
11136 int random_pick = Math.RandomInt(0, attachment_count);
11138 if (!attachment.IsExplosive())
11139 {
11140 attachment.AddHealth("","",damage);
11141 return true;
11142 }
11143 }
11144 return false;
11145 }
11146
11148 {
11150 }
11151
11153 {
11155 return GetInventory().CanRemoveEntity();
11156
11157 return false;
11158 }
11159
11161 {
11162
11164 return false;
11165
11166
11168 return false;
11169
11170
11171
11173 if (delta == 0)
11174 return false;
11175
11176
11177 return true;
11178 }
11179
11181 {
11183 {
11184 if (ScriptInputUserData.CanStoreInputUserData())
11185 {
11186 ScriptInputUserData ctx = new ScriptInputUserData;
11191 ctx.
Write(destination_entity);
11193 ctx.
Write(slot_id);
11195 }
11196 }
11197 else if (!
g_Game.IsMultiplayer())
11198 {
11200 }
11201 }
11202
11204 {
11205 float split_quantity_new;
11209 InventoryLocation loc = new InventoryLocation;
11210
11211 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11212 {
11214 split_quantity_new = stack_max;
11215 else
11217
11219 {
11220 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11221 if (new_item)
11222 {
11223 new_item.SetResultOfSplit(true);
11224 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11226 new_item.
SetQuantity(split_quantity_new,
false,
true);
11227 }
11228 }
11229 }
11230 else if (destination_entity && slot_id == -1)
11231 {
11232 if (quantity > stack_max)
11233 split_quantity_new = stack_max;
11234 else
11235 split_quantity_new = quantity;
11236
11238 {
11239 GameInventory destinationInventory = destination_entity.GetInventory();
11241 {
11244 }
11245
11246 if (new_item)
11247 {
11248 new_item.SetResultOfSplit(true);
11249 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11251 new_item.
SetQuantity(split_quantity_new,
false,
true);
11252 }
11253 }
11254 }
11255 else
11256 {
11257 if (stack_max != 0)
11258 {
11260 {
11262 }
11263
11264 if (split_quantity_new == 0)
11265 {
11266 if (!
g_Game.IsMultiplayer())
11267 player.PhysicalPredictiveDropItem(this);
11268 else
11269 player.ServerDropEntity(this);
11270 return;
11271 }
11272
11274 {
11276
11277 if (new_item)
11278 {
11279 new_item.SetResultOfSplit(true);
11280 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11283 new_item.PlaceOnSurface();
11284 }
11285 }
11286 }
11287 }
11288 }
11289
11291 {
11292 float split_quantity_new;
11296 InventoryLocation loc = new InventoryLocation;
11297
11298 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11299 {
11301 split_quantity_new = stack_max;
11302 else
11304
11306 {
11307 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11308 if (new_item)
11309 {
11310 new_item.SetResultOfSplit(true);
11311 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11313 new_item.
SetQuantity(split_quantity_new,
false,
true);
11314 }
11315 }
11316 }
11317 else if (destination_entity && slot_id == -1)
11318 {
11319 if (quantity > stack_max)
11320 split_quantity_new = stack_max;
11321 else
11322 split_quantity_new = quantity;
11323
11325 {
11326 GameInventory destinationInventory = destination_entity.GetInventory();
11328 {
11331 }
11332
11333 if (new_item)
11334 {
11335 new_item.SetResultOfSplit(true);
11336 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11338 new_item.
SetQuantity(split_quantity_new,
false,
true);
11339 }
11340 }
11341 }
11342 else
11343 {
11344 if (stack_max != 0)
11345 {
11347 {
11349 }
11350
11352 {
11354
11355 if (new_item)
11356 {
11357 new_item.SetResultOfSplit(true);
11358 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11361 new_item.PlaceOnSurface();
11362 }
11363 }
11364 }
11365 }
11366 }
11367
11369 {
11371 {
11372 if (ScriptInputUserData.CanStoreInputUserData())
11373 {
11374 ScriptInputUserData ctx = new ScriptInputUserData;
11379 dst.WriteToContext(ctx);
11381 }
11382 }
11383 else if (!
g_Game.IsMultiplayer())
11384 {
11386 }
11387 }
11388
11390 {
11392 {
11393 if (ScriptInputUserData.CanStoreInputUserData())
11394 {
11395 ScriptInputUserData ctx = new ScriptInputUserData;
11400 ctx.
Write(destination_entity);
11406 }
11407 }
11408 else if (!
g_Game.IsMultiplayer())
11409 {
11411 }
11412 }
11413
11415 {
11417 }
11418
11420 {
11422 float split_quantity_new;
11424 if (dst.IsValid())
11425 {
11426 int slot_id = dst.GetSlot();
11428
11429 if (quantity > stack_max)
11430 split_quantity_new = stack_max;
11431 else
11432 split_quantity_new = quantity;
11433
11435 {
11437
11438 if (new_item)
11439 {
11440 new_item.SetResultOfSplit(true);
11441 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11443 new_item.
SetQuantity(split_quantity_new,
false,
true);
11444 }
11445
11446 return new_item;
11447 }
11448 }
11449
11450 return null;
11451 }
11452
11454 {
11456 float split_quantity_new;
11458 if (destination_entity)
11459 {
11461 if (quantity > stackable)
11462 split_quantity_new = stackable;
11463 else
11464 split_quantity_new = quantity;
11465
11467 {
11468 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11469 if (new_item)
11470 {
11471 new_item.SetResultOfSplit(true);
11472 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11474 new_item.
SetQuantity(split_quantity_new,
false,
true);
11475 }
11476 }
11477 }
11478 }
11479
11481 {
11483 {
11484 if (ScriptInputUserData.CanStoreInputUserData())
11485 {
11486 ScriptInputUserData ctx = new ScriptInputUserData;
11491 ItemBase destination_entity =
this;
11492 ctx.
Write(destination_entity);
11496 }
11497 }
11498 else if (!
g_Game.IsMultiplayer())
11499 {
11501 }
11502 }
11503
11505 {
11507 float split_quantity_new;
11509 if (player)
11510 {
11512 if (quantity > stackable)
11513 split_quantity_new = stackable;
11514 else
11515 split_quantity_new = quantity;
11516
11518 {
11519 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11520 new_item =
ItemBase.Cast(in_hands);
11521 if (new_item)
11522 {
11523 new_item.SetResultOfSplit(true);
11524 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11526 new_item.SetQuantity(split_quantity_new, false, true);
11527 }
11528 }
11529 }
11530 }
11531
11533 {
11535 float split_quantity_new = Math.Floor(quantity * 0.5);
11536
11538 return;
11539
11541
11542 if (new_item)
11543 {
11544 if (new_item.GetQuantityMax() < split_quantity_new)
11545 {
11546 split_quantity_new = new_item.GetQuantityMax();
11547 }
11548
11549 new_item.SetResultOfSplit(true);
11550 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11551
11553 {
11556 }
11557 else
11558 {
11560 new_item.
SetQuantity(split_quantity_new,
false,
true);
11561 }
11562 }
11563 }
11564
11566 {
11568 float split_quantity_new = Math.Floor(quantity / 2);
11569
11571 return;
11572
11573 InventoryLocation invloc = new InventoryLocation;
11575
11577 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11578
11579 if (new_item)
11580 {
11581 if (new_item.GetQuantityMax() < split_quantity_new)
11582 {
11583 split_quantity_new = new_item.GetQuantityMax();
11584 }
11586 {
11589 }
11590 else if (split_quantity_new > 1)
11591 {
11593 new_item.
SetQuantity(split_quantity_new,
false,
true);
11594 }
11595 }
11596 }
11597
11600 {
11601 SetWeightDirty();
11603
11604 if (parent)
11605 parent.OnAttachmentQuantityChangedEx(this, delta);
11606
11608 {
11610 {
11612 }
11614 {
11615 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11617 }
11618 }
11619 }
11620
11623 {
11624
11625 }
11626
11629 {
11631 }
11632
11634 {
11635 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11636
11638 {
11639 if (newLevel == GameConstants.STATE_RUINED)
11640 {
11642 EntityAI parent = GetHierarchyParent();
11643 if (parent && parent.IsFireplace())
11644 {
11645 CargoBase cargo = GetInventory().GetCargo();
11646 if (cargo)
11647 {
11649 {
11651 }
11652 }
11653 }
11654 }
11655
11657 {
11658
11660 return;
11661 }
11662
11663 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11664 {
11666 }
11667 }
11668 }
11669
11670
11672 {
11673 super.OnRightClick();
11674
11676 {
11678 {
11679 if (ScriptInputUserData.CanStoreInputUserData())
11680 {
11681 EntityAI root = GetHierarchyRoot();
11682 Man playerOwner = GetHierarchyRootPlayer();
11683 InventoryLocation dst = new InventoryLocation;
11684
11685
11686 if (!playerOwner && root && root == this)
11687 {
11689 }
11690 else
11691 {
11692
11693 GetInventory().GetCurrentInventoryLocation(dst);
11695 {
11696 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11698 {
11700 }
11701 else
11702 {
11704
11705
11706 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11707 {
11709 }
11710 else
11711 {
11712 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11713 }
11714 }
11715 }
11716 }
11717
11718 ScriptInputUserData ctx = new ScriptInputUserData;
11726 }
11727 }
11728 else if (!
g_Game.IsMultiplayer())
11729 {
11731 }
11732 }
11733 }
11734
11736 {
11737 if (root)
11738 {
11739 vector m4[4];
11740 root.GetTransform(m4);
11741 dst.SetGround(this, m4);
11742 }
11743 else
11744 {
11745 GetInventory().GetCurrentInventoryLocation(dst);
11746 }
11747 }
11748
11749 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11750 {
11751
11752 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11753 return false;
11754
11755 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11756 return false;
11757
11758
11760 return false;
11761
11762
11763 Magazine mag = Magazine.Cast(this);
11764 if (mag)
11765 {
11766 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11767 return false;
11768
11769 if (stack_max_limit)
11770 {
11771 Magazine other_mag = Magazine.Cast(other_item);
11772 if (other_item)
11773 {
11774 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11775 return false;
11776 }
11777
11778 }
11779 }
11780 else
11781 {
11782
11784 return false;
11785
11787 return false;
11788 }
11789
11790 PlayerBase player = null;
11791 if (CastTo(player, GetHierarchyRootPlayer()))
11792 {
11793 if (player.GetInventory().HasAttachment(this))
11794 return false;
11795
11796 if (player.IsItemsToDelete())
11797 return false;
11798 }
11799
11800 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11801 return false;
11802
11803 int slotID;
11805 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11806 return false;
11807
11808 return true;
11809 }
11810
11812 {
11814 }
11815
11817 {
11818 return m_IsResultOfSplit;
11819 }
11820
11822 {
11823 m_IsResultOfSplit = value;
11824 }
11825
11827 {
11829 }
11830
11832 {
11833 float other_item_quantity = other_item.GetQuantity();
11834 float this_free_space;
11835
11837
11839
11840 if (other_item_quantity > this_free_space)
11841 {
11842 return this_free_space;
11843 }
11844 else
11845 {
11846 return other_item_quantity;
11847 }
11848 }
11849
11851 {
11853 }
11854
11856 {
11858 return;
11859
11860 if (!IsMagazine() && other_item)
11861 {
11863 if (quantity_used != 0)
11864 {
11865 float hp1 = GetHealth01("","");
11866 float hp2 = other_item.GetHealth01("","");
11867 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11868 hpResult = hpResult / (
GetQuantity() + quantity_used);
11869
11870 hpResult *= GetMaxHealth();
11871 Math.Round(hpResult);
11872 SetHealth("", "Health", hpResult);
11873
11875 other_item.AddQuantity(-quantity_used);
11876 }
11877 }
11879 }
11880
11882 {
11883 #ifdef SERVER
11884 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11885 GetHierarchyParent().IncreaseLifetimeUp();
11886 #endif
11887 };
11888
11890 {
11891 PlayerBase p = PlayerBase.Cast(player);
11892
11893 array<int> recipesIds = p.m_Recipes;
11894 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11895 if (moduleRecipesManager)
11896 {
11897 EntityAI itemInHands = player.GetEntityInHands();
11898 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11899 }
11900
11901 for (int i = 0;i < recipesIds.Count(); i++)
11902 {
11903 int key = recipesIds.Get(i);
11904 string recipeName = moduleRecipesManager.GetRecipeName(key);
11906 }
11907 }
11908
11909
11910 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11911 {
11912 super.GetDebugActions(outputList);
11913
11914
11920
11921
11926
11931
11932
11936
11937
11939 {
11943 }
11944
11947
11948
11952
11954
11955 InventoryLocation loc = new InventoryLocation();
11956 GetInventory().GetCurrentInventoryLocation(loc);
11958 {
11959 if (Gizmo_IsSupported())
11962 }
11963
11965 }
11966
11967
11968
11969
11971 {
11972 super.OnAction(action_id, player, ctx);
11973
11975 {
11976 switch (action_id)
11977 {
11981 return true;
11985 return true;
11986 }
11987 }
11988
11990 {
11991 switch (action_id)
11992 {
11994 Delete();
11995 return true;
11996 }
11997 }
11998
11999 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
12000 {
12001 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
12002 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
12003 PlayerBase p = PlayerBase.Cast(player);
12004 if (
EActions.RECIPES_RANGE_START < 1000)
12005 {
12006 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
12007 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
12008 }
12009 }
12010 #ifndef SERVER
12011 else if (action_id ==
EActions.WATCH_PLAYER)
12012 {
12013 PluginDeveloper.SetDeveloperItemClientEx(player);
12014 }
12015 #endif
12017 {
12018 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12019 {
12020 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12021 OnDebugButtonPressServer(id + 1);
12022 }
12023
12024 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12025 {
12026 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12028 }
12029
12030 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12031 {
12032 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12034 }
12035
12036 else if (action_id ==
EActions.ADD_QUANTITY)
12037 {
12038 if (IsMagazine())
12039 {
12040 Magazine mag = Magazine.Cast(this);
12041 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12042 }
12043 else
12044 {
12046 }
12047
12048 if (m_EM)
12049 {
12050 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12051 }
12052
12053 }
12054
12055 else if (action_id ==
EActions.REMOVE_QUANTITY)
12056 {
12057 if (IsMagazine())
12058 {
12059 Magazine mag2 = Magazine.Cast(this);
12060 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12061 }
12062 else
12063 {
12065 }
12066 if (m_EM)
12067 {
12068 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12069 }
12070
12071 }
12072
12073 else if (action_id ==
EActions.SET_QUANTITY_0)
12074 {
12076
12077 if (m_EM)
12078 {
12079 m_EM.SetEnergy(0);
12080 }
12081 }
12082
12083 else if (action_id ==
EActions.SET_MAX_QUANTITY)
12084 {
12086
12087 if (m_EM)
12088 {
12089 m_EM.SetEnergy(m_EM.GetEnergyMax());
12090 }
12091 }
12092
12093 else if (action_id ==
EActions.ADD_HEALTH)
12094 {
12095 AddHealth("","",GetMaxHealth("","Health")/5);
12096 }
12097 else if (action_id ==
EActions.REMOVE_HEALTH)
12098 {
12099 AddHealth("","",-GetMaxHealth("","Health")/5);
12100 }
12101 else if (action_id ==
EActions.DESTROY_HEALTH)
12102 {
12103 SetHealth01("","",0);
12104 }
12105 else if (action_id ==
EActions.WATCH_ITEM)
12106 {
12108 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12109 #ifdef DEVELOPER
12110 SetDebugDeveloper_item(this);
12111 #endif
12112 }
12113
12114 else if (action_id ==
EActions.ADD_TEMPERATURE)
12115 {
12116 AddTemperature(20);
12117
12118 }
12119
12120 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12121 {
12122 AddTemperature(-20);
12123
12124 }
12125
12126 else if (action_id ==
EActions.FLIP_FROZEN)
12127 {
12128 SetFrozen(!GetIsFrozen());
12129
12130 }
12131
12132 else if (action_id ==
EActions.ADD_WETNESS)
12133 {
12135
12136 }
12137
12138 else if (action_id ==
EActions.REMOVE_WETNESS)
12139 {
12141
12142 }
12143
12144 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12145 {
12148
12149
12150 }
12151
12152 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12153 {
12156 }
12157
12158 else if (action_id ==
EActions.MAKE_SPECIAL)
12159 {
12160 auto debugParams = DebugSpawnParams.WithPlayer(player);
12161 OnDebugSpawnEx(debugParams);
12162 }
12163
12164 }
12165
12166
12167 return false;
12168 }
12169
12170
12171
12172
12176
12179
12180
12181
12183 {
12184 return false;
12185 }
12186
12187
12189 {
12190 return true;
12191 }
12192
12193
12195 {
12196 return true;
12197 }
12198
12199
12200
12202 {
12203 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12204 return g_Game.ConfigIsExisting(config_path);
12205 }
12206
12209 {
12210 return null;
12211 }
12212
12214 {
12215 return false;
12216 }
12217
12219 {
12220 return false;
12221 }
12222
12226
12227
12229 {
12230 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12231 return module_repairing.CanRepair(this, item_repair_kit);
12232 }
12233
12234
12235 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12236 {
12237 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12238 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12239 }
12240
12241
12243 {
12244
12245
12246
12247
12248
12249
12250
12251
12252 return 1;
12253 }
12254
12255
12256
12258 {
12260 }
12261
12262
12263
12265 {
12267 }
12268
12269
12278 {
12279 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12280
12281 if (player)
12282 {
12283 player.MessageStatus(text);
12284 }
12285 }
12286
12287
12296 {
12297 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12298
12299 if (player)
12300 {
12301 player.MessageAction(text);
12302 }
12303 }
12304
12305
12314 {
12315 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12316
12317 if (player)
12318 {
12319 player.MessageFriendly(text);
12320 }
12321 }
12322
12323
12332 {
12333 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12334
12335 if (player)
12336 {
12337 player.MessageImportant(text);
12338 }
12339 }
12340
12342 {
12343 return true;
12344 }
12345
12346
12347 override bool KindOf(
string tag)
12348 {
12349 bool found = false;
12350 string item_name = this.
GetType();
12352 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12353
12354 int array_size = item_tag_array.Count();
12355 for (int i = 0; i < array_size; i++)
12356 {
12357 if (item_tag_array.Get(i) == tag)
12358 {
12359 found = true;
12360 break;
12361 }
12362 }
12363 return found;
12364 }
12365
12366
12368 {
12369
12370 super.OnRPC(sender, rpc_type,ctx);
12371
12372
12373 switch (rpc_type)
12374 {
12375 #ifndef SERVER
12376 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12377 Param2<bool, string> p = new Param2<bool, string>(false, "");
12378
12380 return;
12381
12382 bool play = p.param1;
12383 string soundSet = p.param2;
12384
12385 if (play)
12386 {
12388 {
12390 {
12392 }
12393 }
12394 else
12395 {
12397 }
12398 }
12399 else
12400 {
12402 }
12403
12404 break;
12405 #endif
12406
12407 }
12408
12410 {
12412 }
12413 }
12414
12415
12416
12417
12419 {
12420 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12421 return plugin.GetID(
name);
12422 }
12423
12425 {
12426 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12427 return plugin.GetName(id);
12428 }
12429
12432 {
12433
12434
12435 int varFlags;
12436 if (!ctx.
Read(varFlags))
12437 return;
12438
12439 if (varFlags & ItemVariableFlags.FLOAT)
12440 {
12442 }
12443 }
12444
12446 {
12447
12448 super.SerializeNumericalVars(floats_out);
12449
12450
12451
12453 {
12455 }
12456
12458 {
12460 }
12461
12463 {
12465 }
12466
12468 {
12473 }
12474
12476 {
12478 }
12479 }
12480
12482 {
12483
12484 super.DeSerializeNumericalVars(floats);
12485
12486
12487 int index = 0;
12488 int mask = Math.Round(floats.Get(index));
12489
12490 index++;
12491
12493 {
12495 {
12497 }
12498 else
12499 {
12500 float quantity = floats.Get(index);
12501 SetQuantity(quantity,
true,
false,
false,
false);
12502 }
12503 index++;
12504 }
12505
12507 {
12508 float wet = floats.Get(index);
12510 index++;
12511 }
12512
12514 {
12515 int liquidtype = Math.Round(floats.Get(index));
12517 index++;
12518 }
12519
12521 {
12523 index++;
12525 index++;
12527 index++;
12529 index++;
12530 }
12531
12533 {
12534 int cleanness = Math.Round(floats.Get(index));
12536 index++;
12537 }
12538 }
12539
12541 {
12542 super.WriteVarsToCTX(ctx);
12543
12544
12546 {
12548 }
12549
12551 {
12553 }
12554
12556 {
12558 }
12559
12561 {
12562 int r,g,b,a;
12568 }
12569
12571 {
12573 }
12574 }
12575
12577 {
12578 if (!super.ReadVarsFromCTX(ctx,version))
12579 return false;
12580
12581 int intValue;
12582 float value;
12583
12584 if (version < 140)
12585 {
12586 if (!ctx.
Read(intValue))
12587 return false;
12588
12589 m_VariablesMask = intValue;
12590 }
12591
12593 {
12594 if (!ctx.
Read(value))
12595 return false;
12596
12598 {
12600 }
12601 else
12602 {
12604 }
12605 }
12606
12607 if (version < 140)
12608 {
12610 {
12611 if (!ctx.
Read(value))
12612 return false;
12613 SetTemperatureDirect(value);
12614 }
12615 }
12616
12618 {
12619 if (!ctx.
Read(value))
12620 return false;
12622 }
12623
12625 {
12626 if (!ctx.
Read(intValue))
12627 return false;
12629 }
12630
12632 {
12633 int r,g,b,a;
12635 return false;
12637 return false;
12639 return false;
12641 return false;
12642
12644 }
12645
12647 {
12648 if (!ctx.
Read(intValue))
12649 return false;
12651 }
12652
12653 if (version >= 138 && version < 140)
12654 {
12656 {
12657 if (!ctx.
Read(intValue))
12658 return false;
12659 SetFrozen(intValue);
12660 }
12661 }
12662
12663 return true;
12664 }
12665
12666
12668 {
12671 {
12673 }
12674
12675 if (!super.OnStoreLoad(ctx, version))
12676 {
12678 return false;
12679 }
12680
12681 if (version >= 114)
12682 {
12683 bool hasQuickBarIndexSaved;
12684
12685 if (!ctx.
Read(hasQuickBarIndexSaved))
12686 {
12688 return false;
12689 }
12690
12691 if (hasQuickBarIndexSaved)
12692 {
12693 int itmQBIndex;
12694
12695
12696 if (!ctx.
Read(itmQBIndex))
12697 {
12699 return false;
12700 }
12701
12702 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12703 if (itmQBIndex != -1 && parentPlayer)
12704 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12705 }
12706 }
12707 else
12708 {
12709
12710 PlayerBase player;
12711 int itemQBIndex;
12712 if (version ==
int.
MAX)
12713 {
12714 if (!ctx.
Read(itemQBIndex))
12715 {
12717 return false;
12718 }
12719 }
12720 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12721 {
12722
12723 if (!ctx.
Read(itemQBIndex))
12724 {
12726 return false;
12727 }
12728 if (itemQBIndex != -1 && player)
12729 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12730 }
12731 }
12732
12733 if (version < 140)
12734 {
12735
12736 if (!LoadVariables(ctx, version))
12737 {
12739 return false;
12740 }
12741 }
12742
12743
12745 {
12747 return false;
12748 }
12749 if (version >= 132)
12750 {
12752 if (raib)
12753 {
12755 {
12757 return false;
12758 }
12759 }
12760 }
12761
12763 return true;
12764 }
12765
12766
12767
12769 {
12770 super.OnStoreSave(ctx);
12771
12772 PlayerBase player;
12773 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12774 {
12776
12777 int itemQBIndex = -1;
12778 itemQBIndex = player.FindQuickBarEntityIndex(this);
12779 ctx.
Write(itemQBIndex);
12780 }
12781 else
12782 {
12784 }
12785
12787
12789 if (raib)
12790 {
12792 }
12793 }
12794
12795
12797 {
12798 super.AfterStoreLoad();
12799
12801 {
12803 }
12804
12806 {
12809 }
12810 }
12811
12813 {
12814 super.EEOnAfterLoad();
12815
12817 {
12819 }
12820
12823 }
12824
12826 {
12827 return false;
12828 }
12829
12830
12831
12833 {
12835 {
12836 #ifdef PLATFORM_CONSOLE
12837
12839 {
12841 if (menu)
12842 {
12844 }
12845 }
12846 #endif
12847 }
12848
12850 {
12853 }
12854
12856 {
12857 SetWeightDirty();
12859 }
12861 {
12864 }
12865
12867 {
12870
12873 }
12875 {
12879 }
12880
12881 super.OnVariablesSynchronized();
12882 }
12883
12884
12885
12887 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12888 {
12889 if (!IsServerCheck(allow_client))
12890 return false;
12891
12893 return false;
12894
12897
12898 if (value <= (min + 0.001))
12899 value = min;
12900
12901 if (value == min)
12902 {
12903 if (destroy_config)
12904 {
12905 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12906 if (dstr)
12907 {
12909 this.Delete();
12910 return true;
12911 }
12912 }
12913 else if (destroy_forced)
12914 {
12916 this.Delete();
12917 return true;
12918 }
12919
12921 }
12922
12925
12927 {
12928 EntityAI parent = GetHierarchyRoot();
12929 InventoryLocation iLoc = new InventoryLocation();
12930 GetInventory().GetCurrentInventoryLocation(iLoc);
12932 {
12933 int iLocSlot = iLoc.
GetSlot();
12935 {
12937 }
12939 {
12941 }
12942 }
12943 }
12944
12946 {
12948
12949 if (delta)
12951 }
12952
12954
12955 return false;
12956 }
12957
12958
12960 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12961 {
12963 }
12964
12966 {
12969 }
12970
12972 {
12975 }
12976
12978 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12979 {
12980 float value_clamped = Math.Clamp(value, 0, 1);
12982 SetQuantity(result, destroy_config, destroy_forced);
12983 }
12984
12985
12988 {
12990 }
12991
12993 {
12995 }
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13007 {
13008 int slot = -1;
13009 GameInventory inventory = GetInventory();
13010 if (inventory)
13011 {
13012 InventoryLocation il = new InventoryLocation;
13015 }
13016
13018 }
13019
13021 {
13022 float quantity_max = 0;
13023
13025 {
13026 if (attSlotID != -1)
13027 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
13028
13029 if (quantity_max <= 0)
13031 }
13032
13033 if (quantity_max <= 0)
13035
13036 return quantity_max;
13037 }
13038
13040 {
13042 }
13043
13045 {
13047 }
13048
13049
13051 {
13053 }
13054
13056 {
13058 }
13059
13061 {
13063 }
13064
13065
13067 {
13068
13069 float weightEx = GetWeightEx();
13070 float special = GetInventoryAndCargoWeight();
13071 return weightEx - special;
13072 }
13073
13074
13076 {
13078 }
13079
13081 {
13083 {
13084 #ifdef DEVELOPER
13085 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13086 {
13087 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13089 }
13090 #endif
13091
13092 return GetQuantity() * GetConfigWeightModified();
13093 }
13094 else if (HasEnergyManager())
13095 {
13096 #ifdef DEVELOPER
13097 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13098 {
13099 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13100 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13101 }
13102 #endif
13103 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13104 }
13105 else
13106 {
13107 #ifdef DEVELOPER
13108 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13109 {
13110 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13111 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13112 }
13113 #endif
13114 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13115 }
13116 }
13117
13120 {
13121 int item_count = 0;
13123
13124 GameInventory inventory = GetInventory();
13125 CargoBase cargo = inventory.
GetCargo();
13126 if (cargo != NULL)
13127 {
13129 }
13130
13132 for (int i = 0; i < nAttachments; ++i)
13133 {
13135 if (item)
13136 item_count += item.GetNumberOfItems();
13137 }
13138 return item_count;
13139 }
13140
13143 {
13144 float weight = 0;
13145 float wetness = 1;
13146 if (include_wetness)
13149 {
13150 weight = wetness * m_ConfigWeight;
13151 }
13153 {
13154 weight = 1;
13155 }
13156 return weight;
13157 }
13158
13159
13160
13162 {
13163 GameInventory inventory = GetInventory();
13164 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13165 {
13166 array<EntityAI> items = new array<EntityAI>;
13168 for (int i = 0; i < items.Count(); ++i)
13169 {
13171 if (item)
13172 {
13173 g_Game.ObjectDelete(item);
13174 }
13175 }
13176 }
13177 }
13178
13179
13180
13181
13183 {
13184 float energy = 0;
13185 if (HasEnergyManager())
13186 {
13187 energy = GetCompEM().GetEnergy();
13188 }
13189 return energy;
13190 }
13191
13192
13194 {
13195 super.OnEnergyConsumed();
13196
13198 }
13199
13201 {
13202 super.OnEnergyAdded();
13203
13205 }
13206
13207
13209 {
13210 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13211 {
13213 {
13214 float energy_0to1 = GetCompEM().GetEnergy0To1();
13216 }
13217 }
13218 }
13219
13220
13222 {
13223 return ConfigGetFloat("heatIsolation");
13224 }
13225
13227 {
13229 }
13230
13232 {
13233 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13234 if (
g_Game.ConfigIsExisting(paramPath))
13235 return g_Game.ConfigGetFloat(paramPath);
13236
13237 return 0.0;
13238 }
13239
13241 {
13242 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13243 if (
g_Game.ConfigIsExisting(paramPath))
13244 return g_Game.ConfigGetFloat(paramPath);
13245
13246 return 0.0;
13247 }
13248
13249 override void SetWet(
float value,
bool allow_client =
false)
13250 {
13251 if (!IsServerCheck(allow_client))
13252 return;
13253
13256
13258
13259 m_VarWet = Math.Clamp(value, min, max);
13260
13262 {
13265 }
13266 }
13267
13268 override void AddWet(
float value)
13269 {
13271 }
13272
13274 {
13276 }
13277
13279 {
13281 }
13282
13284 {
13286 }
13287
13289 {
13291 }
13292
13294 {
13296 }
13297
13298 override void OnWetChanged(
float newVal,
float oldVal)
13299 {
13302 if (newLevel != oldLevel)
13303 {
13305 }
13306 }
13307
13309 {
13310 SetWeightDirty();
13311 }
13312
13314 {
13315 return GetWetLevelInternal(
m_VarWet);
13316 }
13317
13318
13319
13321 {
13323 }
13324
13326 {
13328 }
13329
13331 {
13333 }
13334
13336 {
13338 }
13339
13340
13341
13343 {
13344 if (ConfigIsExisting("itemModelLength"))
13345 {
13346 return ConfigGetFloat("itemModelLength");
13347 }
13348 return 0;
13349 }
13350
13352 {
13353 if (ConfigIsExisting("itemAttachOffset"))
13354 {
13355 return ConfigGetFloat("itemAttachOffset");
13356 }
13357 return 0;
13358 }
13359
13360 override void SetCleanness(
int value,
bool allow_client =
false)
13361 {
13362 if (!IsServerCheck(allow_client))
13363 return;
13364
13366
13368
13371 }
13372
13374 {
13376 }
13377
13379 {
13380 return true;
13381 }
13382
13383
13384
13385
13387 {
13389 }
13390
13392 {
13394 }
13395
13396
13397
13398
13399 override void SetColor(
int r,
int g,
int b,
int a)
13400 {
13406 }
13408 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13409 {
13414 }
13415
13417 {
13419 }
13420
13423 {
13424 int r,g,b,a;
13426 r = r/255;
13427 g = g/255;
13428 b = b/255;
13429 a = a/255;
13430 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13431 }
13432
13433
13434
13435 override void SetLiquidType(
int value,
bool allow_client =
false)
13436 {
13437 if (!IsServerCheck(allow_client))
13438 return;
13439
13444 }
13445
13447 {
13448 return ConfigGetInt("varLiquidTypeInit");
13449 }
13450
13452 {
13454 }
13455
13457 {
13459 SetFrozen(false);
13460 }
13461
13464 {
13465 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13466 }
13467
13468
13471 {
13472 PlayerBase nplayer;
13473 if (PlayerBase.CastTo(nplayer, player))
13474 {
13476 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13477 }
13478 }
13479
13480
13483 {
13484 PlayerBase nplayer;
13485 if (PlayerBase.CastTo(nplayer,player))
13486 {
13487 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13488 }
13489
13490 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13491
13492 if (HasEnergyManager())
13493 {
13494 GetCompEM().UpdatePlugState();
13495 }
13496 }
13497
13498
13500 {
13501 super.OnPlacementStarted(player);
13502
13504 }
13505
13506 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13507 {
13509 {
13510 m_AdminLog.OnPlacementComplete(player,
this);
13511 }
13512
13513 super.OnPlacementComplete(player, position, orientation);
13514 }
13515
13516
13517
13518
13519
13521 {
13523 {
13524 return true;
13525 }
13526 else
13527 {
13528 return false;
13529 }
13530 }
13531
13532
13534 {
13536 {
13538 }
13539 }
13540
13541
13543 {
13545 }
13546
13548 {
13550 }
13551
13552 override void InsertAgent(
int agent,
float count = 1)
13553 {
13554 if (count < 1)
13555 return;
13556
13558 }
13559
13562 {
13564 }
13565
13566
13568 {
13570 }
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13614 {
13616 return false;
13617 return true;
13618 }
13619
13621 {
13622
13624 }
13625
13626
13629 {
13630 super.CheckForRoofLimited(timeTresholdMS);
13631
13632 float time =
g_Game.GetTime();
13633 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13634 {
13635 m_PreviousRoofTestTime = time;
13636 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13637 }
13638 }
13639
13640
13642 {
13644 {
13645 return 0;
13646 }
13647
13648 if (GetInventory().GetAttachmentSlotsCount() != 0)
13649 {
13650 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13651 if (filter)
13652 return filter.GetProtectionLevel(type, false, system);
13653 else
13654 return 0;
13655 }
13656
13657 string subclassPath, entryName;
13658
13659 switch (type)
13660 {
13662 entryName = "biological";
13663 break;
13665 entryName = "chemical";
13666 break;
13667 default:
13668 entryName = "biological";
13669 break;
13670 }
13671
13672 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13673
13674 return g_Game.ConfigGetFloat(subclassPath + entryName);
13675 }
13676
13677
13678
13681 {
13682 if (!IsMagazine())
13684
13686 }
13687
13688
13689
13690
13691
13696 {
13697 return true;
13698 }
13699
13701 {
13703 }
13704
13705
13706
13707
13708
13710 {
13711 if (parent)
13712 {
13713 if (parent.IsInherited(DayZInfected))
13714 return true;
13715
13716 if (!parent.IsRuined())
13717 return true;
13718 }
13719
13720 return true;
13721 }
13722
13724 {
13725 if (!super.CanPutAsAttachment(parent))
13726 {
13727 return false;
13728 }
13729
13730 if (!IsRuined() && !parent.IsRuined())
13731 {
13732 return true;
13733 }
13734
13735 return false;
13736 }
13737
13739 {
13740
13741
13742
13743
13744 return super.CanReceiveItemIntoCargo(item);
13745 }
13746
13748 {
13749
13750
13751
13752
13753 GameInventory attachmentInv = attachment.GetInventory();
13755 {
13756 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13757 return false;
13758 }
13759
13760 InventoryLocation loc = new InventoryLocation();
13761 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13762 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13763 return false;
13764
13765 return super.CanReceiveAttachment(attachment, slotId);
13766 }
13767
13769 {
13770 if (!super.CanReleaseAttachment(attachment))
13771 return false;
13772
13773 return GetInventory().AreChildrenAccessible();
13774 }
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13797 {
13798 int id = muzzle_owner.GetMuzzleID();
13799 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13800
13801 if (WPOF_array)
13802 {
13803 for (int i = 0; i < WPOF_array.Count(); i++)
13804 {
13805 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13806
13807 if (WPOF)
13808 {
13809 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13810 }
13811 }
13812 }
13813 }
13814
13815
13817 {
13818 int id = muzzle_owner.GetMuzzleID();
13820
13821 if (WPOBE_array)
13822 {
13823 for (int i = 0; i < WPOBE_array.Count(); i++)
13824 {
13825 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13826
13827 if (WPOBE)
13828 {
13829 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13830 }
13831 }
13832 }
13833 }
13834
13835
13837 {
13838 int id = muzzle_owner.GetMuzzleID();
13839 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13840
13841 if (WPOOH_array)
13842 {
13843 for (int i = 0; i < WPOOH_array.Count(); i++)
13844 {
13845 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13846
13847 if (WPOOH)
13848 {
13849 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13850 }
13851 }
13852 }
13853 }
13854
13855
13857 {
13858 int id = muzzle_owner.GetMuzzleID();
13859 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13860
13861 if (WPOOH_array)
13862 {
13863 for (int i = 0; i < WPOOH_array.Count(); i++)
13864 {
13865 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13866
13867 if (WPOOH)
13868 {
13869 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13870 }
13871 }
13872 }
13873 }
13874
13875
13877 {
13878 int id = muzzle_owner.GetMuzzleID();
13879 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13880
13881 if (WPOOH_array)
13882 {
13883 for (int i = 0; i < WPOOH_array.Count(); i++)
13884 {
13885 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13886
13887 if (WPOOH)
13888 {
13889 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13890 }
13891 }
13892 }
13893 }
13894
13895
13896
13898 {
13900 {
13901 return true;
13902 }
13903
13904 return false;
13905 }
13906
13908 {
13910 {
13911 return true;
13912 }
13913
13914 return false;
13915 }
13916
13918 {
13920 {
13921 return true;
13922 }
13923
13924 return false;
13925 }
13926
13928 {
13929 return false;
13930 }
13931
13934 {
13935 return UATimeSpent.DEFAULT_DEPLOY;
13936 }
13937
13938
13939
13940
13942 {
13944 SetSynchDirty();
13945 }
13946
13948 {
13950 }
13951
13952
13954 {
13955 return false;
13956 }
13957
13960 {
13961 string att_type = "None";
13962
13963 if (ConfigIsExisting("soundAttType"))
13964 {
13965 att_type = ConfigGetString("soundAttType");
13966 }
13967
13969 }
13970
13972 {
13974 }
13975
13976
13977
13978
13979
13985
13987 {
13990
13992 }
13993
13994
13996 {
13998 return;
13999
14001
14004
14007
14008 SoundParameters params = new SoundParameters();
14012 }
14013
14014
14016 {
14018 {
14021
14022 SetSynchDirty();
14023
14026 }
14027 }
14028
14030 {
14032 }
14033
14034
14036 {
14038 return;
14039
14041 SetSynchDirty();
14042
14045 }
14046
14048 {
14051 }
14052
14054 {
14056 }
14057
14058 void OnApply(PlayerBase player);
14059
14061 {
14062 return 1.0;
14063 };
14064
14066 {
14068 }
14069
14071 {
14073 }
14074
14076
14078 {
14079 SetDynamicPhysicsLifeTime(0.01);
14081 }
14082
14084 {
14085 array<string> zone_names = new array<string>;
14086 GetDamageZones(zone_names);
14087 for (int i = 0; i < zone_names.Count(); i++)
14088 {
14089 SetHealthMax(zone_names.Get(i),"Health");
14090 }
14091 SetHealthMax("","Health");
14092 }
14093
14096 {
14097 float global_health = GetHealth01("","Health");
14098 array<string> zones = new array<string>;
14099 GetDamageZones(zones);
14100
14101 for (int i = 0; i < zones.Count(); i++)
14102 {
14103 SetHealth01(zones.Get(i),"Health",global_health);
14104 }
14105 }
14106
14109 {
14110 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14111 }
14112
14114 {
14115 if (!hasRootAsPlayer)
14116 {
14117 if (refParentIB)
14118 {
14119
14120 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14121 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14122
14123 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14124 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14125
14128 }
14129 else
14130 {
14131
14134 }
14135 }
14136 }
14137
14139 {
14141 {
14142 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14143 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14144 {
14145 float heatPermCoef = 1.0;
14147 while (ent)
14148 {
14149 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14150 ent = ent.GetHierarchyParent();
14151 }
14152
14153 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14154 }
14155 }
14156 }
14157
14159 {
14160
14161 EntityAI parent = GetHierarchyParent();
14162 if (!parent)
14163 {
14164 hasParent = false;
14165 hasRootAsPlayer = false;
14166 }
14167 else
14168 {
14169 hasParent = true;
14170 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14171 refParentIB =
ItemBase.Cast(parent);
14172 }
14173 }
14174
14175 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14176 {
14177
14178 }
14179
14181 {
14182
14183 return false;
14184 }
14185
14187 {
14188
14189
14190 return false;
14191 }
14192
14194 {
14195
14196 return false;
14197 }
14198
14201 {
14202 return !GetIsFrozen() &&
IsOpen();
14203 }
14204
14206 {
14207 bool hasParent = false, hasRootAsPlayer = false;
14209
14210 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14211 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14212
14213 if (wwtu || foodDecay)
14214 {
14218
14219 if (processWetness || processTemperature || processDecay)
14220 {
14222
14223 if (processWetness)
14224 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14225
14226 if (processTemperature)
14228
14229 if (processDecay)
14230 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14231 }
14232 }
14233 }
14234
14237 {
14239 }
14240
14242 {
14245
14246 return super.GetTemperatureFreezeThreshold();
14247 }
14248
14250 {
14253
14254 return super.GetTemperatureThawThreshold();
14255 }
14256
14258 {
14261
14262 return super.GetItemOverheatThreshold();
14263 }
14264
14266 {
14268 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14269
14270 return super.GetTemperatureFreezeTime();
14271 }
14272
14274 {
14276 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14277
14278 return super.GetTemperatureThawTime();
14279 }
14280
14285
14287 {
14288 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14289 }
14290
14292 {
14293 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14294 }
14295
14298 {
14300 }
14301
14303 {
14305 }
14306
14308 {
14310 }
14311
14314 {
14315 return null;
14316 }
14317
14320 {
14321 return false;
14322 }
14323
14325 {
14327 {
14330 if (!trg)
14331 {
14333 explosive = this;
14334 }
14335
14336 explosive.PairRemote(trg);
14338
14339 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14340 trg.SetPersistentPairID(persistentID);
14341 explosive.SetPersistentPairID(persistentID);
14342
14343 return true;
14344 }
14345 return false;
14346 }
14347
14350 {
14351 float ret = 1.0;
14354 ret *= GetHealth01();
14355
14356 return ret;
14357 }
14358
14359 #ifdef DEVELOPER
14360 override void SetDebugItem()
14361 {
14362 super.SetDebugItem();
14363 _itemBase = this;
14364 }
14365
14367 {
14368 string text = super.GetDebugText();
14369
14371 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14372
14373 return text;
14374 }
14375 #endif
14376
14378 {
14379 return true;
14380 }
14381
14383
14385
14387 {
14390 }
14391
14392
14400
14416
14417 [
Obsolete(
"Use ItemSoundHandler instead")]
14420 {
14421 if (!
g_Game.IsDedicatedServer())
14422 {
14423 if (ConfigIsExisting("attachSoundSet"))
14424 {
14425 string cfg_path = "";
14426 string soundset = "";
14427 string type_name =
GetType();
14428
14431 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14432 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14433
14434 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14435 {
14436 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14437 {
14438 if (cfg_slot_array[i] == slot_type)
14439 {
14440 soundset = cfg_soundset_array[i];
14441 break;
14442 }
14443 }
14444 }
14445
14446 if (soundset != "")
14447 {
14448 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14450 }
14451 }
14452 }
14453 }
14454
14456}
14457
14459{
14461 if (entity)
14462 {
14463 bool is_item = entity.IsInherited(
ItemBase);
14464 if (is_item && full_quantity)
14465 {
14468 }
14469 }
14470 else
14471 {
14473 return NULL;
14474 }
14475 return entity;
14476}
14477
14479{
14480 if (item)
14481 {
14482 if (health > 0)
14483 item.SetHealth("", "", health);
14484
14485 if (item.CanHaveTemperature())
14486 {
14488 if (item.CanFreeze())
14489 item.SetFrozen(false);
14490 }
14491
14492 if (item.HasEnergyManager())
14493 {
14494 if (quantity >= 0)
14495 {
14496 item.GetCompEM().SetEnergy0To1(quantity);
14497 }
14498 else
14499 {
14501 }
14502 }
14503 else if (item.IsMagazine())
14504 {
14505 Magazine mag = Magazine.Cast(item);
14506 if (quantity >= 0)
14507 {
14508 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14509 }
14510 else
14511 {
14513 }
14514
14515 }
14516 else
14517 {
14518 if (quantity >= 0)
14519 {
14520 item.SetQuantityNormalized(quantity, false);
14521 }
14522 else
14523 {
14525 }
14526
14527 }
14528 }
14529}
14530
14531#ifdef DEVELOPER
14533#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.