9395{
9397 {
9398 return true;
9399 }
9400};
9401
9403{
9404
9405};
9406
9407
9408
9410{
9414
9416
9419
9420
9421
9422
9423
9432
9438
9443
9448
9469 protected bool m_IsResultOfSplit
9470
9472
9477
9478
9479
9481
9485
9486
9487
9489
9492
9493
9494
9500
9501
9509
9512
9513
9515
9516
9518
9519
9524
9525
9530
9532
9533
9535
9536
9538 {
9543
9544 if (!
g_Game.IsDedicatedServer())
9545 {
9547 {
9549
9551 {
9553 }
9554 }
9555
9558 }
9559
9560 m_OldLocation = null;
9561
9563 {
9565 }
9566
9567 if (ConfigIsExisting("headSelectionsToHide"))
9568 {
9571 }
9572
9574 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9575 {
9577 }
9578
9580
9581 m_IsResultOfSplit = false;
9582
9584 }
9585
9587 {
9588 super.InitItemVariables();
9589
9595 m_Count = ConfigGetInt(
"count");
9596
9599
9604
9607
9612
9624
9628
9629
9632 if (ConfigIsExisting("canBeSplit"))
9633 {
9636 }
9637
9639 if (ConfigIsExisting("itemBehaviour"))
9641
9642
9645 RegisterNetSyncVariableInt("m_VarLiquidType");
9646 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9647
9648 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9649 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9650 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9651
9652 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9653 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9654 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9655 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9656
9657 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9658 RegisterNetSyncVariableBool("m_IsTakeable");
9659 RegisterNetSyncVariableBool("m_IsHologram");
9660
9663 {
9666 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9667 }
9668
9670
9672 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9674
9676 }
9677
9679 {
9681 }
9682
9684 {
9687 {
9692 }
9693 }
9694
9695 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9696 {
9698 {
9701 }
9702
9704 }
9705
9707 {
9713 }
9714
9716
9718 {
9720
9721 if (!action)
9722 {
9723 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9724 return;
9725 }
9726
9728 if (!ai)
9729 {
9731 return;
9732 }
9733
9735 if (!action_array)
9736 {
9737 action_array = new array<ActionBase_Basic>;
9739 }
9740 if (LogManager.IsActionLogEnable())
9741 {
9742 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9743 }
9744
9745 if (action_array.Find(action) != -1)
9746 {
9747 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9748 }
9749 else
9750 {
9751 action_array.Insert(action);
9752 }
9753 }
9754
9756 {
9757 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9758 ActionBase action = player.GetActionManager().GetAction(actionName);
9761
9762 if (action_array)
9763 {
9764 action_array.RemoveItem(action);
9765 }
9766 }
9767
9768
9769
9771 {
9772 ActionOverrideData overrideData = new ActionOverrideData();
9776
9778 if (!actionMap)
9779 {
9782 }
9783
9784 actionMap.Insert(this.
Type(), overrideData);
9785
9786 }
9787
9789
9791
9792
9794 {
9797
9800
9801 string config_to_search = "CfgVehicles";
9802 string muzzle_owner_config;
9803
9805 {
9806 if (IsInherited(Weapon))
9807 config_to_search = "CfgWeapons";
9808
9809 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9810
9811 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9812
9813 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9814
9815 if (config_OnFire_subclass_count > 0)
9816 {
9817 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9818
9819 for (int i = 0; i < config_OnFire_subclass_count; i++)
9820 {
9821 string particle_class = "";
9822 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9823 string config_OnFire_entry = config_OnFire_class + particle_class;
9824 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9825 WPOF_array.Insert(WPOF);
9826 }
9827
9828
9830 }
9831 }
9832
9834 {
9835 config_to_search = "CfgWeapons";
9836 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9837
9838 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9839
9840 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9841
9842 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9843 {
9844 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9845
9846 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9847 {
9848 string particle_class2 = "";
9849 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9850 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9851 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9852 WPOBE_array.Insert(WPOBE);
9853 }
9854
9855
9857 }
9858 }
9859 }
9860
9861
9863 {
9866
9868 {
9869 string config_to_search = "CfgVehicles";
9870
9871 if (IsInherited(Weapon))
9872 config_to_search = "CfgWeapons";
9873
9874 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9875 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9876
9877 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9878 {
9879
9881
9883 {
9885 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9887 return;
9888 }
9889
9892
9893
9894
9895 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9896 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9897
9898 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9899 {
9900 string particle_class = "";
9901 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9902 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9903 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9904
9905 if (entry_type == CT_CLASS)
9906 {
9907 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9908 WPOOH_array.Insert(WPOF);
9909 }
9910 }
9911
9912
9914 }
9915 }
9916 }
9917
9919 {
9921 }
9922
9924 {
9926 {
9928
9931
9934
9935 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9936 }
9937 }
9938
9940 {
9942 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9943
9945 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9946
9948 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9949
9951 {
9953 }
9954 }
9955
9957 {
9959 }
9960
9962 {
9965 else
9967
9969 {
9972 }
9973 else
9974 {
9977
9980 }
9981
9983 }
9984
9986 {
9988 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9989 }
9990
9992 {
9994 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9996 }
9997
9999 {
10001 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10002 }
10003
10005 {
10008
10009 OverheatingParticle OP = new OverheatingParticle();
10014
10016 }
10017
10019 {
10022
10023 return -1;
10024 }
10025
10027 {
10029 {
10032
10033 for (int i = count; i > 0; --i)
10034 {
10035 int id = i - 1;
10038
10041
10042 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10043 {
10044 if (p)
10045 {
10048 }
10049 }
10050 }
10051 }
10052 }
10053
10055 {
10057 {
10059 {
10060 int id = i - 1;
10062
10063 if (OP)
10064 {
10066
10067 if (p)
10068 {
10070 }
10071
10072 delete OP;
10073 }
10074 }
10075
10078 }
10079 }
10080
10083 {
10084 return 0.0;
10085 }
10086
10087
10089 {
10090 return 250;
10091 }
10092
10094 {
10095 return 0;
10096 }
10097
10100 {
10102 return true;
10103
10104 return false;
10105 }
10106
10109 {
10112
10114 {
10116 }
10117 else
10118 {
10119
10121 }
10122
10124 }
10125
10132 {
10133 return -1;
10134 }
10135
10136
10137
10138
10140 {
10142 {
10143 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10144 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10145
10146 if (r_index >= 0)
10147 {
10148 InventoryLocation r_il = new InventoryLocation;
10149 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10150
10151 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10154 {
10155 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10156 }
10158 {
10159 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10160 }
10161
10162 }
10163
10164 player.GetHumanInventory().ClearUserReservedLocation(this);
10165 }
10166
10169 }
10170
10171
10172
10173
10175 {
10176 return ItemBase.m_DebugActionsMask;
10177 }
10178
10180 {
10181 return ItemBase.m_DebugActionsMask & mask;
10182 }
10183
10185 {
10186 ItemBase.m_DebugActionsMask = mask;
10187 }
10188
10190 {
10191 ItemBase.m_DebugActionsMask |= mask;
10192 }
10193
10195 {
10196 ItemBase.m_DebugActionsMask &= ~mask;
10197 }
10198
10200 {
10202 {
10204 }
10205 else
10206 {
10208 }
10209 }
10210
10211
10213 {
10214 if (GetEconomyProfile())
10215 {
10216 float q_max = GetEconomyProfile().GetQuantityMax();
10217 if (q_max > 0)
10218 {
10219 float q_min = GetEconomyProfile().GetQuantityMin();
10220 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10221
10223 {
10224 ComponentEnergyManager comp = GetCompEM();
10226 {
10228 }
10229 }
10231 {
10233
10234 }
10235
10236 }
10237 }
10238 }
10239
10242 {
10243 EntityAI parent = GetHierarchyParent();
10244
10245 if (parent)
10246 {
10247 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10248 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10249 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10250 }
10251 }
10252
10255 {
10256 EntityAI parent = GetHierarchyParent();
10257
10258 if (parent)
10259 {
10260 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10261 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10262 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10263 }
10264 }
10265
10267 {
10268
10269
10270
10271
10273
10275 {
10276 if (ScriptInputUserData.CanStoreInputUserData())
10277 {
10278 ScriptInputUserData ctx = new ScriptInputUserData;
10284 ctx.
Write(use_stack_max);
10287
10289 {
10290 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10291 }
10292 }
10293 }
10294 else if (!
g_Game.IsMultiplayer())
10295 {
10297 }
10298 }
10299
10301 {
10303 }
10304
10306 {
10308 }
10309
10311 {
10313 }
10314
10316 {
10317
10318 return false;
10319 }
10320
10322 {
10323 return false;
10324 }
10325
10329 {
10330 return false;
10331 }
10332
10334 {
10335 return "";
10336 }
10337
10339
10341 {
10342 return false;
10343 }
10344
10346 {
10347 return true;
10348 }
10349
10350
10351
10353 {
10354 return true;
10355 }
10356
10358 {
10359 return true;
10360 }
10361
10363 {
10364 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10366 }
10367
10369 {
10371 }
10372
10374 {
10376 if (!is_being_placed)
10378 SetSynchDirty();
10379 }
10380
10381
10383
10385 {
10387 }
10388
10390 {
10392 }
10393
10395 {
10396 return 1;
10397 }
10398
10400 {
10401 return false;
10402 }
10403
10405 {
10407 SetSynchDirty();
10408 }
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10445 {
10446 super.OnMovedInsideCargo(container);
10447
10448 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10449 }
10450
10451 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10452 {
10453 super.EEItemLocationChanged(oldLoc, newLoc);
10454
10455 PlayerBase newPlayer = null;
10456 PlayerBase oldPlayer = null;
10457
10458 if (newLoc.GetParent())
10459 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10460
10461 if (oldLoc.GetParent())
10462 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10463
10465 {
10466 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10467
10468 if (rIndex >= 0)
10469 {
10470 InventoryLocation rIl = new InventoryLocation;
10471 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10472
10473 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10476 {
10477 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10478 }
10480 {
10482 }
10483
10484 }
10485 }
10486
10488 {
10489 if (newPlayer)
10490 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10491
10492 if (newPlayer == oldPlayer)
10493 {
10494 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10495 {
10497 {
10498 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10499 {
10500 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10501 }
10502 }
10503 else
10504 {
10505 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10506 }
10507 }
10508
10509 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10510 {
10511 int type = oldLoc.GetType();
10513 {
10514 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10515 }
10517 {
10518 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10519 }
10520 }
10521 if (!m_OldLocation)
10522 {
10523 m_OldLocation = new InventoryLocation;
10524 }
10525 m_OldLocation.Copy(oldLoc);
10526 }
10527 else
10528 {
10529 if (m_OldLocation)
10530 {
10531 m_OldLocation.Reset();
10532 }
10533 }
10534
10535 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10536 }
10537 else
10538 {
10539 if (newPlayer)
10540 {
10541 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10542 if (resIndex >= 0)
10543 {
10544 InventoryLocation il = new InventoryLocation;
10545 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10547 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10550 {
10551 il.
GetParent().GetOnReleaseLock().Invoke(it);
10552 }
10554 {
10556 }
10557
10558 }
10559 }
10561 {
10562
10564 }
10565
10566 if (m_OldLocation)
10567 {
10568 m_OldLocation.Reset();
10569 }
10570 }
10571
10573 {
10574 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10575 }
10576
10578 {
10579 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10580 }
10581 }
10582
10583 override void EOnContact(IEntity other, Contact extra)
10584 {
10586 {
10587 int liquidType = -1;
10589 if (impactSpeed > 0.0)
10590 {
10592 #ifndef SERVER
10594 #else
10596 SetSynchDirty();
10597 #endif
10599 }
10600 }
10601
10602 #ifdef SERVER
10603 if (GetCompEM() && GetCompEM().IsPlugged())
10604 {
10605 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10606 GetCompEM().UnplugThis();
10607 }
10608 #endif
10609 }
10610
10612
10614 {
10616 }
10617
10619 {
10620
10621 }
10622
10624 {
10625 super.OnItemLocationChanged(old_owner, new_owner);
10626
10627 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10628 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10629
10630 if (!relatedPlayer && playerNew)
10631 relatedPlayer = playerNew;
10632
10633 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10634 {
10636 if (actionMgr)
10637 {
10638 ActionBase currentAction = actionMgr.GetRunningAction();
10639 if (currentAction)
10641 }
10642 }
10643
10644 Man ownerPlayerOld = null;
10645 Man ownerPlayerNew = null;
10646
10647 if (old_owner)
10648 {
10649 if (old_owner.
IsMan())
10650 {
10651 ownerPlayerOld = Man.Cast(old_owner);
10652 }
10653 else
10654 {
10655 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10656 }
10657 }
10658 else
10659 {
10661 {
10663
10664 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10665 {
10666 GetCompEM().UnplugThis();
10667 }
10668 }
10669 }
10670
10671 if (new_owner)
10672 {
10673 if (new_owner.
IsMan())
10674 {
10675 ownerPlayerNew = Man.Cast(new_owner);
10676 }
10677 else
10678 {
10679 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10680 }
10681 }
10682
10683 if (ownerPlayerOld != ownerPlayerNew)
10684 {
10685 if (ownerPlayerOld)
10686 {
10687 array<EntityAI> subItemsExit = new array<EntityAI>;
10689 for (int i = 0; i < subItemsExit.Count(); i++)
10690 {
10693 }
10694 }
10695
10696 if (ownerPlayerNew)
10697 {
10698 array<EntityAI> subItemsEnter = new array<EntityAI>;
10700 for (int j = 0; j < subItemsEnter.Count(); j++)
10701 {
10704 }
10705 }
10706 }
10707 else if (ownerPlayerNew != null)
10708 {
10709 PlayerBase nplayer;
10710 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10711 {
10712 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10714 for (int k = 0; k < subItemsUpdate.Count(); k++)
10715 {
10717 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10718 }
10719 }
10720 }
10721
10722 if (old_owner)
10723 old_owner.OnChildItemRemoved(this);
10724 if (new_owner)
10725 new_owner.OnChildItemReceived(this);
10726 }
10727
10728
10730 {
10731 super.EEDelete(parent);
10732 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10733 if (player)
10734 {
10736
10737 if (player.IsAlive())
10738 {
10739 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10740 if (r_index >= 0)
10741 {
10742 InventoryLocation r_il = new InventoryLocation;
10743 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10744
10745 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10748 {
10749 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10750 }
10752 {
10753 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10754 }
10755
10756 }
10757
10758 player.RemoveQuickBarEntityShortcut(this);
10759 }
10760 }
10761 }
10762
10764 {
10765 super.EEKilled(killer);
10766
10769 {
10770 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10771 {
10772 if (IsMagazine())
10773 {
10774 if (Magazine.Cast(this).GetAmmoCount() > 0)
10775 {
10777 }
10778 }
10779 else
10780 {
10782 }
10783 }
10784 }
10785 }
10786
10788 {
10789 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10790
10791 super.OnWasAttached(parent, slot_id);
10792
10795
10798 }
10799
10801 {
10802 super.OnWasDetached(parent, slot_id);
10803
10806
10809 }
10810
10812 {
10813 int idx;
10816
10817 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10818 if (inventory_slots.Count() < 1)
10819 {
10820 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10821 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10822 }
10823 else
10824 {
10825 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10826 }
10827
10828 idx = inventory_slots.Find(slot);
10829 if (idx < 0)
10830 return "";
10831
10832 return attach_types.Get(idx);
10833 }
10834
10836 {
10837 int idx = -1;
10838 string slot;
10839
10842
10843 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10844 if (inventory_slots.Count() < 1)
10845 {
10846 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10847 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10848 }
10849 else
10850 {
10851 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10852 if (detach_types.Count() < 1)
10853 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10854 }
10855
10856 for (int i = 0; i < inventory_slots.Count(); i++)
10857 {
10858 slot = inventory_slots.Get(i);
10859 }
10860
10861 if (slot != "")
10862 {
10863 if (detach_types.Count() == 1)
10864 idx = 0;
10865 else
10866 idx = inventory_slots.Find(slot);
10867 }
10868 if (idx < 0)
10869 return "";
10870
10871 return detach_types.Get(idx);
10872 }
10873
10875 {
10876
10878
10879
10880 float min_time = 1;
10881 float max_time = 3;
10882 float delay = Math.RandomFloat(min_time, max_time);
10883
10884 explode_timer.Run(delay, this, "DoAmmoExplosion");
10885 }
10886
10888 {
10889 Magazine magazine = Magazine.Cast(this);
10890 int pop_sounds_count = 6;
10891 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10892
10893
10894 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10895 string sound_name = pop_sounds[ sound_idx ];
10896 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10897
10898
10899 magazine.ServerAddAmmoCount(-1);
10900
10901
10902 float min_temp_to_explode = 100;
10903
10904 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10905 {
10907 }
10908 }
10909
10910
10911 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10912 {
10913 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10914
10915 const int CHANCE_DAMAGE_CARGO = 4;
10916 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10917 const int CHANCE_DAMAGE_NOTHING = 2;
10918
10920 {
10921 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10922 int chances;
10923 int rnd;
10924
10925 if (GetInventory().GetCargo())
10926 {
10927 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10928 rnd = Math.RandomInt(0,chances);
10929
10930 if (rnd < CHANCE_DAMAGE_CARGO)
10931 {
10933 }
10934 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10935 {
10937 }
10938 }
10939 else
10940 {
10941 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10942 rnd = Math.RandomInt(0,chances);
10943
10944 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10945 {
10947 }
10948 }
10949 }
10950 }
10951
10953 {
10954 CargoBase cargo = GetInventory().GetCargo();
10955 if (cargo)
10956 {
10958 if (item_count > 0)
10959 {
10960 int random_pick = Math.RandomInt(0, item_count);
10962 if (!item.IsExplosive())
10963 {
10964 item.AddHealth("","",damage);
10965 return true;
10966 }
10967 }
10968 }
10969 return false;
10970 }
10971
10973 {
10974 GameInventory inventory = GetInventory();
10976 if (attachment_count > 0)
10977 {
10978 int random_pick = Math.RandomInt(0, attachment_count);
10980 if (!attachment.IsExplosive())
10981 {
10982 attachment.AddHealth("","",damage);
10983 return true;
10984 }
10985 }
10986 return false;
10987 }
10988
10990 {
10992 }
10993
10995 {
10997 return GetInventory().CanRemoveEntity();
10998
10999 return false;
11000 }
11001
11003 {
11004
11006 return false;
11007
11008
11010 return false;
11011
11012
11013
11015 if (delta == 0)
11016 return false;
11017
11018
11019 return true;
11020 }
11021
11023 {
11025 {
11026 if (ScriptInputUserData.CanStoreInputUserData())
11027 {
11028 ScriptInputUserData ctx = new ScriptInputUserData;
11033 ctx.
Write(destination_entity);
11035 ctx.
Write(slot_id);
11037 }
11038 }
11039 else if (!
g_Game.IsMultiplayer())
11040 {
11042 }
11043 }
11044
11046 {
11047 float split_quantity_new;
11051 InventoryLocation loc = new InventoryLocation;
11052
11053 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11054 {
11056 split_quantity_new = stack_max;
11057 else
11059
11061 {
11062 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11063 if (new_item)
11064 {
11065 new_item.SetResultOfSplit(true);
11066 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11068 new_item.
SetQuantity(split_quantity_new,
false,
true);
11069 }
11070 }
11071 }
11072 else if (destination_entity && slot_id == -1)
11073 {
11074 if (quantity > stack_max)
11075 split_quantity_new = stack_max;
11076 else
11077 split_quantity_new = quantity;
11078
11080 {
11081 GameInventory destinationInventory = destination_entity.GetInventory();
11083 {
11086 }
11087
11088 if (new_item)
11089 {
11090 new_item.SetResultOfSplit(true);
11091 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11093 new_item.
SetQuantity(split_quantity_new,
false,
true);
11094 }
11095 }
11096 }
11097 else
11098 {
11099 if (stack_max != 0)
11100 {
11102 {
11104 }
11105
11106 if (split_quantity_new == 0)
11107 {
11108 if (!
g_Game.IsMultiplayer())
11109 player.PhysicalPredictiveDropItem(this);
11110 else
11111 player.ServerDropEntity(this);
11112 return;
11113 }
11114
11116 {
11118
11119 if (new_item)
11120 {
11121 new_item.SetResultOfSplit(true);
11122 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11125 new_item.PlaceOnSurface();
11126 }
11127 }
11128 }
11129 }
11130 }
11131
11133 {
11134 float split_quantity_new;
11138 InventoryLocation loc = new InventoryLocation;
11139
11140 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11141 {
11143 split_quantity_new = stack_max;
11144 else
11146
11148 {
11149 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11150 if (new_item)
11151 {
11152 new_item.SetResultOfSplit(true);
11153 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11155 new_item.
SetQuantity(split_quantity_new,
false,
true);
11156 }
11157 }
11158 }
11159 else if (destination_entity && slot_id == -1)
11160 {
11161 if (quantity > stack_max)
11162 split_quantity_new = stack_max;
11163 else
11164 split_quantity_new = quantity;
11165
11167 {
11168 GameInventory destinationInventory = destination_entity.GetInventory();
11170 {
11173 }
11174
11175 if (new_item)
11176 {
11177 new_item.SetResultOfSplit(true);
11178 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11180 new_item.
SetQuantity(split_quantity_new,
false,
true);
11181 }
11182 }
11183 }
11184 else
11185 {
11186 if (stack_max != 0)
11187 {
11189 {
11191 }
11192
11194 {
11196
11197 if (new_item)
11198 {
11199 new_item.SetResultOfSplit(true);
11200 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11203 new_item.PlaceOnSurface();
11204 }
11205 }
11206 }
11207 }
11208 }
11209
11211 {
11213 {
11214 if (ScriptInputUserData.CanStoreInputUserData())
11215 {
11216 ScriptInputUserData ctx = new ScriptInputUserData;
11221 dst.WriteToContext(ctx);
11223 }
11224 }
11225 else if (!
g_Game.IsMultiplayer())
11226 {
11228 }
11229 }
11230
11232 {
11234 {
11235 if (ScriptInputUserData.CanStoreInputUserData())
11236 {
11237 ScriptInputUserData ctx = new ScriptInputUserData;
11242 ctx.
Write(destination_entity);
11248 }
11249 }
11250 else if (!
g_Game.IsMultiplayer())
11251 {
11253 }
11254 }
11255
11257 {
11259 }
11260
11262 {
11264 float split_quantity_new;
11266 if (dst.IsValid())
11267 {
11268 int slot_id = dst.GetSlot();
11270
11271 if (quantity > stack_max)
11272 split_quantity_new = stack_max;
11273 else
11274 split_quantity_new = quantity;
11275
11277 {
11279
11280 if (new_item)
11281 {
11282 new_item.SetResultOfSplit(true);
11283 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11285 new_item.
SetQuantity(split_quantity_new,
false,
true);
11286 }
11287
11288 return new_item;
11289 }
11290 }
11291
11292 return null;
11293 }
11294
11296 {
11298 float split_quantity_new;
11300 if (destination_entity)
11301 {
11303 if (quantity > stackable)
11304 split_quantity_new = stackable;
11305 else
11306 split_quantity_new = quantity;
11307
11309 {
11310 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11311 if (new_item)
11312 {
11313 new_item.SetResultOfSplit(true);
11314 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11316 new_item.
SetQuantity(split_quantity_new,
false,
true);
11317 }
11318 }
11319 }
11320 }
11321
11323 {
11325 {
11326 if (ScriptInputUserData.CanStoreInputUserData())
11327 {
11328 ScriptInputUserData ctx = new ScriptInputUserData;
11333 ItemBase destination_entity =
this;
11334 ctx.
Write(destination_entity);
11338 }
11339 }
11340 else if (!
g_Game.IsMultiplayer())
11341 {
11343 }
11344 }
11345
11347 {
11349 float split_quantity_new;
11351 if (player)
11352 {
11354 if (quantity > stackable)
11355 split_quantity_new = stackable;
11356 else
11357 split_quantity_new = quantity;
11358
11360 {
11361 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11362 new_item =
ItemBase.Cast(in_hands);
11363 if (new_item)
11364 {
11365 new_item.SetResultOfSplit(true);
11366 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11368 new_item.SetQuantity(split_quantity_new, false, true);
11369 }
11370 }
11371 }
11372 }
11373
11375 {
11377 float split_quantity_new = Math.Floor(quantity * 0.5);
11378
11380 return;
11381
11383
11384 if (new_item)
11385 {
11386 if (new_item.GetQuantityMax() < split_quantity_new)
11387 {
11388 split_quantity_new = new_item.GetQuantityMax();
11389 }
11390
11391 new_item.SetResultOfSplit(true);
11392 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11393
11395 {
11398 }
11399 else
11400 {
11402 new_item.
SetQuantity(split_quantity_new,
false,
true);
11403 }
11404 }
11405 }
11406
11408 {
11410 float split_quantity_new = Math.Floor(quantity / 2);
11411
11413 return;
11414
11415 InventoryLocation invloc = new InventoryLocation;
11417
11419 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11420
11421 if (new_item)
11422 {
11423 if (new_item.GetQuantityMax() < split_quantity_new)
11424 {
11425 split_quantity_new = new_item.GetQuantityMax();
11426 }
11428 {
11431 }
11432 else if (split_quantity_new > 1)
11433 {
11435 new_item.
SetQuantity(split_quantity_new,
false,
true);
11436 }
11437 }
11438 }
11439
11442 {
11443 SetWeightDirty();
11445
11446 if (parent)
11447 parent.OnAttachmentQuantityChangedEx(this, delta);
11448
11450 {
11452 {
11454 }
11456 {
11457 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11459 }
11460 }
11461 }
11462
11465 {
11466
11467 }
11468
11471 {
11473 }
11474
11476 {
11477 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11478
11480 {
11481 if (newLevel == GameConstants.STATE_RUINED)
11482 {
11484 EntityAI parent = GetHierarchyParent();
11485 if (parent && parent.IsFireplace())
11486 {
11487 CargoBase cargo = GetInventory().GetCargo();
11488 if (cargo)
11489 {
11491 {
11493 }
11494 }
11495 }
11496 }
11497
11499 {
11500
11502 return;
11503 }
11504
11505 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11506 {
11508 }
11509 }
11510 }
11511
11512
11514 {
11515 super.OnRightClick();
11516
11518 {
11520 {
11521 if (ScriptInputUserData.CanStoreInputUserData())
11522 {
11523 EntityAI root = GetHierarchyRoot();
11524 Man playerOwner = GetHierarchyRootPlayer();
11525 InventoryLocation dst = new InventoryLocation;
11526
11527
11528 if (!playerOwner && root && root == this)
11529 {
11531 }
11532 else
11533 {
11534
11535 GetInventory().GetCurrentInventoryLocation(dst);
11537 {
11538 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11540 {
11542 }
11543 else
11544 {
11546
11547
11548 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11549 {
11551 }
11552 else
11553 {
11554 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11555 }
11556 }
11557 }
11558 }
11559
11560 ScriptInputUserData ctx = new ScriptInputUserData;
11568 }
11569 }
11570 else if (!
g_Game.IsMultiplayer())
11571 {
11573 }
11574 }
11575 }
11576
11578 {
11579 if (root)
11580 {
11581 vector m4[4];
11582 root.GetTransform(m4);
11583 dst.SetGround(this, m4);
11584 }
11585 else
11586 {
11587 GetInventory().GetCurrentInventoryLocation(dst);
11588 }
11589 }
11590
11591 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11592 {
11593
11594 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11595 return false;
11596
11597 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11598 return false;
11599
11600
11602 return false;
11603
11604
11605 Magazine mag = Magazine.Cast(this);
11606 if (mag)
11607 {
11608 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11609 return false;
11610
11611 if (stack_max_limit)
11612 {
11613 Magazine other_mag = Magazine.Cast(other_item);
11614 if (other_item)
11615 {
11616 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11617 return false;
11618 }
11619
11620 }
11621 }
11622 else
11623 {
11624
11626 return false;
11627
11629 return false;
11630 }
11631
11632 PlayerBase player = null;
11633 if (CastTo(player, GetHierarchyRootPlayer()))
11634 {
11635 if (player.GetInventory().HasAttachment(this))
11636 return false;
11637
11638 if (player.IsItemsToDelete())
11639 return false;
11640 }
11641
11642 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11643 return false;
11644
11645 int slotID;
11647 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11648 return false;
11649
11650 return true;
11651 }
11652
11654 {
11656 }
11657
11659 {
11660 return m_IsResultOfSplit;
11661 }
11662
11664 {
11665 m_IsResultOfSplit = value;
11666 }
11667
11669 {
11671 }
11672
11674 {
11675 float other_item_quantity = other_item.GetQuantity();
11676 float this_free_space;
11677
11679
11681
11682 if (other_item_quantity > this_free_space)
11683 {
11684 return this_free_space;
11685 }
11686 else
11687 {
11688 return other_item_quantity;
11689 }
11690 }
11691
11693 {
11695 }
11696
11698 {
11700 return;
11701
11702 if (!IsMagazine() && other_item)
11703 {
11705 if (quantity_used != 0)
11706 {
11707 float hp1 = GetHealth01("","");
11708 float hp2 = other_item.GetHealth01("","");
11709 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11710 hpResult = hpResult / (
GetQuantity() + quantity_used);
11711
11712 hpResult *= GetMaxHealth();
11713 Math.Round(hpResult);
11714 SetHealth("", "Health", hpResult);
11715
11717 other_item.AddQuantity(-quantity_used);
11718 }
11719 }
11721 }
11722
11724 {
11725 #ifdef SERVER
11726 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11727 GetHierarchyParent().IncreaseLifetimeUp();
11728 #endif
11729 };
11730
11732 {
11733 PlayerBase p = PlayerBase.Cast(player);
11734
11735 array<int> recipesIds = p.m_Recipes;
11736 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11737 if (moduleRecipesManager)
11738 {
11739 EntityAI itemInHands = player.GetEntityInHands();
11740 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11741 }
11742
11743 for (int i = 0;i < recipesIds.Count(); i++)
11744 {
11745 int key = recipesIds.Get(i);
11746 string recipeName = moduleRecipesManager.GetRecipeName(key);
11748 }
11749 }
11750
11751
11752 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11753 {
11754 super.GetDebugActions(outputList);
11755
11756
11762
11763
11768
11773
11774
11778
11779
11781 {
11785 }
11786
11789
11790
11794
11796
11797 InventoryLocation loc = new InventoryLocation();
11798 GetInventory().GetCurrentInventoryLocation(loc);
11800 {
11801 if (Gizmo_IsSupported())
11804 }
11805
11807 }
11808
11809
11810
11811
11813 {
11814 super.OnAction(action_id, player, ctx);
11815
11817 {
11818 switch (action_id)
11819 {
11823 return true;
11827 return true;
11828 }
11829 }
11830
11832 {
11833 switch (action_id)
11834 {
11836 Delete();
11837 return true;
11838 }
11839 }
11840
11841 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11842 {
11843 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11844 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11845 PlayerBase p = PlayerBase.Cast(player);
11846 if (
EActions.RECIPES_RANGE_START < 1000)
11847 {
11848 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11849 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11850 }
11851 }
11852 #ifndef SERVER
11853 else if (action_id ==
EActions.WATCH_PLAYER)
11854 {
11855 PluginDeveloper.SetDeveloperItemClientEx(player);
11856 }
11857 #endif
11859 {
11860 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11861 {
11862 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11863 OnDebugButtonPressServer(id + 1);
11864 }
11865
11866 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11867 {
11868 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11870 }
11871
11872 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11873 {
11874 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11876 }
11877
11878 else if (action_id ==
EActions.ADD_QUANTITY)
11879 {
11880 if (IsMagazine())
11881 {
11882 Magazine mag = Magazine.Cast(this);
11883 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11884 }
11885 else
11886 {
11888 }
11889
11890 if (m_EM)
11891 {
11892 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11893 }
11894
11895 }
11896
11897 else if (action_id ==
EActions.REMOVE_QUANTITY)
11898 {
11899 if (IsMagazine())
11900 {
11901 Magazine mag2 = Magazine.Cast(this);
11902 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11903 }
11904 else
11905 {
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.SET_QUANTITY_0)
11916 {
11918
11919 if (m_EM)
11920 {
11921 m_EM.SetEnergy(0);
11922 }
11923 }
11924
11925 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11926 {
11928
11929 if (m_EM)
11930 {
11931 m_EM.SetEnergy(m_EM.GetEnergyMax());
11932 }
11933 }
11934
11935 else if (action_id ==
EActions.ADD_HEALTH)
11936 {
11937 AddHealth("","",GetMaxHealth("","Health")/5);
11938 }
11939 else if (action_id ==
EActions.REMOVE_HEALTH)
11940 {
11941 AddHealth("","",-GetMaxHealth("","Health")/5);
11942 }
11943 else if (action_id ==
EActions.DESTROY_HEALTH)
11944 {
11945 SetHealth01("","",0);
11946 }
11947 else if (action_id ==
EActions.WATCH_ITEM)
11948 {
11950 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11951 #ifdef DEVELOPER
11952 SetDebugDeveloper_item(this);
11953 #endif
11954 }
11955
11956 else if (action_id ==
EActions.ADD_TEMPERATURE)
11957 {
11958 AddTemperature(20);
11959
11960 }
11961
11962 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11963 {
11964 AddTemperature(-20);
11965
11966 }
11967
11968 else if (action_id ==
EActions.FLIP_FROZEN)
11969 {
11970 SetFrozen(!GetIsFrozen());
11971
11972 }
11973
11974 else if (action_id ==
EActions.ADD_WETNESS)
11975 {
11977
11978 }
11979
11980 else if (action_id ==
EActions.REMOVE_WETNESS)
11981 {
11983
11984 }
11985
11986 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11987 {
11990
11991
11992 }
11993
11994 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11995 {
11998 }
11999
12000 else if (action_id ==
EActions.MAKE_SPECIAL)
12001 {
12002 auto debugParams = DebugSpawnParams.WithPlayer(player);
12003 OnDebugSpawnEx(debugParams);
12004 }
12005
12006 }
12007
12008
12009 return false;
12010 }
12011
12012
12013
12014
12018
12021
12022
12023
12025 {
12026 return false;
12027 }
12028
12029
12031 {
12032 return true;
12033 }
12034
12035
12037 {
12038 return true;
12039 }
12040
12041
12042
12044 {
12045 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12046 return g_Game.ConfigIsExisting(config_path);
12047 }
12048
12051 {
12052 return null;
12053 }
12054
12056 {
12057 return false;
12058 }
12059
12061 {
12062 return false;
12063 }
12064
12068
12069
12071 {
12072 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12073 return module_repairing.CanRepair(this, item_repair_kit);
12074 }
12075
12076
12077 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12078 {
12079 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12080 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12081 }
12082
12083
12085 {
12086
12087
12088
12089
12090
12091
12092
12093
12094 return 1;
12095 }
12096
12097
12098
12100 {
12102 }
12103
12104
12105
12107 {
12109 }
12110
12111
12120 {
12121 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12122
12123 if (player)
12124 {
12125 player.MessageStatus(text);
12126 }
12127 }
12128
12129
12138 {
12139 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12140
12141 if (player)
12142 {
12143 player.MessageAction(text);
12144 }
12145 }
12146
12147
12156 {
12157 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12158
12159 if (player)
12160 {
12161 player.MessageFriendly(text);
12162 }
12163 }
12164
12165
12174 {
12175 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12176
12177 if (player)
12178 {
12179 player.MessageImportant(text);
12180 }
12181 }
12182
12184 {
12185 return true;
12186 }
12187
12188
12189 override bool KindOf(
string tag)
12190 {
12191 bool found = false;
12192 string item_name = this.
GetType();
12194 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12195
12196 int array_size = item_tag_array.Count();
12197 for (int i = 0; i < array_size; i++)
12198 {
12199 if (item_tag_array.Get(i) == tag)
12200 {
12201 found = true;
12202 break;
12203 }
12204 }
12205 return found;
12206 }
12207
12208
12210 {
12211
12212 super.OnRPC(sender, rpc_type,ctx);
12213
12214
12215 switch (rpc_type)
12216 {
12217 #ifndef SERVER
12218 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12219 Param2<bool, string> p = new Param2<bool, string>(false, "");
12220
12222 return;
12223
12224 bool play = p.param1;
12225 string soundSet = p.param2;
12226
12227 if (play)
12228 {
12230 {
12232 {
12234 }
12235 }
12236 else
12237 {
12239 }
12240 }
12241 else
12242 {
12244 }
12245
12246 break;
12247 #endif
12248
12249 }
12250
12252 {
12254 }
12255 }
12256
12257
12258
12259
12261 {
12262 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12263 return plugin.GetID(
name);
12264 }
12265
12267 {
12268 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12269 return plugin.GetName(id);
12270 }
12271
12274 {
12275
12276
12277 int varFlags;
12278 if (!ctx.
Read(varFlags))
12279 return;
12280
12281 if (varFlags & ItemVariableFlags.FLOAT)
12282 {
12284 }
12285 }
12286
12288 {
12289
12290 super.SerializeNumericalVars(floats_out);
12291
12292
12293
12295 {
12297 }
12298
12300 {
12302 }
12303
12305 {
12307 }
12308
12310 {
12315 }
12316
12318 {
12320 }
12321 }
12322
12324 {
12325
12326 super.DeSerializeNumericalVars(floats);
12327
12328
12329 int index = 0;
12330 int mask = Math.Round(floats.Get(index));
12331
12332 index++;
12333
12335 {
12337 {
12339 }
12340 else
12341 {
12342 float quantity = floats.Get(index);
12343 SetQuantity(quantity,
true,
false,
false,
false);
12344 }
12345 index++;
12346 }
12347
12349 {
12350 float wet = floats.Get(index);
12352 index++;
12353 }
12354
12356 {
12357 int liquidtype = Math.Round(floats.Get(index));
12359 index++;
12360 }
12361
12363 {
12365 index++;
12367 index++;
12369 index++;
12371 index++;
12372 }
12373
12375 {
12376 int cleanness = Math.Round(floats.Get(index));
12378 index++;
12379 }
12380 }
12381
12383 {
12384 super.WriteVarsToCTX(ctx);
12385
12386
12388 {
12390 }
12391
12393 {
12395 }
12396
12398 {
12400 }
12401
12403 {
12404 int r,g,b,a;
12410 }
12411
12413 {
12415 }
12416 }
12417
12419 {
12420 if (!super.ReadVarsFromCTX(ctx,version))
12421 return false;
12422
12423 int intValue;
12424 float value;
12425
12426 if (version < 140)
12427 {
12428 if (!ctx.
Read(intValue))
12429 return false;
12430
12431 m_VariablesMask = intValue;
12432 }
12433
12435 {
12436 if (!ctx.
Read(value))
12437 return false;
12438
12440 {
12442 }
12443 else
12444 {
12446 }
12447 }
12448
12449 if (version < 140)
12450 {
12452 {
12453 if (!ctx.
Read(value))
12454 return false;
12455 SetTemperatureDirect(value);
12456 }
12457 }
12458
12460 {
12461 if (!ctx.
Read(value))
12462 return false;
12464 }
12465
12467 {
12468 if (!ctx.
Read(intValue))
12469 return false;
12471 }
12472
12474 {
12475 int r,g,b,a;
12477 return false;
12479 return false;
12481 return false;
12483 return false;
12484
12486 }
12487
12489 {
12490 if (!ctx.
Read(intValue))
12491 return false;
12493 }
12494
12495 if (version >= 138 && version < 140)
12496 {
12498 {
12499 if (!ctx.
Read(intValue))
12500 return false;
12501 SetFrozen(intValue);
12502 }
12503 }
12504
12505 return true;
12506 }
12507
12508
12510 {
12513 {
12515 }
12516
12517 if (!super.OnStoreLoad(ctx, version))
12518 {
12520 return false;
12521 }
12522
12523 if (version >= 114)
12524 {
12525 bool hasQuickBarIndexSaved;
12526
12527 if (!ctx.
Read(hasQuickBarIndexSaved))
12528 {
12530 return false;
12531 }
12532
12533 if (hasQuickBarIndexSaved)
12534 {
12535 int itmQBIndex;
12536
12537
12538 if (!ctx.
Read(itmQBIndex))
12539 {
12541 return false;
12542 }
12543
12544 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12545 if (itmQBIndex != -1 && parentPlayer)
12546 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12547 }
12548 }
12549 else
12550 {
12551
12552 PlayerBase player;
12553 int itemQBIndex;
12554 if (version ==
int.
MAX)
12555 {
12556 if (!ctx.
Read(itemQBIndex))
12557 {
12559 return false;
12560 }
12561 }
12562 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12563 {
12564
12565 if (!ctx.
Read(itemQBIndex))
12566 {
12568 return false;
12569 }
12570 if (itemQBIndex != -1 && player)
12571 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12572 }
12573 }
12574
12575 if (version < 140)
12576 {
12577
12578 if (!LoadVariables(ctx, version))
12579 {
12581 return false;
12582 }
12583 }
12584
12585
12587 {
12589 return false;
12590 }
12591 if (version >= 132)
12592 {
12594 if (raib)
12595 {
12597 {
12599 return false;
12600 }
12601 }
12602 }
12603
12605 return true;
12606 }
12607
12608
12609
12611 {
12612 super.OnStoreSave(ctx);
12613
12614 PlayerBase player;
12615 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12616 {
12618
12619 int itemQBIndex = -1;
12620 itemQBIndex = player.FindQuickBarEntityIndex(this);
12621 ctx.
Write(itemQBIndex);
12622 }
12623 else
12624 {
12626 }
12627
12629
12631 if (raib)
12632 {
12634 }
12635 }
12636
12637
12639 {
12640 super.AfterStoreLoad();
12641
12643 {
12645 }
12646
12648 {
12651 }
12652 }
12653
12655 {
12656 super.EEOnAfterLoad();
12657
12659 {
12661 }
12662
12665 }
12666
12668 {
12669 return false;
12670 }
12671
12672
12673
12675 {
12677 {
12678 #ifdef PLATFORM_CONSOLE
12679
12681 {
12683 if (menu)
12684 {
12686 }
12687 }
12688 #endif
12689 }
12690
12692 {
12695 }
12696
12698 {
12699 SetWeightDirty();
12701 }
12703 {
12706 }
12707
12709 {
12712
12715 }
12717 {
12721 }
12722
12723 super.OnVariablesSynchronized();
12724 }
12725
12726
12727
12729 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12730 {
12731 if (!IsServerCheck(allow_client))
12732 return false;
12733
12735 return false;
12736
12739
12740 if (value <= (min + 0.001))
12741 value = min;
12742
12743 if (value == min)
12744 {
12745 if (destroy_config)
12746 {
12747 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12748 if (dstr)
12749 {
12751 this.Delete();
12752 return true;
12753 }
12754 }
12755 else if (destroy_forced)
12756 {
12758 this.Delete();
12759 return true;
12760 }
12761
12763 }
12764
12767
12769 {
12770 EntityAI parent = GetHierarchyRoot();
12771 InventoryLocation iLoc = new InventoryLocation();
12772 GetInventory().GetCurrentInventoryLocation(iLoc);
12774 {
12775 int iLocSlot = iLoc.
GetSlot();
12777 {
12779 }
12781 {
12783 }
12784 }
12785 }
12786
12788 {
12790
12791 if (delta)
12793 }
12794
12796
12797 return false;
12798 }
12799
12800
12802 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12803 {
12805 }
12806
12808 {
12811 }
12812
12814 {
12817 }
12818
12820 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12821 {
12822 float value_clamped = Math.Clamp(value, 0, 1);
12824 SetQuantity(result, destroy_config, destroy_forced);
12825 }
12826
12827
12830 {
12832 }
12833
12835 {
12837 }
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12849 {
12850 int slot = -1;
12851 GameInventory inventory = GetInventory();
12852 if (inventory)
12853 {
12854 InventoryLocation il = new InventoryLocation;
12857 }
12858
12860 }
12861
12863 {
12864 float quantity_max = 0;
12865
12867 {
12868 if (attSlotID != -1)
12869 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12870
12871 if (quantity_max <= 0)
12873 }
12874
12875 if (quantity_max <= 0)
12877
12878 return quantity_max;
12879 }
12880
12882 {
12884 }
12885
12887 {
12889 }
12890
12891
12893 {
12895 }
12896
12898 {
12900 }
12901
12903 {
12905 }
12906
12907
12909 {
12910
12911 float weightEx = GetWeightEx();
12912 float special = GetInventoryAndCargoWeight();
12913 return weightEx - special;
12914 }
12915
12916
12918 {
12920 }
12921
12923 {
12925 {
12926 #ifdef DEVELOPER
12927 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12928 {
12929 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12931 }
12932 #endif
12933
12934 return GetQuantity() * GetConfigWeightModified();
12935 }
12936 else if (HasEnergyManager())
12937 {
12938 #ifdef DEVELOPER
12939 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12940 {
12941 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12942 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12943 }
12944 #endif
12945 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12946 }
12947 else
12948 {
12949 #ifdef DEVELOPER
12950 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12951 {
12952 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12953 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12954 }
12955 #endif
12956 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12957 }
12958 }
12959
12962 {
12963 int item_count = 0;
12965
12966 GameInventory inventory = GetInventory();
12967 CargoBase cargo = inventory.
GetCargo();
12968 if (cargo != NULL)
12969 {
12971 }
12972
12974 for (int i = 0; i < nAttachments; ++i)
12975 {
12977 if (item)
12978 item_count += item.GetNumberOfItems();
12979 }
12980 return item_count;
12981 }
12982
12985 {
12986 float weight = 0;
12987 float wetness = 1;
12988 if (include_wetness)
12991 {
12992 weight = wetness * m_ConfigWeight;
12993 }
12995 {
12996 weight = 1;
12997 }
12998 return weight;
12999 }
13000
13001
13002
13004 {
13005 GameInventory inventory = GetInventory();
13006 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13007 {
13008 array<EntityAI> items = new array<EntityAI>;
13010 for (int i = 0; i < items.Count(); ++i)
13011 {
13013 if (item)
13014 {
13015 g_Game.ObjectDelete(item);
13016 }
13017 }
13018 }
13019 }
13020
13021
13022
13023
13025 {
13026 float energy = 0;
13027 if (HasEnergyManager())
13028 {
13029 energy = GetCompEM().GetEnergy();
13030 }
13031 return energy;
13032 }
13033
13034
13036 {
13037 super.OnEnergyConsumed();
13038
13040 }
13041
13043 {
13044 super.OnEnergyAdded();
13045
13047 }
13048
13049
13051 {
13052 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13053 {
13055 {
13056 float energy_0to1 = GetCompEM().GetEnergy0To1();
13058 }
13059 }
13060 }
13061
13062
13064 {
13065 return ConfigGetFloat("heatIsolation");
13066 }
13067
13069 {
13071 }
13072
13074 {
13075 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13076 if (
g_Game.ConfigIsExisting(paramPath))
13077 return g_Game.ConfigGetFloat(paramPath);
13078
13079 return 0.0;
13080 }
13081
13083 {
13084 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13085 if (
g_Game.ConfigIsExisting(paramPath))
13086 return g_Game.ConfigGetFloat(paramPath);
13087
13088 return 0.0;
13089 }
13090
13091 override void SetWet(
float value,
bool allow_client =
false)
13092 {
13093 if (!IsServerCheck(allow_client))
13094 return;
13095
13098
13100
13101 m_VarWet = Math.Clamp(value, min, max);
13102
13104 {
13107 }
13108 }
13109
13110 override void AddWet(
float value)
13111 {
13113 }
13114
13116 {
13118 }
13119
13121 {
13123 }
13124
13126 {
13128 }
13129
13131 {
13133 }
13134
13136 {
13138 }
13139
13140 override void OnWetChanged(
float newVal,
float oldVal)
13141 {
13144 if (newLevel != oldLevel)
13145 {
13147 }
13148 }
13149
13151 {
13152 SetWeightDirty();
13153 }
13154
13156 {
13157 return GetWetLevelInternal(
m_VarWet);
13158 }
13159
13160
13161
13163 {
13165 }
13166
13168 {
13170 }
13171
13173 {
13175 }
13176
13178 {
13180 }
13181
13182
13183
13185 {
13186 if (ConfigIsExisting("itemModelLength"))
13187 {
13188 return ConfigGetFloat("itemModelLength");
13189 }
13190 return 0;
13191 }
13192
13194 {
13195 if (ConfigIsExisting("itemAttachOffset"))
13196 {
13197 return ConfigGetFloat("itemAttachOffset");
13198 }
13199 return 0;
13200 }
13201
13202 override void SetCleanness(
int value,
bool allow_client =
false)
13203 {
13204 if (!IsServerCheck(allow_client))
13205 return;
13206
13208
13210
13213 }
13214
13216 {
13218 }
13219
13221 {
13222 return true;
13223 }
13224
13225
13226
13227
13229 {
13231 }
13232
13234 {
13236 }
13237
13238
13239
13240
13241 override void SetColor(
int r,
int g,
int b,
int a)
13242 {
13248 }
13250 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13251 {
13256 }
13257
13259 {
13261 }
13262
13265 {
13266 int r,g,b,a;
13268 r = r/255;
13269 g = g/255;
13270 b = b/255;
13271 a = a/255;
13272 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13273 }
13274
13275
13276
13277 override void SetLiquidType(
int value,
bool allow_client =
false)
13278 {
13279 if (!IsServerCheck(allow_client))
13280 return;
13281
13286 }
13287
13289 {
13290 return ConfigGetInt("varLiquidTypeInit");
13291 }
13292
13294 {
13296 }
13297
13299 {
13301 SetFrozen(false);
13302 }
13303
13306 {
13307 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13308 }
13309
13310
13313 {
13314 PlayerBase nplayer;
13315 if (PlayerBase.CastTo(nplayer, player))
13316 {
13318 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13319 }
13320 }
13321
13322
13325 {
13326 PlayerBase nplayer;
13327 if (PlayerBase.CastTo(nplayer,player))
13328 {
13329 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13330 }
13331
13332 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13333
13334 if (HasEnergyManager())
13335 {
13336 GetCompEM().UpdatePlugState();
13337 }
13338 }
13339
13340
13342 {
13343 super.OnPlacementStarted(player);
13344
13346 }
13347
13348 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13349 {
13351 {
13352 m_AdminLog.OnPlacementComplete(player,
this);
13353 }
13354
13355 super.OnPlacementComplete(player, position, orientation);
13356 }
13357
13358
13359
13360
13361
13363 {
13365 {
13366 return true;
13367 }
13368 else
13369 {
13370 return false;
13371 }
13372 }
13373
13374
13376 {
13378 {
13380 }
13381 }
13382
13383
13385 {
13387 }
13388
13390 {
13392 }
13393
13394 override void InsertAgent(
int agent,
float count = 1)
13395 {
13396 if (count < 1)
13397 return;
13398
13400 }
13401
13404 {
13406 }
13407
13408
13410 {
13412 }
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
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
13456 {
13458 return false;
13459 return true;
13460 }
13461
13463 {
13464
13466 }
13467
13468
13471 {
13472 super.CheckForRoofLimited(timeTresholdMS);
13473
13474 float time =
g_Game.GetTime();
13475 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13476 {
13477 m_PreviousRoofTestTime = time;
13478 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13479 }
13480 }
13481
13482
13484 {
13486 {
13487 return 0;
13488 }
13489
13490 if (GetInventory().GetAttachmentSlotsCount() != 0)
13491 {
13492 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13493 if (filter)
13494 return filter.GetProtectionLevel(type, false, system);
13495 else
13496 return 0;
13497 }
13498
13499 string subclassPath, entryName;
13500
13501 switch (type)
13502 {
13504 entryName = "biological";
13505 break;
13507 entryName = "chemical";
13508 break;
13509 default:
13510 entryName = "biological";
13511 break;
13512 }
13513
13514 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13515
13516 return g_Game.ConfigGetFloat(subclassPath + entryName);
13517 }
13518
13519
13520
13523 {
13524 if (!IsMagazine())
13526
13528 }
13529
13530
13531
13532
13533
13538 {
13539 return true;
13540 }
13541
13543 {
13545 }
13546
13547
13548
13549
13550
13552 {
13553 if (parent)
13554 {
13555 if (parent.IsInherited(DayZInfected))
13556 return true;
13557
13558 if (!parent.IsRuined())
13559 return true;
13560 }
13561
13562 return true;
13563 }
13564
13566 {
13567 if (!super.CanPutAsAttachment(parent))
13568 {
13569 return false;
13570 }
13571
13572 if (!IsRuined() && !parent.IsRuined())
13573 {
13574 return true;
13575 }
13576
13577 return false;
13578 }
13579
13581 {
13582
13583
13584
13585
13586 return super.CanReceiveItemIntoCargo(item);
13587 }
13588
13590 {
13591
13592
13593
13594
13595 GameInventory attachmentInv = attachment.GetInventory();
13597 {
13598 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13599 return false;
13600 }
13601
13602 InventoryLocation loc = new InventoryLocation();
13603 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13604 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13605 return false;
13606
13607 return super.CanReceiveAttachment(attachment, slotId);
13608 }
13609
13611 {
13612 if (!super.CanReleaseAttachment(attachment))
13613 return false;
13614
13615 return GetInventory().AreChildrenAccessible();
13616 }
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13639 {
13640 int id = muzzle_owner.GetMuzzleID();
13641 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13642
13643 if (WPOF_array)
13644 {
13645 for (int i = 0; i < WPOF_array.Count(); i++)
13646 {
13647 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13648
13649 if (WPOF)
13650 {
13651 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13652 }
13653 }
13654 }
13655 }
13656
13657
13659 {
13660 int id = muzzle_owner.GetMuzzleID();
13662
13663 if (WPOBE_array)
13664 {
13665 for (int i = 0; i < WPOBE_array.Count(); i++)
13666 {
13667 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13668
13669 if (WPOBE)
13670 {
13671 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13672 }
13673 }
13674 }
13675 }
13676
13677
13679 {
13680 int id = muzzle_owner.GetMuzzleID();
13681 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13682
13683 if (WPOOH_array)
13684 {
13685 for (int i = 0; i < WPOOH_array.Count(); i++)
13686 {
13687 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13688
13689 if (WPOOH)
13690 {
13691 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13692 }
13693 }
13694 }
13695 }
13696
13697
13699 {
13700 int id = muzzle_owner.GetMuzzleID();
13701 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13702
13703 if (WPOOH_array)
13704 {
13705 for (int i = 0; i < WPOOH_array.Count(); i++)
13706 {
13707 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13708
13709 if (WPOOH)
13710 {
13711 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13712 }
13713 }
13714 }
13715 }
13716
13717
13719 {
13720 int id = muzzle_owner.GetMuzzleID();
13721 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13722
13723 if (WPOOH_array)
13724 {
13725 for (int i = 0; i < WPOOH_array.Count(); i++)
13726 {
13727 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13728
13729 if (WPOOH)
13730 {
13731 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13732 }
13733 }
13734 }
13735 }
13736
13737
13738
13740 {
13742 {
13743 return true;
13744 }
13745
13746 return false;
13747 }
13748
13750 {
13752 {
13753 return true;
13754 }
13755
13756 return false;
13757 }
13758
13760 {
13762 {
13763 return true;
13764 }
13765
13766 return false;
13767 }
13768
13770 {
13771 return false;
13772 }
13773
13776 {
13777 return UATimeSpent.DEFAULT_DEPLOY;
13778 }
13779
13780
13781
13782
13784 {
13786 SetSynchDirty();
13787 }
13788
13790 {
13792 }
13793
13794
13796 {
13797 return false;
13798 }
13799
13802 {
13803 string att_type = "None";
13804
13805 if (ConfigIsExisting("soundAttType"))
13806 {
13807 att_type = ConfigGetString("soundAttType");
13808 }
13809
13811 }
13812
13814 {
13816 }
13817
13818
13819
13820
13821
13827
13829 {
13832
13834 }
13835
13836
13838 {
13840 return;
13841
13843
13846
13849
13850 SoundParameters params = new SoundParameters();
13854 }
13855
13856
13858 {
13860 {
13863
13864 SetSynchDirty();
13865
13868 }
13869 }
13870
13872 {
13874 }
13875
13876
13878 {
13880 return;
13881
13883 SetSynchDirty();
13884
13887 }
13888
13890 {
13893 }
13894
13896 {
13898 }
13899
13900 void OnApply(PlayerBase player);
13901
13903 {
13904 return 1.0;
13905 };
13906
13908 {
13910 }
13911
13913 {
13915 }
13916
13918
13920 {
13921 SetDynamicPhysicsLifeTime(0.01);
13923 }
13924
13926 {
13927 array<string> zone_names = new array<string>;
13928 GetDamageZones(zone_names);
13929 for (int i = 0; i < zone_names.Count(); i++)
13930 {
13931 SetHealthMax(zone_names.Get(i),"Health");
13932 }
13933 SetHealthMax("","Health");
13934 }
13935
13938 {
13939 float global_health = GetHealth01("","Health");
13940 array<string> zones = new array<string>;
13941 GetDamageZones(zones);
13942
13943 for (int i = 0; i < zones.Count(); i++)
13944 {
13945 SetHealth01(zones.Get(i),"Health",global_health);
13946 }
13947 }
13948
13951 {
13952 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13953 }
13954
13956 {
13957 if (!hasRootAsPlayer)
13958 {
13959 if (refParentIB)
13960 {
13961
13962 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13963 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13964
13965 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13966 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13967
13970 }
13971 else
13972 {
13973
13976 }
13977 }
13978 }
13979
13981 {
13983 {
13984 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13985 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13986 {
13987 float heatPermCoef = 1.0;
13989 while (ent)
13990 {
13991 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13992 ent = ent.GetHierarchyParent();
13993 }
13994
13995 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13996 }
13997 }
13998 }
13999
14001 {
14002
14003 EntityAI parent = GetHierarchyParent();
14004 if (!parent)
14005 {
14006 hasParent = false;
14007 hasRootAsPlayer = false;
14008 }
14009 else
14010 {
14011 hasParent = true;
14012 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14013 refParentIB =
ItemBase.Cast(parent);
14014 }
14015 }
14016
14017 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14018 {
14019
14020 }
14021
14023 {
14024
14025 return false;
14026 }
14027
14029 {
14030
14031
14032 return false;
14033 }
14034
14036 {
14037
14038 return false;
14039 }
14040
14043 {
14044 return !GetIsFrozen() &&
IsOpen();
14045 }
14046
14048 {
14049 bool hasParent = false, hasRootAsPlayer = false;
14051
14052 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14053 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14054
14055 if (wwtu || foodDecay)
14056 {
14060
14061 if (processWetness || processTemperature || processDecay)
14062 {
14064
14065 if (processWetness)
14066 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14067
14068 if (processTemperature)
14070
14071 if (processDecay)
14072 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14073 }
14074 }
14075 }
14076
14079 {
14081 }
14082
14084 {
14087
14088 return super.GetTemperatureFreezeThreshold();
14089 }
14090
14092 {
14095
14096 return super.GetTemperatureThawThreshold();
14097 }
14098
14100 {
14103
14104 return super.GetItemOverheatThreshold();
14105 }
14106
14108 {
14110 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14111
14112 return super.GetTemperatureFreezeTime();
14113 }
14114
14116 {
14118 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14119
14120 return super.GetTemperatureThawTime();
14121 }
14122
14127
14129 {
14130 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14131 }
14132
14134 {
14135 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14136 }
14137
14140 {
14142 }
14143
14145 {
14147 }
14148
14150 {
14152 }
14153
14156 {
14157 return null;
14158 }
14159
14162 {
14163 return false;
14164 }
14165
14167 {
14169 {
14172 if (!trg)
14173 {
14175 explosive = this;
14176 }
14177
14178 explosive.PairRemote(trg);
14180
14181 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14182 trg.SetPersistentPairID(persistentID);
14183 explosive.SetPersistentPairID(persistentID);
14184
14185 return true;
14186 }
14187 return false;
14188 }
14189
14192 {
14193 float ret = 1.0;
14196 ret *= GetHealth01();
14197
14198 return ret;
14199 }
14200
14201 #ifdef DEVELOPER
14202 override void SetDebugItem()
14203 {
14204 super.SetDebugItem();
14205 _itemBase = this;
14206 }
14207
14209 {
14210 string text = super.GetDebugText();
14211
14213 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14214
14215 return text;
14216 }
14217 #endif
14218
14220 {
14221 return true;
14222 }
14223
14225
14227
14229 {
14232 }
14233
14234
14242
14258
14259 [
Obsolete(
"Use ItemSoundHandler instead")]
14262 {
14263 if (!
g_Game.IsDedicatedServer())
14264 {
14265 if (ConfigIsExisting("attachSoundSet"))
14266 {
14267 string cfg_path = "";
14268 string soundset = "";
14269 string type_name =
GetType();
14270
14273 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14274 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14275
14276 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14277 {
14278 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14279 {
14280 if (cfg_slot_array[i] == slot_type)
14281 {
14282 soundset = cfg_soundset_array[i];
14283 break;
14284 }
14285 }
14286 }
14287
14288 if (soundset != "")
14289 {
14290 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14292 }
14293 }
14294 }
14295 }
14296
14298}
14299
14301{
14303 if (entity)
14304 {
14305 bool is_item = entity.IsInherited(
ItemBase);
14306 if (is_item && full_quantity)
14307 {
14310 }
14311 }
14312 else
14313 {
14315 return NULL;
14316 }
14317 return entity;
14318}
14319
14321{
14322 if (item)
14323 {
14324 if (health > 0)
14325 item.SetHealth("", "", health);
14326
14327 if (item.CanHaveTemperature())
14328 {
14330 if (item.CanFreeze())
14331 item.SetFrozen(false);
14332 }
14333
14334 if (item.HasEnergyManager())
14335 {
14336 if (quantity >= 0)
14337 {
14338 item.GetCompEM().SetEnergy0To1(quantity);
14339 }
14340 else
14341 {
14343 }
14344 }
14345 else if (item.IsMagazine())
14346 {
14347 Magazine mag = Magazine.Cast(item);
14348 if (quantity >= 0)
14349 {
14350 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14351 }
14352 else
14353 {
14355 }
14356
14357 }
14358 else
14359 {
14360 if (quantity >= 0)
14361 {
14362 item.SetQuantityNormalized(quantity, false);
14363 }
14364 else
14365 {
14367 }
14368
14369 }
14370 }
14371}
14372
14373#ifdef DEVELOPER
14375#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.