9461{
9463 {
9464 return true;
9465 }
9466};
9467
9469{
9470
9471};
9472
9473
9474
9476{
9480
9482
9485
9486
9487
9488
9489
9498
9504
9509
9514
9535 protected bool m_IsResultOfSplit
9536
9538
9543
9544
9545
9547
9551
9552
9553
9555
9558
9559
9560
9566
9567
9575
9578
9579
9581
9582
9584
9585
9590
9591
9596
9598
9599
9601
9602
9604 {
9609
9610 if (!
g_Game.IsDedicatedServer())
9611 {
9613 {
9615
9617 {
9619 }
9620 }
9621
9624 }
9625
9626 m_OldLocation = null;
9627
9629 {
9631 }
9632
9633 if (ConfigIsExisting("headSelectionsToHide"))
9634 {
9637 }
9638
9640 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9641 {
9643 }
9644
9646
9647 m_IsResultOfSplit = false;
9648
9650 }
9651
9653 {
9654 super.InitItemVariables();
9655
9661 m_Count = ConfigGetInt(
"count");
9662
9665
9670
9673
9678
9690
9694
9695
9698 if (ConfigIsExisting("canBeSplit"))
9699 {
9702 }
9703
9705 if (ConfigIsExisting("itemBehaviour"))
9707
9708
9711 RegisterNetSyncVariableInt("m_VarLiquidType");
9712 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9713
9714 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9715 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9716 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9717
9718 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9719 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9720 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9721 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9722
9723 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9724 RegisterNetSyncVariableBool("m_IsTakeable");
9725 RegisterNetSyncVariableBool("m_IsHologram");
9726
9729 {
9732 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9733 }
9734
9736
9738 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9740
9742 }
9743
9745 {
9747 }
9748
9750 {
9753 {
9758 }
9759 }
9760
9761 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9762 {
9764 {
9767 }
9768
9770 }
9771
9773 {
9779 }
9780
9782
9784 {
9786
9787 if (!action)
9788 {
9789 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9790 return;
9791 }
9792
9794 if (!ai)
9795 {
9797 return;
9798 }
9799
9801 if (!action_array)
9802 {
9803 action_array = new array<ActionBase_Basic>;
9805 }
9806 if (LogManager.IsActionLogEnable())
9807 {
9808 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9809 }
9810
9811 if (action_array.Find(action) != -1)
9812 {
9813 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9814 }
9815 else
9816 {
9817 action_array.Insert(action);
9818 }
9819 }
9820
9822 {
9823 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9824 ActionBase action = player.GetActionManager().GetAction(actionName);
9827
9828 if (action_array)
9829 {
9830 action_array.RemoveItem(action);
9831 }
9832 }
9833
9834
9835
9837 {
9838 ActionOverrideData overrideData = new ActionOverrideData();
9842
9844 if (!actionMap)
9845 {
9848 }
9849
9850 actionMap.Insert(this.
Type(), overrideData);
9851
9852 }
9853
9855
9857
9858
9860 {
9863
9866
9867 string config_to_search = "CfgVehicles";
9868 string muzzle_owner_config;
9869
9871 {
9872 if (IsInherited(Weapon))
9873 config_to_search = "CfgWeapons";
9874
9875 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9876
9877 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9878
9879 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9880
9881 if (config_OnFire_subclass_count > 0)
9882 {
9883 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9884
9885 for (int i = 0; i < config_OnFire_subclass_count; i++)
9886 {
9887 string particle_class = "";
9888 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9889 string config_OnFire_entry = config_OnFire_class + particle_class;
9890 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9891 WPOF_array.Insert(WPOF);
9892 }
9893
9894
9896 }
9897 }
9898
9900 {
9901 config_to_search = "CfgWeapons";
9902 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9903
9904 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9905
9906 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9907
9908 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9909 {
9910 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9911
9912 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9913 {
9914 string particle_class2 = "";
9915 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9916 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9917 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9918 WPOBE_array.Insert(WPOBE);
9919 }
9920
9921
9923 }
9924 }
9925 }
9926
9927
9929 {
9932
9934 {
9935 string config_to_search = "CfgVehicles";
9936
9937 if (IsInherited(Weapon))
9938 config_to_search = "CfgWeapons";
9939
9940 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9941 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9942
9943 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9944 {
9945
9947
9949 {
9951 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9953 return;
9954 }
9955
9958
9959
9960
9961 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9962 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9963
9964 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9965 {
9966 string particle_class = "";
9967 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9968 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9969 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9970
9971 if (entry_type == CT_CLASS)
9972 {
9973 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9974 WPOOH_array.Insert(WPOF);
9975 }
9976 }
9977
9978
9980 }
9981 }
9982 }
9983
9985 {
9987 }
9988
9990 {
9992 {
9994
9997
10000
10001 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10002 }
10003 }
10004
10006 {
10008 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10009
10011 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10012
10014 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10015
10017 {
10019 }
10020 }
10021
10023 {
10025 }
10026
10028 {
10031 else
10033
10035 {
10038 }
10039 else
10040 {
10043
10046 }
10047
10049 }
10050
10052 {
10054 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10055 }
10056
10058 {
10060 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10062 }
10063
10065 {
10067 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10068 }
10069
10071 {
10074
10075 OverheatingParticle OP = new OverheatingParticle();
10080
10082 }
10083
10085 {
10088
10089 return -1;
10090 }
10091
10093 {
10095 {
10098
10099 for (int i = count; i > 0; --i)
10100 {
10101 int id = i - 1;
10104
10107
10108 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10109 {
10110 if (p)
10111 {
10114 }
10115 }
10116 }
10117 }
10118 }
10119
10121 {
10123 {
10125 {
10126 int id = i - 1;
10128
10129 if (OP)
10130 {
10132
10133 if (p)
10134 {
10136 }
10137
10138 delete OP;
10139 }
10140 }
10141
10144 }
10145 }
10146
10149 {
10150 return 0.0;
10151 }
10152
10153
10155 {
10156 return 250;
10157 }
10158
10160 {
10161 return 0;
10162 }
10163
10166 {
10168 return true;
10169
10170 return false;
10171 }
10172
10175 {
10178
10180 {
10182 }
10183 else
10184 {
10185
10187 }
10188
10190 }
10191
10198 {
10199 return -1;
10200 }
10201
10202
10203
10204
10206 {
10208 {
10209 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10210 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10211
10212 if (r_index >= 0)
10213 {
10214 InventoryLocation r_il = new InventoryLocation;
10215 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10216
10217 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10220 {
10221 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10222 }
10224 {
10225 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10226 }
10227
10228 }
10229
10230 player.GetHumanInventory().ClearUserReservedLocation(this);
10231 }
10232
10235 }
10236
10237
10238
10239
10241 {
10242 return ItemBase.m_DebugActionsMask;
10243 }
10244
10246 {
10247 return ItemBase.m_DebugActionsMask & mask;
10248 }
10249
10251 {
10252 ItemBase.m_DebugActionsMask = mask;
10253 }
10254
10256 {
10257 ItemBase.m_DebugActionsMask |= mask;
10258 }
10259
10261 {
10262 ItemBase.m_DebugActionsMask &= ~mask;
10263 }
10264
10266 {
10268 {
10270 }
10271 else
10272 {
10274 }
10275 }
10276
10277
10279 {
10280 if (GetEconomyProfile())
10281 {
10282 float q_max = GetEconomyProfile().GetQuantityMax();
10283 if (q_max > 0)
10284 {
10285 float q_min = GetEconomyProfile().GetQuantityMin();
10286 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10287
10289 {
10290 ComponentEnergyManager comp = GetCompEM();
10292 {
10294 }
10295 }
10297 {
10299
10300 }
10301
10302 }
10303 }
10304 }
10305
10308 {
10309 EntityAI parent = GetHierarchyParent();
10310
10311 if (parent)
10312 {
10313 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10314 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10315 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10316 }
10317 }
10318
10321 {
10322 EntityAI parent = GetHierarchyParent();
10323
10324 if (parent)
10325 {
10326 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10327 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10328 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10329 }
10330 }
10331
10333 {
10334
10335
10336
10337
10339
10341 {
10342 if (ScriptInputUserData.CanStoreInputUserData())
10343 {
10344 ScriptInputUserData ctx = new ScriptInputUserData;
10350 ctx.
Write(use_stack_max);
10353
10355 {
10356 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10357 }
10358 }
10359 }
10360 else if (!
g_Game.IsMultiplayer())
10361 {
10363 }
10364 }
10365
10367 {
10369 }
10370
10372 {
10374 }
10375
10377 {
10379 }
10380
10382 {
10383
10384 return false;
10385 }
10386
10388 {
10389 return false;
10390 }
10391
10395 {
10396 return false;
10397 }
10398
10400 {
10401 return "";
10402 }
10403
10405
10407 {
10408 return false;
10409 }
10410
10412 {
10413 return true;
10414 }
10415
10416
10417
10419 {
10420 return true;
10421 }
10422
10424 {
10425 return true;
10426 }
10427
10429 {
10430 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10432 }
10433
10435 {
10437 }
10438
10440 {
10442 if (!is_being_placed)
10444 SetSynchDirty();
10445 }
10446
10447
10449
10451 {
10453 }
10454
10456 {
10458 }
10459
10461 {
10462 return 1;
10463 }
10464
10466 {
10467 return false;
10468 }
10469
10471 {
10473 SetSynchDirty();
10474 }
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10511 {
10512 super.OnMovedInsideCargo(container);
10513
10514 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10515 }
10516
10517 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10518 {
10519 super.EEItemLocationChanged(oldLoc, newLoc);
10520
10521 PlayerBase newPlayer = null;
10522 PlayerBase oldPlayer = null;
10523
10524 if (newLoc.GetParent())
10525 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10526
10527 if (oldLoc.GetParent())
10528 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10529
10531 {
10532 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10533
10534 if (rIndex >= 0)
10535 {
10536 InventoryLocation rIl = new InventoryLocation;
10537 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10538
10539 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10542 {
10543 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10544 }
10546 {
10548 }
10549
10550 }
10551 }
10552
10554 {
10555 if (newPlayer)
10556 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10557
10558 if (newPlayer == oldPlayer)
10559 {
10560 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10561 {
10563 {
10564 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10565 {
10566 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10567 }
10568 }
10569 else
10570 {
10571 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10572 }
10573 }
10574
10575 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10576 {
10577 int type = oldLoc.GetType();
10579 {
10580 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10581 }
10583 {
10584 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10585 }
10586 }
10587 if (!m_OldLocation)
10588 {
10589 m_OldLocation = new InventoryLocation;
10590 }
10591 m_OldLocation.Copy(oldLoc);
10592 }
10593 else
10594 {
10595 if (m_OldLocation)
10596 {
10597 m_OldLocation.Reset();
10598 }
10599 }
10600
10601 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10602 }
10603 else
10604 {
10605 if (newPlayer)
10606 {
10607 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10608 if (resIndex >= 0)
10609 {
10610 InventoryLocation il = new InventoryLocation;
10611 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10613 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10616 {
10617 il.
GetParent().GetOnReleaseLock().Invoke(it);
10618 }
10620 {
10622 }
10623
10624 }
10625 }
10627 {
10628
10630 }
10631
10632 if (m_OldLocation)
10633 {
10634 m_OldLocation.Reset();
10635 }
10636 }
10637
10639 {
10640 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10641 }
10642
10644 {
10645 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10646 }
10647 }
10648
10649 override void EOnContact(IEntity other, Contact extra)
10650 {
10652 {
10653 int liquidType = -1;
10655 if (impactSpeed > 0.0)
10656 {
10658 #ifndef SERVER
10660 #else
10662 SetSynchDirty();
10663 #endif
10665 }
10666 }
10667
10668 #ifdef SERVER
10669 if (GetCompEM() && GetCompEM().IsPlugged())
10670 {
10671 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10672 GetCompEM().UnplugThis();
10673 }
10674 #endif
10675 }
10676
10678
10680 {
10682 }
10683
10685 {
10686
10687 }
10688
10690 {
10691 super.OnItemLocationChanged(old_owner, new_owner);
10692
10693 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10694 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10695
10696 if (!relatedPlayer && playerNew)
10697 relatedPlayer = playerNew;
10698
10699 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10700 {
10702 if (actionMgr)
10703 {
10704 ActionBase currentAction = actionMgr.GetRunningAction();
10705 if (currentAction)
10707 }
10708 }
10709
10710 Man ownerPlayerOld = null;
10711 Man ownerPlayerNew = null;
10712
10713 if (old_owner)
10714 {
10715 if (old_owner.
IsMan())
10716 {
10717 ownerPlayerOld = Man.Cast(old_owner);
10718 }
10719 else
10720 {
10721 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10722 }
10723 }
10724 else
10725 {
10727 {
10729
10730 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10731 {
10732 GetCompEM().UnplugThis();
10733 }
10734 }
10735 }
10736
10737 if (new_owner)
10738 {
10739 if (new_owner.
IsMan())
10740 {
10741 ownerPlayerNew = Man.Cast(new_owner);
10742 }
10743 else
10744 {
10745 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10746 }
10747 }
10748
10749 if (ownerPlayerOld != ownerPlayerNew)
10750 {
10751 if (ownerPlayerOld)
10752 {
10753 array<EntityAI> subItemsExit = new array<EntityAI>;
10755 for (int i = 0; i < subItemsExit.Count(); i++)
10756 {
10759 }
10760 }
10761
10762 if (ownerPlayerNew)
10763 {
10764 array<EntityAI> subItemsEnter = new array<EntityAI>;
10766 for (int j = 0; j < subItemsEnter.Count(); j++)
10767 {
10770 }
10771 }
10772 }
10773 else if (ownerPlayerNew != null)
10774 {
10775 PlayerBase nplayer;
10776 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10777 {
10778 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10780 for (int k = 0; k < subItemsUpdate.Count(); k++)
10781 {
10783 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10784 }
10785 }
10786 }
10787
10788 if (old_owner)
10789 old_owner.OnChildItemRemoved(this);
10790 if (new_owner)
10791 new_owner.OnChildItemReceived(this);
10792 }
10793
10794
10796 {
10797 super.EEDelete(parent);
10798 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10799 if (player)
10800 {
10802
10803 if (player.IsAlive())
10804 {
10805 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10806 if (r_index >= 0)
10807 {
10808 InventoryLocation r_il = new InventoryLocation;
10809 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10810
10811 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10814 {
10815 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10816 }
10818 {
10819 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10820 }
10821
10822 }
10823
10824 player.RemoveQuickBarEntityShortcut(this);
10825 }
10826 }
10827 }
10828
10830 {
10831 super.EEKilled(killer);
10832
10835 {
10836 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10837 {
10838 if (IsMagazine())
10839 {
10840 if (Magazine.Cast(this).GetAmmoCount() > 0)
10841 {
10843 }
10844 }
10845 else
10846 {
10848 }
10849 }
10850 }
10851 }
10852
10854 {
10855 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10856
10857 super.OnWasAttached(parent, slot_id);
10858
10861
10864 }
10865
10867 {
10868 super.OnWasDetached(parent, slot_id);
10869
10872
10875 }
10876
10878 {
10879 int idx;
10882
10883 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10884 if (inventory_slots.Count() < 1)
10885 {
10886 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10887 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10888 }
10889 else
10890 {
10891 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10892 }
10893
10894 idx = inventory_slots.Find(slot);
10895 if (idx < 0)
10896 return "";
10897
10898 return attach_types.Get(idx);
10899 }
10900
10902 {
10903 int idx = -1;
10904 string slot;
10905
10908
10909 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10910 if (inventory_slots.Count() < 1)
10911 {
10912 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10913 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10914 }
10915 else
10916 {
10917 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10918 if (detach_types.Count() < 1)
10919 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10920 }
10921
10922 for (int i = 0; i < inventory_slots.Count(); i++)
10923 {
10924 slot = inventory_slots.Get(i);
10925 }
10926
10927 if (slot != "")
10928 {
10929 if (detach_types.Count() == 1)
10930 idx = 0;
10931 else
10932 idx = inventory_slots.Find(slot);
10933 }
10934 if (idx < 0)
10935 return "";
10936
10937 return detach_types.Get(idx);
10938 }
10939
10941 {
10942
10944
10945
10946 float min_time = 1;
10947 float max_time = 3;
10948 float delay = Math.RandomFloat(min_time, max_time);
10949
10950 explode_timer.Run(delay, this, "DoAmmoExplosion");
10951 }
10952
10954 {
10955 Magazine magazine = Magazine.Cast(this);
10956 int pop_sounds_count = 6;
10957 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10958
10959
10960 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10961 string sound_name = pop_sounds[ sound_idx ];
10962 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10963
10964
10965 magazine.ServerAddAmmoCount(-1);
10966
10967
10968 float min_temp_to_explode = 100;
10969
10970 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10971 {
10973 }
10974 }
10975
10976
10977 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10978 {
10979 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10980
10981 const int CHANCE_DAMAGE_CARGO = 4;
10982 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10983 const int CHANCE_DAMAGE_NOTHING = 2;
10984
10986 {
10987 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10988 int chances;
10989 int rnd;
10990
10991 if (GetInventory().GetCargo())
10992 {
10993 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10994 rnd = Math.RandomInt(0,chances);
10995
10996 if (rnd < CHANCE_DAMAGE_CARGO)
10997 {
10999 }
11000 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11001 {
11003 }
11004 }
11005 else
11006 {
11007 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11008 rnd = Math.RandomInt(0,chances);
11009
11010 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11011 {
11013 }
11014 }
11015 }
11016 }
11017
11019 {
11020 CargoBase cargo = GetInventory().GetCargo();
11021 if (cargo)
11022 {
11024 if (item_count > 0)
11025 {
11026 int random_pick = Math.RandomInt(0, item_count);
11028 if (!item.IsExplosive())
11029 {
11030 item.AddHealth("","",damage);
11031 return true;
11032 }
11033 }
11034 }
11035 return false;
11036 }
11037
11039 {
11040 GameInventory inventory = GetInventory();
11042 if (attachment_count > 0)
11043 {
11044 int random_pick = Math.RandomInt(0, attachment_count);
11046 if (!attachment.IsExplosive())
11047 {
11048 attachment.AddHealth("","",damage);
11049 return true;
11050 }
11051 }
11052 return false;
11053 }
11054
11056 {
11058 }
11059
11061 {
11063 return GetInventory().CanRemoveEntity();
11064
11065 return false;
11066 }
11067
11069 {
11070
11072 return false;
11073
11074
11076 return false;
11077
11078
11079
11081 if (delta == 0)
11082 return false;
11083
11084
11085 return true;
11086 }
11087
11089 {
11091 {
11092 if (ScriptInputUserData.CanStoreInputUserData())
11093 {
11094 ScriptInputUserData ctx = new ScriptInputUserData;
11099 ctx.
Write(destination_entity);
11101 ctx.
Write(slot_id);
11103 }
11104 }
11105 else if (!
g_Game.IsMultiplayer())
11106 {
11108 }
11109 }
11110
11112 {
11113 float split_quantity_new;
11117 InventoryLocation loc = new InventoryLocation;
11118
11119 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11120 {
11122 split_quantity_new = stack_max;
11123 else
11125
11127 {
11128 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11129 if (new_item)
11130 {
11131 new_item.SetResultOfSplit(true);
11132 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11134 new_item.
SetQuantity(split_quantity_new,
false,
true);
11135 }
11136 }
11137 }
11138 else if (destination_entity && slot_id == -1)
11139 {
11140 if (quantity > stack_max)
11141 split_quantity_new = stack_max;
11142 else
11143 split_quantity_new = quantity;
11144
11146 {
11147 GameInventory destinationInventory = destination_entity.GetInventory();
11149 {
11152 }
11153
11154 if (new_item)
11155 {
11156 new_item.SetResultOfSplit(true);
11157 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11159 new_item.
SetQuantity(split_quantity_new,
false,
true);
11160 }
11161 }
11162 }
11163 else
11164 {
11165 if (stack_max != 0)
11166 {
11168 {
11170 }
11171
11172 if (split_quantity_new == 0)
11173 {
11174 if (!
g_Game.IsMultiplayer())
11175 player.PhysicalPredictiveDropItem(this);
11176 else
11177 player.ServerDropEntity(this);
11178 return;
11179 }
11180
11182 {
11184
11185 if (new_item)
11186 {
11187 new_item.SetResultOfSplit(true);
11188 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11191 new_item.PlaceOnSurface();
11192 }
11193 }
11194 }
11195 }
11196 }
11197
11199 {
11200 float split_quantity_new;
11204 InventoryLocation loc = new InventoryLocation;
11205
11206 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11207 {
11209 split_quantity_new = stack_max;
11210 else
11212
11214 {
11215 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11216 if (new_item)
11217 {
11218 new_item.SetResultOfSplit(true);
11219 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11221 new_item.
SetQuantity(split_quantity_new,
false,
true);
11222 }
11223 }
11224 }
11225 else if (destination_entity && slot_id == -1)
11226 {
11227 if (quantity > stack_max)
11228 split_quantity_new = stack_max;
11229 else
11230 split_quantity_new = quantity;
11231
11233 {
11234 GameInventory destinationInventory = destination_entity.GetInventory();
11236 {
11239 }
11240
11241 if (new_item)
11242 {
11243 new_item.SetResultOfSplit(true);
11244 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11246 new_item.
SetQuantity(split_quantity_new,
false,
true);
11247 }
11248 }
11249 }
11250 else
11251 {
11252 if (stack_max != 0)
11253 {
11255 {
11257 }
11258
11260 {
11262
11263 if (new_item)
11264 {
11265 new_item.SetResultOfSplit(true);
11266 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11269 new_item.PlaceOnSurface();
11270 }
11271 }
11272 }
11273 }
11274 }
11275
11277 {
11279 {
11280 if (ScriptInputUserData.CanStoreInputUserData())
11281 {
11282 ScriptInputUserData ctx = new ScriptInputUserData;
11287 dst.WriteToContext(ctx);
11289 }
11290 }
11291 else if (!
g_Game.IsMultiplayer())
11292 {
11294 }
11295 }
11296
11298 {
11300 {
11301 if (ScriptInputUserData.CanStoreInputUserData())
11302 {
11303 ScriptInputUserData ctx = new ScriptInputUserData;
11308 ctx.
Write(destination_entity);
11314 }
11315 }
11316 else if (!
g_Game.IsMultiplayer())
11317 {
11319 }
11320 }
11321
11323 {
11325 }
11326
11328 {
11330 float split_quantity_new;
11332 if (dst.IsValid())
11333 {
11334 int slot_id = dst.GetSlot();
11336
11337 if (quantity > stack_max)
11338 split_quantity_new = stack_max;
11339 else
11340 split_quantity_new = quantity;
11341
11343 {
11345
11346 if (new_item)
11347 {
11348 new_item.SetResultOfSplit(true);
11349 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11351 new_item.
SetQuantity(split_quantity_new,
false,
true);
11352 }
11353
11354 return new_item;
11355 }
11356 }
11357
11358 return null;
11359 }
11360
11362 {
11364 float split_quantity_new;
11366 if (destination_entity)
11367 {
11369 if (quantity > stackable)
11370 split_quantity_new = stackable;
11371 else
11372 split_quantity_new = quantity;
11373
11375 {
11376 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11377 if (new_item)
11378 {
11379 new_item.SetResultOfSplit(true);
11380 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11382 new_item.
SetQuantity(split_quantity_new,
false,
true);
11383 }
11384 }
11385 }
11386 }
11387
11389 {
11391 {
11392 if (ScriptInputUserData.CanStoreInputUserData())
11393 {
11394 ScriptInputUserData ctx = new ScriptInputUserData;
11399 ItemBase destination_entity =
this;
11400 ctx.
Write(destination_entity);
11404 }
11405 }
11406 else if (!
g_Game.IsMultiplayer())
11407 {
11409 }
11410 }
11411
11413 {
11415 float split_quantity_new;
11417 if (player)
11418 {
11420 if (quantity > stackable)
11421 split_quantity_new = stackable;
11422 else
11423 split_quantity_new = quantity;
11424
11426 {
11427 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11428 new_item =
ItemBase.Cast(in_hands);
11429 if (new_item)
11430 {
11431 new_item.SetResultOfSplit(true);
11432 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11434 new_item.SetQuantity(split_quantity_new, false, true);
11435 }
11436 }
11437 }
11438 }
11439
11441 {
11443 float split_quantity_new = Math.Floor(quantity * 0.5);
11444
11446 return;
11447
11449
11450 if (new_item)
11451 {
11452 if (new_item.GetQuantityMax() < split_quantity_new)
11453 {
11454 split_quantity_new = new_item.GetQuantityMax();
11455 }
11456
11457 new_item.SetResultOfSplit(true);
11458 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11459
11461 {
11464 }
11465 else
11466 {
11468 new_item.
SetQuantity(split_quantity_new,
false,
true);
11469 }
11470 }
11471 }
11472
11474 {
11476 float split_quantity_new = Math.Floor(quantity / 2);
11477
11479 return;
11480
11481 InventoryLocation invloc = new InventoryLocation;
11483
11485 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11486
11487 if (new_item)
11488 {
11489 if (new_item.GetQuantityMax() < split_quantity_new)
11490 {
11491 split_quantity_new = new_item.GetQuantityMax();
11492 }
11494 {
11497 }
11498 else if (split_quantity_new > 1)
11499 {
11501 new_item.
SetQuantity(split_quantity_new,
false,
true);
11502 }
11503 }
11504 }
11505
11508 {
11509 SetWeightDirty();
11511
11512 if (parent)
11513 parent.OnAttachmentQuantityChangedEx(this, delta);
11514
11516 {
11518 {
11520 }
11522 {
11523 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11525 }
11526 }
11527 }
11528
11531 {
11532
11533 }
11534
11537 {
11539 }
11540
11542 {
11543 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11544
11546 {
11547 if (newLevel == GameConstants.STATE_RUINED)
11548 {
11550 EntityAI parent = GetHierarchyParent();
11551 if (parent && parent.IsFireplace())
11552 {
11553 CargoBase cargo = GetInventory().GetCargo();
11554 if (cargo)
11555 {
11557 {
11559 }
11560 }
11561 }
11562 }
11563
11565 {
11566
11568 return;
11569 }
11570
11571 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11572 {
11574 }
11575 }
11576 }
11577
11578
11580 {
11581 super.OnRightClick();
11582
11584 {
11586 {
11587 if (ScriptInputUserData.CanStoreInputUserData())
11588 {
11589 EntityAI root = GetHierarchyRoot();
11590 Man playerOwner = GetHierarchyRootPlayer();
11591 InventoryLocation dst = new InventoryLocation;
11592
11593
11594 if (!playerOwner && root && root == this)
11595 {
11597 }
11598 else
11599 {
11600
11601 GetInventory().GetCurrentInventoryLocation(dst);
11603 {
11604 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11606 {
11608 }
11609 else
11610 {
11612
11613
11614 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11615 {
11617 }
11618 else
11619 {
11620 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11621 }
11622 }
11623 }
11624 }
11625
11626 ScriptInputUserData ctx = new ScriptInputUserData;
11634 }
11635 }
11636 else if (!
g_Game.IsMultiplayer())
11637 {
11639 }
11640 }
11641 }
11642
11644 {
11645 if (root)
11646 {
11647 vector m4[4];
11648 root.GetTransform(m4);
11649 dst.SetGround(this, m4);
11650 }
11651 else
11652 {
11653 GetInventory().GetCurrentInventoryLocation(dst);
11654 }
11655 }
11656
11657 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11658 {
11659
11660 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11661 return false;
11662
11663 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11664 return false;
11665
11666
11668 return false;
11669
11670
11671 Magazine mag = Magazine.Cast(this);
11672 if (mag)
11673 {
11674 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11675 return false;
11676
11677 if (stack_max_limit)
11678 {
11679 Magazine other_mag = Magazine.Cast(other_item);
11680 if (other_item)
11681 {
11682 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11683 return false;
11684 }
11685
11686 }
11687 }
11688 else
11689 {
11690
11692 return false;
11693
11695 return false;
11696 }
11697
11698 PlayerBase player = null;
11699 if (CastTo(player, GetHierarchyRootPlayer()))
11700 {
11701 if (player.GetInventory().HasAttachment(this))
11702 return false;
11703
11704 if (player.IsItemsToDelete())
11705 return false;
11706 }
11707
11708 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11709 return false;
11710
11711 int slotID;
11713 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11714 return false;
11715
11716 return true;
11717 }
11718
11720 {
11722 }
11723
11725 {
11726 return m_IsResultOfSplit;
11727 }
11728
11730 {
11731 m_IsResultOfSplit = value;
11732 }
11733
11735 {
11737 }
11738
11740 {
11741 float other_item_quantity = other_item.GetQuantity();
11742 float this_free_space;
11743
11745
11747
11748 if (other_item_quantity > this_free_space)
11749 {
11750 return this_free_space;
11751 }
11752 else
11753 {
11754 return other_item_quantity;
11755 }
11756 }
11757
11759 {
11761 }
11762
11764 {
11766 return;
11767
11768 if (!IsMagazine() && other_item)
11769 {
11771 if (quantity_used != 0)
11772 {
11773 float hp1 = GetHealth01("","");
11774 float hp2 = other_item.GetHealth01("","");
11775 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11776 hpResult = hpResult / (
GetQuantity() + quantity_used);
11777
11778 hpResult *= GetMaxHealth();
11779 Math.Round(hpResult);
11780 SetHealth("", "Health", hpResult);
11781
11783 other_item.AddQuantity(-quantity_used);
11784 }
11785 }
11787 }
11788
11790 {
11791 #ifdef SERVER
11792 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11793 GetHierarchyParent().IncreaseLifetimeUp();
11794 #endif
11795 };
11796
11798 {
11799 PlayerBase p = PlayerBase.Cast(player);
11800
11801 array<int> recipesIds = p.m_Recipes;
11802 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11803 if (moduleRecipesManager)
11804 {
11805 EntityAI itemInHands = player.GetEntityInHands();
11806 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11807 }
11808
11809 for (int i = 0;i < recipesIds.Count(); i++)
11810 {
11811 int key = recipesIds.Get(i);
11812 string recipeName = moduleRecipesManager.GetRecipeName(key);
11814 }
11815 }
11816
11817
11818 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11819 {
11820 super.GetDebugActions(outputList);
11821
11822
11828
11829
11834
11839
11840
11844
11845
11847 {
11851 }
11852
11855
11856
11860
11862
11863 InventoryLocation loc = new InventoryLocation();
11864 GetInventory().GetCurrentInventoryLocation(loc);
11866 {
11867 if (Gizmo_IsSupported())
11870 }
11871
11873 }
11874
11875
11876
11877
11879 {
11880 super.OnAction(action_id, player, ctx);
11881
11883 {
11884 switch (action_id)
11885 {
11889 return true;
11893 return true;
11894 }
11895 }
11896
11898 {
11899 switch (action_id)
11900 {
11902 Delete();
11903 return true;
11904 }
11905 }
11906
11907 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11908 {
11909 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11910 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11911 PlayerBase p = PlayerBase.Cast(player);
11912 if (
EActions.RECIPES_RANGE_START < 1000)
11913 {
11914 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11915 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11916 }
11917 }
11918 #ifndef SERVER
11919 else if (action_id ==
EActions.WATCH_PLAYER)
11920 {
11921 PluginDeveloper.SetDeveloperItemClientEx(player);
11922 }
11923 #endif
11925 {
11926 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11927 {
11928 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11929 OnDebugButtonPressServer(id + 1);
11930 }
11931
11932 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11933 {
11934 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11936 }
11937
11938 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11939 {
11940 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11942 }
11943
11944 else if (action_id ==
EActions.ADD_QUANTITY)
11945 {
11946 if (IsMagazine())
11947 {
11948 Magazine mag = Magazine.Cast(this);
11949 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11950 }
11951 else
11952 {
11954 }
11955
11956 if (m_EM)
11957 {
11958 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11959 }
11960
11961 }
11962
11963 else if (action_id ==
EActions.REMOVE_QUANTITY)
11964 {
11965 if (IsMagazine())
11966 {
11967 Magazine mag2 = Magazine.Cast(this);
11968 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11969 }
11970 else
11971 {
11973 }
11974 if (m_EM)
11975 {
11976 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11977 }
11978
11979 }
11980
11981 else if (action_id ==
EActions.SET_QUANTITY_0)
11982 {
11984
11985 if (m_EM)
11986 {
11987 m_EM.SetEnergy(0);
11988 }
11989 }
11990
11991 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11992 {
11994
11995 if (m_EM)
11996 {
11997 m_EM.SetEnergy(m_EM.GetEnergyMax());
11998 }
11999 }
12000
12001 else if (action_id ==
EActions.ADD_HEALTH)
12002 {
12003 AddHealth("","",GetMaxHealth("","Health")/5);
12004 }
12005 else if (action_id ==
EActions.REMOVE_HEALTH)
12006 {
12007 AddHealth("","",-GetMaxHealth("","Health")/5);
12008 }
12009 else if (action_id ==
EActions.DESTROY_HEALTH)
12010 {
12011 SetHealth01("","",0);
12012 }
12013 else if (action_id ==
EActions.WATCH_ITEM)
12014 {
12016 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
12017 #ifdef DEVELOPER
12018 SetDebugDeveloper_item(this);
12019 #endif
12020 }
12021
12022 else if (action_id ==
EActions.ADD_TEMPERATURE)
12023 {
12024 AddTemperature(20);
12025
12026 }
12027
12028 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
12029 {
12030 AddTemperature(-20);
12031
12032 }
12033
12034 else if (action_id ==
EActions.FLIP_FROZEN)
12035 {
12036 SetFrozen(!GetIsFrozen());
12037
12038 }
12039
12040 else if (action_id ==
EActions.ADD_WETNESS)
12041 {
12043
12044 }
12045
12046 else if (action_id ==
EActions.REMOVE_WETNESS)
12047 {
12049
12050 }
12051
12052 else if (action_id ==
EActions.LIQUIDTYPE_UP)
12053 {
12056
12057
12058 }
12059
12060 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12061 {
12064 }
12065
12066 else if (action_id ==
EActions.MAKE_SPECIAL)
12067 {
12068 auto debugParams = DebugSpawnParams.WithPlayer(player);
12069 OnDebugSpawnEx(debugParams);
12070 }
12071
12072 }
12073
12074
12075 return false;
12076 }
12077
12078
12079
12080
12084
12087
12088
12089
12091 {
12092 return false;
12093 }
12094
12095
12097 {
12098 return true;
12099 }
12100
12101
12103 {
12104 return true;
12105 }
12106
12107
12108
12110 {
12111 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12112 return g_Game.ConfigIsExisting(config_path);
12113 }
12114
12117 {
12118 return null;
12119 }
12120
12122 {
12123 return false;
12124 }
12125
12127 {
12128 return false;
12129 }
12130
12134
12135
12137 {
12138 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12139 return module_repairing.CanRepair(this, item_repair_kit);
12140 }
12141
12142
12143 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12144 {
12145 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12146 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12147 }
12148
12149
12151 {
12152
12153
12154
12155
12156
12157
12158
12159
12160 return 1;
12161 }
12162
12163
12164
12166 {
12168 }
12169
12170
12171
12173 {
12175 }
12176
12177
12186 {
12187 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12188
12189 if (player)
12190 {
12191 player.MessageStatus(text);
12192 }
12193 }
12194
12195
12204 {
12205 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12206
12207 if (player)
12208 {
12209 player.MessageAction(text);
12210 }
12211 }
12212
12213
12222 {
12223 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12224
12225 if (player)
12226 {
12227 player.MessageFriendly(text);
12228 }
12229 }
12230
12231
12240 {
12241 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12242
12243 if (player)
12244 {
12245 player.MessageImportant(text);
12246 }
12247 }
12248
12250 {
12251 return true;
12252 }
12253
12254
12255 override bool KindOf(
string tag)
12256 {
12257 bool found = false;
12258 string item_name = this.
GetType();
12260 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12261
12262 int array_size = item_tag_array.Count();
12263 for (int i = 0; i < array_size; i++)
12264 {
12265 if (item_tag_array.Get(i) == tag)
12266 {
12267 found = true;
12268 break;
12269 }
12270 }
12271 return found;
12272 }
12273
12274
12276 {
12277
12278 super.OnRPC(sender, rpc_type,ctx);
12279
12280
12281 switch (rpc_type)
12282 {
12283 #ifndef SERVER
12284 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12285 Param2<bool, string> p = new Param2<bool, string>(false, "");
12286
12288 return;
12289
12290 bool play = p.param1;
12291 string soundSet = p.param2;
12292
12293 if (play)
12294 {
12296 {
12298 {
12300 }
12301 }
12302 else
12303 {
12305 }
12306 }
12307 else
12308 {
12310 }
12311
12312 break;
12313 #endif
12314
12315 }
12316
12318 {
12320 }
12321 }
12322
12323
12324
12325
12327 {
12328 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12329 return plugin.GetID(
name);
12330 }
12331
12333 {
12334 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12335 return plugin.GetName(id);
12336 }
12337
12340 {
12341
12342
12343 int varFlags;
12344 if (!ctx.
Read(varFlags))
12345 return;
12346
12347 if (varFlags & ItemVariableFlags.FLOAT)
12348 {
12350 }
12351 }
12352
12354 {
12355
12356 super.SerializeNumericalVars(floats_out);
12357
12358
12359
12361 {
12363 }
12364
12366 {
12368 }
12369
12371 {
12373 }
12374
12376 {
12381 }
12382
12384 {
12386 }
12387 }
12388
12390 {
12391
12392 super.DeSerializeNumericalVars(floats);
12393
12394
12395 int index = 0;
12396 int mask = Math.Round(floats.Get(index));
12397
12398 index++;
12399
12401 {
12403 {
12405 }
12406 else
12407 {
12408 float quantity = floats.Get(index);
12409 SetQuantity(quantity,
true,
false,
false,
false);
12410 }
12411 index++;
12412 }
12413
12415 {
12416 float wet = floats.Get(index);
12418 index++;
12419 }
12420
12422 {
12423 int liquidtype = Math.Round(floats.Get(index));
12425 index++;
12426 }
12427
12429 {
12431 index++;
12433 index++;
12435 index++;
12437 index++;
12438 }
12439
12441 {
12442 int cleanness = Math.Round(floats.Get(index));
12444 index++;
12445 }
12446 }
12447
12449 {
12450 super.WriteVarsToCTX(ctx);
12451
12452
12454 {
12456 }
12457
12459 {
12461 }
12462
12464 {
12466 }
12467
12469 {
12470 int r,g,b,a;
12476 }
12477
12479 {
12481 }
12482 }
12483
12485 {
12486 if (!super.ReadVarsFromCTX(ctx,version))
12487 return false;
12488
12489 int intValue;
12490 float value;
12491
12492 if (version < 140)
12493 {
12494 if (!ctx.
Read(intValue))
12495 return false;
12496
12497 m_VariablesMask = intValue;
12498 }
12499
12501 {
12502 if (!ctx.
Read(value))
12503 return false;
12504
12506 {
12508 }
12509 else
12510 {
12512 }
12513 }
12514
12515 if (version < 140)
12516 {
12518 {
12519 if (!ctx.
Read(value))
12520 return false;
12521 SetTemperatureDirect(value);
12522 }
12523 }
12524
12526 {
12527 if (!ctx.
Read(value))
12528 return false;
12530 }
12531
12533 {
12534 if (!ctx.
Read(intValue))
12535 return false;
12537 }
12538
12540 {
12541 int r,g,b,a;
12543 return false;
12545 return false;
12547 return false;
12549 return false;
12550
12552 }
12553
12555 {
12556 if (!ctx.
Read(intValue))
12557 return false;
12559 }
12560
12561 if (version >= 138 && version < 140)
12562 {
12564 {
12565 if (!ctx.
Read(intValue))
12566 return false;
12567 SetFrozen(intValue);
12568 }
12569 }
12570
12571 return true;
12572 }
12573
12574
12576 {
12579 {
12581 }
12582
12583 if (!super.OnStoreLoad(ctx, version))
12584 {
12586 return false;
12587 }
12588
12589 if (version >= 114)
12590 {
12591 bool hasQuickBarIndexSaved;
12592
12593 if (!ctx.
Read(hasQuickBarIndexSaved))
12594 {
12596 return false;
12597 }
12598
12599 if (hasQuickBarIndexSaved)
12600 {
12601 int itmQBIndex;
12602
12603
12604 if (!ctx.
Read(itmQBIndex))
12605 {
12607 return false;
12608 }
12609
12610 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12611 if (itmQBIndex != -1 && parentPlayer)
12612 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12613 }
12614 }
12615 else
12616 {
12617
12618 PlayerBase player;
12619 int itemQBIndex;
12620 if (version ==
int.
MAX)
12621 {
12622 if (!ctx.
Read(itemQBIndex))
12623 {
12625 return false;
12626 }
12627 }
12628 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12629 {
12630
12631 if (!ctx.
Read(itemQBIndex))
12632 {
12634 return false;
12635 }
12636 if (itemQBIndex != -1 && player)
12637 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12638 }
12639 }
12640
12641 if (version < 140)
12642 {
12643
12644 if (!LoadVariables(ctx, version))
12645 {
12647 return false;
12648 }
12649 }
12650
12651
12653 {
12655 return false;
12656 }
12657 if (version >= 132)
12658 {
12660 if (raib)
12661 {
12663 {
12665 return false;
12666 }
12667 }
12668 }
12669
12671 return true;
12672 }
12673
12674
12675
12677 {
12678 super.OnStoreSave(ctx);
12679
12680 PlayerBase player;
12681 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12682 {
12684
12685 int itemQBIndex = -1;
12686 itemQBIndex = player.FindQuickBarEntityIndex(this);
12687 ctx.
Write(itemQBIndex);
12688 }
12689 else
12690 {
12692 }
12693
12695
12697 if (raib)
12698 {
12700 }
12701 }
12702
12703
12705 {
12706 super.AfterStoreLoad();
12707
12709 {
12711 }
12712
12714 {
12717 }
12718 }
12719
12721 {
12722 super.EEOnAfterLoad();
12723
12725 {
12727 }
12728
12731 }
12732
12734 {
12735 return false;
12736 }
12737
12738
12739
12741 {
12743 {
12744 #ifdef PLATFORM_CONSOLE
12745
12747 {
12749 if (menu)
12750 {
12752 }
12753 }
12754 #endif
12755 }
12756
12758 {
12761 }
12762
12764 {
12765 SetWeightDirty();
12767 }
12769 {
12772 }
12773
12775 {
12778
12781 }
12783 {
12787 }
12788
12789 super.OnVariablesSynchronized();
12790 }
12791
12792
12793
12795 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12796 {
12797 if (!IsServerCheck(allow_client))
12798 return false;
12799
12801 return false;
12802
12805
12806 if (value <= (min + 0.001))
12807 value = min;
12808
12809 if (value == min)
12810 {
12811 if (destroy_config)
12812 {
12813 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12814 if (dstr)
12815 {
12817 this.Delete();
12818 return true;
12819 }
12820 }
12821 else if (destroy_forced)
12822 {
12824 this.Delete();
12825 return true;
12826 }
12827
12829 }
12830
12833
12835 {
12836 EntityAI parent = GetHierarchyRoot();
12837 InventoryLocation iLoc = new InventoryLocation();
12838 GetInventory().GetCurrentInventoryLocation(iLoc);
12840 {
12841 int iLocSlot = iLoc.
GetSlot();
12843 {
12845 }
12847 {
12849 }
12850 }
12851 }
12852
12854 {
12856
12857 if (delta)
12859 }
12860
12862
12863 return false;
12864 }
12865
12866
12868 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12869 {
12871 }
12872
12874 {
12877 }
12878
12880 {
12883 }
12884
12886 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12887 {
12888 float value_clamped = Math.Clamp(value, 0, 1);
12890 SetQuantity(result, destroy_config, destroy_forced);
12891 }
12892
12893
12896 {
12898 }
12899
12901 {
12903 }
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12915 {
12916 int slot = -1;
12917 GameInventory inventory = GetInventory();
12918 if (inventory)
12919 {
12920 InventoryLocation il = new InventoryLocation;
12923 }
12924
12926 }
12927
12929 {
12930 float quantity_max = 0;
12931
12933 {
12934 if (attSlotID != -1)
12935 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12936
12937 if (quantity_max <= 0)
12939 }
12940
12941 if (quantity_max <= 0)
12943
12944 return quantity_max;
12945 }
12946
12948 {
12950 }
12951
12953 {
12955 }
12956
12957
12959 {
12961 }
12962
12964 {
12966 }
12967
12969 {
12971 }
12972
12973
12975 {
12976
12977 float weightEx = GetWeightEx();
12978 float special = GetInventoryAndCargoWeight();
12979 return weightEx - special;
12980 }
12981
12982
12984 {
12986 }
12987
12989 {
12991 {
12992 #ifdef DEVELOPER
12993 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12994 {
12995 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12997 }
12998 #endif
12999
13000 return GetQuantity() * GetConfigWeightModified();
13001 }
13002 else if (HasEnergyManager())
13003 {
13004 #ifdef DEVELOPER
13005 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13006 {
13007 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13008 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
13009 }
13010 #endif
13011 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13012 }
13013 else
13014 {
13015 #ifdef DEVELOPER
13016 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13017 {
13018 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13019 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
13020 }
13021 #endif
13022 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
13023 }
13024 }
13025
13028 {
13029 int item_count = 0;
13031
13032 GameInventory inventory = GetInventory();
13033 CargoBase cargo = inventory.
GetCargo();
13034 if (cargo != NULL)
13035 {
13037 }
13038
13040 for (int i = 0; i < nAttachments; ++i)
13041 {
13043 if (item)
13044 item_count += item.GetNumberOfItems();
13045 }
13046 return item_count;
13047 }
13048
13051 {
13052 float weight = 0;
13053 float wetness = 1;
13054 if (include_wetness)
13057 {
13058 weight = wetness * m_ConfigWeight;
13059 }
13061 {
13062 weight = 1;
13063 }
13064 return weight;
13065 }
13066
13067
13068
13070 {
13071 GameInventory inventory = GetInventory();
13072 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13073 {
13074 array<EntityAI> items = new array<EntityAI>;
13076 for (int i = 0; i < items.Count(); ++i)
13077 {
13079 if (item)
13080 {
13081 g_Game.ObjectDelete(item);
13082 }
13083 }
13084 }
13085 }
13086
13087
13088
13089
13091 {
13092 float energy = 0;
13093 if (HasEnergyManager())
13094 {
13095 energy = GetCompEM().GetEnergy();
13096 }
13097 return energy;
13098 }
13099
13100
13102 {
13103 super.OnEnergyConsumed();
13104
13106 }
13107
13109 {
13110 super.OnEnergyAdded();
13111
13113 }
13114
13115
13117 {
13118 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13119 {
13121 {
13122 float energy_0to1 = GetCompEM().GetEnergy0To1();
13124 }
13125 }
13126 }
13127
13128
13130 {
13131 return ConfigGetFloat("heatIsolation");
13132 }
13133
13135 {
13137 }
13138
13140 {
13141 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13142 if (
g_Game.ConfigIsExisting(paramPath))
13143 return g_Game.ConfigGetFloat(paramPath);
13144
13145 return 0.0;
13146 }
13147
13149 {
13150 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13151 if (
g_Game.ConfigIsExisting(paramPath))
13152 return g_Game.ConfigGetFloat(paramPath);
13153
13154 return 0.0;
13155 }
13156
13157 override void SetWet(
float value,
bool allow_client =
false)
13158 {
13159 if (!IsServerCheck(allow_client))
13160 return;
13161
13164
13166
13167 m_VarWet = Math.Clamp(value, min, max);
13168
13170 {
13173 }
13174 }
13175
13176 override void AddWet(
float value)
13177 {
13179 }
13180
13182 {
13184 }
13185
13187 {
13189 }
13190
13192 {
13194 }
13195
13197 {
13199 }
13200
13202 {
13204 }
13205
13206 override void OnWetChanged(
float newVal,
float oldVal)
13207 {
13210 if (newLevel != oldLevel)
13211 {
13213 }
13214 }
13215
13217 {
13218 SetWeightDirty();
13219 }
13220
13222 {
13223 return GetWetLevelInternal(
m_VarWet);
13224 }
13225
13226
13227
13229 {
13231 }
13232
13234 {
13236 }
13237
13239 {
13241 }
13242
13244 {
13246 }
13247
13248
13249
13251 {
13252 if (ConfigIsExisting("itemModelLength"))
13253 {
13254 return ConfigGetFloat("itemModelLength");
13255 }
13256 return 0;
13257 }
13258
13260 {
13261 if (ConfigIsExisting("itemAttachOffset"))
13262 {
13263 return ConfigGetFloat("itemAttachOffset");
13264 }
13265 return 0;
13266 }
13267
13268 override void SetCleanness(
int value,
bool allow_client =
false)
13269 {
13270 if (!IsServerCheck(allow_client))
13271 return;
13272
13274
13276
13279 }
13280
13282 {
13284 }
13285
13287 {
13288 return true;
13289 }
13290
13291
13292
13293
13295 {
13297 }
13298
13300 {
13302 }
13303
13304
13305
13306
13307 override void SetColor(
int r,
int g,
int b,
int a)
13308 {
13314 }
13316 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13317 {
13322 }
13323
13325 {
13327 }
13328
13331 {
13332 int r,g,b,a;
13334 r = r/255;
13335 g = g/255;
13336 b = b/255;
13337 a = a/255;
13338 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13339 }
13340
13341
13342
13343 override void SetLiquidType(
int value,
bool allow_client =
false)
13344 {
13345 if (!IsServerCheck(allow_client))
13346 return;
13347
13352 }
13353
13355 {
13356 return ConfigGetInt("varLiquidTypeInit");
13357 }
13358
13360 {
13362 }
13363
13365 {
13367 SetFrozen(false);
13368 }
13369
13372 {
13373 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13374 }
13375
13376
13379 {
13380 PlayerBase nplayer;
13381 if (PlayerBase.CastTo(nplayer, player))
13382 {
13384 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13385 }
13386 }
13387
13388
13391 {
13392 PlayerBase nplayer;
13393 if (PlayerBase.CastTo(nplayer,player))
13394 {
13395 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13396 }
13397
13398 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13399
13400 if (HasEnergyManager())
13401 {
13402 GetCompEM().UpdatePlugState();
13403 }
13404 }
13405
13406
13408 {
13409 super.OnPlacementStarted(player);
13410
13412 }
13413
13414 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13415 {
13417 {
13418 m_AdminLog.OnPlacementComplete(player,
this);
13419 }
13420
13421 super.OnPlacementComplete(player, position, orientation);
13422 }
13423
13424
13425
13426
13427
13429 {
13431 {
13432 return true;
13433 }
13434 else
13435 {
13436 return false;
13437 }
13438 }
13439
13440
13442 {
13444 {
13446 }
13447 }
13448
13449
13451 {
13453 }
13454
13456 {
13458 }
13459
13460 override void InsertAgent(
int agent,
float count = 1)
13461 {
13462 if (count < 1)
13463 return;
13464
13466 }
13467
13470 {
13472 }
13473
13474
13476 {
13478 }
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13522 {
13524 return false;
13525 return true;
13526 }
13527
13529 {
13530
13532 }
13533
13534
13537 {
13538 super.CheckForRoofLimited(timeTresholdMS);
13539
13540 float time =
g_Game.GetTime();
13541 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13542 {
13543 m_PreviousRoofTestTime = time;
13544 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13545 }
13546 }
13547
13548
13550 {
13552 {
13553 return 0;
13554 }
13555
13556 if (GetInventory().GetAttachmentSlotsCount() != 0)
13557 {
13558 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13559 if (filter)
13560 return filter.GetProtectionLevel(type, false, system);
13561 else
13562 return 0;
13563 }
13564
13565 string subclassPath, entryName;
13566
13567 switch (type)
13568 {
13570 entryName = "biological";
13571 break;
13573 entryName = "chemical";
13574 break;
13575 default:
13576 entryName = "biological";
13577 break;
13578 }
13579
13580 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13581
13582 return g_Game.ConfigGetFloat(subclassPath + entryName);
13583 }
13584
13585
13586
13589 {
13590 if (!IsMagazine())
13592
13594 }
13595
13596
13597
13598
13599
13604 {
13605 return true;
13606 }
13607
13609 {
13611 }
13612
13613
13614
13615
13616
13618 {
13619 if (parent)
13620 {
13621 if (parent.IsInherited(DayZInfected))
13622 return true;
13623
13624 if (!parent.IsRuined())
13625 return true;
13626 }
13627
13628 return true;
13629 }
13630
13632 {
13633 if (!super.CanPutAsAttachment(parent))
13634 {
13635 return false;
13636 }
13637
13638 if (!IsRuined() && !parent.IsRuined())
13639 {
13640 return true;
13641 }
13642
13643 return false;
13644 }
13645
13647 {
13648
13649
13650
13651
13652 return super.CanReceiveItemIntoCargo(item);
13653 }
13654
13656 {
13657
13658
13659
13660
13661 GameInventory attachmentInv = attachment.GetInventory();
13663 {
13664 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13665 return false;
13666 }
13667
13668 InventoryLocation loc = new InventoryLocation();
13669 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13670 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13671 return false;
13672
13673 return super.CanReceiveAttachment(attachment, slotId);
13674 }
13675
13677 {
13678 if (!super.CanReleaseAttachment(attachment))
13679 return false;
13680
13681 return GetInventory().AreChildrenAccessible();
13682 }
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13705 {
13706 int id = muzzle_owner.GetMuzzleID();
13707 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13708
13709 if (WPOF_array)
13710 {
13711 for (int i = 0; i < WPOF_array.Count(); i++)
13712 {
13713 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13714
13715 if (WPOF)
13716 {
13717 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13718 }
13719 }
13720 }
13721 }
13722
13723
13725 {
13726 int id = muzzle_owner.GetMuzzleID();
13728
13729 if (WPOBE_array)
13730 {
13731 for (int i = 0; i < WPOBE_array.Count(); i++)
13732 {
13733 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13734
13735 if (WPOBE)
13736 {
13737 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13738 }
13739 }
13740 }
13741 }
13742
13743
13745 {
13746 int id = muzzle_owner.GetMuzzleID();
13747 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13748
13749 if (WPOOH_array)
13750 {
13751 for (int i = 0; i < WPOOH_array.Count(); i++)
13752 {
13753 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13754
13755 if (WPOOH)
13756 {
13757 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13758 }
13759 }
13760 }
13761 }
13762
13763
13765 {
13766 int id = muzzle_owner.GetMuzzleID();
13767 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13768
13769 if (WPOOH_array)
13770 {
13771 for (int i = 0; i < WPOOH_array.Count(); i++)
13772 {
13773 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13774
13775 if (WPOOH)
13776 {
13777 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13778 }
13779 }
13780 }
13781 }
13782
13783
13785 {
13786 int id = muzzle_owner.GetMuzzleID();
13787 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13788
13789 if (WPOOH_array)
13790 {
13791 for (int i = 0; i < WPOOH_array.Count(); i++)
13792 {
13793 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13794
13795 if (WPOOH)
13796 {
13797 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13798 }
13799 }
13800 }
13801 }
13802
13803
13804
13806 {
13808 {
13809 return true;
13810 }
13811
13812 return false;
13813 }
13814
13816 {
13818 {
13819 return true;
13820 }
13821
13822 return false;
13823 }
13824
13826 {
13828 {
13829 return true;
13830 }
13831
13832 return false;
13833 }
13834
13836 {
13837 return false;
13838 }
13839
13842 {
13843 return UATimeSpent.DEFAULT_DEPLOY;
13844 }
13845
13846
13847
13848
13850 {
13852 SetSynchDirty();
13853 }
13854
13856 {
13858 }
13859
13860
13862 {
13863 return false;
13864 }
13865
13868 {
13869 string att_type = "None";
13870
13871 if (ConfigIsExisting("soundAttType"))
13872 {
13873 att_type = ConfigGetString("soundAttType");
13874 }
13875
13877 }
13878
13880 {
13882 }
13883
13884
13885
13886
13887
13893
13895 {
13898
13900 }
13901
13902
13904 {
13906 return;
13907
13909
13912
13915
13916 SoundParameters params = new SoundParameters();
13920 }
13921
13922
13924 {
13926 {
13929
13930 SetSynchDirty();
13931
13934 }
13935 }
13936
13938 {
13940 }
13941
13942
13944 {
13946 return;
13947
13949 SetSynchDirty();
13950
13953 }
13954
13956 {
13959 }
13960
13962 {
13964 }
13965
13966 void OnApply(PlayerBase player);
13967
13969 {
13970 return 1.0;
13971 };
13972
13974 {
13976 }
13977
13979 {
13981 }
13982
13984
13986 {
13987 SetDynamicPhysicsLifeTime(0.01);
13989 }
13990
13992 {
13993 array<string> zone_names = new array<string>;
13994 GetDamageZones(zone_names);
13995 for (int i = 0; i < zone_names.Count(); i++)
13996 {
13997 SetHealthMax(zone_names.Get(i),"Health");
13998 }
13999 SetHealthMax("","Health");
14000 }
14001
14004 {
14005 float global_health = GetHealth01("","Health");
14006 array<string> zones = new array<string>;
14007 GetDamageZones(zones);
14008
14009 for (int i = 0; i < zones.Count(); i++)
14010 {
14011 SetHealth01(zones.Get(i),"Health",global_health);
14012 }
14013 }
14014
14017 {
14018 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14019 }
14020
14022 {
14023 if (!hasRootAsPlayer)
14024 {
14025 if (refParentIB)
14026 {
14027
14028 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
14029 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14030
14031 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
14032 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14033
14036 }
14037 else
14038 {
14039
14042 }
14043 }
14044 }
14045
14047 {
14049 {
14050 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
14051 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
14052 {
14053 float heatPermCoef = 1.0;
14055 while (ent)
14056 {
14057 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14058 ent = ent.GetHierarchyParent();
14059 }
14060
14061 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14062 }
14063 }
14064 }
14065
14067 {
14068
14069 EntityAI parent = GetHierarchyParent();
14070 if (!parent)
14071 {
14072 hasParent = false;
14073 hasRootAsPlayer = false;
14074 }
14075 else
14076 {
14077 hasParent = true;
14078 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14079 refParentIB =
ItemBase.Cast(parent);
14080 }
14081 }
14082
14083 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14084 {
14085
14086 }
14087
14089 {
14090
14091 return false;
14092 }
14093
14095 {
14096
14097
14098 return false;
14099 }
14100
14102 {
14103
14104 return false;
14105 }
14106
14109 {
14110 return !GetIsFrozen() &&
IsOpen();
14111 }
14112
14114 {
14115 bool hasParent = false, hasRootAsPlayer = false;
14117
14118 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14119 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14120
14121 if (wwtu || foodDecay)
14122 {
14126
14127 if (processWetness || processTemperature || processDecay)
14128 {
14130
14131 if (processWetness)
14132 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14133
14134 if (processTemperature)
14136
14137 if (processDecay)
14138 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14139 }
14140 }
14141 }
14142
14145 {
14147 }
14148
14150 {
14153
14154 return super.GetTemperatureFreezeThreshold();
14155 }
14156
14158 {
14161
14162 return super.GetTemperatureThawThreshold();
14163 }
14164
14166 {
14169
14170 return super.GetItemOverheatThreshold();
14171 }
14172
14174 {
14176 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14177
14178 return super.GetTemperatureFreezeTime();
14179 }
14180
14182 {
14184 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14185
14186 return super.GetTemperatureThawTime();
14187 }
14188
14193
14195 {
14196 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14197 }
14198
14200 {
14201 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14202 }
14203
14206 {
14208 }
14209
14211 {
14213 }
14214
14216 {
14218 }
14219
14222 {
14223 return null;
14224 }
14225
14228 {
14229 return false;
14230 }
14231
14233 {
14235 {
14238 if (!trg)
14239 {
14241 explosive = this;
14242 }
14243
14244 explosive.PairRemote(trg);
14246
14247 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14248 trg.SetPersistentPairID(persistentID);
14249 explosive.SetPersistentPairID(persistentID);
14250
14251 return true;
14252 }
14253 return false;
14254 }
14255
14258 {
14259 float ret = 1.0;
14262 ret *= GetHealth01();
14263
14264 return ret;
14265 }
14266
14267 #ifdef DEVELOPER
14268 override void SetDebugItem()
14269 {
14270 super.SetDebugItem();
14271 _itemBase = this;
14272 }
14273
14275 {
14276 string text = super.GetDebugText();
14277
14279 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14280
14281 return text;
14282 }
14283 #endif
14284
14286 {
14287 return true;
14288 }
14289
14291
14293
14295 {
14298 }
14299
14300
14308
14324
14325 [
Obsolete(
"Use ItemSoundHandler instead")]
14328 {
14329 if (!
g_Game.IsDedicatedServer())
14330 {
14331 if (ConfigIsExisting("attachSoundSet"))
14332 {
14333 string cfg_path = "";
14334 string soundset = "";
14335 string type_name =
GetType();
14336
14339 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14340 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14341
14342 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14343 {
14344 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14345 {
14346 if (cfg_slot_array[i] == slot_type)
14347 {
14348 soundset = cfg_soundset_array[i];
14349 break;
14350 }
14351 }
14352 }
14353
14354 if (soundset != "")
14355 {
14356 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14358 }
14359 }
14360 }
14361 }
14362
14364}
14365
14367{
14369 if (entity)
14370 {
14371 bool is_item = entity.IsInherited(
ItemBase);
14372 if (is_item && full_quantity)
14373 {
14376 }
14377 }
14378 else
14379 {
14381 return NULL;
14382 }
14383 return entity;
14384}
14385
14387{
14388 if (item)
14389 {
14390 if (health > 0)
14391 item.SetHealth("", "", health);
14392
14393 if (item.CanHaveTemperature())
14394 {
14396 if (item.CanFreeze())
14397 item.SetFrozen(false);
14398 }
14399
14400 if (item.HasEnergyManager())
14401 {
14402 if (quantity >= 0)
14403 {
14404 item.GetCompEM().SetEnergy0To1(quantity);
14405 }
14406 else
14407 {
14409 }
14410 }
14411 else if (item.IsMagazine())
14412 {
14413 Magazine mag = Magazine.Cast(item);
14414 if (quantity >= 0)
14415 {
14416 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14417 }
14418 else
14419 {
14421 }
14422
14423 }
14424 else
14425 {
14426 if (quantity >= 0)
14427 {
14428 item.SetQuantityNormalized(quantity, false);
14429 }
14430 else
14431 {
14433 }
14434
14435 }
14436 }
14437}
14438
14439#ifdef DEVELOPER
14441#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.