9418{
9420 {
9421 return true;
9422 }
9423};
9424
9426{
9427
9428};
9429
9430
9431
9433{
9437
9439
9442
9443
9444
9445
9446
9455
9461
9466
9471
9492 protected bool m_IsResultOfSplit
9493
9495
9500
9501
9502
9504
9508
9509
9510
9512
9515
9516
9517
9523
9524
9532
9535
9536
9538
9539
9541
9542
9547
9548
9553
9555
9556
9558
9559
9561 {
9566
9567 if (!
g_Game.IsDedicatedServer())
9568 {
9570 {
9572
9574 {
9576 }
9577 }
9578
9581 }
9582
9583 m_OldLocation = null;
9584
9586 {
9588 }
9589
9590 if (ConfigIsExisting("headSelectionsToHide"))
9591 {
9594 }
9595
9597 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9598 {
9600 }
9601
9603
9604 m_IsResultOfSplit = false;
9605
9607 }
9608
9610 {
9611 super.InitItemVariables();
9612
9618 m_Count = ConfigGetInt(
"count");
9619
9622
9627
9630
9635
9647
9651
9652
9655 if (ConfigIsExisting("canBeSplit"))
9656 {
9659 }
9660
9662 if (ConfigIsExisting("itemBehaviour"))
9664
9665
9668 RegisterNetSyncVariableInt("m_VarLiquidType");
9669 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9670
9671 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9672 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9673 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9674
9675 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9676 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9677 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9678 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9679
9680 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9681 RegisterNetSyncVariableBool("m_IsTakeable");
9682 RegisterNetSyncVariableBool("m_IsHologram");
9683
9686 {
9689 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9690 }
9691
9693
9695 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9697
9699 }
9700
9702 {
9704 }
9705
9707 {
9710 {
9715 }
9716 }
9717
9718 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9719 {
9721 {
9724 }
9725
9727 }
9728
9730 {
9736 }
9737
9739
9741 {
9743
9744 if (!action)
9745 {
9746 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9747 return;
9748 }
9749
9751 if (!ai)
9752 {
9754 return;
9755 }
9756
9758 if (!action_array)
9759 {
9760 action_array = new array<ActionBase_Basic>;
9762 }
9763 if (LogManager.IsActionLogEnable())
9764 {
9765 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9766 }
9767
9768 if (action_array.Find(action) != -1)
9769 {
9770 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9771 }
9772 else
9773 {
9774 action_array.Insert(action);
9775 }
9776 }
9777
9779 {
9780 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9781 ActionBase action = player.GetActionManager().GetAction(actionName);
9784
9785 if (action_array)
9786 {
9787 action_array.RemoveItem(action);
9788 }
9789 }
9790
9791
9792
9794 {
9795 ActionOverrideData overrideData = new ActionOverrideData();
9799
9801 if (!actionMap)
9802 {
9805 }
9806
9807 actionMap.Insert(this.
Type(), overrideData);
9808
9809 }
9810
9812
9814
9815
9817 {
9820
9823
9824 string config_to_search = "CfgVehicles";
9825 string muzzle_owner_config;
9826
9828 {
9829 if (IsInherited(Weapon))
9830 config_to_search = "CfgWeapons";
9831
9832 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9833
9834 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9835
9836 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9837
9838 if (config_OnFire_subclass_count > 0)
9839 {
9840 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9841
9842 for (int i = 0; i < config_OnFire_subclass_count; i++)
9843 {
9844 string particle_class = "";
9845 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9846 string config_OnFire_entry = config_OnFire_class + particle_class;
9847 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9848 WPOF_array.Insert(WPOF);
9849 }
9850
9851
9853 }
9854 }
9855
9857 {
9858 config_to_search = "CfgWeapons";
9859 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9860
9861 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9862
9863 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9864
9865 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9866 {
9867 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9868
9869 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9870 {
9871 string particle_class2 = "";
9872 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9873 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9874 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9875 WPOBE_array.Insert(WPOBE);
9876 }
9877
9878
9880 }
9881 }
9882 }
9883
9884
9886 {
9889
9891 {
9892 string config_to_search = "CfgVehicles";
9893
9894 if (IsInherited(Weapon))
9895 config_to_search = "CfgWeapons";
9896
9897 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9898 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9899
9900 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9901 {
9902
9904
9906 {
9908 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9910 return;
9911 }
9912
9915
9916
9917
9918 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9919 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9920
9921 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9922 {
9923 string particle_class = "";
9924 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9925 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9926 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9927
9928 if (entry_type == CT_CLASS)
9929 {
9930 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9931 WPOOH_array.Insert(WPOF);
9932 }
9933 }
9934
9935
9937 }
9938 }
9939 }
9940
9942 {
9944 }
9945
9947 {
9949 {
9951
9954
9957
9958 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9959 }
9960 }
9961
9963 {
9965 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9966
9968 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9969
9971 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9972
9974 {
9976 }
9977 }
9978
9980 {
9982 }
9983
9985 {
9988 else
9990
9992 {
9995 }
9996 else
9997 {
10000
10003 }
10004
10006 }
10007
10009 {
10011 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10012 }
10013
10015 {
10017 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10019 }
10020
10022 {
10024 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10025 }
10026
10028 {
10031
10032 OverheatingParticle OP = new OverheatingParticle();
10037
10039 }
10040
10042 {
10045
10046 return -1;
10047 }
10048
10050 {
10052 {
10055
10056 for (int i = count; i > 0; --i)
10057 {
10058 int id = i - 1;
10061
10064
10065 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10066 {
10067 if (p)
10068 {
10071 }
10072 }
10073 }
10074 }
10075 }
10076
10078 {
10080 {
10082 {
10083 int id = i - 1;
10085
10086 if (OP)
10087 {
10089
10090 if (p)
10091 {
10093 }
10094
10095 delete OP;
10096 }
10097 }
10098
10101 }
10102 }
10103
10106 {
10107 return 0.0;
10108 }
10109
10110
10112 {
10113 return 250;
10114 }
10115
10117 {
10118 return 0;
10119 }
10120
10123 {
10125 return true;
10126
10127 return false;
10128 }
10129
10132 {
10135
10137 {
10139 }
10140 else
10141 {
10142
10144 }
10145
10147 }
10148
10155 {
10156 return -1;
10157 }
10158
10159
10160
10161
10163 {
10165 {
10166 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10167 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10168
10169 if (r_index >= 0)
10170 {
10171 InventoryLocation r_il = new InventoryLocation;
10172 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10173
10174 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10177 {
10178 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10179 }
10181 {
10182 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10183 }
10184
10185 }
10186
10187 player.GetHumanInventory().ClearUserReservedLocation(this);
10188 }
10189
10192 }
10193
10194
10195
10196
10198 {
10199 return ItemBase.m_DebugActionsMask;
10200 }
10201
10203 {
10204 return ItemBase.m_DebugActionsMask & mask;
10205 }
10206
10208 {
10209 ItemBase.m_DebugActionsMask = mask;
10210 }
10211
10213 {
10214 ItemBase.m_DebugActionsMask |= mask;
10215 }
10216
10218 {
10219 ItemBase.m_DebugActionsMask &= ~mask;
10220 }
10221
10223 {
10225 {
10227 }
10228 else
10229 {
10231 }
10232 }
10233
10234
10236 {
10237 if (GetEconomyProfile())
10238 {
10239 float q_max = GetEconomyProfile().GetQuantityMax();
10240 if (q_max > 0)
10241 {
10242 float q_min = GetEconomyProfile().GetQuantityMin();
10243 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10244
10246 {
10247 ComponentEnergyManager comp = GetCompEM();
10249 {
10251 }
10252 }
10254 {
10256
10257 }
10258
10259 }
10260 }
10261 }
10262
10265 {
10266 EntityAI parent = GetHierarchyParent();
10267
10268 if (parent)
10269 {
10270 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10271 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10272 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10273 }
10274 }
10275
10278 {
10279 EntityAI parent = GetHierarchyParent();
10280
10281 if (parent)
10282 {
10283 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10284 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10285 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10286 }
10287 }
10288
10290 {
10291
10292
10293
10294
10296
10298 {
10299 if (ScriptInputUserData.CanStoreInputUserData())
10300 {
10301 ScriptInputUserData ctx = new ScriptInputUserData;
10307 ctx.
Write(use_stack_max);
10310
10312 {
10313 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10314 }
10315 }
10316 }
10317 else if (!
g_Game.IsMultiplayer())
10318 {
10320 }
10321 }
10322
10324 {
10326 }
10327
10329 {
10331 }
10332
10334 {
10336 }
10337
10339 {
10340
10341 return false;
10342 }
10343
10345 {
10346 return false;
10347 }
10348
10352 {
10353 return false;
10354 }
10355
10357 {
10358 return "";
10359 }
10360
10362
10364 {
10365 return false;
10366 }
10367
10369 {
10370 return true;
10371 }
10372
10373
10374
10376 {
10377 return true;
10378 }
10379
10381 {
10382 return true;
10383 }
10384
10386 {
10387 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10389 }
10390
10392 {
10394 }
10395
10397 {
10399 if (!is_being_placed)
10401 SetSynchDirty();
10402 }
10403
10404
10406
10408 {
10410 }
10411
10413 {
10415 }
10416
10418 {
10419 return 1;
10420 }
10421
10423 {
10424 return false;
10425 }
10426
10428 {
10430 SetSynchDirty();
10431 }
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10468 {
10469 super.OnMovedInsideCargo(container);
10470
10471 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10472 }
10473
10474 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10475 {
10476 super.EEItemLocationChanged(oldLoc, newLoc);
10477
10478 PlayerBase newPlayer = null;
10479 PlayerBase oldPlayer = null;
10480
10481 if (newLoc.GetParent())
10482 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10483
10484 if (oldLoc.GetParent())
10485 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10486
10488 {
10489 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10490
10491 if (rIndex >= 0)
10492 {
10493 InventoryLocation rIl = new InventoryLocation;
10494 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10495
10496 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10499 {
10500 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10501 }
10503 {
10505 }
10506
10507 }
10508 }
10509
10511 {
10512 if (newPlayer)
10513 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10514
10515 if (newPlayer == oldPlayer)
10516 {
10517 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10518 {
10520 {
10521 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10522 {
10523 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10524 }
10525 }
10526 else
10527 {
10528 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10529 }
10530 }
10531
10532 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10533 {
10534 int type = oldLoc.GetType();
10536 {
10537 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10538 }
10540 {
10541 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10542 }
10543 }
10544 if (!m_OldLocation)
10545 {
10546 m_OldLocation = new InventoryLocation;
10547 }
10548 m_OldLocation.Copy(oldLoc);
10549 }
10550 else
10551 {
10552 if (m_OldLocation)
10553 {
10554 m_OldLocation.Reset();
10555 }
10556 }
10557
10558 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10559 }
10560 else
10561 {
10562 if (newPlayer)
10563 {
10564 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10565 if (resIndex >= 0)
10566 {
10567 InventoryLocation il = new InventoryLocation;
10568 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10570 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10573 {
10574 il.
GetParent().GetOnReleaseLock().Invoke(it);
10575 }
10577 {
10579 }
10580
10581 }
10582 }
10584 {
10585
10587 }
10588
10589 if (m_OldLocation)
10590 {
10591 m_OldLocation.Reset();
10592 }
10593 }
10594
10596 {
10597 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10598 }
10599
10601 {
10602 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10603 }
10604 }
10605
10606 override void EOnContact(IEntity other, Contact extra)
10607 {
10609 {
10610 int liquidType = -1;
10612 if (impactSpeed > 0.0)
10613 {
10615 #ifndef SERVER
10617 #else
10619 SetSynchDirty();
10620 #endif
10622 }
10623 }
10624
10625 #ifdef SERVER
10626 if (GetCompEM() && GetCompEM().IsPlugged())
10627 {
10628 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10629 GetCompEM().UnplugThis();
10630 }
10631 #endif
10632 }
10633
10635
10637 {
10639 }
10640
10642 {
10643
10644 }
10645
10647 {
10648 super.OnItemLocationChanged(old_owner, new_owner);
10649
10650 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10651 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10652
10653 if (!relatedPlayer && playerNew)
10654 relatedPlayer = playerNew;
10655
10656 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10657 {
10659 if (actionMgr)
10660 {
10661 ActionBase currentAction = actionMgr.GetRunningAction();
10662 if (currentAction)
10664 }
10665 }
10666
10667 Man ownerPlayerOld = null;
10668 Man ownerPlayerNew = null;
10669
10670 if (old_owner)
10671 {
10672 if (old_owner.
IsMan())
10673 {
10674 ownerPlayerOld = Man.Cast(old_owner);
10675 }
10676 else
10677 {
10678 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10679 }
10680 }
10681 else
10682 {
10684 {
10686
10687 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10688 {
10689 GetCompEM().UnplugThis();
10690 }
10691 }
10692 }
10693
10694 if (new_owner)
10695 {
10696 if (new_owner.
IsMan())
10697 {
10698 ownerPlayerNew = Man.Cast(new_owner);
10699 }
10700 else
10701 {
10702 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10703 }
10704 }
10705
10706 if (ownerPlayerOld != ownerPlayerNew)
10707 {
10708 if (ownerPlayerOld)
10709 {
10710 array<EntityAI> subItemsExit = new array<EntityAI>;
10712 for (int i = 0; i < subItemsExit.Count(); i++)
10713 {
10716 }
10717 }
10718
10719 if (ownerPlayerNew)
10720 {
10721 array<EntityAI> subItemsEnter = new array<EntityAI>;
10723 for (int j = 0; j < subItemsEnter.Count(); j++)
10724 {
10727 }
10728 }
10729 }
10730 else if (ownerPlayerNew != null)
10731 {
10732 PlayerBase nplayer;
10733 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10734 {
10735 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10737 for (int k = 0; k < subItemsUpdate.Count(); k++)
10738 {
10740 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10741 }
10742 }
10743 }
10744
10745 if (old_owner)
10746 old_owner.OnChildItemRemoved(this);
10747 if (new_owner)
10748 new_owner.OnChildItemReceived(this);
10749 }
10750
10751
10753 {
10754 super.EEDelete(parent);
10755 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10756 if (player)
10757 {
10759
10760 if (player.IsAlive())
10761 {
10762 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10763 if (r_index >= 0)
10764 {
10765 InventoryLocation r_il = new InventoryLocation;
10766 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10767
10768 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10771 {
10772 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10773 }
10775 {
10776 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10777 }
10778
10779 }
10780
10781 player.RemoveQuickBarEntityShortcut(this);
10782 }
10783 }
10784 }
10785
10787 {
10788 super.EEKilled(killer);
10789
10792 {
10793 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10794 {
10795 if (IsMagazine())
10796 {
10797 if (Magazine.Cast(this).GetAmmoCount() > 0)
10798 {
10800 }
10801 }
10802 else
10803 {
10805 }
10806 }
10807 }
10808 }
10809
10811 {
10812 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10813
10814 super.OnWasAttached(parent, slot_id);
10815
10818
10821 }
10822
10824 {
10825 super.OnWasDetached(parent, slot_id);
10826
10829
10832 }
10833
10835 {
10836 int idx;
10839
10840 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10841 if (inventory_slots.Count() < 1)
10842 {
10843 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10844 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10845 }
10846 else
10847 {
10848 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10849 }
10850
10851 idx = inventory_slots.Find(slot);
10852 if (idx < 0)
10853 return "";
10854
10855 return attach_types.Get(idx);
10856 }
10857
10859 {
10860 int idx = -1;
10861 string slot;
10862
10865
10866 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10867 if (inventory_slots.Count() < 1)
10868 {
10869 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10870 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10871 }
10872 else
10873 {
10874 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10875 if (detach_types.Count() < 1)
10876 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10877 }
10878
10879 for (int i = 0; i < inventory_slots.Count(); i++)
10880 {
10881 slot = inventory_slots.Get(i);
10882 }
10883
10884 if (slot != "")
10885 {
10886 if (detach_types.Count() == 1)
10887 idx = 0;
10888 else
10889 idx = inventory_slots.Find(slot);
10890 }
10891 if (idx < 0)
10892 return "";
10893
10894 return detach_types.Get(idx);
10895 }
10896
10898 {
10899
10901
10902
10903 float min_time = 1;
10904 float max_time = 3;
10905 float delay = Math.RandomFloat(min_time, max_time);
10906
10907 explode_timer.Run(delay, this, "DoAmmoExplosion");
10908 }
10909
10911 {
10912 Magazine magazine = Magazine.Cast(this);
10913 int pop_sounds_count = 6;
10914 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10915
10916
10917 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10918 string sound_name = pop_sounds[ sound_idx ];
10919 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10920
10921
10922 magazine.ServerAddAmmoCount(-1);
10923
10924
10925 float min_temp_to_explode = 100;
10926
10927 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10928 {
10930 }
10931 }
10932
10933
10934 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10935 {
10936 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10937
10938 const int CHANCE_DAMAGE_CARGO = 4;
10939 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10940 const int CHANCE_DAMAGE_NOTHING = 2;
10941
10943 {
10944 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10945 int chances;
10946 int rnd;
10947
10948 if (GetInventory().GetCargo())
10949 {
10950 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10951 rnd = Math.RandomInt(0,chances);
10952
10953 if (rnd < CHANCE_DAMAGE_CARGO)
10954 {
10956 }
10957 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10958 {
10960 }
10961 }
10962 else
10963 {
10964 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10965 rnd = Math.RandomInt(0,chances);
10966
10967 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10968 {
10970 }
10971 }
10972 }
10973 }
10974
10976 {
10977 CargoBase cargo = GetInventory().GetCargo();
10978 if (cargo)
10979 {
10981 if (item_count > 0)
10982 {
10983 int random_pick = Math.RandomInt(0, item_count);
10985 if (!item.IsExplosive())
10986 {
10987 item.AddHealth("","",damage);
10988 return true;
10989 }
10990 }
10991 }
10992 return false;
10993 }
10994
10996 {
10997 GameInventory inventory = GetInventory();
10999 if (attachment_count > 0)
11000 {
11001 int random_pick = Math.RandomInt(0, attachment_count);
11003 if (!attachment.IsExplosive())
11004 {
11005 attachment.AddHealth("","",damage);
11006 return true;
11007 }
11008 }
11009 return false;
11010 }
11011
11013 {
11015 }
11016
11018 {
11020 return GetInventory().CanRemoveEntity();
11021
11022 return false;
11023 }
11024
11026 {
11027
11029 return false;
11030
11031
11033 return false;
11034
11035
11036
11038 if (delta == 0)
11039 return false;
11040
11041
11042 return true;
11043 }
11044
11046 {
11048 {
11049 if (ScriptInputUserData.CanStoreInputUserData())
11050 {
11051 ScriptInputUserData ctx = new ScriptInputUserData;
11056 ctx.
Write(destination_entity);
11058 ctx.
Write(slot_id);
11060 }
11061 }
11062 else if (!
g_Game.IsMultiplayer())
11063 {
11065 }
11066 }
11067
11069 {
11070 float split_quantity_new;
11074 InventoryLocation loc = new InventoryLocation;
11075
11076 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11077 {
11079 split_quantity_new = stack_max;
11080 else
11082
11084 {
11085 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11086 if (new_item)
11087 {
11088 new_item.SetResultOfSplit(true);
11089 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11091 new_item.
SetQuantity(split_quantity_new,
false,
true);
11092 }
11093 }
11094 }
11095 else if (destination_entity && slot_id == -1)
11096 {
11097 if (quantity > stack_max)
11098 split_quantity_new = stack_max;
11099 else
11100 split_quantity_new = quantity;
11101
11103 {
11104 GameInventory destinationInventory = destination_entity.GetInventory();
11106 {
11109 }
11110
11111 if (new_item)
11112 {
11113 new_item.SetResultOfSplit(true);
11114 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11116 new_item.
SetQuantity(split_quantity_new,
false,
true);
11117 }
11118 }
11119 }
11120 else
11121 {
11122 if (stack_max != 0)
11123 {
11125 {
11127 }
11128
11129 if (split_quantity_new == 0)
11130 {
11131 if (!
g_Game.IsMultiplayer())
11132 player.PhysicalPredictiveDropItem(this);
11133 else
11134 player.ServerDropEntity(this);
11135 return;
11136 }
11137
11139 {
11141
11142 if (new_item)
11143 {
11144 new_item.SetResultOfSplit(true);
11145 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11148 new_item.PlaceOnSurface();
11149 }
11150 }
11151 }
11152 }
11153 }
11154
11156 {
11157 float split_quantity_new;
11161 InventoryLocation loc = new InventoryLocation;
11162
11163 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11164 {
11166 split_quantity_new = stack_max;
11167 else
11169
11171 {
11172 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11173 if (new_item)
11174 {
11175 new_item.SetResultOfSplit(true);
11176 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11178 new_item.
SetQuantity(split_quantity_new,
false,
true);
11179 }
11180 }
11181 }
11182 else if (destination_entity && slot_id == -1)
11183 {
11184 if (quantity > stack_max)
11185 split_quantity_new = stack_max;
11186 else
11187 split_quantity_new = quantity;
11188
11190 {
11191 GameInventory destinationInventory = destination_entity.GetInventory();
11193 {
11196 }
11197
11198 if (new_item)
11199 {
11200 new_item.SetResultOfSplit(true);
11201 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11203 new_item.
SetQuantity(split_quantity_new,
false,
true);
11204 }
11205 }
11206 }
11207 else
11208 {
11209 if (stack_max != 0)
11210 {
11212 {
11214 }
11215
11217 {
11219
11220 if (new_item)
11221 {
11222 new_item.SetResultOfSplit(true);
11223 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11226 new_item.PlaceOnSurface();
11227 }
11228 }
11229 }
11230 }
11231 }
11232
11234 {
11236 {
11237 if (ScriptInputUserData.CanStoreInputUserData())
11238 {
11239 ScriptInputUserData ctx = new ScriptInputUserData;
11244 dst.WriteToContext(ctx);
11246 }
11247 }
11248 else if (!
g_Game.IsMultiplayer())
11249 {
11251 }
11252 }
11253
11255 {
11257 {
11258 if (ScriptInputUserData.CanStoreInputUserData())
11259 {
11260 ScriptInputUserData ctx = new ScriptInputUserData;
11265 ctx.
Write(destination_entity);
11271 }
11272 }
11273 else if (!
g_Game.IsMultiplayer())
11274 {
11276 }
11277 }
11278
11280 {
11282 }
11283
11285 {
11287 float split_quantity_new;
11289 if (dst.IsValid())
11290 {
11291 int slot_id = dst.GetSlot();
11293
11294 if (quantity > stack_max)
11295 split_quantity_new = stack_max;
11296 else
11297 split_quantity_new = quantity;
11298
11300 {
11302
11303 if (new_item)
11304 {
11305 new_item.SetResultOfSplit(true);
11306 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11308 new_item.
SetQuantity(split_quantity_new,
false,
true);
11309 }
11310
11311 return new_item;
11312 }
11313 }
11314
11315 return null;
11316 }
11317
11319 {
11321 float split_quantity_new;
11323 if (destination_entity)
11324 {
11326 if (quantity > stackable)
11327 split_quantity_new = stackable;
11328 else
11329 split_quantity_new = quantity;
11330
11332 {
11333 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11334 if (new_item)
11335 {
11336 new_item.SetResultOfSplit(true);
11337 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11339 new_item.
SetQuantity(split_quantity_new,
false,
true);
11340 }
11341 }
11342 }
11343 }
11344
11346 {
11348 {
11349 if (ScriptInputUserData.CanStoreInputUserData())
11350 {
11351 ScriptInputUserData ctx = new ScriptInputUserData;
11356 ItemBase destination_entity =
this;
11357 ctx.
Write(destination_entity);
11361 }
11362 }
11363 else if (!
g_Game.IsMultiplayer())
11364 {
11366 }
11367 }
11368
11370 {
11372 float split_quantity_new;
11374 if (player)
11375 {
11377 if (quantity > stackable)
11378 split_quantity_new = stackable;
11379 else
11380 split_quantity_new = quantity;
11381
11383 {
11384 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11385 new_item =
ItemBase.Cast(in_hands);
11386 if (new_item)
11387 {
11388 new_item.SetResultOfSplit(true);
11389 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11391 new_item.SetQuantity(split_quantity_new, false, true);
11392 }
11393 }
11394 }
11395 }
11396
11398 {
11400 float split_quantity_new = Math.Floor(quantity * 0.5);
11401
11403 return;
11404
11406
11407 if (new_item)
11408 {
11409 if (new_item.GetQuantityMax() < split_quantity_new)
11410 {
11411 split_quantity_new = new_item.GetQuantityMax();
11412 }
11413
11414 new_item.SetResultOfSplit(true);
11415 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11416
11418 {
11421 }
11422 else
11423 {
11425 new_item.
SetQuantity(split_quantity_new,
false,
true);
11426 }
11427 }
11428 }
11429
11431 {
11433 float split_quantity_new = Math.Floor(quantity / 2);
11434
11436 return;
11437
11438 InventoryLocation invloc = new InventoryLocation;
11440
11442 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11443
11444 if (new_item)
11445 {
11446 if (new_item.GetQuantityMax() < split_quantity_new)
11447 {
11448 split_quantity_new = new_item.GetQuantityMax();
11449 }
11451 {
11454 }
11455 else if (split_quantity_new > 1)
11456 {
11458 new_item.
SetQuantity(split_quantity_new,
false,
true);
11459 }
11460 }
11461 }
11462
11465 {
11466 SetWeightDirty();
11468
11469 if (parent)
11470 parent.OnAttachmentQuantityChangedEx(this, delta);
11471
11473 {
11475 {
11477 }
11479 {
11480 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11482 }
11483 }
11484 }
11485
11488 {
11489
11490 }
11491
11494 {
11496 }
11497
11499 {
11500 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11501
11503 {
11504 if (newLevel == GameConstants.STATE_RUINED)
11505 {
11507 EntityAI parent = GetHierarchyParent();
11508 if (parent && parent.IsFireplace())
11509 {
11510 CargoBase cargo = GetInventory().GetCargo();
11511 if (cargo)
11512 {
11514 {
11516 }
11517 }
11518 }
11519 }
11520
11522 {
11523
11525 return;
11526 }
11527
11528 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11529 {
11531 }
11532 }
11533 }
11534
11535
11537 {
11538 super.OnRightClick();
11539
11541 {
11543 {
11544 if (ScriptInputUserData.CanStoreInputUserData())
11545 {
11546 EntityAI root = GetHierarchyRoot();
11547 Man playerOwner = GetHierarchyRootPlayer();
11548 InventoryLocation dst = new InventoryLocation;
11549
11550
11551 if (!playerOwner && root && root == this)
11552 {
11554 }
11555 else
11556 {
11557
11558 GetInventory().GetCurrentInventoryLocation(dst);
11560 {
11561 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11563 {
11565 }
11566 else
11567 {
11569
11570
11571 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11572 {
11574 }
11575 else
11576 {
11577 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11578 }
11579 }
11580 }
11581 }
11582
11583 ScriptInputUserData ctx = new ScriptInputUserData;
11591 }
11592 }
11593 else if (!
g_Game.IsMultiplayer())
11594 {
11596 }
11597 }
11598 }
11599
11601 {
11602 if (root)
11603 {
11604 vector m4[4];
11605 root.GetTransform(m4);
11606 dst.SetGround(this, m4);
11607 }
11608 else
11609 {
11610 GetInventory().GetCurrentInventoryLocation(dst);
11611 }
11612 }
11613
11614 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11615 {
11616
11617 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11618 return false;
11619
11620 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11621 return false;
11622
11623
11625 return false;
11626
11627
11628 Magazine mag = Magazine.Cast(this);
11629 if (mag)
11630 {
11631 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11632 return false;
11633
11634 if (stack_max_limit)
11635 {
11636 Magazine other_mag = Magazine.Cast(other_item);
11637 if (other_item)
11638 {
11639 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11640 return false;
11641 }
11642
11643 }
11644 }
11645 else
11646 {
11647
11649 return false;
11650
11652 return false;
11653 }
11654
11655 PlayerBase player = null;
11656 if (CastTo(player, GetHierarchyRootPlayer()))
11657 {
11658 if (player.GetInventory().HasAttachment(this))
11659 return false;
11660
11661 if (player.IsItemsToDelete())
11662 return false;
11663 }
11664
11665 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11666 return false;
11667
11668 int slotID;
11670 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11671 return false;
11672
11673 return true;
11674 }
11675
11677 {
11679 }
11680
11682 {
11683 return m_IsResultOfSplit;
11684 }
11685
11687 {
11688 m_IsResultOfSplit = value;
11689 }
11690
11692 {
11694 }
11695
11697 {
11698 float other_item_quantity = other_item.GetQuantity();
11699 float this_free_space;
11700
11702
11704
11705 if (other_item_quantity > this_free_space)
11706 {
11707 return this_free_space;
11708 }
11709 else
11710 {
11711 return other_item_quantity;
11712 }
11713 }
11714
11716 {
11718 }
11719
11721 {
11723 return;
11724
11725 if (!IsMagazine() && other_item)
11726 {
11728 if (quantity_used != 0)
11729 {
11730 float hp1 = GetHealth01("","");
11731 float hp2 = other_item.GetHealth01("","");
11732 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11733 hpResult = hpResult / (
GetQuantity() + quantity_used);
11734
11735 hpResult *= GetMaxHealth();
11736 Math.Round(hpResult);
11737 SetHealth("", "Health", hpResult);
11738
11740 other_item.AddQuantity(-quantity_used);
11741 }
11742 }
11744 }
11745
11747 {
11748 #ifdef SERVER
11749 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11750 GetHierarchyParent().IncreaseLifetimeUp();
11751 #endif
11752 };
11753
11755 {
11756 PlayerBase p = PlayerBase.Cast(player);
11757
11758 array<int> recipesIds = p.m_Recipes;
11759 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11760 if (moduleRecipesManager)
11761 {
11762 EntityAI itemInHands = player.GetEntityInHands();
11763 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11764 }
11765
11766 for (int i = 0;i < recipesIds.Count(); i++)
11767 {
11768 int key = recipesIds.Get(i);
11769 string recipeName = moduleRecipesManager.GetRecipeName(key);
11771 }
11772 }
11773
11774
11775 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11776 {
11777 super.GetDebugActions(outputList);
11778
11779
11785
11786
11791
11796
11797
11801
11802
11804 {
11808 }
11809
11812
11813
11817
11819
11820 InventoryLocation loc = new InventoryLocation();
11821 GetInventory().GetCurrentInventoryLocation(loc);
11823 {
11824 if (Gizmo_IsSupported())
11827 }
11828
11830 }
11831
11832
11833
11834
11836 {
11837 super.OnAction(action_id, player, ctx);
11838
11840 {
11841 switch (action_id)
11842 {
11846 return true;
11850 return true;
11851 }
11852 }
11853
11855 {
11856 switch (action_id)
11857 {
11859 Delete();
11860 return true;
11861 }
11862 }
11863
11864 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11865 {
11866 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11867 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11868 PlayerBase p = PlayerBase.Cast(player);
11869 if (
EActions.RECIPES_RANGE_START < 1000)
11870 {
11871 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11872 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11873 }
11874 }
11875 #ifndef SERVER
11876 else if (action_id ==
EActions.WATCH_PLAYER)
11877 {
11878 PluginDeveloper.SetDeveloperItemClientEx(player);
11879 }
11880 #endif
11882 {
11883 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11884 {
11885 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11886 OnDebugButtonPressServer(id + 1);
11887 }
11888
11889 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11890 {
11891 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11893 }
11894
11895 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11896 {
11897 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11899 }
11900
11901 else if (action_id ==
EActions.ADD_QUANTITY)
11902 {
11903 if (IsMagazine())
11904 {
11905 Magazine mag = Magazine.Cast(this);
11906 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11907 }
11908 else
11909 {
11911 }
11912
11913 if (m_EM)
11914 {
11915 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11916 }
11917
11918 }
11919
11920 else if (action_id ==
EActions.REMOVE_QUANTITY)
11921 {
11922 if (IsMagazine())
11923 {
11924 Magazine mag2 = Magazine.Cast(this);
11925 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11926 }
11927 else
11928 {
11930 }
11931 if (m_EM)
11932 {
11933 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11934 }
11935
11936 }
11937
11938 else if (action_id ==
EActions.SET_QUANTITY_0)
11939 {
11941
11942 if (m_EM)
11943 {
11944 m_EM.SetEnergy(0);
11945 }
11946 }
11947
11948 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11949 {
11951
11952 if (m_EM)
11953 {
11954 m_EM.SetEnergy(m_EM.GetEnergyMax());
11955 }
11956 }
11957
11958 else if (action_id ==
EActions.ADD_HEALTH)
11959 {
11960 AddHealth("","",GetMaxHealth("","Health")/5);
11961 }
11962 else if (action_id ==
EActions.REMOVE_HEALTH)
11963 {
11964 AddHealth("","",-GetMaxHealth("","Health")/5);
11965 }
11966 else if (action_id ==
EActions.DESTROY_HEALTH)
11967 {
11968 SetHealth01("","",0);
11969 }
11970 else if (action_id ==
EActions.WATCH_ITEM)
11971 {
11973 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11974 #ifdef DEVELOPER
11975 SetDebugDeveloper_item(this);
11976 #endif
11977 }
11978
11979 else if (action_id ==
EActions.ADD_TEMPERATURE)
11980 {
11981 AddTemperature(20);
11982
11983 }
11984
11985 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11986 {
11987 AddTemperature(-20);
11988
11989 }
11990
11991 else if (action_id ==
EActions.FLIP_FROZEN)
11992 {
11993 SetFrozen(!GetIsFrozen());
11994
11995 }
11996
11997 else if (action_id ==
EActions.ADD_WETNESS)
11998 {
12000
12001 }
12002
12003 else if (action_id ==
EActions.REMOVE_WETNESS)
12004 {
12006
12007 }
12008
12009 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12010 {
12013
12014
12015 }
12016
12017 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12018 {
12021 }
12022
12023 else if (action_id ==
EActions.MAKE_SPECIAL)
12024 {
12025 auto debugParams = DebugSpawnParams.WithPlayer(player);
12026 OnDebugSpawnEx(debugParams);
12027 }
12028
12029 }
12030
12031
12032 return false;
12033 }
12034
12035
12036
12037
12041
12044
12045
12046
12048 {
12049 return false;
12050 }
12051
12052
12054 {
12055 return true;
12056 }
12057
12058
12060 {
12061 return true;
12062 }
12063
12064
12065
12067 {
12068 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12069 return g_Game.ConfigIsExisting(config_path);
12070 }
12071
12074 {
12075 return null;
12076 }
12077
12079 {
12080 return false;
12081 }
12082
12084 {
12085 return false;
12086 }
12087
12091
12092
12094 {
12095 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12096 return module_repairing.CanRepair(this, item_repair_kit);
12097 }
12098
12099
12100 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12101 {
12102 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12103 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12104 }
12105
12106
12108 {
12109
12110
12111
12112
12113
12114
12115
12116
12117 return 1;
12118 }
12119
12120
12121
12123 {
12125 }
12126
12127
12128
12130 {
12132 }
12133
12134
12143 {
12144 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12145
12146 if (player)
12147 {
12148 player.MessageStatus(text);
12149 }
12150 }
12151
12152
12161 {
12162 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12163
12164 if (player)
12165 {
12166 player.MessageAction(text);
12167 }
12168 }
12169
12170
12179 {
12180 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12181
12182 if (player)
12183 {
12184 player.MessageFriendly(text);
12185 }
12186 }
12187
12188
12197 {
12198 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12199
12200 if (player)
12201 {
12202 player.MessageImportant(text);
12203 }
12204 }
12205
12207 {
12208 return true;
12209 }
12210
12211
12212 override bool KindOf(
string tag)
12213 {
12214 bool found = false;
12215 string item_name = this.
GetType();
12217 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12218
12219 int array_size = item_tag_array.Count();
12220 for (int i = 0; i < array_size; i++)
12221 {
12222 if (item_tag_array.Get(i) == tag)
12223 {
12224 found = true;
12225 break;
12226 }
12227 }
12228 return found;
12229 }
12230
12231
12233 {
12234
12235 super.OnRPC(sender, rpc_type,ctx);
12236
12237
12238 switch (rpc_type)
12239 {
12240 #ifndef SERVER
12241 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12242 Param2<bool, string> p = new Param2<bool, string>(false, "");
12243
12245 return;
12246
12247 bool play = p.param1;
12248 string soundSet = p.param2;
12249
12250 if (play)
12251 {
12253 {
12255 {
12257 }
12258 }
12259 else
12260 {
12262 }
12263 }
12264 else
12265 {
12267 }
12268
12269 break;
12270 #endif
12271
12272 }
12273
12275 {
12277 }
12278 }
12279
12280
12281
12282
12284 {
12285 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12286 return plugin.GetID(
name);
12287 }
12288
12290 {
12291 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12292 return plugin.GetName(id);
12293 }
12294
12297 {
12298
12299
12300 int varFlags;
12301 if (!ctx.
Read(varFlags))
12302 return;
12303
12304 if (varFlags & ItemVariableFlags.FLOAT)
12305 {
12307 }
12308 }
12309
12311 {
12312
12313 super.SerializeNumericalVars(floats_out);
12314
12315
12316
12318 {
12320 }
12321
12323 {
12325 }
12326
12328 {
12330 }
12331
12333 {
12338 }
12339
12341 {
12343 }
12344 }
12345
12347 {
12348
12349 super.DeSerializeNumericalVars(floats);
12350
12351
12352 int index = 0;
12353 int mask = Math.Round(floats.Get(index));
12354
12355 index++;
12356
12358 {
12360 {
12362 }
12363 else
12364 {
12365 float quantity = floats.Get(index);
12366 SetQuantity(quantity,
true,
false,
false,
false);
12367 }
12368 index++;
12369 }
12370
12372 {
12373 float wet = floats.Get(index);
12375 index++;
12376 }
12377
12379 {
12380 int liquidtype = Math.Round(floats.Get(index));
12382 index++;
12383 }
12384
12386 {
12388 index++;
12390 index++;
12392 index++;
12394 index++;
12395 }
12396
12398 {
12399 int cleanness = Math.Round(floats.Get(index));
12401 index++;
12402 }
12403 }
12404
12406 {
12407 super.WriteVarsToCTX(ctx);
12408
12409
12411 {
12413 }
12414
12416 {
12418 }
12419
12421 {
12423 }
12424
12426 {
12427 int r,g,b,a;
12433 }
12434
12436 {
12438 }
12439 }
12440
12442 {
12443 if (!super.ReadVarsFromCTX(ctx,version))
12444 return false;
12445
12446 int intValue;
12447 float value;
12448
12449 if (version < 140)
12450 {
12451 if (!ctx.
Read(intValue))
12452 return false;
12453
12454 m_VariablesMask = intValue;
12455 }
12456
12458 {
12459 if (!ctx.
Read(value))
12460 return false;
12461
12463 {
12465 }
12466 else
12467 {
12469 }
12470 }
12471
12472 if (version < 140)
12473 {
12475 {
12476 if (!ctx.
Read(value))
12477 return false;
12478 SetTemperatureDirect(value);
12479 }
12480 }
12481
12483 {
12484 if (!ctx.
Read(value))
12485 return false;
12487 }
12488
12490 {
12491 if (!ctx.
Read(intValue))
12492 return false;
12494 }
12495
12497 {
12498 int r,g,b,a;
12500 return false;
12502 return false;
12504 return false;
12506 return false;
12507
12509 }
12510
12512 {
12513 if (!ctx.
Read(intValue))
12514 return false;
12516 }
12517
12518 if (version >= 138 && version < 140)
12519 {
12521 {
12522 if (!ctx.
Read(intValue))
12523 return false;
12524 SetFrozen(intValue);
12525 }
12526 }
12527
12528 return true;
12529 }
12530
12531
12533 {
12536 {
12538 }
12539
12540 if (!super.OnStoreLoad(ctx, version))
12541 {
12543 return false;
12544 }
12545
12546 if (version >= 114)
12547 {
12548 bool hasQuickBarIndexSaved;
12549
12550 if (!ctx.
Read(hasQuickBarIndexSaved))
12551 {
12553 return false;
12554 }
12555
12556 if (hasQuickBarIndexSaved)
12557 {
12558 int itmQBIndex;
12559
12560
12561 if (!ctx.
Read(itmQBIndex))
12562 {
12564 return false;
12565 }
12566
12567 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12568 if (itmQBIndex != -1 && parentPlayer)
12569 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12570 }
12571 }
12572 else
12573 {
12574
12575 PlayerBase player;
12576 int itemQBIndex;
12577 if (version ==
int.
MAX)
12578 {
12579 if (!ctx.
Read(itemQBIndex))
12580 {
12582 return false;
12583 }
12584 }
12585 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12586 {
12587
12588 if (!ctx.
Read(itemQBIndex))
12589 {
12591 return false;
12592 }
12593 if (itemQBIndex != -1 && player)
12594 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12595 }
12596 }
12597
12598 if (version < 140)
12599 {
12600
12601 if (!LoadVariables(ctx, version))
12602 {
12604 return false;
12605 }
12606 }
12607
12608
12610 {
12612 return false;
12613 }
12614 if (version >= 132)
12615 {
12617 if (raib)
12618 {
12620 {
12622 return false;
12623 }
12624 }
12625 }
12626
12628 return true;
12629 }
12630
12631
12632
12634 {
12635 super.OnStoreSave(ctx);
12636
12637 PlayerBase player;
12638 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12639 {
12641
12642 int itemQBIndex = -1;
12643 itemQBIndex = player.FindQuickBarEntityIndex(this);
12644 ctx.
Write(itemQBIndex);
12645 }
12646 else
12647 {
12649 }
12650
12652
12654 if (raib)
12655 {
12657 }
12658 }
12659
12660
12662 {
12663 super.AfterStoreLoad();
12664
12666 {
12668 }
12669
12671 {
12674 }
12675 }
12676
12678 {
12679 super.EEOnAfterLoad();
12680
12682 {
12684 }
12685
12688 }
12689
12691 {
12692 return false;
12693 }
12694
12695
12696
12698 {
12700 {
12701 #ifdef PLATFORM_CONSOLE
12702
12704 {
12706 if (menu)
12707 {
12709 }
12710 }
12711 #endif
12712 }
12713
12715 {
12718 }
12719
12721 {
12722 SetWeightDirty();
12724 }
12726 {
12729 }
12730
12732 {
12735
12738 }
12740 {
12744 }
12745
12746 super.OnVariablesSynchronized();
12747 }
12748
12749
12750
12752 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12753 {
12754 if (!IsServerCheck(allow_client))
12755 return false;
12756
12758 return false;
12759
12762
12763 if (value <= (min + 0.001))
12764 value = min;
12765
12766 if (value == min)
12767 {
12768 if (destroy_config)
12769 {
12770 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12771 if (dstr)
12772 {
12774 this.Delete();
12775 return true;
12776 }
12777 }
12778 else if (destroy_forced)
12779 {
12781 this.Delete();
12782 return true;
12783 }
12784
12786 }
12787
12790
12792 {
12793 EntityAI parent = GetHierarchyRoot();
12794 InventoryLocation iLoc = new InventoryLocation();
12795 GetInventory().GetCurrentInventoryLocation(iLoc);
12797 {
12798 int iLocSlot = iLoc.
GetSlot();
12800 {
12802 }
12804 {
12806 }
12807 }
12808 }
12809
12811 {
12813
12814 if (delta)
12816 }
12817
12819
12820 return false;
12821 }
12822
12823
12825 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12826 {
12828 }
12829
12831 {
12834 }
12835
12837 {
12840 }
12841
12843 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12844 {
12845 float value_clamped = Math.Clamp(value, 0, 1);
12847 SetQuantity(result, destroy_config, destroy_forced);
12848 }
12849
12850
12853 {
12855 }
12856
12858 {
12860 }
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12872 {
12873 int slot = -1;
12874 GameInventory inventory = GetInventory();
12875 if (inventory)
12876 {
12877 InventoryLocation il = new InventoryLocation;
12880 }
12881
12883 }
12884
12886 {
12887 float quantity_max = 0;
12888
12890 {
12891 if (attSlotID != -1)
12892 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12893
12894 if (quantity_max <= 0)
12896 }
12897
12898 if (quantity_max <= 0)
12900
12901 return quantity_max;
12902 }
12903
12905 {
12907 }
12908
12910 {
12912 }
12913
12914
12916 {
12918 }
12919
12921 {
12923 }
12924
12926 {
12928 }
12929
12930
12932 {
12933
12934 float weightEx = GetWeightEx();
12935 float special = GetInventoryAndCargoWeight();
12936 return weightEx - special;
12937 }
12938
12939
12941 {
12943 }
12944
12946 {
12948 {
12949 #ifdef DEVELOPER
12950 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12951 {
12952 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12954 }
12955 #endif
12956
12957 return GetQuantity() * GetConfigWeightModified();
12958 }
12959 else if (HasEnergyManager())
12960 {
12961 #ifdef DEVELOPER
12962 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12963 {
12964 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12965 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12966 }
12967 #endif
12968 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12969 }
12970 else
12971 {
12972 #ifdef DEVELOPER
12973 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12974 {
12975 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12976 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12977 }
12978 #endif
12979 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12980 }
12981 }
12982
12985 {
12986 int item_count = 0;
12988
12989 GameInventory inventory = GetInventory();
12990 CargoBase cargo = inventory.
GetCargo();
12991 if (cargo != NULL)
12992 {
12994 }
12995
12997 for (int i = 0; i < nAttachments; ++i)
12998 {
13000 if (item)
13001 item_count += item.GetNumberOfItems();
13002 }
13003 return item_count;
13004 }
13005
13008 {
13009 float weight = 0;
13010 float wetness = 1;
13011 if (include_wetness)
13014 {
13015 weight = wetness * m_ConfigWeight;
13016 }
13018 {
13019 weight = 1;
13020 }
13021 return weight;
13022 }
13023
13024
13025
13027 {
13028 GameInventory inventory = GetInventory();
13029 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13030 {
13031 array<EntityAI> items = new array<EntityAI>;
13033 for (int i = 0; i < items.Count(); ++i)
13034 {
13036 if (item)
13037 {
13038 g_Game.ObjectDelete(item);
13039 }
13040 }
13041 }
13042 }
13043
13044
13045
13046
13048 {
13049 float energy = 0;
13050 if (HasEnergyManager())
13051 {
13052 energy = GetCompEM().GetEnergy();
13053 }
13054 return energy;
13055 }
13056
13057
13059 {
13060 super.OnEnergyConsumed();
13061
13063 }
13064
13066 {
13067 super.OnEnergyAdded();
13068
13070 }
13071
13072
13074 {
13075 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13076 {
13078 {
13079 float energy_0to1 = GetCompEM().GetEnergy0To1();
13081 }
13082 }
13083 }
13084
13085
13087 {
13088 return ConfigGetFloat("heatIsolation");
13089 }
13090
13092 {
13094 }
13095
13097 {
13098 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13099 if (
g_Game.ConfigIsExisting(paramPath))
13100 return g_Game.ConfigGetFloat(paramPath);
13101
13102 return 0.0;
13103 }
13104
13106 {
13107 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13108 if (
g_Game.ConfigIsExisting(paramPath))
13109 return g_Game.ConfigGetFloat(paramPath);
13110
13111 return 0.0;
13112 }
13113
13114 override void SetWet(
float value,
bool allow_client =
false)
13115 {
13116 if (!IsServerCheck(allow_client))
13117 return;
13118
13121
13123
13124 m_VarWet = Math.Clamp(value, min, max);
13125
13127 {
13130 }
13131 }
13132
13133 override void AddWet(
float value)
13134 {
13136 }
13137
13139 {
13141 }
13142
13144 {
13146 }
13147
13149 {
13151 }
13152
13154 {
13156 }
13157
13159 {
13161 }
13162
13163 override void OnWetChanged(
float newVal,
float oldVal)
13164 {
13167 if (newLevel != oldLevel)
13168 {
13170 }
13171 }
13172
13174 {
13175 SetWeightDirty();
13176 }
13177
13179 {
13180 return GetWetLevelInternal(
m_VarWet);
13181 }
13182
13183
13184
13186 {
13188 }
13189
13191 {
13193 }
13194
13196 {
13198 }
13199
13201 {
13203 }
13204
13205
13206
13208 {
13209 if (ConfigIsExisting("itemModelLength"))
13210 {
13211 return ConfigGetFloat("itemModelLength");
13212 }
13213 return 0;
13214 }
13215
13217 {
13218 if (ConfigIsExisting("itemAttachOffset"))
13219 {
13220 return ConfigGetFloat("itemAttachOffset");
13221 }
13222 return 0;
13223 }
13224
13225 override void SetCleanness(
int value,
bool allow_client =
false)
13226 {
13227 if (!IsServerCheck(allow_client))
13228 return;
13229
13231
13233
13236 }
13237
13239 {
13241 }
13242
13244 {
13245 return true;
13246 }
13247
13248
13249
13250
13252 {
13254 }
13255
13257 {
13259 }
13260
13261
13262
13263
13264 override void SetColor(
int r,
int g,
int b,
int a)
13265 {
13271 }
13273 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13274 {
13279 }
13280
13282 {
13284 }
13285
13288 {
13289 int r,g,b,a;
13291 r = r/255;
13292 g = g/255;
13293 b = b/255;
13294 a = a/255;
13295 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13296 }
13297
13298
13299
13300 override void SetLiquidType(
int value,
bool allow_client =
false)
13301 {
13302 if (!IsServerCheck(allow_client))
13303 return;
13304
13309 }
13310
13312 {
13313 return ConfigGetInt("varLiquidTypeInit");
13314 }
13315
13317 {
13319 }
13320
13322 {
13324 SetFrozen(false);
13325 }
13326
13329 {
13330 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13331 }
13332
13333
13336 {
13337 PlayerBase nplayer;
13338 if (PlayerBase.CastTo(nplayer, player))
13339 {
13341 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13342 }
13343 }
13344
13345
13348 {
13349 PlayerBase nplayer;
13350 if (PlayerBase.CastTo(nplayer,player))
13351 {
13352 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13353 }
13354
13355 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13356
13357 if (HasEnergyManager())
13358 {
13359 GetCompEM().UpdatePlugState();
13360 }
13361 }
13362
13363
13365 {
13366 super.OnPlacementStarted(player);
13367
13369 }
13370
13371 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13372 {
13374 {
13375 m_AdminLog.OnPlacementComplete(player,
this);
13376 }
13377
13378 super.OnPlacementComplete(player, position, orientation);
13379 }
13380
13381
13382
13383
13384
13386 {
13388 {
13389 return true;
13390 }
13391 else
13392 {
13393 return false;
13394 }
13395 }
13396
13397
13399 {
13401 {
13403 }
13404 }
13405
13406
13408 {
13410 }
13411
13413 {
13415 }
13416
13417 override void InsertAgent(
int agent,
float count = 1)
13418 {
13419 if (count < 1)
13420 return;
13421
13423 }
13424
13427 {
13429 }
13430
13431
13433 {
13435 }
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13479 {
13481 return false;
13482 return true;
13483 }
13484
13486 {
13487
13489 }
13490
13491
13494 {
13495 super.CheckForRoofLimited(timeTresholdMS);
13496
13497 float time =
g_Game.GetTime();
13498 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13499 {
13500 m_PreviousRoofTestTime = time;
13501 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13502 }
13503 }
13504
13505
13507 {
13509 {
13510 return 0;
13511 }
13512
13513 if (GetInventory().GetAttachmentSlotsCount() != 0)
13514 {
13515 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13516 if (filter)
13517 return filter.GetProtectionLevel(type, false, system);
13518 else
13519 return 0;
13520 }
13521
13522 string subclassPath, entryName;
13523
13524 switch (type)
13525 {
13527 entryName = "biological";
13528 break;
13530 entryName = "chemical";
13531 break;
13532 default:
13533 entryName = "biological";
13534 break;
13535 }
13536
13537 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13538
13539 return g_Game.ConfigGetFloat(subclassPath + entryName);
13540 }
13541
13542
13543
13546 {
13547 if (!IsMagazine())
13549
13551 }
13552
13553
13554
13555
13556
13561 {
13562 return true;
13563 }
13564
13566 {
13568 }
13569
13570
13571
13572
13573
13575 {
13576 if (parent)
13577 {
13578 if (parent.IsInherited(DayZInfected))
13579 return true;
13580
13581 if (!parent.IsRuined())
13582 return true;
13583 }
13584
13585 return true;
13586 }
13587
13589 {
13590 if (!super.CanPutAsAttachment(parent))
13591 {
13592 return false;
13593 }
13594
13595 if (!IsRuined() && !parent.IsRuined())
13596 {
13597 return true;
13598 }
13599
13600 return false;
13601 }
13602
13604 {
13605
13606
13607
13608
13609 return super.CanReceiveItemIntoCargo(item);
13610 }
13611
13613 {
13614
13615
13616
13617
13618 GameInventory attachmentInv = attachment.GetInventory();
13620 {
13621 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13622 return false;
13623 }
13624
13625 InventoryLocation loc = new InventoryLocation();
13626 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13627 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13628 return false;
13629
13630 return super.CanReceiveAttachment(attachment, slotId);
13631 }
13632
13634 {
13635 if (!super.CanReleaseAttachment(attachment))
13636 return false;
13637
13638 return GetInventory().AreChildrenAccessible();
13639 }
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13662 {
13663 int id = muzzle_owner.GetMuzzleID();
13664 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13665
13666 if (WPOF_array)
13667 {
13668 for (int i = 0; i < WPOF_array.Count(); i++)
13669 {
13670 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13671
13672 if (WPOF)
13673 {
13674 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13675 }
13676 }
13677 }
13678 }
13679
13680
13682 {
13683 int id = muzzle_owner.GetMuzzleID();
13685
13686 if (WPOBE_array)
13687 {
13688 for (int i = 0; i < WPOBE_array.Count(); i++)
13689 {
13690 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13691
13692 if (WPOBE)
13693 {
13694 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13695 }
13696 }
13697 }
13698 }
13699
13700
13702 {
13703 int id = muzzle_owner.GetMuzzleID();
13704 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13705
13706 if (WPOOH_array)
13707 {
13708 for (int i = 0; i < WPOOH_array.Count(); i++)
13709 {
13710 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13711
13712 if (WPOOH)
13713 {
13714 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13715 }
13716 }
13717 }
13718 }
13719
13720
13722 {
13723 int id = muzzle_owner.GetMuzzleID();
13724 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13725
13726 if (WPOOH_array)
13727 {
13728 for (int i = 0; i < WPOOH_array.Count(); i++)
13729 {
13730 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13731
13732 if (WPOOH)
13733 {
13734 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13735 }
13736 }
13737 }
13738 }
13739
13740
13742 {
13743 int id = muzzle_owner.GetMuzzleID();
13744 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13745
13746 if (WPOOH_array)
13747 {
13748 for (int i = 0; i < WPOOH_array.Count(); i++)
13749 {
13750 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13751
13752 if (WPOOH)
13753 {
13754 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13755 }
13756 }
13757 }
13758 }
13759
13760
13761
13763 {
13765 {
13766 return true;
13767 }
13768
13769 return false;
13770 }
13771
13773 {
13775 {
13776 return true;
13777 }
13778
13779 return false;
13780 }
13781
13783 {
13785 {
13786 return true;
13787 }
13788
13789 return false;
13790 }
13791
13793 {
13794 return false;
13795 }
13796
13799 {
13800 return UATimeSpent.DEFAULT_DEPLOY;
13801 }
13802
13803
13804
13805
13807 {
13809 SetSynchDirty();
13810 }
13811
13813 {
13815 }
13816
13817
13819 {
13820 return false;
13821 }
13822
13825 {
13826 string att_type = "None";
13827
13828 if (ConfigIsExisting("soundAttType"))
13829 {
13830 att_type = ConfigGetString("soundAttType");
13831 }
13832
13834 }
13835
13837 {
13839 }
13840
13841
13842
13843
13844
13850
13852 {
13855
13857 }
13858
13859
13861 {
13863 return;
13864
13866
13869
13872
13873 SoundParameters params = new SoundParameters();
13877 }
13878
13879
13881 {
13883 {
13886
13887 SetSynchDirty();
13888
13891 }
13892 }
13893
13895 {
13897 }
13898
13899
13901 {
13903 return;
13904
13906 SetSynchDirty();
13907
13910 }
13911
13913 {
13916 }
13917
13919 {
13921 }
13922
13923 void OnApply(PlayerBase player);
13924
13926 {
13927 return 1.0;
13928 };
13929
13931 {
13933 }
13934
13936 {
13938 }
13939
13941
13943 {
13944 SetDynamicPhysicsLifeTime(0.01);
13946 }
13947
13949 {
13950 array<string> zone_names = new array<string>;
13951 GetDamageZones(zone_names);
13952 for (int i = 0; i < zone_names.Count(); i++)
13953 {
13954 SetHealthMax(zone_names.Get(i),"Health");
13955 }
13956 SetHealthMax("","Health");
13957 }
13958
13961 {
13962 float global_health = GetHealth01("","Health");
13963 array<string> zones = new array<string>;
13964 GetDamageZones(zones);
13965
13966 for (int i = 0; i < zones.Count(); i++)
13967 {
13968 SetHealth01(zones.Get(i),"Health",global_health);
13969 }
13970 }
13971
13974 {
13975 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13976 }
13977
13979 {
13980 if (!hasRootAsPlayer)
13981 {
13982 if (refParentIB)
13983 {
13984
13985 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13986 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13987
13988 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13989 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13990
13993 }
13994 else
13995 {
13996
13999 }
14000 }
14001 }
14002
14004 {
14006 {
14007 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14008 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14009 {
14010 float heatPermCoef = 1.0;
14012 while (ent)
14013 {
14014 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14015 ent = ent.GetHierarchyParent();
14016 }
14017
14018 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14019 }
14020 }
14021 }
14022
14024 {
14025
14026 EntityAI parent = GetHierarchyParent();
14027 if (!parent)
14028 {
14029 hasParent = false;
14030 hasRootAsPlayer = false;
14031 }
14032 else
14033 {
14034 hasParent = true;
14035 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14036 refParentIB =
ItemBase.Cast(parent);
14037 }
14038 }
14039
14040 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14041 {
14042
14043 }
14044
14046 {
14047
14048 return false;
14049 }
14050
14052 {
14053
14054
14055 return false;
14056 }
14057
14059 {
14060
14061 return false;
14062 }
14063
14066 {
14067 return !GetIsFrozen() &&
IsOpen();
14068 }
14069
14071 {
14072 bool hasParent = false, hasRootAsPlayer = false;
14074
14075 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14076 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14077
14078 if (wwtu || foodDecay)
14079 {
14083
14084 if (processWetness || processTemperature || processDecay)
14085 {
14087
14088 if (processWetness)
14089 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14090
14091 if (processTemperature)
14093
14094 if (processDecay)
14095 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14096 }
14097 }
14098 }
14099
14102 {
14104 }
14105
14107 {
14110
14111 return super.GetTemperatureFreezeThreshold();
14112 }
14113
14115 {
14118
14119 return super.GetTemperatureThawThreshold();
14120 }
14121
14123 {
14126
14127 return super.GetItemOverheatThreshold();
14128 }
14129
14131 {
14133 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14134
14135 return super.GetTemperatureFreezeTime();
14136 }
14137
14139 {
14141 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14142
14143 return super.GetTemperatureThawTime();
14144 }
14145
14150
14152 {
14153 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14154 }
14155
14157 {
14158 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14159 }
14160
14163 {
14165 }
14166
14168 {
14170 }
14171
14173 {
14175 }
14176
14179 {
14180 return null;
14181 }
14182
14185 {
14186 return false;
14187 }
14188
14190 {
14192 {
14195 if (!trg)
14196 {
14198 explosive = this;
14199 }
14200
14201 explosive.PairRemote(trg);
14203
14204 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14205 trg.SetPersistentPairID(persistentID);
14206 explosive.SetPersistentPairID(persistentID);
14207
14208 return true;
14209 }
14210 return false;
14211 }
14212
14215 {
14216 float ret = 1.0;
14219 ret *= GetHealth01();
14220
14221 return ret;
14222 }
14223
14224 #ifdef DEVELOPER
14225 override void SetDebugItem()
14226 {
14227 super.SetDebugItem();
14228 _itemBase = this;
14229 }
14230
14232 {
14233 string text = super.GetDebugText();
14234
14236 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14237
14238 return text;
14239 }
14240 #endif
14241
14243 {
14244 return true;
14245 }
14246
14248
14250
14252 {
14255 }
14256
14257
14265
14281
14282 [
Obsolete(
"Use ItemSoundHandler instead")]
14285 {
14286 if (!
g_Game.IsDedicatedServer())
14287 {
14288 if (ConfigIsExisting("attachSoundSet"))
14289 {
14290 string cfg_path = "";
14291 string soundset = "";
14292 string type_name =
GetType();
14293
14296 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14297 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14298
14299 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14300 {
14301 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14302 {
14303 if (cfg_slot_array[i] == slot_type)
14304 {
14305 soundset = cfg_soundset_array[i];
14306 break;
14307 }
14308 }
14309 }
14310
14311 if (soundset != "")
14312 {
14313 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14315 }
14316 }
14317 }
14318 }
14319
14321}
14322
14324{
14326 if (entity)
14327 {
14328 bool is_item = entity.IsInherited(
ItemBase);
14329 if (is_item && full_quantity)
14330 {
14333 }
14334 }
14335 else
14336 {
14338 return NULL;
14339 }
14340 return entity;
14341}
14342
14344{
14345 if (item)
14346 {
14347 if (health > 0)
14348 item.SetHealth("", "", health);
14349
14350 if (item.CanHaveTemperature())
14351 {
14353 if (item.CanFreeze())
14354 item.SetFrozen(false);
14355 }
14356
14357 if (item.HasEnergyManager())
14358 {
14359 if (quantity >= 0)
14360 {
14361 item.GetCompEM().SetEnergy0To1(quantity);
14362 }
14363 else
14364 {
14366 }
14367 }
14368 else if (item.IsMagazine())
14369 {
14370 Magazine mag = Magazine.Cast(item);
14371 if (quantity >= 0)
14372 {
14373 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14374 }
14375 else
14376 {
14378 }
14379
14380 }
14381 else
14382 {
14383 if (quantity >= 0)
14384 {
14385 item.SetQuantityNormalized(quantity, false);
14386 }
14387 else
14388 {
14390 }
14391
14392 }
14393 }
14394}
14395
14396#ifdef DEVELOPER
14398#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.