9443{
9445 {
9446 return true;
9447 }
9448};
9449
9451{
9452
9453};
9454
9455
9456
9458{
9462
9464
9467
9468
9469
9470
9471
9480
9486
9491
9496
9517 protected bool m_IsResultOfSplit
9518
9520
9525
9526
9527
9529
9533
9534
9535
9537
9540
9541
9542
9548
9549
9557
9560
9561
9563
9564
9566
9567
9572
9573
9578
9580
9581
9583
9584
9586 {
9591
9592 if (!
g_Game.IsDedicatedServer())
9593 {
9595 {
9597
9599 {
9601 }
9602 }
9603
9606 }
9607
9608 m_OldLocation = null;
9609
9611 {
9613 }
9614
9615 if (ConfigIsExisting("headSelectionsToHide"))
9616 {
9619 }
9620
9622 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9623 {
9625 }
9626
9628
9629 m_IsResultOfSplit = false;
9630
9632 }
9633
9635 {
9636 super.InitItemVariables();
9637
9643 m_Count = ConfigGetInt(
"count");
9644
9647
9652
9655
9660
9672
9676
9677
9680 if (ConfigIsExisting("canBeSplit"))
9681 {
9684 }
9685
9687 if (ConfigIsExisting("itemBehaviour"))
9689
9690
9693 RegisterNetSyncVariableInt("m_VarLiquidType");
9694 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9695
9696 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9697 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9698 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9699
9700 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9701 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9702 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9703 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9704
9705 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9706 RegisterNetSyncVariableBool("m_IsTakeable");
9707 RegisterNetSyncVariableBool("m_IsHologram");
9708
9711 {
9714 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9715 }
9716
9718
9720 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9722
9724 }
9725
9727 {
9729 }
9730
9732 {
9735 {
9740 }
9741 }
9742
9743 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9744 {
9746 {
9749 }
9750
9752 }
9753
9755 {
9761 }
9762
9764
9766 {
9768
9769 if (!action)
9770 {
9771 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9772 return;
9773 }
9774
9776 if (!ai)
9777 {
9779 return;
9780 }
9781
9783 if (!action_array)
9784 {
9785 action_array = new array<ActionBase_Basic>;
9787 }
9788 if (LogManager.IsActionLogEnable())
9789 {
9790 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9791 }
9792
9793 if (action_array.Find(action) != -1)
9794 {
9795 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9796 }
9797 else
9798 {
9799 action_array.Insert(action);
9800 }
9801 }
9802
9804 {
9805 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9806 ActionBase action = player.GetActionManager().GetAction(actionName);
9809
9810 if (action_array)
9811 {
9812 action_array.RemoveItem(action);
9813 }
9814 }
9815
9816
9817
9819 {
9820 ActionOverrideData overrideData = new ActionOverrideData();
9824
9826 if (!actionMap)
9827 {
9830 }
9831
9832 actionMap.Insert(this.
Type(), overrideData);
9833
9834 }
9835
9837
9839
9840
9842 {
9845
9848
9849 string config_to_search = "CfgVehicles";
9850 string muzzle_owner_config;
9851
9853 {
9854 if (IsInherited(Weapon))
9855 config_to_search = "CfgWeapons";
9856
9857 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9858
9859 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9860
9861 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9862
9863 if (config_OnFire_subclass_count > 0)
9864 {
9865 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9866
9867 for (int i = 0; i < config_OnFire_subclass_count; i++)
9868 {
9869 string particle_class = "";
9870 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9871 string config_OnFire_entry = config_OnFire_class + particle_class;
9872 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9873 WPOF_array.Insert(WPOF);
9874 }
9875
9876
9878 }
9879 }
9880
9882 {
9883 config_to_search = "CfgWeapons";
9884 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9885
9886 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9887
9888 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9889
9890 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9891 {
9892 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9893
9894 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9895 {
9896 string particle_class2 = "";
9897 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9898 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9899 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9900 WPOBE_array.Insert(WPOBE);
9901 }
9902
9903
9905 }
9906 }
9907 }
9908
9909
9911 {
9914
9916 {
9917 string config_to_search = "CfgVehicles";
9918
9919 if (IsInherited(Weapon))
9920 config_to_search = "CfgWeapons";
9921
9922 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9923 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9924
9925 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9926 {
9927
9929
9931 {
9933 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9935 return;
9936 }
9937
9940
9941
9942
9943 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9944 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9945
9946 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9947 {
9948 string particle_class = "";
9949 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9950 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9951 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9952
9953 if (entry_type == CT_CLASS)
9954 {
9955 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9956 WPOOH_array.Insert(WPOF);
9957 }
9958 }
9959
9960
9962 }
9963 }
9964 }
9965
9967 {
9969 }
9970
9972 {
9974 {
9976
9979
9982
9983 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9984 }
9985 }
9986
9988 {
9990 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9991
9993 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9994
9996 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9997
9999 {
10001 }
10002 }
10003
10005 {
10007 }
10008
10010 {
10013 else
10015
10017 {
10020 }
10021 else
10022 {
10025
10028 }
10029
10031 }
10032
10034 {
10036 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10037 }
10038
10040 {
10042 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10044 }
10045
10047 {
10049 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10050 }
10051
10053 {
10056
10057 OverheatingParticle OP = new OverheatingParticle();
10062
10064 }
10065
10067 {
10070
10071 return -1;
10072 }
10073
10075 {
10077 {
10080
10081 for (int i = count; i > 0; --i)
10082 {
10083 int id = i - 1;
10086
10089
10090 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10091 {
10092 if (p)
10093 {
10096 }
10097 }
10098 }
10099 }
10100 }
10101
10103 {
10105 {
10107 {
10108 int id = i - 1;
10110
10111 if (OP)
10112 {
10114
10115 if (p)
10116 {
10118 }
10119
10120 delete OP;
10121 }
10122 }
10123
10126 }
10127 }
10128
10131 {
10132 return 0.0;
10133 }
10134
10135
10137 {
10138 return 250;
10139 }
10140
10142 {
10143 return 0;
10144 }
10145
10148 {
10150 return true;
10151
10152 return false;
10153 }
10154
10157 {
10160
10162 {
10164 }
10165 else
10166 {
10167
10169 }
10170
10172 }
10173
10180 {
10181 return -1;
10182 }
10183
10184
10185
10186
10188 {
10190 {
10191 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10192 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10193
10194 if (r_index >= 0)
10195 {
10196 InventoryLocation r_il = new InventoryLocation;
10197 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10198
10199 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10202 {
10203 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10204 }
10206 {
10207 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10208 }
10209
10210 }
10211
10212 player.GetHumanInventory().ClearUserReservedLocation(this);
10213 }
10214
10217 }
10218
10219
10220
10221
10223 {
10224 return ItemBase.m_DebugActionsMask;
10225 }
10226
10228 {
10229 return ItemBase.m_DebugActionsMask & mask;
10230 }
10231
10233 {
10234 ItemBase.m_DebugActionsMask = mask;
10235 }
10236
10238 {
10239 ItemBase.m_DebugActionsMask |= mask;
10240 }
10241
10243 {
10244 ItemBase.m_DebugActionsMask &= ~mask;
10245 }
10246
10248 {
10250 {
10252 }
10253 else
10254 {
10256 }
10257 }
10258
10259
10261 {
10262 if (GetEconomyProfile())
10263 {
10264 float q_max = GetEconomyProfile().GetQuantityMax();
10265 if (q_max > 0)
10266 {
10267 float q_min = GetEconomyProfile().GetQuantityMin();
10268 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10269
10271 {
10272 ComponentEnergyManager comp = GetCompEM();
10274 {
10276 }
10277 }
10279 {
10281
10282 }
10283
10284 }
10285 }
10286 }
10287
10290 {
10291 EntityAI parent = GetHierarchyParent();
10292
10293 if (parent)
10294 {
10295 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10296 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10297 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10298 }
10299 }
10300
10303 {
10304 EntityAI parent = GetHierarchyParent();
10305
10306 if (parent)
10307 {
10308 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10309 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10310 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10311 }
10312 }
10313
10315 {
10316
10317
10318
10319
10321
10323 {
10324 if (ScriptInputUserData.CanStoreInputUserData())
10325 {
10326 ScriptInputUserData ctx = new ScriptInputUserData;
10332 ctx.
Write(use_stack_max);
10335
10337 {
10338 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10339 }
10340 }
10341 }
10342 else if (!
g_Game.IsMultiplayer())
10343 {
10345 }
10346 }
10347
10349 {
10351 }
10352
10354 {
10356 }
10357
10359 {
10361 }
10362
10364 {
10365
10366 return false;
10367 }
10368
10370 {
10371 return false;
10372 }
10373
10377 {
10378 return false;
10379 }
10380
10382 {
10383 return "";
10384 }
10385
10387
10389 {
10390 return false;
10391 }
10392
10394 {
10395 return true;
10396 }
10397
10398
10399
10401 {
10402 return true;
10403 }
10404
10406 {
10407 return true;
10408 }
10409
10411 {
10412 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10414 }
10415
10417 {
10419 }
10420
10422 {
10424 if (!is_being_placed)
10426 SetSynchDirty();
10427 }
10428
10429
10431
10433 {
10435 }
10436
10438 {
10440 }
10441
10443 {
10444 return 1;
10445 }
10446
10448 {
10449 return false;
10450 }
10451
10453 {
10455 SetSynchDirty();
10456 }
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10493 {
10494 super.OnMovedInsideCargo(container);
10495
10496 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10497 }
10498
10499 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10500 {
10501 super.EEItemLocationChanged(oldLoc, newLoc);
10502
10503 PlayerBase newPlayer = null;
10504 PlayerBase oldPlayer = null;
10505
10506 if (newLoc.GetParent())
10507 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10508
10509 if (oldLoc.GetParent())
10510 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10511
10513 {
10514 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10515
10516 if (rIndex >= 0)
10517 {
10518 InventoryLocation rIl = new InventoryLocation;
10519 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10520
10521 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10524 {
10525 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10526 }
10528 {
10530 }
10531
10532 }
10533 }
10534
10536 {
10537 if (newPlayer)
10538 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10539
10540 if (newPlayer == oldPlayer)
10541 {
10542 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10543 {
10545 {
10546 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10547 {
10548 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10549 }
10550 }
10551 else
10552 {
10553 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10554 }
10555 }
10556
10557 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10558 {
10559 int type = oldLoc.GetType();
10561 {
10562 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10563 }
10565 {
10566 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10567 }
10568 }
10569 if (!m_OldLocation)
10570 {
10571 m_OldLocation = new InventoryLocation;
10572 }
10573 m_OldLocation.Copy(oldLoc);
10574 }
10575 else
10576 {
10577 if (m_OldLocation)
10578 {
10579 m_OldLocation.Reset();
10580 }
10581 }
10582
10583 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10584 }
10585 else
10586 {
10587 if (newPlayer)
10588 {
10589 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10590 if (resIndex >= 0)
10591 {
10592 InventoryLocation il = new InventoryLocation;
10593 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10595 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10598 {
10599 il.
GetParent().GetOnReleaseLock().Invoke(it);
10600 }
10602 {
10604 }
10605
10606 }
10607 }
10609 {
10610
10612 }
10613
10614 if (m_OldLocation)
10615 {
10616 m_OldLocation.Reset();
10617 }
10618 }
10619
10621 {
10622 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10623 }
10624
10626 {
10627 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10628 }
10629 }
10630
10631 override void EOnContact(IEntity other, Contact extra)
10632 {
10634 {
10635 int liquidType = -1;
10637 if (impactSpeed > 0.0)
10638 {
10640 #ifndef SERVER
10642 #else
10644 SetSynchDirty();
10645 #endif
10647 }
10648 }
10649
10650 #ifdef SERVER
10651 if (GetCompEM() && GetCompEM().IsPlugged())
10652 {
10653 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10654 GetCompEM().UnplugThis();
10655 }
10656 #endif
10657 }
10658
10660
10662 {
10664 }
10665
10667 {
10668
10669 }
10670
10672 {
10673 super.OnItemLocationChanged(old_owner, new_owner);
10674
10675 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10676 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10677
10678 if (!relatedPlayer && playerNew)
10679 relatedPlayer = playerNew;
10680
10681 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10682 {
10684 if (actionMgr)
10685 {
10686 ActionBase currentAction = actionMgr.GetRunningAction();
10687 if (currentAction)
10689 }
10690 }
10691
10692 Man ownerPlayerOld = null;
10693 Man ownerPlayerNew = null;
10694
10695 if (old_owner)
10696 {
10697 if (old_owner.
IsMan())
10698 {
10699 ownerPlayerOld = Man.Cast(old_owner);
10700 }
10701 else
10702 {
10703 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10704 }
10705 }
10706 else
10707 {
10709 {
10711
10712 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10713 {
10714 GetCompEM().UnplugThis();
10715 }
10716 }
10717 }
10718
10719 if (new_owner)
10720 {
10721 if (new_owner.
IsMan())
10722 {
10723 ownerPlayerNew = Man.Cast(new_owner);
10724 }
10725 else
10726 {
10727 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10728 }
10729 }
10730
10731 if (ownerPlayerOld != ownerPlayerNew)
10732 {
10733 if (ownerPlayerOld)
10734 {
10735 array<EntityAI> subItemsExit = new array<EntityAI>;
10737 for (int i = 0; i < subItemsExit.Count(); i++)
10738 {
10741 }
10742 }
10743
10744 if (ownerPlayerNew)
10745 {
10746 array<EntityAI> subItemsEnter = new array<EntityAI>;
10748 for (int j = 0; j < subItemsEnter.Count(); j++)
10749 {
10752 }
10753 }
10754 }
10755 else if (ownerPlayerNew != null)
10756 {
10757 PlayerBase nplayer;
10758 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10759 {
10760 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10762 for (int k = 0; k < subItemsUpdate.Count(); k++)
10763 {
10765 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10766 }
10767 }
10768 }
10769
10770 if (old_owner)
10771 old_owner.OnChildItemRemoved(this);
10772 if (new_owner)
10773 new_owner.OnChildItemReceived(this);
10774 }
10775
10776
10778 {
10779 super.EEDelete(parent);
10780 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10781 if (player)
10782 {
10784
10785 if (player.IsAlive())
10786 {
10787 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10788 if (r_index >= 0)
10789 {
10790 InventoryLocation r_il = new InventoryLocation;
10791 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10792
10793 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10796 {
10797 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10798 }
10800 {
10801 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10802 }
10803
10804 }
10805
10806 player.RemoveQuickBarEntityShortcut(this);
10807 }
10808 }
10809 }
10810
10812 {
10813 super.EEKilled(killer);
10814
10817 {
10818 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10819 {
10820 if (IsMagazine())
10821 {
10822 if (Magazine.Cast(this).GetAmmoCount() > 0)
10823 {
10825 }
10826 }
10827 else
10828 {
10830 }
10831 }
10832 }
10833 }
10834
10836 {
10837 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10838
10839 super.OnWasAttached(parent, slot_id);
10840
10843
10846 }
10847
10849 {
10850 super.OnWasDetached(parent, slot_id);
10851
10854
10857 }
10858
10860 {
10861 int idx;
10864
10865 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10866 if (inventory_slots.Count() < 1)
10867 {
10868 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10869 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10870 }
10871 else
10872 {
10873 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10874 }
10875
10876 idx = inventory_slots.Find(slot);
10877 if (idx < 0)
10878 return "";
10879
10880 return attach_types.Get(idx);
10881 }
10882
10884 {
10885 int idx = -1;
10886 string slot;
10887
10890
10891 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10892 if (inventory_slots.Count() < 1)
10893 {
10894 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10895 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10896 }
10897 else
10898 {
10899 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10900 if (detach_types.Count() < 1)
10901 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10902 }
10903
10904 for (int i = 0; i < inventory_slots.Count(); i++)
10905 {
10906 slot = inventory_slots.Get(i);
10907 }
10908
10909 if (slot != "")
10910 {
10911 if (detach_types.Count() == 1)
10912 idx = 0;
10913 else
10914 idx = inventory_slots.Find(slot);
10915 }
10916 if (idx < 0)
10917 return "";
10918
10919 return detach_types.Get(idx);
10920 }
10921
10923 {
10924
10926
10927
10928 float min_time = 1;
10929 float max_time = 3;
10930 float delay = Math.RandomFloat(min_time, max_time);
10931
10932 explode_timer.Run(delay, this, "DoAmmoExplosion");
10933 }
10934
10936 {
10937 Magazine magazine = Magazine.Cast(this);
10938 int pop_sounds_count = 6;
10939 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10940
10941
10942 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10943 string sound_name = pop_sounds[ sound_idx ];
10944 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10945
10946
10947 magazine.ServerAddAmmoCount(-1);
10948
10949
10950 float min_temp_to_explode = 100;
10951
10952 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10953 {
10955 }
10956 }
10957
10958
10959 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10960 {
10961 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10962
10963 const int CHANCE_DAMAGE_CARGO = 4;
10964 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10965 const int CHANCE_DAMAGE_NOTHING = 2;
10966
10968 {
10969 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10970 int chances;
10971 int rnd;
10972
10973 if (GetInventory().GetCargo())
10974 {
10975 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10976 rnd = Math.RandomInt(0,chances);
10977
10978 if (rnd < CHANCE_DAMAGE_CARGO)
10979 {
10981 }
10982 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10983 {
10985 }
10986 }
10987 else
10988 {
10989 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10990 rnd = Math.RandomInt(0,chances);
10991
10992 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10993 {
10995 }
10996 }
10997 }
10998 }
10999
11001 {
11002 CargoBase cargo = GetInventory().GetCargo();
11003 if (cargo)
11004 {
11006 if (item_count > 0)
11007 {
11008 int random_pick = Math.RandomInt(0, item_count);
11010 if (!item.IsExplosive())
11011 {
11012 item.AddHealth("","",damage);
11013 return true;
11014 }
11015 }
11016 }
11017 return false;
11018 }
11019
11021 {
11022 GameInventory inventory = GetInventory();
11024 if (attachment_count > 0)
11025 {
11026 int random_pick = Math.RandomInt(0, attachment_count);
11028 if (!attachment.IsExplosive())
11029 {
11030 attachment.AddHealth("","",damage);
11031 return true;
11032 }
11033 }
11034 return false;
11035 }
11036
11038 {
11040 }
11041
11043 {
11045 return GetInventory().CanRemoveEntity();
11046
11047 return false;
11048 }
11049
11051 {
11052
11054 return false;
11055
11056
11058 return false;
11059
11060
11061
11063 if (delta == 0)
11064 return false;
11065
11066
11067 return true;
11068 }
11069
11071 {
11073 {
11074 if (ScriptInputUserData.CanStoreInputUserData())
11075 {
11076 ScriptInputUserData ctx = new ScriptInputUserData;
11081 ctx.
Write(destination_entity);
11083 ctx.
Write(slot_id);
11085 }
11086 }
11087 else if (!
g_Game.IsMultiplayer())
11088 {
11090 }
11091 }
11092
11094 {
11095 float split_quantity_new;
11099 InventoryLocation loc = new InventoryLocation;
11100
11101 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11102 {
11104 split_quantity_new = stack_max;
11105 else
11107
11109 {
11110 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11111 if (new_item)
11112 {
11113 new_item.SetResultOfSplit(true);
11114 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11116 new_item.
SetQuantity(split_quantity_new,
false,
true);
11117 }
11118 }
11119 }
11120 else if (destination_entity && slot_id == -1)
11121 {
11122 if (quantity > stack_max)
11123 split_quantity_new = stack_max;
11124 else
11125 split_quantity_new = quantity;
11126
11128 {
11129 GameInventory destinationInventory = destination_entity.GetInventory();
11131 {
11134 }
11135
11136 if (new_item)
11137 {
11138 new_item.SetResultOfSplit(true);
11139 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11141 new_item.
SetQuantity(split_quantity_new,
false,
true);
11142 }
11143 }
11144 }
11145 else
11146 {
11147 if (stack_max != 0)
11148 {
11150 {
11152 }
11153
11154 if (split_quantity_new == 0)
11155 {
11156 if (!
g_Game.IsMultiplayer())
11157 player.PhysicalPredictiveDropItem(this);
11158 else
11159 player.ServerDropEntity(this);
11160 return;
11161 }
11162
11164 {
11166
11167 if (new_item)
11168 {
11169 new_item.SetResultOfSplit(true);
11170 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11173 new_item.PlaceOnSurface();
11174 }
11175 }
11176 }
11177 }
11178 }
11179
11181 {
11182 float split_quantity_new;
11186 InventoryLocation loc = new InventoryLocation;
11187
11188 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11189 {
11191 split_quantity_new = stack_max;
11192 else
11194
11196 {
11197 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11198 if (new_item)
11199 {
11200 new_item.SetResultOfSplit(true);
11201 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11203 new_item.
SetQuantity(split_quantity_new,
false,
true);
11204 }
11205 }
11206 }
11207 else if (destination_entity && slot_id == -1)
11208 {
11209 if (quantity > stack_max)
11210 split_quantity_new = stack_max;
11211 else
11212 split_quantity_new = quantity;
11213
11215 {
11216 GameInventory destinationInventory = destination_entity.GetInventory();
11218 {
11221 }
11222
11223 if (new_item)
11224 {
11225 new_item.SetResultOfSplit(true);
11226 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11228 new_item.
SetQuantity(split_quantity_new,
false,
true);
11229 }
11230 }
11231 }
11232 else
11233 {
11234 if (stack_max != 0)
11235 {
11237 {
11239 }
11240
11242 {
11244
11245 if (new_item)
11246 {
11247 new_item.SetResultOfSplit(true);
11248 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11251 new_item.PlaceOnSurface();
11252 }
11253 }
11254 }
11255 }
11256 }
11257
11259 {
11261 {
11262 if (ScriptInputUserData.CanStoreInputUserData())
11263 {
11264 ScriptInputUserData ctx = new ScriptInputUserData;
11269 dst.WriteToContext(ctx);
11271 }
11272 }
11273 else if (!
g_Game.IsMultiplayer())
11274 {
11276 }
11277 }
11278
11280 {
11282 {
11283 if (ScriptInputUserData.CanStoreInputUserData())
11284 {
11285 ScriptInputUserData ctx = new ScriptInputUserData;
11290 ctx.
Write(destination_entity);
11296 }
11297 }
11298 else if (!
g_Game.IsMultiplayer())
11299 {
11301 }
11302 }
11303
11305 {
11307 }
11308
11310 {
11312 float split_quantity_new;
11314 if (dst.IsValid())
11315 {
11316 int slot_id = dst.GetSlot();
11318
11319 if (quantity > stack_max)
11320 split_quantity_new = stack_max;
11321 else
11322 split_quantity_new = quantity;
11323
11325 {
11327
11328 if (new_item)
11329 {
11330 new_item.SetResultOfSplit(true);
11331 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11333 new_item.
SetQuantity(split_quantity_new,
false,
true);
11334 }
11335
11336 return new_item;
11337 }
11338 }
11339
11340 return null;
11341 }
11342
11344 {
11346 float split_quantity_new;
11348 if (destination_entity)
11349 {
11351 if (quantity > stackable)
11352 split_quantity_new = stackable;
11353 else
11354 split_quantity_new = quantity;
11355
11357 {
11358 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11359 if (new_item)
11360 {
11361 new_item.SetResultOfSplit(true);
11362 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11364 new_item.
SetQuantity(split_quantity_new,
false,
true);
11365 }
11366 }
11367 }
11368 }
11369
11371 {
11373 {
11374 if (ScriptInputUserData.CanStoreInputUserData())
11375 {
11376 ScriptInputUserData ctx = new ScriptInputUserData;
11381 ItemBase destination_entity =
this;
11382 ctx.
Write(destination_entity);
11386 }
11387 }
11388 else if (!
g_Game.IsMultiplayer())
11389 {
11391 }
11392 }
11393
11395 {
11397 float split_quantity_new;
11399 if (player)
11400 {
11402 if (quantity > stackable)
11403 split_quantity_new = stackable;
11404 else
11405 split_quantity_new = quantity;
11406
11408 {
11409 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11410 new_item =
ItemBase.Cast(in_hands);
11411 if (new_item)
11412 {
11413 new_item.SetResultOfSplit(true);
11414 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11416 new_item.SetQuantity(split_quantity_new, false, true);
11417 }
11418 }
11419 }
11420 }
11421
11423 {
11425 float split_quantity_new = Math.Floor(quantity * 0.5);
11426
11428 return;
11429
11431
11432 if (new_item)
11433 {
11434 if (new_item.GetQuantityMax() < split_quantity_new)
11435 {
11436 split_quantity_new = new_item.GetQuantityMax();
11437 }
11438
11439 new_item.SetResultOfSplit(true);
11440 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11441
11443 {
11446 }
11447 else
11448 {
11450 new_item.
SetQuantity(split_quantity_new,
false,
true);
11451 }
11452 }
11453 }
11454
11456 {
11458 float split_quantity_new = Math.Floor(quantity / 2);
11459
11461 return;
11462
11463 InventoryLocation invloc = new InventoryLocation;
11465
11467 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11468
11469 if (new_item)
11470 {
11471 if (new_item.GetQuantityMax() < split_quantity_new)
11472 {
11473 split_quantity_new = new_item.GetQuantityMax();
11474 }
11476 {
11479 }
11480 else if (split_quantity_new > 1)
11481 {
11483 new_item.
SetQuantity(split_quantity_new,
false,
true);
11484 }
11485 }
11486 }
11487
11490 {
11491 SetWeightDirty();
11493
11494 if (parent)
11495 parent.OnAttachmentQuantityChangedEx(this, delta);
11496
11498 {
11500 {
11502 }
11504 {
11505 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11507 }
11508 }
11509 }
11510
11513 {
11514
11515 }
11516
11519 {
11521 }
11522
11524 {
11525 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11526
11528 {
11529 if (newLevel == GameConstants.STATE_RUINED)
11530 {
11532 EntityAI parent = GetHierarchyParent();
11533 if (parent && parent.IsFireplace())
11534 {
11535 CargoBase cargo = GetInventory().GetCargo();
11536 if (cargo)
11537 {
11539 {
11541 }
11542 }
11543 }
11544 }
11545
11547 {
11548
11550 return;
11551 }
11552
11553 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11554 {
11556 }
11557 }
11558 }
11559
11560
11562 {
11563 super.OnRightClick();
11564
11566 {
11568 {
11569 if (ScriptInputUserData.CanStoreInputUserData())
11570 {
11571 EntityAI root = GetHierarchyRoot();
11572 Man playerOwner = GetHierarchyRootPlayer();
11573 InventoryLocation dst = new InventoryLocation;
11574
11575
11576 if (!playerOwner && root && root == this)
11577 {
11579 }
11580 else
11581 {
11582
11583 GetInventory().GetCurrentInventoryLocation(dst);
11585 {
11586 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11588 {
11590 }
11591 else
11592 {
11594
11595
11596 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11597 {
11599 }
11600 else
11601 {
11602 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11603 }
11604 }
11605 }
11606 }
11607
11608 ScriptInputUserData ctx = new ScriptInputUserData;
11616 }
11617 }
11618 else if (!
g_Game.IsMultiplayer())
11619 {
11621 }
11622 }
11623 }
11624
11626 {
11627 if (root)
11628 {
11629 vector m4[4];
11630 root.GetTransform(m4);
11631 dst.SetGround(this, m4);
11632 }
11633 else
11634 {
11635 GetInventory().GetCurrentInventoryLocation(dst);
11636 }
11637 }
11638
11639 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11640 {
11641
11642 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11643 return false;
11644
11645 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11646 return false;
11647
11648
11650 return false;
11651
11652
11653 Magazine mag = Magazine.Cast(this);
11654 if (mag)
11655 {
11656 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11657 return false;
11658
11659 if (stack_max_limit)
11660 {
11661 Magazine other_mag = Magazine.Cast(other_item);
11662 if (other_item)
11663 {
11664 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11665 return false;
11666 }
11667
11668 }
11669 }
11670 else
11671 {
11672
11674 return false;
11675
11677 return false;
11678 }
11679
11680 PlayerBase player = null;
11681 if (CastTo(player, GetHierarchyRootPlayer()))
11682 {
11683 if (player.GetInventory().HasAttachment(this))
11684 return false;
11685
11686 if (player.IsItemsToDelete())
11687 return false;
11688 }
11689
11690 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11691 return false;
11692
11693 int slotID;
11695 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11696 return false;
11697
11698 return true;
11699 }
11700
11702 {
11704 }
11705
11707 {
11708 return m_IsResultOfSplit;
11709 }
11710
11712 {
11713 m_IsResultOfSplit = value;
11714 }
11715
11717 {
11719 }
11720
11722 {
11723 float other_item_quantity = other_item.GetQuantity();
11724 float this_free_space;
11725
11727
11729
11730 if (other_item_quantity > this_free_space)
11731 {
11732 return this_free_space;
11733 }
11734 else
11735 {
11736 return other_item_quantity;
11737 }
11738 }
11739
11741 {
11743 }
11744
11746 {
11748 return;
11749
11750 if (!IsMagazine() && other_item)
11751 {
11753 if (quantity_used != 0)
11754 {
11755 float hp1 = GetHealth01("","");
11756 float hp2 = other_item.GetHealth01("","");
11757 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11758 hpResult = hpResult / (
GetQuantity() + quantity_used);
11759
11760 hpResult *= GetMaxHealth();
11761 Math.Round(hpResult);
11762 SetHealth("", "Health", hpResult);
11763
11765 other_item.AddQuantity(-quantity_used);
11766 }
11767 }
11769 }
11770
11772 {
11773 #ifdef SERVER
11774 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11775 GetHierarchyParent().IncreaseLifetimeUp();
11776 #endif
11777 };
11778
11780 {
11781 PlayerBase p = PlayerBase.Cast(player);
11782
11783 array<int> recipesIds = p.m_Recipes;
11784 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11785 if (moduleRecipesManager)
11786 {
11787 EntityAI itemInHands = player.GetEntityInHands();
11788 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11789 }
11790
11791 for (int i = 0;i < recipesIds.Count(); i++)
11792 {
11793 int key = recipesIds.Get(i);
11794 string recipeName = moduleRecipesManager.GetRecipeName(key);
11796 }
11797 }
11798
11799
11800 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11801 {
11802 super.GetDebugActions(outputList);
11803
11804
11810
11811
11816
11821
11822
11826
11827
11829 {
11833 }
11834
11837
11838
11842
11844
11845 InventoryLocation loc = new InventoryLocation();
11846 GetInventory().GetCurrentInventoryLocation(loc);
11848 {
11849 if (Gizmo_IsSupported())
11852 }
11853
11855 }
11856
11857
11858
11859
11861 {
11862 super.OnAction(action_id, player, ctx);
11863
11865 {
11866 switch (action_id)
11867 {
11871 return true;
11875 return true;
11876 }
11877 }
11878
11880 {
11881 switch (action_id)
11882 {
11884 Delete();
11885 return true;
11886 }
11887 }
11888
11889 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11890 {
11891 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11892 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11893 PlayerBase p = PlayerBase.Cast(player);
11894 if (
EActions.RECIPES_RANGE_START < 1000)
11895 {
11896 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11897 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11898 }
11899 }
11900 #ifndef SERVER
11901 else if (action_id ==
EActions.WATCH_PLAYER)
11902 {
11903 PluginDeveloper.SetDeveloperItemClientEx(player);
11904 }
11905 #endif
11907 {
11908 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11909 {
11910 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11911 OnDebugButtonPressServer(id + 1);
11912 }
11913
11914 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11915 {
11916 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11918 }
11919
11920 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11921 {
11922 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11924 }
11925
11926 else if (action_id ==
EActions.ADD_QUANTITY)
11927 {
11928 if (IsMagazine())
11929 {
11930 Magazine mag = Magazine.Cast(this);
11931 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11932 }
11933 else
11934 {
11936 }
11937
11938 if (m_EM)
11939 {
11940 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11941 }
11942
11943 }
11944
11945 else if (action_id ==
EActions.REMOVE_QUANTITY)
11946 {
11947 if (IsMagazine())
11948 {
11949 Magazine mag2 = Magazine.Cast(this);
11950 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11951 }
11952 else
11953 {
11955 }
11956 if (m_EM)
11957 {
11958 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11959 }
11960
11961 }
11962
11963 else if (action_id ==
EActions.SET_QUANTITY_0)
11964 {
11966
11967 if (m_EM)
11968 {
11969 m_EM.SetEnergy(0);
11970 }
11971 }
11972
11973 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11974 {
11976
11977 if (m_EM)
11978 {
11979 m_EM.SetEnergy(m_EM.GetEnergyMax());
11980 }
11981 }
11982
11983 else if (action_id ==
EActions.ADD_HEALTH)
11984 {
11985 AddHealth("","",GetMaxHealth("","Health")/5);
11986 }
11987 else if (action_id ==
EActions.REMOVE_HEALTH)
11988 {
11989 AddHealth("","",-GetMaxHealth("","Health")/5);
11990 }
11991 else if (action_id ==
EActions.DESTROY_HEALTH)
11992 {
11993 SetHealth01("","",0);
11994 }
11995 else if (action_id ==
EActions.WATCH_ITEM)
11996 {
11998 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11999 #ifdef DEVELOPER
12000 SetDebugDeveloper_item(this);
12001 #endif
12002 }
12003
12004 else if (action_id ==
EActions.ADD_TEMPERATURE)
12005 {
12006 AddTemperature(20);
12007
12008 }
12009
12010 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12011 {
12012 AddTemperature(-20);
12013
12014 }
12015
12016 else if (action_id ==
EActions.FLIP_FROZEN)
12017 {
12018 SetFrozen(!GetIsFrozen());
12019
12020 }
12021
12022 else if (action_id ==
EActions.ADD_WETNESS)
12023 {
12025
12026 }
12027
12028 else if (action_id ==
EActions.REMOVE_WETNESS)
12029 {
12031
12032 }
12033
12034 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12035 {
12038
12039
12040 }
12041
12042 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12043 {
12046 }
12047
12048 else if (action_id ==
EActions.MAKE_SPECIAL)
12049 {
12050 auto debugParams = DebugSpawnParams.WithPlayer(player);
12051 OnDebugSpawnEx(debugParams);
12052 }
12053
12054 }
12055
12056
12057 return false;
12058 }
12059
12060
12061
12062
12066
12069
12070
12071
12073 {
12074 return false;
12075 }
12076
12077
12079 {
12080 return true;
12081 }
12082
12083
12085 {
12086 return true;
12087 }
12088
12089
12090
12092 {
12093 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12094 return g_Game.ConfigIsExisting(config_path);
12095 }
12096
12099 {
12100 return null;
12101 }
12102
12104 {
12105 return false;
12106 }
12107
12109 {
12110 return false;
12111 }
12112
12116
12117
12119 {
12120 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12121 return module_repairing.CanRepair(this, item_repair_kit);
12122 }
12123
12124
12125 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12126 {
12127 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12128 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12129 }
12130
12131
12133 {
12134
12135
12136
12137
12138
12139
12140
12141
12142 return 1;
12143 }
12144
12145
12146
12148 {
12150 }
12151
12152
12153
12155 {
12157 }
12158
12159
12168 {
12169 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12170
12171 if (player)
12172 {
12173 player.MessageStatus(text);
12174 }
12175 }
12176
12177
12186 {
12187 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12188
12189 if (player)
12190 {
12191 player.MessageAction(text);
12192 }
12193 }
12194
12195
12204 {
12205 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12206
12207 if (player)
12208 {
12209 player.MessageFriendly(text);
12210 }
12211 }
12212
12213
12222 {
12223 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12224
12225 if (player)
12226 {
12227 player.MessageImportant(text);
12228 }
12229 }
12230
12232 {
12233 return true;
12234 }
12235
12236
12237 override bool KindOf(
string tag)
12238 {
12239 bool found = false;
12240 string item_name = this.
GetType();
12242 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12243
12244 int array_size = item_tag_array.Count();
12245 for (int i = 0; i < array_size; i++)
12246 {
12247 if (item_tag_array.Get(i) == tag)
12248 {
12249 found = true;
12250 break;
12251 }
12252 }
12253 return found;
12254 }
12255
12256
12258 {
12259
12260 super.OnRPC(sender, rpc_type,ctx);
12261
12262
12263 switch (rpc_type)
12264 {
12265 #ifndef SERVER
12266 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12267 Param2<bool, string> p = new Param2<bool, string>(false, "");
12268
12270 return;
12271
12272 bool play = p.param1;
12273 string soundSet = p.param2;
12274
12275 if (play)
12276 {
12278 {
12280 {
12282 }
12283 }
12284 else
12285 {
12287 }
12288 }
12289 else
12290 {
12292 }
12293
12294 break;
12295 #endif
12296
12297 }
12298
12300 {
12302 }
12303 }
12304
12305
12306
12307
12309 {
12310 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12311 return plugin.GetID(
name);
12312 }
12313
12315 {
12316 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12317 return plugin.GetName(id);
12318 }
12319
12322 {
12323
12324
12325 int varFlags;
12326 if (!ctx.
Read(varFlags))
12327 return;
12328
12329 if (varFlags & ItemVariableFlags.FLOAT)
12330 {
12332 }
12333 }
12334
12336 {
12337
12338 super.SerializeNumericalVars(floats_out);
12339
12340
12341
12343 {
12345 }
12346
12348 {
12350 }
12351
12353 {
12355 }
12356
12358 {
12363 }
12364
12366 {
12368 }
12369 }
12370
12372 {
12373
12374 super.DeSerializeNumericalVars(floats);
12375
12376
12377 int index = 0;
12378 int mask = Math.Round(floats.Get(index));
12379
12380 index++;
12381
12383 {
12385 {
12387 }
12388 else
12389 {
12390 float quantity = floats.Get(index);
12391 SetQuantity(quantity,
true,
false,
false,
false);
12392 }
12393 index++;
12394 }
12395
12397 {
12398 float wet = floats.Get(index);
12400 index++;
12401 }
12402
12404 {
12405 int liquidtype = Math.Round(floats.Get(index));
12407 index++;
12408 }
12409
12411 {
12413 index++;
12415 index++;
12417 index++;
12419 index++;
12420 }
12421
12423 {
12424 int cleanness = Math.Round(floats.Get(index));
12426 index++;
12427 }
12428 }
12429
12431 {
12432 super.WriteVarsToCTX(ctx);
12433
12434
12436 {
12438 }
12439
12441 {
12443 }
12444
12446 {
12448 }
12449
12451 {
12452 int r,g,b,a;
12458 }
12459
12461 {
12463 }
12464 }
12465
12467 {
12468 if (!super.ReadVarsFromCTX(ctx,version))
12469 return false;
12470
12471 int intValue;
12472 float value;
12473
12474 if (version < 140)
12475 {
12476 if (!ctx.
Read(intValue))
12477 return false;
12478
12479 m_VariablesMask = intValue;
12480 }
12481
12483 {
12484 if (!ctx.
Read(value))
12485 return false;
12486
12488 {
12490 }
12491 else
12492 {
12494 }
12495 }
12496
12497 if (version < 140)
12498 {
12500 {
12501 if (!ctx.
Read(value))
12502 return false;
12503 SetTemperatureDirect(value);
12504 }
12505 }
12506
12508 {
12509 if (!ctx.
Read(value))
12510 return false;
12512 }
12513
12515 {
12516 if (!ctx.
Read(intValue))
12517 return false;
12519 }
12520
12522 {
12523 int r,g,b,a;
12525 return false;
12527 return false;
12529 return false;
12531 return false;
12532
12534 }
12535
12537 {
12538 if (!ctx.
Read(intValue))
12539 return false;
12541 }
12542
12543 if (version >= 138 && version < 140)
12544 {
12546 {
12547 if (!ctx.
Read(intValue))
12548 return false;
12549 SetFrozen(intValue);
12550 }
12551 }
12552
12553 return true;
12554 }
12555
12556
12558 {
12561 {
12563 }
12564
12565 if (!super.OnStoreLoad(ctx, version))
12566 {
12568 return false;
12569 }
12570
12571 if (version >= 114)
12572 {
12573 bool hasQuickBarIndexSaved;
12574
12575 if (!ctx.
Read(hasQuickBarIndexSaved))
12576 {
12578 return false;
12579 }
12580
12581 if (hasQuickBarIndexSaved)
12582 {
12583 int itmQBIndex;
12584
12585
12586 if (!ctx.
Read(itmQBIndex))
12587 {
12589 return false;
12590 }
12591
12592 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12593 if (itmQBIndex != -1 && parentPlayer)
12594 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12595 }
12596 }
12597 else
12598 {
12599
12600 PlayerBase player;
12601 int itemQBIndex;
12602 if (version ==
int.
MAX)
12603 {
12604 if (!ctx.
Read(itemQBIndex))
12605 {
12607 return false;
12608 }
12609 }
12610 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12611 {
12612
12613 if (!ctx.
Read(itemQBIndex))
12614 {
12616 return false;
12617 }
12618 if (itemQBIndex != -1 && player)
12619 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12620 }
12621 }
12622
12623 if (version < 140)
12624 {
12625
12626 if (!LoadVariables(ctx, version))
12627 {
12629 return false;
12630 }
12631 }
12632
12633
12635 {
12637 return false;
12638 }
12639 if (version >= 132)
12640 {
12642 if (raib)
12643 {
12645 {
12647 return false;
12648 }
12649 }
12650 }
12651
12653 return true;
12654 }
12655
12656
12657
12659 {
12660 super.OnStoreSave(ctx);
12661
12662 PlayerBase player;
12663 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12664 {
12666
12667 int itemQBIndex = -1;
12668 itemQBIndex = player.FindQuickBarEntityIndex(this);
12669 ctx.
Write(itemQBIndex);
12670 }
12671 else
12672 {
12674 }
12675
12677
12679 if (raib)
12680 {
12682 }
12683 }
12684
12685
12687 {
12688 super.AfterStoreLoad();
12689
12691 {
12693 }
12694
12696 {
12699 }
12700 }
12701
12703 {
12704 super.EEOnAfterLoad();
12705
12707 {
12709 }
12710
12713 }
12714
12716 {
12717 return false;
12718 }
12719
12720
12721
12723 {
12725 {
12726 #ifdef PLATFORM_CONSOLE
12727
12729 {
12731 if (menu)
12732 {
12734 }
12735 }
12736 #endif
12737 }
12738
12740 {
12743 }
12744
12746 {
12747 SetWeightDirty();
12749 }
12751 {
12754 }
12755
12757 {
12760
12763 }
12765 {
12769 }
12770
12771 super.OnVariablesSynchronized();
12772 }
12773
12774
12775
12777 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12778 {
12779 if (!IsServerCheck(allow_client))
12780 return false;
12781
12783 return false;
12784
12787
12788 if (value <= (min + 0.001))
12789 value = min;
12790
12791 if (value == min)
12792 {
12793 if (destroy_config)
12794 {
12795 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12796 if (dstr)
12797 {
12799 this.Delete();
12800 return true;
12801 }
12802 }
12803 else if (destroy_forced)
12804 {
12806 this.Delete();
12807 return true;
12808 }
12809
12811 }
12812
12815
12817 {
12818 EntityAI parent = GetHierarchyRoot();
12819 InventoryLocation iLoc = new InventoryLocation();
12820 GetInventory().GetCurrentInventoryLocation(iLoc);
12822 {
12823 int iLocSlot = iLoc.
GetSlot();
12825 {
12827 }
12829 {
12831 }
12832 }
12833 }
12834
12836 {
12838
12839 if (delta)
12841 }
12842
12844
12845 return false;
12846 }
12847
12848
12850 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12851 {
12853 }
12854
12856 {
12859 }
12860
12862 {
12865 }
12866
12868 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12869 {
12870 float value_clamped = Math.Clamp(value, 0, 1);
12872 SetQuantity(result, destroy_config, destroy_forced);
12873 }
12874
12875
12878 {
12880 }
12881
12883 {
12885 }
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12897 {
12898 int slot = -1;
12899 GameInventory inventory = GetInventory();
12900 if (inventory)
12901 {
12902 InventoryLocation il = new InventoryLocation;
12905 }
12906
12908 }
12909
12911 {
12912 float quantity_max = 0;
12913
12915 {
12916 if (attSlotID != -1)
12917 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12918
12919 if (quantity_max <= 0)
12921 }
12922
12923 if (quantity_max <= 0)
12925
12926 return quantity_max;
12927 }
12928
12930 {
12932 }
12933
12935 {
12937 }
12938
12939
12941 {
12943 }
12944
12946 {
12948 }
12949
12951 {
12953 }
12954
12955
12957 {
12958
12959 float weightEx = GetWeightEx();
12960 float special = GetInventoryAndCargoWeight();
12961 return weightEx - special;
12962 }
12963
12964
12966 {
12968 }
12969
12971 {
12973 {
12974 #ifdef DEVELOPER
12975 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12976 {
12977 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12979 }
12980 #endif
12981
12982 return GetQuantity() * GetConfigWeightModified();
12983 }
12984 else if (HasEnergyManager())
12985 {
12986 #ifdef DEVELOPER
12987 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12988 {
12989 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12990 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12991 }
12992 #endif
12993 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12994 }
12995 else
12996 {
12997 #ifdef DEVELOPER
12998 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12999 {
13000 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13001 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13002 }
13003 #endif
13004 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13005 }
13006 }
13007
13010 {
13011 int item_count = 0;
13013
13014 GameInventory inventory = GetInventory();
13015 CargoBase cargo = inventory.
GetCargo();
13016 if (cargo != NULL)
13017 {
13019 }
13020
13022 for (int i = 0; i < nAttachments; ++i)
13023 {
13025 if (item)
13026 item_count += item.GetNumberOfItems();
13027 }
13028 return item_count;
13029 }
13030
13033 {
13034 float weight = 0;
13035 float wetness = 1;
13036 if (include_wetness)
13039 {
13040 weight = wetness * m_ConfigWeight;
13041 }
13043 {
13044 weight = 1;
13045 }
13046 return weight;
13047 }
13048
13049
13050
13052 {
13053 GameInventory inventory = GetInventory();
13054 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13055 {
13056 array<EntityAI> items = new array<EntityAI>;
13058 for (int i = 0; i < items.Count(); ++i)
13059 {
13061 if (item)
13062 {
13063 g_Game.ObjectDelete(item);
13064 }
13065 }
13066 }
13067 }
13068
13069
13070
13071
13073 {
13074 float energy = 0;
13075 if (HasEnergyManager())
13076 {
13077 energy = GetCompEM().GetEnergy();
13078 }
13079 return energy;
13080 }
13081
13082
13084 {
13085 super.OnEnergyConsumed();
13086
13088 }
13089
13091 {
13092 super.OnEnergyAdded();
13093
13095 }
13096
13097
13099 {
13100 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13101 {
13103 {
13104 float energy_0to1 = GetCompEM().GetEnergy0To1();
13106 }
13107 }
13108 }
13109
13110
13112 {
13113 return ConfigGetFloat("heatIsolation");
13114 }
13115
13117 {
13119 }
13120
13122 {
13123 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13124 if (
g_Game.ConfigIsExisting(paramPath))
13125 return g_Game.ConfigGetFloat(paramPath);
13126
13127 return 0.0;
13128 }
13129
13131 {
13132 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13133 if (
g_Game.ConfigIsExisting(paramPath))
13134 return g_Game.ConfigGetFloat(paramPath);
13135
13136 return 0.0;
13137 }
13138
13139 override void SetWet(
float value,
bool allow_client =
false)
13140 {
13141 if (!IsServerCheck(allow_client))
13142 return;
13143
13146
13148
13149 m_VarWet = Math.Clamp(value, min, max);
13150
13152 {
13155 }
13156 }
13157
13158 override void AddWet(
float value)
13159 {
13161 }
13162
13164 {
13166 }
13167
13169 {
13171 }
13172
13174 {
13176 }
13177
13179 {
13181 }
13182
13184 {
13186 }
13187
13188 override void OnWetChanged(
float newVal,
float oldVal)
13189 {
13192 if (newLevel != oldLevel)
13193 {
13195 }
13196 }
13197
13199 {
13200 SetWeightDirty();
13201 }
13202
13204 {
13205 return GetWetLevelInternal(
m_VarWet);
13206 }
13207
13208
13209
13211 {
13213 }
13214
13216 {
13218 }
13219
13221 {
13223 }
13224
13226 {
13228 }
13229
13230
13231
13233 {
13234 if (ConfigIsExisting("itemModelLength"))
13235 {
13236 return ConfigGetFloat("itemModelLength");
13237 }
13238 return 0;
13239 }
13240
13242 {
13243 if (ConfigIsExisting("itemAttachOffset"))
13244 {
13245 return ConfigGetFloat("itemAttachOffset");
13246 }
13247 return 0;
13248 }
13249
13250 override void SetCleanness(
int value,
bool allow_client =
false)
13251 {
13252 if (!IsServerCheck(allow_client))
13253 return;
13254
13256
13258
13261 }
13262
13264 {
13266 }
13267
13269 {
13270 return true;
13271 }
13272
13273
13274
13275
13277 {
13279 }
13280
13282 {
13284 }
13285
13286
13287
13288
13289 override void SetColor(
int r,
int g,
int b,
int a)
13290 {
13296 }
13298 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13299 {
13304 }
13305
13307 {
13309 }
13310
13313 {
13314 int r,g,b,a;
13316 r = r/255;
13317 g = g/255;
13318 b = b/255;
13319 a = a/255;
13320 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13321 }
13322
13323
13324
13325 override void SetLiquidType(
int value,
bool allow_client =
false)
13326 {
13327 if (!IsServerCheck(allow_client))
13328 return;
13329
13334 }
13335
13337 {
13338 return ConfigGetInt("varLiquidTypeInit");
13339 }
13340
13342 {
13344 }
13345
13347 {
13349 SetFrozen(false);
13350 }
13351
13354 {
13355 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13356 }
13357
13358
13361 {
13362 PlayerBase nplayer;
13363 if (PlayerBase.CastTo(nplayer, player))
13364 {
13366 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13367 }
13368 }
13369
13370
13373 {
13374 PlayerBase nplayer;
13375 if (PlayerBase.CastTo(nplayer,player))
13376 {
13377 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13378 }
13379
13380 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13381
13382 if (HasEnergyManager())
13383 {
13384 GetCompEM().UpdatePlugState();
13385 }
13386 }
13387
13388
13390 {
13391 super.OnPlacementStarted(player);
13392
13394 }
13395
13396 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13397 {
13399 {
13400 m_AdminLog.OnPlacementComplete(player,
this);
13401 }
13402
13403 super.OnPlacementComplete(player, position, orientation);
13404 }
13405
13406
13407
13408
13409
13411 {
13413 {
13414 return true;
13415 }
13416 else
13417 {
13418 return false;
13419 }
13420 }
13421
13422
13424 {
13426 {
13428 }
13429 }
13430
13431
13433 {
13435 }
13436
13438 {
13440 }
13441
13442 override void InsertAgent(
int agent,
float count = 1)
13443 {
13444 if (count < 1)
13445 return;
13446
13448 }
13449
13452 {
13454 }
13455
13456
13458 {
13460 }
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
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
13504 {
13506 return false;
13507 return true;
13508 }
13509
13511 {
13512
13514 }
13515
13516
13519 {
13520 super.CheckForRoofLimited(timeTresholdMS);
13521
13522 float time =
g_Game.GetTime();
13523 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13524 {
13525 m_PreviousRoofTestTime = time;
13526 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13527 }
13528 }
13529
13530
13532 {
13534 {
13535 return 0;
13536 }
13537
13538 if (GetInventory().GetAttachmentSlotsCount() != 0)
13539 {
13540 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13541 if (filter)
13542 return filter.GetProtectionLevel(type, false, system);
13543 else
13544 return 0;
13545 }
13546
13547 string subclassPath, entryName;
13548
13549 switch (type)
13550 {
13552 entryName = "biological";
13553 break;
13555 entryName = "chemical";
13556 break;
13557 default:
13558 entryName = "biological";
13559 break;
13560 }
13561
13562 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13563
13564 return g_Game.ConfigGetFloat(subclassPath + entryName);
13565 }
13566
13567
13568
13571 {
13572 if (!IsMagazine())
13574
13576 }
13577
13578
13579
13580
13581
13586 {
13587 return true;
13588 }
13589
13591 {
13593 }
13594
13595
13596
13597
13598
13600 {
13601 if (parent)
13602 {
13603 if (parent.IsInherited(DayZInfected))
13604 return true;
13605
13606 if (!parent.IsRuined())
13607 return true;
13608 }
13609
13610 return true;
13611 }
13612
13614 {
13615 if (!super.CanPutAsAttachment(parent))
13616 {
13617 return false;
13618 }
13619
13620 if (!IsRuined() && !parent.IsRuined())
13621 {
13622 return true;
13623 }
13624
13625 return false;
13626 }
13627
13629 {
13630
13631
13632
13633
13634 return super.CanReceiveItemIntoCargo(item);
13635 }
13636
13638 {
13639
13640
13641
13642
13643 GameInventory attachmentInv = attachment.GetInventory();
13645 {
13646 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13647 return false;
13648 }
13649
13650 InventoryLocation loc = new InventoryLocation();
13651 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13652 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13653 return false;
13654
13655 return super.CanReceiveAttachment(attachment, slotId);
13656 }
13657
13659 {
13660 if (!super.CanReleaseAttachment(attachment))
13661 return false;
13662
13663 return GetInventory().AreChildrenAccessible();
13664 }
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13687 {
13688 int id = muzzle_owner.GetMuzzleID();
13689 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13690
13691 if (WPOF_array)
13692 {
13693 for (int i = 0; i < WPOF_array.Count(); i++)
13694 {
13695 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13696
13697 if (WPOF)
13698 {
13699 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13700 }
13701 }
13702 }
13703 }
13704
13705
13707 {
13708 int id = muzzle_owner.GetMuzzleID();
13710
13711 if (WPOBE_array)
13712 {
13713 for (int i = 0; i < WPOBE_array.Count(); i++)
13714 {
13715 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13716
13717 if (WPOBE)
13718 {
13719 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13720 }
13721 }
13722 }
13723 }
13724
13725
13727 {
13728 int id = muzzle_owner.GetMuzzleID();
13729 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13730
13731 if (WPOOH_array)
13732 {
13733 for (int i = 0; i < WPOOH_array.Count(); i++)
13734 {
13735 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13736
13737 if (WPOOH)
13738 {
13739 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13740 }
13741 }
13742 }
13743 }
13744
13745
13747 {
13748 int id = muzzle_owner.GetMuzzleID();
13749 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13750
13751 if (WPOOH_array)
13752 {
13753 for (int i = 0; i < WPOOH_array.Count(); i++)
13754 {
13755 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13756
13757 if (WPOOH)
13758 {
13759 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13760 }
13761 }
13762 }
13763 }
13764
13765
13767 {
13768 int id = muzzle_owner.GetMuzzleID();
13769 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13770
13771 if (WPOOH_array)
13772 {
13773 for (int i = 0; i < WPOOH_array.Count(); i++)
13774 {
13775 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13776
13777 if (WPOOH)
13778 {
13779 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13780 }
13781 }
13782 }
13783 }
13784
13785
13786
13788 {
13790 {
13791 return true;
13792 }
13793
13794 return false;
13795 }
13796
13798 {
13800 {
13801 return true;
13802 }
13803
13804 return false;
13805 }
13806
13808 {
13810 {
13811 return true;
13812 }
13813
13814 return false;
13815 }
13816
13818 {
13819 return false;
13820 }
13821
13824 {
13825 return UATimeSpent.DEFAULT_DEPLOY;
13826 }
13827
13828
13829
13830
13832 {
13834 SetSynchDirty();
13835 }
13836
13838 {
13840 }
13841
13842
13844 {
13845 return false;
13846 }
13847
13850 {
13851 string att_type = "None";
13852
13853 if (ConfigIsExisting("soundAttType"))
13854 {
13855 att_type = ConfigGetString("soundAttType");
13856 }
13857
13859 }
13860
13862 {
13864 }
13865
13866
13867
13868
13869
13875
13877 {
13880
13882 }
13883
13884
13886 {
13888 return;
13889
13891
13894
13897
13898 SoundParameters params = new SoundParameters();
13902 }
13903
13904
13906 {
13908 {
13911
13912 SetSynchDirty();
13913
13916 }
13917 }
13918
13920 {
13922 }
13923
13924
13926 {
13928 return;
13929
13931 SetSynchDirty();
13932
13935 }
13936
13938 {
13941 }
13942
13944 {
13946 }
13947
13948 void OnApply(PlayerBase player);
13949
13951 {
13952 return 1.0;
13953 };
13954
13956 {
13958 }
13959
13961 {
13963 }
13964
13966
13968 {
13969 SetDynamicPhysicsLifeTime(0.01);
13971 }
13972
13974 {
13975 array<string> zone_names = new array<string>;
13976 GetDamageZones(zone_names);
13977 for (int i = 0; i < zone_names.Count(); i++)
13978 {
13979 SetHealthMax(zone_names.Get(i),"Health");
13980 }
13981 SetHealthMax("","Health");
13982 }
13983
13986 {
13987 float global_health = GetHealth01("","Health");
13988 array<string> zones = new array<string>;
13989 GetDamageZones(zones);
13990
13991 for (int i = 0; i < zones.Count(); i++)
13992 {
13993 SetHealth01(zones.Get(i),"Health",global_health);
13994 }
13995 }
13996
13999 {
14000 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14001 }
14002
14004 {
14005 if (!hasRootAsPlayer)
14006 {
14007 if (refParentIB)
14008 {
14009
14010 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14011 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14012
14013 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14014 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14015
14018 }
14019 else
14020 {
14021
14024 }
14025 }
14026 }
14027
14029 {
14031 {
14032 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14033 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14034 {
14035 float heatPermCoef = 1.0;
14037 while (ent)
14038 {
14039 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14040 ent = ent.GetHierarchyParent();
14041 }
14042
14043 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14044 }
14045 }
14046 }
14047
14049 {
14050
14051 EntityAI parent = GetHierarchyParent();
14052 if (!parent)
14053 {
14054 hasParent = false;
14055 hasRootAsPlayer = false;
14056 }
14057 else
14058 {
14059 hasParent = true;
14060 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14061 refParentIB =
ItemBase.Cast(parent);
14062 }
14063 }
14064
14065 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14066 {
14067
14068 }
14069
14071 {
14072
14073 return false;
14074 }
14075
14077 {
14078
14079
14080 return false;
14081 }
14082
14084 {
14085
14086 return false;
14087 }
14088
14091 {
14092 return !GetIsFrozen() &&
IsOpen();
14093 }
14094
14096 {
14097 bool hasParent = false, hasRootAsPlayer = false;
14099
14100 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14101 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14102
14103 if (wwtu || foodDecay)
14104 {
14108
14109 if (processWetness || processTemperature || processDecay)
14110 {
14112
14113 if (processWetness)
14114 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14115
14116 if (processTemperature)
14118
14119 if (processDecay)
14120 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14121 }
14122 }
14123 }
14124
14127 {
14129 }
14130
14132 {
14135
14136 return super.GetTemperatureFreezeThreshold();
14137 }
14138
14140 {
14143
14144 return super.GetTemperatureThawThreshold();
14145 }
14146
14148 {
14151
14152 return super.GetItemOverheatThreshold();
14153 }
14154
14156 {
14158 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14159
14160 return super.GetTemperatureFreezeTime();
14161 }
14162
14164 {
14166 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14167
14168 return super.GetTemperatureThawTime();
14169 }
14170
14175
14177 {
14178 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14179 }
14180
14182 {
14183 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14184 }
14185
14188 {
14190 }
14191
14193 {
14195 }
14196
14198 {
14200 }
14201
14204 {
14205 return null;
14206 }
14207
14210 {
14211 return false;
14212 }
14213
14215 {
14217 {
14220 if (!trg)
14221 {
14223 explosive = this;
14224 }
14225
14226 explosive.PairRemote(trg);
14228
14229 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14230 trg.SetPersistentPairID(persistentID);
14231 explosive.SetPersistentPairID(persistentID);
14232
14233 return true;
14234 }
14235 return false;
14236 }
14237
14240 {
14241 float ret = 1.0;
14244 ret *= GetHealth01();
14245
14246 return ret;
14247 }
14248
14249 #ifdef DEVELOPER
14250 override void SetDebugItem()
14251 {
14252 super.SetDebugItem();
14253 _itemBase = this;
14254 }
14255
14257 {
14258 string text = super.GetDebugText();
14259
14261 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14262
14263 return text;
14264 }
14265 #endif
14266
14268 {
14269 return true;
14270 }
14271
14273
14275
14277 {
14280 }
14281
14282
14290
14306
14307 [
Obsolete(
"Use ItemSoundHandler instead")]
14310 {
14311 if (!
g_Game.IsDedicatedServer())
14312 {
14313 if (ConfigIsExisting("attachSoundSet"))
14314 {
14315 string cfg_path = "";
14316 string soundset = "";
14317 string type_name =
GetType();
14318
14321 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14322 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14323
14324 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14325 {
14326 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14327 {
14328 if (cfg_slot_array[i] == slot_type)
14329 {
14330 soundset = cfg_soundset_array[i];
14331 break;
14332 }
14333 }
14334 }
14335
14336 if (soundset != "")
14337 {
14338 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14340 }
14341 }
14342 }
14343 }
14344
14346}
14347
14349{
14351 if (entity)
14352 {
14353 bool is_item = entity.IsInherited(
ItemBase);
14354 if (is_item && full_quantity)
14355 {
14358 }
14359 }
14360 else
14361 {
14363 return NULL;
14364 }
14365 return entity;
14366}
14367
14369{
14370 if (item)
14371 {
14372 if (health > 0)
14373 item.SetHealth("", "", health);
14374
14375 if (item.CanHaveTemperature())
14376 {
14378 if (item.CanFreeze())
14379 item.SetFrozen(false);
14380 }
14381
14382 if (item.HasEnergyManager())
14383 {
14384 if (quantity >= 0)
14385 {
14386 item.GetCompEM().SetEnergy0To1(quantity);
14387 }
14388 else
14389 {
14391 }
14392 }
14393 else if (item.IsMagazine())
14394 {
14395 Magazine mag = Magazine.Cast(item);
14396 if (quantity >= 0)
14397 {
14398 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14399 }
14400 else
14401 {
14403 }
14404
14405 }
14406 else
14407 {
14408 if (quantity >= 0)
14409 {
14410 item.SetQuantityNormalized(quantity, false);
14411 }
14412 else
14413 {
14415 }
14416
14417 }
14418 }
14419}
14420
14421#ifdef DEVELOPER
14423#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.