9413{
9415 {
9416 return true;
9417 }
9418};
9419
9421{
9422
9423};
9424
9425
9426
9428{
9432
9434
9437
9438
9439
9440
9441
9450
9456
9461
9466
9487 protected bool m_IsResultOfSplit
9488
9490
9495
9496
9497
9499
9503
9504
9505
9507
9510
9511
9512
9518
9519
9527
9530
9531
9533
9534
9536
9537
9542
9543
9548
9550
9551
9553
9554
9556 {
9561
9562 if (!
g_Game.IsDedicatedServer())
9563 {
9565 {
9567
9569 {
9571 }
9572 }
9573
9576 }
9577
9578 m_OldLocation = null;
9579
9581 {
9583 }
9584
9585 if (ConfigIsExisting("headSelectionsToHide"))
9586 {
9589 }
9590
9592 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9593 {
9595 }
9596
9598
9599 m_IsResultOfSplit = false;
9600
9602 }
9603
9605 {
9606 super.InitItemVariables();
9607
9613 m_Count = ConfigGetInt(
"count");
9614
9617
9622
9625
9630
9642
9646
9647
9650 if (ConfigIsExisting("canBeSplit"))
9651 {
9654 }
9655
9657 if (ConfigIsExisting("itemBehaviour"))
9659
9660
9663 RegisterNetSyncVariableInt("m_VarLiquidType");
9664 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9665
9666 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9667 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9668 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9669
9670 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9671 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9672 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9673 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9674
9675 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9676 RegisterNetSyncVariableBool("m_IsTakeable");
9677 RegisterNetSyncVariableBool("m_IsHologram");
9678
9681 {
9684 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9685 }
9686
9688
9690 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9692
9694 }
9695
9697 {
9699 }
9700
9702 {
9705 {
9710 }
9711 }
9712
9713 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9714 {
9716 {
9719 }
9720
9722 }
9723
9725 {
9731 }
9732
9734
9736 {
9738
9739 if (!action)
9740 {
9741 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9742 return;
9743 }
9744
9746 if (!ai)
9747 {
9749 return;
9750 }
9751
9753 if (!action_array)
9754 {
9755 action_array = new array<ActionBase_Basic>;
9757 }
9758 if (LogManager.IsActionLogEnable())
9759 {
9760 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9761 }
9762
9763 if (action_array.Find(action) != -1)
9764 {
9765 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9766 }
9767 else
9768 {
9769 action_array.Insert(action);
9770 }
9771 }
9772
9774 {
9775 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9776 ActionBase action = player.GetActionManager().GetAction(actionName);
9779
9780 if (action_array)
9781 {
9782 action_array.RemoveItem(action);
9783 }
9784 }
9785
9786
9787
9789 {
9790 ActionOverrideData overrideData = new ActionOverrideData();
9794
9796 if (!actionMap)
9797 {
9800 }
9801
9802 actionMap.Insert(this.
Type(), overrideData);
9803
9804 }
9805
9807
9809
9810
9812 {
9815
9818
9819 string config_to_search = "CfgVehicles";
9820 string muzzle_owner_config;
9821
9823 {
9824 if (IsInherited(Weapon))
9825 config_to_search = "CfgWeapons";
9826
9827 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9828
9829 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9830
9831 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9832
9833 if (config_OnFire_subclass_count > 0)
9834 {
9835 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9836
9837 for (int i = 0; i < config_OnFire_subclass_count; i++)
9838 {
9839 string particle_class = "";
9840 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9841 string config_OnFire_entry = config_OnFire_class + particle_class;
9842 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9843 WPOF_array.Insert(WPOF);
9844 }
9845
9846
9848 }
9849 }
9850
9852 {
9853 config_to_search = "CfgWeapons";
9854 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9855
9856 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9857
9858 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9859
9860 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9861 {
9862 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9863
9864 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9865 {
9866 string particle_class2 = "";
9867 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9868 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9869 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9870 WPOBE_array.Insert(WPOBE);
9871 }
9872
9873
9875 }
9876 }
9877 }
9878
9879
9881 {
9884
9886 {
9887 string config_to_search = "CfgVehicles";
9888
9889 if (IsInherited(Weapon))
9890 config_to_search = "CfgWeapons";
9891
9892 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9893 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9894
9895 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9896 {
9897
9899
9901 {
9903 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9905 return;
9906 }
9907
9910
9911
9912
9913 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9914 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9915
9916 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9917 {
9918 string particle_class = "";
9919 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9920 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9921 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9922
9923 if (entry_type == CT_CLASS)
9924 {
9925 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9926 WPOOH_array.Insert(WPOF);
9927 }
9928 }
9929
9930
9932 }
9933 }
9934 }
9935
9937 {
9939 }
9940
9942 {
9944 {
9946
9949
9952
9953 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9954 }
9955 }
9956
9958 {
9960 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9961
9963 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9964
9966 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9967
9969 {
9971 }
9972 }
9973
9975 {
9977 }
9978
9980 {
9983 else
9985
9987 {
9990 }
9991 else
9992 {
9995
9998 }
9999
10001 }
10002
10004 {
10006 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10007 }
10008
10010 {
10012 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10014 }
10015
10017 {
10019 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10020 }
10021
10023 {
10026
10027 OverheatingParticle OP = new OverheatingParticle();
10032
10034 }
10035
10037 {
10040
10041 return -1;
10042 }
10043
10045 {
10047 {
10050
10051 for (int i = count; i > 0; --i)
10052 {
10053 int id = i - 1;
10056
10059
10060 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10061 {
10062 if (p)
10063 {
10066 }
10067 }
10068 }
10069 }
10070 }
10071
10073 {
10075 {
10077 {
10078 int id = i - 1;
10080
10081 if (OP)
10082 {
10084
10085 if (p)
10086 {
10088 }
10089
10090 delete OP;
10091 }
10092 }
10093
10096 }
10097 }
10098
10101 {
10102 return 0.0;
10103 }
10104
10105
10107 {
10108 return 250;
10109 }
10110
10112 {
10113 return 0;
10114 }
10115
10118 {
10120 return true;
10121
10122 return false;
10123 }
10124
10127 {
10130
10132 {
10134 }
10135 else
10136 {
10137
10139 }
10140
10142 }
10143
10150 {
10151 return -1;
10152 }
10153
10154
10155
10156
10158 {
10160 {
10161 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10162 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10163
10164 if (r_index >= 0)
10165 {
10166 InventoryLocation r_il = new InventoryLocation;
10167 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10168
10169 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10172 {
10173 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10174 }
10176 {
10177 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10178 }
10179
10180 }
10181
10182 player.GetHumanInventory().ClearUserReservedLocation(this);
10183 }
10184
10187 }
10188
10189
10190
10191
10193 {
10194 return ItemBase.m_DebugActionsMask;
10195 }
10196
10198 {
10199 return ItemBase.m_DebugActionsMask & mask;
10200 }
10201
10203 {
10204 ItemBase.m_DebugActionsMask = mask;
10205 }
10206
10208 {
10209 ItemBase.m_DebugActionsMask |= mask;
10210 }
10211
10213 {
10214 ItemBase.m_DebugActionsMask &= ~mask;
10215 }
10216
10218 {
10220 {
10222 }
10223 else
10224 {
10226 }
10227 }
10228
10229
10231 {
10232 if (GetEconomyProfile())
10233 {
10234 float q_max = GetEconomyProfile().GetQuantityMax();
10235 if (q_max > 0)
10236 {
10237 float q_min = GetEconomyProfile().GetQuantityMin();
10238 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10239
10241 {
10242 ComponentEnergyManager comp = GetCompEM();
10244 {
10246 }
10247 }
10249 {
10251
10252 }
10253
10254 }
10255 }
10256 }
10257
10260 {
10261 EntityAI parent = GetHierarchyParent();
10262
10263 if (parent)
10264 {
10265 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10266 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10267 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10268 }
10269 }
10270
10273 {
10274 EntityAI parent = GetHierarchyParent();
10275
10276 if (parent)
10277 {
10278 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10279 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10280 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10281 }
10282 }
10283
10285 {
10286
10287
10288
10289
10291
10293 {
10294 if (ScriptInputUserData.CanStoreInputUserData())
10295 {
10296 ScriptInputUserData ctx = new ScriptInputUserData;
10302 ctx.
Write(use_stack_max);
10305
10307 {
10308 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10309 }
10310 }
10311 }
10312 else if (!
g_Game.IsMultiplayer())
10313 {
10315 }
10316 }
10317
10319 {
10321 }
10322
10324 {
10326 }
10327
10329 {
10331 }
10332
10334 {
10335
10336 return false;
10337 }
10338
10340 {
10341 return false;
10342 }
10343
10347 {
10348 return false;
10349 }
10350
10352 {
10353 return "";
10354 }
10355
10357
10359 {
10360 return false;
10361 }
10362
10364 {
10365 return true;
10366 }
10367
10368
10369
10371 {
10372 return true;
10373 }
10374
10376 {
10377 return true;
10378 }
10379
10381 {
10382 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10384 }
10385
10387 {
10389 }
10390
10392 {
10394 if (!is_being_placed)
10396 SetSynchDirty();
10397 }
10398
10399
10401
10403 {
10405 }
10406
10408 {
10410 }
10411
10413 {
10414 return 1;
10415 }
10416
10418 {
10419 return false;
10420 }
10421
10423 {
10425 SetSynchDirty();
10426 }
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10463 {
10464 super.OnMovedInsideCargo(container);
10465
10466 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10467 }
10468
10469 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10470 {
10471 super.EEItemLocationChanged(oldLoc, newLoc);
10472
10473 PlayerBase newPlayer = null;
10474 PlayerBase oldPlayer = null;
10475
10476 if (newLoc.GetParent())
10477 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10478
10479 if (oldLoc.GetParent())
10480 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10481
10483 {
10484 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10485
10486 if (rIndex >= 0)
10487 {
10488 InventoryLocation rIl = new InventoryLocation;
10489 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10490
10491 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10494 {
10495 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10496 }
10498 {
10500 }
10501
10502 }
10503 }
10504
10506 {
10507 if (newPlayer)
10508 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10509
10510 if (newPlayer == oldPlayer)
10511 {
10512 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10513 {
10515 {
10516 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10517 {
10518 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10519 }
10520 }
10521 else
10522 {
10523 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10524 }
10525 }
10526
10527 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10528 {
10529 int type = oldLoc.GetType();
10531 {
10532 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10533 }
10535 {
10536 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10537 }
10538 }
10539 if (!m_OldLocation)
10540 {
10541 m_OldLocation = new InventoryLocation;
10542 }
10543 m_OldLocation.Copy(oldLoc);
10544 }
10545 else
10546 {
10547 if (m_OldLocation)
10548 {
10549 m_OldLocation.Reset();
10550 }
10551 }
10552
10553 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10554 }
10555 else
10556 {
10557 if (newPlayer)
10558 {
10559 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10560 if (resIndex >= 0)
10561 {
10562 InventoryLocation il = new InventoryLocation;
10563 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10565 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10568 {
10569 il.
GetParent().GetOnReleaseLock().Invoke(it);
10570 }
10572 {
10574 }
10575
10576 }
10577 }
10579 {
10580
10582 }
10583
10584 if (m_OldLocation)
10585 {
10586 m_OldLocation.Reset();
10587 }
10588 }
10589
10591 {
10592 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10593 }
10594
10596 {
10597 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10598 }
10599 }
10600
10601 override void EOnContact(IEntity other, Contact extra)
10602 {
10604 {
10605 int liquidType = -1;
10607 if (impactSpeed > 0.0)
10608 {
10610 #ifndef SERVER
10612 #else
10614 SetSynchDirty();
10615 #endif
10617 }
10618 }
10619
10620 #ifdef SERVER
10621 if (GetCompEM() && GetCompEM().IsPlugged())
10622 {
10623 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10624 GetCompEM().UnplugThis();
10625 }
10626 #endif
10627 }
10628
10630
10632 {
10634 }
10635
10637 {
10638
10639 }
10640
10642 {
10643 super.OnItemLocationChanged(old_owner, new_owner);
10644
10645 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10646 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10647
10648 if (!relatedPlayer && playerNew)
10649 relatedPlayer = playerNew;
10650
10651 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10652 {
10654 if (actionMgr)
10655 {
10656 ActionBase currentAction = actionMgr.GetRunningAction();
10657 if (currentAction)
10659 }
10660 }
10661
10662 Man ownerPlayerOld = null;
10663 Man ownerPlayerNew = null;
10664
10665 if (old_owner)
10666 {
10667 if (old_owner.
IsMan())
10668 {
10669 ownerPlayerOld = Man.Cast(old_owner);
10670 }
10671 else
10672 {
10673 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10674 }
10675 }
10676 else
10677 {
10679 {
10681
10682 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10683 {
10684 GetCompEM().UnplugThis();
10685 }
10686 }
10687 }
10688
10689 if (new_owner)
10690 {
10691 if (new_owner.
IsMan())
10692 {
10693 ownerPlayerNew = Man.Cast(new_owner);
10694 }
10695 else
10696 {
10697 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10698 }
10699 }
10700
10701 if (ownerPlayerOld != ownerPlayerNew)
10702 {
10703 if (ownerPlayerOld)
10704 {
10705 array<EntityAI> subItemsExit = new array<EntityAI>;
10707 for (int i = 0; i < subItemsExit.Count(); i++)
10708 {
10711 }
10712 }
10713
10714 if (ownerPlayerNew)
10715 {
10716 array<EntityAI> subItemsEnter = new array<EntityAI>;
10718 for (int j = 0; j < subItemsEnter.Count(); j++)
10719 {
10722 }
10723 }
10724 }
10725 else if (ownerPlayerNew != null)
10726 {
10727 PlayerBase nplayer;
10728 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10729 {
10730 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10732 for (int k = 0; k < subItemsUpdate.Count(); k++)
10733 {
10735 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10736 }
10737 }
10738 }
10739
10740 if (old_owner)
10741 old_owner.OnChildItemRemoved(this);
10742 if (new_owner)
10743 new_owner.OnChildItemReceived(this);
10744 }
10745
10746
10748 {
10749 super.EEDelete(parent);
10750 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10751 if (player)
10752 {
10754
10755 if (player.IsAlive())
10756 {
10757 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10758 if (r_index >= 0)
10759 {
10760 InventoryLocation r_il = new InventoryLocation;
10761 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10762
10763 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10766 {
10767 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10768 }
10770 {
10771 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10772 }
10773
10774 }
10775
10776 player.RemoveQuickBarEntityShortcut(this);
10777 }
10778 }
10779 }
10780
10782 {
10783 super.EEKilled(killer);
10784
10787 {
10788 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10789 {
10790 if (IsMagazine())
10791 {
10792 if (Magazine.Cast(this).GetAmmoCount() > 0)
10793 {
10795 }
10796 }
10797 else
10798 {
10800 }
10801 }
10802 }
10803 }
10804
10806 {
10807 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10808
10809 super.OnWasAttached(parent, slot_id);
10810
10813
10816 }
10817
10819 {
10820 super.OnWasDetached(parent, slot_id);
10821
10824
10827 }
10828
10830 {
10831 int idx;
10834
10835 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10836 if (inventory_slots.Count() < 1)
10837 {
10838 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10839 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10840 }
10841 else
10842 {
10843 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10844 }
10845
10846 idx = inventory_slots.Find(slot);
10847 if (idx < 0)
10848 return "";
10849
10850 return attach_types.Get(idx);
10851 }
10852
10854 {
10855 int idx = -1;
10856 string slot;
10857
10860
10861 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10862 if (inventory_slots.Count() < 1)
10863 {
10864 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10865 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10866 }
10867 else
10868 {
10869 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10870 if (detach_types.Count() < 1)
10871 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10872 }
10873
10874 for (int i = 0; i < inventory_slots.Count(); i++)
10875 {
10876 slot = inventory_slots.Get(i);
10877 }
10878
10879 if (slot != "")
10880 {
10881 if (detach_types.Count() == 1)
10882 idx = 0;
10883 else
10884 idx = inventory_slots.Find(slot);
10885 }
10886 if (idx < 0)
10887 return "";
10888
10889 return detach_types.Get(idx);
10890 }
10891
10893 {
10894
10896
10897
10898 float min_time = 1;
10899 float max_time = 3;
10900 float delay = Math.RandomFloat(min_time, max_time);
10901
10902 explode_timer.Run(delay, this, "DoAmmoExplosion");
10903 }
10904
10906 {
10907 Magazine magazine = Magazine.Cast(this);
10908 int pop_sounds_count = 6;
10909 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10910
10911
10912 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10913 string sound_name = pop_sounds[ sound_idx ];
10914 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10915
10916
10917 magazine.ServerAddAmmoCount(-1);
10918
10919
10920 float min_temp_to_explode = 100;
10921
10922 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10923 {
10925 }
10926 }
10927
10928
10929 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10930 {
10931 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10932
10933 const int CHANCE_DAMAGE_CARGO = 4;
10934 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10935 const int CHANCE_DAMAGE_NOTHING = 2;
10936
10938 {
10939 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10940 int chances;
10941 int rnd;
10942
10943 if (GetInventory().GetCargo())
10944 {
10945 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10946 rnd = Math.RandomInt(0,chances);
10947
10948 if (rnd < CHANCE_DAMAGE_CARGO)
10949 {
10951 }
10952 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10953 {
10955 }
10956 }
10957 else
10958 {
10959 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10960 rnd = Math.RandomInt(0,chances);
10961
10962 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10963 {
10965 }
10966 }
10967 }
10968 }
10969
10971 {
10972 CargoBase cargo = GetInventory().GetCargo();
10973 if (cargo)
10974 {
10976 if (item_count > 0)
10977 {
10978 int random_pick = Math.RandomInt(0, item_count);
10980 if (!item.IsExplosive())
10981 {
10982 item.AddHealth("","",damage);
10983 return true;
10984 }
10985 }
10986 }
10987 return false;
10988 }
10989
10991 {
10992 GameInventory inventory = GetInventory();
10994 if (attachment_count > 0)
10995 {
10996 int random_pick = Math.RandomInt(0, attachment_count);
10998 if (!attachment.IsExplosive())
10999 {
11000 attachment.AddHealth("","",damage);
11001 return true;
11002 }
11003 }
11004 return false;
11005 }
11006
11008 {
11010 }
11011
11013 {
11015 return GetInventory().CanRemoveEntity();
11016
11017 return false;
11018 }
11019
11021 {
11022
11024 return false;
11025
11026
11028 return false;
11029
11030
11031
11033 if (delta == 0)
11034 return false;
11035
11036
11037 return true;
11038 }
11039
11041 {
11043 {
11044 if (ScriptInputUserData.CanStoreInputUserData())
11045 {
11046 ScriptInputUserData ctx = new ScriptInputUserData;
11051 ctx.
Write(destination_entity);
11053 ctx.
Write(slot_id);
11055 }
11056 }
11057 else if (!
g_Game.IsMultiplayer())
11058 {
11060 }
11061 }
11062
11064 {
11065 float split_quantity_new;
11069 InventoryLocation loc = new InventoryLocation;
11070
11071 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11072 {
11074 split_quantity_new = stack_max;
11075 else
11077
11079 {
11080 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11081 if (new_item)
11082 {
11083 new_item.SetResultOfSplit(true);
11084 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11086 new_item.
SetQuantity(split_quantity_new,
false,
true);
11087 }
11088 }
11089 }
11090 else if (destination_entity && slot_id == -1)
11091 {
11092 if (quantity > stack_max)
11093 split_quantity_new = stack_max;
11094 else
11095 split_quantity_new = quantity;
11096
11098 {
11099 GameInventory destinationInventory = destination_entity.GetInventory();
11101 {
11104 }
11105
11106 if (new_item)
11107 {
11108 new_item.SetResultOfSplit(true);
11109 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11111 new_item.
SetQuantity(split_quantity_new,
false,
true);
11112 }
11113 }
11114 }
11115 else
11116 {
11117 if (stack_max != 0)
11118 {
11120 {
11122 }
11123
11124 if (split_quantity_new == 0)
11125 {
11126 if (!
g_Game.IsMultiplayer())
11127 player.PhysicalPredictiveDropItem(this);
11128 else
11129 player.ServerDropEntity(this);
11130 return;
11131 }
11132
11134 {
11136
11137 if (new_item)
11138 {
11139 new_item.SetResultOfSplit(true);
11140 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11143 new_item.PlaceOnSurface();
11144 }
11145 }
11146 }
11147 }
11148 }
11149
11151 {
11152 float split_quantity_new;
11156 InventoryLocation loc = new InventoryLocation;
11157
11158 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11159 {
11161 split_quantity_new = stack_max;
11162 else
11164
11166 {
11167 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11168 if (new_item)
11169 {
11170 new_item.SetResultOfSplit(true);
11171 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11173 new_item.
SetQuantity(split_quantity_new,
false,
true);
11174 }
11175 }
11176 }
11177 else if (destination_entity && slot_id == -1)
11178 {
11179 if (quantity > stack_max)
11180 split_quantity_new = stack_max;
11181 else
11182 split_quantity_new = quantity;
11183
11185 {
11186 GameInventory destinationInventory = destination_entity.GetInventory();
11188 {
11191 }
11192
11193 if (new_item)
11194 {
11195 new_item.SetResultOfSplit(true);
11196 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11198 new_item.
SetQuantity(split_quantity_new,
false,
true);
11199 }
11200 }
11201 }
11202 else
11203 {
11204 if (stack_max != 0)
11205 {
11207 {
11209 }
11210
11212 {
11214
11215 if (new_item)
11216 {
11217 new_item.SetResultOfSplit(true);
11218 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11221 new_item.PlaceOnSurface();
11222 }
11223 }
11224 }
11225 }
11226 }
11227
11229 {
11231 {
11232 if (ScriptInputUserData.CanStoreInputUserData())
11233 {
11234 ScriptInputUserData ctx = new ScriptInputUserData;
11239 dst.WriteToContext(ctx);
11241 }
11242 }
11243 else if (!
g_Game.IsMultiplayer())
11244 {
11246 }
11247 }
11248
11250 {
11252 {
11253 if (ScriptInputUserData.CanStoreInputUserData())
11254 {
11255 ScriptInputUserData ctx = new ScriptInputUserData;
11260 ctx.
Write(destination_entity);
11266 }
11267 }
11268 else if (!
g_Game.IsMultiplayer())
11269 {
11271 }
11272 }
11273
11275 {
11277 }
11278
11280 {
11282 float split_quantity_new;
11284 if (dst.IsValid())
11285 {
11286 int slot_id = dst.GetSlot();
11288
11289 if (quantity > stack_max)
11290 split_quantity_new = stack_max;
11291 else
11292 split_quantity_new = quantity;
11293
11295 {
11297
11298 if (new_item)
11299 {
11300 new_item.SetResultOfSplit(true);
11301 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11303 new_item.
SetQuantity(split_quantity_new,
false,
true);
11304 }
11305
11306 return new_item;
11307 }
11308 }
11309
11310 return null;
11311 }
11312
11314 {
11316 float split_quantity_new;
11318 if (destination_entity)
11319 {
11321 if (quantity > stackable)
11322 split_quantity_new = stackable;
11323 else
11324 split_quantity_new = quantity;
11325
11327 {
11328 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11329 if (new_item)
11330 {
11331 new_item.SetResultOfSplit(true);
11332 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11334 new_item.
SetQuantity(split_quantity_new,
false,
true);
11335 }
11336 }
11337 }
11338 }
11339
11341 {
11343 {
11344 if (ScriptInputUserData.CanStoreInputUserData())
11345 {
11346 ScriptInputUserData ctx = new ScriptInputUserData;
11351 ItemBase destination_entity =
this;
11352 ctx.
Write(destination_entity);
11356 }
11357 }
11358 else if (!
g_Game.IsMultiplayer())
11359 {
11361 }
11362 }
11363
11365 {
11367 float split_quantity_new;
11369 if (player)
11370 {
11372 if (quantity > stackable)
11373 split_quantity_new = stackable;
11374 else
11375 split_quantity_new = quantity;
11376
11378 {
11379 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11380 new_item =
ItemBase.Cast(in_hands);
11381 if (new_item)
11382 {
11383 new_item.SetResultOfSplit(true);
11384 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11386 new_item.SetQuantity(split_quantity_new, false, true);
11387 }
11388 }
11389 }
11390 }
11391
11393 {
11395 float split_quantity_new = Math.Floor(quantity * 0.5);
11396
11398 return;
11399
11401
11402 if (new_item)
11403 {
11404 if (new_item.GetQuantityMax() < split_quantity_new)
11405 {
11406 split_quantity_new = new_item.GetQuantityMax();
11407 }
11408
11409 new_item.SetResultOfSplit(true);
11410 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11411
11413 {
11416 }
11417 else
11418 {
11420 new_item.
SetQuantity(split_quantity_new,
false,
true);
11421 }
11422 }
11423 }
11424
11426 {
11428 float split_quantity_new = Math.Floor(quantity / 2);
11429
11431 return;
11432
11433 InventoryLocation invloc = new InventoryLocation;
11435
11437 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11438
11439 if (new_item)
11440 {
11441 if (new_item.GetQuantityMax() < split_quantity_new)
11442 {
11443 split_quantity_new = new_item.GetQuantityMax();
11444 }
11446 {
11449 }
11450 else if (split_quantity_new > 1)
11451 {
11453 new_item.
SetQuantity(split_quantity_new,
false,
true);
11454 }
11455 }
11456 }
11457
11460 {
11461 SetWeightDirty();
11463
11464 if (parent)
11465 parent.OnAttachmentQuantityChangedEx(this, delta);
11466
11468 {
11470 {
11472 }
11474 {
11475 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11477 }
11478 }
11479 }
11480
11483 {
11484
11485 }
11486
11489 {
11491 }
11492
11494 {
11495 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11496
11498 {
11499 if (newLevel == GameConstants.STATE_RUINED)
11500 {
11502 EntityAI parent = GetHierarchyParent();
11503 if (parent && parent.IsFireplace())
11504 {
11505 CargoBase cargo = GetInventory().GetCargo();
11506 if (cargo)
11507 {
11509 {
11511 }
11512 }
11513 }
11514 }
11515
11517 {
11518
11520 return;
11521 }
11522
11523 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11524 {
11526 }
11527 }
11528 }
11529
11530
11532 {
11533 super.OnRightClick();
11534
11536 {
11538 {
11539 if (ScriptInputUserData.CanStoreInputUserData())
11540 {
11541 EntityAI root = GetHierarchyRoot();
11542 Man playerOwner = GetHierarchyRootPlayer();
11543 InventoryLocation dst = new InventoryLocation;
11544
11545
11546 if (!playerOwner && root && root == this)
11547 {
11549 }
11550 else
11551 {
11552
11553 GetInventory().GetCurrentInventoryLocation(dst);
11555 {
11556 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11558 {
11560 }
11561 else
11562 {
11564
11565
11566 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11567 {
11569 }
11570 else
11571 {
11572 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11573 }
11574 }
11575 }
11576 }
11577
11578 ScriptInputUserData ctx = new ScriptInputUserData;
11586 }
11587 }
11588 else if (!
g_Game.IsMultiplayer())
11589 {
11591 }
11592 }
11593 }
11594
11596 {
11597 if (root)
11598 {
11599 vector m4[4];
11600 root.GetTransform(m4);
11601 dst.SetGround(this, m4);
11602 }
11603 else
11604 {
11605 GetInventory().GetCurrentInventoryLocation(dst);
11606 }
11607 }
11608
11609 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11610 {
11611
11612 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11613 return false;
11614
11615 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11616 return false;
11617
11618
11620 return false;
11621
11622
11623 Magazine mag = Magazine.Cast(this);
11624 if (mag)
11625 {
11626 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11627 return false;
11628
11629 if (stack_max_limit)
11630 {
11631 Magazine other_mag = Magazine.Cast(other_item);
11632 if (other_item)
11633 {
11634 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11635 return false;
11636 }
11637
11638 }
11639 }
11640 else
11641 {
11642
11644 return false;
11645
11647 return false;
11648 }
11649
11650 PlayerBase player = null;
11651 if (CastTo(player, GetHierarchyRootPlayer()))
11652 {
11653 if (player.GetInventory().HasAttachment(this))
11654 return false;
11655
11656 if (player.IsItemsToDelete())
11657 return false;
11658 }
11659
11660 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11661 return false;
11662
11663 int slotID;
11665 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11666 return false;
11667
11668 return true;
11669 }
11670
11672 {
11674 }
11675
11677 {
11678 return m_IsResultOfSplit;
11679 }
11680
11682 {
11683 m_IsResultOfSplit = value;
11684 }
11685
11687 {
11689 }
11690
11692 {
11693 float other_item_quantity = other_item.GetQuantity();
11694 float this_free_space;
11695
11697
11699
11700 if (other_item_quantity > this_free_space)
11701 {
11702 return this_free_space;
11703 }
11704 else
11705 {
11706 return other_item_quantity;
11707 }
11708 }
11709
11711 {
11713 }
11714
11716 {
11718 return;
11719
11720 if (!IsMagazine() && other_item)
11721 {
11723 if (quantity_used != 0)
11724 {
11725 float hp1 = GetHealth01("","");
11726 float hp2 = other_item.GetHealth01("","");
11727 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11728 hpResult = hpResult / (
GetQuantity() + quantity_used);
11729
11730 hpResult *= GetMaxHealth();
11731 Math.Round(hpResult);
11732 SetHealth("", "Health", hpResult);
11733
11735 other_item.AddQuantity(-quantity_used);
11736 }
11737 }
11739 }
11740
11742 {
11743 #ifdef SERVER
11744 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11745 GetHierarchyParent().IncreaseLifetimeUp();
11746 #endif
11747 };
11748
11750 {
11751 PlayerBase p = PlayerBase.Cast(player);
11752
11753 array<int> recipesIds = p.m_Recipes;
11754 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11755 if (moduleRecipesManager)
11756 {
11757 EntityAI itemInHands = player.GetEntityInHands();
11758 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11759 }
11760
11761 for (int i = 0;i < recipesIds.Count(); i++)
11762 {
11763 int key = recipesIds.Get(i);
11764 string recipeName = moduleRecipesManager.GetRecipeName(key);
11766 }
11767 }
11768
11769
11770 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11771 {
11772 super.GetDebugActions(outputList);
11773
11774
11780
11781
11786
11791
11792
11796
11797
11799 {
11803 }
11804
11807
11808
11812
11814
11815 InventoryLocation loc = new InventoryLocation();
11816 GetInventory().GetCurrentInventoryLocation(loc);
11818 {
11819 if (Gizmo_IsSupported())
11822 }
11823
11825 }
11826
11827
11828
11829
11831 {
11832 super.OnAction(action_id, player, ctx);
11833
11835 {
11836 switch (action_id)
11837 {
11841 return true;
11845 return true;
11846 }
11847 }
11848
11850 {
11851 switch (action_id)
11852 {
11854 Delete();
11855 return true;
11856 }
11857 }
11858
11859 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11860 {
11861 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11862 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11863 PlayerBase p = PlayerBase.Cast(player);
11864 if (
EActions.RECIPES_RANGE_START < 1000)
11865 {
11866 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11867 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11868 }
11869 }
11870 #ifndef SERVER
11871 else if (action_id ==
EActions.WATCH_PLAYER)
11872 {
11873 PluginDeveloper.SetDeveloperItemClientEx(player);
11874 }
11875 #endif
11877 {
11878 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11879 {
11880 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11881 OnDebugButtonPressServer(id + 1);
11882 }
11883
11884 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11885 {
11886 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11888 }
11889
11890 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11891 {
11892 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11894 }
11895
11896 else if (action_id ==
EActions.ADD_QUANTITY)
11897 {
11898 if (IsMagazine())
11899 {
11900 Magazine mag = Magazine.Cast(this);
11901 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11902 }
11903 else
11904 {
11906 }
11907
11908 if (m_EM)
11909 {
11910 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11911 }
11912
11913 }
11914
11915 else if (action_id ==
EActions.REMOVE_QUANTITY)
11916 {
11917 if (IsMagazine())
11918 {
11919 Magazine mag2 = Magazine.Cast(this);
11920 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11921 }
11922 else
11923 {
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.SET_QUANTITY_0)
11934 {
11936
11937 if (m_EM)
11938 {
11939 m_EM.SetEnergy(0);
11940 }
11941 }
11942
11943 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11944 {
11946
11947 if (m_EM)
11948 {
11949 m_EM.SetEnergy(m_EM.GetEnergyMax());
11950 }
11951 }
11952
11953 else if (action_id ==
EActions.ADD_HEALTH)
11954 {
11955 AddHealth("","",GetMaxHealth("","Health")/5);
11956 }
11957 else if (action_id ==
EActions.REMOVE_HEALTH)
11958 {
11959 AddHealth("","",-GetMaxHealth("","Health")/5);
11960 }
11961 else if (action_id ==
EActions.DESTROY_HEALTH)
11962 {
11963 SetHealth01("","",0);
11964 }
11965 else if (action_id ==
EActions.WATCH_ITEM)
11966 {
11968 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11969 #ifdef DEVELOPER
11970 SetDebugDeveloper_item(this);
11971 #endif
11972 }
11973
11974 else if (action_id ==
EActions.ADD_TEMPERATURE)
11975 {
11976 AddTemperature(20);
11977
11978 }
11979
11980 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11981 {
11982 AddTemperature(-20);
11983
11984 }
11985
11986 else if (action_id ==
EActions.FLIP_FROZEN)
11987 {
11988 SetFrozen(!GetIsFrozen());
11989
11990 }
11991
11992 else if (action_id ==
EActions.ADD_WETNESS)
11993 {
11995
11996 }
11997
11998 else if (action_id ==
EActions.REMOVE_WETNESS)
11999 {
12001
12002 }
12003
12004 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12005 {
12008
12009
12010 }
12011
12012 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12013 {
12016 }
12017
12018 else if (action_id ==
EActions.MAKE_SPECIAL)
12019 {
12020 auto debugParams = DebugSpawnParams.WithPlayer(player);
12021 OnDebugSpawnEx(debugParams);
12022 }
12023
12024 }
12025
12026
12027 return false;
12028 }
12029
12030
12031
12032
12036
12039
12040
12041
12043 {
12044 return false;
12045 }
12046
12047
12049 {
12050 return true;
12051 }
12052
12053
12055 {
12056 return true;
12057 }
12058
12059
12060
12062 {
12063 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12064 return g_Game.ConfigIsExisting(config_path);
12065 }
12066
12069 {
12070 return null;
12071 }
12072
12074 {
12075 return false;
12076 }
12077
12079 {
12080 return false;
12081 }
12082
12086
12087
12089 {
12090 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12091 return module_repairing.CanRepair(this, item_repair_kit);
12092 }
12093
12094
12095 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12096 {
12097 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12098 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12099 }
12100
12101
12103 {
12104
12105
12106
12107
12108
12109
12110
12111
12112 return 1;
12113 }
12114
12115
12116
12118 {
12120 }
12121
12122
12123
12125 {
12127 }
12128
12129
12138 {
12139 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12140
12141 if (player)
12142 {
12143 player.MessageStatus(text);
12144 }
12145 }
12146
12147
12156 {
12157 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12158
12159 if (player)
12160 {
12161 player.MessageAction(text);
12162 }
12163 }
12164
12165
12174 {
12175 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12176
12177 if (player)
12178 {
12179 player.MessageFriendly(text);
12180 }
12181 }
12182
12183
12192 {
12193 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12194
12195 if (player)
12196 {
12197 player.MessageImportant(text);
12198 }
12199 }
12200
12202 {
12203 return true;
12204 }
12205
12206
12207 override bool KindOf(
string tag)
12208 {
12209 bool found = false;
12210 string item_name = this.
GetType();
12212 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12213
12214 int array_size = item_tag_array.Count();
12215 for (int i = 0; i < array_size; i++)
12216 {
12217 if (item_tag_array.Get(i) == tag)
12218 {
12219 found = true;
12220 break;
12221 }
12222 }
12223 return found;
12224 }
12225
12226
12228 {
12229
12230 super.OnRPC(sender, rpc_type,ctx);
12231
12232
12233 switch (rpc_type)
12234 {
12235 #ifndef SERVER
12236 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12237 Param2<bool, string> p = new Param2<bool, string>(false, "");
12238
12240 return;
12241
12242 bool play = p.param1;
12243 string soundSet = p.param2;
12244
12245 if (play)
12246 {
12248 {
12250 {
12252 }
12253 }
12254 else
12255 {
12257 }
12258 }
12259 else
12260 {
12262 }
12263
12264 break;
12265 #endif
12266
12267 }
12268
12270 {
12272 }
12273 }
12274
12275
12276
12277
12279 {
12280 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12281 return plugin.GetID(
name);
12282 }
12283
12285 {
12286 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12287 return plugin.GetName(id);
12288 }
12289
12292 {
12293
12294
12295 int varFlags;
12296 if (!ctx.
Read(varFlags))
12297 return;
12298
12299 if (varFlags & ItemVariableFlags.FLOAT)
12300 {
12302 }
12303 }
12304
12306 {
12307
12308 super.SerializeNumericalVars(floats_out);
12309
12310
12311
12313 {
12315 }
12316
12318 {
12320 }
12321
12323 {
12325 }
12326
12328 {
12333 }
12334
12336 {
12338 }
12339 }
12340
12342 {
12343
12344 super.DeSerializeNumericalVars(floats);
12345
12346
12347 int index = 0;
12348 int mask = Math.Round(floats.Get(index));
12349
12350 index++;
12351
12353 {
12355 {
12357 }
12358 else
12359 {
12360 float quantity = floats.Get(index);
12361 SetQuantity(quantity,
true,
false,
false,
false);
12362 }
12363 index++;
12364 }
12365
12367 {
12368 float wet = floats.Get(index);
12370 index++;
12371 }
12372
12374 {
12375 int liquidtype = Math.Round(floats.Get(index));
12377 index++;
12378 }
12379
12381 {
12383 index++;
12385 index++;
12387 index++;
12389 index++;
12390 }
12391
12393 {
12394 int cleanness = Math.Round(floats.Get(index));
12396 index++;
12397 }
12398 }
12399
12401 {
12402 super.WriteVarsToCTX(ctx);
12403
12404
12406 {
12408 }
12409
12411 {
12413 }
12414
12416 {
12418 }
12419
12421 {
12422 int r,g,b,a;
12428 }
12429
12431 {
12433 }
12434 }
12435
12437 {
12438 if (!super.ReadVarsFromCTX(ctx,version))
12439 return false;
12440
12441 int intValue;
12442 float value;
12443
12444 if (version < 140)
12445 {
12446 if (!ctx.
Read(intValue))
12447 return false;
12448
12449 m_VariablesMask = intValue;
12450 }
12451
12453 {
12454 if (!ctx.
Read(value))
12455 return false;
12456
12458 {
12460 }
12461 else
12462 {
12464 }
12465 }
12466
12467 if (version < 140)
12468 {
12470 {
12471 if (!ctx.
Read(value))
12472 return false;
12473 SetTemperatureDirect(value);
12474 }
12475 }
12476
12478 {
12479 if (!ctx.
Read(value))
12480 return false;
12482 }
12483
12485 {
12486 if (!ctx.
Read(intValue))
12487 return false;
12489 }
12490
12492 {
12493 int r,g,b,a;
12495 return false;
12497 return false;
12499 return false;
12501 return false;
12502
12504 }
12505
12507 {
12508 if (!ctx.
Read(intValue))
12509 return false;
12511 }
12512
12513 if (version >= 138 && version < 140)
12514 {
12516 {
12517 if (!ctx.
Read(intValue))
12518 return false;
12519 SetFrozen(intValue);
12520 }
12521 }
12522
12523 return true;
12524 }
12525
12526
12528 {
12531 {
12533 }
12534
12535 if (!super.OnStoreLoad(ctx, version))
12536 {
12538 return false;
12539 }
12540
12541 if (version >= 114)
12542 {
12543 bool hasQuickBarIndexSaved;
12544
12545 if (!ctx.
Read(hasQuickBarIndexSaved))
12546 {
12548 return false;
12549 }
12550
12551 if (hasQuickBarIndexSaved)
12552 {
12553 int itmQBIndex;
12554
12555
12556 if (!ctx.
Read(itmQBIndex))
12557 {
12559 return false;
12560 }
12561
12562 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12563 if (itmQBIndex != -1 && parentPlayer)
12564 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12565 }
12566 }
12567 else
12568 {
12569
12570 PlayerBase player;
12571 int itemQBIndex;
12572 if (version ==
int.
MAX)
12573 {
12574 if (!ctx.
Read(itemQBIndex))
12575 {
12577 return false;
12578 }
12579 }
12580 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12581 {
12582
12583 if (!ctx.
Read(itemQBIndex))
12584 {
12586 return false;
12587 }
12588 if (itemQBIndex != -1 && player)
12589 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12590 }
12591 }
12592
12593 if (version < 140)
12594 {
12595
12596 if (!LoadVariables(ctx, version))
12597 {
12599 return false;
12600 }
12601 }
12602
12603
12605 {
12607 return false;
12608 }
12609 if (version >= 132)
12610 {
12612 if (raib)
12613 {
12615 {
12617 return false;
12618 }
12619 }
12620 }
12621
12623 return true;
12624 }
12625
12626
12627
12629 {
12630 super.OnStoreSave(ctx);
12631
12632 PlayerBase player;
12633 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12634 {
12636
12637 int itemQBIndex = -1;
12638 itemQBIndex = player.FindQuickBarEntityIndex(this);
12639 ctx.
Write(itemQBIndex);
12640 }
12641 else
12642 {
12644 }
12645
12647
12649 if (raib)
12650 {
12652 }
12653 }
12654
12655
12657 {
12658 super.AfterStoreLoad();
12659
12661 {
12663 }
12664
12666 {
12669 }
12670 }
12671
12673 {
12674 super.EEOnAfterLoad();
12675
12677 {
12679 }
12680
12683 }
12684
12686 {
12687 return false;
12688 }
12689
12690
12691
12693 {
12695 {
12696 #ifdef PLATFORM_CONSOLE
12697
12699 {
12701 if (menu)
12702 {
12704 }
12705 }
12706 #endif
12707 }
12708
12710 {
12713 }
12714
12716 {
12717 SetWeightDirty();
12719 }
12721 {
12724 }
12725
12727 {
12730
12733 }
12735 {
12739 }
12740
12741 super.OnVariablesSynchronized();
12742 }
12743
12744
12745
12747 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12748 {
12749 if (!IsServerCheck(allow_client))
12750 return false;
12751
12753 return false;
12754
12757
12758 if (value <= (min + 0.001))
12759 value = min;
12760
12761 if (value == min)
12762 {
12763 if (destroy_config)
12764 {
12765 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12766 if (dstr)
12767 {
12769 this.Delete();
12770 return true;
12771 }
12772 }
12773 else if (destroy_forced)
12774 {
12776 this.Delete();
12777 return true;
12778 }
12779
12781 }
12782
12785
12787 {
12788 EntityAI parent = GetHierarchyRoot();
12789 InventoryLocation iLoc = new InventoryLocation();
12790 GetInventory().GetCurrentInventoryLocation(iLoc);
12792 {
12793 int iLocSlot = iLoc.
GetSlot();
12795 {
12797 }
12799 {
12801 }
12802 }
12803 }
12804
12806 {
12808
12809 if (delta)
12811 }
12812
12814
12815 return false;
12816 }
12817
12818
12820 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12821 {
12823 }
12824
12826 {
12829 }
12830
12832 {
12835 }
12836
12838 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12839 {
12840 float value_clamped = Math.Clamp(value, 0, 1);
12842 SetQuantity(result, destroy_config, destroy_forced);
12843 }
12844
12845
12848 {
12850 }
12851
12853 {
12855 }
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12867 {
12868 int slot = -1;
12869 GameInventory inventory = GetInventory();
12870 if (inventory)
12871 {
12872 InventoryLocation il = new InventoryLocation;
12875 }
12876
12878 }
12879
12881 {
12882 float quantity_max = 0;
12883
12885 {
12886 if (attSlotID != -1)
12887 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12888
12889 if (quantity_max <= 0)
12891 }
12892
12893 if (quantity_max <= 0)
12895
12896 return quantity_max;
12897 }
12898
12900 {
12902 }
12903
12905 {
12907 }
12908
12909
12911 {
12913 }
12914
12916 {
12918 }
12919
12921 {
12923 }
12924
12925
12927 {
12928
12929 float weightEx = GetWeightEx();
12930 float special = GetInventoryAndCargoWeight();
12931 return weightEx - special;
12932 }
12933
12934
12936 {
12938 }
12939
12941 {
12943 {
12944 #ifdef DEVELOPER
12945 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12946 {
12947 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12949 }
12950 #endif
12951
12952 return GetQuantity() * GetConfigWeightModified();
12953 }
12954 else if (HasEnergyManager())
12955 {
12956 #ifdef DEVELOPER
12957 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12958 {
12959 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12960 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12961 }
12962 #endif
12963 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12964 }
12965 else
12966 {
12967 #ifdef DEVELOPER
12968 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12969 {
12970 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12971 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12972 }
12973 #endif
12974 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12975 }
12976 }
12977
12980 {
12981 int item_count = 0;
12983
12984 GameInventory inventory = GetInventory();
12985 CargoBase cargo = inventory.
GetCargo();
12986 if (cargo != NULL)
12987 {
12989 }
12990
12992 for (int i = 0; i < nAttachments; ++i)
12993 {
12995 if (item)
12996 item_count += item.GetNumberOfItems();
12997 }
12998 return item_count;
12999 }
13000
13003 {
13004 float weight = 0;
13005 float wetness = 1;
13006 if (include_wetness)
13009 {
13010 weight = wetness * m_ConfigWeight;
13011 }
13013 {
13014 weight = 1;
13015 }
13016 return weight;
13017 }
13018
13019
13020
13022 {
13023 GameInventory inventory = GetInventory();
13024 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13025 {
13026 array<EntityAI> items = new array<EntityAI>;
13028 for (int i = 0; i < items.Count(); ++i)
13029 {
13031 if (item)
13032 {
13033 g_Game.ObjectDelete(item);
13034 }
13035 }
13036 }
13037 }
13038
13039
13040
13041
13043 {
13044 float energy = 0;
13045 if (HasEnergyManager())
13046 {
13047 energy = GetCompEM().GetEnergy();
13048 }
13049 return energy;
13050 }
13051
13052
13054 {
13055 super.OnEnergyConsumed();
13056
13058 }
13059
13061 {
13062 super.OnEnergyAdded();
13063
13065 }
13066
13067
13069 {
13070 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13071 {
13073 {
13074 float energy_0to1 = GetCompEM().GetEnergy0To1();
13076 }
13077 }
13078 }
13079
13080
13082 {
13083 return ConfigGetFloat("heatIsolation");
13084 }
13085
13087 {
13089 }
13090
13092 {
13093 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13094 if (
g_Game.ConfigIsExisting(paramPath))
13095 return g_Game.ConfigGetFloat(paramPath);
13096
13097 return 0.0;
13098 }
13099
13101 {
13102 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13103 if (
g_Game.ConfigIsExisting(paramPath))
13104 return g_Game.ConfigGetFloat(paramPath);
13105
13106 return 0.0;
13107 }
13108
13109 override void SetWet(
float value,
bool allow_client =
false)
13110 {
13111 if (!IsServerCheck(allow_client))
13112 return;
13113
13116
13118
13119 m_VarWet = Math.Clamp(value, min, max);
13120
13122 {
13125 }
13126 }
13127
13128 override void AddWet(
float value)
13129 {
13131 }
13132
13134 {
13136 }
13137
13139 {
13141 }
13142
13144 {
13146 }
13147
13149 {
13151 }
13152
13154 {
13156 }
13157
13158 override void OnWetChanged(
float newVal,
float oldVal)
13159 {
13162 if (newLevel != oldLevel)
13163 {
13165 }
13166 }
13167
13169 {
13170 SetWeightDirty();
13171 }
13172
13174 {
13175 return GetWetLevelInternal(
m_VarWet);
13176 }
13177
13178
13179
13181 {
13183 }
13184
13186 {
13188 }
13189
13191 {
13193 }
13194
13196 {
13198 }
13199
13200
13201
13203 {
13204 if (ConfigIsExisting("itemModelLength"))
13205 {
13206 return ConfigGetFloat("itemModelLength");
13207 }
13208 return 0;
13209 }
13210
13212 {
13213 if (ConfigIsExisting("itemAttachOffset"))
13214 {
13215 return ConfigGetFloat("itemAttachOffset");
13216 }
13217 return 0;
13218 }
13219
13220 override void SetCleanness(
int value,
bool allow_client =
false)
13221 {
13222 if (!IsServerCheck(allow_client))
13223 return;
13224
13226
13228
13231 }
13232
13234 {
13236 }
13237
13239 {
13240 return true;
13241 }
13242
13243
13244
13245
13247 {
13249 }
13250
13252 {
13254 }
13255
13256
13257
13258
13259 override void SetColor(
int r,
int g,
int b,
int a)
13260 {
13266 }
13268 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13269 {
13274 }
13275
13277 {
13279 }
13280
13283 {
13284 int r,g,b,a;
13286 r = r/255;
13287 g = g/255;
13288 b = b/255;
13289 a = a/255;
13290 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13291 }
13292
13293
13294
13295 override void SetLiquidType(
int value,
bool allow_client =
false)
13296 {
13297 if (!IsServerCheck(allow_client))
13298 return;
13299
13304 }
13305
13307 {
13308 return ConfigGetInt("varLiquidTypeInit");
13309 }
13310
13312 {
13314 }
13315
13317 {
13319 SetFrozen(false);
13320 }
13321
13324 {
13325 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13326 }
13327
13328
13331 {
13332 PlayerBase nplayer;
13333 if (PlayerBase.CastTo(nplayer, player))
13334 {
13336 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13337 }
13338 }
13339
13340
13343 {
13344 PlayerBase nplayer;
13345 if (PlayerBase.CastTo(nplayer,player))
13346 {
13347 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13348 }
13349
13350 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13351
13352 if (HasEnergyManager())
13353 {
13354 GetCompEM().UpdatePlugState();
13355 }
13356 }
13357
13358
13360 {
13361 super.OnPlacementStarted(player);
13362
13364 }
13365
13366 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13367 {
13369 {
13370 m_AdminLog.OnPlacementComplete(player,
this);
13371 }
13372
13373 super.OnPlacementComplete(player, position, orientation);
13374 }
13375
13376
13377
13378
13379
13381 {
13383 {
13384 return true;
13385 }
13386 else
13387 {
13388 return false;
13389 }
13390 }
13391
13392
13394 {
13396 {
13398 }
13399 }
13400
13401
13403 {
13405 }
13406
13408 {
13410 }
13411
13412 override void InsertAgent(
int agent,
float count = 1)
13413 {
13414 if (count < 1)
13415 return;
13416
13418 }
13419
13422 {
13424 }
13425
13426
13428 {
13430 }
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13474 {
13476 return false;
13477 return true;
13478 }
13479
13481 {
13482
13484 }
13485
13486
13489 {
13490 super.CheckForRoofLimited(timeTresholdMS);
13491
13492 float time =
g_Game.GetTime();
13493 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13494 {
13495 m_PreviousRoofTestTime = time;
13496 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13497 }
13498 }
13499
13500
13502 {
13504 {
13505 return 0;
13506 }
13507
13508 if (GetInventory().GetAttachmentSlotsCount() != 0)
13509 {
13510 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13511 if (filter)
13512 return filter.GetProtectionLevel(type, false, system);
13513 else
13514 return 0;
13515 }
13516
13517 string subclassPath, entryName;
13518
13519 switch (type)
13520 {
13522 entryName = "biological";
13523 break;
13525 entryName = "chemical";
13526 break;
13527 default:
13528 entryName = "biological";
13529 break;
13530 }
13531
13532 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13533
13534 return g_Game.ConfigGetFloat(subclassPath + entryName);
13535 }
13536
13537
13538
13541 {
13542 if (!IsMagazine())
13544
13546 }
13547
13548
13549
13550
13551
13556 {
13557 return true;
13558 }
13559
13561 {
13563 }
13564
13565
13566
13567
13568
13570 {
13571 if (parent)
13572 {
13573 if (parent.IsInherited(DayZInfected))
13574 return true;
13575
13576 if (!parent.IsRuined())
13577 return true;
13578 }
13579
13580 return true;
13581 }
13582
13584 {
13585 if (!super.CanPutAsAttachment(parent))
13586 {
13587 return false;
13588 }
13589
13590 if (!IsRuined() && !parent.IsRuined())
13591 {
13592 return true;
13593 }
13594
13595 return false;
13596 }
13597
13599 {
13600
13601
13602
13603
13604 return super.CanReceiveItemIntoCargo(item);
13605 }
13606
13608 {
13609
13610
13611
13612
13613 GameInventory attachmentInv = attachment.GetInventory();
13615 {
13616 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13617 return false;
13618 }
13619
13620 InventoryLocation loc = new InventoryLocation();
13621 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13622 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13623 return false;
13624
13625 return super.CanReceiveAttachment(attachment, slotId);
13626 }
13627
13629 {
13630 if (!super.CanReleaseAttachment(attachment))
13631 return false;
13632
13633 return GetInventory().AreChildrenAccessible();
13634 }
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13657 {
13658 int id = muzzle_owner.GetMuzzleID();
13659 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13660
13661 if (WPOF_array)
13662 {
13663 for (int i = 0; i < WPOF_array.Count(); i++)
13664 {
13665 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13666
13667 if (WPOF)
13668 {
13669 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13670 }
13671 }
13672 }
13673 }
13674
13675
13677 {
13678 int id = muzzle_owner.GetMuzzleID();
13680
13681 if (WPOBE_array)
13682 {
13683 for (int i = 0; i < WPOBE_array.Count(); i++)
13684 {
13685 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13686
13687 if (WPOBE)
13688 {
13689 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13690 }
13691 }
13692 }
13693 }
13694
13695
13697 {
13698 int id = muzzle_owner.GetMuzzleID();
13699 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13700
13701 if (WPOOH_array)
13702 {
13703 for (int i = 0; i < WPOOH_array.Count(); i++)
13704 {
13705 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13706
13707 if (WPOOH)
13708 {
13709 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13710 }
13711 }
13712 }
13713 }
13714
13715
13717 {
13718 int id = muzzle_owner.GetMuzzleID();
13719 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13720
13721 if (WPOOH_array)
13722 {
13723 for (int i = 0; i < WPOOH_array.Count(); i++)
13724 {
13725 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13726
13727 if (WPOOH)
13728 {
13729 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13730 }
13731 }
13732 }
13733 }
13734
13735
13737 {
13738 int id = muzzle_owner.GetMuzzleID();
13739 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13740
13741 if (WPOOH_array)
13742 {
13743 for (int i = 0; i < WPOOH_array.Count(); i++)
13744 {
13745 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13746
13747 if (WPOOH)
13748 {
13749 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13750 }
13751 }
13752 }
13753 }
13754
13755
13756
13758 {
13760 {
13761 return true;
13762 }
13763
13764 return false;
13765 }
13766
13768 {
13770 {
13771 return true;
13772 }
13773
13774 return false;
13775 }
13776
13778 {
13780 {
13781 return true;
13782 }
13783
13784 return false;
13785 }
13786
13788 {
13789 return false;
13790 }
13791
13794 {
13795 return UATimeSpent.DEFAULT_DEPLOY;
13796 }
13797
13798
13799
13800
13802 {
13804 SetSynchDirty();
13805 }
13806
13808 {
13810 }
13811
13812
13814 {
13815 return false;
13816 }
13817
13820 {
13821 string att_type = "None";
13822
13823 if (ConfigIsExisting("soundAttType"))
13824 {
13825 att_type = ConfigGetString("soundAttType");
13826 }
13827
13829 }
13830
13832 {
13834 }
13835
13836
13837
13838
13839
13845
13847 {
13850
13852 }
13853
13854
13856 {
13858 return;
13859
13861
13864
13867
13868 SoundParameters params = new SoundParameters();
13872 }
13873
13874
13876 {
13878 {
13881
13882 SetSynchDirty();
13883
13886 }
13887 }
13888
13890 {
13892 }
13893
13894
13896 {
13898 return;
13899
13901 SetSynchDirty();
13902
13905 }
13906
13908 {
13911 }
13912
13914 {
13916 }
13917
13918 void OnApply(PlayerBase player);
13919
13921 {
13922 return 1.0;
13923 };
13924
13926 {
13928 }
13929
13931 {
13933 }
13934
13936
13938 {
13939 SetDynamicPhysicsLifeTime(0.01);
13941 }
13942
13944 {
13945 array<string> zone_names = new array<string>;
13946 GetDamageZones(zone_names);
13947 for (int i = 0; i < zone_names.Count(); i++)
13948 {
13949 SetHealthMax(zone_names.Get(i),"Health");
13950 }
13951 SetHealthMax("","Health");
13952 }
13953
13956 {
13957 float global_health = GetHealth01("","Health");
13958 array<string> zones = new array<string>;
13959 GetDamageZones(zones);
13960
13961 for (int i = 0; i < zones.Count(); i++)
13962 {
13963 SetHealth01(zones.Get(i),"Health",global_health);
13964 }
13965 }
13966
13969 {
13970 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13971 }
13972
13974 {
13975 if (!hasRootAsPlayer)
13976 {
13977 if (refParentIB)
13978 {
13979
13980 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13981 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13982
13983 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13984 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13985
13988 }
13989 else
13990 {
13991
13994 }
13995 }
13996 }
13997
13999 {
14001 {
14002 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14003 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14004 {
14005 float heatPermCoef = 1.0;
14007 while (ent)
14008 {
14009 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14010 ent = ent.GetHierarchyParent();
14011 }
14012
14013 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14014 }
14015 }
14016 }
14017
14019 {
14020
14021 EntityAI parent = GetHierarchyParent();
14022 if (!parent)
14023 {
14024 hasParent = false;
14025 hasRootAsPlayer = false;
14026 }
14027 else
14028 {
14029 hasParent = true;
14030 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14031 refParentIB =
ItemBase.Cast(parent);
14032 }
14033 }
14034
14035 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14036 {
14037
14038 }
14039
14041 {
14042
14043 return false;
14044 }
14045
14047 {
14048
14049
14050 return false;
14051 }
14052
14054 {
14055
14056 return false;
14057 }
14058
14061 {
14062 return !GetIsFrozen() &&
IsOpen();
14063 }
14064
14066 {
14067 bool hasParent = false, hasRootAsPlayer = false;
14069
14070 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14071 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14072
14073 if (wwtu || foodDecay)
14074 {
14078
14079 if (processWetness || processTemperature || processDecay)
14080 {
14082
14083 if (processWetness)
14084 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14085
14086 if (processTemperature)
14088
14089 if (processDecay)
14090 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14091 }
14092 }
14093 }
14094
14097 {
14099 }
14100
14102 {
14105
14106 return super.GetTemperatureFreezeThreshold();
14107 }
14108
14110 {
14113
14114 return super.GetTemperatureThawThreshold();
14115 }
14116
14118 {
14121
14122 return super.GetItemOverheatThreshold();
14123 }
14124
14126 {
14128 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14129
14130 return super.GetTemperatureFreezeTime();
14131 }
14132
14134 {
14136 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14137
14138 return super.GetTemperatureThawTime();
14139 }
14140
14145
14147 {
14148 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14149 }
14150
14152 {
14153 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14154 }
14155
14158 {
14160 }
14161
14163 {
14165 }
14166
14168 {
14170 }
14171
14174 {
14175 return null;
14176 }
14177
14180 {
14181 return false;
14182 }
14183
14185 {
14187 {
14190 if (!trg)
14191 {
14193 explosive = this;
14194 }
14195
14196 explosive.PairRemote(trg);
14198
14199 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14200 trg.SetPersistentPairID(persistentID);
14201 explosive.SetPersistentPairID(persistentID);
14202
14203 return true;
14204 }
14205 return false;
14206 }
14207
14210 {
14211 float ret = 1.0;
14214 ret *= GetHealth01();
14215
14216 return ret;
14217 }
14218
14219 #ifdef DEVELOPER
14220 override void SetDebugItem()
14221 {
14222 super.SetDebugItem();
14223 _itemBase = this;
14224 }
14225
14227 {
14228 string text = super.GetDebugText();
14229
14231 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14232
14233 return text;
14234 }
14235 #endif
14236
14238 {
14239 return true;
14240 }
14241
14243
14245
14247 {
14250 }
14251
14252
14260
14276
14277 [
Obsolete(
"Use ItemSoundHandler instead")]
14280 {
14281 if (!
g_Game.IsDedicatedServer())
14282 {
14283 if (ConfigIsExisting("attachSoundSet"))
14284 {
14285 string cfg_path = "";
14286 string soundset = "";
14287 string type_name =
GetType();
14288
14291 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14292 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14293
14294 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14295 {
14296 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14297 {
14298 if (cfg_slot_array[i] == slot_type)
14299 {
14300 soundset = cfg_soundset_array[i];
14301 break;
14302 }
14303 }
14304 }
14305
14306 if (soundset != "")
14307 {
14308 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14310 }
14311 }
14312 }
14313 }
14314
14316}
14317
14319{
14321 if (entity)
14322 {
14323 bool is_item = entity.IsInherited(
ItemBase);
14324 if (is_item && full_quantity)
14325 {
14328 }
14329 }
14330 else
14331 {
14333 return NULL;
14334 }
14335 return entity;
14336}
14337
14339{
14340 if (item)
14341 {
14342 if (health > 0)
14343 item.SetHealth("", "", health);
14344
14345 if (item.CanHaveTemperature())
14346 {
14348 if (item.CanFreeze())
14349 item.SetFrozen(false);
14350 }
14351
14352 if (item.HasEnergyManager())
14353 {
14354 if (quantity >= 0)
14355 {
14356 item.GetCompEM().SetEnergy0To1(quantity);
14357 }
14358 else
14359 {
14361 }
14362 }
14363 else if (item.IsMagazine())
14364 {
14365 Magazine mag = Magazine.Cast(item);
14366 if (quantity >= 0)
14367 {
14368 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14369 }
14370 else
14371 {
14373 }
14374
14375 }
14376 else
14377 {
14378 if (quantity >= 0)
14379 {
14380 item.SetQuantityNormalized(quantity, false);
14381 }
14382 else
14383 {
14385 }
14386
14387 }
14388 }
14389}
14390
14391#ifdef DEVELOPER
14393#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.