9425{
9427 {
9428 return true;
9429 }
9430};
9431
9433{
9434
9435};
9436
9437
9438
9440{
9444
9446
9449
9450
9451
9452
9453
9462
9468
9473
9478
9499 protected bool m_IsResultOfSplit
9500
9502
9507
9508
9509
9511
9515
9516
9517
9519
9522
9523
9524
9530
9531
9539
9542
9543
9545
9546
9548
9549
9554
9555
9560
9562
9563
9565
9566
9568 {
9573
9574 if (!
g_Game.IsDedicatedServer())
9575 {
9577 {
9579
9581 {
9583 }
9584 }
9585
9588 }
9589
9590 m_OldLocation = null;
9591
9593 {
9595 }
9596
9597 if (ConfigIsExisting("headSelectionsToHide"))
9598 {
9601 }
9602
9604 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9605 {
9607 }
9608
9610
9611 m_IsResultOfSplit = false;
9612
9614 }
9615
9617 {
9618 super.InitItemVariables();
9619
9625 m_Count = ConfigGetInt(
"count");
9626
9629
9634
9637
9642
9654
9658
9659
9662 if (ConfigIsExisting("canBeSplit"))
9663 {
9666 }
9667
9669 if (ConfigIsExisting("itemBehaviour"))
9671
9672
9675 RegisterNetSyncVariableInt("m_VarLiquidType");
9676 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9677
9678 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9679 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9680 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9681
9682 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9683 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9684 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9685 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9686
9687 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9688 RegisterNetSyncVariableBool("m_IsTakeable");
9689 RegisterNetSyncVariableBool("m_IsHologram");
9690
9693 {
9696 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9697 }
9698
9700
9702 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9704
9706 }
9707
9709 {
9711 }
9712
9714 {
9717 {
9722 }
9723 }
9724
9725 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9726 {
9728 {
9731 }
9732
9734 }
9735
9737 {
9743 }
9744
9746
9748 {
9750
9751 if (!action)
9752 {
9753 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9754 return;
9755 }
9756
9758 if (!ai)
9759 {
9761 return;
9762 }
9763
9765 if (!action_array)
9766 {
9767 action_array = new array<ActionBase_Basic>;
9769 }
9770 if (LogManager.IsActionLogEnable())
9771 {
9772 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9773 }
9774
9775 if (action_array.Find(action) != -1)
9776 {
9777 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9778 }
9779 else
9780 {
9781 action_array.Insert(action);
9782 }
9783 }
9784
9786 {
9787 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9788 ActionBase action = player.GetActionManager().GetAction(actionName);
9791
9792 if (action_array)
9793 {
9794 action_array.RemoveItem(action);
9795 }
9796 }
9797
9798
9799
9801 {
9802 ActionOverrideData overrideData = new ActionOverrideData();
9806
9808 if (!actionMap)
9809 {
9812 }
9813
9814 actionMap.Insert(this.
Type(), overrideData);
9815
9816 }
9817
9819
9821
9822
9824 {
9827
9830
9831 string config_to_search = "CfgVehicles";
9832 string muzzle_owner_config;
9833
9835 {
9836 if (IsInherited(Weapon))
9837 config_to_search = "CfgWeapons";
9838
9839 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9840
9841 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9842
9843 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9844
9845 if (config_OnFire_subclass_count > 0)
9846 {
9847 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9848
9849 for (int i = 0; i < config_OnFire_subclass_count; i++)
9850 {
9851 string particle_class = "";
9852 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9853 string config_OnFire_entry = config_OnFire_class + particle_class;
9854 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9855 WPOF_array.Insert(WPOF);
9856 }
9857
9858
9860 }
9861 }
9862
9864 {
9865 config_to_search = "CfgWeapons";
9866 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9867
9868 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9869
9870 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9871
9872 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9873 {
9874 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9875
9876 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9877 {
9878 string particle_class2 = "";
9879 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9880 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9881 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9882 WPOBE_array.Insert(WPOBE);
9883 }
9884
9885
9887 }
9888 }
9889 }
9890
9891
9893 {
9896
9898 {
9899 string config_to_search = "CfgVehicles";
9900
9901 if (IsInherited(Weapon))
9902 config_to_search = "CfgWeapons";
9903
9904 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9905 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9906
9907 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9908 {
9909
9911
9913 {
9915 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9917 return;
9918 }
9919
9922
9923
9924
9925 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9926 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9927
9928 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9929 {
9930 string particle_class = "";
9931 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9932 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9933 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9934
9935 if (entry_type == CT_CLASS)
9936 {
9937 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9938 WPOOH_array.Insert(WPOF);
9939 }
9940 }
9941
9942
9944 }
9945 }
9946 }
9947
9949 {
9951 }
9952
9954 {
9956 {
9958
9961
9964
9965 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9966 }
9967 }
9968
9970 {
9972 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9973
9975 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9976
9978 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9979
9981 {
9983 }
9984 }
9985
9987 {
9989 }
9990
9992 {
9995 else
9997
9999 {
10002 }
10003 else
10004 {
10007
10010 }
10011
10013 }
10014
10016 {
10018 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10019 }
10020
10022 {
10024 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10026 }
10027
10029 {
10031 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10032 }
10033
10035 {
10038
10039 OverheatingParticle OP = new OverheatingParticle();
10044
10046 }
10047
10049 {
10052
10053 return -1;
10054 }
10055
10057 {
10059 {
10062
10063 for (int i = count; i > 0; --i)
10064 {
10065 int id = i - 1;
10068
10071
10072 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10073 {
10074 if (p)
10075 {
10078 }
10079 }
10080 }
10081 }
10082 }
10083
10085 {
10087 {
10089 {
10090 int id = i - 1;
10092
10093 if (OP)
10094 {
10096
10097 if (p)
10098 {
10100 }
10101
10102 delete OP;
10103 }
10104 }
10105
10108 }
10109 }
10110
10113 {
10114 return 0.0;
10115 }
10116
10117
10119 {
10120 return 250;
10121 }
10122
10124 {
10125 return 0;
10126 }
10127
10130 {
10132 return true;
10133
10134 return false;
10135 }
10136
10139 {
10142
10144 {
10146 }
10147 else
10148 {
10149
10151 }
10152
10154 }
10155
10162 {
10163 return -1;
10164 }
10165
10166
10167
10168
10170 {
10172 {
10173 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10174 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10175
10176 if (r_index >= 0)
10177 {
10178 InventoryLocation r_il = new InventoryLocation;
10179 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10180
10181 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10184 {
10185 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10186 }
10188 {
10189 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10190 }
10191
10192 }
10193
10194 player.GetHumanInventory().ClearUserReservedLocation(this);
10195 }
10196
10199 }
10200
10201
10202
10203
10205 {
10206 return ItemBase.m_DebugActionsMask;
10207 }
10208
10210 {
10211 return ItemBase.m_DebugActionsMask & mask;
10212 }
10213
10215 {
10216 ItemBase.m_DebugActionsMask = mask;
10217 }
10218
10220 {
10221 ItemBase.m_DebugActionsMask |= mask;
10222 }
10223
10225 {
10226 ItemBase.m_DebugActionsMask &= ~mask;
10227 }
10228
10230 {
10232 {
10234 }
10235 else
10236 {
10238 }
10239 }
10240
10241
10243 {
10244 if (GetEconomyProfile())
10245 {
10246 float q_max = GetEconomyProfile().GetQuantityMax();
10247 if (q_max > 0)
10248 {
10249 float q_min = GetEconomyProfile().GetQuantityMin();
10250 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10251
10253 {
10254 ComponentEnergyManager comp = GetCompEM();
10256 {
10258 }
10259 }
10261 {
10263
10264 }
10265
10266 }
10267 }
10268 }
10269
10272 {
10273 EntityAI parent = GetHierarchyParent();
10274
10275 if (parent)
10276 {
10277 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10278 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10279 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10280 }
10281 }
10282
10285 {
10286 EntityAI parent = GetHierarchyParent();
10287
10288 if (parent)
10289 {
10290 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10291 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10292 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10293 }
10294 }
10295
10297 {
10298
10299
10300
10301
10303
10305 {
10306 if (ScriptInputUserData.CanStoreInputUserData())
10307 {
10308 ScriptInputUserData ctx = new ScriptInputUserData;
10314 ctx.
Write(use_stack_max);
10317
10319 {
10320 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10321 }
10322 }
10323 }
10324 else if (!
g_Game.IsMultiplayer())
10325 {
10327 }
10328 }
10329
10331 {
10333 }
10334
10336 {
10338 }
10339
10341 {
10343 }
10344
10346 {
10347
10348 return false;
10349 }
10350
10352 {
10353 return false;
10354 }
10355
10359 {
10360 return false;
10361 }
10362
10364 {
10365 return "";
10366 }
10367
10369
10371 {
10372 return false;
10373 }
10374
10376 {
10377 return true;
10378 }
10379
10380
10381
10383 {
10384 return true;
10385 }
10386
10388 {
10389 return true;
10390 }
10391
10393 {
10394 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10396 }
10397
10399 {
10401 }
10402
10404 {
10406 if (!is_being_placed)
10408 SetSynchDirty();
10409 }
10410
10411
10413
10415 {
10417 }
10418
10420 {
10422 }
10423
10425 {
10426 return 1;
10427 }
10428
10430 {
10431 return false;
10432 }
10433
10435 {
10437 SetSynchDirty();
10438 }
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10475 {
10476 super.OnMovedInsideCargo(container);
10477
10478 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10479 }
10480
10481 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10482 {
10483 super.EEItemLocationChanged(oldLoc, newLoc);
10484
10485 PlayerBase newPlayer = null;
10486 PlayerBase oldPlayer = null;
10487
10488 if (newLoc.GetParent())
10489 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10490
10491 if (oldLoc.GetParent())
10492 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10493
10495 {
10496 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10497
10498 if (rIndex >= 0)
10499 {
10500 InventoryLocation rIl = new InventoryLocation;
10501 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10502
10503 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10506 {
10507 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10508 }
10510 {
10512 }
10513
10514 }
10515 }
10516
10518 {
10519 if (newPlayer)
10520 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10521
10522 if (newPlayer == oldPlayer)
10523 {
10524 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10525 {
10527 {
10528 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10529 {
10530 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10531 }
10532 }
10533 else
10534 {
10535 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10536 }
10537 }
10538
10539 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10540 {
10541 int type = oldLoc.GetType();
10543 {
10544 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10545 }
10547 {
10548 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10549 }
10550 }
10551 if (!m_OldLocation)
10552 {
10553 m_OldLocation = new InventoryLocation;
10554 }
10555 m_OldLocation.Copy(oldLoc);
10556 }
10557 else
10558 {
10559 if (m_OldLocation)
10560 {
10561 m_OldLocation.Reset();
10562 }
10563 }
10564
10565 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10566 }
10567 else
10568 {
10569 if (newPlayer)
10570 {
10571 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10572 if (resIndex >= 0)
10573 {
10574 InventoryLocation il = new InventoryLocation;
10575 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10577 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10580 {
10581 il.
GetParent().GetOnReleaseLock().Invoke(it);
10582 }
10584 {
10586 }
10587
10588 }
10589 }
10591 {
10592
10594 }
10595
10596 if (m_OldLocation)
10597 {
10598 m_OldLocation.Reset();
10599 }
10600 }
10601
10603 {
10604 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10605 }
10606
10608 {
10609 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10610 }
10611 }
10612
10613 override void EOnContact(IEntity other, Contact extra)
10614 {
10616 {
10617 int liquidType = -1;
10619 if (impactSpeed > 0.0)
10620 {
10622 #ifndef SERVER
10624 #else
10626 SetSynchDirty();
10627 #endif
10629 }
10630 }
10631
10632 #ifdef SERVER
10633 if (GetCompEM() && GetCompEM().IsPlugged())
10634 {
10635 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10636 GetCompEM().UnplugThis();
10637 }
10638 #endif
10639 }
10640
10642
10644 {
10646 }
10647
10649 {
10650
10651 }
10652
10654 {
10655 super.OnItemLocationChanged(old_owner, new_owner);
10656
10657 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10658 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10659
10660 if (!relatedPlayer && playerNew)
10661 relatedPlayer = playerNew;
10662
10663 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10664 {
10666 if (actionMgr)
10667 {
10668 ActionBase currentAction = actionMgr.GetRunningAction();
10669 if (currentAction)
10671 }
10672 }
10673
10674 Man ownerPlayerOld = null;
10675 Man ownerPlayerNew = null;
10676
10677 if (old_owner)
10678 {
10679 if (old_owner.
IsMan())
10680 {
10681 ownerPlayerOld = Man.Cast(old_owner);
10682 }
10683 else
10684 {
10685 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10686 }
10687 }
10688 else
10689 {
10691 {
10693
10694 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10695 {
10696 GetCompEM().UnplugThis();
10697 }
10698 }
10699 }
10700
10701 if (new_owner)
10702 {
10703 if (new_owner.
IsMan())
10704 {
10705 ownerPlayerNew = Man.Cast(new_owner);
10706 }
10707 else
10708 {
10709 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10710 }
10711 }
10712
10713 if (ownerPlayerOld != ownerPlayerNew)
10714 {
10715 if (ownerPlayerOld)
10716 {
10717 array<EntityAI> subItemsExit = new array<EntityAI>;
10719 for (int i = 0; i < subItemsExit.Count(); i++)
10720 {
10723 }
10724 }
10725
10726 if (ownerPlayerNew)
10727 {
10728 array<EntityAI> subItemsEnter = new array<EntityAI>;
10730 for (int j = 0; j < subItemsEnter.Count(); j++)
10731 {
10734 }
10735 }
10736 }
10737 else if (ownerPlayerNew != null)
10738 {
10739 PlayerBase nplayer;
10740 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10741 {
10742 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10744 for (int k = 0; k < subItemsUpdate.Count(); k++)
10745 {
10747 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10748 }
10749 }
10750 }
10751
10752 if (old_owner)
10753 old_owner.OnChildItemRemoved(this);
10754 if (new_owner)
10755 new_owner.OnChildItemReceived(this);
10756 }
10757
10758
10760 {
10761 super.EEDelete(parent);
10762 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10763 if (player)
10764 {
10766
10767 if (player.IsAlive())
10768 {
10769 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10770 if (r_index >= 0)
10771 {
10772 InventoryLocation r_il = new InventoryLocation;
10773 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10774
10775 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10778 {
10779 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10780 }
10782 {
10783 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10784 }
10785
10786 }
10787
10788 player.RemoveQuickBarEntityShortcut(this);
10789 }
10790 }
10791 }
10792
10794 {
10795 super.EEKilled(killer);
10796
10799 {
10800 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10801 {
10802 if (IsMagazine())
10803 {
10804 if (Magazine.Cast(this).GetAmmoCount() > 0)
10805 {
10807 }
10808 }
10809 else
10810 {
10812 }
10813 }
10814 }
10815 }
10816
10818 {
10819 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10820
10821 super.OnWasAttached(parent, slot_id);
10822
10825
10828 }
10829
10831 {
10832 super.OnWasDetached(parent, slot_id);
10833
10836
10839 }
10840
10842 {
10843 int idx;
10846
10847 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10848 if (inventory_slots.Count() < 1)
10849 {
10850 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10851 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10852 }
10853 else
10854 {
10855 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10856 }
10857
10858 idx = inventory_slots.Find(slot);
10859 if (idx < 0)
10860 return "";
10861
10862 return attach_types.Get(idx);
10863 }
10864
10866 {
10867 int idx = -1;
10868 string slot;
10869
10872
10873 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10874 if (inventory_slots.Count() < 1)
10875 {
10876 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10877 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10878 }
10879 else
10880 {
10881 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10882 if (detach_types.Count() < 1)
10883 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10884 }
10885
10886 for (int i = 0; i < inventory_slots.Count(); i++)
10887 {
10888 slot = inventory_slots.Get(i);
10889 }
10890
10891 if (slot != "")
10892 {
10893 if (detach_types.Count() == 1)
10894 idx = 0;
10895 else
10896 idx = inventory_slots.Find(slot);
10897 }
10898 if (idx < 0)
10899 return "";
10900
10901 return detach_types.Get(idx);
10902 }
10903
10905 {
10906
10908
10909
10910 float min_time = 1;
10911 float max_time = 3;
10912 float delay = Math.RandomFloat(min_time, max_time);
10913
10914 explode_timer.Run(delay, this, "DoAmmoExplosion");
10915 }
10916
10918 {
10919 Magazine magazine = Magazine.Cast(this);
10920 int pop_sounds_count = 6;
10921 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10922
10923
10924 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10925 string sound_name = pop_sounds[ sound_idx ];
10926 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10927
10928
10929 magazine.ServerAddAmmoCount(-1);
10930
10931
10932 float min_temp_to_explode = 100;
10933
10934 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10935 {
10937 }
10938 }
10939
10940
10941 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10942 {
10943 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10944
10945 const int CHANCE_DAMAGE_CARGO = 4;
10946 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10947 const int CHANCE_DAMAGE_NOTHING = 2;
10948
10950 {
10951 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10952 int chances;
10953 int rnd;
10954
10955 if (GetInventory().GetCargo())
10956 {
10957 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10958 rnd = Math.RandomInt(0,chances);
10959
10960 if (rnd < CHANCE_DAMAGE_CARGO)
10961 {
10963 }
10964 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10965 {
10967 }
10968 }
10969 else
10970 {
10971 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10972 rnd = Math.RandomInt(0,chances);
10973
10974 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10975 {
10977 }
10978 }
10979 }
10980 }
10981
10983 {
10984 CargoBase cargo = GetInventory().GetCargo();
10985 if (cargo)
10986 {
10988 if (item_count > 0)
10989 {
10990 int random_pick = Math.RandomInt(0, item_count);
10992 if (!item.IsExplosive())
10993 {
10994 item.AddHealth("","",damage);
10995 return true;
10996 }
10997 }
10998 }
10999 return false;
11000 }
11001
11003 {
11004 GameInventory inventory = GetInventory();
11006 if (attachment_count > 0)
11007 {
11008 int random_pick = Math.RandomInt(0, attachment_count);
11010 if (!attachment.IsExplosive())
11011 {
11012 attachment.AddHealth("","",damage);
11013 return true;
11014 }
11015 }
11016 return false;
11017 }
11018
11020 {
11022 }
11023
11025 {
11027 return GetInventory().CanRemoveEntity();
11028
11029 return false;
11030 }
11031
11033 {
11034
11036 return false;
11037
11038
11040 return false;
11041
11042
11043
11045 if (delta == 0)
11046 return false;
11047
11048
11049 return true;
11050 }
11051
11053 {
11055 {
11056 if (ScriptInputUserData.CanStoreInputUserData())
11057 {
11058 ScriptInputUserData ctx = new ScriptInputUserData;
11063 ctx.
Write(destination_entity);
11065 ctx.
Write(slot_id);
11067 }
11068 }
11069 else if (!
g_Game.IsMultiplayer())
11070 {
11072 }
11073 }
11074
11076 {
11077 float split_quantity_new;
11081 InventoryLocation loc = new InventoryLocation;
11082
11083 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11084 {
11086 split_quantity_new = stack_max;
11087 else
11089
11091 {
11092 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11093 if (new_item)
11094 {
11095 new_item.SetResultOfSplit(true);
11096 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11098 new_item.
SetQuantity(split_quantity_new,
false,
true);
11099 }
11100 }
11101 }
11102 else if (destination_entity && slot_id == -1)
11103 {
11104 if (quantity > stack_max)
11105 split_quantity_new = stack_max;
11106 else
11107 split_quantity_new = quantity;
11108
11110 {
11111 GameInventory destinationInventory = destination_entity.GetInventory();
11113 {
11116 }
11117
11118 if (new_item)
11119 {
11120 new_item.SetResultOfSplit(true);
11121 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11123 new_item.
SetQuantity(split_quantity_new,
false,
true);
11124 }
11125 }
11126 }
11127 else
11128 {
11129 if (stack_max != 0)
11130 {
11132 {
11134 }
11135
11136 if (split_quantity_new == 0)
11137 {
11138 if (!
g_Game.IsMultiplayer())
11139 player.PhysicalPredictiveDropItem(this);
11140 else
11141 player.ServerDropEntity(this);
11142 return;
11143 }
11144
11146 {
11148
11149 if (new_item)
11150 {
11151 new_item.SetResultOfSplit(true);
11152 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11155 new_item.PlaceOnSurface();
11156 }
11157 }
11158 }
11159 }
11160 }
11161
11163 {
11164 float split_quantity_new;
11168 InventoryLocation loc = new InventoryLocation;
11169
11170 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11171 {
11173 split_quantity_new = stack_max;
11174 else
11176
11178 {
11179 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11180 if (new_item)
11181 {
11182 new_item.SetResultOfSplit(true);
11183 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11185 new_item.
SetQuantity(split_quantity_new,
false,
true);
11186 }
11187 }
11188 }
11189 else if (destination_entity && slot_id == -1)
11190 {
11191 if (quantity > stack_max)
11192 split_quantity_new = stack_max;
11193 else
11194 split_quantity_new = quantity;
11195
11197 {
11198 GameInventory destinationInventory = destination_entity.GetInventory();
11200 {
11203 }
11204
11205 if (new_item)
11206 {
11207 new_item.SetResultOfSplit(true);
11208 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11210 new_item.
SetQuantity(split_quantity_new,
false,
true);
11211 }
11212 }
11213 }
11214 else
11215 {
11216 if (stack_max != 0)
11217 {
11219 {
11221 }
11222
11224 {
11226
11227 if (new_item)
11228 {
11229 new_item.SetResultOfSplit(true);
11230 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11233 new_item.PlaceOnSurface();
11234 }
11235 }
11236 }
11237 }
11238 }
11239
11241 {
11243 {
11244 if (ScriptInputUserData.CanStoreInputUserData())
11245 {
11246 ScriptInputUserData ctx = new ScriptInputUserData;
11251 dst.WriteToContext(ctx);
11253 }
11254 }
11255 else if (!
g_Game.IsMultiplayer())
11256 {
11258 }
11259 }
11260
11262 {
11264 {
11265 if (ScriptInputUserData.CanStoreInputUserData())
11266 {
11267 ScriptInputUserData ctx = new ScriptInputUserData;
11272 ctx.
Write(destination_entity);
11278 }
11279 }
11280 else if (!
g_Game.IsMultiplayer())
11281 {
11283 }
11284 }
11285
11287 {
11289 }
11290
11292 {
11294 float split_quantity_new;
11296 if (dst.IsValid())
11297 {
11298 int slot_id = dst.GetSlot();
11300
11301 if (quantity > stack_max)
11302 split_quantity_new = stack_max;
11303 else
11304 split_quantity_new = quantity;
11305
11307 {
11309
11310 if (new_item)
11311 {
11312 new_item.SetResultOfSplit(true);
11313 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11315 new_item.
SetQuantity(split_quantity_new,
false,
true);
11316 }
11317
11318 return new_item;
11319 }
11320 }
11321
11322 return null;
11323 }
11324
11326 {
11328 float split_quantity_new;
11330 if (destination_entity)
11331 {
11333 if (quantity > stackable)
11334 split_quantity_new = stackable;
11335 else
11336 split_quantity_new = quantity;
11337
11339 {
11340 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11341 if (new_item)
11342 {
11343 new_item.SetResultOfSplit(true);
11344 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11346 new_item.
SetQuantity(split_quantity_new,
false,
true);
11347 }
11348 }
11349 }
11350 }
11351
11353 {
11355 {
11356 if (ScriptInputUserData.CanStoreInputUserData())
11357 {
11358 ScriptInputUserData ctx = new ScriptInputUserData;
11363 ItemBase destination_entity =
this;
11364 ctx.
Write(destination_entity);
11368 }
11369 }
11370 else if (!
g_Game.IsMultiplayer())
11371 {
11373 }
11374 }
11375
11377 {
11379 float split_quantity_new;
11381 if (player)
11382 {
11384 if (quantity > stackable)
11385 split_quantity_new = stackable;
11386 else
11387 split_quantity_new = quantity;
11388
11390 {
11391 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11392 new_item =
ItemBase.Cast(in_hands);
11393 if (new_item)
11394 {
11395 new_item.SetResultOfSplit(true);
11396 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11398 new_item.SetQuantity(split_quantity_new, false, true);
11399 }
11400 }
11401 }
11402 }
11403
11405 {
11407 float split_quantity_new = Math.Floor(quantity * 0.5);
11408
11410 return;
11411
11413
11414 if (new_item)
11415 {
11416 if (new_item.GetQuantityMax() < split_quantity_new)
11417 {
11418 split_quantity_new = new_item.GetQuantityMax();
11419 }
11420
11421 new_item.SetResultOfSplit(true);
11422 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11423
11425 {
11428 }
11429 else
11430 {
11432 new_item.
SetQuantity(split_quantity_new,
false,
true);
11433 }
11434 }
11435 }
11436
11438 {
11440 float split_quantity_new = Math.Floor(quantity / 2);
11441
11443 return;
11444
11445 InventoryLocation invloc = new InventoryLocation;
11447
11449 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11450
11451 if (new_item)
11452 {
11453 if (new_item.GetQuantityMax() < split_quantity_new)
11454 {
11455 split_quantity_new = new_item.GetQuantityMax();
11456 }
11458 {
11461 }
11462 else if (split_quantity_new > 1)
11463 {
11465 new_item.
SetQuantity(split_quantity_new,
false,
true);
11466 }
11467 }
11468 }
11469
11472 {
11473 SetWeightDirty();
11475
11476 if (parent)
11477 parent.OnAttachmentQuantityChangedEx(this, delta);
11478
11480 {
11482 {
11484 }
11486 {
11487 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11489 }
11490 }
11491 }
11492
11495 {
11496
11497 }
11498
11501 {
11503 }
11504
11506 {
11507 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11508
11510 {
11511 if (newLevel == GameConstants.STATE_RUINED)
11512 {
11514 EntityAI parent = GetHierarchyParent();
11515 if (parent && parent.IsFireplace())
11516 {
11517 CargoBase cargo = GetInventory().GetCargo();
11518 if (cargo)
11519 {
11521 {
11523 }
11524 }
11525 }
11526 }
11527
11529 {
11530
11532 return;
11533 }
11534
11535 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11536 {
11538 }
11539 }
11540 }
11541
11542
11544 {
11545 super.OnRightClick();
11546
11548 {
11550 {
11551 if (ScriptInputUserData.CanStoreInputUserData())
11552 {
11553 EntityAI root = GetHierarchyRoot();
11554 Man playerOwner = GetHierarchyRootPlayer();
11555 InventoryLocation dst = new InventoryLocation;
11556
11557
11558 if (!playerOwner && root && root == this)
11559 {
11561 }
11562 else
11563 {
11564
11565 GetInventory().GetCurrentInventoryLocation(dst);
11567 {
11568 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11570 {
11572 }
11573 else
11574 {
11576
11577
11578 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11579 {
11581 }
11582 else
11583 {
11584 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11585 }
11586 }
11587 }
11588 }
11589
11590 ScriptInputUserData ctx = new ScriptInputUserData;
11598 }
11599 }
11600 else if (!
g_Game.IsMultiplayer())
11601 {
11603 }
11604 }
11605 }
11606
11608 {
11609 if (root)
11610 {
11611 vector m4[4];
11612 root.GetTransform(m4);
11613 dst.SetGround(this, m4);
11614 }
11615 else
11616 {
11617 GetInventory().GetCurrentInventoryLocation(dst);
11618 }
11619 }
11620
11621 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11622 {
11623
11624 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11625 return false;
11626
11627 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11628 return false;
11629
11630
11632 return false;
11633
11634
11635 Magazine mag = Magazine.Cast(this);
11636 if (mag)
11637 {
11638 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11639 return false;
11640
11641 if (stack_max_limit)
11642 {
11643 Magazine other_mag = Magazine.Cast(other_item);
11644 if (other_item)
11645 {
11646 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11647 return false;
11648 }
11649
11650 }
11651 }
11652 else
11653 {
11654
11656 return false;
11657
11659 return false;
11660 }
11661
11662 PlayerBase player = null;
11663 if (CastTo(player, GetHierarchyRootPlayer()))
11664 {
11665 if (player.GetInventory().HasAttachment(this))
11666 return false;
11667
11668 if (player.IsItemsToDelete())
11669 return false;
11670 }
11671
11672 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11673 return false;
11674
11675 int slotID;
11677 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11678 return false;
11679
11680 return true;
11681 }
11682
11684 {
11686 }
11687
11689 {
11690 return m_IsResultOfSplit;
11691 }
11692
11694 {
11695 m_IsResultOfSplit = value;
11696 }
11697
11699 {
11701 }
11702
11704 {
11705 float other_item_quantity = other_item.GetQuantity();
11706 float this_free_space;
11707
11709
11711
11712 if (other_item_quantity > this_free_space)
11713 {
11714 return this_free_space;
11715 }
11716 else
11717 {
11718 return other_item_quantity;
11719 }
11720 }
11721
11723 {
11725 }
11726
11728 {
11730 return;
11731
11732 if (!IsMagazine() && other_item)
11733 {
11735 if (quantity_used != 0)
11736 {
11737 float hp1 = GetHealth01("","");
11738 float hp2 = other_item.GetHealth01("","");
11739 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11740 hpResult = hpResult / (
GetQuantity() + quantity_used);
11741
11742 hpResult *= GetMaxHealth();
11743 Math.Round(hpResult);
11744 SetHealth("", "Health", hpResult);
11745
11747 other_item.AddQuantity(-quantity_used);
11748 }
11749 }
11751 }
11752
11754 {
11755 #ifdef SERVER
11756 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11757 GetHierarchyParent().IncreaseLifetimeUp();
11758 #endif
11759 };
11760
11762 {
11763 PlayerBase p = PlayerBase.Cast(player);
11764
11765 array<int> recipesIds = p.m_Recipes;
11766 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11767 if (moduleRecipesManager)
11768 {
11769 EntityAI itemInHands = player.GetEntityInHands();
11770 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11771 }
11772
11773 for (int i = 0;i < recipesIds.Count(); i++)
11774 {
11775 int key = recipesIds.Get(i);
11776 string recipeName = moduleRecipesManager.GetRecipeName(key);
11778 }
11779 }
11780
11781
11782 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11783 {
11784 super.GetDebugActions(outputList);
11785
11786
11792
11793
11798
11803
11804
11808
11809
11811 {
11815 }
11816
11819
11820
11824
11826
11827 InventoryLocation loc = new InventoryLocation();
11828 GetInventory().GetCurrentInventoryLocation(loc);
11830 {
11831 if (Gizmo_IsSupported())
11834 }
11835
11837 }
11838
11839
11840
11841
11843 {
11844 super.OnAction(action_id, player, ctx);
11845
11847 {
11848 switch (action_id)
11849 {
11853 return true;
11857 return true;
11858 }
11859 }
11860
11862 {
11863 switch (action_id)
11864 {
11866 Delete();
11867 return true;
11868 }
11869 }
11870
11871 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11872 {
11873 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11874 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11875 PlayerBase p = PlayerBase.Cast(player);
11876 if (
EActions.RECIPES_RANGE_START < 1000)
11877 {
11878 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11879 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11880 }
11881 }
11882 #ifndef SERVER
11883 else if (action_id ==
EActions.WATCH_PLAYER)
11884 {
11885 PluginDeveloper.SetDeveloperItemClientEx(player);
11886 }
11887 #endif
11889 {
11890 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11891 {
11892 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11893 OnDebugButtonPressServer(id + 1);
11894 }
11895
11896 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11897 {
11898 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11900 }
11901
11902 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11903 {
11904 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11906 }
11907
11908 else if (action_id ==
EActions.ADD_QUANTITY)
11909 {
11910 if (IsMagazine())
11911 {
11912 Magazine mag = Magazine.Cast(this);
11913 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11914 }
11915 else
11916 {
11918 }
11919
11920 if (m_EM)
11921 {
11922 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11923 }
11924
11925 }
11926
11927 else if (action_id ==
EActions.REMOVE_QUANTITY)
11928 {
11929 if (IsMagazine())
11930 {
11931 Magazine mag2 = Magazine.Cast(this);
11932 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11933 }
11934 else
11935 {
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.SET_QUANTITY_0)
11946 {
11948
11949 if (m_EM)
11950 {
11951 m_EM.SetEnergy(0);
11952 }
11953 }
11954
11955 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11956 {
11958
11959 if (m_EM)
11960 {
11961 m_EM.SetEnergy(m_EM.GetEnergyMax());
11962 }
11963 }
11964
11965 else if (action_id ==
EActions.ADD_HEALTH)
11966 {
11967 AddHealth("","",GetMaxHealth("","Health")/5);
11968 }
11969 else if (action_id ==
EActions.REMOVE_HEALTH)
11970 {
11971 AddHealth("","",-GetMaxHealth("","Health")/5);
11972 }
11973 else if (action_id ==
EActions.DESTROY_HEALTH)
11974 {
11975 SetHealth01("","",0);
11976 }
11977 else if (action_id ==
EActions.WATCH_ITEM)
11978 {
11980 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11981 #ifdef DEVELOPER
11982 SetDebugDeveloper_item(this);
11983 #endif
11984 }
11985
11986 else if (action_id ==
EActions.ADD_TEMPERATURE)
11987 {
11988 AddTemperature(20);
11989
11990 }
11991
11992 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11993 {
11994 AddTemperature(-20);
11995
11996 }
11997
11998 else if (action_id ==
EActions.FLIP_FROZEN)
11999 {
12000 SetFrozen(!GetIsFrozen());
12001
12002 }
12003
12004 else if (action_id ==
EActions.ADD_WETNESS)
12005 {
12007
12008 }
12009
12010 else if (action_id ==
EActions.REMOVE_WETNESS)
12011 {
12013
12014 }
12015
12016 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12017 {
12020
12021
12022 }
12023
12024 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12025 {
12028 }
12029
12030 else if (action_id ==
EActions.MAKE_SPECIAL)
12031 {
12032 auto debugParams = DebugSpawnParams.WithPlayer(player);
12033 OnDebugSpawnEx(debugParams);
12034 }
12035
12036 }
12037
12038
12039 return false;
12040 }
12041
12042
12043
12044
12048
12051
12052
12053
12055 {
12056 return false;
12057 }
12058
12059
12061 {
12062 return true;
12063 }
12064
12065
12067 {
12068 return true;
12069 }
12070
12071
12072
12074 {
12075 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12076 return g_Game.ConfigIsExisting(config_path);
12077 }
12078
12081 {
12082 return null;
12083 }
12084
12086 {
12087 return false;
12088 }
12089
12091 {
12092 return false;
12093 }
12094
12098
12099
12101 {
12102 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12103 return module_repairing.CanRepair(this, item_repair_kit);
12104 }
12105
12106
12107 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12108 {
12109 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12110 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12111 }
12112
12113
12115 {
12116
12117
12118
12119
12120
12121
12122
12123
12124 return 1;
12125 }
12126
12127
12128
12130 {
12132 }
12133
12134
12135
12137 {
12139 }
12140
12141
12150 {
12151 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12152
12153 if (player)
12154 {
12155 player.MessageStatus(text);
12156 }
12157 }
12158
12159
12168 {
12169 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12170
12171 if (player)
12172 {
12173 player.MessageAction(text);
12174 }
12175 }
12176
12177
12186 {
12187 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12188
12189 if (player)
12190 {
12191 player.MessageFriendly(text);
12192 }
12193 }
12194
12195
12204 {
12205 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12206
12207 if (player)
12208 {
12209 player.MessageImportant(text);
12210 }
12211 }
12212
12214 {
12215 return true;
12216 }
12217
12218
12219 override bool KindOf(
string tag)
12220 {
12221 bool found = false;
12222 string item_name = this.
GetType();
12224 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12225
12226 int array_size = item_tag_array.Count();
12227 for (int i = 0; i < array_size; i++)
12228 {
12229 if (item_tag_array.Get(i) == tag)
12230 {
12231 found = true;
12232 break;
12233 }
12234 }
12235 return found;
12236 }
12237
12238
12240 {
12241
12242 super.OnRPC(sender, rpc_type,ctx);
12243
12244
12245 switch (rpc_type)
12246 {
12247 #ifndef SERVER
12248 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12249 Param2<bool, string> p = new Param2<bool, string>(false, "");
12250
12252 return;
12253
12254 bool play = p.param1;
12255 string soundSet = p.param2;
12256
12257 if (play)
12258 {
12260 {
12262 {
12264 }
12265 }
12266 else
12267 {
12269 }
12270 }
12271 else
12272 {
12274 }
12275
12276 break;
12277 #endif
12278
12279 }
12280
12282 {
12284 }
12285 }
12286
12287
12288
12289
12291 {
12292 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12293 return plugin.GetID(
name);
12294 }
12295
12297 {
12298 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12299 return plugin.GetName(id);
12300 }
12301
12304 {
12305
12306
12307 int varFlags;
12308 if (!ctx.
Read(varFlags))
12309 return;
12310
12311 if (varFlags & ItemVariableFlags.FLOAT)
12312 {
12314 }
12315 }
12316
12318 {
12319
12320 super.SerializeNumericalVars(floats_out);
12321
12322
12323
12325 {
12327 }
12328
12330 {
12332 }
12333
12335 {
12337 }
12338
12340 {
12345 }
12346
12348 {
12350 }
12351 }
12352
12354 {
12355
12356 super.DeSerializeNumericalVars(floats);
12357
12358
12359 int index = 0;
12360 int mask = Math.Round(floats.Get(index));
12361
12362 index++;
12363
12365 {
12367 {
12369 }
12370 else
12371 {
12372 float quantity = floats.Get(index);
12373 SetQuantity(quantity,
true,
false,
false,
false);
12374 }
12375 index++;
12376 }
12377
12379 {
12380 float wet = floats.Get(index);
12382 index++;
12383 }
12384
12386 {
12387 int liquidtype = Math.Round(floats.Get(index));
12389 index++;
12390 }
12391
12393 {
12395 index++;
12397 index++;
12399 index++;
12401 index++;
12402 }
12403
12405 {
12406 int cleanness = Math.Round(floats.Get(index));
12408 index++;
12409 }
12410 }
12411
12413 {
12414 super.WriteVarsToCTX(ctx);
12415
12416
12418 {
12420 }
12421
12423 {
12425 }
12426
12428 {
12430 }
12431
12433 {
12434 int r,g,b,a;
12440 }
12441
12443 {
12445 }
12446 }
12447
12449 {
12450 if (!super.ReadVarsFromCTX(ctx,version))
12451 return false;
12452
12453 int intValue;
12454 float value;
12455
12456 if (version < 140)
12457 {
12458 if (!ctx.
Read(intValue))
12459 return false;
12460
12461 m_VariablesMask = intValue;
12462 }
12463
12465 {
12466 if (!ctx.
Read(value))
12467 return false;
12468
12470 {
12472 }
12473 else
12474 {
12476 }
12477 }
12478
12479 if (version < 140)
12480 {
12482 {
12483 if (!ctx.
Read(value))
12484 return false;
12485 SetTemperatureDirect(value);
12486 }
12487 }
12488
12490 {
12491 if (!ctx.
Read(value))
12492 return false;
12494 }
12495
12497 {
12498 if (!ctx.
Read(intValue))
12499 return false;
12501 }
12502
12504 {
12505 int r,g,b,a;
12507 return false;
12509 return false;
12511 return false;
12513 return false;
12514
12516 }
12517
12519 {
12520 if (!ctx.
Read(intValue))
12521 return false;
12523 }
12524
12525 if (version >= 138 && version < 140)
12526 {
12528 {
12529 if (!ctx.
Read(intValue))
12530 return false;
12531 SetFrozen(intValue);
12532 }
12533 }
12534
12535 return true;
12536 }
12537
12538
12540 {
12543 {
12545 }
12546
12547 if (!super.OnStoreLoad(ctx, version))
12548 {
12550 return false;
12551 }
12552
12553 if (version >= 114)
12554 {
12555 bool hasQuickBarIndexSaved;
12556
12557 if (!ctx.
Read(hasQuickBarIndexSaved))
12558 {
12560 return false;
12561 }
12562
12563 if (hasQuickBarIndexSaved)
12564 {
12565 int itmQBIndex;
12566
12567
12568 if (!ctx.
Read(itmQBIndex))
12569 {
12571 return false;
12572 }
12573
12574 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12575 if (itmQBIndex != -1 && parentPlayer)
12576 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12577 }
12578 }
12579 else
12580 {
12581
12582 PlayerBase player;
12583 int itemQBIndex;
12584 if (version ==
int.
MAX)
12585 {
12586 if (!ctx.
Read(itemQBIndex))
12587 {
12589 return false;
12590 }
12591 }
12592 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12593 {
12594
12595 if (!ctx.
Read(itemQBIndex))
12596 {
12598 return false;
12599 }
12600 if (itemQBIndex != -1 && player)
12601 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12602 }
12603 }
12604
12605 if (version < 140)
12606 {
12607
12608 if (!LoadVariables(ctx, version))
12609 {
12611 return false;
12612 }
12613 }
12614
12615
12617 {
12619 return false;
12620 }
12621 if (version >= 132)
12622 {
12624 if (raib)
12625 {
12627 {
12629 return false;
12630 }
12631 }
12632 }
12633
12635 return true;
12636 }
12637
12638
12639
12641 {
12642 super.OnStoreSave(ctx);
12643
12644 PlayerBase player;
12645 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12646 {
12648
12649 int itemQBIndex = -1;
12650 itemQBIndex = player.FindQuickBarEntityIndex(this);
12651 ctx.
Write(itemQBIndex);
12652 }
12653 else
12654 {
12656 }
12657
12659
12661 if (raib)
12662 {
12664 }
12665 }
12666
12667
12669 {
12670 super.AfterStoreLoad();
12671
12673 {
12675 }
12676
12678 {
12681 }
12682 }
12683
12685 {
12686 super.EEOnAfterLoad();
12687
12689 {
12691 }
12692
12695 }
12696
12698 {
12699 return false;
12700 }
12701
12702
12703
12705 {
12707 {
12708 #ifdef PLATFORM_CONSOLE
12709
12711 {
12713 if (menu)
12714 {
12716 }
12717 }
12718 #endif
12719 }
12720
12722 {
12725 }
12726
12728 {
12729 SetWeightDirty();
12731 }
12733 {
12736 }
12737
12739 {
12742
12745 }
12747 {
12751 }
12752
12753 super.OnVariablesSynchronized();
12754 }
12755
12756
12757
12759 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12760 {
12761 if (!IsServerCheck(allow_client))
12762 return false;
12763
12765 return false;
12766
12769
12770 if (value <= (min + 0.001))
12771 value = min;
12772
12773 if (value == min)
12774 {
12775 if (destroy_config)
12776 {
12777 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12778 if (dstr)
12779 {
12781 this.Delete();
12782 return true;
12783 }
12784 }
12785 else if (destroy_forced)
12786 {
12788 this.Delete();
12789 return true;
12790 }
12791
12793 }
12794
12797
12799 {
12800 EntityAI parent = GetHierarchyRoot();
12801 InventoryLocation iLoc = new InventoryLocation();
12802 GetInventory().GetCurrentInventoryLocation(iLoc);
12804 {
12805 int iLocSlot = iLoc.
GetSlot();
12807 {
12809 }
12811 {
12813 }
12814 }
12815 }
12816
12818 {
12820
12821 if (delta)
12823 }
12824
12826
12827 return false;
12828 }
12829
12830
12832 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12833 {
12835 }
12836
12838 {
12841 }
12842
12844 {
12847 }
12848
12850 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12851 {
12852 float value_clamped = Math.Clamp(value, 0, 1);
12854 SetQuantity(result, destroy_config, destroy_forced);
12855 }
12856
12857
12860 {
12862 }
12863
12865 {
12867 }
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12879 {
12880 int slot = -1;
12881 GameInventory inventory = GetInventory();
12882 if (inventory)
12883 {
12884 InventoryLocation il = new InventoryLocation;
12887 }
12888
12890 }
12891
12893 {
12894 float quantity_max = 0;
12895
12897 {
12898 if (attSlotID != -1)
12899 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12900
12901 if (quantity_max <= 0)
12903 }
12904
12905 if (quantity_max <= 0)
12907
12908 return quantity_max;
12909 }
12910
12912 {
12914 }
12915
12917 {
12919 }
12920
12921
12923 {
12925 }
12926
12928 {
12930 }
12931
12933 {
12935 }
12936
12937
12939 {
12940
12941 float weightEx = GetWeightEx();
12942 float special = GetInventoryAndCargoWeight();
12943 return weightEx - special;
12944 }
12945
12946
12948 {
12950 }
12951
12953 {
12955 {
12956 #ifdef DEVELOPER
12957 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12958 {
12959 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12961 }
12962 #endif
12963
12964 return GetQuantity() * GetConfigWeightModified();
12965 }
12966 else if (HasEnergyManager())
12967 {
12968 #ifdef DEVELOPER
12969 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12970 {
12971 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12972 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12973 }
12974 #endif
12975 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12976 }
12977 else
12978 {
12979 #ifdef DEVELOPER
12980 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12981 {
12982 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12983 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12984 }
12985 #endif
12986 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12987 }
12988 }
12989
12992 {
12993 int item_count = 0;
12995
12996 GameInventory inventory = GetInventory();
12997 CargoBase cargo = inventory.
GetCargo();
12998 if (cargo != NULL)
12999 {
13001 }
13002
13004 for (int i = 0; i < nAttachments; ++i)
13005 {
13007 if (item)
13008 item_count += item.GetNumberOfItems();
13009 }
13010 return item_count;
13011 }
13012
13015 {
13016 float weight = 0;
13017 float wetness = 1;
13018 if (include_wetness)
13021 {
13022 weight = wetness * m_ConfigWeight;
13023 }
13025 {
13026 weight = 1;
13027 }
13028 return weight;
13029 }
13030
13031
13032
13034 {
13035 GameInventory inventory = GetInventory();
13036 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13037 {
13038 array<EntityAI> items = new array<EntityAI>;
13040 for (int i = 0; i < items.Count(); ++i)
13041 {
13043 if (item)
13044 {
13045 g_Game.ObjectDelete(item);
13046 }
13047 }
13048 }
13049 }
13050
13051
13052
13053
13055 {
13056 float energy = 0;
13057 if (HasEnergyManager())
13058 {
13059 energy = GetCompEM().GetEnergy();
13060 }
13061 return energy;
13062 }
13063
13064
13066 {
13067 super.OnEnergyConsumed();
13068
13070 }
13071
13073 {
13074 super.OnEnergyAdded();
13075
13077 }
13078
13079
13081 {
13082 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13083 {
13085 {
13086 float energy_0to1 = GetCompEM().GetEnergy0To1();
13088 }
13089 }
13090 }
13091
13092
13094 {
13095 return ConfigGetFloat("heatIsolation");
13096 }
13097
13099 {
13101 }
13102
13104 {
13105 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13106 if (
g_Game.ConfigIsExisting(paramPath))
13107 return g_Game.ConfigGetFloat(paramPath);
13108
13109 return 0.0;
13110 }
13111
13113 {
13114 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13115 if (
g_Game.ConfigIsExisting(paramPath))
13116 return g_Game.ConfigGetFloat(paramPath);
13117
13118 return 0.0;
13119 }
13120
13121 override void SetWet(
float value,
bool allow_client =
false)
13122 {
13123 if (!IsServerCheck(allow_client))
13124 return;
13125
13128
13130
13131 m_VarWet = Math.Clamp(value, min, max);
13132
13134 {
13137 }
13138 }
13139
13140 override void AddWet(
float value)
13141 {
13143 }
13144
13146 {
13148 }
13149
13151 {
13153 }
13154
13156 {
13158 }
13159
13161 {
13163 }
13164
13166 {
13168 }
13169
13170 override void OnWetChanged(
float newVal,
float oldVal)
13171 {
13174 if (newLevel != oldLevel)
13175 {
13177 }
13178 }
13179
13181 {
13182 SetWeightDirty();
13183 }
13184
13186 {
13187 return GetWetLevelInternal(
m_VarWet);
13188 }
13189
13190
13191
13193 {
13195 }
13196
13198 {
13200 }
13201
13203 {
13205 }
13206
13208 {
13210 }
13211
13212
13213
13215 {
13216 if (ConfigIsExisting("itemModelLength"))
13217 {
13218 return ConfigGetFloat("itemModelLength");
13219 }
13220 return 0;
13221 }
13222
13224 {
13225 if (ConfigIsExisting("itemAttachOffset"))
13226 {
13227 return ConfigGetFloat("itemAttachOffset");
13228 }
13229 return 0;
13230 }
13231
13232 override void SetCleanness(
int value,
bool allow_client =
false)
13233 {
13234 if (!IsServerCheck(allow_client))
13235 return;
13236
13238
13240
13243 }
13244
13246 {
13248 }
13249
13251 {
13252 return true;
13253 }
13254
13255
13256
13257
13259 {
13261 }
13262
13264 {
13266 }
13267
13268
13269
13270
13271 override void SetColor(
int r,
int g,
int b,
int a)
13272 {
13278 }
13280 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13281 {
13286 }
13287
13289 {
13291 }
13292
13295 {
13296 int r,g,b,a;
13298 r = r/255;
13299 g = g/255;
13300 b = b/255;
13301 a = a/255;
13302 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13303 }
13304
13305
13306
13307 override void SetLiquidType(
int value,
bool allow_client =
false)
13308 {
13309 if (!IsServerCheck(allow_client))
13310 return;
13311
13316 }
13317
13319 {
13320 return ConfigGetInt("varLiquidTypeInit");
13321 }
13322
13324 {
13326 }
13327
13329 {
13331 SetFrozen(false);
13332 }
13333
13336 {
13337 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13338 }
13339
13340
13343 {
13344 PlayerBase nplayer;
13345 if (PlayerBase.CastTo(nplayer, player))
13346 {
13348 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13349 }
13350 }
13351
13352
13355 {
13356 PlayerBase nplayer;
13357 if (PlayerBase.CastTo(nplayer,player))
13358 {
13359 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13360 }
13361
13362 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13363
13364 if (HasEnergyManager())
13365 {
13366 GetCompEM().UpdatePlugState();
13367 }
13368 }
13369
13370
13372 {
13373 super.OnPlacementStarted(player);
13374
13376 }
13377
13378 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13379 {
13381 {
13382 m_AdminLog.OnPlacementComplete(player,
this);
13383 }
13384
13385 super.OnPlacementComplete(player, position, orientation);
13386 }
13387
13388
13389
13390
13391
13393 {
13395 {
13396 return true;
13397 }
13398 else
13399 {
13400 return false;
13401 }
13402 }
13403
13404
13406 {
13408 {
13410 }
13411 }
13412
13413
13415 {
13417 }
13418
13420 {
13422 }
13423
13424 override void InsertAgent(
int agent,
float count = 1)
13425 {
13426 if (count < 1)
13427 return;
13428
13430 }
13431
13434 {
13436 }
13437
13438
13440 {
13442 }
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
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
13486 {
13488 return false;
13489 return true;
13490 }
13491
13493 {
13494
13496 }
13497
13498
13501 {
13502 super.CheckForRoofLimited(timeTresholdMS);
13503
13504 float time =
g_Game.GetTime();
13505 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13506 {
13507 m_PreviousRoofTestTime = time;
13508 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13509 }
13510 }
13511
13512
13514 {
13516 {
13517 return 0;
13518 }
13519
13520 if (GetInventory().GetAttachmentSlotsCount() != 0)
13521 {
13522 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13523 if (filter)
13524 return filter.GetProtectionLevel(type, false, system);
13525 else
13526 return 0;
13527 }
13528
13529 string subclassPath, entryName;
13530
13531 switch (type)
13532 {
13534 entryName = "biological";
13535 break;
13537 entryName = "chemical";
13538 break;
13539 default:
13540 entryName = "biological";
13541 break;
13542 }
13543
13544 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13545
13546 return g_Game.ConfigGetFloat(subclassPath + entryName);
13547 }
13548
13549
13550
13553 {
13554 if (!IsMagazine())
13556
13558 }
13559
13560
13561
13562
13563
13568 {
13569 return true;
13570 }
13571
13573 {
13575 }
13576
13577
13578
13579
13580
13582 {
13583 if (parent)
13584 {
13585 if (parent.IsInherited(DayZInfected))
13586 return true;
13587
13588 if (!parent.IsRuined())
13589 return true;
13590 }
13591
13592 return true;
13593 }
13594
13596 {
13597 if (!super.CanPutAsAttachment(parent))
13598 {
13599 return false;
13600 }
13601
13602 if (!IsRuined() && !parent.IsRuined())
13603 {
13604 return true;
13605 }
13606
13607 return false;
13608 }
13609
13611 {
13612
13613
13614
13615
13616 return super.CanReceiveItemIntoCargo(item);
13617 }
13618
13620 {
13621
13622
13623
13624
13625 GameInventory attachmentInv = attachment.GetInventory();
13627 {
13628 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13629 return false;
13630 }
13631
13632 InventoryLocation loc = new InventoryLocation();
13633 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13634 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13635 return false;
13636
13637 return super.CanReceiveAttachment(attachment, slotId);
13638 }
13639
13641 {
13642 if (!super.CanReleaseAttachment(attachment))
13643 return false;
13644
13645 return GetInventory().AreChildrenAccessible();
13646 }
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13669 {
13670 int id = muzzle_owner.GetMuzzleID();
13671 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13672
13673 if (WPOF_array)
13674 {
13675 for (int i = 0; i < WPOF_array.Count(); i++)
13676 {
13677 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13678
13679 if (WPOF)
13680 {
13681 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13682 }
13683 }
13684 }
13685 }
13686
13687
13689 {
13690 int id = muzzle_owner.GetMuzzleID();
13692
13693 if (WPOBE_array)
13694 {
13695 for (int i = 0; i < WPOBE_array.Count(); i++)
13696 {
13697 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13698
13699 if (WPOBE)
13700 {
13701 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13702 }
13703 }
13704 }
13705 }
13706
13707
13709 {
13710 int id = muzzle_owner.GetMuzzleID();
13711 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13712
13713 if (WPOOH_array)
13714 {
13715 for (int i = 0; i < WPOOH_array.Count(); i++)
13716 {
13717 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13718
13719 if (WPOOH)
13720 {
13721 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13722 }
13723 }
13724 }
13725 }
13726
13727
13729 {
13730 int id = muzzle_owner.GetMuzzleID();
13731 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13732
13733 if (WPOOH_array)
13734 {
13735 for (int i = 0; i < WPOOH_array.Count(); i++)
13736 {
13737 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13738
13739 if (WPOOH)
13740 {
13741 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13742 }
13743 }
13744 }
13745 }
13746
13747
13749 {
13750 int id = muzzle_owner.GetMuzzleID();
13751 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13752
13753 if (WPOOH_array)
13754 {
13755 for (int i = 0; i < WPOOH_array.Count(); i++)
13756 {
13757 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13758
13759 if (WPOOH)
13760 {
13761 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13762 }
13763 }
13764 }
13765 }
13766
13767
13768
13770 {
13772 {
13773 return true;
13774 }
13775
13776 return false;
13777 }
13778
13780 {
13782 {
13783 return true;
13784 }
13785
13786 return false;
13787 }
13788
13790 {
13792 {
13793 return true;
13794 }
13795
13796 return false;
13797 }
13798
13800 {
13801 return false;
13802 }
13803
13806 {
13807 return UATimeSpent.DEFAULT_DEPLOY;
13808 }
13809
13810
13811
13812
13814 {
13816 SetSynchDirty();
13817 }
13818
13820 {
13822 }
13823
13824
13826 {
13827 return false;
13828 }
13829
13832 {
13833 string att_type = "None";
13834
13835 if (ConfigIsExisting("soundAttType"))
13836 {
13837 att_type = ConfigGetString("soundAttType");
13838 }
13839
13841 }
13842
13844 {
13846 }
13847
13848
13849
13850
13851
13857
13859 {
13862
13864 }
13865
13866
13868 {
13870 return;
13871
13873
13876
13879
13880 SoundParameters params = new SoundParameters();
13884 }
13885
13886
13888 {
13890 {
13893
13894 SetSynchDirty();
13895
13898 }
13899 }
13900
13902 {
13904 }
13905
13906
13908 {
13910 return;
13911
13913 SetSynchDirty();
13914
13917 }
13918
13920 {
13923 }
13924
13926 {
13928 }
13929
13930 void OnApply(PlayerBase player);
13931
13933 {
13934 return 1.0;
13935 };
13936
13938 {
13940 }
13941
13943 {
13945 }
13946
13948
13950 {
13951 SetDynamicPhysicsLifeTime(0.01);
13953 }
13954
13956 {
13957 array<string> zone_names = new array<string>;
13958 GetDamageZones(zone_names);
13959 for (int i = 0; i < zone_names.Count(); i++)
13960 {
13961 SetHealthMax(zone_names.Get(i),"Health");
13962 }
13963 SetHealthMax("","Health");
13964 }
13965
13968 {
13969 float global_health = GetHealth01("","Health");
13970 array<string> zones = new array<string>;
13971 GetDamageZones(zones);
13972
13973 for (int i = 0; i < zones.Count(); i++)
13974 {
13975 SetHealth01(zones.Get(i),"Health",global_health);
13976 }
13977 }
13978
13981 {
13982 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13983 }
13984
13986 {
13987 if (!hasRootAsPlayer)
13988 {
13989 if (refParentIB)
13990 {
13991
13992 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13993 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13994
13995 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13996 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13997
14000 }
14001 else
14002 {
14003
14006 }
14007 }
14008 }
14009
14011 {
14013 {
14014 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14015 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14016 {
14017 float heatPermCoef = 1.0;
14019 while (ent)
14020 {
14021 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14022 ent = ent.GetHierarchyParent();
14023 }
14024
14025 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14026 }
14027 }
14028 }
14029
14031 {
14032
14033 EntityAI parent = GetHierarchyParent();
14034 if (!parent)
14035 {
14036 hasParent = false;
14037 hasRootAsPlayer = false;
14038 }
14039 else
14040 {
14041 hasParent = true;
14042 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14043 refParentIB =
ItemBase.Cast(parent);
14044 }
14045 }
14046
14047 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14048 {
14049
14050 }
14051
14053 {
14054
14055 return false;
14056 }
14057
14059 {
14060
14061
14062 return false;
14063 }
14064
14066 {
14067
14068 return false;
14069 }
14070
14073 {
14074 return !GetIsFrozen() &&
IsOpen();
14075 }
14076
14078 {
14079 bool hasParent = false, hasRootAsPlayer = false;
14081
14082 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14083 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14084
14085 if (wwtu || foodDecay)
14086 {
14090
14091 if (processWetness || processTemperature || processDecay)
14092 {
14094
14095 if (processWetness)
14096 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14097
14098 if (processTemperature)
14100
14101 if (processDecay)
14102 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14103 }
14104 }
14105 }
14106
14109 {
14111 }
14112
14114 {
14117
14118 return super.GetTemperatureFreezeThreshold();
14119 }
14120
14122 {
14125
14126 return super.GetTemperatureThawThreshold();
14127 }
14128
14130 {
14133
14134 return super.GetItemOverheatThreshold();
14135 }
14136
14138 {
14140 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14141
14142 return super.GetTemperatureFreezeTime();
14143 }
14144
14146 {
14148 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14149
14150 return super.GetTemperatureThawTime();
14151 }
14152
14157
14159 {
14160 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14161 }
14162
14164 {
14165 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14166 }
14167
14170 {
14172 }
14173
14175 {
14177 }
14178
14180 {
14182 }
14183
14186 {
14187 return null;
14188 }
14189
14192 {
14193 return false;
14194 }
14195
14197 {
14199 {
14202 if (!trg)
14203 {
14205 explosive = this;
14206 }
14207
14208 explosive.PairRemote(trg);
14210
14211 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14212 trg.SetPersistentPairID(persistentID);
14213 explosive.SetPersistentPairID(persistentID);
14214
14215 return true;
14216 }
14217 return false;
14218 }
14219
14222 {
14223 float ret = 1.0;
14226 ret *= GetHealth01();
14227
14228 return ret;
14229 }
14230
14231 #ifdef DEVELOPER
14232 override void SetDebugItem()
14233 {
14234 super.SetDebugItem();
14235 _itemBase = this;
14236 }
14237
14239 {
14240 string text = super.GetDebugText();
14241
14243 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14244
14245 return text;
14246 }
14247 #endif
14248
14250 {
14251 return true;
14252 }
14253
14255
14257
14259 {
14262 }
14263
14264
14272
14288
14289 [
Obsolete(
"Use ItemSoundHandler instead")]
14292 {
14293 if (!
g_Game.IsDedicatedServer())
14294 {
14295 if (ConfigIsExisting("attachSoundSet"))
14296 {
14297 string cfg_path = "";
14298 string soundset = "";
14299 string type_name =
GetType();
14300
14303 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14304 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14305
14306 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14307 {
14308 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14309 {
14310 if (cfg_slot_array[i] == slot_type)
14311 {
14312 soundset = cfg_soundset_array[i];
14313 break;
14314 }
14315 }
14316 }
14317
14318 if (soundset != "")
14319 {
14320 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14322 }
14323 }
14324 }
14325 }
14326
14328}
14329
14331{
14333 if (entity)
14334 {
14335 bool is_item = entity.IsInherited(
ItemBase);
14336 if (is_item && full_quantity)
14337 {
14340 }
14341 }
14342 else
14343 {
14345 return NULL;
14346 }
14347 return entity;
14348}
14349
14351{
14352 if (item)
14353 {
14354 if (health > 0)
14355 item.SetHealth("", "", health);
14356
14357 if (item.CanHaveTemperature())
14358 {
14360 if (item.CanFreeze())
14361 item.SetFrozen(false);
14362 }
14363
14364 if (item.HasEnergyManager())
14365 {
14366 if (quantity >= 0)
14367 {
14368 item.GetCompEM().SetEnergy0To1(quantity);
14369 }
14370 else
14371 {
14373 }
14374 }
14375 else if (item.IsMagazine())
14376 {
14377 Magazine mag = Magazine.Cast(item);
14378 if (quantity >= 0)
14379 {
14380 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14381 }
14382 else
14383 {
14385 }
14386
14387 }
14388 else
14389 {
14390 if (quantity >= 0)
14391 {
14392 item.SetQuantityNormalized(quantity, false);
14393 }
14394 else
14395 {
14397 }
14398
14399 }
14400 }
14401}
14402
14403#ifdef DEVELOPER
14405#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.