DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
9456{
9458 {
9459 return true;
9460 }
9461};
9462
9464{
9465
9466};
9467
9468
9469
9471{
9475
9477
9480
9481
9482
9483
9484
9493
9499
9504
9509
9530 protected bool m_IsResultOfSplit
9531
9533
9538
9539
9540
9542
9546
9547
9548
9550
9553
9554
9555
9561
9562
9570
9573
9574
9576
9577
9579
9580
9585
9586
9591
9593
9594
9596
9597
9599 {
9604
9605 if (!
g_Game.IsDedicatedServer())
9606 {
9608 {
9610
9612 {
9614 }
9615 }
9616
9619 }
9620
9621 m_OldLocation = null;
9622
9624 {
9626 }
9627
9628 if (ConfigIsExisting("headSelectionsToHide"))
9629 {
9632 }
9633
9635 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9636 {
9638 }
9639
9641
9642 m_IsResultOfSplit = false;
9643
9645 }
9646
9648 {
9649 super.InitItemVariables();
9650
9656 m_Count = ConfigGetInt(
"count");
9657
9660
9665
9668
9673
9685
9689
9690
9693 if (ConfigIsExisting("canBeSplit"))
9694 {
9697 }
9698
9700 if (ConfigIsExisting("itemBehaviour"))
9702
9703
9706 RegisterNetSyncVariableInt("m_VarLiquidType");
9707 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9708
9709 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9710 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9711 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9712
9713 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9714 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9715 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9716 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9717
9718 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9719 RegisterNetSyncVariableBool("m_IsTakeable");
9720 RegisterNetSyncVariableBool("m_IsHologram");
9721
9724 {
9727 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9728 }
9729
9731
9733 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9735
9737 }
9738
9740 {
9742 }
9743
9745 {
9748 {
9753 }
9754 }
9755
9756 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9757 {
9759 {
9762 }
9763
9765 }
9766
9768 {
9774 }
9775
9777
9779 {
9781
9782 if (!action)
9783 {
9784 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9785 return;
9786 }
9787
9789 if (!ai)
9790 {
9792 return;
9793 }
9794
9796 if (!action_array)
9797 {
9798 action_array = new array<ActionBase_Basic>;
9800 }
9801 if (LogManager.IsActionLogEnable())
9802 {
9803 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9804 }
9805
9806 if (action_array.Find(action) != -1)
9807 {
9808 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9809 }
9810 else
9811 {
9812 action_array.Insert(action);
9813 }
9814 }
9815
9817 {
9818 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9819 ActionBase action = player.GetActionManager().GetAction(actionName);
9822
9823 if (action_array)
9824 {
9825 action_array.RemoveItem(action);
9826 }
9827 }
9828
9829
9830
9832 {
9833 ActionOverrideData overrideData = new ActionOverrideData();
9837
9839 if (!actionMap)
9840 {
9843 }
9844
9845 actionMap.Insert(this.
Type(), overrideData);
9846
9847 }
9848
9850
9852
9853
9855 {
9858
9861
9862 string config_to_search = "CfgVehicles";
9863 string muzzle_owner_config;
9864
9866 {
9867 if (IsInherited(Weapon))
9868 config_to_search = "CfgWeapons";
9869
9870 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9871
9872 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9873
9874 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9875
9876 if (config_OnFire_subclass_count > 0)
9877 {
9878 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9879
9880 for (int i = 0; i < config_OnFire_subclass_count; i++)
9881 {
9882 string particle_class = "";
9883 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9884 string config_OnFire_entry = config_OnFire_class + particle_class;
9885 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9886 WPOF_array.Insert(WPOF);
9887 }
9888
9889
9891 }
9892 }
9893
9895 {
9896 config_to_search = "CfgWeapons";
9897 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9898
9899 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9900
9901 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9902
9903 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9904 {
9905 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9906
9907 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9908 {
9909 string particle_class2 = "";
9910 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9911 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9912 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9913 WPOBE_array.Insert(WPOBE);
9914 }
9915
9916
9918 }
9919 }
9920 }
9921
9922
9924 {
9927
9929 {
9930 string config_to_search = "CfgVehicles";
9931
9932 if (IsInherited(Weapon))
9933 config_to_search = "CfgWeapons";
9934
9935 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9936 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9937
9938 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9939 {
9940
9942
9944 {
9946 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9948 return;
9949 }
9950
9953
9954
9955
9956 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9957 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9958
9959 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9960 {
9961 string particle_class = "";
9962 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9963 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9964 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9965
9966 if (entry_type == CT_CLASS)
9967 {
9968 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9969 WPOOH_array.Insert(WPOF);
9970 }
9971 }
9972
9973
9975 }
9976 }
9977 }
9978
9980 {
9982 }
9983
9985 {
9987 {
9989
9992
9995
9996 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9997 }
9998 }
9999
10001 {
10003 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10004
10006 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10007
10009 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10010
10012 {
10014 }
10015 }
10016
10018 {
10020 }
10021
10023 {
10026 else
10028
10030 {
10033 }
10034 else
10035 {
10038
10041 }
10042
10044 }
10045
10047 {
10049 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10050 }
10051
10053 {
10055 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10057 }
10058
10060 {
10062 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10063 }
10064
10066 {
10069
10070 OverheatingParticle OP = new OverheatingParticle();
10075
10077 }
10078
10080 {
10083
10084 return -1;
10085 }
10086
10088 {
10090 {
10093
10094 for (int i = count; i > 0; --i)
10095 {
10096 int id = i - 1;
10099
10102
10103 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10104 {
10105 if (p)
10106 {
10109 }
10110 }
10111 }
10112 }
10113 }
10114
10116 {
10118 {
10120 {
10121 int id = i - 1;
10123
10124 if (OP)
10125 {
10127
10128 if (p)
10129 {
10131 }
10132
10133 delete OP;
10134 }
10135 }
10136
10139 }
10140 }
10141
10144 {
10145 return 0.0;
10146 }
10147
10148
10150 {
10151 return 250;
10152 }
10153
10155 {
10156 return 0;
10157 }
10158
10161 {
10163 return true;
10164
10165 return false;
10166 }
10167
10170 {
10173
10175 {
10177 }
10178 else
10179 {
10180
10182 }
10183
10185 }
10186
10193 {
10194 return -1;
10195 }
10196
10197
10198
10199
10201 {
10203 {
10204 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10205 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10206
10207 if (r_index >= 0)
10208 {
10209 InventoryLocation r_il = new InventoryLocation;
10210 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10211
10212 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10215 {
10216 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10217 }
10219 {
10220 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10221 }
10222
10223 }
10224
10225 player.GetHumanInventory().ClearUserReservedLocation(this);
10226 }
10227
10230 }
10231
10232
10233
10234
10236 {
10237 return ItemBase.m_DebugActionsMask;
10238 }
10239
10241 {
10242 return ItemBase.m_DebugActionsMask & mask;
10243 }
10244
10246 {
10247 ItemBase.m_DebugActionsMask = mask;
10248 }
10249
10251 {
10252 ItemBase.m_DebugActionsMask |= mask;
10253 }
10254
10256 {
10257 ItemBase.m_DebugActionsMask &= ~mask;
10258 }
10259
10261 {
10263 {
10265 }
10266 else
10267 {
10269 }
10270 }
10271
10272
10274 {
10275 if (GetEconomyProfile())
10276 {
10277 float q_max = GetEconomyProfile().GetQuantityMax();
10278 if (q_max > 0)
10279 {
10280 float q_min = GetEconomyProfile().GetQuantityMin();
10281 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10282
10284 {
10285 ComponentEnergyManager comp = GetCompEM();
10287 {
10289 }
10290 }
10292 {
10294
10295 }
10296
10297 }
10298 }
10299 }
10300
10303 {
10304 EntityAI parent = GetHierarchyParent();
10305
10306 if (parent)
10307 {
10308 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10309 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10310 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10311 }
10312 }
10313
10316 {
10317 EntityAI parent = GetHierarchyParent();
10318
10319 if (parent)
10320 {
10321 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10322 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10323 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10324 }
10325 }
10326
10328 {
10329
10330
10331
10332
10334
10336 {
10337 if (ScriptInputUserData.CanStoreInputUserData())
10338 {
10339 ScriptInputUserData ctx = new ScriptInputUserData;
10345 ctx.
Write(use_stack_max);
10348
10350 {
10351 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10352 }
10353 }
10354 }
10355 else if (!
g_Game.IsMultiplayer())
10356 {
10358 }
10359 }
10360
10362 {
10364 }
10365
10367 {
10369 }
10370
10372 {
10374 }
10375
10377 {
10378
10379 return false;
10380 }
10381
10383 {
10384 return false;
10385 }
10386
10390 {
10391 return false;
10392 }
10393
10395 {
10396 return "";
10397 }
10398
10400
10402 {
10403 return false;
10404 }
10405
10407 {
10408 return true;
10409 }
10410
10411
10412
10414 {
10415 return true;
10416 }
10417
10419 {
10420 return true;
10421 }
10422
10424 {
10425 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10427 }
10428
10430 {
10432 }
10433
10435 {
10437 if (!is_being_placed)
10439 SetSynchDirty();
10440 }
10441
10442
10444
10446 {
10448 }
10449
10451 {
10453 }
10454
10456 {
10457 return 1;
10458 }
10459
10461 {
10462 return false;
10463 }
10464
10466 {
10468 SetSynchDirty();
10469 }
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10506 {
10507 super.OnMovedInsideCargo(container);
10508
10509 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10510 }
10511
10512 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10513 {
10514 super.EEItemLocationChanged(oldLoc, newLoc);
10515
10516 PlayerBase newPlayer = null;
10517 PlayerBase oldPlayer = null;
10518
10519 if (newLoc.GetParent())
10520 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10521
10522 if (oldLoc.GetParent())
10523 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10524
10526 {
10527 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10528
10529 if (rIndex >= 0)
10530 {
10531 InventoryLocation rIl = new InventoryLocation;
10532 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10533
10534 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10537 {
10538 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10539 }
10541 {
10543 }
10544
10545 }
10546 }
10547
10549 {
10550 if (newPlayer)
10551 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10552
10553 if (newPlayer == oldPlayer)
10554 {
10555 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10556 {
10558 {
10559 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10560 {
10561 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10562 }
10563 }
10564 else
10565 {
10566 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10567 }
10568 }
10569
10570 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10571 {
10572 int type = oldLoc.GetType();
10574 {
10575 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10576 }
10578 {
10579 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10580 }
10581 }
10582 if (!m_OldLocation)
10583 {
10584 m_OldLocation = new InventoryLocation;
10585 }
10586 m_OldLocation.Copy(oldLoc);
10587 }
10588 else
10589 {
10590 if (m_OldLocation)
10591 {
10592 m_OldLocation.Reset();
10593 }
10594 }
10595
10596 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10597 }
10598 else
10599 {
10600 if (newPlayer)
10601 {
10602 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10603 if (resIndex >= 0)
10604 {
10605 InventoryLocation il = new InventoryLocation;
10606 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10608 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10611 {
10612 il.
GetParent().GetOnReleaseLock().Invoke(it);
10613 }
10615 {
10617 }
10618
10619 }
10620 }
10622 {
10623
10625 }
10626
10627 if (m_OldLocation)
10628 {
10629 m_OldLocation.Reset();
10630 }
10631 }
10632
10634 {
10635 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10636 }
10637
10639 {
10640 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10641 }
10642 }
10643
10644 override void EOnContact(IEntity other, Contact extra)
10645 {
10647 {
10648 int liquidType = -1;
10650 if (impactSpeed > 0.0)
10651 {
10653 #ifndef SERVER
10655 #else
10657 SetSynchDirty();
10658 #endif
10660 }
10661 }
10662
10663 #ifdef SERVER
10664 if (GetCompEM() && GetCompEM().IsPlugged())
10665 {
10666 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10667 GetCompEM().UnplugThis();
10668 }
10669 #endif
10670 }
10671
10673
10675 {
10677 }
10678
10680 {
10681
10682 }
10683
10685 {
10686 super.OnItemLocationChanged(old_owner, new_owner);
10687
10688 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10689 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10690
10691 if (!relatedPlayer && playerNew)
10692 relatedPlayer = playerNew;
10693
10694 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10695 {
10697 if (actionMgr)
10698 {
10699 ActionBase currentAction = actionMgr.GetRunningAction();
10700 if (currentAction)
10702 }
10703 }
10704
10705 Man ownerPlayerOld = null;
10706 Man ownerPlayerNew = null;
10707
10708 if (old_owner)
10709 {
10710 if (old_owner.
IsMan())
10711 {
10712 ownerPlayerOld = Man.Cast(old_owner);
10713 }
10714 else
10715 {
10716 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10717 }
10718 }
10719 else
10720 {
10722 {
10724
10725 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10726 {
10727 GetCompEM().UnplugThis();
10728 }
10729 }
10730 }
10731
10732 if (new_owner)
10733 {
10734 if (new_owner.
IsMan())
10735 {
10736 ownerPlayerNew = Man.Cast(new_owner);
10737 }
10738 else
10739 {
10740 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10741 }
10742 }
10743
10744 if (ownerPlayerOld != ownerPlayerNew)
10745 {
10746 if (ownerPlayerOld)
10747 {
10748 array<EntityAI> subItemsExit = new array<EntityAI>;
10750 for (int i = 0; i < subItemsExit.Count(); i++)
10751 {
10754 }
10755 }
10756
10757 if (ownerPlayerNew)
10758 {
10759 array<EntityAI> subItemsEnter = new array<EntityAI>;
10761 for (int j = 0; j < subItemsEnter.Count(); j++)
10762 {
10765 }
10766 }
10767 }
10768 else if (ownerPlayerNew != null)
10769 {
10770 PlayerBase nplayer;
10771 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10772 {
10773 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10775 for (int k = 0; k < subItemsUpdate.Count(); k++)
10776 {
10778 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10779 }
10780 }
10781 }
10782
10783 if (old_owner)
10784 old_owner.OnChildItemRemoved(this);
10785 if (new_owner)
10786 new_owner.OnChildItemReceived(this);
10787 }
10788
10789
10791 {
10792 super.EEDelete(parent);
10793 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10794 if (player)
10795 {
10797
10798 if (player.IsAlive())
10799 {
10800 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10801 if (r_index >= 0)
10802 {
10803 InventoryLocation r_il = new InventoryLocation;
10804 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10805
10806 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10809 {
10810 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10811 }
10813 {
10814 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10815 }
10816
10817 }
10818
10819 player.RemoveQuickBarEntityShortcut(this);
10820 }
10821 }
10822 }
10823
10825 {
10826 super.EEKilled(killer);
10827
10830 {
10831 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10832 {
10833 if (IsMagazine())
10834 {
10835 if (Magazine.Cast(this).GetAmmoCount() > 0)
10836 {
10838 }
10839 }
10840 else
10841 {
10843 }
10844 }
10845 }
10846 }
10847
10849 {
10850 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10851
10852 super.OnWasAttached(parent, slot_id);
10853
10856
10859 }
10860
10862 {
10863 super.OnWasDetached(parent, slot_id);
10864
10867
10870 }
10871
10873 {
10874 int idx;
10877
10878 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10879 if (inventory_slots.Count() < 1)
10880 {
10881 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10882 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10883 }
10884 else
10885 {
10886 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10887 }
10888
10889 idx = inventory_slots.Find(slot);
10890 if (idx < 0)
10891 return "";
10892
10893 return attach_types.Get(idx);
10894 }
10895
10897 {
10898 int idx = -1;
10899 string slot;
10900
10903
10904 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10905 if (inventory_slots.Count() < 1)
10906 {
10907 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10908 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10909 }
10910 else
10911 {
10912 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10913 if (detach_types.Count() < 1)
10914 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10915 }
10916
10917 for (int i = 0; i < inventory_slots.Count(); i++)
10918 {
10919 slot = inventory_slots.Get(i);
10920 }
10921
10922 if (slot != "")
10923 {
10924 if (detach_types.Count() == 1)
10925 idx = 0;
10926 else
10927 idx = inventory_slots.Find(slot);
10928 }
10929 if (idx < 0)
10930 return "";
10931
10932 return detach_types.Get(idx);
10933 }
10934
10936 {
10937
10939
10940
10941 float min_time = 1;
10942 float max_time = 3;
10943 float delay = Math.RandomFloat(min_time, max_time);
10944
10945 explode_timer.Run(delay, this, "DoAmmoExplosion");
10946 }
10947
10949 {
10950 Magazine magazine = Magazine.Cast(this);
10951 int pop_sounds_count = 6;
10952 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10953
10954
10955 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10956 string sound_name = pop_sounds[ sound_idx ];
10957 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10958
10959
10960 magazine.ServerAddAmmoCount(-1);
10961
10962
10963 float min_temp_to_explode = 100;
10964
10965 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10966 {
10968 }
10969 }
10970
10971
10972 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10973 {
10974 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10975
10976 const int CHANCE_DAMAGE_CARGO = 4;
10977 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10978 const int CHANCE_DAMAGE_NOTHING = 2;
10979
10981 {
10982 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10983 int chances;
10984 int rnd;
10985
10986 if (GetInventory().GetCargo())
10987 {
10988 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10989 rnd = Math.RandomInt(0,chances);
10990
10991 if (rnd < CHANCE_DAMAGE_CARGO)
10992 {
10994 }
10995 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10996 {
10998 }
10999 }
11000 else
11001 {
11002 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11003 rnd = Math.RandomInt(0,chances);
11004
11005 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11006 {
11008 }
11009 }
11010 }
11011 }
11012
11014 {
11015 CargoBase cargo = GetInventory().GetCargo();
11016 if (cargo)
11017 {
11019 if (item_count > 0)
11020 {
11021 int random_pick = Math.RandomInt(0, item_count);
11023 if (!item.IsExplosive())
11024 {
11025 item.AddHealth("","",damage);
11026 return true;
11027 }
11028 }
11029 }
11030 return false;
11031 }
11032
11034 {
11035 GameInventory inventory = GetInventory();
11037 if (attachment_count > 0)
11038 {
11039 int random_pick = Math.RandomInt(0, attachment_count);
11041 if (!attachment.IsExplosive())
11042 {
11043 attachment.AddHealth("","",damage);
11044 return true;
11045 }
11046 }
11047 return false;
11048 }
11049
11051 {
11053 }
11054
11056 {
11058 return GetInventory().CanRemoveEntity();
11059
11060 return false;
11061 }
11062
11064 {
11065
11067 return false;
11068
11069
11071 return false;
11072
11073
11074
11076 if (delta == 0)
11077 return false;
11078
11079
11080 return true;
11081 }
11082
11084 {
11086 {
11087 if (ScriptInputUserData.CanStoreInputUserData())
11088 {
11089 ScriptInputUserData ctx = new ScriptInputUserData;
11094 ctx.
Write(destination_entity);
11096 ctx.
Write(slot_id);
11098 }
11099 }
11100 else if (!
g_Game.IsMultiplayer())
11101 {
11103 }
11104 }
11105
11107 {
11108 float split_quantity_new;
11112 InventoryLocation loc = new InventoryLocation;
11113
11114 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11115 {
11117 split_quantity_new = stack_max;
11118 else
11120
11122 {
11123 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11124 if (new_item)
11125 {
11126 new_item.SetResultOfSplit(true);
11127 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11129 new_item.
SetQuantity(split_quantity_new,
false,
true);
11130 }
11131 }
11132 }
11133 else if (destination_entity && slot_id == -1)
11134 {
11135 if (quantity > stack_max)
11136 split_quantity_new = stack_max;
11137 else
11138 split_quantity_new = quantity;
11139
11141 {
11142 GameInventory destinationInventory = destination_entity.GetInventory();
11144 {
11147 }
11148
11149 if (new_item)
11150 {
11151 new_item.SetResultOfSplit(true);
11152 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11154 new_item.
SetQuantity(split_quantity_new,
false,
true);
11155 }
11156 }
11157 }
11158 else
11159 {
11160 if (stack_max != 0)
11161 {
11163 {
11165 }
11166
11167 if (split_quantity_new == 0)
11168 {
11169 if (!
g_Game.IsMultiplayer())
11170 player.PhysicalPredictiveDropItem(this);
11171 else
11172 player.ServerDropEntity(this);
11173 return;
11174 }
11175
11177 {
11179
11180 if (new_item)
11181 {
11182 new_item.SetResultOfSplit(true);
11183 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11186 new_item.PlaceOnSurface();
11187 }
11188 }
11189 }
11190 }
11191 }
11192
11194 {
11195 float split_quantity_new;
11199 InventoryLocation loc = new InventoryLocation;
11200
11201 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11202 {
11204 split_quantity_new = stack_max;
11205 else
11207
11209 {
11210 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11211 if (new_item)
11212 {
11213 new_item.SetResultOfSplit(true);
11214 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11216 new_item.
SetQuantity(split_quantity_new,
false,
true);
11217 }
11218 }
11219 }
11220 else if (destination_entity && slot_id == -1)
11221 {
11222 if (quantity > stack_max)
11223 split_quantity_new = stack_max;
11224 else
11225 split_quantity_new = quantity;
11226
11228 {
11229 GameInventory destinationInventory = destination_entity.GetInventory();
11231 {
11234 }
11235
11236 if (new_item)
11237 {
11238 new_item.SetResultOfSplit(true);
11239 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11241 new_item.
SetQuantity(split_quantity_new,
false,
true);
11242 }
11243 }
11244 }
11245 else
11246 {
11247 if (stack_max != 0)
11248 {
11250 {
11252 }
11253
11255 {
11257
11258 if (new_item)
11259 {
11260 new_item.SetResultOfSplit(true);
11261 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11264 new_item.PlaceOnSurface();
11265 }
11266 }
11267 }
11268 }
11269 }
11270
11272 {
11274 {
11275 if (ScriptInputUserData.CanStoreInputUserData())
11276 {
11277 ScriptInputUserData ctx = new ScriptInputUserData;
11282 dst.WriteToContext(ctx);
11284 }
11285 }
11286 else if (!
g_Game.IsMultiplayer())
11287 {
11289 }
11290 }
11291
11293 {
11295 {
11296 if (ScriptInputUserData.CanStoreInputUserData())
11297 {
11298 ScriptInputUserData ctx = new ScriptInputUserData;
11303 ctx.
Write(destination_entity);
11309 }
11310 }
11311 else if (!
g_Game.IsMultiplayer())
11312 {
11314 }
11315 }
11316
11318 {
11320 }
11321
11323 {
11325 float split_quantity_new;
11327 if (dst.IsValid())
11328 {
11329 int slot_id = dst.GetSlot();
11331
11332 if (quantity > stack_max)
11333 split_quantity_new = stack_max;
11334 else
11335 split_quantity_new = quantity;
11336
11338 {
11340
11341 if (new_item)
11342 {
11343 new_item.SetResultOfSplit(true);
11344 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11346 new_item.
SetQuantity(split_quantity_new,
false,
true);
11347 }
11348
11349 return new_item;
11350 }
11351 }
11352
11353 return null;
11354 }
11355
11357 {
11359 float split_quantity_new;
11361 if (destination_entity)
11362 {
11364 if (quantity > stackable)
11365 split_quantity_new = stackable;
11366 else
11367 split_quantity_new = quantity;
11368
11370 {
11371 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11372 if (new_item)
11373 {
11374 new_item.SetResultOfSplit(true);
11375 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11377 new_item.
SetQuantity(split_quantity_new,
false,
true);
11378 }
11379 }
11380 }
11381 }
11382
11384 {
11386 {
11387 if (ScriptInputUserData.CanStoreInputUserData())
11388 {
11389 ScriptInputUserData ctx = new ScriptInputUserData;
11394 ItemBase destination_entity =
this;
11395 ctx.
Write(destination_entity);
11399 }
11400 }
11401 else if (!
g_Game.IsMultiplayer())
11402 {
11404 }
11405 }
11406
11408 {
11410 float split_quantity_new;
11412 if (player)
11413 {
11415 if (quantity > stackable)
11416 split_quantity_new = stackable;
11417 else
11418 split_quantity_new = quantity;
11419
11421 {
11422 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11423 new_item =
ItemBase.Cast(in_hands);
11424 if (new_item)
11425 {
11426 new_item.SetResultOfSplit(true);
11427 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11429 new_item.SetQuantity(split_quantity_new, false, true);
11430 }
11431 }
11432 }
11433 }
11434
11436 {
11438 float split_quantity_new = Math.Floor(quantity * 0.5);
11439
11441 return;
11442
11444
11445 if (new_item)
11446 {
11447 if (new_item.GetQuantityMax() < split_quantity_new)
11448 {
11449 split_quantity_new = new_item.GetQuantityMax();
11450 }
11451
11452 new_item.SetResultOfSplit(true);
11453 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11454
11456 {
11459 }
11460 else
11461 {
11463 new_item.
SetQuantity(split_quantity_new,
false,
true);
11464 }
11465 }
11466 }
11467
11469 {
11471 float split_quantity_new = Math.Floor(quantity / 2);
11472
11474 return;
11475
11476 InventoryLocation invloc = new InventoryLocation;
11478
11480 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11481
11482 if (new_item)
11483 {
11484 if (new_item.GetQuantityMax() < split_quantity_new)
11485 {
11486 split_quantity_new = new_item.GetQuantityMax();
11487 }
11489 {
11492 }
11493 else if (split_quantity_new > 1)
11494 {
11496 new_item.
SetQuantity(split_quantity_new,
false,
true);
11497 }
11498 }
11499 }
11500
11503 {
11504 SetWeightDirty();
11506
11507 if (parent)
11508 parent.OnAttachmentQuantityChangedEx(this, delta);
11509
11511 {
11513 {
11515 }
11517 {
11518 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11520 }
11521 }
11522 }
11523
11526 {
11527
11528 }
11529
11532 {
11534 }
11535
11537 {
11538 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11539
11541 {
11542 if (newLevel == GameConstants.STATE_RUINED)
11543 {
11545 EntityAI parent = GetHierarchyParent();
11546 if (parent && parent.IsFireplace())
11547 {
11548 CargoBase cargo = GetInventory().GetCargo();
11549 if (cargo)
11550 {
11552 {
11554 }
11555 }
11556 }
11557 }
11558
11560 {
11561
11563 return;
11564 }
11565
11566 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11567 {
11569 }
11570 }
11571 }
11572
11573
11575 {
11576 super.OnRightClick();
11577
11579 {
11581 {
11582 if (ScriptInputUserData.CanStoreInputUserData())
11583 {
11584 EntityAI root = GetHierarchyRoot();
11585 Man playerOwner = GetHierarchyRootPlayer();
11586 InventoryLocation dst = new InventoryLocation;
11587
11588
11589 if (!playerOwner && root && root == this)
11590 {
11592 }
11593 else
11594 {
11595
11596 GetInventory().GetCurrentInventoryLocation(dst);
11598 {
11599 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11601 {
11603 }
11604 else
11605 {
11607
11608
11609 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11610 {
11612 }
11613 else
11614 {
11615 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11616 }
11617 }
11618 }
11619 }
11620
11621 ScriptInputUserData ctx = new ScriptInputUserData;
11629 }
11630 }
11631 else if (!
g_Game.IsMultiplayer())
11632 {
11634 }
11635 }
11636 }
11637
11639 {
11640 if (root)
11641 {
11642 vector m4[4];
11643 root.GetTransform(m4);
11644 dst.SetGround(this, m4);
11645 }
11646 else
11647 {
11648 GetInventory().GetCurrentInventoryLocation(dst);
11649 }
11650 }
11651
11652 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11653 {
11654
11655 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11656 return false;
11657
11658 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11659 return false;
11660
11661
11663 return false;
11664
11665
11666 Magazine mag = Magazine.Cast(this);
11667 if (mag)
11668 {
11669 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11670 return false;
11671
11672 if (stack_max_limit)
11673 {
11674 Magazine other_mag = Magazine.Cast(other_item);
11675 if (other_item)
11676 {
11677 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11678 return false;
11679 }
11680
11681 }
11682 }
11683 else
11684 {
11685
11687 return false;
11688
11690 return false;
11691 }
11692
11693 PlayerBase player = null;
11694 if (CastTo(player, GetHierarchyRootPlayer()))
11695 {
11696 if (player.GetInventory().HasAttachment(this))
11697 return false;
11698
11699 if (player.IsItemsToDelete())
11700 return false;
11701 }
11702
11703 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11704 return false;
11705
11706 int slotID;
11708 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11709 return false;
11710
11711 return true;
11712 }
11713
11715 {
11717 }
11718
11720 {
11721 return m_IsResultOfSplit;
11722 }
11723
11725 {
11726 m_IsResultOfSplit = value;
11727 }
11728
11730 {
11732 }
11733
11735 {
11736 float other_item_quantity = other_item.GetQuantity();
11737 float this_free_space;
11738
11740
11742
11743 if (other_item_quantity > this_free_space)
11744 {
11745 return this_free_space;
11746 }
11747 else
11748 {
11749 return other_item_quantity;
11750 }
11751 }
11752
11754 {
11756 }
11757
11759 {
11761 return;
11762
11763 if (!IsMagazine() && other_item)
11764 {
11766 if (quantity_used != 0)
11767 {
11768 float hp1 = GetHealth01("","");
11769 float hp2 = other_item.GetHealth01("","");
11770 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11771 hpResult = hpResult / (
GetQuantity() + quantity_used);
11772
11773 hpResult *= GetMaxHealth();
11774 Math.Round(hpResult);
11775 SetHealth("", "Health", hpResult);
11776
11778 other_item.AddQuantity(-quantity_used);
11779 }
11780 }
11782 }
11783
11785 {
11786 #ifdef SERVER
11787 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11788 GetHierarchyParent().IncreaseLifetimeUp();
11789 #endif
11790 };
11791
11793 {
11794 PlayerBase p = PlayerBase.Cast(player);
11795
11796 array<int> recipesIds = p.m_Recipes;
11797 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11798 if (moduleRecipesManager)
11799 {
11800 EntityAI itemInHands = player.GetEntityInHands();
11801 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11802 }
11803
11804 for (int i = 0;i < recipesIds.Count(); i++)
11805 {
11806 int key = recipesIds.Get(i);
11807 string recipeName = moduleRecipesManager.GetRecipeName(key);
11809 }
11810 }
11811
11812
11813 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11814 {
11815 super.GetDebugActions(outputList);
11816
11817
11823
11824
11829
11834
11835
11839
11840
11842 {
11846 }
11847
11850
11851
11855
11857
11858 InventoryLocation loc = new InventoryLocation();
11859 GetInventory().GetCurrentInventoryLocation(loc);
11861 {
11862 if (Gizmo_IsSupported())
11865 }
11866
11868 }
11869
11870
11871
11872
11874 {
11875 super.OnAction(action_id, player, ctx);
11876
11878 {
11879 switch (action_id)
11880 {
11884 return true;
11888 return true;
11889 }
11890 }
11891
11893 {
11894 switch (action_id)
11895 {
11897 Delete();
11898 return true;
11899 }
11900 }
11901
11902 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11903 {
11904 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11905 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11906 PlayerBase p = PlayerBase.Cast(player);
11907 if (
EActions.RECIPES_RANGE_START < 1000)
11908 {
11909 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11910 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11911 }
11912 }
11913 #ifndef SERVER
11914 else if (action_id ==
EActions.WATCH_PLAYER)
11915 {
11916 PluginDeveloper.SetDeveloperItemClientEx(player);
11917 }
11918 #endif
11920 {
11921 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11922 {
11923 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11924 OnDebugButtonPressServer(id + 1);
11925 }
11926
11927 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11928 {
11929 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11931 }
11932
11933 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11934 {
11935 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11937 }
11938
11939 else if (action_id ==
EActions.ADD_QUANTITY)
11940 {
11941 if (IsMagazine())
11942 {
11943 Magazine mag = Magazine.Cast(this);
11944 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11945 }
11946 else
11947 {
11949 }
11950
11951 if (m_EM)
11952 {
11953 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11954 }
11955
11956 }
11957
11958 else if (action_id ==
EActions.REMOVE_QUANTITY)
11959 {
11960 if (IsMagazine())
11961 {
11962 Magazine mag2 = Magazine.Cast(this);
11963 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11964 }
11965 else
11966 {
11968 }
11969 if (m_EM)
11970 {
11971 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11972 }
11973
11974 }
11975
11976 else if (action_id ==
EActions.SET_QUANTITY_0)
11977 {
11979
11980 if (m_EM)
11981 {
11982 m_EM.SetEnergy(0);
11983 }
11984 }
11985
11986 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11987 {
11989
11990 if (m_EM)
11991 {
11992 m_EM.SetEnergy(m_EM.GetEnergyMax());
11993 }
11994 }
11995
11996 else if (action_id ==
EActions.ADD_HEALTH)
11997 {
11998 AddHealth("","",GetMaxHealth("","Health")/5);
11999 }
12000 else if (action_id ==
EActions.REMOVE_HEALTH)
12001 {
12002 AddHealth("","",-GetMaxHealth("","Health")/5);
12003 }
12004 else if (action_id ==
EActions.DESTROY_HEALTH)
12005 {
12006 SetHealth01("","",0);
12007 }
12008 else if (action_id ==
EActions.WATCH_ITEM)
12009 {
12011 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12012 #ifdef DEVELOPER
12013 SetDebugDeveloper_item(this);
12014 #endif
12015 }
12016
12017 else if (action_id ==
EActions.ADD_TEMPERATURE)
12018 {
12019 AddTemperature(20);
12020
12021 }
12022
12023 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12024 {
12025 AddTemperature(-20);
12026
12027 }
12028
12029 else if (action_id ==
EActions.FLIP_FROZEN)
12030 {
12031 SetFrozen(!GetIsFrozen());
12032
12033 }
12034
12035 else if (action_id ==
EActions.ADD_WETNESS)
12036 {
12038
12039 }
12040
12041 else if (action_id ==
EActions.REMOVE_WETNESS)
12042 {
12044
12045 }
12046
12047 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12048 {
12051
12052
12053 }
12054
12055 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12056 {
12059 }
12060
12061 else if (action_id ==
EActions.MAKE_SPECIAL)
12062 {
12063 auto debugParams = DebugSpawnParams.WithPlayer(player);
12064 OnDebugSpawnEx(debugParams);
12065 }
12066
12067 }
12068
12069
12070 return false;
12071 }
12072
12073
12074
12075
12079
12082
12083
12084
12086 {
12087 return false;
12088 }
12089
12090
12092 {
12093 return true;
12094 }
12095
12096
12098 {
12099 return true;
12100 }
12101
12102
12103
12105 {
12106 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12107 return g_Game.ConfigIsExisting(config_path);
12108 }
12109
12112 {
12113 return null;
12114 }
12115
12117 {
12118 return false;
12119 }
12120
12122 {
12123 return false;
12124 }
12125
12129
12130
12132 {
12133 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12134 return module_repairing.CanRepair(this, item_repair_kit);
12135 }
12136
12137
12138 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12139 {
12140 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12141 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12142 }
12143
12144
12146 {
12147
12148
12149
12150
12151
12152
12153
12154
12155 return 1;
12156 }
12157
12158
12159
12161 {
12163 }
12164
12165
12166
12168 {
12170 }
12171
12172
12181 {
12182 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12183
12184 if (player)
12185 {
12186 player.MessageStatus(text);
12187 }
12188 }
12189
12190
12199 {
12200 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12201
12202 if (player)
12203 {
12204 player.MessageAction(text);
12205 }
12206 }
12207
12208
12217 {
12218 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12219
12220 if (player)
12221 {
12222 player.MessageFriendly(text);
12223 }
12224 }
12225
12226
12235 {
12236 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12237
12238 if (player)
12239 {
12240 player.MessageImportant(text);
12241 }
12242 }
12243
12245 {
12246 return true;
12247 }
12248
12249
12250 override bool KindOf(
string tag)
12251 {
12252 bool found = false;
12253 string item_name = this.
GetType();
12255 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12256
12257 int array_size = item_tag_array.Count();
12258 for (int i = 0; i < array_size; i++)
12259 {
12260 if (item_tag_array.Get(i) == tag)
12261 {
12262 found = true;
12263 break;
12264 }
12265 }
12266 return found;
12267 }
12268
12269
12271 {
12272
12273 super.OnRPC(sender, rpc_type,ctx);
12274
12275
12276 switch (rpc_type)
12277 {
12278 #ifndef SERVER
12279 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12280 Param2<bool, string> p = new Param2<bool, string>(false, "");
12281
12283 return;
12284
12285 bool play = p.param1;
12286 string soundSet = p.param2;
12287
12288 if (play)
12289 {
12291 {
12293 {
12295 }
12296 }
12297 else
12298 {
12300 }
12301 }
12302 else
12303 {
12305 }
12306
12307 break;
12308 #endif
12309
12310 }
12311
12313 {
12315 }
12316 }
12317
12318
12319
12320
12322 {
12323 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12324 return plugin.GetID(
name);
12325 }
12326
12328 {
12329 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12330 return plugin.GetName(id);
12331 }
12332
12335 {
12336
12337
12338 int varFlags;
12339 if (!ctx.
Read(varFlags))
12340 return;
12341
12342 if (varFlags & ItemVariableFlags.FLOAT)
12343 {
12345 }
12346 }
12347
12349 {
12350
12351 super.SerializeNumericalVars(floats_out);
12352
12353
12354
12356 {
12358 }
12359
12361 {
12363 }
12364
12366 {
12368 }
12369
12371 {
12376 }
12377
12379 {
12381 }
12382 }
12383
12385 {
12386
12387 super.DeSerializeNumericalVars(floats);
12388
12389
12390 int index = 0;
12391 int mask = Math.Round(floats.Get(index));
12392
12393 index++;
12394
12396 {
12398 {
12400 }
12401 else
12402 {
12403 float quantity = floats.Get(index);
12404 SetQuantity(quantity,
true,
false,
false,
false);
12405 }
12406 index++;
12407 }
12408
12410 {
12411 float wet = floats.Get(index);
12413 index++;
12414 }
12415
12417 {
12418 int liquidtype = Math.Round(floats.Get(index));
12420 index++;
12421 }
12422
12424 {
12426 index++;
12428 index++;
12430 index++;
12432 index++;
12433 }
12434
12436 {
12437 int cleanness = Math.Round(floats.Get(index));
12439 index++;
12440 }
12441 }
12442
12444 {
12445 super.WriteVarsToCTX(ctx);
12446
12447
12449 {
12451 }
12452
12454 {
12456 }
12457
12459 {
12461 }
12462
12464 {
12465 int r,g,b,a;
12471 }
12472
12474 {
12476 }
12477 }
12478
12480 {
12481 if (!super.ReadVarsFromCTX(ctx,version))
12482 return false;
12483
12484 int intValue;
12485 float value;
12486
12487 if (version < 140)
12488 {
12489 if (!ctx.
Read(intValue))
12490 return false;
12491
12492 m_VariablesMask = intValue;
12493 }
12494
12496 {
12497 if (!ctx.
Read(value))
12498 return false;
12499
12501 {
12503 }
12504 else
12505 {
12507 }
12508 }
12509
12510 if (version < 140)
12511 {
12513 {
12514 if (!ctx.
Read(value))
12515 return false;
12516 SetTemperatureDirect(value);
12517 }
12518 }
12519
12521 {
12522 if (!ctx.
Read(value))
12523 return false;
12525 }
12526
12528 {
12529 if (!ctx.
Read(intValue))
12530 return false;
12532 }
12533
12535 {
12536 int r,g,b,a;
12538 return false;
12540 return false;
12542 return false;
12544 return false;
12545
12547 }
12548
12550 {
12551 if (!ctx.
Read(intValue))
12552 return false;
12554 }
12555
12556 if (version >= 138 && version < 140)
12557 {
12559 {
12560 if (!ctx.
Read(intValue))
12561 return false;
12562 SetFrozen(intValue);
12563 }
12564 }
12565
12566 return true;
12567 }
12568
12569
12571 {
12574 {
12576 }
12577
12578 if (!super.OnStoreLoad(ctx, version))
12579 {
12581 return false;
12582 }
12583
12584 if (version >= 114)
12585 {
12586 bool hasQuickBarIndexSaved;
12587
12588 if (!ctx.
Read(hasQuickBarIndexSaved))
12589 {
12591 return false;
12592 }
12593
12594 if (hasQuickBarIndexSaved)
12595 {
12596 int itmQBIndex;
12597
12598
12599 if (!ctx.
Read(itmQBIndex))
12600 {
12602 return false;
12603 }
12604
12605 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12606 if (itmQBIndex != -1 && parentPlayer)
12607 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12608 }
12609 }
12610 else
12611 {
12612
12613 PlayerBase player;
12614 int itemQBIndex;
12615 if (version ==
int.
MAX)
12616 {
12617 if (!ctx.
Read(itemQBIndex))
12618 {
12620 return false;
12621 }
12622 }
12623 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12624 {
12625
12626 if (!ctx.
Read(itemQBIndex))
12627 {
12629 return false;
12630 }
12631 if (itemQBIndex != -1 && player)
12632 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12633 }
12634 }
12635
12636 if (version < 140)
12637 {
12638
12639 if (!LoadVariables(ctx, version))
12640 {
12642 return false;
12643 }
12644 }
12645
12646
12648 {
12650 return false;
12651 }
12652 if (version >= 132)
12653 {
12655 if (raib)
12656 {
12658 {
12660 return false;
12661 }
12662 }
12663 }
12664
12666 return true;
12667 }
12668
12669
12670
12672 {
12673 super.OnStoreSave(ctx);
12674
12675 PlayerBase player;
12676 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12677 {
12679
12680 int itemQBIndex = -1;
12681 itemQBIndex = player.FindQuickBarEntityIndex(this);
12682 ctx.
Write(itemQBIndex);
12683 }
12684 else
12685 {
12687 }
12688
12690
12692 if (raib)
12693 {
12695 }
12696 }
12697
12698
12700 {
12701 super.AfterStoreLoad();
12702
12704 {
12706 }
12707
12709 {
12712 }
12713 }
12714
12716 {
12717 super.EEOnAfterLoad();
12718
12720 {
12722 }
12723
12726 }
12727
12729 {
12730 return false;
12731 }
12732
12733
12734
12736 {
12738 {
12739 #ifdef PLATFORM_CONSOLE
12740
12742 {
12744 if (menu)
12745 {
12747 }
12748 }
12749 #endif
12750 }
12751
12753 {
12756 }
12757
12759 {
12760 SetWeightDirty();
12762 }
12764 {
12767 }
12768
12770 {
12773
12776 }
12778 {
12782 }
12783
12784 super.OnVariablesSynchronized();
12785 }
12786
12787
12788
12790 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12791 {
12792 if (!IsServerCheck(allow_client))
12793 return false;
12794
12796 return false;
12797
12800
12801 if (value <= (min + 0.001))
12802 value = min;
12803
12804 if (value == min)
12805 {
12806 if (destroy_config)
12807 {
12808 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12809 if (dstr)
12810 {
12812 this.Delete();
12813 return true;
12814 }
12815 }
12816 else if (destroy_forced)
12817 {
12819 this.Delete();
12820 return true;
12821 }
12822
12824 }
12825
12828
12830 {
12831 EntityAI parent = GetHierarchyRoot();
12832 InventoryLocation iLoc = new InventoryLocation();
12833 GetInventory().GetCurrentInventoryLocation(iLoc);
12835 {
12836 int iLocSlot = iLoc.
GetSlot();
12838 {
12840 }
12842 {
12844 }
12845 }
12846 }
12847
12849 {
12851
12852 if (delta)
12854 }
12855
12857
12858 return false;
12859 }
12860
12861
12863 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12864 {
12866 }
12867
12869 {
12872 }
12873
12875 {
12878 }
12879
12881 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12882 {
12883 float value_clamped = Math.Clamp(value, 0, 1);
12885 SetQuantity(result, destroy_config, destroy_forced);
12886 }
12887
12888
12891 {
12893 }
12894
12896 {
12898 }
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12910 {
12911 int slot = -1;
12912 GameInventory inventory = GetInventory();
12913 if (inventory)
12914 {
12915 InventoryLocation il = new InventoryLocation;
12918 }
12919
12921 }
12922
12924 {
12925 float quantity_max = 0;
12926
12928 {
12929 if (attSlotID != -1)
12930 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12931
12932 if (quantity_max <= 0)
12934 }
12935
12936 if (quantity_max <= 0)
12938
12939 return quantity_max;
12940 }
12941
12943 {
12945 }
12946
12948 {
12950 }
12951
12952
12954 {
12956 }
12957
12959 {
12961 }
12962
12964 {
12966 }
12967
12968
12970 {
12971
12972 float weightEx = GetWeightEx();
12973 float special = GetInventoryAndCargoWeight();
12974 return weightEx - special;
12975 }
12976
12977
12979 {
12981 }
12982
12984 {
12986 {
12987 #ifdef DEVELOPER
12988 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12989 {
12990 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12992 }
12993 #endif
12994
12995 return GetQuantity() * GetConfigWeightModified();
12996 }
12997 else if (HasEnergyManager())
12998 {
12999 #ifdef DEVELOPER
13000 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13001 {
13002 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13003 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13004 }
13005 #endif
13006 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13007 }
13008 else
13009 {
13010 #ifdef DEVELOPER
13011 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13012 {
13013 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13014 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13015 }
13016 #endif
13017 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13018 }
13019 }
13020
13023 {
13024 int item_count = 0;
13026
13027 GameInventory inventory = GetInventory();
13028 CargoBase cargo = inventory.
GetCargo();
13029 if (cargo != NULL)
13030 {
13032 }
13033
13035 for (int i = 0; i < nAttachments; ++i)
13036 {
13038 if (item)
13039 item_count += item.GetNumberOfItems();
13040 }
13041 return item_count;
13042 }
13043
13046 {
13047 float weight = 0;
13048 float wetness = 1;
13049 if (include_wetness)
13052 {
13053 weight = wetness * m_ConfigWeight;
13054 }
13056 {
13057 weight = 1;
13058 }
13059 return weight;
13060 }
13061
13062
13063
13065 {
13066 GameInventory inventory = GetInventory();
13067 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13068 {
13069 array<EntityAI> items = new array<EntityAI>;
13071 for (int i = 0; i < items.Count(); ++i)
13072 {
13074 if (item)
13075 {
13076 g_Game.ObjectDelete(item);
13077 }
13078 }
13079 }
13080 }
13081
13082
13083
13084
13086 {
13087 float energy = 0;
13088 if (HasEnergyManager())
13089 {
13090 energy = GetCompEM().GetEnergy();
13091 }
13092 return energy;
13093 }
13094
13095
13097 {
13098 super.OnEnergyConsumed();
13099
13101 }
13102
13104 {
13105 super.OnEnergyAdded();
13106
13108 }
13109
13110
13112 {
13113 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13114 {
13116 {
13117 float energy_0to1 = GetCompEM().GetEnergy0To1();
13119 }
13120 }
13121 }
13122
13123
13125 {
13126 return ConfigGetFloat("heatIsolation");
13127 }
13128
13130 {
13132 }
13133
13135 {
13136 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13137 if (
g_Game.ConfigIsExisting(paramPath))
13138 return g_Game.ConfigGetFloat(paramPath);
13139
13140 return 0.0;
13141 }
13142
13144 {
13145 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13146 if (
g_Game.ConfigIsExisting(paramPath))
13147 return g_Game.ConfigGetFloat(paramPath);
13148
13149 return 0.0;
13150 }
13151
13152 override void SetWet(
float value,
bool allow_client =
false)
13153 {
13154 if (!IsServerCheck(allow_client))
13155 return;
13156
13159
13161
13162 m_VarWet = Math.Clamp(value, min, max);
13163
13165 {
13168 }
13169 }
13170
13171 override void AddWet(
float value)
13172 {
13174 }
13175
13177 {
13179 }
13180
13182 {
13184 }
13185
13187 {
13189 }
13190
13192 {
13194 }
13195
13197 {
13199 }
13200
13201 override void OnWetChanged(
float newVal,
float oldVal)
13202 {
13205 if (newLevel != oldLevel)
13206 {
13208 }
13209 }
13210
13212 {
13213 SetWeightDirty();
13214 }
13215
13217 {
13218 return GetWetLevelInternal(
m_VarWet);
13219 }
13220
13221
13222
13224 {
13226 }
13227
13229 {
13231 }
13232
13234 {
13236 }
13237
13239 {
13241 }
13242
13243
13244
13246 {
13247 if (ConfigIsExisting("itemModelLength"))
13248 {
13249 return ConfigGetFloat("itemModelLength");
13250 }
13251 return 0;
13252 }
13253
13255 {
13256 if (ConfigIsExisting("itemAttachOffset"))
13257 {
13258 return ConfigGetFloat("itemAttachOffset");
13259 }
13260 return 0;
13261 }
13262
13263 override void SetCleanness(
int value,
bool allow_client =
false)
13264 {
13265 if (!IsServerCheck(allow_client))
13266 return;
13267
13269
13271
13274 }
13275
13277 {
13279 }
13280
13282 {
13283 return true;
13284 }
13285
13286
13287
13288
13290 {
13292 }
13293
13295 {
13297 }
13298
13299
13300
13301
13302 override void SetColor(
int r,
int g,
int b,
int a)
13303 {
13309 }
13311 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13312 {
13317 }
13318
13320 {
13322 }
13323
13326 {
13327 int r,g,b,a;
13329 r = r/255;
13330 g = g/255;
13331 b = b/255;
13332 a = a/255;
13333 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13334 }
13335
13336
13337
13338 override void SetLiquidType(
int value,
bool allow_client =
false)
13339 {
13340 if (!IsServerCheck(allow_client))
13341 return;
13342
13347 }
13348
13350 {
13351 return ConfigGetInt("varLiquidTypeInit");
13352 }
13353
13355 {
13357 }
13358
13360 {
13362 SetFrozen(false);
13363 }
13364
13367 {
13368 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13369 }
13370
13371
13374 {
13375 PlayerBase nplayer;
13376 if (PlayerBase.CastTo(nplayer, player))
13377 {
13379 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13380 }
13381 }
13382
13383
13386 {
13387 PlayerBase nplayer;
13388 if (PlayerBase.CastTo(nplayer,player))
13389 {
13390 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13391 }
13392
13393 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13394
13395 if (HasEnergyManager())
13396 {
13397 GetCompEM().UpdatePlugState();
13398 }
13399 }
13400
13401
13403 {
13404 super.OnPlacementStarted(player);
13405
13407 }
13408
13409 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13410 {
13412 {
13413 m_AdminLog.OnPlacementComplete(player,
this);
13414 }
13415
13416 super.OnPlacementComplete(player, position, orientation);
13417 }
13418
13419
13420
13421
13422
13424 {
13426 {
13427 return true;
13428 }
13429 else
13430 {
13431 return false;
13432 }
13433 }
13434
13435
13437 {
13439 {
13441 }
13442 }
13443
13444
13446 {
13448 }
13449
13451 {
13453 }
13454
13455 override void InsertAgent(
int agent,
float count = 1)
13456 {
13457 if (count < 1)
13458 return;
13459
13461 }
13462
13465 {
13467 }
13468
13469
13471 {
13473 }
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13517 {
13519 return false;
13520 return true;
13521 }
13522
13524 {
13525
13527 }
13528
13529
13532 {
13533 super.CheckForRoofLimited(timeTresholdMS);
13534
13535 float time =
g_Game.GetTime();
13536 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13537 {
13538 m_PreviousRoofTestTime = time;
13539 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13540 }
13541 }
13542
13543
13545 {
13547 {
13548 return 0;
13549 }
13550
13551 if (GetInventory().GetAttachmentSlotsCount() != 0)
13552 {
13553 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13554 if (filter)
13555 return filter.GetProtectionLevel(type, false, system);
13556 else
13557 return 0;
13558 }
13559
13560 string subclassPath, entryName;
13561
13562 switch (type)
13563 {
13565 entryName = "biological";
13566 break;
13568 entryName = "chemical";
13569 break;
13570 default:
13571 entryName = "biological";
13572 break;
13573 }
13574
13575 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13576
13577 return g_Game.ConfigGetFloat(subclassPath + entryName);
13578 }
13579
13580
13581
13584 {
13585 if (!IsMagazine())
13587
13589 }
13590
13591
13592
13593
13594
13599 {
13600 return true;
13601 }
13602
13604 {
13606 }
13607
13608
13609
13610
13611
13613 {
13614 if (parent)
13615 {
13616 if (parent.IsInherited(DayZInfected))
13617 return true;
13618
13619 if (!parent.IsRuined())
13620 return true;
13621 }
13622
13623 return true;
13624 }
13625
13627 {
13628 if (!super.CanPutAsAttachment(parent))
13629 {
13630 return false;
13631 }
13632
13633 if (!IsRuined() && !parent.IsRuined())
13634 {
13635 return true;
13636 }
13637
13638 return false;
13639 }
13640
13642 {
13643
13644
13645
13646
13647 return super.CanReceiveItemIntoCargo(item);
13648 }
13649
13651 {
13652
13653
13654
13655
13656 GameInventory attachmentInv = attachment.GetInventory();
13658 {
13659 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13660 return false;
13661 }
13662
13663 InventoryLocation loc = new InventoryLocation();
13664 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13665 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13666 return false;
13667
13668 return super.CanReceiveAttachment(attachment, slotId);
13669 }
13670
13672 {
13673 if (!super.CanReleaseAttachment(attachment))
13674 return false;
13675
13676 return GetInventory().AreChildrenAccessible();
13677 }
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13700 {
13701 int id = muzzle_owner.GetMuzzleID();
13702 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13703
13704 if (WPOF_array)
13705 {
13706 for (int i = 0; i < WPOF_array.Count(); i++)
13707 {
13708 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13709
13710 if (WPOF)
13711 {
13712 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13713 }
13714 }
13715 }
13716 }
13717
13718
13720 {
13721 int id = muzzle_owner.GetMuzzleID();
13723
13724 if (WPOBE_array)
13725 {
13726 for (int i = 0; i < WPOBE_array.Count(); i++)
13727 {
13728 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13729
13730 if (WPOBE)
13731 {
13732 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13733 }
13734 }
13735 }
13736 }
13737
13738
13740 {
13741 int id = muzzle_owner.GetMuzzleID();
13742 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13743
13744 if (WPOOH_array)
13745 {
13746 for (int i = 0; i < WPOOH_array.Count(); i++)
13747 {
13748 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13749
13750 if (WPOOH)
13751 {
13752 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13753 }
13754 }
13755 }
13756 }
13757
13758
13760 {
13761 int id = muzzle_owner.GetMuzzleID();
13762 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13763
13764 if (WPOOH_array)
13765 {
13766 for (int i = 0; i < WPOOH_array.Count(); i++)
13767 {
13768 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13769
13770 if (WPOOH)
13771 {
13772 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13773 }
13774 }
13775 }
13776 }
13777
13778
13780 {
13781 int id = muzzle_owner.GetMuzzleID();
13782 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13783
13784 if (WPOOH_array)
13785 {
13786 for (int i = 0; i < WPOOH_array.Count(); i++)
13787 {
13788 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13789
13790 if (WPOOH)
13791 {
13792 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13793 }
13794 }
13795 }
13796 }
13797
13798
13799
13801 {
13803 {
13804 return true;
13805 }
13806
13807 return false;
13808 }
13809
13811 {
13813 {
13814 return true;
13815 }
13816
13817 return false;
13818 }
13819
13821 {
13823 {
13824 return true;
13825 }
13826
13827 return false;
13828 }
13829
13831 {
13832 return false;
13833 }
13834
13837 {
13838 return UATimeSpent.DEFAULT_DEPLOY;
13839 }
13840
13841
13842
13843
13845 {
13847 SetSynchDirty();
13848 }
13849
13851 {
13853 }
13854
13855
13857 {
13858 return false;
13859 }
13860
13863 {
13864 string att_type = "None";
13865
13866 if (ConfigIsExisting("soundAttType"))
13867 {
13868 att_type = ConfigGetString("soundAttType");
13869 }
13870
13872 }
13873
13875 {
13877 }
13878
13879
13880
13881
13882
13888
13890 {
13893
13895 }
13896
13897
13899 {
13901 return;
13902
13904
13907
13910
13911 SoundParameters params = new SoundParameters();
13915 }
13916
13917
13919 {
13921 {
13924
13925 SetSynchDirty();
13926
13929 }
13930 }
13931
13933 {
13935 }
13936
13937
13939 {
13941 return;
13942
13944 SetSynchDirty();
13945
13948 }
13949
13951 {
13954 }
13955
13957 {
13959 }
13960
13961 void OnApply(PlayerBase player);
13962
13964 {
13965 return 1.0;
13966 };
13967
13969 {
13971 }
13972
13974 {
13976 }
13977
13979
13981 {
13982 SetDynamicPhysicsLifeTime(0.01);
13984 }
13985
13987 {
13988 array<string> zone_names = new array<string>;
13989 GetDamageZones(zone_names);
13990 for (int i = 0; i < zone_names.Count(); i++)
13991 {
13992 SetHealthMax(zone_names.Get(i),"Health");
13993 }
13994 SetHealthMax("","Health");
13995 }
13996
13999 {
14000 float global_health = GetHealth01("","Health");
14001 array<string> zones = new array<string>;
14002 GetDamageZones(zones);
14003
14004 for (int i = 0; i < zones.Count(); i++)
14005 {
14006 SetHealth01(zones.Get(i),"Health",global_health);
14007 }
14008 }
14009
14012 {
14013 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14014 }
14015
14017 {
14018 if (!hasRootAsPlayer)
14019 {
14020 if (refParentIB)
14021 {
14022
14023 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14024 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14025
14026 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14027 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14028
14031 }
14032 else
14033 {
14034
14037 }
14038 }
14039 }
14040
14042 {
14044 {
14045 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14046 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14047 {
14048 float heatPermCoef = 1.0;
14050 while (ent)
14051 {
14052 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14053 ent = ent.GetHierarchyParent();
14054 }
14055
14056 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14057 }
14058 }
14059 }
14060
14062 {
14063
14064 EntityAI parent = GetHierarchyParent();
14065 if (!parent)
14066 {
14067 hasParent = false;
14068 hasRootAsPlayer = false;
14069 }
14070 else
14071 {
14072 hasParent = true;
14073 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14074 refParentIB =
ItemBase.Cast(parent);
14075 }
14076 }
14077
14078 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14079 {
14080
14081 }
14082
14084 {
14085
14086 return false;
14087 }
14088
14090 {
14091
14092
14093 return false;
14094 }
14095
14097 {
14098
14099 return false;
14100 }
14101
14104 {
14105 return !GetIsFrozen() &&
IsOpen();
14106 }
14107
14109 {
14110 bool hasParent = false, hasRootAsPlayer = false;
14112
14113 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14114 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14115
14116 if (wwtu || foodDecay)
14117 {
14121
14122 if (processWetness || processTemperature || processDecay)
14123 {
14125
14126 if (processWetness)
14127 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14128
14129 if (processTemperature)
14131
14132 if (processDecay)
14133 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14134 }
14135 }
14136 }
14137
14140 {
14142 }
14143
14145 {
14148
14149 return super.GetTemperatureFreezeThreshold();
14150 }
14151
14153 {
14156
14157 return super.GetTemperatureThawThreshold();
14158 }
14159
14161 {
14164
14165 return super.GetItemOverheatThreshold();
14166 }
14167
14169 {
14171 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14172
14173 return super.GetTemperatureFreezeTime();
14174 }
14175
14177 {
14179 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14180
14181 return super.GetTemperatureThawTime();
14182 }
14183
14188
14190 {
14191 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14192 }
14193
14195 {
14196 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14197 }
14198
14201 {
14203 }
14204
14206 {
14208 }
14209
14211 {
14213 }
14214
14217 {
14218 return null;
14219 }
14220
14223 {
14224 return false;
14225 }
14226
14228 {
14230 {
14233 if (!trg)
14234 {
14236 explosive = this;
14237 }
14238
14239 explosive.PairRemote(trg);
14241
14242 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14243 trg.SetPersistentPairID(persistentID);
14244 explosive.SetPersistentPairID(persistentID);
14245
14246 return true;
14247 }
14248 return false;
14249 }
14250
14253 {
14254 float ret = 1.0;
14257 ret *= GetHealth01();
14258
14259 return ret;
14260 }
14261
14262 #ifdef DEVELOPER
14263 override void SetDebugItem()
14264 {
14265 super.SetDebugItem();
14266 _itemBase = this;
14267 }
14268
14270 {
14271 string text = super.GetDebugText();
14272
14274 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14275
14276 return text;
14277 }
14278 #endif
14279
14281 {
14282 return true;
14283 }
14284
14286
14288
14290 {
14293 }
14294
14295
14303
14319
14320 [
Obsolete(
"Use ItemSoundHandler instead")]
14323 {
14324 if (!
g_Game.IsDedicatedServer())
14325 {
14326 if (ConfigIsExisting("attachSoundSet"))
14327 {
14328 string cfg_path = "";
14329 string soundset = "";
14330 string type_name =
GetType();
14331
14334 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14335 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14336
14337 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14338 {
14339 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14340 {
14341 if (cfg_slot_array[i] == slot_type)
14342 {
14343 soundset = cfg_soundset_array[i];
14344 break;
14345 }
14346 }
14347 }
14348
14349 if (soundset != "")
14350 {
14351 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14353 }
14354 }
14355 }
14356 }
14357
14359}
14360
14362{
14364 if (entity)
14365 {
14366 bool is_item = entity.IsInherited(
ItemBase);
14367 if (is_item && full_quantity)
14368 {
14371 }
14372 }
14373 else
14374 {
14376 return NULL;
14377 }
14378 return entity;
14379}
14380
14382{
14383 if (item)
14384 {
14385 if (health > 0)
14386 item.SetHealth("", "", health);
14387
14388 if (item.CanHaveTemperature())
14389 {
14391 if (item.CanFreeze())
14392 item.SetFrozen(false);
14393 }
14394
14395 if (item.HasEnergyManager())
14396 {
14397 if (quantity >= 0)
14398 {
14399 item.GetCompEM().SetEnergy0To1(quantity);
14400 }
14401 else
14402 {
14404 }
14405 }
14406 else if (item.IsMagazine())
14407 {
14408 Magazine mag = Magazine.Cast(item);
14409 if (quantity >= 0)
14410 {
14411 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14412 }
14413 else
14414 {
14416 }
14417
14418 }
14419 else
14420 {
14421 if (quantity >= 0)
14422 {
14423 item.SetQuantityNormalized(quantity, false);
14424 }
14425 else
14426 {
14428 }
14429
14430 }
14431 }
14432}
14433
14434#ifdef DEVELOPER
14436#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.