9343{
9345 {
9346 return true;
9347 }
9348};
9349
9351{
9352
9353};
9354
9355
9356
9358{
9362
9364
9367
9368
9369
9370
9371
9380
9386
9391
9396
9417 protected bool m_IsResultOfSplit
9418
9420
9425
9426
9427
9429
9433
9434
9435
9437
9440
9441
9442
9448
9449
9457
9460
9461
9463
9464
9466
9467
9472
9473
9478
9480
9481
9483
9484
9486 {
9491
9492 if (!
g_Game.IsDedicatedServer())
9493 {
9495 {
9497
9499 {
9501 }
9502 }
9503
9506 }
9507
9508 m_OldLocation = null;
9509
9511 {
9513 }
9514
9515 if (ConfigIsExisting("headSelectionsToHide"))
9516 {
9519 }
9520
9522 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9523 {
9525 }
9526
9528
9529 m_IsResultOfSplit = false;
9530
9532 }
9533
9535 {
9536 super.InitItemVariables();
9537
9543 m_Count = ConfigGetInt(
"count");
9544
9547
9552
9555
9560
9572
9576
9577
9580 if (ConfigIsExisting("canBeSplit"))
9581 {
9584 }
9585
9587 if (ConfigIsExisting("itemBehaviour"))
9589
9590
9593 RegisterNetSyncVariableInt("m_VarLiquidType");
9594 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9595
9596 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9597 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9598 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9599
9600 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9601 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9602 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9603 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9604
9605 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9606 RegisterNetSyncVariableBool("m_IsTakeable");
9607 RegisterNetSyncVariableBool("m_IsHologram");
9608
9611 {
9614 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9615 }
9616
9618
9620 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9622
9624 }
9625
9627 {
9629 }
9630
9632 {
9635 {
9640 }
9641 }
9642
9643 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9644 {
9646 {
9649 }
9650
9652 }
9653
9655 {
9661 }
9662
9664
9666 {
9668
9669 if (!action)
9670 {
9671 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9672 return;
9673 }
9674
9676 if (!ai)
9677 {
9679 return;
9680 }
9681
9683 if (!action_array)
9684 {
9685 action_array = new array<ActionBase_Basic>;
9687 }
9688 if (LogManager.IsActionLogEnable())
9689 {
9690 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9691 }
9692
9693 if (action_array.Find(action) != -1)
9694 {
9695 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9696 }
9697 else
9698 {
9699 action_array.Insert(action);
9700 }
9701 }
9702
9704 {
9705 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9706 ActionBase action = player.GetActionManager().GetAction(actionName);
9709
9710 if (action_array)
9711 {
9712 action_array.RemoveItem(action);
9713 }
9714 }
9715
9716
9717
9719 {
9720 ActionOverrideData overrideData = new ActionOverrideData();
9724
9726 if (!actionMap)
9727 {
9730 }
9731
9732 actionMap.Insert(this.
Type(), overrideData);
9733
9734 }
9735
9737
9739
9740
9742 {
9745
9748
9749 string config_to_search = "CfgVehicles";
9750 string muzzle_owner_config;
9751
9753 {
9754 if (IsInherited(Weapon))
9755 config_to_search = "CfgWeapons";
9756
9757 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9758
9759 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9760
9761 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9762
9763 if (config_OnFire_subclass_count > 0)
9764 {
9765 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9766
9767 for (int i = 0; i < config_OnFire_subclass_count; i++)
9768 {
9769 string particle_class = "";
9770 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9771 string config_OnFire_entry = config_OnFire_class + particle_class;
9772 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9773 WPOF_array.Insert(WPOF);
9774 }
9775
9776
9778 }
9779 }
9780
9782 {
9783 config_to_search = "CfgWeapons";
9784 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9785
9786 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9787
9788 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9789
9790 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9791 {
9792 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9793
9794 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9795 {
9796 string particle_class2 = "";
9797 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9798 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9799 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9800 WPOBE_array.Insert(WPOBE);
9801 }
9802
9803
9805 }
9806 }
9807 }
9808
9809
9811 {
9814
9816 {
9817 string config_to_search = "CfgVehicles";
9818
9819 if (IsInherited(Weapon))
9820 config_to_search = "CfgWeapons";
9821
9822 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9823 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9824
9825 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9826 {
9827
9829
9831 {
9833 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9835 return;
9836 }
9837
9840
9841
9842
9843 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9844 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9845
9846 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9847 {
9848 string particle_class = "";
9849 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9850 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9851 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9852
9853 if (entry_type == CT_CLASS)
9854 {
9855 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9856 WPOOH_array.Insert(WPOF);
9857 }
9858 }
9859
9860
9862 }
9863 }
9864 }
9865
9867 {
9869 }
9870
9872 {
9874 {
9876
9879
9882
9883 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9884 }
9885 }
9886
9888 {
9890 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9891
9893 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9894
9896 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9897
9899 {
9901 }
9902 }
9903
9905 {
9907 }
9908
9910 {
9913 else
9915
9917 {
9920 }
9921 else
9922 {
9925
9928 }
9929
9931 }
9932
9934 {
9936 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9937 }
9938
9940 {
9942 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9944 }
9945
9947 {
9949 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9950 }
9951
9953 {
9956
9957 OverheatingParticle OP = new OverheatingParticle();
9962
9964 }
9965
9967 {
9970
9971 return -1;
9972 }
9973
9975 {
9977 {
9980
9981 for (int i = count; i > 0; --i)
9982 {
9983 int id = i - 1;
9986
9989
9990 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9991 {
9992 if (p)
9993 {
9996 }
9997 }
9998 }
9999 }
10000 }
10001
10003 {
10005 {
10007 {
10008 int id = i - 1;
10010
10011 if (OP)
10012 {
10014
10015 if (p)
10016 {
10018 }
10019
10020 delete OP;
10021 }
10022 }
10023
10026 }
10027 }
10028
10031 {
10032 return 0.0;
10033 }
10034
10035
10037 {
10038 return 250;
10039 }
10040
10042 {
10043 return 0;
10044 }
10045
10048 {
10050 return true;
10051
10052 return false;
10053 }
10054
10057 {
10060
10062 {
10064 }
10065 else
10066 {
10067
10069 }
10070
10072 }
10073
10080 {
10081 return -1;
10082 }
10083
10084
10085
10086
10088 {
10090 {
10091 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10092 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10093
10094 if (r_index >= 0)
10095 {
10096 InventoryLocation r_il = new InventoryLocation;
10097 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10098
10099 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10102 {
10103 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10104 }
10106 {
10107 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10108 }
10109
10110 }
10111
10112 player.GetHumanInventory().ClearUserReservedLocation(this);
10113 }
10114
10117 }
10118
10119
10120
10121
10123 {
10124 return ItemBase.m_DebugActionsMask;
10125 }
10126
10128 {
10129 return ItemBase.m_DebugActionsMask & mask;
10130 }
10131
10133 {
10134 ItemBase.m_DebugActionsMask = mask;
10135 }
10136
10138 {
10139 ItemBase.m_DebugActionsMask |= mask;
10140 }
10141
10143 {
10144 ItemBase.m_DebugActionsMask &= ~mask;
10145 }
10146
10148 {
10150 {
10152 }
10153 else
10154 {
10156 }
10157 }
10158
10159
10161 {
10162 if (GetEconomyProfile())
10163 {
10164 float q_max = GetEconomyProfile().GetQuantityMax();
10165 if (q_max > 0)
10166 {
10167 float q_min = GetEconomyProfile().GetQuantityMin();
10168 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10169
10171 {
10172 ComponentEnergyManager comp = GetCompEM();
10174 {
10176 }
10177 }
10179 {
10181
10182 }
10183
10184 }
10185 }
10186 }
10187
10190 {
10191 EntityAI parent = GetHierarchyParent();
10192
10193 if (parent)
10194 {
10195 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10196 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10197 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10198 }
10199 }
10200
10203 {
10204 EntityAI parent = GetHierarchyParent();
10205
10206 if (parent)
10207 {
10208 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10209 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10210 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10211 }
10212 }
10213
10215 {
10216
10217
10218
10219
10221
10223 {
10224 if (ScriptInputUserData.CanStoreInputUserData())
10225 {
10226 ScriptInputUserData ctx = new ScriptInputUserData;
10232 ctx.
Write(use_stack_max);
10235
10237 {
10238 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10239 }
10240 }
10241 }
10242 else if (!
g_Game.IsMultiplayer())
10243 {
10245 }
10246 }
10247
10249 {
10251 }
10252
10254 {
10256 }
10257
10259 {
10261 }
10262
10264 {
10265
10266 return false;
10267 }
10268
10270 {
10271 return false;
10272 }
10273
10277 {
10278 return false;
10279 }
10280
10282 {
10283 return "";
10284 }
10285
10287
10289 {
10290 return false;
10291 }
10292
10294 {
10295 return true;
10296 }
10297
10298
10299
10301 {
10302 return true;
10303 }
10304
10306 {
10307 return true;
10308 }
10309
10311 {
10312 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10314 }
10315
10317 {
10319 }
10320
10322 {
10324 if (!is_being_placed)
10326 SetSynchDirty();
10327 }
10328
10329
10331
10333 {
10335 }
10336
10338 {
10340 }
10341
10343 {
10344 return 1;
10345 }
10346
10348 {
10349 return false;
10350 }
10351
10353 {
10355 SetSynchDirty();
10356 }
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10393 {
10394 super.OnMovedInsideCargo(container);
10395
10396 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10397 }
10398
10399 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10400 {
10401 super.EEItemLocationChanged(oldLoc, newLoc);
10402
10403 PlayerBase newPlayer = null;
10404 PlayerBase oldPlayer = null;
10405
10406 if (newLoc.GetParent())
10407 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10408
10409 if (oldLoc.GetParent())
10410 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10411
10413 {
10414 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10415
10416 if (rIndex >= 0)
10417 {
10418 InventoryLocation rIl = new InventoryLocation;
10419 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10420
10421 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10424 {
10425 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10426 }
10428 {
10430 }
10431
10432 }
10433 }
10434
10436 {
10437 if (newPlayer)
10438 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10439
10440 if (newPlayer == oldPlayer)
10441 {
10442 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10443 {
10445 {
10446 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10447 {
10448 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10449 }
10450 }
10451 else
10452 {
10453 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10454 }
10455 }
10456
10457 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10458 {
10459 int type = oldLoc.GetType();
10461 {
10462 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10463 }
10465 {
10466 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10467 }
10468 }
10469 if (!m_OldLocation)
10470 {
10471 m_OldLocation = new InventoryLocation;
10472 }
10473 m_OldLocation.Copy(oldLoc);
10474 }
10475 else
10476 {
10477 if (m_OldLocation)
10478 {
10479 m_OldLocation.Reset();
10480 }
10481 }
10482
10483 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10484 }
10485 else
10486 {
10487 if (newPlayer)
10488 {
10489 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10490 if (resIndex >= 0)
10491 {
10492 InventoryLocation il = new InventoryLocation;
10493 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10495 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10498 {
10499 il.
GetParent().GetOnReleaseLock().Invoke(it);
10500 }
10502 {
10504 }
10505
10506 }
10507 }
10509 {
10510
10512 }
10513
10514 if (m_OldLocation)
10515 {
10516 m_OldLocation.Reset();
10517 }
10518 }
10519
10521 {
10522 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10523 }
10524
10526 {
10527 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10528 }
10529 }
10530
10531 override void EOnContact(IEntity other, Contact extra)
10532 {
10534 {
10535 int liquidType = -1;
10537 if (impactSpeed > 0.0)
10538 {
10540 #ifndef SERVER
10542 #else
10544 SetSynchDirty();
10545 #endif
10547 }
10548 }
10549
10550 #ifdef SERVER
10551 if (GetCompEM() && GetCompEM().IsPlugged())
10552 {
10553 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10554 GetCompEM().UnplugThis();
10555 }
10556 #endif
10557 }
10558
10560
10562 {
10564 }
10565
10567 {
10568
10569 }
10570
10572 {
10573 super.OnItemLocationChanged(old_owner, new_owner);
10574
10575 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10576 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10577
10578 if (!relatedPlayer && playerNew)
10579 relatedPlayer = playerNew;
10580
10581 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10582 {
10584 if (actionMgr)
10585 {
10586 ActionBase currentAction = actionMgr.GetRunningAction();
10587 if (currentAction)
10589 }
10590 }
10591
10592 Man ownerPlayerOld = null;
10593 Man ownerPlayerNew = null;
10594
10595 if (old_owner)
10596 {
10597 if (old_owner.
IsMan())
10598 {
10599 ownerPlayerOld = Man.Cast(old_owner);
10600 }
10601 else
10602 {
10603 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10604 }
10605 }
10606 else
10607 {
10609 {
10611
10612 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10613 {
10614 GetCompEM().UnplugThis();
10615 }
10616 }
10617 }
10618
10619 if (new_owner)
10620 {
10621 if (new_owner.
IsMan())
10622 {
10623 ownerPlayerNew = Man.Cast(new_owner);
10624 }
10625 else
10626 {
10627 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10628 }
10629 }
10630
10631 if (ownerPlayerOld != ownerPlayerNew)
10632 {
10633 if (ownerPlayerOld)
10634 {
10635 array<EntityAI> subItemsExit = new array<EntityAI>;
10637 for (int i = 0; i < subItemsExit.Count(); i++)
10638 {
10641 }
10642 }
10643
10644 if (ownerPlayerNew)
10645 {
10646 array<EntityAI> subItemsEnter = new array<EntityAI>;
10648 for (int j = 0; j < subItemsEnter.Count(); j++)
10649 {
10652 }
10653 }
10654 }
10655 else if (ownerPlayerNew != null)
10656 {
10657 PlayerBase nplayer;
10658 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10659 {
10660 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10662 for (int k = 0; k < subItemsUpdate.Count(); k++)
10663 {
10665 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10666 }
10667 }
10668 }
10669
10670 if (old_owner)
10671 old_owner.OnChildItemRemoved(this);
10672 if (new_owner)
10673 new_owner.OnChildItemReceived(this);
10674 }
10675
10676
10678 {
10679 super.EEDelete(parent);
10680 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10681 if (player)
10682 {
10684
10685 if (player.IsAlive())
10686 {
10687 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10688 if (r_index >= 0)
10689 {
10690 InventoryLocation r_il = new InventoryLocation;
10691 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10692
10693 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10696 {
10697 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10698 }
10700 {
10701 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10702 }
10703
10704 }
10705
10706 player.RemoveQuickBarEntityShortcut(this);
10707 }
10708 }
10709 }
10710
10712 {
10713 super.EEKilled(killer);
10714
10717 {
10718 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10719 {
10720 if (IsMagazine())
10721 {
10722 if (Magazine.Cast(this).GetAmmoCount() > 0)
10723 {
10725 }
10726 }
10727 else
10728 {
10730 }
10731 }
10732 }
10733 }
10734
10736 {
10737 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10738
10739 super.OnWasAttached(parent, slot_id);
10740
10743
10746 }
10747
10749 {
10750 super.OnWasDetached(parent, slot_id);
10751
10754
10757 }
10758
10760 {
10761 int idx;
10764
10765 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10766 if (inventory_slots.Count() < 1)
10767 {
10768 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10769 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10770 }
10771 else
10772 {
10773 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10774 }
10775
10776 idx = inventory_slots.Find(slot);
10777 if (idx < 0)
10778 return "";
10779
10780 return attach_types.Get(idx);
10781 }
10782
10784 {
10785 int idx = -1;
10786 string slot;
10787
10790
10791 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10792 if (inventory_slots.Count() < 1)
10793 {
10794 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10795 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10796 }
10797 else
10798 {
10799 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10800 if (detach_types.Count() < 1)
10801 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10802 }
10803
10804 for (int i = 0; i < inventory_slots.Count(); i++)
10805 {
10806 slot = inventory_slots.Get(i);
10807 }
10808
10809 if (slot != "")
10810 {
10811 if (detach_types.Count() == 1)
10812 idx = 0;
10813 else
10814 idx = inventory_slots.Find(slot);
10815 }
10816 if (idx < 0)
10817 return "";
10818
10819 return detach_types.Get(idx);
10820 }
10821
10823 {
10824
10826
10827
10828 float min_time = 1;
10829 float max_time = 3;
10830 float delay = Math.RandomFloat(min_time, max_time);
10831
10832 explode_timer.Run(delay, this, "DoAmmoExplosion");
10833 }
10834
10836 {
10837 Magazine magazine = Magazine.Cast(this);
10838 int pop_sounds_count = 6;
10839 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10840
10841
10842 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10843 string sound_name = pop_sounds[ sound_idx ];
10844 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10845
10846
10847 magazine.ServerAddAmmoCount(-1);
10848
10849
10850 float min_temp_to_explode = 100;
10851
10852 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10853 {
10855 }
10856 }
10857
10858
10859 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10860 {
10861 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10862
10863 const int CHANCE_DAMAGE_CARGO = 4;
10864 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10865 const int CHANCE_DAMAGE_NOTHING = 2;
10866
10868 {
10869 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10870 int chances;
10871 int rnd;
10872
10873 if (GetInventory().GetCargo())
10874 {
10875 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10876 rnd = Math.RandomInt(0,chances);
10877
10878 if (rnd < CHANCE_DAMAGE_CARGO)
10879 {
10881 }
10882 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10883 {
10885 }
10886 }
10887 else
10888 {
10889 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10890 rnd = Math.RandomInt(0,chances);
10891
10892 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10893 {
10895 }
10896 }
10897 }
10898 }
10899
10901 {
10902 CargoBase cargo = GetInventory().GetCargo();
10903 if (cargo)
10904 {
10906 if (item_count > 0)
10907 {
10908 int random_pick = Math.RandomInt(0, item_count);
10910 if (!item.IsExplosive())
10911 {
10912 item.AddHealth("","",damage);
10913 return true;
10914 }
10915 }
10916 }
10917 return false;
10918 }
10919
10921 {
10922 GameInventory inventory = GetInventory();
10924 if (attachment_count > 0)
10925 {
10926 int random_pick = Math.RandomInt(0, attachment_count);
10928 if (!attachment.IsExplosive())
10929 {
10930 attachment.AddHealth("","",damage);
10931 return true;
10932 }
10933 }
10934 return false;
10935 }
10936
10938 {
10940 }
10941
10943 {
10945 return GetInventory().CanRemoveEntity();
10946
10947 return false;
10948 }
10949
10951 {
10952
10954 return false;
10955
10956
10958 return false;
10959
10960
10961
10963 if (delta == 0)
10964 return false;
10965
10966
10967 return true;
10968 }
10969
10971 {
10973 {
10974 if (ScriptInputUserData.CanStoreInputUserData())
10975 {
10976 ScriptInputUserData ctx = new ScriptInputUserData;
10981 ctx.
Write(destination_entity);
10983 ctx.
Write(slot_id);
10985 }
10986 }
10987 else if (!
g_Game.IsMultiplayer())
10988 {
10990 }
10991 }
10992
10994 {
10995 float split_quantity_new;
10999 InventoryLocation loc = new InventoryLocation;
11000
11001 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11002 {
11004 split_quantity_new = stack_max;
11005 else
11007
11009 {
11010 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11011 if (new_item)
11012 {
11013 new_item.SetResultOfSplit(true);
11014 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11016 new_item.
SetQuantity(split_quantity_new,
false,
true);
11017 }
11018 }
11019 }
11020 else if (destination_entity && slot_id == -1)
11021 {
11022 if (quantity > stack_max)
11023 split_quantity_new = stack_max;
11024 else
11025 split_quantity_new = quantity;
11026
11028 {
11029 GameInventory destinationInventory = destination_entity.GetInventory();
11031 {
11034 }
11035
11036 if (new_item)
11037 {
11038 new_item.SetResultOfSplit(true);
11039 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11041 new_item.
SetQuantity(split_quantity_new,
false,
true);
11042 }
11043 }
11044 }
11045 else
11046 {
11047 if (stack_max != 0)
11048 {
11050 {
11052 }
11053
11054 if (split_quantity_new == 0)
11055 {
11056 if (!
g_Game.IsMultiplayer())
11057 player.PhysicalPredictiveDropItem(this);
11058 else
11059 player.ServerDropEntity(this);
11060 return;
11061 }
11062
11064 {
11066
11067 if (new_item)
11068 {
11069 new_item.SetResultOfSplit(true);
11070 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11073 new_item.PlaceOnSurface();
11074 }
11075 }
11076 }
11077 }
11078 }
11079
11081 {
11082 float split_quantity_new;
11086 InventoryLocation loc = new InventoryLocation;
11087
11088 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11089 {
11091 split_quantity_new = stack_max;
11092 else
11094
11096 {
11097 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11098 if (new_item)
11099 {
11100 new_item.SetResultOfSplit(true);
11101 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11103 new_item.
SetQuantity(split_quantity_new,
false,
true);
11104 }
11105 }
11106 }
11107 else if (destination_entity && slot_id == -1)
11108 {
11109 if (quantity > stack_max)
11110 split_quantity_new = stack_max;
11111 else
11112 split_quantity_new = quantity;
11113
11115 {
11116 GameInventory destinationInventory = destination_entity.GetInventory();
11118 {
11121 }
11122
11123 if (new_item)
11124 {
11125 new_item.SetResultOfSplit(true);
11126 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11128 new_item.
SetQuantity(split_quantity_new,
false,
true);
11129 }
11130 }
11131 }
11132 else
11133 {
11134 if (stack_max != 0)
11135 {
11137 {
11139 }
11140
11142 {
11144
11145 if (new_item)
11146 {
11147 new_item.SetResultOfSplit(true);
11148 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11151 new_item.PlaceOnSurface();
11152 }
11153 }
11154 }
11155 }
11156 }
11157
11159 {
11161 {
11162 if (ScriptInputUserData.CanStoreInputUserData())
11163 {
11164 ScriptInputUserData ctx = new ScriptInputUserData;
11169 dst.WriteToContext(ctx);
11171 }
11172 }
11173 else if (!
g_Game.IsMultiplayer())
11174 {
11176 }
11177 }
11178
11180 {
11182 {
11183 if (ScriptInputUserData.CanStoreInputUserData())
11184 {
11185 ScriptInputUserData ctx = new ScriptInputUserData;
11190 ctx.
Write(destination_entity);
11196 }
11197 }
11198 else if (!
g_Game.IsMultiplayer())
11199 {
11201 }
11202 }
11203
11205 {
11207 }
11208
11210 {
11212 float split_quantity_new;
11214 if (dst.IsValid())
11215 {
11216 int slot_id = dst.GetSlot();
11218
11219 if (quantity > stack_max)
11220 split_quantity_new = stack_max;
11221 else
11222 split_quantity_new = quantity;
11223
11225 {
11227
11228 if (new_item)
11229 {
11230 new_item.SetResultOfSplit(true);
11231 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11233 new_item.
SetQuantity(split_quantity_new,
false,
true);
11234 }
11235
11236 return new_item;
11237 }
11238 }
11239
11240 return null;
11241 }
11242
11244 {
11246 float split_quantity_new;
11248 if (destination_entity)
11249 {
11251 if (quantity > stackable)
11252 split_quantity_new = stackable;
11253 else
11254 split_quantity_new = quantity;
11255
11257 {
11258 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11259 if (new_item)
11260 {
11261 new_item.SetResultOfSplit(true);
11262 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11264 new_item.
SetQuantity(split_quantity_new,
false,
true);
11265 }
11266 }
11267 }
11268 }
11269
11271 {
11273 {
11274 if (ScriptInputUserData.CanStoreInputUserData())
11275 {
11276 ScriptInputUserData ctx = new ScriptInputUserData;
11281 ItemBase destination_entity =
this;
11282 ctx.
Write(destination_entity);
11286 }
11287 }
11288 else if (!
g_Game.IsMultiplayer())
11289 {
11291 }
11292 }
11293
11295 {
11297 float split_quantity_new;
11299 if (player)
11300 {
11302 if (quantity > stackable)
11303 split_quantity_new = stackable;
11304 else
11305 split_quantity_new = quantity;
11306
11308 {
11309 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11310 new_item =
ItemBase.Cast(in_hands);
11311 if (new_item)
11312 {
11313 new_item.SetResultOfSplit(true);
11314 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11316 new_item.SetQuantity(split_quantity_new, false, true);
11317 }
11318 }
11319 }
11320 }
11321
11323 {
11325 float split_quantity_new = Math.Floor(quantity * 0.5);
11326
11328 return;
11329
11331
11332 if (new_item)
11333 {
11334 if (new_item.GetQuantityMax() < split_quantity_new)
11335 {
11336 split_quantity_new = new_item.GetQuantityMax();
11337 }
11338
11339 new_item.SetResultOfSplit(true);
11340 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11341
11343 {
11346 }
11347 else
11348 {
11350 new_item.
SetQuantity(split_quantity_new,
false,
true);
11351 }
11352 }
11353 }
11354
11356 {
11358 float split_quantity_new = Math.Floor(quantity / 2);
11359
11361 return;
11362
11363 InventoryLocation invloc = new InventoryLocation;
11365
11367 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11368
11369 if (new_item)
11370 {
11371 if (new_item.GetQuantityMax() < split_quantity_new)
11372 {
11373 split_quantity_new = new_item.GetQuantityMax();
11374 }
11376 {
11379 }
11380 else if (split_quantity_new > 1)
11381 {
11383 new_item.
SetQuantity(split_quantity_new,
false,
true);
11384 }
11385 }
11386 }
11387
11390 {
11391 SetWeightDirty();
11393
11394 if (parent)
11395 parent.OnAttachmentQuantityChangedEx(this, delta);
11396
11398 {
11400 {
11402 }
11404 {
11405 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11407 }
11408 }
11409 }
11410
11413 {
11414
11415 }
11416
11419 {
11421 }
11422
11424 {
11425 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11426
11428 {
11429 if (newLevel == GameConstants.STATE_RUINED)
11430 {
11432 EntityAI parent = GetHierarchyParent();
11433 if (parent && parent.IsFireplace())
11434 {
11435 CargoBase cargo = GetInventory().GetCargo();
11436 if (cargo)
11437 {
11439 {
11441 }
11442 }
11443 }
11444 }
11445
11447 {
11448
11450 return;
11451 }
11452
11453 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11454 {
11456 }
11457 }
11458 }
11459
11460
11462 {
11463 super.OnRightClick();
11464
11466 {
11468 {
11469 if (ScriptInputUserData.CanStoreInputUserData())
11470 {
11471 EntityAI root = GetHierarchyRoot();
11472 Man playerOwner = GetHierarchyRootPlayer();
11473 InventoryLocation dst = new InventoryLocation;
11474
11475
11476 if (!playerOwner && root && root == this)
11477 {
11479 }
11480 else
11481 {
11482
11483 GetInventory().GetCurrentInventoryLocation(dst);
11485 {
11486 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11488 {
11490 }
11491 else
11492 {
11494
11495
11496 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11497 {
11499 }
11500 else
11501 {
11502 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11503 }
11504 }
11505 }
11506 }
11507
11508 ScriptInputUserData ctx = new ScriptInputUserData;
11516 }
11517 }
11518 else if (!
g_Game.IsMultiplayer())
11519 {
11521 }
11522 }
11523 }
11524
11526 {
11527 if (root)
11528 {
11529 vector m4[4];
11530 root.GetTransform(m4);
11531 dst.SetGround(this, m4);
11532 }
11533 else
11534 {
11535 GetInventory().GetCurrentInventoryLocation(dst);
11536 }
11537 }
11538
11539 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11540 {
11541
11542 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11543 return false;
11544
11545 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11546 return false;
11547
11548
11550 return false;
11551
11552
11553 Magazine mag = Magazine.Cast(this);
11554 if (mag)
11555 {
11556 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11557 return false;
11558
11559 if (stack_max_limit)
11560 {
11561 Magazine other_mag = Magazine.Cast(other_item);
11562 if (other_item)
11563 {
11564 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11565 return false;
11566 }
11567
11568 }
11569 }
11570 else
11571 {
11572
11574 return false;
11575
11577 return false;
11578 }
11579
11580 PlayerBase player = null;
11581 if (CastTo(player, GetHierarchyRootPlayer()))
11582 {
11583 if (player.GetInventory().HasAttachment(this))
11584 return false;
11585
11586 if (player.IsItemsToDelete())
11587 return false;
11588 }
11589
11590 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11591 return false;
11592
11593 int slotID;
11595 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11596 return false;
11597
11598 return true;
11599 }
11600
11602 {
11604 }
11605
11607 {
11608 return m_IsResultOfSplit;
11609 }
11610
11612 {
11613 m_IsResultOfSplit = value;
11614 }
11615
11617 {
11619 }
11620
11622 {
11623 float other_item_quantity = other_item.GetQuantity();
11624 float this_free_space;
11625
11627
11629
11630 if (other_item_quantity > this_free_space)
11631 {
11632 return this_free_space;
11633 }
11634 else
11635 {
11636 return other_item_quantity;
11637 }
11638 }
11639
11641 {
11643 }
11644
11646 {
11648 return;
11649
11650 if (!IsMagazine() && other_item)
11651 {
11653 if (quantity_used != 0)
11654 {
11655 float hp1 = GetHealth01("","");
11656 float hp2 = other_item.GetHealth01("","");
11657 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11658 hpResult = hpResult / (
GetQuantity() + quantity_used);
11659
11660 hpResult *= GetMaxHealth();
11661 Math.Round(hpResult);
11662 SetHealth("", "Health", hpResult);
11663
11665 other_item.AddQuantity(-quantity_used);
11666 }
11667 }
11669 }
11670
11672 {
11673 #ifdef SERVER
11674 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11675 GetHierarchyParent().IncreaseLifetimeUp();
11676 #endif
11677 };
11678
11680 {
11681 PlayerBase p = PlayerBase.Cast(player);
11682
11683 array<int> recipesIds = p.m_Recipes;
11684 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11685 if (moduleRecipesManager)
11686 {
11687 EntityAI itemInHands = player.GetEntityInHands();
11688 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11689 }
11690
11691 for (int i = 0;i < recipesIds.Count(); i++)
11692 {
11693 int key = recipesIds.Get(i);
11694 string recipeName = moduleRecipesManager.GetRecipeName(key);
11696 }
11697 }
11698
11699
11700 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11701 {
11702 super.GetDebugActions(outputList);
11703
11704
11710
11711
11716
11721
11722
11726
11727
11729 {
11733 }
11734
11737
11738
11742
11744
11745 InventoryLocation loc = new InventoryLocation();
11746 GetInventory().GetCurrentInventoryLocation(loc);
11748 {
11749 if (Gizmo_IsSupported())
11752 }
11753
11755 }
11756
11757
11758
11759
11761 {
11762 super.OnAction(action_id, player, ctx);
11763
11765 {
11766 switch (action_id)
11767 {
11771 return true;
11775 return true;
11776 }
11777 }
11778
11780 {
11781 switch (action_id)
11782 {
11784 Delete();
11785 return true;
11786 }
11787 }
11788
11789 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11790 {
11791 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11792 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11793 PlayerBase p = PlayerBase.Cast(player);
11794 if (
EActions.RECIPES_RANGE_START < 1000)
11795 {
11796 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11797 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11798 }
11799 }
11800 #ifndef SERVER
11801 else if (action_id ==
EActions.WATCH_PLAYER)
11802 {
11803 PluginDeveloper.SetDeveloperItemClientEx(player);
11804 }
11805 #endif
11807 {
11808 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11809 {
11810 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11811 OnDebugButtonPressServer(id + 1);
11812 }
11813
11814 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11815 {
11816 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11818 }
11819
11820 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11821 {
11822 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11824 }
11825
11826 else if (action_id ==
EActions.ADD_QUANTITY)
11827 {
11828 if (IsMagazine())
11829 {
11830 Magazine mag = Magazine.Cast(this);
11831 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11832 }
11833 else
11834 {
11836 }
11837
11838 if (m_EM)
11839 {
11840 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11841 }
11842
11843 }
11844
11845 else if (action_id ==
EActions.REMOVE_QUANTITY)
11846 {
11847 if (IsMagazine())
11848 {
11849 Magazine mag2 = Magazine.Cast(this);
11850 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11851 }
11852 else
11853 {
11855 }
11856 if (m_EM)
11857 {
11858 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11859 }
11860
11861 }
11862
11863 else if (action_id ==
EActions.SET_QUANTITY_0)
11864 {
11866
11867 if (m_EM)
11868 {
11869 m_EM.SetEnergy(0);
11870 }
11871 }
11872
11873 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11874 {
11876
11877 if (m_EM)
11878 {
11879 m_EM.SetEnergy(m_EM.GetEnergyMax());
11880 }
11881 }
11882
11883 else if (action_id ==
EActions.ADD_HEALTH)
11884 {
11885 AddHealth("","",GetMaxHealth("","Health")/5);
11886 }
11887 else if (action_id ==
EActions.REMOVE_HEALTH)
11888 {
11889 AddHealth("","",-GetMaxHealth("","Health")/5);
11890 }
11891 else if (action_id ==
EActions.DESTROY_HEALTH)
11892 {
11893 SetHealth01("","",0);
11894 }
11895 else if (action_id ==
EActions.WATCH_ITEM)
11896 {
11898 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11899 #ifdef DEVELOPER
11900 SetDebugDeveloper_item(this);
11901 #endif
11902 }
11903
11904 else if (action_id ==
EActions.ADD_TEMPERATURE)
11905 {
11906 AddTemperature(20);
11907
11908 }
11909
11910 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11911 {
11912 AddTemperature(-20);
11913
11914 }
11915
11916 else if (action_id ==
EActions.FLIP_FROZEN)
11917 {
11918 SetFrozen(!GetIsFrozen());
11919
11920 }
11921
11922 else if (action_id ==
EActions.ADD_WETNESS)
11923 {
11925
11926 }
11927
11928 else if (action_id ==
EActions.REMOVE_WETNESS)
11929 {
11931
11932 }
11933
11934 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11935 {
11938
11939
11940 }
11941
11942 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11943 {
11946 }
11947
11948 else if (action_id ==
EActions.MAKE_SPECIAL)
11949 {
11950 auto debugParams = DebugSpawnParams.WithPlayer(player);
11951 OnDebugSpawnEx(debugParams);
11952 }
11953
11954 }
11955
11956
11957 return false;
11958 }
11959
11960
11961
11962
11966
11969
11970
11971
11973 {
11974 return false;
11975 }
11976
11977
11979 {
11980 return true;
11981 }
11982
11983
11985 {
11986 return true;
11987 }
11988
11989
11990
11992 {
11993 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11994 return g_Game.ConfigIsExisting(config_path);
11995 }
11996
11999 {
12000 return null;
12001 }
12002
12004 {
12005 return false;
12006 }
12007
12009 {
12010 return false;
12011 }
12012
12016
12017
12019 {
12020 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12021 return module_repairing.CanRepair(this, item_repair_kit);
12022 }
12023
12024
12025 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12026 {
12027 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12028 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12029 }
12030
12031
12033 {
12034
12035
12036
12037
12038
12039
12040
12041
12042 return 1;
12043 }
12044
12045
12046
12048 {
12050 }
12051
12052
12053
12055 {
12057 }
12058
12059
12068 {
12069 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12070
12071 if (player)
12072 {
12073 player.MessageStatus(text);
12074 }
12075 }
12076
12077
12086 {
12087 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12088
12089 if (player)
12090 {
12091 player.MessageAction(text);
12092 }
12093 }
12094
12095
12104 {
12105 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12106
12107 if (player)
12108 {
12109 player.MessageFriendly(text);
12110 }
12111 }
12112
12113
12122 {
12123 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12124
12125 if (player)
12126 {
12127 player.MessageImportant(text);
12128 }
12129 }
12130
12132 {
12133 return true;
12134 }
12135
12136
12137 override bool KindOf(
string tag)
12138 {
12139 bool found = false;
12140 string item_name = this.
GetType();
12142 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12143
12144 int array_size = item_tag_array.Count();
12145 for (int i = 0; i < array_size; i++)
12146 {
12147 if (item_tag_array.Get(i) == tag)
12148 {
12149 found = true;
12150 break;
12151 }
12152 }
12153 return found;
12154 }
12155
12156
12158 {
12159
12160 super.OnRPC(sender, rpc_type,ctx);
12161
12162
12163 switch (rpc_type)
12164 {
12165 #ifndef SERVER
12166 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12167 Param2<bool, string> p = new Param2<bool, string>(false, "");
12168
12170 return;
12171
12172 bool play = p.param1;
12173 string soundSet = p.param2;
12174
12175 if (play)
12176 {
12178 {
12180 {
12182 }
12183 }
12184 else
12185 {
12187 }
12188 }
12189 else
12190 {
12192 }
12193
12194 break;
12195 #endif
12196
12197 }
12198
12200 {
12202 }
12203 }
12204
12205
12206
12207
12209 {
12210 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12211 return plugin.GetID(
name);
12212 }
12213
12215 {
12216 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12217 return plugin.GetName(id);
12218 }
12219
12222 {
12223
12224
12225 int varFlags;
12226 if (!ctx.
Read(varFlags))
12227 return;
12228
12229 if (varFlags & ItemVariableFlags.FLOAT)
12230 {
12232 }
12233 }
12234
12236 {
12237
12238 super.SerializeNumericalVars(floats_out);
12239
12240
12241
12243 {
12245 }
12246
12248 {
12250 }
12251
12253 {
12255 }
12256
12258 {
12263 }
12264
12266 {
12268 }
12269 }
12270
12272 {
12273
12274 super.DeSerializeNumericalVars(floats);
12275
12276
12277 int index = 0;
12278 int mask = Math.Round(floats.Get(index));
12279
12280 index++;
12281
12283 {
12285 {
12287 }
12288 else
12289 {
12290 float quantity = floats.Get(index);
12291 SetQuantity(quantity,
true,
false,
false,
false);
12292 }
12293 index++;
12294 }
12295
12297 {
12298 float wet = floats.Get(index);
12300 index++;
12301 }
12302
12304 {
12305 int liquidtype = Math.Round(floats.Get(index));
12307 index++;
12308 }
12309
12311 {
12313 index++;
12315 index++;
12317 index++;
12319 index++;
12320 }
12321
12323 {
12324 int cleanness = Math.Round(floats.Get(index));
12326 index++;
12327 }
12328 }
12329
12331 {
12332 super.WriteVarsToCTX(ctx);
12333
12334
12336 {
12338 }
12339
12341 {
12343 }
12344
12346 {
12348 }
12349
12351 {
12352 int r,g,b,a;
12358 }
12359
12361 {
12363 }
12364 }
12365
12367 {
12368 if (!super.ReadVarsFromCTX(ctx,version))
12369 return false;
12370
12371 int intValue;
12372 float value;
12373
12374 if (version < 140)
12375 {
12376 if (!ctx.
Read(intValue))
12377 return false;
12378
12379 m_VariablesMask = intValue;
12380 }
12381
12383 {
12384 if (!ctx.
Read(value))
12385 return false;
12386
12388 {
12390 }
12391 else
12392 {
12394 }
12395 }
12396
12397 if (version < 140)
12398 {
12400 {
12401 if (!ctx.
Read(value))
12402 return false;
12403 SetTemperatureDirect(value);
12404 }
12405 }
12406
12408 {
12409 if (!ctx.
Read(value))
12410 return false;
12412 }
12413
12415 {
12416 if (!ctx.
Read(intValue))
12417 return false;
12419 }
12420
12422 {
12423 int r,g,b,a;
12425 return false;
12427 return false;
12429 return false;
12431 return false;
12432
12434 }
12435
12437 {
12438 if (!ctx.
Read(intValue))
12439 return false;
12441 }
12442
12443 if (version >= 138 && version < 140)
12444 {
12446 {
12447 if (!ctx.
Read(intValue))
12448 return false;
12449 SetFrozen(intValue);
12450 }
12451 }
12452
12453 return true;
12454 }
12455
12456
12458 {
12461 {
12463 }
12464
12465 if (!super.OnStoreLoad(ctx, version))
12466 {
12468 return false;
12469 }
12470
12471 if (version >= 114)
12472 {
12473 bool hasQuickBarIndexSaved;
12474
12475 if (!ctx.
Read(hasQuickBarIndexSaved))
12476 {
12478 return false;
12479 }
12480
12481 if (hasQuickBarIndexSaved)
12482 {
12483 int itmQBIndex;
12484
12485
12486 if (!ctx.
Read(itmQBIndex))
12487 {
12489 return false;
12490 }
12491
12492 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12493 if (itmQBIndex != -1 && parentPlayer)
12494 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12495 }
12496 }
12497 else
12498 {
12499
12500 PlayerBase player;
12501 int itemQBIndex;
12502 if (version ==
int.
MAX)
12503 {
12504 if (!ctx.
Read(itemQBIndex))
12505 {
12507 return false;
12508 }
12509 }
12510 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12511 {
12512
12513 if (!ctx.
Read(itemQBIndex))
12514 {
12516 return false;
12517 }
12518 if (itemQBIndex != -1 && player)
12519 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12520 }
12521 }
12522
12523 if (version < 140)
12524 {
12525
12526 if (!LoadVariables(ctx, version))
12527 {
12529 return false;
12530 }
12531 }
12532
12533
12535 {
12537 return false;
12538 }
12539 if (version >= 132)
12540 {
12542 if (raib)
12543 {
12545 {
12547 return false;
12548 }
12549 }
12550 }
12551
12553 return true;
12554 }
12555
12556
12557
12559 {
12560 super.OnStoreSave(ctx);
12561
12562 PlayerBase player;
12563 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12564 {
12566
12567 int itemQBIndex = -1;
12568 itemQBIndex = player.FindQuickBarEntityIndex(this);
12569 ctx.
Write(itemQBIndex);
12570 }
12571 else
12572 {
12574 }
12575
12577
12579 if (raib)
12580 {
12582 }
12583 }
12584
12585
12587 {
12588 super.AfterStoreLoad();
12589
12591 {
12593 }
12594
12596 {
12599 }
12600 }
12601
12603 {
12604 super.EEOnAfterLoad();
12605
12607 {
12609 }
12610
12613 }
12614
12616 {
12617 return false;
12618 }
12619
12620
12621
12623 {
12625 {
12626 #ifdef PLATFORM_CONSOLE
12627
12629 {
12631 if (menu)
12632 {
12634 }
12635 }
12636 #endif
12637 }
12638
12640 {
12643 }
12644
12646 {
12647 SetWeightDirty();
12649 }
12651 {
12654 }
12655
12657 {
12660
12663 }
12665 {
12669 }
12670
12671 super.OnVariablesSynchronized();
12672 }
12673
12674
12675
12677 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12678 {
12679 if (!IsServerCheck(allow_client))
12680 return false;
12681
12683 return false;
12684
12687
12688 if (value <= (min + 0.001))
12689 value = min;
12690
12691 if (value == min)
12692 {
12693 if (destroy_config)
12694 {
12695 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12696 if (dstr)
12697 {
12699 this.Delete();
12700 return true;
12701 }
12702 }
12703 else if (destroy_forced)
12704 {
12706 this.Delete();
12707 return true;
12708 }
12709
12711 }
12712
12715
12717 {
12718 EntityAI parent = GetHierarchyRoot();
12719 InventoryLocation iLoc = new InventoryLocation();
12720 GetInventory().GetCurrentInventoryLocation(iLoc);
12722 {
12723 int iLocSlot = iLoc.
GetSlot();
12725 {
12727 }
12729 {
12731 }
12732 }
12733 }
12734
12736 {
12738
12739 if (delta)
12741 }
12742
12744
12745 return false;
12746 }
12747
12748
12750 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12751 {
12753 }
12754
12756 {
12759 }
12760
12762 {
12765 }
12766
12768 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12769 {
12770 float value_clamped = Math.Clamp(value, 0, 1);
12772 SetQuantity(result, destroy_config, destroy_forced);
12773 }
12774
12775
12778 {
12780 }
12781
12783 {
12785 }
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12797 {
12798 int slot = -1;
12799 GameInventory inventory = GetInventory();
12800 if (inventory)
12801 {
12802 InventoryLocation il = new InventoryLocation;
12805 }
12806
12808 }
12809
12811 {
12812 float quantity_max = 0;
12813
12815 {
12816 if (attSlotID != -1)
12817 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12818
12819 if (quantity_max <= 0)
12821 }
12822
12823 if (quantity_max <= 0)
12825
12826 return quantity_max;
12827 }
12828
12830 {
12832 }
12833
12835 {
12837 }
12838
12839
12841 {
12843 }
12844
12846 {
12848 }
12849
12851 {
12853 }
12854
12855
12857 {
12858
12859 float weightEx = GetWeightEx();
12860 float special = GetInventoryAndCargoWeight();
12861 return weightEx - special;
12862 }
12863
12864
12866 {
12868 }
12869
12871 {
12873 {
12874 #ifdef DEVELOPER
12875 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12876 {
12877 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12879 }
12880 #endif
12881
12882 return GetQuantity() * GetConfigWeightModified();
12883 }
12884 else if (HasEnergyManager())
12885 {
12886 #ifdef DEVELOPER
12887 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12888 {
12889 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12890 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12891 }
12892 #endif
12893 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12894 }
12895 else
12896 {
12897 #ifdef DEVELOPER
12898 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12899 {
12900 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12901 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12902 }
12903 #endif
12904 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12905 }
12906 }
12907
12910 {
12911 int item_count = 0;
12913
12914 GameInventory inventory = GetInventory();
12915 CargoBase cargo = inventory.
GetCargo();
12916 if (cargo != NULL)
12917 {
12919 }
12920
12922 for (int i = 0; i < nAttachments; ++i)
12923 {
12925 if (item)
12926 item_count += item.GetNumberOfItems();
12927 }
12928 return item_count;
12929 }
12930
12933 {
12934 float weight = 0;
12935 float wetness = 1;
12936 if (include_wetness)
12939 {
12940 weight = wetness * m_ConfigWeight;
12941 }
12943 {
12944 weight = 1;
12945 }
12946 return weight;
12947 }
12948
12949
12950
12952 {
12953 GameInventory inventory = GetInventory();
12954 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12955 {
12956 array<EntityAI> items = new array<EntityAI>;
12958 for (int i = 0; i < items.Count(); ++i)
12959 {
12961 if (item)
12962 {
12963 g_Game.ObjectDelete(item);
12964 }
12965 }
12966 }
12967 }
12968
12969
12970
12971
12973 {
12974 float energy = 0;
12975 if (HasEnergyManager())
12976 {
12977 energy = GetCompEM().GetEnergy();
12978 }
12979 return energy;
12980 }
12981
12982
12984 {
12985 super.OnEnergyConsumed();
12986
12988 }
12989
12991 {
12992 super.OnEnergyAdded();
12993
12995 }
12996
12997
12999 {
13000 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13001 {
13003 {
13004 float energy_0to1 = GetCompEM().GetEnergy0To1();
13006 }
13007 }
13008 }
13009
13010
13012 {
13013 return ConfigGetFloat("heatIsolation");
13014 }
13015
13017 {
13019 }
13020
13022 {
13023 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13024 if (
g_Game.ConfigIsExisting(paramPath))
13025 return g_Game.ConfigGetFloat(paramPath);
13026
13027 return 0.0;
13028 }
13029
13031 {
13032 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13033 if (
g_Game.ConfigIsExisting(paramPath))
13034 return g_Game.ConfigGetFloat(paramPath);
13035
13036 return 0.0;
13037 }
13038
13039 override void SetWet(
float value,
bool allow_client =
false)
13040 {
13041 if (!IsServerCheck(allow_client))
13042 return;
13043
13046
13048
13049 m_VarWet = Math.Clamp(value, min, max);
13050
13052 {
13055 }
13056 }
13057
13058 override void AddWet(
float value)
13059 {
13061 }
13062
13064 {
13066 }
13067
13069 {
13071 }
13072
13074 {
13076 }
13077
13079 {
13081 }
13082
13084 {
13086 }
13087
13088 override void OnWetChanged(
float newVal,
float oldVal)
13089 {
13092 if (newLevel != oldLevel)
13093 {
13095 }
13096 }
13097
13099 {
13100 SetWeightDirty();
13101 }
13102
13104 {
13105 return GetWetLevelInternal(
m_VarWet);
13106 }
13107
13108
13109
13111 {
13113 }
13114
13116 {
13118 }
13119
13121 {
13123 }
13124
13126 {
13128 }
13129
13130
13131
13133 {
13134 if (ConfigIsExisting("itemModelLength"))
13135 {
13136 return ConfigGetFloat("itemModelLength");
13137 }
13138 return 0;
13139 }
13140
13142 {
13143 if (ConfigIsExisting("itemAttachOffset"))
13144 {
13145 return ConfigGetFloat("itemAttachOffset");
13146 }
13147 return 0;
13148 }
13149
13150 override void SetCleanness(
int value,
bool allow_client =
false)
13151 {
13152 if (!IsServerCheck(allow_client))
13153 return;
13154
13156
13158
13161 }
13162
13164 {
13166 }
13167
13169 {
13170 return true;
13171 }
13172
13173
13174
13175
13177 {
13179 }
13180
13182 {
13184 }
13185
13186
13187
13188
13189 override void SetColor(
int r,
int g,
int b,
int a)
13190 {
13196 }
13198 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13199 {
13204 }
13205
13207 {
13209 }
13210
13213 {
13214 int r,g,b,a;
13216 r = r/255;
13217 g = g/255;
13218 b = b/255;
13219 a = a/255;
13220 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13221 }
13222
13223
13224
13225 override void SetLiquidType(
int value,
bool allow_client =
false)
13226 {
13227 if (!IsServerCheck(allow_client))
13228 return;
13229
13234 }
13235
13237 {
13238 return ConfigGetInt("varLiquidTypeInit");
13239 }
13240
13242 {
13244 }
13245
13247 {
13249 SetFrozen(false);
13250 }
13251
13254 {
13255 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13256 }
13257
13258
13261 {
13262 PlayerBase nplayer;
13263 if (PlayerBase.CastTo(nplayer, player))
13264 {
13266 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13267 }
13268 }
13269
13270
13273 {
13274 PlayerBase nplayer;
13275 if (PlayerBase.CastTo(nplayer,player))
13276 {
13277 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13278 }
13279
13280 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13281
13282 if (HasEnergyManager())
13283 {
13284 GetCompEM().UpdatePlugState();
13285 }
13286 }
13287
13288
13290 {
13291 super.OnPlacementStarted(player);
13292
13294 }
13295
13296 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13297 {
13299 {
13300 m_AdminLog.OnPlacementComplete(player,
this);
13301 }
13302
13303 super.OnPlacementComplete(player, position, orientation);
13304 }
13305
13306
13307
13308
13309
13311 {
13313 {
13314 return true;
13315 }
13316 else
13317 {
13318 return false;
13319 }
13320 }
13321
13322
13324 {
13326 {
13328 }
13329 }
13330
13331
13333 {
13335 }
13336
13338 {
13340 }
13341
13342 override void InsertAgent(
int agent,
float count = 1)
13343 {
13344 if (count < 1)
13345 return;
13346
13348 }
13349
13352 {
13354 }
13355
13356
13358 {
13360 }
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13404 {
13406 return false;
13407 return true;
13408 }
13409
13411 {
13412
13414 }
13415
13416
13419 {
13420 super.CheckForRoofLimited(timeTresholdMS);
13421
13422 float time =
g_Game.GetTime();
13423 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13424 {
13425 m_PreviousRoofTestTime = time;
13426 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13427 }
13428 }
13429
13430
13432 {
13434 {
13435 return 0;
13436 }
13437
13438 if (GetInventory().GetAttachmentSlotsCount() != 0)
13439 {
13440 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13441 if (filter)
13442 return filter.GetProtectionLevel(type, false, system);
13443 else
13444 return 0;
13445 }
13446
13447 string subclassPath, entryName;
13448
13449 switch (type)
13450 {
13452 entryName = "biological";
13453 break;
13455 entryName = "chemical";
13456 break;
13457 default:
13458 entryName = "biological";
13459 break;
13460 }
13461
13462 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13463
13464 return g_Game.ConfigGetFloat(subclassPath + entryName);
13465 }
13466
13467
13468
13471 {
13472 if (!IsMagazine())
13474
13476 }
13477
13478
13479
13480
13481
13486 {
13487 return true;
13488 }
13489
13491 {
13493 }
13494
13495
13496
13497
13498
13500 {
13501 if (parent)
13502 {
13503 if (parent.IsInherited(DayZInfected))
13504 return true;
13505
13506 if (!parent.IsRuined())
13507 return true;
13508 }
13509
13510 return true;
13511 }
13512
13514 {
13515 if (!super.CanPutAsAttachment(parent))
13516 {
13517 return false;
13518 }
13519
13520 if (!IsRuined() && !parent.IsRuined())
13521 {
13522 return true;
13523 }
13524
13525 return false;
13526 }
13527
13529 {
13530
13531
13532
13533
13534 return super.CanReceiveItemIntoCargo(item);
13535 }
13536
13538 {
13539
13540
13541
13542
13543 GameInventory attachmentInv = attachment.GetInventory();
13545 {
13546 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13547 return false;
13548 }
13549
13550 InventoryLocation loc = new InventoryLocation();
13551 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13552 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13553 return false;
13554
13555 return super.CanReceiveAttachment(attachment, slotId);
13556 }
13557
13559 {
13560 if (!super.CanReleaseAttachment(attachment))
13561 return false;
13562
13563 return GetInventory().AreChildrenAccessible();
13564 }
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13587 {
13588 int id = muzzle_owner.GetMuzzleID();
13589 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13590
13591 if (WPOF_array)
13592 {
13593 for (int i = 0; i < WPOF_array.Count(); i++)
13594 {
13595 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13596
13597 if (WPOF)
13598 {
13599 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13600 }
13601 }
13602 }
13603 }
13604
13605
13607 {
13608 int id = muzzle_owner.GetMuzzleID();
13610
13611 if (WPOBE_array)
13612 {
13613 for (int i = 0; i < WPOBE_array.Count(); i++)
13614 {
13615 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13616
13617 if (WPOBE)
13618 {
13619 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13620 }
13621 }
13622 }
13623 }
13624
13625
13627 {
13628 int id = muzzle_owner.GetMuzzleID();
13629 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13630
13631 if (WPOOH_array)
13632 {
13633 for (int i = 0; i < WPOOH_array.Count(); i++)
13634 {
13635 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13636
13637 if (WPOOH)
13638 {
13639 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13640 }
13641 }
13642 }
13643 }
13644
13645
13647 {
13648 int id = muzzle_owner.GetMuzzleID();
13649 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13650
13651 if (WPOOH_array)
13652 {
13653 for (int i = 0; i < WPOOH_array.Count(); i++)
13654 {
13655 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13656
13657 if (WPOOH)
13658 {
13659 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13660 }
13661 }
13662 }
13663 }
13664
13665
13667 {
13668 int id = muzzle_owner.GetMuzzleID();
13669 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13670
13671 if (WPOOH_array)
13672 {
13673 for (int i = 0; i < WPOOH_array.Count(); i++)
13674 {
13675 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13676
13677 if (WPOOH)
13678 {
13679 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13680 }
13681 }
13682 }
13683 }
13684
13685
13686
13688 {
13690 {
13691 return true;
13692 }
13693
13694 return false;
13695 }
13696
13698 {
13700 {
13701 return true;
13702 }
13703
13704 return false;
13705 }
13706
13708 {
13710 {
13711 return true;
13712 }
13713
13714 return false;
13715 }
13716
13718 {
13719 return false;
13720 }
13721
13724 {
13725 return UATimeSpent.DEFAULT_DEPLOY;
13726 }
13727
13728
13729
13730
13732 {
13734 SetSynchDirty();
13735 }
13736
13738 {
13740 }
13741
13742
13744 {
13745 return false;
13746 }
13747
13750 {
13751 string att_type = "None";
13752
13753 if (ConfigIsExisting("soundAttType"))
13754 {
13755 att_type = ConfigGetString("soundAttType");
13756 }
13757
13759 }
13760
13762 {
13764 }
13765
13766
13767
13768
13769
13775
13777 {
13780
13782 }
13783
13784
13786 {
13788 return;
13789
13791
13794
13797
13798 SoundParameters params = new SoundParameters();
13802 }
13803
13804
13806 {
13808 {
13811
13812 SetSynchDirty();
13813
13816 }
13817 }
13818
13820 {
13822 }
13823
13824
13826 {
13828 return;
13829
13831 SetSynchDirty();
13832
13835 }
13836
13838 {
13841 }
13842
13844 {
13846 }
13847
13848 void OnApply(PlayerBase player);
13849
13851 {
13852 return 1.0;
13853 };
13854
13856 {
13858 }
13859
13861 {
13863 }
13864
13866
13868 {
13869 SetDynamicPhysicsLifeTime(0.01);
13871 }
13872
13874 {
13875 array<string> zone_names = new array<string>;
13876 GetDamageZones(zone_names);
13877 for (int i = 0; i < zone_names.Count(); i++)
13878 {
13879 SetHealthMax(zone_names.Get(i),"Health");
13880 }
13881 SetHealthMax("","Health");
13882 }
13883
13886 {
13887 float global_health = GetHealth01("","Health");
13888 array<string> zones = new array<string>;
13889 GetDamageZones(zones);
13890
13891 for (int i = 0; i < zones.Count(); i++)
13892 {
13893 SetHealth01(zones.Get(i),"Health",global_health);
13894 }
13895 }
13896
13899 {
13900 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13901 }
13902
13904 {
13905 if (!hasRootAsPlayer)
13906 {
13907 if (refParentIB)
13908 {
13909
13910 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13911 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13912
13913 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13914 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13915
13918 }
13919 else
13920 {
13921
13924 }
13925 }
13926 }
13927
13929 {
13931 {
13932 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13933 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13934 {
13935 float heatPermCoef = 1.0;
13937 while (ent)
13938 {
13939 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13940 ent = ent.GetHierarchyParent();
13941 }
13942
13943 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13944 }
13945 }
13946 }
13947
13949 {
13950
13951 EntityAI parent = GetHierarchyParent();
13952 if (!parent)
13953 {
13954 hasParent = false;
13955 hasRootAsPlayer = false;
13956 }
13957 else
13958 {
13959 hasParent = true;
13960 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13961 refParentIB =
ItemBase.Cast(parent);
13962 }
13963 }
13964
13965 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13966 {
13967
13968 }
13969
13971 {
13972
13973 return false;
13974 }
13975
13977 {
13978
13979
13980 return false;
13981 }
13982
13984 {
13985
13986 return false;
13987 }
13988
13991 {
13992 return !GetIsFrozen() &&
IsOpen();
13993 }
13994
13996 {
13997 bool hasParent = false, hasRootAsPlayer = false;
13999
14000 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
14001 bool foodDecay =
g_Game.IsFoodDecayEnabled();
14002
14003 if (wwtu || foodDecay)
14004 {
14008
14009 if (processWetness || processTemperature || processDecay)
14010 {
14012
14013 if (processWetness)
14014 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14015
14016 if (processTemperature)
14018
14019 if (processDecay)
14020 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14021 }
14022 }
14023 }
14024
14027 {
14029 }
14030
14032 {
14035
14036 return super.GetTemperatureFreezeThreshold();
14037 }
14038
14040 {
14043
14044 return super.GetTemperatureThawThreshold();
14045 }
14046
14048 {
14051
14052 return super.GetItemOverheatThreshold();
14053 }
14054
14056 {
14058 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14059
14060 return super.GetTemperatureFreezeTime();
14061 }
14062
14064 {
14066 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14067
14068 return super.GetTemperatureThawTime();
14069 }
14070
14075
14077 {
14078 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14079 }
14080
14082 {
14083 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14084 }
14085
14088 {
14090 }
14091
14093 {
14095 }
14096
14098 {
14100 }
14101
14104 {
14105 return null;
14106 }
14107
14110 {
14111 return false;
14112 }
14113
14115 {
14117 {
14120 if (!trg)
14121 {
14123 explosive = this;
14124 }
14125
14126 explosive.PairRemote(trg);
14128
14129 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14130 trg.SetPersistentPairID(persistentID);
14131 explosive.SetPersistentPairID(persistentID);
14132
14133 return true;
14134 }
14135 return false;
14136 }
14137
14140 {
14141 float ret = 1.0;
14144 ret *= GetHealth01();
14145
14146 return ret;
14147 }
14148
14149 #ifdef DEVELOPER
14150 override void SetDebugItem()
14151 {
14152 super.SetDebugItem();
14153 _itemBase = this;
14154 }
14155
14157 {
14158 string text = super.GetDebugText();
14159
14161 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14162
14163 return text;
14164 }
14165 #endif
14166
14168 {
14169 return true;
14170 }
14171
14173
14175
14177 {
14180 }
14181
14182
14190
14206
14207 [
Obsolete(
"Use ItemSoundHandler instead")]
14210 {
14211 if (!
g_Game.IsDedicatedServer())
14212 {
14213 if (ConfigIsExisting("attachSoundSet"))
14214 {
14215 string cfg_path = "";
14216 string soundset = "";
14217 string type_name =
GetType();
14218
14221 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14222 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14223
14224 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14225 {
14226 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14227 {
14228 if (cfg_slot_array[i] == slot_type)
14229 {
14230 soundset = cfg_soundset_array[i];
14231 break;
14232 }
14233 }
14234 }
14235
14236 if (soundset != "")
14237 {
14238 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14240 }
14241 }
14242 }
14243 }
14244
14246}
14247
14249{
14251 if (entity)
14252 {
14253 bool is_item = entity.IsInherited(
ItemBase);
14254 if (is_item && full_quantity)
14255 {
14258 }
14259 }
14260 else
14261 {
14263 return NULL;
14264 }
14265 return entity;
14266}
14267
14269{
14270 if (item)
14271 {
14272 if (health > 0)
14273 item.SetHealth("", "", health);
14274
14275 if (item.CanHaveTemperature())
14276 {
14278 if (item.CanFreeze())
14279 item.SetFrozen(false);
14280 }
14281
14282 if (item.HasEnergyManager())
14283 {
14284 if (quantity >= 0)
14285 {
14286 item.GetCompEM().SetEnergy0To1(quantity);
14287 }
14288 else
14289 {
14291 }
14292 }
14293 else if (item.IsMagazine())
14294 {
14295 Magazine mag = Magazine.Cast(item);
14296 if (quantity >= 0)
14297 {
14298 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14299 }
14300 else
14301 {
14303 }
14304
14305 }
14306 else
14307 {
14308 if (quantity >= 0)
14309 {
14310 item.SetQuantityNormalized(quantity, false);
14311 }
14312 else
14313 {
14315 }
14316
14317 }
14318 }
14319}
14320
14321#ifdef DEVELOPER
14323#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.