9401{
9403 {
9404 return true;
9405 }
9406};
9407
9409{
9410
9411};
9412
9413
9414
9416{
9420
9422
9425
9426
9427
9428
9429
9438
9444
9449
9454
9475 protected bool m_IsResultOfSplit
9476
9478
9483
9484
9485
9487
9491
9492
9493
9495
9498
9499
9500
9506
9507
9515
9518
9519
9521
9522
9524
9525
9530
9531
9536
9538
9539
9541
9542
9544 {
9549
9550 if (!
g_Game.IsDedicatedServer())
9551 {
9553 {
9555
9557 {
9559 }
9560 }
9561
9564 }
9565
9566 m_OldLocation = null;
9567
9569 {
9571 }
9572
9573 if (ConfigIsExisting("headSelectionsToHide"))
9574 {
9577 }
9578
9580 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9581 {
9583 }
9584
9586
9587 m_IsResultOfSplit = false;
9588
9590 }
9591
9593 {
9594 super.InitItemVariables();
9595
9601 m_Count = ConfigGetInt(
"count");
9602
9605
9610
9613
9618
9630
9634
9635
9638 if (ConfigIsExisting("canBeSplit"))
9639 {
9642 }
9643
9645 if (ConfigIsExisting("itemBehaviour"))
9647
9648
9651 RegisterNetSyncVariableInt("m_VarLiquidType");
9652 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9653
9654 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9655 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9656 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9657
9658 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9659 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9660 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9661 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9662
9663 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9664 RegisterNetSyncVariableBool("m_IsTakeable");
9665 RegisterNetSyncVariableBool("m_IsHologram");
9666
9669 {
9672 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9673 }
9674
9676
9678 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9680
9682 }
9683
9685 {
9687 }
9688
9690 {
9693 {
9698 }
9699 }
9700
9701 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9702 {
9704 {
9707 }
9708
9710 }
9711
9713 {
9719 }
9720
9722
9724 {
9726
9727 if (!action)
9728 {
9729 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9730 return;
9731 }
9732
9734 if (!ai)
9735 {
9737 return;
9738 }
9739
9741 if (!action_array)
9742 {
9743 action_array = new array<ActionBase_Basic>;
9745 }
9746 if (LogManager.IsActionLogEnable())
9747 {
9748 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9749 }
9750
9751 if (action_array.Find(action) != -1)
9752 {
9753 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9754 }
9755 else
9756 {
9757 action_array.Insert(action);
9758 }
9759 }
9760
9762 {
9763 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9764 ActionBase action = player.GetActionManager().GetAction(actionName);
9767
9768 if (action_array)
9769 {
9770 action_array.RemoveItem(action);
9771 }
9772 }
9773
9774
9775
9777 {
9778 ActionOverrideData overrideData = new ActionOverrideData();
9782
9784 if (!actionMap)
9785 {
9788 }
9789
9790 actionMap.Insert(this.
Type(), overrideData);
9791
9792 }
9793
9795
9797
9798
9800 {
9803
9806
9807 string config_to_search = "CfgVehicles";
9808 string muzzle_owner_config;
9809
9811 {
9812 if (IsInherited(Weapon))
9813 config_to_search = "CfgWeapons";
9814
9815 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9816
9817 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9818
9819 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9820
9821 if (config_OnFire_subclass_count > 0)
9822 {
9823 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9824
9825 for (int i = 0; i < config_OnFire_subclass_count; i++)
9826 {
9827 string particle_class = "";
9828 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9829 string config_OnFire_entry = config_OnFire_class + particle_class;
9830 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9831 WPOF_array.Insert(WPOF);
9832 }
9833
9834
9836 }
9837 }
9838
9840 {
9841 config_to_search = "CfgWeapons";
9842 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9843
9844 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9845
9846 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9847
9848 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9849 {
9850 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9851
9852 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9853 {
9854 string particle_class2 = "";
9855 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9856 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9857 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9858 WPOBE_array.Insert(WPOBE);
9859 }
9860
9861
9863 }
9864 }
9865 }
9866
9867
9869 {
9872
9874 {
9875 string config_to_search = "CfgVehicles";
9876
9877 if (IsInherited(Weapon))
9878 config_to_search = "CfgWeapons";
9879
9880 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9881 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9882
9883 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9884 {
9885
9887
9889 {
9891 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9893 return;
9894 }
9895
9898
9899
9900
9901 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9902 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9903
9904 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9905 {
9906 string particle_class = "";
9907 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9908 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9909 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9910
9911 if (entry_type == CT_CLASS)
9912 {
9913 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9914 WPOOH_array.Insert(WPOF);
9915 }
9916 }
9917
9918
9920 }
9921 }
9922 }
9923
9925 {
9927 }
9928
9930 {
9932 {
9934
9937
9940
9941 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9942 }
9943 }
9944
9946 {
9948 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9949
9951 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9952
9954 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9955
9957 {
9959 }
9960 }
9961
9963 {
9965 }
9966
9968 {
9971 else
9973
9975 {
9978 }
9979 else
9980 {
9983
9986 }
9987
9989 }
9990
9992 {
9994 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9995 }
9996
9998 {
10000 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
10002 }
10003
10005 {
10007 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10008 }
10009
10011 {
10014
10015 OverheatingParticle OP = new OverheatingParticle();
10020
10022 }
10023
10025 {
10028
10029 return -1;
10030 }
10031
10033 {
10035 {
10038
10039 for (int i = count; i > 0; --i)
10040 {
10041 int id = i - 1;
10044
10047
10048 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10049 {
10050 if (p)
10051 {
10054 }
10055 }
10056 }
10057 }
10058 }
10059
10061 {
10063 {
10065 {
10066 int id = i - 1;
10068
10069 if (OP)
10070 {
10072
10073 if (p)
10074 {
10076 }
10077
10078 delete OP;
10079 }
10080 }
10081
10084 }
10085 }
10086
10089 {
10090 return 0.0;
10091 }
10092
10093
10095 {
10096 return 250;
10097 }
10098
10100 {
10101 return 0;
10102 }
10103
10106 {
10108 return true;
10109
10110 return false;
10111 }
10112
10115 {
10118
10120 {
10122 }
10123 else
10124 {
10125
10127 }
10128
10130 }
10131
10138 {
10139 return -1;
10140 }
10141
10142
10143
10144
10146 {
10148 {
10149 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10150 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10151
10152 if (r_index >= 0)
10153 {
10154 InventoryLocation r_il = new InventoryLocation;
10155 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10156
10157 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10160 {
10161 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10162 }
10164 {
10165 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10166 }
10167
10168 }
10169
10170 player.GetHumanInventory().ClearUserReservedLocation(this);
10171 }
10172
10175 }
10176
10177
10178
10179
10181 {
10182 return ItemBase.m_DebugActionsMask;
10183 }
10184
10186 {
10187 return ItemBase.m_DebugActionsMask & mask;
10188 }
10189
10191 {
10192 ItemBase.m_DebugActionsMask = mask;
10193 }
10194
10196 {
10197 ItemBase.m_DebugActionsMask |= mask;
10198 }
10199
10201 {
10202 ItemBase.m_DebugActionsMask &= ~mask;
10203 }
10204
10206 {
10208 {
10210 }
10211 else
10212 {
10214 }
10215 }
10216
10217
10219 {
10220 if (GetEconomyProfile())
10221 {
10222 float q_max = GetEconomyProfile().GetQuantityMax();
10223 if (q_max > 0)
10224 {
10225 float q_min = GetEconomyProfile().GetQuantityMin();
10226 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10227
10229 {
10230 ComponentEnergyManager comp = GetCompEM();
10232 {
10234 }
10235 }
10237 {
10239
10240 }
10241
10242 }
10243 }
10244 }
10245
10248 {
10249 EntityAI parent = GetHierarchyParent();
10250
10251 if (parent)
10252 {
10253 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10254 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10255 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10256 }
10257 }
10258
10261 {
10262 EntityAI parent = GetHierarchyParent();
10263
10264 if (parent)
10265 {
10266 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10267 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10268 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10269 }
10270 }
10271
10273 {
10274
10275
10276
10277
10279
10281 {
10282 if (ScriptInputUserData.CanStoreInputUserData())
10283 {
10284 ScriptInputUserData ctx = new ScriptInputUserData;
10290 ctx.
Write(use_stack_max);
10293
10295 {
10296 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10297 }
10298 }
10299 }
10300 else if (!
g_Game.IsMultiplayer())
10301 {
10303 }
10304 }
10305
10307 {
10309 }
10310
10312 {
10314 }
10315
10317 {
10319 }
10320
10322 {
10323
10324 return false;
10325 }
10326
10328 {
10329 return false;
10330 }
10331
10335 {
10336 return false;
10337 }
10338
10340 {
10341 return "";
10342 }
10343
10345
10347 {
10348 return false;
10349 }
10350
10352 {
10353 return true;
10354 }
10355
10356
10357
10359 {
10360 return true;
10361 }
10362
10364 {
10365 return true;
10366 }
10367
10369 {
10370 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10372 }
10373
10375 {
10377 }
10378
10380 {
10382 if (!is_being_placed)
10384 SetSynchDirty();
10385 }
10386
10387
10389
10391 {
10393 }
10394
10396 {
10398 }
10399
10401 {
10402 return 1;
10403 }
10404
10406 {
10407 return false;
10408 }
10409
10411 {
10413 SetSynchDirty();
10414 }
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10451 {
10452 super.OnMovedInsideCargo(container);
10453
10454 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10455 }
10456
10457 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10458 {
10459 super.EEItemLocationChanged(oldLoc, newLoc);
10460
10461 PlayerBase newPlayer = null;
10462 PlayerBase oldPlayer = null;
10463
10464 if (newLoc.GetParent())
10465 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10466
10467 if (oldLoc.GetParent())
10468 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10469
10471 {
10472 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10473
10474 if (rIndex >= 0)
10475 {
10476 InventoryLocation rIl = new InventoryLocation;
10477 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10478
10479 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10482 {
10483 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10484 }
10486 {
10488 }
10489
10490 }
10491 }
10492
10494 {
10495 if (newPlayer)
10496 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10497
10498 if (newPlayer == oldPlayer)
10499 {
10500 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10501 {
10503 {
10504 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10505 {
10506 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10507 }
10508 }
10509 else
10510 {
10511 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10512 }
10513 }
10514
10515 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10516 {
10517 int type = oldLoc.GetType();
10519 {
10520 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10521 }
10523 {
10524 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10525 }
10526 }
10527 if (!m_OldLocation)
10528 {
10529 m_OldLocation = new InventoryLocation;
10530 }
10531 m_OldLocation.Copy(oldLoc);
10532 }
10533 else
10534 {
10535 if (m_OldLocation)
10536 {
10537 m_OldLocation.Reset();
10538 }
10539 }
10540
10541 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10542 }
10543 else
10544 {
10545 if (newPlayer)
10546 {
10547 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10548 if (resIndex >= 0)
10549 {
10550 InventoryLocation il = new InventoryLocation;
10551 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10553 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10556 {
10557 il.
GetParent().GetOnReleaseLock().Invoke(it);
10558 }
10560 {
10562 }
10563
10564 }
10565 }
10567 {
10568
10570 }
10571
10572 if (m_OldLocation)
10573 {
10574 m_OldLocation.Reset();
10575 }
10576 }
10577
10579 {
10580 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10581 }
10582
10584 {
10585 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10586 }
10587 }
10588
10589 override void EOnContact(IEntity other, Contact extra)
10590 {
10592 {
10593 int liquidType = -1;
10595 if (impactSpeed > 0.0)
10596 {
10598 #ifndef SERVER
10600 #else
10602 SetSynchDirty();
10603 #endif
10605 }
10606 }
10607
10608 #ifdef SERVER
10609 if (GetCompEM() && GetCompEM().IsPlugged())
10610 {
10611 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10612 GetCompEM().UnplugThis();
10613 }
10614 #endif
10615 }
10616
10618
10620 {
10622 }
10623
10625 {
10626
10627 }
10628
10630 {
10631 super.OnItemLocationChanged(old_owner, new_owner);
10632
10633 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10634 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10635
10636 if (!relatedPlayer && playerNew)
10637 relatedPlayer = playerNew;
10638
10639 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10640 {
10642 if (actionMgr)
10643 {
10644 ActionBase currentAction = actionMgr.GetRunningAction();
10645 if (currentAction)
10647 }
10648 }
10649
10650 Man ownerPlayerOld = null;
10651 Man ownerPlayerNew = null;
10652
10653 if (old_owner)
10654 {
10655 if (old_owner.
IsMan())
10656 {
10657 ownerPlayerOld = Man.Cast(old_owner);
10658 }
10659 else
10660 {
10661 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10662 }
10663 }
10664 else
10665 {
10667 {
10669
10670 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10671 {
10672 GetCompEM().UnplugThis();
10673 }
10674 }
10675 }
10676
10677 if (new_owner)
10678 {
10679 if (new_owner.
IsMan())
10680 {
10681 ownerPlayerNew = Man.Cast(new_owner);
10682 }
10683 else
10684 {
10685 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10686 }
10687 }
10688
10689 if (ownerPlayerOld != ownerPlayerNew)
10690 {
10691 if (ownerPlayerOld)
10692 {
10693 array<EntityAI> subItemsExit = new array<EntityAI>;
10695 for (int i = 0; i < subItemsExit.Count(); i++)
10696 {
10699 }
10700 }
10701
10702 if (ownerPlayerNew)
10703 {
10704 array<EntityAI> subItemsEnter = new array<EntityAI>;
10706 for (int j = 0; j < subItemsEnter.Count(); j++)
10707 {
10710 }
10711 }
10712 }
10713 else if (ownerPlayerNew != null)
10714 {
10715 PlayerBase nplayer;
10716 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10717 {
10718 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10720 for (int k = 0; k < subItemsUpdate.Count(); k++)
10721 {
10723 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10724 }
10725 }
10726 }
10727
10728 if (old_owner)
10729 old_owner.OnChildItemRemoved(this);
10730 if (new_owner)
10731 new_owner.OnChildItemReceived(this);
10732 }
10733
10734
10736 {
10737 super.EEDelete(parent);
10738 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10739 if (player)
10740 {
10742
10743 if (player.IsAlive())
10744 {
10745 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10746 if (r_index >= 0)
10747 {
10748 InventoryLocation r_il = new InventoryLocation;
10749 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10750
10751 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10754 {
10755 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10756 }
10758 {
10759 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10760 }
10761
10762 }
10763
10764 player.RemoveQuickBarEntityShortcut(this);
10765 }
10766 }
10767 }
10768
10770 {
10771 super.EEKilled(killer);
10772
10775 {
10776 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10777 {
10778 if (IsMagazine())
10779 {
10780 if (Magazine.Cast(this).GetAmmoCount() > 0)
10781 {
10783 }
10784 }
10785 else
10786 {
10788 }
10789 }
10790 }
10791 }
10792
10794 {
10795 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10796
10797 super.OnWasAttached(parent, slot_id);
10798
10801
10804 }
10805
10807 {
10808 super.OnWasDetached(parent, slot_id);
10809
10812
10815 }
10816
10818 {
10819 int idx;
10822
10823 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10824 if (inventory_slots.Count() < 1)
10825 {
10826 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10827 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10828 }
10829 else
10830 {
10831 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10832 }
10833
10834 idx = inventory_slots.Find(slot);
10835 if (idx < 0)
10836 return "";
10837
10838 return attach_types.Get(idx);
10839 }
10840
10842 {
10843 int idx = -1;
10844 string slot;
10845
10848
10849 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10850 if (inventory_slots.Count() < 1)
10851 {
10852 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10853 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10854 }
10855 else
10856 {
10857 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10858 if (detach_types.Count() < 1)
10859 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10860 }
10861
10862 for (int i = 0; i < inventory_slots.Count(); i++)
10863 {
10864 slot = inventory_slots.Get(i);
10865 }
10866
10867 if (slot != "")
10868 {
10869 if (detach_types.Count() == 1)
10870 idx = 0;
10871 else
10872 idx = inventory_slots.Find(slot);
10873 }
10874 if (idx < 0)
10875 return "";
10876
10877 return detach_types.Get(idx);
10878 }
10879
10881 {
10882
10884
10885
10886 float min_time = 1;
10887 float max_time = 3;
10888 float delay = Math.RandomFloat(min_time, max_time);
10889
10890 explode_timer.Run(delay, this, "DoAmmoExplosion");
10891 }
10892
10894 {
10895 Magazine magazine = Magazine.Cast(this);
10896 int pop_sounds_count = 6;
10897 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10898
10899
10900 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10901 string sound_name = pop_sounds[ sound_idx ];
10902 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10903
10904
10905 magazine.ServerAddAmmoCount(-1);
10906
10907
10908 float min_temp_to_explode = 100;
10909
10910 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10911 {
10913 }
10914 }
10915
10916
10917 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10918 {
10919 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10920
10921 const int CHANCE_DAMAGE_CARGO = 4;
10922 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10923 const int CHANCE_DAMAGE_NOTHING = 2;
10924
10926 {
10927 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10928 int chances;
10929 int rnd;
10930
10931 if (GetInventory().GetCargo())
10932 {
10933 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10934 rnd = Math.RandomInt(0,chances);
10935
10936 if (rnd < CHANCE_DAMAGE_CARGO)
10937 {
10939 }
10940 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10941 {
10943 }
10944 }
10945 else
10946 {
10947 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10948 rnd = Math.RandomInt(0,chances);
10949
10950 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10951 {
10953 }
10954 }
10955 }
10956 }
10957
10959 {
10960 CargoBase cargo = GetInventory().GetCargo();
10961 if (cargo)
10962 {
10964 if (item_count > 0)
10965 {
10966 int random_pick = Math.RandomInt(0, item_count);
10968 if (!item.IsExplosive())
10969 {
10970 item.AddHealth("","",damage);
10971 return true;
10972 }
10973 }
10974 }
10975 return false;
10976 }
10977
10979 {
10980 GameInventory inventory = GetInventory();
10982 if (attachment_count > 0)
10983 {
10984 int random_pick = Math.RandomInt(0, attachment_count);
10986 if (!attachment.IsExplosive())
10987 {
10988 attachment.AddHealth("","",damage);
10989 return true;
10990 }
10991 }
10992 return false;
10993 }
10994
10996 {
10998 }
10999
11001 {
11003 return GetInventory().CanRemoveEntity();
11004
11005 return false;
11006 }
11007
11009 {
11010
11012 return false;
11013
11014
11016 return false;
11017
11018
11019
11021 if (delta == 0)
11022 return false;
11023
11024
11025 return true;
11026 }
11027
11029 {
11031 {
11032 if (ScriptInputUserData.CanStoreInputUserData())
11033 {
11034 ScriptInputUserData ctx = new ScriptInputUserData;
11039 ctx.
Write(destination_entity);
11041 ctx.
Write(slot_id);
11043 }
11044 }
11045 else if (!
g_Game.IsMultiplayer())
11046 {
11048 }
11049 }
11050
11052 {
11053 float split_quantity_new;
11057 InventoryLocation loc = new InventoryLocation;
11058
11059 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11060 {
11062 split_quantity_new = stack_max;
11063 else
11065
11067 {
11068 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11069 if (new_item)
11070 {
11071 new_item.SetResultOfSplit(true);
11072 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11074 new_item.
SetQuantity(split_quantity_new,
false,
true);
11075 }
11076 }
11077 }
11078 else if (destination_entity && slot_id == -1)
11079 {
11080 if (quantity > stack_max)
11081 split_quantity_new = stack_max;
11082 else
11083 split_quantity_new = quantity;
11084
11086 {
11087 GameInventory destinationInventory = destination_entity.GetInventory();
11089 {
11092 }
11093
11094 if (new_item)
11095 {
11096 new_item.SetResultOfSplit(true);
11097 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11099 new_item.
SetQuantity(split_quantity_new,
false,
true);
11100 }
11101 }
11102 }
11103 else
11104 {
11105 if (stack_max != 0)
11106 {
11108 {
11110 }
11111
11112 if (split_quantity_new == 0)
11113 {
11114 if (!
g_Game.IsMultiplayer())
11115 player.PhysicalPredictiveDropItem(this);
11116 else
11117 player.ServerDropEntity(this);
11118 return;
11119 }
11120
11122 {
11124
11125 if (new_item)
11126 {
11127 new_item.SetResultOfSplit(true);
11128 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11131 new_item.PlaceOnSurface();
11132 }
11133 }
11134 }
11135 }
11136 }
11137
11139 {
11140 float split_quantity_new;
11144 InventoryLocation loc = new InventoryLocation;
11145
11146 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11147 {
11149 split_quantity_new = stack_max;
11150 else
11152
11154 {
11155 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11156 if (new_item)
11157 {
11158 new_item.SetResultOfSplit(true);
11159 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11161 new_item.
SetQuantity(split_quantity_new,
false,
true);
11162 }
11163 }
11164 }
11165 else if (destination_entity && slot_id == -1)
11166 {
11167 if (quantity > stack_max)
11168 split_quantity_new = stack_max;
11169 else
11170 split_quantity_new = quantity;
11171
11173 {
11174 GameInventory destinationInventory = destination_entity.GetInventory();
11176 {
11179 }
11180
11181 if (new_item)
11182 {
11183 new_item.SetResultOfSplit(true);
11184 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11186 new_item.
SetQuantity(split_quantity_new,
false,
true);
11187 }
11188 }
11189 }
11190 else
11191 {
11192 if (stack_max != 0)
11193 {
11195 {
11197 }
11198
11200 {
11202
11203 if (new_item)
11204 {
11205 new_item.SetResultOfSplit(true);
11206 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11209 new_item.PlaceOnSurface();
11210 }
11211 }
11212 }
11213 }
11214 }
11215
11217 {
11219 {
11220 if (ScriptInputUserData.CanStoreInputUserData())
11221 {
11222 ScriptInputUserData ctx = new ScriptInputUserData;
11227 dst.WriteToContext(ctx);
11229 }
11230 }
11231 else if (!
g_Game.IsMultiplayer())
11232 {
11234 }
11235 }
11236
11238 {
11240 {
11241 if (ScriptInputUserData.CanStoreInputUserData())
11242 {
11243 ScriptInputUserData ctx = new ScriptInputUserData;
11248 ctx.
Write(destination_entity);
11254 }
11255 }
11256 else if (!
g_Game.IsMultiplayer())
11257 {
11259 }
11260 }
11261
11263 {
11265 }
11266
11268 {
11270 float split_quantity_new;
11272 if (dst.IsValid())
11273 {
11274 int slot_id = dst.GetSlot();
11276
11277 if (quantity > stack_max)
11278 split_quantity_new = stack_max;
11279 else
11280 split_quantity_new = quantity;
11281
11283 {
11285
11286 if (new_item)
11287 {
11288 new_item.SetResultOfSplit(true);
11289 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11291 new_item.
SetQuantity(split_quantity_new,
false,
true);
11292 }
11293
11294 return new_item;
11295 }
11296 }
11297
11298 return null;
11299 }
11300
11302 {
11304 float split_quantity_new;
11306 if (destination_entity)
11307 {
11309 if (quantity > stackable)
11310 split_quantity_new = stackable;
11311 else
11312 split_quantity_new = quantity;
11313
11315 {
11316 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11317 if (new_item)
11318 {
11319 new_item.SetResultOfSplit(true);
11320 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11322 new_item.
SetQuantity(split_quantity_new,
false,
true);
11323 }
11324 }
11325 }
11326 }
11327
11329 {
11331 {
11332 if (ScriptInputUserData.CanStoreInputUserData())
11333 {
11334 ScriptInputUserData ctx = new ScriptInputUserData;
11339 ItemBase destination_entity =
this;
11340 ctx.
Write(destination_entity);
11344 }
11345 }
11346 else if (!
g_Game.IsMultiplayer())
11347 {
11349 }
11350 }
11351
11353 {
11355 float split_quantity_new;
11357 if (player)
11358 {
11360 if (quantity > stackable)
11361 split_quantity_new = stackable;
11362 else
11363 split_quantity_new = quantity;
11364
11366 {
11367 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11368 new_item =
ItemBase.Cast(in_hands);
11369 if (new_item)
11370 {
11371 new_item.SetResultOfSplit(true);
11372 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11374 new_item.SetQuantity(split_quantity_new, false, true);
11375 }
11376 }
11377 }
11378 }
11379
11381 {
11383 float split_quantity_new = Math.Floor(quantity * 0.5);
11384
11386 return;
11387
11389
11390 if (new_item)
11391 {
11392 if (new_item.GetQuantityMax() < split_quantity_new)
11393 {
11394 split_quantity_new = new_item.GetQuantityMax();
11395 }
11396
11397 new_item.SetResultOfSplit(true);
11398 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11399
11401 {
11404 }
11405 else
11406 {
11408 new_item.
SetQuantity(split_quantity_new,
false,
true);
11409 }
11410 }
11411 }
11412
11414 {
11416 float split_quantity_new = Math.Floor(quantity / 2);
11417
11419 return;
11420
11421 InventoryLocation invloc = new InventoryLocation;
11423
11425 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11426
11427 if (new_item)
11428 {
11429 if (new_item.GetQuantityMax() < split_quantity_new)
11430 {
11431 split_quantity_new = new_item.GetQuantityMax();
11432 }
11434 {
11437 }
11438 else if (split_quantity_new > 1)
11439 {
11441 new_item.
SetQuantity(split_quantity_new,
false,
true);
11442 }
11443 }
11444 }
11445
11448 {
11449 SetWeightDirty();
11451
11452 if (parent)
11453 parent.OnAttachmentQuantityChangedEx(this, delta);
11454
11456 {
11458 {
11460 }
11462 {
11463 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11465 }
11466 }
11467 }
11468
11471 {
11472
11473 }
11474
11477 {
11479 }
11480
11482 {
11483 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11484
11486 {
11487 if (newLevel == GameConstants.STATE_RUINED)
11488 {
11490 EntityAI parent = GetHierarchyParent();
11491 if (parent && parent.IsFireplace())
11492 {
11493 CargoBase cargo = GetInventory().GetCargo();
11494 if (cargo)
11495 {
11497 {
11499 }
11500 }
11501 }
11502 }
11503
11505 {
11506
11508 return;
11509 }
11510
11511 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11512 {
11514 }
11515 }
11516 }
11517
11518
11520 {
11521 super.OnRightClick();
11522
11524 {
11526 {
11527 if (ScriptInputUserData.CanStoreInputUserData())
11528 {
11529 EntityAI root = GetHierarchyRoot();
11530 Man playerOwner = GetHierarchyRootPlayer();
11531 InventoryLocation dst = new InventoryLocation;
11532
11533
11534 if (!playerOwner && root && root == this)
11535 {
11537 }
11538 else
11539 {
11540
11541 GetInventory().GetCurrentInventoryLocation(dst);
11543 {
11544 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11546 {
11548 }
11549 else
11550 {
11552
11553
11554 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11555 {
11557 }
11558 else
11559 {
11560 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11561 }
11562 }
11563 }
11564 }
11565
11566 ScriptInputUserData ctx = new ScriptInputUserData;
11574 }
11575 }
11576 else if (!
g_Game.IsMultiplayer())
11577 {
11579 }
11580 }
11581 }
11582
11584 {
11585 if (root)
11586 {
11587 vector m4[4];
11588 root.GetTransform(m4);
11589 dst.SetGround(this, m4);
11590 }
11591 else
11592 {
11593 GetInventory().GetCurrentInventoryLocation(dst);
11594 }
11595 }
11596
11597 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11598 {
11599
11600 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11601 return false;
11602
11603 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11604 return false;
11605
11606
11608 return false;
11609
11610
11611 Magazine mag = Magazine.Cast(this);
11612 if (mag)
11613 {
11614 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11615 return false;
11616
11617 if (stack_max_limit)
11618 {
11619 Magazine other_mag = Magazine.Cast(other_item);
11620 if (other_item)
11621 {
11622 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11623 return false;
11624 }
11625
11626 }
11627 }
11628 else
11629 {
11630
11632 return false;
11633
11635 return false;
11636 }
11637
11638 PlayerBase player = null;
11639 if (CastTo(player, GetHierarchyRootPlayer()))
11640 {
11641 if (player.GetInventory().HasAttachment(this))
11642 return false;
11643
11644 if (player.IsItemsToDelete())
11645 return false;
11646 }
11647
11648 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11649 return false;
11650
11651 int slotID;
11653 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11654 return false;
11655
11656 return true;
11657 }
11658
11660 {
11662 }
11663
11665 {
11666 return m_IsResultOfSplit;
11667 }
11668
11670 {
11671 m_IsResultOfSplit = value;
11672 }
11673
11675 {
11677 }
11678
11680 {
11681 float other_item_quantity = other_item.GetQuantity();
11682 float this_free_space;
11683
11685
11687
11688 if (other_item_quantity > this_free_space)
11689 {
11690 return this_free_space;
11691 }
11692 else
11693 {
11694 return other_item_quantity;
11695 }
11696 }
11697
11699 {
11701 }
11702
11704 {
11706 return;
11707
11708 if (!IsMagazine() && other_item)
11709 {
11711 if (quantity_used != 0)
11712 {
11713 float hp1 = GetHealth01("","");
11714 float hp2 = other_item.GetHealth01("","");
11715 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11716 hpResult = hpResult / (
GetQuantity() + quantity_used);
11717
11718 hpResult *= GetMaxHealth();
11719 Math.Round(hpResult);
11720 SetHealth("", "Health", hpResult);
11721
11723 other_item.AddQuantity(-quantity_used);
11724 }
11725 }
11727 }
11728
11730 {
11731 #ifdef SERVER
11732 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11733 GetHierarchyParent().IncreaseLifetimeUp();
11734 #endif
11735 };
11736
11738 {
11739 PlayerBase p = PlayerBase.Cast(player);
11740
11741 array<int> recipesIds = p.m_Recipes;
11742 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11743 if (moduleRecipesManager)
11744 {
11745 EntityAI itemInHands = player.GetEntityInHands();
11746 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11747 }
11748
11749 for (int i = 0;i < recipesIds.Count(); i++)
11750 {
11751 int key = recipesIds.Get(i);
11752 string recipeName = moduleRecipesManager.GetRecipeName(key);
11754 }
11755 }
11756
11757
11758 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11759 {
11760 super.GetDebugActions(outputList);
11761
11762
11768
11769
11774
11779
11780
11784
11785
11787 {
11791 }
11792
11795
11796
11800
11802
11803 InventoryLocation loc = new InventoryLocation();
11804 GetInventory().GetCurrentInventoryLocation(loc);
11806 {
11807 if (Gizmo_IsSupported())
11810 }
11811
11813 }
11814
11815
11816
11817
11819 {
11820 super.OnAction(action_id, player, ctx);
11821
11823 {
11824 switch (action_id)
11825 {
11829 return true;
11833 return true;
11834 }
11835 }
11836
11838 {
11839 switch (action_id)
11840 {
11842 Delete();
11843 return true;
11844 }
11845 }
11846
11847 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11848 {
11849 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11850 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11851 PlayerBase p = PlayerBase.Cast(player);
11852 if (
EActions.RECIPES_RANGE_START < 1000)
11853 {
11854 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11855 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11856 }
11857 }
11858 #ifndef SERVER
11859 else if (action_id ==
EActions.WATCH_PLAYER)
11860 {
11861 PluginDeveloper.SetDeveloperItemClientEx(player);
11862 }
11863 #endif
11865 {
11866 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11867 {
11868 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11869 OnDebugButtonPressServer(id + 1);
11870 }
11871
11872 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11873 {
11874 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11876 }
11877
11878 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11879 {
11880 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11882 }
11883
11884 else if (action_id ==
EActions.ADD_QUANTITY)
11885 {
11886 if (IsMagazine())
11887 {
11888 Magazine mag = Magazine.Cast(this);
11889 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11890 }
11891 else
11892 {
11894 }
11895
11896 if (m_EM)
11897 {
11898 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11899 }
11900
11901 }
11902
11903 else if (action_id ==
EActions.REMOVE_QUANTITY)
11904 {
11905 if (IsMagazine())
11906 {
11907 Magazine mag2 = Magazine.Cast(this);
11908 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11909 }
11910 else
11911 {
11913 }
11914 if (m_EM)
11915 {
11916 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11917 }
11918
11919 }
11920
11921 else if (action_id ==
EActions.SET_QUANTITY_0)
11922 {
11924
11925 if (m_EM)
11926 {
11927 m_EM.SetEnergy(0);
11928 }
11929 }
11930
11931 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11932 {
11934
11935 if (m_EM)
11936 {
11937 m_EM.SetEnergy(m_EM.GetEnergyMax());
11938 }
11939 }
11940
11941 else if (action_id ==
EActions.ADD_HEALTH)
11942 {
11943 AddHealth("","",GetMaxHealth("","Health")/5);
11944 }
11945 else if (action_id ==
EActions.REMOVE_HEALTH)
11946 {
11947 AddHealth("","",-GetMaxHealth("","Health")/5);
11948 }
11949 else if (action_id ==
EActions.DESTROY_HEALTH)
11950 {
11951 SetHealth01("","",0);
11952 }
11953 else if (action_id ==
EActions.WATCH_ITEM)
11954 {
11956 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11957 #ifdef DEVELOPER
11958 SetDebugDeveloper_item(this);
11959 #endif
11960 }
11961
11962 else if (action_id ==
EActions.ADD_TEMPERATURE)
11963 {
11964 AddTemperature(20);
11965
11966 }
11967
11968 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11969 {
11970 AddTemperature(-20);
11971
11972 }
11973
11974 else if (action_id ==
EActions.FLIP_FROZEN)
11975 {
11976 SetFrozen(!GetIsFrozen());
11977
11978 }
11979
11980 else if (action_id ==
EActions.ADD_WETNESS)
11981 {
11983
11984 }
11985
11986 else if (action_id ==
EActions.REMOVE_WETNESS)
11987 {
11989
11990 }
11991
11992 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11993 {
11996
11997
11998 }
11999
12000 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
12001 {
12004 }
12005
12006 else if (action_id ==
EActions.MAKE_SPECIAL)
12007 {
12008 auto debugParams = DebugSpawnParams.WithPlayer(player);
12009 OnDebugSpawnEx(debugParams);
12010 }
12011
12012 }
12013
12014
12015 return false;
12016 }
12017
12018
12019
12020
12024
12027
12028
12029
12031 {
12032 return false;
12033 }
12034
12035
12037 {
12038 return true;
12039 }
12040
12041
12043 {
12044 return true;
12045 }
12046
12047
12048
12050 {
12051 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
12052 return g_Game.ConfigIsExisting(config_path);
12053 }
12054
12057 {
12058 return null;
12059 }
12060
12062 {
12063 return false;
12064 }
12065
12067 {
12068 return false;
12069 }
12070
12074
12075
12077 {
12078 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12079 return module_repairing.CanRepair(this, item_repair_kit);
12080 }
12081
12082
12083 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12084 {
12085 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12086 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12087 }
12088
12089
12091 {
12092
12093
12094
12095
12096
12097
12098
12099
12100 return 1;
12101 }
12102
12103
12104
12106 {
12108 }
12109
12110
12111
12113 {
12115 }
12116
12117
12126 {
12127 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12128
12129 if (player)
12130 {
12131 player.MessageStatus(text);
12132 }
12133 }
12134
12135
12144 {
12145 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12146
12147 if (player)
12148 {
12149 player.MessageAction(text);
12150 }
12151 }
12152
12153
12162 {
12163 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12164
12165 if (player)
12166 {
12167 player.MessageFriendly(text);
12168 }
12169 }
12170
12171
12180 {
12181 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12182
12183 if (player)
12184 {
12185 player.MessageImportant(text);
12186 }
12187 }
12188
12190 {
12191 return true;
12192 }
12193
12194
12195 override bool KindOf(
string tag)
12196 {
12197 bool found = false;
12198 string item_name = this.
GetType();
12200 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12201
12202 int array_size = item_tag_array.Count();
12203 for (int i = 0; i < array_size; i++)
12204 {
12205 if (item_tag_array.Get(i) == tag)
12206 {
12207 found = true;
12208 break;
12209 }
12210 }
12211 return found;
12212 }
12213
12214
12216 {
12217
12218 super.OnRPC(sender, rpc_type,ctx);
12219
12220
12221 switch (rpc_type)
12222 {
12223 #ifndef SERVER
12224 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12225 Param2<bool, string> p = new Param2<bool, string>(false, "");
12226
12228 return;
12229
12230 bool play = p.param1;
12231 string soundSet = p.param2;
12232
12233 if (play)
12234 {
12236 {
12238 {
12240 }
12241 }
12242 else
12243 {
12245 }
12246 }
12247 else
12248 {
12250 }
12251
12252 break;
12253 #endif
12254
12255 }
12256
12258 {
12260 }
12261 }
12262
12263
12264
12265
12267 {
12268 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12269 return plugin.GetID(
name);
12270 }
12271
12273 {
12274 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12275 return plugin.GetName(id);
12276 }
12277
12280 {
12281
12282
12283 int varFlags;
12284 if (!ctx.
Read(varFlags))
12285 return;
12286
12287 if (varFlags & ItemVariableFlags.FLOAT)
12288 {
12290 }
12291 }
12292
12294 {
12295
12296 super.SerializeNumericalVars(floats_out);
12297
12298
12299
12301 {
12303 }
12304
12306 {
12308 }
12309
12311 {
12313 }
12314
12316 {
12321 }
12322
12324 {
12326 }
12327 }
12328
12330 {
12331
12332 super.DeSerializeNumericalVars(floats);
12333
12334
12335 int index = 0;
12336 int mask = Math.Round(floats.Get(index));
12337
12338 index++;
12339
12341 {
12343 {
12345 }
12346 else
12347 {
12348 float quantity = floats.Get(index);
12349 SetQuantity(quantity,
true,
false,
false,
false);
12350 }
12351 index++;
12352 }
12353
12355 {
12356 float wet = floats.Get(index);
12358 index++;
12359 }
12360
12362 {
12363 int liquidtype = Math.Round(floats.Get(index));
12365 index++;
12366 }
12367
12369 {
12371 index++;
12373 index++;
12375 index++;
12377 index++;
12378 }
12379
12381 {
12382 int cleanness = Math.Round(floats.Get(index));
12384 index++;
12385 }
12386 }
12387
12389 {
12390 super.WriteVarsToCTX(ctx);
12391
12392
12394 {
12396 }
12397
12399 {
12401 }
12402
12404 {
12406 }
12407
12409 {
12410 int r,g,b,a;
12416 }
12417
12419 {
12421 }
12422 }
12423
12425 {
12426 if (!super.ReadVarsFromCTX(ctx,version))
12427 return false;
12428
12429 int intValue;
12430 float value;
12431
12432 if (version < 140)
12433 {
12434 if (!ctx.
Read(intValue))
12435 return false;
12436
12437 m_VariablesMask = intValue;
12438 }
12439
12441 {
12442 if (!ctx.
Read(value))
12443 return false;
12444
12446 {
12448 }
12449 else
12450 {
12452 }
12453 }
12454
12455 if (version < 140)
12456 {
12458 {
12459 if (!ctx.
Read(value))
12460 return false;
12461 SetTemperatureDirect(value);
12462 }
12463 }
12464
12466 {
12467 if (!ctx.
Read(value))
12468 return false;
12470 }
12471
12473 {
12474 if (!ctx.
Read(intValue))
12475 return false;
12477 }
12478
12480 {
12481 int r,g,b,a;
12483 return false;
12485 return false;
12487 return false;
12489 return false;
12490
12492 }
12493
12495 {
12496 if (!ctx.
Read(intValue))
12497 return false;
12499 }
12500
12501 if (version >= 138 && version < 140)
12502 {
12504 {
12505 if (!ctx.
Read(intValue))
12506 return false;
12507 SetFrozen(intValue);
12508 }
12509 }
12510
12511 return true;
12512 }
12513
12514
12516 {
12519 {
12521 }
12522
12523 if (!super.OnStoreLoad(ctx, version))
12524 {
12526 return false;
12527 }
12528
12529 if (version >= 114)
12530 {
12531 bool hasQuickBarIndexSaved;
12532
12533 if (!ctx.
Read(hasQuickBarIndexSaved))
12534 {
12536 return false;
12537 }
12538
12539 if (hasQuickBarIndexSaved)
12540 {
12541 int itmQBIndex;
12542
12543
12544 if (!ctx.
Read(itmQBIndex))
12545 {
12547 return false;
12548 }
12549
12550 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12551 if (itmQBIndex != -1 && parentPlayer)
12552 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12553 }
12554 }
12555 else
12556 {
12557
12558 PlayerBase player;
12559 int itemQBIndex;
12560 if (version ==
int.
MAX)
12561 {
12562 if (!ctx.
Read(itemQBIndex))
12563 {
12565 return false;
12566 }
12567 }
12568 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12569 {
12570
12571 if (!ctx.
Read(itemQBIndex))
12572 {
12574 return false;
12575 }
12576 if (itemQBIndex != -1 && player)
12577 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12578 }
12579 }
12580
12581 if (version < 140)
12582 {
12583
12584 if (!LoadVariables(ctx, version))
12585 {
12587 return false;
12588 }
12589 }
12590
12591
12593 {
12595 return false;
12596 }
12597 if (version >= 132)
12598 {
12600 if (raib)
12601 {
12603 {
12605 return false;
12606 }
12607 }
12608 }
12609
12611 return true;
12612 }
12613
12614
12615
12617 {
12618 super.OnStoreSave(ctx);
12619
12620 PlayerBase player;
12621 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12622 {
12624
12625 int itemQBIndex = -1;
12626 itemQBIndex = player.FindQuickBarEntityIndex(this);
12627 ctx.
Write(itemQBIndex);
12628 }
12629 else
12630 {
12632 }
12633
12635
12637 if (raib)
12638 {
12640 }
12641 }
12642
12643
12645 {
12646 super.AfterStoreLoad();
12647
12649 {
12651 }
12652
12654 {
12657 }
12658 }
12659
12661 {
12662 super.EEOnAfterLoad();
12663
12665 {
12667 }
12668
12671 }
12672
12674 {
12675 return false;
12676 }
12677
12678
12679
12681 {
12683 {
12684 #ifdef PLATFORM_CONSOLE
12685
12687 {
12689 if (menu)
12690 {
12692 }
12693 }
12694 #endif
12695 }
12696
12698 {
12701 }
12702
12704 {
12705 SetWeightDirty();
12707 }
12709 {
12712 }
12713
12715 {
12718
12721 }
12723 {
12727 }
12728
12729 super.OnVariablesSynchronized();
12730 }
12731
12732
12733
12735 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12736 {
12737 if (!IsServerCheck(allow_client))
12738 return false;
12739
12741 return false;
12742
12745
12746 if (value <= (min + 0.001))
12747 value = min;
12748
12749 if (value == min)
12750 {
12751 if (destroy_config)
12752 {
12753 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12754 if (dstr)
12755 {
12757 this.Delete();
12758 return true;
12759 }
12760 }
12761 else if (destroy_forced)
12762 {
12764 this.Delete();
12765 return true;
12766 }
12767
12769 }
12770
12773
12775 {
12776 EntityAI parent = GetHierarchyRoot();
12777 InventoryLocation iLoc = new InventoryLocation();
12778 GetInventory().GetCurrentInventoryLocation(iLoc);
12780 {
12781 int iLocSlot = iLoc.
GetSlot();
12783 {
12785 }
12787 {
12789 }
12790 }
12791 }
12792
12794 {
12796
12797 if (delta)
12799 }
12800
12802
12803 return false;
12804 }
12805
12806
12808 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12809 {
12811 }
12812
12814 {
12817 }
12818
12820 {
12823 }
12824
12826 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12827 {
12828 float value_clamped = Math.Clamp(value, 0, 1);
12830 SetQuantity(result, destroy_config, destroy_forced);
12831 }
12832
12833
12836 {
12838 }
12839
12841 {
12843 }
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12855 {
12856 int slot = -1;
12857 GameInventory inventory = GetInventory();
12858 if (inventory)
12859 {
12860 InventoryLocation il = new InventoryLocation;
12863 }
12864
12866 }
12867
12869 {
12870 float quantity_max = 0;
12871
12873 {
12874 if (attSlotID != -1)
12875 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12876
12877 if (quantity_max <= 0)
12879 }
12880
12881 if (quantity_max <= 0)
12883
12884 return quantity_max;
12885 }
12886
12888 {
12890 }
12891
12893 {
12895 }
12896
12897
12899 {
12901 }
12902
12904 {
12906 }
12907
12909 {
12911 }
12912
12913
12915 {
12916
12917 float weightEx = GetWeightEx();
12918 float special = GetInventoryAndCargoWeight();
12919 return weightEx - special;
12920 }
12921
12922
12924 {
12926 }
12927
12929 {
12931 {
12932 #ifdef DEVELOPER
12933 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12934 {
12935 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12937 }
12938 #endif
12939
12940 return GetQuantity() * GetConfigWeightModified();
12941 }
12942 else if (HasEnergyManager())
12943 {
12944 #ifdef DEVELOPER
12945 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12946 {
12947 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12948 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12949 }
12950 #endif
12951 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12952 }
12953 else
12954 {
12955 #ifdef DEVELOPER
12956 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12957 {
12958 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12959 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12960 }
12961 #endif
12962 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12963 }
12964 }
12965
12968 {
12969 int item_count = 0;
12971
12972 GameInventory inventory = GetInventory();
12973 CargoBase cargo = inventory.
GetCargo();
12974 if (cargo != NULL)
12975 {
12977 }
12978
12980 for (int i = 0; i < nAttachments; ++i)
12981 {
12983 if (item)
12984 item_count += item.GetNumberOfItems();
12985 }
12986 return item_count;
12987 }
12988
12991 {
12992 float weight = 0;
12993 float wetness = 1;
12994 if (include_wetness)
12997 {
12998 weight = wetness * m_ConfigWeight;
12999 }
13001 {
13002 weight = 1;
13003 }
13004 return weight;
13005 }
13006
13007
13008
13010 {
13011 GameInventory inventory = GetInventory();
13012 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
13013 {
13014 array<EntityAI> items = new array<EntityAI>;
13016 for (int i = 0; i < items.Count(); ++i)
13017 {
13019 if (item)
13020 {
13021 g_Game.ObjectDelete(item);
13022 }
13023 }
13024 }
13025 }
13026
13027
13028
13029
13031 {
13032 float energy = 0;
13033 if (HasEnergyManager())
13034 {
13035 energy = GetCompEM().GetEnergy();
13036 }
13037 return energy;
13038 }
13039
13040
13042 {
13043 super.OnEnergyConsumed();
13044
13046 }
13047
13049 {
13050 super.OnEnergyAdded();
13051
13053 }
13054
13055
13057 {
13058 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13059 {
13061 {
13062 float energy_0to1 = GetCompEM().GetEnergy0To1();
13064 }
13065 }
13066 }
13067
13068
13070 {
13071 return ConfigGetFloat("heatIsolation");
13072 }
13073
13075 {
13077 }
13078
13080 {
13081 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13082 if (
g_Game.ConfigIsExisting(paramPath))
13083 return g_Game.ConfigGetFloat(paramPath);
13084
13085 return 0.0;
13086 }
13087
13089 {
13090 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13091 if (
g_Game.ConfigIsExisting(paramPath))
13092 return g_Game.ConfigGetFloat(paramPath);
13093
13094 return 0.0;
13095 }
13096
13097 override void SetWet(
float value,
bool allow_client =
false)
13098 {
13099 if (!IsServerCheck(allow_client))
13100 return;
13101
13104
13106
13107 m_VarWet = Math.Clamp(value, min, max);
13108
13110 {
13113 }
13114 }
13115
13116 override void AddWet(
float value)
13117 {
13119 }
13120
13122 {
13124 }
13125
13127 {
13129 }
13130
13132 {
13134 }
13135
13137 {
13139 }
13140
13142 {
13144 }
13145
13146 override void OnWetChanged(
float newVal,
float oldVal)
13147 {
13150 if (newLevel != oldLevel)
13151 {
13153 }
13154 }
13155
13157 {
13158 SetWeightDirty();
13159 }
13160
13162 {
13163 return GetWetLevelInternal(
m_VarWet);
13164 }
13165
13166
13167
13169 {
13171 }
13172
13174 {
13176 }
13177
13179 {
13181 }
13182
13184 {
13186 }
13187
13188
13189
13191 {
13192 if (ConfigIsExisting("itemModelLength"))
13193 {
13194 return ConfigGetFloat("itemModelLength");
13195 }
13196 return 0;
13197 }
13198
13200 {
13201 if (ConfigIsExisting("itemAttachOffset"))
13202 {
13203 return ConfigGetFloat("itemAttachOffset");
13204 }
13205 return 0;
13206 }
13207
13208 override void SetCleanness(
int value,
bool allow_client =
false)
13209 {
13210 if (!IsServerCheck(allow_client))
13211 return;
13212
13214
13216
13219 }
13220
13222 {
13224 }
13225
13227 {
13228 return true;
13229 }
13230
13231
13232
13233
13235 {
13237 }
13238
13240 {
13242 }
13243
13244
13245
13246
13247 override void SetColor(
int r,
int g,
int b,
int a)
13248 {
13254 }
13256 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13257 {
13262 }
13263
13265 {
13267 }
13268
13271 {
13272 int r,g,b,a;
13274 r = r/255;
13275 g = g/255;
13276 b = b/255;
13277 a = a/255;
13278 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13279 }
13280
13281
13282
13283 override void SetLiquidType(
int value,
bool allow_client =
false)
13284 {
13285 if (!IsServerCheck(allow_client))
13286 return;
13287
13292 }
13293
13295 {
13296 return ConfigGetInt("varLiquidTypeInit");
13297 }
13298
13300 {
13302 }
13303
13305 {
13307 SetFrozen(false);
13308 }
13309
13312 {
13313 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13314 }
13315
13316
13319 {
13320 PlayerBase nplayer;
13321 if (PlayerBase.CastTo(nplayer, player))
13322 {
13324 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13325 }
13326 }
13327
13328
13331 {
13332 PlayerBase nplayer;
13333 if (PlayerBase.CastTo(nplayer,player))
13334 {
13335 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13336 }
13337
13338 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13339
13340 if (HasEnergyManager())
13341 {
13342 GetCompEM().UpdatePlugState();
13343 }
13344 }
13345
13346
13348 {
13349 super.OnPlacementStarted(player);
13350
13352 }
13353
13354 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13355 {
13357 {
13358 m_AdminLog.OnPlacementComplete(player,
this);
13359 }
13360
13361 super.OnPlacementComplete(player, position, orientation);
13362 }
13363
13364
13365
13366
13367
13369 {
13371 {
13372 return true;
13373 }
13374 else
13375 {
13376 return false;
13377 }
13378 }
13379
13380
13382 {
13384 {
13386 }
13387 }
13388
13389
13391 {
13393 }
13394
13396 {
13398 }
13399
13400 override void InsertAgent(
int agent,
float count = 1)
13401 {
13402 if (count < 1)
13403 return;
13404
13406 }
13407
13410 {
13412 }
13413
13414
13416 {
13418 }
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13462 {
13464 return false;
13465 return true;
13466 }
13467
13469 {
13470
13472 }
13473
13474
13477 {
13478 super.CheckForRoofLimited(timeTresholdMS);
13479
13480 float time =
g_Game.GetTime();
13481 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13482 {
13483 m_PreviousRoofTestTime = time;
13484 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13485 }
13486 }
13487
13488
13490 {
13492 {
13493 return 0;
13494 }
13495
13496 if (GetInventory().GetAttachmentSlotsCount() != 0)
13497 {
13498 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13499 if (filter)
13500 return filter.GetProtectionLevel(type, false, system);
13501 else
13502 return 0;
13503 }
13504
13505 string subclassPath, entryName;
13506
13507 switch (type)
13508 {
13510 entryName = "biological";
13511 break;
13513 entryName = "chemical";
13514 break;
13515 default:
13516 entryName = "biological";
13517 break;
13518 }
13519
13520 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13521
13522 return g_Game.ConfigGetFloat(subclassPath + entryName);
13523 }
13524
13525
13526
13529 {
13530 if (!IsMagazine())
13532
13534 }
13535
13536
13537
13538
13539
13544 {
13545 return true;
13546 }
13547
13549 {
13551 }
13552
13553
13554
13555
13556
13558 {
13559 if (parent)
13560 {
13561 if (parent.IsInherited(DayZInfected))
13562 return true;
13563
13564 if (!parent.IsRuined())
13565 return true;
13566 }
13567
13568 return true;
13569 }
13570
13572 {
13573 if (!super.CanPutAsAttachment(parent))
13574 {
13575 return false;
13576 }
13577
13578 if (!IsRuined() && !parent.IsRuined())
13579 {
13580 return true;
13581 }
13582
13583 return false;
13584 }
13585
13587 {
13588
13589
13590
13591
13592 return super.CanReceiveItemIntoCargo(item);
13593 }
13594
13596 {
13597
13598
13599
13600
13601 GameInventory attachmentInv = attachment.GetInventory();
13603 {
13604 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13605 return false;
13606 }
13607
13608 InventoryLocation loc = new InventoryLocation();
13609 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13610 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13611 return false;
13612
13613 return super.CanReceiveAttachment(attachment, slotId);
13614 }
13615
13617 {
13618 if (!super.CanReleaseAttachment(attachment))
13619 return false;
13620
13621 return GetInventory().AreChildrenAccessible();
13622 }
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13645 {
13646 int id = muzzle_owner.GetMuzzleID();
13647 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13648
13649 if (WPOF_array)
13650 {
13651 for (int i = 0; i < WPOF_array.Count(); i++)
13652 {
13653 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13654
13655 if (WPOF)
13656 {
13657 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13658 }
13659 }
13660 }
13661 }
13662
13663
13665 {
13666 int id = muzzle_owner.GetMuzzleID();
13668
13669 if (WPOBE_array)
13670 {
13671 for (int i = 0; i < WPOBE_array.Count(); i++)
13672 {
13673 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13674
13675 if (WPOBE)
13676 {
13677 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13678 }
13679 }
13680 }
13681 }
13682
13683
13685 {
13686 int id = muzzle_owner.GetMuzzleID();
13687 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13688
13689 if (WPOOH_array)
13690 {
13691 for (int i = 0; i < WPOOH_array.Count(); i++)
13692 {
13693 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13694
13695 if (WPOOH)
13696 {
13697 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13698 }
13699 }
13700 }
13701 }
13702
13703
13705 {
13706 int id = muzzle_owner.GetMuzzleID();
13707 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13708
13709 if (WPOOH_array)
13710 {
13711 for (int i = 0; i < WPOOH_array.Count(); i++)
13712 {
13713 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13714
13715 if (WPOOH)
13716 {
13717 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13718 }
13719 }
13720 }
13721 }
13722
13723
13725 {
13726 int id = muzzle_owner.GetMuzzleID();
13727 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13728
13729 if (WPOOH_array)
13730 {
13731 for (int i = 0; i < WPOOH_array.Count(); i++)
13732 {
13733 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13734
13735 if (WPOOH)
13736 {
13737 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13738 }
13739 }
13740 }
13741 }
13742
13743
13744
13746 {
13748 {
13749 return true;
13750 }
13751
13752 return false;
13753 }
13754
13756 {
13758 {
13759 return true;
13760 }
13761
13762 return false;
13763 }
13764
13766 {
13768 {
13769 return true;
13770 }
13771
13772 return false;
13773 }
13774
13776 {
13777 return false;
13778 }
13779
13782 {
13783 return UATimeSpent.DEFAULT_DEPLOY;
13784 }
13785
13786
13787
13788
13790 {
13792 SetSynchDirty();
13793 }
13794
13796 {
13798 }
13799
13800
13802 {
13803 return false;
13804 }
13805
13808 {
13809 string att_type = "None";
13810
13811 if (ConfigIsExisting("soundAttType"))
13812 {
13813 att_type = ConfigGetString("soundAttType");
13814 }
13815
13817 }
13818
13820 {
13822 }
13823
13824
13825
13826
13827
13833
13835 {
13838
13840 }
13841
13842
13844 {
13846 return;
13847
13849
13852
13855
13856 SoundParameters params = new SoundParameters();
13860 }
13861
13862
13864 {
13866 {
13869
13870 SetSynchDirty();
13871
13874 }
13875 }
13876
13878 {
13880 }
13881
13882
13884 {
13886 return;
13887
13889 SetSynchDirty();
13890
13893 }
13894
13896 {
13899 }
13900
13902 {
13904 }
13905
13906 void OnApply(PlayerBase player);
13907
13909 {
13910 return 1.0;
13911 };
13912
13914 {
13916 }
13917
13919 {
13921 }
13922
13924
13926 {
13927 SetDynamicPhysicsLifeTime(0.01);
13929 }
13930
13932 {
13933 array<string> zone_names = new array<string>;
13934 GetDamageZones(zone_names);
13935 for (int i = 0; i < zone_names.Count(); i++)
13936 {
13937 SetHealthMax(zone_names.Get(i),"Health");
13938 }
13939 SetHealthMax("","Health");
13940 }
13941
13944 {
13945 float global_health = GetHealth01("","Health");
13946 array<string> zones = new array<string>;
13947 GetDamageZones(zones);
13948
13949 for (int i = 0; i < zones.Count(); i++)
13950 {
13951 SetHealth01(zones.Get(i),"Health",global_health);
13952 }
13953 }
13954
13957 {
13958 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13959 }
13960
13962 {
13963 if (!hasRootAsPlayer)
13964 {
13965 if (refParentIB)
13966 {
13967
13968 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13969 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13970
13971 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13972 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13973
13976 }
13977 else
13978 {
13979
13982 }
13983 }
13984 }
13985
13987 {
13989 {
13990 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13991 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13992 {
13993 float heatPermCoef = 1.0;
13995 while (ent)
13996 {
13997 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13998 ent = ent.GetHierarchyParent();
13999 }
14000
14001 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14002 }
14003 }
14004 }
14005
14007 {
14008
14009 EntityAI parent = GetHierarchyParent();
14010 if (!parent)
14011 {
14012 hasParent = false;
14013 hasRootAsPlayer = false;
14014 }
14015 else
14016 {
14017 hasParent = true;
14018 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14019 refParentIB =
ItemBase.Cast(parent);
14020 }
14021 }
14022
14023 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
14024 {
14025
14026 }
14027
14029 {
14030
14031 return false;
14032 }
14033
14035 {
14036
14037
14038 return false;
14039 }
14040
14042 {
14043
14044 return false;
14045 }
14046
14049 {
14050 return !GetIsFrozen() &&
IsOpen();
14051 }
14052
14054 {
14055 bool hasParent = false, hasRootAsPlayer = false;
14057
14058 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14059 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14060
14061 if (wwtu || foodDecay)
14062 {
14066
14067 if (processWetness || processTemperature || processDecay)
14068 {
14070
14071 if (processWetness)
14072 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14073
14074 if (processTemperature)
14076
14077 if (processDecay)
14078 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14079 }
14080 }
14081 }
14082
14085 {
14087 }
14088
14090 {
14093
14094 return super.GetTemperatureFreezeThreshold();
14095 }
14096
14098 {
14101
14102 return super.GetTemperatureThawThreshold();
14103 }
14104
14106 {
14109
14110 return super.GetItemOverheatThreshold();
14111 }
14112
14114 {
14116 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14117
14118 return super.GetTemperatureFreezeTime();
14119 }
14120
14122 {
14124 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14125
14126 return super.GetTemperatureThawTime();
14127 }
14128
14133
14135 {
14136 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14137 }
14138
14140 {
14141 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14142 }
14143
14146 {
14148 }
14149
14151 {
14153 }
14154
14156 {
14158 }
14159
14162 {
14163 return null;
14164 }
14165
14168 {
14169 return false;
14170 }
14171
14173 {
14175 {
14178 if (!trg)
14179 {
14181 explosive = this;
14182 }
14183
14184 explosive.PairRemote(trg);
14186
14187 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14188 trg.SetPersistentPairID(persistentID);
14189 explosive.SetPersistentPairID(persistentID);
14190
14191 return true;
14192 }
14193 return false;
14194 }
14195
14198 {
14199 float ret = 1.0;
14202 ret *= GetHealth01();
14203
14204 return ret;
14205 }
14206
14207 #ifdef DEVELOPER
14208 override void SetDebugItem()
14209 {
14210 super.SetDebugItem();
14211 _itemBase = this;
14212 }
14213
14215 {
14216 string text = super.GetDebugText();
14217
14219 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14220
14221 return text;
14222 }
14223 #endif
14224
14226 {
14227 return true;
14228 }
14229
14231
14233
14235 {
14238 }
14239
14240
14248
14264
14265 [
Obsolete(
"Use ItemSoundHandler instead")]
14268 {
14269 if (!
g_Game.IsDedicatedServer())
14270 {
14271 if (ConfigIsExisting("attachSoundSet"))
14272 {
14273 string cfg_path = "";
14274 string soundset = "";
14275 string type_name =
GetType();
14276
14279 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14280 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14281
14282 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14283 {
14284 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14285 {
14286 if (cfg_slot_array[i] == slot_type)
14287 {
14288 soundset = cfg_soundset_array[i];
14289 break;
14290 }
14291 }
14292 }
14293
14294 if (soundset != "")
14295 {
14296 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14298 }
14299 }
14300 }
14301 }
14302
14304}
14305
14307{
14309 if (entity)
14310 {
14311 bool is_item = entity.IsInherited(
ItemBase);
14312 if (is_item && full_quantity)
14313 {
14316 }
14317 }
14318 else
14319 {
14321 return NULL;
14322 }
14323 return entity;
14324}
14325
14327{
14328 if (item)
14329 {
14330 if (health > 0)
14331 item.SetHealth("", "", health);
14332
14333 if (item.CanHaveTemperature())
14334 {
14336 if (item.CanFreeze())
14337 item.SetFrozen(false);
14338 }
14339
14340 if (item.HasEnergyManager())
14341 {
14342 if (quantity >= 0)
14343 {
14344 item.GetCompEM().SetEnergy0To1(quantity);
14345 }
14346 else
14347 {
14349 }
14350 }
14351 else if (item.IsMagazine())
14352 {
14353 Magazine mag = Magazine.Cast(item);
14354 if (quantity >= 0)
14355 {
14356 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14357 }
14358 else
14359 {
14361 }
14362
14363 }
14364 else
14365 {
14366 if (quantity >= 0)
14367 {
14368 item.SetQuantityNormalized(quantity, false);
14369 }
14370 else
14371 {
14373 }
14374
14375 }
14376 }
14377}
14378
14379#ifdef DEVELOPER
14381#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.