9431{
9433 {
9434 return true;
9435 }
9436};
9437
9439{
9440
9441};
9442
9443
9444
9446{
9450
9452
9455
9456
9457
9458
9459
9468
9474
9479
9484
9505 protected bool m_IsResultOfSplit
9506
9508
9513
9514
9515
9517
9521
9522
9523
9525
9528
9529
9530
9536
9537
9545
9548
9549
9551
9552
9554
9555
9560
9561
9566
9568
9569
9571
9572
9574 {
9579
9580 if (!
g_Game.IsDedicatedServer())
9581 {
9583 {
9585
9587 {
9589 }
9590 }
9591
9594 }
9595
9596 m_OldLocation = null;
9597
9599 {
9601 }
9602
9603 if (ConfigIsExisting("headSelectionsToHide"))
9604 {
9607 }
9608
9610 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9611 {
9613 }
9614
9616
9617 m_IsResultOfSplit = false;
9618
9620 }
9621
9623 {
9624 super.InitItemVariables();
9625
9631 m_Count = ConfigGetInt(
"count");
9632
9635
9640
9643
9648
9660
9664
9665
9668 if (ConfigIsExisting("canBeSplit"))
9669 {
9672 }
9673
9675 if (ConfigIsExisting("itemBehaviour"))
9677
9678
9681 RegisterNetSyncVariableInt("m_VarLiquidType");
9682 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9683
9684 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9685 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9686 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9687
9688 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9689 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9690 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9691 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9692
9693 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9694 RegisterNetSyncVariableBool("m_IsTakeable");
9695 RegisterNetSyncVariableBool("m_IsHologram");
9696
9699 {
9702 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9703 }
9704
9706
9708 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9710
9712 }
9713
9715 {
9717 }
9718
9720 {
9723 {
9728 }
9729 }
9730
9731 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9732 {
9734 {
9737 }
9738
9740 }
9741
9743 {
9749 }
9750
9752
9754 {
9756
9757 if (!action)
9758 {
9759 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9760 return;
9761 }
9762
9764 if (!ai)
9765 {
9767 return;
9768 }
9769
9771 if (!action_array)
9772 {
9773 action_array = new array<ActionBase_Basic>;
9775 }
9776 if (LogManager.IsActionLogEnable())
9777 {
9778 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9779 }
9780
9781 if (action_array.Find(action) != -1)
9782 {
9783 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9784 }
9785 else
9786 {
9787 action_array.Insert(action);
9788 }
9789 }
9790
9792 {
9793 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9794 ActionBase action = player.GetActionManager().GetAction(actionName);
9797
9798 if (action_array)
9799 {
9800 action_array.RemoveItem(action);
9801 }
9802 }
9803
9804
9805
9807 {
9808 ActionOverrideData overrideData = new ActionOverrideData();
9812
9814 if (!actionMap)
9815 {
9818 }
9819
9820 actionMap.Insert(this.
Type(), overrideData);
9821
9822 }
9823
9825
9827
9828
9830 {
9833
9836
9837 string config_to_search = "CfgVehicles";
9838 string muzzle_owner_config;
9839
9841 {
9842 if (IsInherited(Weapon))
9843 config_to_search = "CfgWeapons";
9844
9845 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9846
9847 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9848
9849 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9850
9851 if (config_OnFire_subclass_count > 0)
9852 {
9853 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9854
9855 for (int i = 0; i < config_OnFire_subclass_count; i++)
9856 {
9857 string particle_class = "";
9858 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9859 string config_OnFire_entry = config_OnFire_class + particle_class;
9860 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9861 WPOF_array.Insert(WPOF);
9862 }
9863
9864
9866 }
9867 }
9868
9870 {
9871 config_to_search = "CfgWeapons";
9872 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9873
9874 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9875
9876 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9877
9878 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9879 {
9880 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9881
9882 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9883 {
9884 string particle_class2 = "";
9885 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9886 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9887 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9888 WPOBE_array.Insert(WPOBE);
9889 }
9890
9891
9893 }
9894 }
9895 }
9896
9897
9899 {
9902
9904 {
9905 string config_to_search = "CfgVehicles";
9906
9907 if (IsInherited(Weapon))
9908 config_to_search = "CfgWeapons";
9909
9910 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9911 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9912
9913 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9914 {
9915
9917
9919 {
9921 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9923 return;
9924 }
9925
9928
9929
9930
9931 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9932 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9933
9934 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9935 {
9936 string particle_class = "";
9937 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9938 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9939 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9940
9941 if (entry_type == CT_CLASS)
9942 {
9943 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9944 WPOOH_array.Insert(WPOF);
9945 }
9946 }
9947
9948
9950 }
9951 }
9952 }
9953
9955 {
9957 }
9958
9960 {
9962 {
9964
9967
9970
9971 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9972 }
9973 }
9974
9976 {
9978 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9979
9981 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9982
9984 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9985
9987 {
9989 }
9990 }
9991
9993 {
9995 }
9996
9998 {
10001 else
10003
10005 {
10008 }
10009 else
10010 {
10013
10016 }
10017
10019 }
10020
10022 {
10024 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10025 }
10026
10028 {
10030 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10032 }
10033
10035 {
10037 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10038 }
10039
10041 {
10044
10045 OverheatingParticle OP = new OverheatingParticle();
10050
10052 }
10053
10055 {
10058
10059 return -1;
10060 }
10061
10063 {
10065 {
10068
10069 for (int i = count; i > 0; --i)
10070 {
10071 int id = i - 1;
10074
10077
10078 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10079 {
10080 if (p)
10081 {
10084 }
10085 }
10086 }
10087 }
10088 }
10089
10091 {
10093 {
10095 {
10096 int id = i - 1;
10098
10099 if (OP)
10100 {
10102
10103 if (p)
10104 {
10106 }
10107
10108 delete OP;
10109 }
10110 }
10111
10114 }
10115 }
10116
10119 {
10120 return 0.0;
10121 }
10122
10123
10125 {
10126 return 250;
10127 }
10128
10130 {
10131 return 0;
10132 }
10133
10136 {
10138 return true;
10139
10140 return false;
10141 }
10142
10145 {
10148
10150 {
10152 }
10153 else
10154 {
10155
10157 }
10158
10160 }
10161
10168 {
10169 return -1;
10170 }
10171
10172
10173
10174
10176 {
10178 {
10179 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10180 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10181
10182 if (r_index >= 0)
10183 {
10184 InventoryLocation r_il = new InventoryLocation;
10185 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10186
10187 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10190 {
10191 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10192 }
10194 {
10195 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10196 }
10197
10198 }
10199
10200 player.GetHumanInventory().ClearUserReservedLocation(this);
10201 }
10202
10205 }
10206
10207
10208
10209
10211 {
10212 return ItemBase.m_DebugActionsMask;
10213 }
10214
10216 {
10217 return ItemBase.m_DebugActionsMask & mask;
10218 }
10219
10221 {
10222 ItemBase.m_DebugActionsMask = mask;
10223 }
10224
10226 {
10227 ItemBase.m_DebugActionsMask |= mask;
10228 }
10229
10231 {
10232 ItemBase.m_DebugActionsMask &= ~mask;
10233 }
10234
10236 {
10238 {
10240 }
10241 else
10242 {
10244 }
10245 }
10246
10247
10249 {
10250 if (GetEconomyProfile())
10251 {
10252 float q_max = GetEconomyProfile().GetQuantityMax();
10253 if (q_max > 0)
10254 {
10255 float q_min = GetEconomyProfile().GetQuantityMin();
10256 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10257
10259 {
10260 ComponentEnergyManager comp = GetCompEM();
10262 {
10264 }
10265 }
10267 {
10269
10270 }
10271
10272 }
10273 }
10274 }
10275
10278 {
10279 EntityAI parent = GetHierarchyParent();
10280
10281 if (parent)
10282 {
10283 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10284 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10285 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10286 }
10287 }
10288
10291 {
10292 EntityAI parent = GetHierarchyParent();
10293
10294 if (parent)
10295 {
10296 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10297 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10298 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10299 }
10300 }
10301
10303 {
10304
10305
10306
10307
10309
10311 {
10312 if (ScriptInputUserData.CanStoreInputUserData())
10313 {
10314 ScriptInputUserData ctx = new ScriptInputUserData;
10320 ctx.
Write(use_stack_max);
10323
10325 {
10326 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10327 }
10328 }
10329 }
10330 else if (!
g_Game.IsMultiplayer())
10331 {
10333 }
10334 }
10335
10337 {
10339 }
10340
10342 {
10344 }
10345
10347 {
10349 }
10350
10352 {
10353
10354 return false;
10355 }
10356
10358 {
10359 return false;
10360 }
10361
10365 {
10366 return false;
10367 }
10368
10370 {
10371 return "";
10372 }
10373
10375
10377 {
10378 return false;
10379 }
10380
10382 {
10383 return true;
10384 }
10385
10386
10387
10389 {
10390 return true;
10391 }
10392
10394 {
10395 return true;
10396 }
10397
10399 {
10400 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10402 }
10403
10405 {
10407 }
10408
10410 {
10412 if (!is_being_placed)
10414 SetSynchDirty();
10415 }
10416
10417
10419
10421 {
10423 }
10424
10426 {
10428 }
10429
10431 {
10432 return 1;
10433 }
10434
10436 {
10437 return false;
10438 }
10439
10441 {
10443 SetSynchDirty();
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
10474
10475
10476
10477
10478
10479
10481 {
10482 super.OnMovedInsideCargo(container);
10483
10484 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10485 }
10486
10487 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10488 {
10489 super.EEItemLocationChanged(oldLoc, newLoc);
10490
10491 PlayerBase newPlayer = null;
10492 PlayerBase oldPlayer = null;
10493
10494 if (newLoc.GetParent())
10495 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10496
10497 if (oldLoc.GetParent())
10498 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10499
10501 {
10502 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10503
10504 if (rIndex >= 0)
10505 {
10506 InventoryLocation rIl = new InventoryLocation;
10507 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10508
10509 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10512 {
10513 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10514 }
10516 {
10518 }
10519
10520 }
10521 }
10522
10524 {
10525 if (newPlayer)
10526 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10527
10528 if (newPlayer == oldPlayer)
10529 {
10530 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10531 {
10533 {
10534 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10535 {
10536 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10537 }
10538 }
10539 else
10540 {
10541 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10542 }
10543 }
10544
10545 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10546 {
10547 int type = oldLoc.GetType();
10549 {
10550 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10551 }
10553 {
10554 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10555 }
10556 }
10557 if (!m_OldLocation)
10558 {
10559 m_OldLocation = new InventoryLocation;
10560 }
10561 m_OldLocation.Copy(oldLoc);
10562 }
10563 else
10564 {
10565 if (m_OldLocation)
10566 {
10567 m_OldLocation.Reset();
10568 }
10569 }
10570
10571 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10572 }
10573 else
10574 {
10575 if (newPlayer)
10576 {
10577 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10578 if (resIndex >= 0)
10579 {
10580 InventoryLocation il = new InventoryLocation;
10581 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10583 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10586 {
10587 il.
GetParent().GetOnReleaseLock().Invoke(it);
10588 }
10590 {
10592 }
10593
10594 }
10595 }
10597 {
10598
10600 }
10601
10602 if (m_OldLocation)
10603 {
10604 m_OldLocation.Reset();
10605 }
10606 }
10607
10609 {
10610 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10611 }
10612
10614 {
10615 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10616 }
10617 }
10618
10619 override void EOnContact(IEntity other, Contact extra)
10620 {
10622 {
10623 int liquidType = -1;
10625 if (impactSpeed > 0.0)
10626 {
10628 #ifndef SERVER
10630 #else
10632 SetSynchDirty();
10633 #endif
10635 }
10636 }
10637
10638 #ifdef SERVER
10639 if (GetCompEM() && GetCompEM().IsPlugged())
10640 {
10641 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10642 GetCompEM().UnplugThis();
10643 }
10644 #endif
10645 }
10646
10648
10650 {
10652 }
10653
10655 {
10656
10657 }
10658
10660 {
10661 super.OnItemLocationChanged(old_owner, new_owner);
10662
10663 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10664 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10665
10666 if (!relatedPlayer && playerNew)
10667 relatedPlayer = playerNew;
10668
10669 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10670 {
10672 if (actionMgr)
10673 {
10674 ActionBase currentAction = actionMgr.GetRunningAction();
10675 if (currentAction)
10677 }
10678 }
10679
10680 Man ownerPlayerOld = null;
10681 Man ownerPlayerNew = null;
10682
10683 if (old_owner)
10684 {
10685 if (old_owner.
IsMan())
10686 {
10687 ownerPlayerOld = Man.Cast(old_owner);
10688 }
10689 else
10690 {
10691 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10692 }
10693 }
10694 else
10695 {
10697 {
10699
10700 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10701 {
10702 GetCompEM().UnplugThis();
10703 }
10704 }
10705 }
10706
10707 if (new_owner)
10708 {
10709 if (new_owner.
IsMan())
10710 {
10711 ownerPlayerNew = Man.Cast(new_owner);
10712 }
10713 else
10714 {
10715 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10716 }
10717 }
10718
10719 if (ownerPlayerOld != ownerPlayerNew)
10720 {
10721 if (ownerPlayerOld)
10722 {
10723 array<EntityAI> subItemsExit = new array<EntityAI>;
10725 for (int i = 0; i < subItemsExit.Count(); i++)
10726 {
10729 }
10730 }
10731
10732 if (ownerPlayerNew)
10733 {
10734 array<EntityAI> subItemsEnter = new array<EntityAI>;
10736 for (int j = 0; j < subItemsEnter.Count(); j++)
10737 {
10740 }
10741 }
10742 }
10743 else if (ownerPlayerNew != null)
10744 {
10745 PlayerBase nplayer;
10746 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10747 {
10748 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10750 for (int k = 0; k < subItemsUpdate.Count(); k++)
10751 {
10753 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10754 }
10755 }
10756 }
10757
10758 if (old_owner)
10759 old_owner.OnChildItemRemoved(this);
10760 if (new_owner)
10761 new_owner.OnChildItemReceived(this);
10762 }
10763
10764
10766 {
10767 super.EEDelete(parent);
10768 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10769 if (player)
10770 {
10772
10773 if (player.IsAlive())
10774 {
10775 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10776 if (r_index >= 0)
10777 {
10778 InventoryLocation r_il = new InventoryLocation;
10779 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10780
10781 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10784 {
10785 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10786 }
10788 {
10789 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10790 }
10791
10792 }
10793
10794 player.RemoveQuickBarEntityShortcut(this);
10795 }
10796 }
10797 }
10798
10800 {
10801 super.EEKilled(killer);
10802
10805 {
10806 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10807 {
10808 if (IsMagazine())
10809 {
10810 if (Magazine.Cast(this).GetAmmoCount() > 0)
10811 {
10813 }
10814 }
10815 else
10816 {
10818 }
10819 }
10820 }
10821 }
10822
10824 {
10825 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10826
10827 super.OnWasAttached(parent, slot_id);
10828
10831
10834 }
10835
10837 {
10838 super.OnWasDetached(parent, slot_id);
10839
10842
10845 }
10846
10848 {
10849 int idx;
10852
10853 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10854 if (inventory_slots.Count() < 1)
10855 {
10856 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10857 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10858 }
10859 else
10860 {
10861 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10862 }
10863
10864 idx = inventory_slots.Find(slot);
10865 if (idx < 0)
10866 return "";
10867
10868 return attach_types.Get(idx);
10869 }
10870
10872 {
10873 int idx = -1;
10874 string slot;
10875
10878
10879 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10880 if (inventory_slots.Count() < 1)
10881 {
10882 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10883 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10884 }
10885 else
10886 {
10887 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10888 if (detach_types.Count() < 1)
10889 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10890 }
10891
10892 for (int i = 0; i < inventory_slots.Count(); i++)
10893 {
10894 slot = inventory_slots.Get(i);
10895 }
10896
10897 if (slot != "")
10898 {
10899 if (detach_types.Count() == 1)
10900 idx = 0;
10901 else
10902 idx = inventory_slots.Find(slot);
10903 }
10904 if (idx < 0)
10905 return "";
10906
10907 return detach_types.Get(idx);
10908 }
10909
10911 {
10912
10914
10915
10916 float min_time = 1;
10917 float max_time = 3;
10918 float delay = Math.RandomFloat(min_time, max_time);
10919
10920 explode_timer.Run(delay, this, "DoAmmoExplosion");
10921 }
10922
10924 {
10925 Magazine magazine = Magazine.Cast(this);
10926 int pop_sounds_count = 6;
10927 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10928
10929
10930 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10931 string sound_name = pop_sounds[ sound_idx ];
10932 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10933
10934
10935 magazine.ServerAddAmmoCount(-1);
10936
10937
10938 float min_temp_to_explode = 100;
10939
10940 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10941 {
10943 }
10944 }
10945
10946
10947 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10948 {
10949 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10950
10951 const int CHANCE_DAMAGE_CARGO = 4;
10952 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10953 const int CHANCE_DAMAGE_NOTHING = 2;
10954
10956 {
10957 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10958 int chances;
10959 int rnd;
10960
10961 if (GetInventory().GetCargo())
10962 {
10963 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10964 rnd = Math.RandomInt(0,chances);
10965
10966 if (rnd < CHANCE_DAMAGE_CARGO)
10967 {
10969 }
10970 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10971 {
10973 }
10974 }
10975 else
10976 {
10977 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10978 rnd = Math.RandomInt(0,chances);
10979
10980 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10981 {
10983 }
10984 }
10985 }
10986 }
10987
10989 {
10990 CargoBase cargo = GetInventory().GetCargo();
10991 if (cargo)
10992 {
10994 if (item_count > 0)
10995 {
10996 int random_pick = Math.RandomInt(0, item_count);
10998 if (!item.IsExplosive())
10999 {
11000 item.AddHealth("","",damage);
11001 return true;
11002 }
11003 }
11004 }
11005 return false;
11006 }
11007
11009 {
11010 GameInventory inventory = GetInventory();
11012 if (attachment_count > 0)
11013 {
11014 int random_pick = Math.RandomInt(0, attachment_count);
11016 if (!attachment.IsExplosive())
11017 {
11018 attachment.AddHealth("","",damage);
11019 return true;
11020 }
11021 }
11022 return false;
11023 }
11024
11026 {
11028 }
11029
11031 {
11033 return GetInventory().CanRemoveEntity();
11034
11035 return false;
11036 }
11037
11039 {
11040
11042 return false;
11043
11044
11046 return false;
11047
11048
11049
11051 if (delta == 0)
11052 return false;
11053
11054
11055 return true;
11056 }
11057
11059 {
11061 {
11062 if (ScriptInputUserData.CanStoreInputUserData())
11063 {
11064 ScriptInputUserData ctx = new ScriptInputUserData;
11069 ctx.
Write(destination_entity);
11071 ctx.
Write(slot_id);
11073 }
11074 }
11075 else if (!
g_Game.IsMultiplayer())
11076 {
11078 }
11079 }
11080
11082 {
11083 float split_quantity_new;
11087 InventoryLocation loc = new InventoryLocation;
11088
11089 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11090 {
11092 split_quantity_new = stack_max;
11093 else
11095
11097 {
11098 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11099 if (new_item)
11100 {
11101 new_item.SetResultOfSplit(true);
11102 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11104 new_item.
SetQuantity(split_quantity_new,
false,
true);
11105 }
11106 }
11107 }
11108 else if (destination_entity && slot_id == -1)
11109 {
11110 if (quantity > stack_max)
11111 split_quantity_new = stack_max;
11112 else
11113 split_quantity_new = quantity;
11114
11116 {
11117 GameInventory destinationInventory = destination_entity.GetInventory();
11119 {
11122 }
11123
11124 if (new_item)
11125 {
11126 new_item.SetResultOfSplit(true);
11127 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11129 new_item.
SetQuantity(split_quantity_new,
false,
true);
11130 }
11131 }
11132 }
11133 else
11134 {
11135 if (stack_max != 0)
11136 {
11138 {
11140 }
11141
11142 if (split_quantity_new == 0)
11143 {
11144 if (!
g_Game.IsMultiplayer())
11145 player.PhysicalPredictiveDropItem(this);
11146 else
11147 player.ServerDropEntity(this);
11148 return;
11149 }
11150
11152 {
11154
11155 if (new_item)
11156 {
11157 new_item.SetResultOfSplit(true);
11158 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11161 new_item.PlaceOnSurface();
11162 }
11163 }
11164 }
11165 }
11166 }
11167
11169 {
11170 float split_quantity_new;
11174 InventoryLocation loc = new InventoryLocation;
11175
11176 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11177 {
11179 split_quantity_new = stack_max;
11180 else
11182
11184 {
11185 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11186 if (new_item)
11187 {
11188 new_item.SetResultOfSplit(true);
11189 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11191 new_item.
SetQuantity(split_quantity_new,
false,
true);
11192 }
11193 }
11194 }
11195 else if (destination_entity && slot_id == -1)
11196 {
11197 if (quantity > stack_max)
11198 split_quantity_new = stack_max;
11199 else
11200 split_quantity_new = quantity;
11201
11203 {
11204 GameInventory destinationInventory = destination_entity.GetInventory();
11206 {
11209 }
11210
11211 if (new_item)
11212 {
11213 new_item.SetResultOfSplit(true);
11214 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11216 new_item.
SetQuantity(split_quantity_new,
false,
true);
11217 }
11218 }
11219 }
11220 else
11221 {
11222 if (stack_max != 0)
11223 {
11225 {
11227 }
11228
11230 {
11232
11233 if (new_item)
11234 {
11235 new_item.SetResultOfSplit(true);
11236 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11239 new_item.PlaceOnSurface();
11240 }
11241 }
11242 }
11243 }
11244 }
11245
11247 {
11249 {
11250 if (ScriptInputUserData.CanStoreInputUserData())
11251 {
11252 ScriptInputUserData ctx = new ScriptInputUserData;
11257 dst.WriteToContext(ctx);
11259 }
11260 }
11261 else if (!
g_Game.IsMultiplayer())
11262 {
11264 }
11265 }
11266
11268 {
11270 {
11271 if (ScriptInputUserData.CanStoreInputUserData())
11272 {
11273 ScriptInputUserData ctx = new ScriptInputUserData;
11278 ctx.
Write(destination_entity);
11284 }
11285 }
11286 else if (!
g_Game.IsMultiplayer())
11287 {
11289 }
11290 }
11291
11293 {
11295 }
11296
11298 {
11300 float split_quantity_new;
11302 if (dst.IsValid())
11303 {
11304 int slot_id = dst.GetSlot();
11306
11307 if (quantity > stack_max)
11308 split_quantity_new = stack_max;
11309 else
11310 split_quantity_new = quantity;
11311
11313 {
11315
11316 if (new_item)
11317 {
11318 new_item.SetResultOfSplit(true);
11319 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11321 new_item.
SetQuantity(split_quantity_new,
false,
true);
11322 }
11323
11324 return new_item;
11325 }
11326 }
11327
11328 return null;
11329 }
11330
11332 {
11334 float split_quantity_new;
11336 if (destination_entity)
11337 {
11339 if (quantity > stackable)
11340 split_quantity_new = stackable;
11341 else
11342 split_quantity_new = quantity;
11343
11345 {
11346 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11347 if (new_item)
11348 {
11349 new_item.SetResultOfSplit(true);
11350 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11352 new_item.
SetQuantity(split_quantity_new,
false,
true);
11353 }
11354 }
11355 }
11356 }
11357
11359 {
11361 {
11362 if (ScriptInputUserData.CanStoreInputUserData())
11363 {
11364 ScriptInputUserData ctx = new ScriptInputUserData;
11369 ItemBase destination_entity =
this;
11370 ctx.
Write(destination_entity);
11374 }
11375 }
11376 else if (!
g_Game.IsMultiplayer())
11377 {
11379 }
11380 }
11381
11383 {
11385 float split_quantity_new;
11387 if (player)
11388 {
11390 if (quantity > stackable)
11391 split_quantity_new = stackable;
11392 else
11393 split_quantity_new = quantity;
11394
11396 {
11397 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11398 new_item =
ItemBase.Cast(in_hands);
11399 if (new_item)
11400 {
11401 new_item.SetResultOfSplit(true);
11402 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11404 new_item.SetQuantity(split_quantity_new, false, true);
11405 }
11406 }
11407 }
11408 }
11409
11411 {
11413 float split_quantity_new = Math.Floor(quantity * 0.5);
11414
11416 return;
11417
11419
11420 if (new_item)
11421 {
11422 if (new_item.GetQuantityMax() < split_quantity_new)
11423 {
11424 split_quantity_new = new_item.GetQuantityMax();
11425 }
11426
11427 new_item.SetResultOfSplit(true);
11428 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11429
11431 {
11434 }
11435 else
11436 {
11438 new_item.
SetQuantity(split_quantity_new,
false,
true);
11439 }
11440 }
11441 }
11442
11444 {
11446 float split_quantity_new = Math.Floor(quantity / 2);
11447
11449 return;
11450
11451 InventoryLocation invloc = new InventoryLocation;
11453
11455 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11456
11457 if (new_item)
11458 {
11459 if (new_item.GetQuantityMax() < split_quantity_new)
11460 {
11461 split_quantity_new = new_item.GetQuantityMax();
11462 }
11464 {
11467 }
11468 else if (split_quantity_new > 1)
11469 {
11471 new_item.
SetQuantity(split_quantity_new,
false,
true);
11472 }
11473 }
11474 }
11475
11478 {
11479 SetWeightDirty();
11481
11482 if (parent)
11483 parent.OnAttachmentQuantityChangedEx(this, delta);
11484
11486 {
11488 {
11490 }
11492 {
11493 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11495 }
11496 }
11497 }
11498
11501 {
11502
11503 }
11504
11507 {
11509 }
11510
11512 {
11513 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11514
11516 {
11517 if (newLevel == GameConstants.STATE_RUINED)
11518 {
11520 EntityAI parent = GetHierarchyParent();
11521 if (parent && parent.IsFireplace())
11522 {
11523 CargoBase cargo = GetInventory().GetCargo();
11524 if (cargo)
11525 {
11527 {
11529 }
11530 }
11531 }
11532 }
11533
11535 {
11536
11538 return;
11539 }
11540
11541 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11542 {
11544 }
11545 }
11546 }
11547
11548
11550 {
11551 super.OnRightClick();
11552
11554 {
11556 {
11557 if (ScriptInputUserData.CanStoreInputUserData())
11558 {
11559 EntityAI root = GetHierarchyRoot();
11560 Man playerOwner = GetHierarchyRootPlayer();
11561 InventoryLocation dst = new InventoryLocation;
11562
11563
11564 if (!playerOwner && root && root == this)
11565 {
11567 }
11568 else
11569 {
11570
11571 GetInventory().GetCurrentInventoryLocation(dst);
11573 {
11574 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11576 {
11578 }
11579 else
11580 {
11582
11583
11584 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11585 {
11587 }
11588 else
11589 {
11590 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11591 }
11592 }
11593 }
11594 }
11595
11596 ScriptInputUserData ctx = new ScriptInputUserData;
11604 }
11605 }
11606 else if (!
g_Game.IsMultiplayer())
11607 {
11609 }
11610 }
11611 }
11612
11614 {
11615 if (root)
11616 {
11617 vector m4[4];
11618 root.GetTransform(m4);
11619 dst.SetGround(this, m4);
11620 }
11621 else
11622 {
11623 GetInventory().GetCurrentInventoryLocation(dst);
11624 }
11625 }
11626
11627 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11628 {
11629
11630 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11631 return false;
11632
11633 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11634 return false;
11635
11636
11638 return false;
11639
11640
11641 Magazine mag = Magazine.Cast(this);
11642 if (mag)
11643 {
11644 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11645 return false;
11646
11647 if (stack_max_limit)
11648 {
11649 Magazine other_mag = Magazine.Cast(other_item);
11650 if (other_item)
11651 {
11652 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11653 return false;
11654 }
11655
11656 }
11657 }
11658 else
11659 {
11660
11662 return false;
11663
11665 return false;
11666 }
11667
11668 PlayerBase player = null;
11669 if (CastTo(player, GetHierarchyRootPlayer()))
11670 {
11671 if (player.GetInventory().HasAttachment(this))
11672 return false;
11673
11674 if (player.IsItemsToDelete())
11675 return false;
11676 }
11677
11678 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11679 return false;
11680
11681 int slotID;
11683 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11684 return false;
11685
11686 return true;
11687 }
11688
11690 {
11692 }
11693
11695 {
11696 return m_IsResultOfSplit;
11697 }
11698
11700 {
11701 m_IsResultOfSplit = value;
11702 }
11703
11705 {
11707 }
11708
11710 {
11711 float other_item_quantity = other_item.GetQuantity();
11712 float this_free_space;
11713
11715
11717
11718 if (other_item_quantity > this_free_space)
11719 {
11720 return this_free_space;
11721 }
11722 else
11723 {
11724 return other_item_quantity;
11725 }
11726 }
11727
11729 {
11731 }
11732
11734 {
11736 return;
11737
11738 if (!IsMagazine() && other_item)
11739 {
11741 if (quantity_used != 0)
11742 {
11743 float hp1 = GetHealth01("","");
11744 float hp2 = other_item.GetHealth01("","");
11745 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11746 hpResult = hpResult / (
GetQuantity() + quantity_used);
11747
11748 hpResult *= GetMaxHealth();
11749 Math.Round(hpResult);
11750 SetHealth("", "Health", hpResult);
11751
11753 other_item.AddQuantity(-quantity_used);
11754 }
11755 }
11757 }
11758
11760 {
11761 #ifdef SERVER
11762 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11763 GetHierarchyParent().IncreaseLifetimeUp();
11764 #endif
11765 };
11766
11768 {
11769 PlayerBase p = PlayerBase.Cast(player);
11770
11771 array<int> recipesIds = p.m_Recipes;
11772 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11773 if (moduleRecipesManager)
11774 {
11775 EntityAI itemInHands = player.GetEntityInHands();
11776 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11777 }
11778
11779 for (int i = 0;i < recipesIds.Count(); i++)
11780 {
11781 int key = recipesIds.Get(i);
11782 string recipeName = moduleRecipesManager.GetRecipeName(key);
11784 }
11785 }
11786
11787
11788 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11789 {
11790 super.GetDebugActions(outputList);
11791
11792
11798
11799
11804
11809
11810
11814
11815
11817 {
11821 }
11822
11825
11826
11830
11832
11833 InventoryLocation loc = new InventoryLocation();
11834 GetInventory().GetCurrentInventoryLocation(loc);
11836 {
11837 if (Gizmo_IsSupported())
11840 }
11841
11843 }
11844
11845
11846
11847
11849 {
11850 super.OnAction(action_id, player, ctx);
11851
11853 {
11854 switch (action_id)
11855 {
11859 return true;
11863 return true;
11864 }
11865 }
11866
11868 {
11869 switch (action_id)
11870 {
11872 Delete();
11873 return true;
11874 }
11875 }
11876
11877 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11878 {
11879 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11880 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11881 PlayerBase p = PlayerBase.Cast(player);
11882 if (
EActions.RECIPES_RANGE_START < 1000)
11883 {
11884 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11885 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11886 }
11887 }
11888 #ifndef SERVER
11889 else if (action_id ==
EActions.WATCH_PLAYER)
11890 {
11891 PluginDeveloper.SetDeveloperItemClientEx(player);
11892 }
11893 #endif
11895 {
11896 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11897 {
11898 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11899 OnDebugButtonPressServer(id + 1);
11900 }
11901
11902 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11903 {
11904 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11906 }
11907
11908 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11909 {
11910 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11912 }
11913
11914 else if (action_id ==
EActions.ADD_QUANTITY)
11915 {
11916 if (IsMagazine())
11917 {
11918 Magazine mag = Magazine.Cast(this);
11919 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11920 }
11921 else
11922 {
11924 }
11925
11926 if (m_EM)
11927 {
11928 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11929 }
11930
11931 }
11932
11933 else if (action_id ==
EActions.REMOVE_QUANTITY)
11934 {
11935 if (IsMagazine())
11936 {
11937 Magazine mag2 = Magazine.Cast(this);
11938 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11939 }
11940 else
11941 {
11943 }
11944 if (m_EM)
11945 {
11946 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11947 }
11948
11949 }
11950
11951 else if (action_id ==
EActions.SET_QUANTITY_0)
11952 {
11954
11955 if (m_EM)
11956 {
11957 m_EM.SetEnergy(0);
11958 }
11959 }
11960
11961 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11962 {
11964
11965 if (m_EM)
11966 {
11967 m_EM.SetEnergy(m_EM.GetEnergyMax());
11968 }
11969 }
11970
11971 else if (action_id ==
EActions.ADD_HEALTH)
11972 {
11973 AddHealth("","",GetMaxHealth("","Health")/5);
11974 }
11975 else if (action_id ==
EActions.REMOVE_HEALTH)
11976 {
11977 AddHealth("","",-GetMaxHealth("","Health")/5);
11978 }
11979 else if (action_id ==
EActions.DESTROY_HEALTH)
11980 {
11981 SetHealth01("","",0);
11982 }
11983 else if (action_id ==
EActions.WATCH_ITEM)
11984 {
11986 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11987 #ifdef DEVELOPER
11988 SetDebugDeveloper_item(this);
11989 #endif
11990 }
11991
11992 else if (action_id ==
EActions.ADD_TEMPERATURE)
11993 {
11994 AddTemperature(20);
11995
11996 }
11997
11998 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11999 {
12000 AddTemperature(-20);
12001
12002 }
12003
12004 else if (action_id ==
EActions.FLIP_FROZEN)
12005 {
12006 SetFrozen(!GetIsFrozen());
12007
12008 }
12009
12010 else if (action_id ==
EActions.ADD_WETNESS)
12011 {
12013
12014 }
12015
12016 else if (action_id ==
EActions.REMOVE_WETNESS)
12017 {
12019
12020 }
12021
12022 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12023 {
12026
12027
12028 }
12029
12030 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12031 {
12034 }
12035
12036 else if (action_id ==
EActions.MAKE_SPECIAL)
12037 {
12038 auto debugParams = DebugSpawnParams.WithPlayer(player);
12039 OnDebugSpawnEx(debugParams);
12040 }
12041
12042 }
12043
12044
12045 return false;
12046 }
12047
12048
12049
12050
12054
12057
12058
12059
12061 {
12062 return false;
12063 }
12064
12065
12067 {
12068 return true;
12069 }
12070
12071
12073 {
12074 return true;
12075 }
12076
12077
12078
12080 {
12081 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12082 return g_Game.ConfigIsExisting(config_path);
12083 }
12084
12087 {
12088 return null;
12089 }
12090
12092 {
12093 return false;
12094 }
12095
12097 {
12098 return false;
12099 }
12100
12104
12105
12107 {
12108 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12109 return module_repairing.CanRepair(this, item_repair_kit);
12110 }
12111
12112
12113 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12114 {
12115 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12116 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12117 }
12118
12119
12121 {
12122
12123
12124
12125
12126
12127
12128
12129
12130 return 1;
12131 }
12132
12133
12134
12136 {
12138 }
12139
12140
12141
12143 {
12145 }
12146
12147
12156 {
12157 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12158
12159 if (player)
12160 {
12161 player.MessageStatus(text);
12162 }
12163 }
12164
12165
12174 {
12175 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12176
12177 if (player)
12178 {
12179 player.MessageAction(text);
12180 }
12181 }
12182
12183
12192 {
12193 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12194
12195 if (player)
12196 {
12197 player.MessageFriendly(text);
12198 }
12199 }
12200
12201
12210 {
12211 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12212
12213 if (player)
12214 {
12215 player.MessageImportant(text);
12216 }
12217 }
12218
12220 {
12221 return true;
12222 }
12223
12224
12225 override bool KindOf(
string tag)
12226 {
12227 bool found = false;
12228 string item_name = this.
GetType();
12230 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12231
12232 int array_size = item_tag_array.Count();
12233 for (int i = 0; i < array_size; i++)
12234 {
12235 if (item_tag_array.Get(i) == tag)
12236 {
12237 found = true;
12238 break;
12239 }
12240 }
12241 return found;
12242 }
12243
12244
12246 {
12247
12248 super.OnRPC(sender, rpc_type,ctx);
12249
12250
12251 switch (rpc_type)
12252 {
12253 #ifndef SERVER
12254 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12255 Param2<bool, string> p = new Param2<bool, string>(false, "");
12256
12258 return;
12259
12260 bool play = p.param1;
12261 string soundSet = p.param2;
12262
12263 if (play)
12264 {
12266 {
12268 {
12270 }
12271 }
12272 else
12273 {
12275 }
12276 }
12277 else
12278 {
12280 }
12281
12282 break;
12283 #endif
12284
12285 }
12286
12288 {
12290 }
12291 }
12292
12293
12294
12295
12297 {
12298 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12299 return plugin.GetID(
name);
12300 }
12301
12303 {
12304 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12305 return plugin.GetName(id);
12306 }
12307
12310 {
12311
12312
12313 int varFlags;
12314 if (!ctx.
Read(varFlags))
12315 return;
12316
12317 if (varFlags & ItemVariableFlags.FLOAT)
12318 {
12320 }
12321 }
12322
12324 {
12325
12326 super.SerializeNumericalVars(floats_out);
12327
12328
12329
12331 {
12333 }
12334
12336 {
12338 }
12339
12341 {
12343 }
12344
12346 {
12351 }
12352
12354 {
12356 }
12357 }
12358
12360 {
12361
12362 super.DeSerializeNumericalVars(floats);
12363
12364
12365 int index = 0;
12366 int mask = Math.Round(floats.Get(index));
12367
12368 index++;
12369
12371 {
12373 {
12375 }
12376 else
12377 {
12378 float quantity = floats.Get(index);
12379 SetQuantity(quantity,
true,
false,
false,
false);
12380 }
12381 index++;
12382 }
12383
12385 {
12386 float wet = floats.Get(index);
12388 index++;
12389 }
12390
12392 {
12393 int liquidtype = Math.Round(floats.Get(index));
12395 index++;
12396 }
12397
12399 {
12401 index++;
12403 index++;
12405 index++;
12407 index++;
12408 }
12409
12411 {
12412 int cleanness = Math.Round(floats.Get(index));
12414 index++;
12415 }
12416 }
12417
12419 {
12420 super.WriteVarsToCTX(ctx);
12421
12422
12424 {
12426 }
12427
12429 {
12431 }
12432
12434 {
12436 }
12437
12439 {
12440 int r,g,b,a;
12446 }
12447
12449 {
12451 }
12452 }
12453
12455 {
12456 if (!super.ReadVarsFromCTX(ctx,version))
12457 return false;
12458
12459 int intValue;
12460 float value;
12461
12462 if (version < 140)
12463 {
12464 if (!ctx.
Read(intValue))
12465 return false;
12466
12467 m_VariablesMask = intValue;
12468 }
12469
12471 {
12472 if (!ctx.
Read(value))
12473 return false;
12474
12476 {
12478 }
12479 else
12480 {
12482 }
12483 }
12484
12485 if (version < 140)
12486 {
12488 {
12489 if (!ctx.
Read(value))
12490 return false;
12491 SetTemperatureDirect(value);
12492 }
12493 }
12494
12496 {
12497 if (!ctx.
Read(value))
12498 return false;
12500 }
12501
12503 {
12504 if (!ctx.
Read(intValue))
12505 return false;
12507 }
12508
12510 {
12511 int r,g,b,a;
12513 return false;
12515 return false;
12517 return false;
12519 return false;
12520
12522 }
12523
12525 {
12526 if (!ctx.
Read(intValue))
12527 return false;
12529 }
12530
12531 if (version >= 138 && version < 140)
12532 {
12534 {
12535 if (!ctx.
Read(intValue))
12536 return false;
12537 SetFrozen(intValue);
12538 }
12539 }
12540
12541 return true;
12542 }
12543
12544
12546 {
12549 {
12551 }
12552
12553 if (!super.OnStoreLoad(ctx, version))
12554 {
12556 return false;
12557 }
12558
12559 if (version >= 114)
12560 {
12561 bool hasQuickBarIndexSaved;
12562
12563 if (!ctx.
Read(hasQuickBarIndexSaved))
12564 {
12566 return false;
12567 }
12568
12569 if (hasQuickBarIndexSaved)
12570 {
12571 int itmQBIndex;
12572
12573
12574 if (!ctx.
Read(itmQBIndex))
12575 {
12577 return false;
12578 }
12579
12580 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12581 if (itmQBIndex != -1 && parentPlayer)
12582 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12583 }
12584 }
12585 else
12586 {
12587
12588 PlayerBase player;
12589 int itemQBIndex;
12590 if (version ==
int.
MAX)
12591 {
12592 if (!ctx.
Read(itemQBIndex))
12593 {
12595 return false;
12596 }
12597 }
12598 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12599 {
12600
12601 if (!ctx.
Read(itemQBIndex))
12602 {
12604 return false;
12605 }
12606 if (itemQBIndex != -1 && player)
12607 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12608 }
12609 }
12610
12611 if (version < 140)
12612 {
12613
12614 if (!LoadVariables(ctx, version))
12615 {
12617 return false;
12618 }
12619 }
12620
12621
12623 {
12625 return false;
12626 }
12627 if (version >= 132)
12628 {
12630 if (raib)
12631 {
12633 {
12635 return false;
12636 }
12637 }
12638 }
12639
12641 return true;
12642 }
12643
12644
12645
12647 {
12648 super.OnStoreSave(ctx);
12649
12650 PlayerBase player;
12651 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12652 {
12654
12655 int itemQBIndex = -1;
12656 itemQBIndex = player.FindQuickBarEntityIndex(this);
12657 ctx.
Write(itemQBIndex);
12658 }
12659 else
12660 {
12662 }
12663
12665
12667 if (raib)
12668 {
12670 }
12671 }
12672
12673
12675 {
12676 super.AfterStoreLoad();
12677
12679 {
12681 }
12682
12684 {
12687 }
12688 }
12689
12691 {
12692 super.EEOnAfterLoad();
12693
12695 {
12697 }
12698
12701 }
12702
12704 {
12705 return false;
12706 }
12707
12708
12709
12711 {
12713 {
12714 #ifdef PLATFORM_CONSOLE
12715
12717 {
12719 if (menu)
12720 {
12722 }
12723 }
12724 #endif
12725 }
12726
12728 {
12731 }
12732
12734 {
12735 SetWeightDirty();
12737 }
12739 {
12742 }
12743
12745 {
12748
12751 }
12753 {
12757 }
12758
12759 super.OnVariablesSynchronized();
12760 }
12761
12762
12763
12765 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12766 {
12767 if (!IsServerCheck(allow_client))
12768 return false;
12769
12771 return false;
12772
12775
12776 if (value <= (min + 0.001))
12777 value = min;
12778
12779 if (value == min)
12780 {
12781 if (destroy_config)
12782 {
12783 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12784 if (dstr)
12785 {
12787 this.Delete();
12788 return true;
12789 }
12790 }
12791 else if (destroy_forced)
12792 {
12794 this.Delete();
12795 return true;
12796 }
12797
12799 }
12800
12803
12805 {
12806 EntityAI parent = GetHierarchyRoot();
12807 InventoryLocation iLoc = new InventoryLocation();
12808 GetInventory().GetCurrentInventoryLocation(iLoc);
12810 {
12811 int iLocSlot = iLoc.
GetSlot();
12813 {
12815 }
12817 {
12819 }
12820 }
12821 }
12822
12824 {
12826
12827 if (delta)
12829 }
12830
12832
12833 return false;
12834 }
12835
12836
12838 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12839 {
12841 }
12842
12844 {
12847 }
12848
12850 {
12853 }
12854
12856 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12857 {
12858 float value_clamped = Math.Clamp(value, 0, 1);
12860 SetQuantity(result, destroy_config, destroy_forced);
12861 }
12862
12863
12866 {
12868 }
12869
12871 {
12873 }
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12885 {
12886 int slot = -1;
12887 GameInventory inventory = GetInventory();
12888 if (inventory)
12889 {
12890 InventoryLocation il = new InventoryLocation;
12893 }
12894
12896 }
12897
12899 {
12900 float quantity_max = 0;
12901
12903 {
12904 if (attSlotID != -1)
12905 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12906
12907 if (quantity_max <= 0)
12909 }
12910
12911 if (quantity_max <= 0)
12913
12914 return quantity_max;
12915 }
12916
12918 {
12920 }
12921
12923 {
12925 }
12926
12927
12929 {
12931 }
12932
12934 {
12936 }
12937
12939 {
12941 }
12942
12943
12945 {
12946
12947 float weightEx = GetWeightEx();
12948 float special = GetInventoryAndCargoWeight();
12949 return weightEx - special;
12950 }
12951
12952
12954 {
12956 }
12957
12959 {
12961 {
12962 #ifdef DEVELOPER
12963 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12964 {
12965 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12967 }
12968 #endif
12969
12970 return GetQuantity() * GetConfigWeightModified();
12971 }
12972 else if (HasEnergyManager())
12973 {
12974 #ifdef DEVELOPER
12975 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12976 {
12977 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12978 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12979 }
12980 #endif
12981 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12982 }
12983 else
12984 {
12985 #ifdef DEVELOPER
12986 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12987 {
12988 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12989 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12990 }
12991 #endif
12992 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12993 }
12994 }
12995
12998 {
12999 int item_count = 0;
13001
13002 GameInventory inventory = GetInventory();
13003 CargoBase cargo = inventory.
GetCargo();
13004 if (cargo != NULL)
13005 {
13007 }
13008
13010 for (int i = 0; i < nAttachments; ++i)
13011 {
13013 if (item)
13014 item_count += item.GetNumberOfItems();
13015 }
13016 return item_count;
13017 }
13018
13021 {
13022 float weight = 0;
13023 float wetness = 1;
13024 if (include_wetness)
13027 {
13028 weight = wetness * m_ConfigWeight;
13029 }
13031 {
13032 weight = 1;
13033 }
13034 return weight;
13035 }
13036
13037
13038
13040 {
13041 GameInventory inventory = GetInventory();
13042 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13043 {
13044 array<EntityAI> items = new array<EntityAI>;
13046 for (int i = 0; i < items.Count(); ++i)
13047 {
13049 if (item)
13050 {
13051 g_Game.ObjectDelete(item);
13052 }
13053 }
13054 }
13055 }
13056
13057
13058
13059
13061 {
13062 float energy = 0;
13063 if (HasEnergyManager())
13064 {
13065 energy = GetCompEM().GetEnergy();
13066 }
13067 return energy;
13068 }
13069
13070
13072 {
13073 super.OnEnergyConsumed();
13074
13076 }
13077
13079 {
13080 super.OnEnergyAdded();
13081
13083 }
13084
13085
13087 {
13088 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13089 {
13091 {
13092 float energy_0to1 = GetCompEM().GetEnergy0To1();
13094 }
13095 }
13096 }
13097
13098
13100 {
13101 return ConfigGetFloat("heatIsolation");
13102 }
13103
13105 {
13107 }
13108
13110 {
13111 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13112 if (
g_Game.ConfigIsExisting(paramPath))
13113 return g_Game.ConfigGetFloat(paramPath);
13114
13115 return 0.0;
13116 }
13117
13119 {
13120 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13121 if (
g_Game.ConfigIsExisting(paramPath))
13122 return g_Game.ConfigGetFloat(paramPath);
13123
13124 return 0.0;
13125 }
13126
13127 override void SetWet(
float value,
bool allow_client =
false)
13128 {
13129 if (!IsServerCheck(allow_client))
13130 return;
13131
13134
13136
13137 m_VarWet = Math.Clamp(value, min, max);
13138
13140 {
13143 }
13144 }
13145
13146 override void AddWet(
float value)
13147 {
13149 }
13150
13152 {
13154 }
13155
13157 {
13159 }
13160
13162 {
13164 }
13165
13167 {
13169 }
13170
13172 {
13174 }
13175
13176 override void OnWetChanged(
float newVal,
float oldVal)
13177 {
13180 if (newLevel != oldLevel)
13181 {
13183 }
13184 }
13185
13187 {
13188 SetWeightDirty();
13189 }
13190
13192 {
13193 return GetWetLevelInternal(
m_VarWet);
13194 }
13195
13196
13197
13199 {
13201 }
13202
13204 {
13206 }
13207
13209 {
13211 }
13212
13214 {
13216 }
13217
13218
13219
13221 {
13222 if (ConfigIsExisting("itemModelLength"))
13223 {
13224 return ConfigGetFloat("itemModelLength");
13225 }
13226 return 0;
13227 }
13228
13230 {
13231 if (ConfigIsExisting("itemAttachOffset"))
13232 {
13233 return ConfigGetFloat("itemAttachOffset");
13234 }
13235 return 0;
13236 }
13237
13238 override void SetCleanness(
int value,
bool allow_client =
false)
13239 {
13240 if (!IsServerCheck(allow_client))
13241 return;
13242
13244
13246
13249 }
13250
13252 {
13254 }
13255
13257 {
13258 return true;
13259 }
13260
13261
13262
13263
13265 {
13267 }
13268
13270 {
13272 }
13273
13274
13275
13276
13277 override void SetColor(
int r,
int g,
int b,
int a)
13278 {
13284 }
13286 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13287 {
13292 }
13293
13295 {
13297 }
13298
13301 {
13302 int r,g,b,a;
13304 r = r/255;
13305 g = g/255;
13306 b = b/255;
13307 a = a/255;
13308 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13309 }
13310
13311
13312
13313 override void SetLiquidType(
int value,
bool allow_client =
false)
13314 {
13315 if (!IsServerCheck(allow_client))
13316 return;
13317
13322 }
13323
13325 {
13326 return ConfigGetInt("varLiquidTypeInit");
13327 }
13328
13330 {
13332 }
13333
13335 {
13337 SetFrozen(false);
13338 }
13339
13342 {
13343 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13344 }
13345
13346
13349 {
13350 PlayerBase nplayer;
13351 if (PlayerBase.CastTo(nplayer, player))
13352 {
13354 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13355 }
13356 }
13357
13358
13361 {
13362 PlayerBase nplayer;
13363 if (PlayerBase.CastTo(nplayer,player))
13364 {
13365 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13366 }
13367
13368 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13369
13370 if (HasEnergyManager())
13371 {
13372 GetCompEM().UpdatePlugState();
13373 }
13374 }
13375
13376
13378 {
13379 super.OnPlacementStarted(player);
13380
13382 }
13383
13384 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13385 {
13387 {
13388 m_AdminLog.OnPlacementComplete(player,
this);
13389 }
13390
13391 super.OnPlacementComplete(player, position, orientation);
13392 }
13393
13394
13395
13396
13397
13399 {
13401 {
13402 return true;
13403 }
13404 else
13405 {
13406 return false;
13407 }
13408 }
13409
13410
13412 {
13414 {
13416 }
13417 }
13418
13419
13421 {
13423 }
13424
13426 {
13428 }
13429
13430 override void InsertAgent(
int agent,
float count = 1)
13431 {
13432 if (count < 1)
13433 return;
13434
13436 }
13437
13440 {
13442 }
13443
13444
13446 {
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
13485
13486
13487
13488
13489
13490
13492 {
13494 return false;
13495 return true;
13496 }
13497
13499 {
13500
13502 }
13503
13504
13507 {
13508 super.CheckForRoofLimited(timeTresholdMS);
13509
13510 float time =
g_Game.GetTime();
13511 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13512 {
13513 m_PreviousRoofTestTime = time;
13514 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13515 }
13516 }
13517
13518
13520 {
13522 {
13523 return 0;
13524 }
13525
13526 if (GetInventory().GetAttachmentSlotsCount() != 0)
13527 {
13528 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13529 if (filter)
13530 return filter.GetProtectionLevel(type, false, system);
13531 else
13532 return 0;
13533 }
13534
13535 string subclassPath, entryName;
13536
13537 switch (type)
13538 {
13540 entryName = "biological";
13541 break;
13543 entryName = "chemical";
13544 break;
13545 default:
13546 entryName = "biological";
13547 break;
13548 }
13549
13550 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13551
13552 return g_Game.ConfigGetFloat(subclassPath + entryName);
13553 }
13554
13555
13556
13559 {
13560 if (!IsMagazine())
13562
13564 }
13565
13566
13567
13568
13569
13574 {
13575 return true;
13576 }
13577
13579 {
13581 }
13582
13583
13584
13585
13586
13588 {
13589 if (parent)
13590 {
13591 if (parent.IsInherited(DayZInfected))
13592 return true;
13593
13594 if (!parent.IsRuined())
13595 return true;
13596 }
13597
13598 return true;
13599 }
13600
13602 {
13603 if (!super.CanPutAsAttachment(parent))
13604 {
13605 return false;
13606 }
13607
13608 if (!IsRuined() && !parent.IsRuined())
13609 {
13610 return true;
13611 }
13612
13613 return false;
13614 }
13615
13617 {
13618
13619
13620
13621
13622 return super.CanReceiveItemIntoCargo(item);
13623 }
13624
13626 {
13627
13628
13629
13630
13631 GameInventory attachmentInv = attachment.GetInventory();
13633 {
13634 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13635 return false;
13636 }
13637
13638 InventoryLocation loc = new InventoryLocation();
13639 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13640 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13641 return false;
13642
13643 return super.CanReceiveAttachment(attachment, slotId);
13644 }
13645
13647 {
13648 if (!super.CanReleaseAttachment(attachment))
13649 return false;
13650
13651 return GetInventory().AreChildrenAccessible();
13652 }
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13675 {
13676 int id = muzzle_owner.GetMuzzleID();
13677 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13678
13679 if (WPOF_array)
13680 {
13681 for (int i = 0; i < WPOF_array.Count(); i++)
13682 {
13683 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13684
13685 if (WPOF)
13686 {
13687 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13688 }
13689 }
13690 }
13691 }
13692
13693
13695 {
13696 int id = muzzle_owner.GetMuzzleID();
13698
13699 if (WPOBE_array)
13700 {
13701 for (int i = 0; i < WPOBE_array.Count(); i++)
13702 {
13703 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13704
13705 if (WPOBE)
13706 {
13707 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13708 }
13709 }
13710 }
13711 }
13712
13713
13715 {
13716 int id = muzzle_owner.GetMuzzleID();
13717 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13718
13719 if (WPOOH_array)
13720 {
13721 for (int i = 0; i < WPOOH_array.Count(); i++)
13722 {
13723 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13724
13725 if (WPOOH)
13726 {
13727 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13728 }
13729 }
13730 }
13731 }
13732
13733
13735 {
13736 int id = muzzle_owner.GetMuzzleID();
13737 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13738
13739 if (WPOOH_array)
13740 {
13741 for (int i = 0; i < WPOOH_array.Count(); i++)
13742 {
13743 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13744
13745 if (WPOOH)
13746 {
13747 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13748 }
13749 }
13750 }
13751 }
13752
13753
13755 {
13756 int id = muzzle_owner.GetMuzzleID();
13757 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13758
13759 if (WPOOH_array)
13760 {
13761 for (int i = 0; i < WPOOH_array.Count(); i++)
13762 {
13763 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13764
13765 if (WPOOH)
13766 {
13767 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13768 }
13769 }
13770 }
13771 }
13772
13773
13774
13776 {
13778 {
13779 return true;
13780 }
13781
13782 return false;
13783 }
13784
13786 {
13788 {
13789 return true;
13790 }
13791
13792 return false;
13793 }
13794
13796 {
13798 {
13799 return true;
13800 }
13801
13802 return false;
13803 }
13804
13806 {
13807 return false;
13808 }
13809
13812 {
13813 return UATimeSpent.DEFAULT_DEPLOY;
13814 }
13815
13816
13817
13818
13820 {
13822 SetSynchDirty();
13823 }
13824
13826 {
13828 }
13829
13830
13832 {
13833 return false;
13834 }
13835
13838 {
13839 string att_type = "None";
13840
13841 if (ConfigIsExisting("soundAttType"))
13842 {
13843 att_type = ConfigGetString("soundAttType");
13844 }
13845
13847 }
13848
13850 {
13852 }
13853
13854
13855
13856
13857
13863
13865 {
13868
13870 }
13871
13872
13874 {
13876 return;
13877
13879
13882
13885
13886 SoundParameters params = new SoundParameters();
13890 }
13891
13892
13894 {
13896 {
13899
13900 SetSynchDirty();
13901
13904 }
13905 }
13906
13908 {
13910 }
13911
13912
13914 {
13916 return;
13917
13919 SetSynchDirty();
13920
13923 }
13924
13926 {
13929 }
13930
13932 {
13934 }
13935
13936 void OnApply(PlayerBase player);
13937
13939 {
13940 return 1.0;
13941 };
13942
13944 {
13946 }
13947
13949 {
13951 }
13952
13954
13956 {
13957 SetDynamicPhysicsLifeTime(0.01);
13959 }
13960
13962 {
13963 array<string> zone_names = new array<string>;
13964 GetDamageZones(zone_names);
13965 for (int i = 0; i < zone_names.Count(); i++)
13966 {
13967 SetHealthMax(zone_names.Get(i),"Health");
13968 }
13969 SetHealthMax("","Health");
13970 }
13971
13974 {
13975 float global_health = GetHealth01("","Health");
13976 array<string> zones = new array<string>;
13977 GetDamageZones(zones);
13978
13979 for (int i = 0; i < zones.Count(); i++)
13980 {
13981 SetHealth01(zones.Get(i),"Health",global_health);
13982 }
13983 }
13984
13987 {
13988 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13989 }
13990
13992 {
13993 if (!hasRootAsPlayer)
13994 {
13995 if (refParentIB)
13996 {
13997
13998 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13999 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14000
14001 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14002 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14003
14006 }
14007 else
14008 {
14009
14012 }
14013 }
14014 }
14015
14017 {
14019 {
14020 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14021 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14022 {
14023 float heatPermCoef = 1.0;
14025 while (ent)
14026 {
14027 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14028 ent = ent.GetHierarchyParent();
14029 }
14030
14031 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14032 }
14033 }
14034 }
14035
14037 {
14038
14039 EntityAI parent = GetHierarchyParent();
14040 if (!parent)
14041 {
14042 hasParent = false;
14043 hasRootAsPlayer = false;
14044 }
14045 else
14046 {
14047 hasParent = true;
14048 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14049 refParentIB =
ItemBase.Cast(parent);
14050 }
14051 }
14052
14053 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14054 {
14055
14056 }
14057
14059 {
14060
14061 return false;
14062 }
14063
14065 {
14066
14067
14068 return false;
14069 }
14070
14072 {
14073
14074 return false;
14075 }
14076
14079 {
14080 return !GetIsFrozen() &&
IsOpen();
14081 }
14082
14084 {
14085 bool hasParent = false, hasRootAsPlayer = false;
14087
14088 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14089 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14090
14091 if (wwtu || foodDecay)
14092 {
14096
14097 if (processWetness || processTemperature || processDecay)
14098 {
14100
14101 if (processWetness)
14102 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14103
14104 if (processTemperature)
14106
14107 if (processDecay)
14108 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14109 }
14110 }
14111 }
14112
14115 {
14117 }
14118
14120 {
14123
14124 return super.GetTemperatureFreezeThreshold();
14125 }
14126
14128 {
14131
14132 return super.GetTemperatureThawThreshold();
14133 }
14134
14136 {
14139
14140 return super.GetItemOverheatThreshold();
14141 }
14142
14144 {
14146 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14147
14148 return super.GetTemperatureFreezeTime();
14149 }
14150
14152 {
14154 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14155
14156 return super.GetTemperatureThawTime();
14157 }
14158
14163
14165 {
14166 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14167 }
14168
14170 {
14171 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14172 }
14173
14176 {
14178 }
14179
14181 {
14183 }
14184
14186 {
14188 }
14189
14192 {
14193 return null;
14194 }
14195
14198 {
14199 return false;
14200 }
14201
14203 {
14205 {
14208 if (!trg)
14209 {
14211 explosive = this;
14212 }
14213
14214 explosive.PairRemote(trg);
14216
14217 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14218 trg.SetPersistentPairID(persistentID);
14219 explosive.SetPersistentPairID(persistentID);
14220
14221 return true;
14222 }
14223 return false;
14224 }
14225
14228 {
14229 float ret = 1.0;
14232 ret *= GetHealth01();
14233
14234 return ret;
14235 }
14236
14237 #ifdef DEVELOPER
14238 override void SetDebugItem()
14239 {
14240 super.SetDebugItem();
14241 _itemBase = this;
14242 }
14243
14245 {
14246 string text = super.GetDebugText();
14247
14249 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14250
14251 return text;
14252 }
14253 #endif
14254
14256 {
14257 return true;
14258 }
14259
14261
14263
14265 {
14268 }
14269
14270
14278
14294
14295 [
Obsolete(
"Use ItemSoundHandler instead")]
14298 {
14299 if (!
g_Game.IsDedicatedServer())
14300 {
14301 if (ConfigIsExisting("attachSoundSet"))
14302 {
14303 string cfg_path = "";
14304 string soundset = "";
14305 string type_name =
GetType();
14306
14309 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14310 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14311
14312 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14313 {
14314 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14315 {
14316 if (cfg_slot_array[i] == slot_type)
14317 {
14318 soundset = cfg_soundset_array[i];
14319 break;
14320 }
14321 }
14322 }
14323
14324 if (soundset != "")
14325 {
14326 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14328 }
14329 }
14330 }
14331 }
14332
14334}
14335
14337{
14339 if (entity)
14340 {
14341 bool is_item = entity.IsInherited(
ItemBase);
14342 if (is_item && full_quantity)
14343 {
14346 }
14347 }
14348 else
14349 {
14351 return NULL;
14352 }
14353 return entity;
14354}
14355
14357{
14358 if (item)
14359 {
14360 if (health > 0)
14361 item.SetHealth("", "", health);
14362
14363 if (item.CanHaveTemperature())
14364 {
14366 if (item.CanFreeze())
14367 item.SetFrozen(false);
14368 }
14369
14370 if (item.HasEnergyManager())
14371 {
14372 if (quantity >= 0)
14373 {
14374 item.GetCompEM().SetEnergy0To1(quantity);
14375 }
14376 else
14377 {
14379 }
14380 }
14381 else if (item.IsMagazine())
14382 {
14383 Magazine mag = Magazine.Cast(item);
14384 if (quantity >= 0)
14385 {
14386 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14387 }
14388 else
14389 {
14391 }
14392
14393 }
14394 else
14395 {
14396 if (quantity >= 0)
14397 {
14398 item.SetQuantityNormalized(quantity, false);
14399 }
14400 else
14401 {
14403 }
14404
14405 }
14406 }
14407}
14408
14409#ifdef DEVELOPER
14411#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.