9334{
9336 {
9337 return true;
9338 }
9339};
9340
9342{
9343
9344};
9345
9346
9347
9349{
9353
9355
9358
9359
9360
9361
9362
9371
9377
9382
9387
9408 protected bool m_IsResultOfSplit
9409
9411
9416
9417
9418
9420
9424
9425
9426
9428
9431
9432
9433
9439
9440
9448
9451
9452
9454
9455
9457
9458
9463
9464
9469
9471
9472
9474
9475
9477 {
9482
9483 if (!
g_Game.IsDedicatedServer())
9484 {
9486 {
9488
9490 {
9492 }
9493 }
9494
9497 }
9498
9499 m_OldLocation = null;
9500
9502 {
9504 }
9505
9506 if (ConfigIsExisting("headSelectionsToHide"))
9507 {
9510 }
9511
9513 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9514 {
9516 }
9517
9519
9520 m_IsResultOfSplit = false;
9521
9523 }
9524
9526 {
9527 super.InitItemVariables();
9528
9534 m_Count = ConfigGetInt(
"count");
9535
9538
9543
9546
9551
9563
9567
9568
9571 if (ConfigIsExisting("canBeSplit"))
9572 {
9575 }
9576
9578 if (ConfigIsExisting("itemBehaviour"))
9580
9581
9584 RegisterNetSyncVariableInt("m_VarLiquidType");
9585 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9586
9587 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9588 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9589 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9590
9591 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9592 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9593 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9594 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9595
9596 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9597 RegisterNetSyncVariableBool("m_IsTakeable");
9598 RegisterNetSyncVariableBool("m_IsHologram");
9599
9602 {
9605 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9606 }
9607
9609
9611 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9613
9615 }
9616
9618 {
9620 }
9621
9623 {
9626 {
9631 }
9632 }
9633
9634 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9635 {
9637 {
9640 }
9641
9643 }
9644
9646 {
9652 }
9653
9655
9657 {
9659
9660 if (!action)
9661 {
9662 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9663 return;
9664 }
9665
9667 if (!ai)
9668 {
9670 return;
9671 }
9672
9674 if (!action_array)
9675 {
9676 action_array = new array<ActionBase_Basic>;
9678 }
9679 if (LogManager.IsActionLogEnable())
9680 {
9681 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9682 }
9683
9684 if (action_array.Find(action) != -1)
9685 {
9686 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9687 }
9688 else
9689 {
9690 action_array.Insert(action);
9691 }
9692 }
9693
9695 {
9696 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9697 ActionBase action = player.GetActionManager().GetAction(actionName);
9700
9701 if (action_array)
9702 {
9703 action_array.RemoveItem(action);
9704 }
9705 }
9706
9707
9708
9710 {
9711 ActionOverrideData overrideData = new ActionOverrideData();
9715
9717 if (!actionMap)
9718 {
9721 }
9722
9723 actionMap.Insert(this.
Type(), overrideData);
9724
9725 }
9726
9728
9730
9731
9733 {
9736
9739
9740 string config_to_search = "CfgVehicles";
9741 string muzzle_owner_config;
9742
9744 {
9745 if (IsInherited(Weapon))
9746 config_to_search = "CfgWeapons";
9747
9748 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9749
9750 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9751
9752 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9753
9754 if (config_OnFire_subclass_count > 0)
9755 {
9756 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9757
9758 for (int i = 0; i < config_OnFire_subclass_count; i++)
9759 {
9760 string particle_class = "";
9761 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9762 string config_OnFire_entry = config_OnFire_class + particle_class;
9763 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9764 WPOF_array.Insert(WPOF);
9765 }
9766
9767
9769 }
9770 }
9771
9773 {
9774 config_to_search = "CfgWeapons";
9775 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9776
9777 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9778
9779 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9780
9781 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9782 {
9783 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9784
9785 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9786 {
9787 string particle_class2 = "";
9788 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9789 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9790 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9791 WPOBE_array.Insert(WPOBE);
9792 }
9793
9794
9796 }
9797 }
9798 }
9799
9800
9802 {
9805
9807 {
9808 string config_to_search = "CfgVehicles";
9809
9810 if (IsInherited(Weapon))
9811 config_to_search = "CfgWeapons";
9812
9813 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9814 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9815
9816 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9817 {
9818
9820
9822 {
9824 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9826 return;
9827 }
9828
9831
9832
9833
9834 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9835 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9836
9837 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9838 {
9839 string particle_class = "";
9840 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9841 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9842 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9843
9844 if (entry_type == CT_CLASS)
9845 {
9846 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9847 WPOOH_array.Insert(WPOF);
9848 }
9849 }
9850
9851
9853 }
9854 }
9855 }
9856
9858 {
9860 }
9861
9863 {
9865 {
9867
9870
9873
9874 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9875 }
9876 }
9877
9879 {
9881 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9882
9884 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9885
9887 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9888
9890 {
9892 }
9893 }
9894
9896 {
9898 }
9899
9901 {
9904 else
9906
9908 {
9911 }
9912 else
9913 {
9916
9919 }
9920
9922 }
9923
9925 {
9927 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9928 }
9929
9931 {
9933 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9935 }
9936
9938 {
9940 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9941 }
9942
9944 {
9947
9948 OverheatingParticle OP = new OverheatingParticle();
9953
9955 }
9956
9958 {
9961
9962 return -1;
9963 }
9964
9966 {
9968 {
9971
9972 for (int i = count; i > 0; --i)
9973 {
9974 int id = i - 1;
9977
9980
9981 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9982 {
9983 if (p)
9984 {
9987 }
9988 }
9989 }
9990 }
9991 }
9992
9994 {
9996 {
9998 {
9999 int id = i - 1;
10001
10002 if (OP)
10003 {
10005
10006 if (p)
10007 {
10009 }
10010
10011 delete OP;
10012 }
10013 }
10014
10017 }
10018 }
10019
10022 {
10023 return 0.0;
10024 }
10025
10026
10028 {
10029 return 250;
10030 }
10031
10033 {
10034 return 0;
10035 }
10036
10039 {
10041 return true;
10042
10043 return false;
10044 }
10045
10048 {
10051
10053 {
10055 }
10056 else
10057 {
10058
10060 }
10061
10063 }
10064
10071 {
10072 return -1;
10073 }
10074
10075
10076
10077
10079 {
10081 {
10082 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10083 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10084
10085 if (r_index >= 0)
10086 {
10087 InventoryLocation r_il = new InventoryLocation;
10088 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10089
10090 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10093 {
10094 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10095 }
10097 {
10098 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10099 }
10100
10101 }
10102
10103 player.GetHumanInventory().ClearUserReservedLocation(this);
10104 }
10105
10108 }
10109
10110
10111
10112
10114 {
10115 return ItemBase.m_DebugActionsMask;
10116 }
10117
10119 {
10120 return ItemBase.m_DebugActionsMask & mask;
10121 }
10122
10124 {
10125 ItemBase.m_DebugActionsMask = mask;
10126 }
10127
10129 {
10130 ItemBase.m_DebugActionsMask |= mask;
10131 }
10132
10134 {
10135 ItemBase.m_DebugActionsMask &= ~mask;
10136 }
10137
10139 {
10141 {
10143 }
10144 else
10145 {
10147 }
10148 }
10149
10150
10152 {
10153 if (GetEconomyProfile())
10154 {
10155 float q_max = GetEconomyProfile().GetQuantityMax();
10156 if (q_max > 0)
10157 {
10158 float q_min = GetEconomyProfile().GetQuantityMin();
10159 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10160
10162 {
10163 ComponentEnergyManager comp = GetCompEM();
10165 {
10167 }
10168 }
10170 {
10172
10173 }
10174
10175 }
10176 }
10177 }
10178
10181 {
10182 EntityAI parent = GetHierarchyParent();
10183
10184 if (parent)
10185 {
10186 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10187 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10188 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10189 }
10190 }
10191
10194 {
10195 EntityAI parent = GetHierarchyParent();
10196
10197 if (parent)
10198 {
10199 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10200 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10201 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10202 }
10203 }
10204
10206 {
10207
10208
10209
10210
10212
10214 {
10215 if (ScriptInputUserData.CanStoreInputUserData())
10216 {
10217 ScriptInputUserData ctx = new ScriptInputUserData;
10223 ctx.
Write(use_stack_max);
10226
10228 {
10229 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10230 }
10231 }
10232 }
10233 else if (!
g_Game.IsMultiplayer())
10234 {
10236 }
10237 }
10238
10240 {
10242 }
10243
10245 {
10247 }
10248
10250 {
10252 }
10253
10255 {
10256
10257 return false;
10258 }
10259
10261 {
10262 return false;
10263 }
10264
10268 {
10269 return false;
10270 }
10271
10273 {
10274 return "";
10275 }
10276
10278
10280 {
10281 return false;
10282 }
10283
10285 {
10286 return true;
10287 }
10288
10289
10290
10292 {
10293 return true;
10294 }
10295
10297 {
10298 return true;
10299 }
10300
10302 {
10303 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10305 }
10306
10308 {
10310 }
10311
10313 {
10315 if (!is_being_placed)
10317 SetSynchDirty();
10318 }
10319
10320
10322
10324 {
10326 }
10327
10329 {
10331 }
10332
10334 {
10335 return 1;
10336 }
10337
10339 {
10340 return false;
10341 }
10342
10344 {
10346 SetSynchDirty();
10347 }
10348
10349
10350
10351
10352
10353
10354
10355
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
10384 {
10385 super.OnMovedInsideCargo(container);
10386
10387 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10388 }
10389
10390 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10391 {
10392 super.EEItemLocationChanged(oldLoc, newLoc);
10393
10394 PlayerBase newPlayer = null;
10395 PlayerBase oldPlayer = null;
10396
10397 if (newLoc.GetParent())
10398 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10399
10400 if (oldLoc.GetParent())
10401 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10402
10404 {
10405 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10406
10407 if (rIndex >= 0)
10408 {
10409 InventoryLocation rIl = new InventoryLocation;
10410 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10411
10412 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10415 {
10416 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10417 }
10419 {
10421 }
10422
10423 }
10424 }
10425
10427 {
10428 if (newPlayer)
10429 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10430
10431 if (newPlayer == oldPlayer)
10432 {
10433 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10434 {
10436 {
10437 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10438 {
10439 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10440 }
10441 }
10442 else
10443 {
10444 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10445 }
10446 }
10447
10448 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10449 {
10450 int type = oldLoc.GetType();
10452 {
10453 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10454 }
10456 {
10457 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10458 }
10459 }
10460 if (!m_OldLocation)
10461 {
10462 m_OldLocation = new InventoryLocation;
10463 }
10464 m_OldLocation.Copy(oldLoc);
10465 }
10466 else
10467 {
10468 if (m_OldLocation)
10469 {
10470 m_OldLocation.Reset();
10471 }
10472 }
10473
10474 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10475 }
10476 else
10477 {
10478 if (newPlayer)
10479 {
10480 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10481 if (resIndex >= 0)
10482 {
10483 InventoryLocation il = new InventoryLocation;
10484 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10486 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10489 {
10490 il.
GetParent().GetOnReleaseLock().Invoke(it);
10491 }
10493 {
10495 }
10496
10497 }
10498 }
10500 {
10501
10503 }
10504
10505 if (m_OldLocation)
10506 {
10507 m_OldLocation.Reset();
10508 }
10509 }
10510
10512 {
10513 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10514 }
10515
10517 {
10518 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10519 }
10520 }
10521
10522 override void EOnContact(IEntity other, Contact extra)
10523 {
10525 {
10526 int liquidType = -1;
10528 if (impactSpeed > 0.0)
10529 {
10531 #ifndef SERVER
10533 #else
10535 SetSynchDirty();
10536 #endif
10538 }
10539 }
10540
10541 #ifdef SERVER
10542 if (GetCompEM() && GetCompEM().IsPlugged())
10543 {
10544 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10545 GetCompEM().UnplugThis();
10546 }
10547 #endif
10548 }
10549
10551
10553 {
10555 }
10556
10558 {
10559
10560 }
10561
10563 {
10564 super.OnItemLocationChanged(old_owner, new_owner);
10565
10566 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10567 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10568
10569 if (!relatedPlayer && playerNew)
10570 relatedPlayer = playerNew;
10571
10572 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10573 {
10575 if (actionMgr)
10576 {
10577 ActionBase currentAction = actionMgr.GetRunningAction();
10578 if (currentAction)
10580 }
10581 }
10582
10583 Man ownerPlayerOld = null;
10584 Man ownerPlayerNew = null;
10585
10586 if (old_owner)
10587 {
10588 if (old_owner.
IsMan())
10589 {
10590 ownerPlayerOld = Man.Cast(old_owner);
10591 }
10592 else
10593 {
10594 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10595 }
10596 }
10597 else
10598 {
10600 {
10602
10603 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10604 {
10605 GetCompEM().UnplugThis();
10606 }
10607 }
10608 }
10609
10610 if (new_owner)
10611 {
10612 if (new_owner.
IsMan())
10613 {
10614 ownerPlayerNew = Man.Cast(new_owner);
10615 }
10616 else
10617 {
10618 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10619 }
10620 }
10621
10622 if (ownerPlayerOld != ownerPlayerNew)
10623 {
10624 if (ownerPlayerOld)
10625 {
10626 array<EntityAI> subItemsExit = new array<EntityAI>;
10628 for (int i = 0; i < subItemsExit.Count(); i++)
10629 {
10632 }
10633 }
10634
10635 if (ownerPlayerNew)
10636 {
10637 array<EntityAI> subItemsEnter = new array<EntityAI>;
10639 for (int j = 0; j < subItemsEnter.Count(); j++)
10640 {
10643 }
10644 }
10645 }
10646 else if (ownerPlayerNew != null)
10647 {
10648 PlayerBase nplayer;
10649 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10650 {
10651 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10653 for (int k = 0; k < subItemsUpdate.Count(); k++)
10654 {
10656 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10657 }
10658 }
10659 }
10660
10661 if (old_owner)
10662 old_owner.OnChildItemRemoved(this);
10663 if (new_owner)
10664 new_owner.OnChildItemReceived(this);
10665 }
10666
10667
10669 {
10670 super.EEDelete(parent);
10671 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10672 if (player)
10673 {
10675
10676 if (player.IsAlive())
10677 {
10678 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10679 if (r_index >= 0)
10680 {
10681 InventoryLocation r_il = new InventoryLocation;
10682 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10683
10684 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10687 {
10688 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10689 }
10691 {
10692 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10693 }
10694
10695 }
10696
10697 player.RemoveQuickBarEntityShortcut(this);
10698 }
10699 }
10700 }
10701
10703 {
10704 super.EEKilled(killer);
10705
10708 {
10709 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10710 {
10711 if (IsMagazine())
10712 {
10713 if (Magazine.Cast(this).GetAmmoCount() > 0)
10714 {
10716 }
10717 }
10718 else
10719 {
10721 }
10722 }
10723 }
10724 }
10725
10727 {
10728 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10729
10730 super.OnWasAttached(parent, slot_id);
10731
10734
10737 }
10738
10740 {
10741 super.OnWasDetached(parent, slot_id);
10742
10745
10748 }
10749
10751 {
10752 int idx;
10755
10756 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10757 if (inventory_slots.Count() < 1)
10758 {
10759 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10760 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10761 }
10762 else
10763 {
10764 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10765 }
10766
10767 idx = inventory_slots.Find(slot);
10768 if (idx < 0)
10769 return "";
10770
10771 return attach_types.Get(idx);
10772 }
10773
10775 {
10776 int idx = -1;
10777 string slot;
10778
10781
10782 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10783 if (inventory_slots.Count() < 1)
10784 {
10785 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10786 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10787 }
10788 else
10789 {
10790 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10791 if (detach_types.Count() < 1)
10792 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10793 }
10794
10795 for (int i = 0; i < inventory_slots.Count(); i++)
10796 {
10797 slot = inventory_slots.Get(i);
10798 }
10799
10800 if (slot != "")
10801 {
10802 if (detach_types.Count() == 1)
10803 idx = 0;
10804 else
10805 idx = inventory_slots.Find(slot);
10806 }
10807 if (idx < 0)
10808 return "";
10809
10810 return detach_types.Get(idx);
10811 }
10812
10814 {
10815
10817
10818
10819 float min_time = 1;
10820 float max_time = 3;
10821 float delay = Math.RandomFloat(min_time, max_time);
10822
10823 explode_timer.Run(delay, this, "DoAmmoExplosion");
10824 }
10825
10827 {
10828 Magazine magazine = Magazine.Cast(this);
10829 int pop_sounds_count = 6;
10830 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10831
10832
10833 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10834 string sound_name = pop_sounds[ sound_idx ];
10835 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10836
10837
10838 magazine.ServerAddAmmoCount(-1);
10839
10840
10841 float min_temp_to_explode = 100;
10842
10843 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10844 {
10846 }
10847 }
10848
10849
10850 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10851 {
10852 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10853
10854 const int CHANCE_DAMAGE_CARGO = 4;
10855 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10856 const int CHANCE_DAMAGE_NOTHING = 2;
10857
10859 {
10860 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10861 int chances;
10862 int rnd;
10863
10864 if (GetInventory().GetCargo())
10865 {
10866 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10867 rnd = Math.RandomInt(0,chances);
10868
10869 if (rnd < CHANCE_DAMAGE_CARGO)
10870 {
10872 }
10873 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10874 {
10876 }
10877 }
10878 else
10879 {
10880 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10881 rnd = Math.RandomInt(0,chances);
10882
10883 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10884 {
10886 }
10887 }
10888 }
10889 }
10890
10892 {
10893 CargoBase cargo = GetInventory().GetCargo();
10894 if (cargo)
10895 {
10897 if (item_count > 0)
10898 {
10899 int random_pick = Math.RandomInt(0, item_count);
10901 if (!item.IsExplosive())
10902 {
10903 item.AddHealth("","",damage);
10904 return true;
10905 }
10906 }
10907 }
10908 return false;
10909 }
10910
10912 {
10913 GameInventory inventory = GetInventory();
10915 if (attachment_count > 0)
10916 {
10917 int random_pick = Math.RandomInt(0, attachment_count);
10919 if (!attachment.IsExplosive())
10920 {
10921 attachment.AddHealth("","",damage);
10922 return true;
10923 }
10924 }
10925 return false;
10926 }
10927
10929 {
10931 }
10932
10934 {
10936 return GetInventory().CanRemoveEntity();
10937
10938 return false;
10939 }
10940
10942 {
10943
10945 return false;
10946
10947
10949 return false;
10950
10951
10952
10954 if (delta == 0)
10955 return false;
10956
10957
10958 return true;
10959 }
10960
10962 {
10964 {
10965 if (ScriptInputUserData.CanStoreInputUserData())
10966 {
10967 ScriptInputUserData ctx = new ScriptInputUserData;
10972 ctx.
Write(destination_entity);
10974 ctx.
Write(slot_id);
10976 }
10977 }
10978 else if (!
g_Game.IsMultiplayer())
10979 {
10981 }
10982 }
10983
10985 {
10986 float split_quantity_new;
10990 InventoryLocation loc = new InventoryLocation;
10991
10992 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10993 {
10995 split_quantity_new = stack_max;
10996 else
10998
11000 {
11001 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11002 if (new_item)
11003 {
11004 new_item.SetResultOfSplit(true);
11005 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11007 new_item.
SetQuantity(split_quantity_new,
false,
true);
11008 }
11009 }
11010 }
11011 else if (destination_entity && slot_id == -1)
11012 {
11013 if (quantity > stack_max)
11014 split_quantity_new = stack_max;
11015 else
11016 split_quantity_new = quantity;
11017
11019 {
11020 GameInventory destinationInventory = destination_entity.GetInventory();
11022 {
11025 }
11026
11027 if (new_item)
11028 {
11029 new_item.SetResultOfSplit(true);
11030 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11032 new_item.
SetQuantity(split_quantity_new,
false,
true);
11033 }
11034 }
11035 }
11036 else
11037 {
11038 if (stack_max != 0)
11039 {
11041 {
11043 }
11044
11045 if (split_quantity_new == 0)
11046 {
11047 if (!
g_Game.IsMultiplayer())
11048 player.PhysicalPredictiveDropItem(this);
11049 else
11050 player.ServerDropEntity(this);
11051 return;
11052 }
11053
11055 {
11057
11058 if (new_item)
11059 {
11060 new_item.SetResultOfSplit(true);
11061 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11064 new_item.PlaceOnSurface();
11065 }
11066 }
11067 }
11068 }
11069 }
11070
11072 {
11073 float split_quantity_new;
11077 InventoryLocation loc = new InventoryLocation;
11078
11079 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11080 {
11082 split_quantity_new = stack_max;
11083 else
11085
11087 {
11088 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11089 if (new_item)
11090 {
11091 new_item.SetResultOfSplit(true);
11092 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11094 new_item.
SetQuantity(split_quantity_new,
false,
true);
11095 }
11096 }
11097 }
11098 else if (destination_entity && slot_id == -1)
11099 {
11100 if (quantity > stack_max)
11101 split_quantity_new = stack_max;
11102 else
11103 split_quantity_new = quantity;
11104
11106 {
11107 GameInventory destinationInventory = destination_entity.GetInventory();
11109 {
11112 }
11113
11114 if (new_item)
11115 {
11116 new_item.SetResultOfSplit(true);
11117 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11119 new_item.
SetQuantity(split_quantity_new,
false,
true);
11120 }
11121 }
11122 }
11123 else
11124 {
11125 if (stack_max != 0)
11126 {
11128 {
11130 }
11131
11133 {
11135
11136 if (new_item)
11137 {
11138 new_item.SetResultOfSplit(true);
11139 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11142 new_item.PlaceOnSurface();
11143 }
11144 }
11145 }
11146 }
11147 }
11148
11150 {
11152 {
11153 if (ScriptInputUserData.CanStoreInputUserData())
11154 {
11155 ScriptInputUserData ctx = new ScriptInputUserData;
11160 dst.WriteToContext(ctx);
11162 }
11163 }
11164 else if (!
g_Game.IsMultiplayer())
11165 {
11167 }
11168 }
11169
11171 {
11173 {
11174 if (ScriptInputUserData.CanStoreInputUserData())
11175 {
11176 ScriptInputUserData ctx = new ScriptInputUserData;
11181 ctx.
Write(destination_entity);
11187 }
11188 }
11189 else if (!
g_Game.IsMultiplayer())
11190 {
11192 }
11193 }
11194
11196 {
11198 }
11199
11201 {
11203 float split_quantity_new;
11205 if (dst.IsValid())
11206 {
11207 int slot_id = dst.GetSlot();
11209
11210 if (quantity > stack_max)
11211 split_quantity_new = stack_max;
11212 else
11213 split_quantity_new = quantity;
11214
11216 {
11218
11219 if (new_item)
11220 {
11221 new_item.SetResultOfSplit(true);
11222 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11224 new_item.
SetQuantity(split_quantity_new,
false,
true);
11225 }
11226
11227 return new_item;
11228 }
11229 }
11230
11231 return null;
11232 }
11233
11235 {
11237 float split_quantity_new;
11239 if (destination_entity)
11240 {
11242 if (quantity > stackable)
11243 split_quantity_new = stackable;
11244 else
11245 split_quantity_new = quantity;
11246
11248 {
11249 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11250 if (new_item)
11251 {
11252 new_item.SetResultOfSplit(true);
11253 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11255 new_item.
SetQuantity(split_quantity_new,
false,
true);
11256 }
11257 }
11258 }
11259 }
11260
11262 {
11264 {
11265 if (ScriptInputUserData.CanStoreInputUserData())
11266 {
11267 ScriptInputUserData ctx = new ScriptInputUserData;
11272 ItemBase destination_entity =
this;
11273 ctx.
Write(destination_entity);
11277 }
11278 }
11279 else if (!
g_Game.IsMultiplayer())
11280 {
11282 }
11283 }
11284
11286 {
11288 float split_quantity_new;
11290 if (player)
11291 {
11293 if (quantity > stackable)
11294 split_quantity_new = stackable;
11295 else
11296 split_quantity_new = quantity;
11297
11299 {
11300 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11301 new_item =
ItemBase.Cast(in_hands);
11302 if (new_item)
11303 {
11304 new_item.SetResultOfSplit(true);
11305 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11307 new_item.SetQuantity(split_quantity_new, false, true);
11308 }
11309 }
11310 }
11311 }
11312
11314 {
11316 float split_quantity_new = Math.Floor(quantity * 0.5);
11317
11319 return;
11320
11322
11323 if (new_item)
11324 {
11325 if (new_item.GetQuantityMax() < split_quantity_new)
11326 {
11327 split_quantity_new = new_item.GetQuantityMax();
11328 }
11329
11330 new_item.SetResultOfSplit(true);
11331 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11332
11334 {
11337 }
11338 else
11339 {
11341 new_item.
SetQuantity(split_quantity_new,
false,
true);
11342 }
11343 }
11344 }
11345
11347 {
11349 float split_quantity_new = Math.Floor(quantity / 2);
11350
11352 return;
11353
11354 InventoryLocation invloc = new InventoryLocation;
11356
11358 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11359
11360 if (new_item)
11361 {
11362 if (new_item.GetQuantityMax() < split_quantity_new)
11363 {
11364 split_quantity_new = new_item.GetQuantityMax();
11365 }
11367 {
11370 }
11371 else if (split_quantity_new > 1)
11372 {
11374 new_item.
SetQuantity(split_quantity_new,
false,
true);
11375 }
11376 }
11377 }
11378
11381 {
11382 SetWeightDirty();
11384
11385 if (parent)
11386 parent.OnAttachmentQuantityChangedEx(this, delta);
11387
11389 {
11391 {
11393 }
11395 {
11396 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11398 }
11399 }
11400 }
11401
11404 {
11405
11406 }
11407
11410 {
11412 }
11413
11415 {
11416 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11417
11419 {
11420 if (newLevel == GameConstants.STATE_RUINED)
11421 {
11423 EntityAI parent = GetHierarchyParent();
11424 if (parent && parent.IsFireplace())
11425 {
11426 CargoBase cargo = GetInventory().GetCargo();
11427 if (cargo)
11428 {
11430 {
11432 }
11433 }
11434 }
11435 }
11436
11438 {
11439
11441 return;
11442 }
11443
11444 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11445 {
11447 }
11448 }
11449 }
11450
11451
11453 {
11454 super.OnRightClick();
11455
11457 {
11459 {
11460 if (ScriptInputUserData.CanStoreInputUserData())
11461 {
11462 EntityAI root = GetHierarchyRoot();
11463 Man playerOwner = GetHierarchyRootPlayer();
11464 InventoryLocation dst = new InventoryLocation;
11465
11466
11467 if (!playerOwner && root && root == this)
11468 {
11470 }
11471 else
11472 {
11473
11474 GetInventory().GetCurrentInventoryLocation(dst);
11476 {
11477 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11479 {
11481 }
11482 else
11483 {
11485
11486
11487 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11488 {
11490 }
11491 else
11492 {
11493 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11494 }
11495 }
11496 }
11497 }
11498
11499 ScriptInputUserData ctx = new ScriptInputUserData;
11507 }
11508 }
11509 else if (!
g_Game.IsMultiplayer())
11510 {
11512 }
11513 }
11514 }
11515
11517 {
11518 if (root)
11519 {
11520 vector m4[4];
11521 root.GetTransform(m4);
11522 dst.SetGround(this, m4);
11523 }
11524 else
11525 {
11526 GetInventory().GetCurrentInventoryLocation(dst);
11527 }
11528 }
11529
11530 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11531 {
11532
11533 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11534 return false;
11535
11536 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11537 return false;
11538
11539
11541 return false;
11542
11543
11544 Magazine mag = Magazine.Cast(this);
11545 if (mag)
11546 {
11547 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11548 return false;
11549
11550 if (stack_max_limit)
11551 {
11552 Magazine other_mag = Magazine.Cast(other_item);
11553 if (other_item)
11554 {
11555 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11556 return false;
11557 }
11558
11559 }
11560 }
11561 else
11562 {
11563
11565 return false;
11566
11568 return false;
11569 }
11570
11571 PlayerBase player = null;
11572 if (CastTo(player, GetHierarchyRootPlayer()))
11573 {
11574 if (player.GetInventory().HasAttachment(this))
11575 return false;
11576
11577 if (player.IsItemsToDelete())
11578 return false;
11579 }
11580
11581 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11582 return false;
11583
11584 int slotID;
11586 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11587 return false;
11588
11589 return true;
11590 }
11591
11593 {
11595 }
11596
11598 {
11599 return m_IsResultOfSplit;
11600 }
11601
11603 {
11604 m_IsResultOfSplit = value;
11605 }
11606
11608 {
11610 }
11611
11613 {
11614 float other_item_quantity = other_item.GetQuantity();
11615 float this_free_space;
11616
11618
11620
11621 if (other_item_quantity > this_free_space)
11622 {
11623 return this_free_space;
11624 }
11625 else
11626 {
11627 return other_item_quantity;
11628 }
11629 }
11630
11632 {
11634 }
11635
11637 {
11639 return;
11640
11641 if (!IsMagazine() && other_item)
11642 {
11644 if (quantity_used != 0)
11645 {
11646 float hp1 = GetHealth01("","");
11647 float hp2 = other_item.GetHealth01("","");
11648 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11649 hpResult = hpResult / (
GetQuantity() + quantity_used);
11650
11651 hpResult *= GetMaxHealth();
11652 Math.Round(hpResult);
11653 SetHealth("", "Health", hpResult);
11654
11656 other_item.AddQuantity(-quantity_used);
11657 }
11658 }
11660 }
11661
11663 {
11664 #ifdef SERVER
11665 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11666 GetHierarchyParent().IncreaseLifetimeUp();
11667 #endif
11668 };
11669
11671 {
11672 PlayerBase p = PlayerBase.Cast(player);
11673
11674 array<int> recipesIds = p.m_Recipes;
11675 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11676 if (moduleRecipesManager)
11677 {
11678 EntityAI itemInHands = player.GetEntityInHands();
11679 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11680 }
11681
11682 for (int i = 0;i < recipesIds.Count(); i++)
11683 {
11684 int key = recipesIds.Get(i);
11685 string recipeName = moduleRecipesManager.GetRecipeName(key);
11687 }
11688 }
11689
11690
11691 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11692 {
11693 super.GetDebugActions(outputList);
11694
11695
11701
11702
11707
11712
11713
11717
11718
11720 {
11724 }
11725
11728
11729
11733
11735
11736 InventoryLocation loc = new InventoryLocation();
11737 GetInventory().GetCurrentInventoryLocation(loc);
11739 {
11740 if (Gizmo_IsSupported())
11743 }
11744
11746 }
11747
11748
11749
11750
11752 {
11753 super.OnAction(action_id, player, ctx);
11754
11756 {
11757 switch (action_id)
11758 {
11762 return true;
11766 return true;
11767 }
11768 }
11769
11771 {
11772 switch (action_id)
11773 {
11775 Delete();
11776 return true;
11777 }
11778 }
11779
11780 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11781 {
11782 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11783 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11784 PlayerBase p = PlayerBase.Cast(player);
11785 if (
EActions.RECIPES_RANGE_START < 1000)
11786 {
11787 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11788 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11789 }
11790 }
11791 #ifndef SERVER
11792 else if (action_id ==
EActions.WATCH_PLAYER)
11793 {
11794 PluginDeveloper.SetDeveloperItemClientEx(player);
11795 }
11796 #endif
11798 {
11799 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11800 {
11801 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11802 OnDebugButtonPressServer(id + 1);
11803 }
11804
11805 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11806 {
11807 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11809 }
11810
11811 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11812 {
11813 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11815 }
11816
11817 else if (action_id ==
EActions.ADD_QUANTITY)
11818 {
11819 if (IsMagazine())
11820 {
11821 Magazine mag = Magazine.Cast(this);
11822 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11823 }
11824 else
11825 {
11827 }
11828
11829 if (m_EM)
11830 {
11831 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11832 }
11833
11834 }
11835
11836 else if (action_id ==
EActions.REMOVE_QUANTITY)
11837 {
11838 if (IsMagazine())
11839 {
11840 Magazine mag2 = Magazine.Cast(this);
11841 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11842 }
11843 else
11844 {
11846 }
11847 if (m_EM)
11848 {
11849 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11850 }
11851
11852 }
11853
11854 else if (action_id ==
EActions.SET_QUANTITY_0)
11855 {
11857
11858 if (m_EM)
11859 {
11860 m_EM.SetEnergy(0);
11861 }
11862 }
11863
11864 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11865 {
11867
11868 if (m_EM)
11869 {
11870 m_EM.SetEnergy(m_EM.GetEnergyMax());
11871 }
11872 }
11873
11874 else if (action_id ==
EActions.ADD_HEALTH)
11875 {
11876 AddHealth("","",GetMaxHealth("","Health")/5);
11877 }
11878 else if (action_id ==
EActions.REMOVE_HEALTH)
11879 {
11880 AddHealth("","",-GetMaxHealth("","Health")/5);
11881 }
11882 else if (action_id ==
EActions.DESTROY_HEALTH)
11883 {
11884 SetHealth01("","",0);
11885 }
11886 else if (action_id ==
EActions.WATCH_ITEM)
11887 {
11889 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11890 #ifdef DEVELOPER
11891 SetDebugDeveloper_item(this);
11892 #endif
11893 }
11894
11895 else if (action_id ==
EActions.ADD_TEMPERATURE)
11896 {
11897 AddTemperature(20);
11898
11899 }
11900
11901 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11902 {
11903 AddTemperature(-20);
11904
11905 }
11906
11907 else if (action_id ==
EActions.FLIP_FROZEN)
11908 {
11909 SetFrozen(!GetIsFrozen());
11910
11911 }
11912
11913 else if (action_id ==
EActions.ADD_WETNESS)
11914 {
11916
11917 }
11918
11919 else if (action_id ==
EActions.REMOVE_WETNESS)
11920 {
11922
11923 }
11924
11925 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11926 {
11929
11930
11931 }
11932
11933 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11934 {
11937 }
11938
11939 else if (action_id ==
EActions.MAKE_SPECIAL)
11940 {
11941 auto debugParams = DebugSpawnParams.WithPlayer(player);
11942 OnDebugSpawnEx(debugParams);
11943 }
11944
11945 }
11946
11947
11948 return false;
11949 }
11950
11951
11952
11953
11957
11960
11961
11962
11964 {
11965 return false;
11966 }
11967
11968
11970 {
11971 return true;
11972 }
11973
11974
11976 {
11977 return true;
11978 }
11979
11980
11981
11983 {
11984 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11985 return g_Game.ConfigIsExisting(config_path);
11986 }
11987
11990 {
11991 return null;
11992 }
11993
11995 {
11996 return false;
11997 }
11998
12000 {
12001 return false;
12002 }
12003
12007
12008
12010 {
12011 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12012 return module_repairing.CanRepair(this, item_repair_kit);
12013 }
12014
12015
12016 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12017 {
12018 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12019 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12020 }
12021
12022
12024 {
12025
12026
12027
12028
12029
12030
12031
12032
12033 return 1;
12034 }
12035
12036
12037
12039 {
12041 }
12042
12043
12044
12046 {
12048 }
12049
12050
12059 {
12060 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12061
12062 if (player)
12063 {
12064 player.MessageStatus(text);
12065 }
12066 }
12067
12068
12077 {
12078 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12079
12080 if (player)
12081 {
12082 player.MessageAction(text);
12083 }
12084 }
12085
12086
12095 {
12096 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12097
12098 if (player)
12099 {
12100 player.MessageFriendly(text);
12101 }
12102 }
12103
12104
12113 {
12114 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12115
12116 if (player)
12117 {
12118 player.MessageImportant(text);
12119 }
12120 }
12121
12123 {
12124 return true;
12125 }
12126
12127
12128 override bool KindOf(
string tag)
12129 {
12130 bool found = false;
12131 string item_name = this.
GetType();
12133 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12134
12135 int array_size = item_tag_array.Count();
12136 for (int i = 0; i < array_size; i++)
12137 {
12138 if (item_tag_array.Get(i) == tag)
12139 {
12140 found = true;
12141 break;
12142 }
12143 }
12144 return found;
12145 }
12146
12147
12149 {
12150
12151 super.OnRPC(sender, rpc_type,ctx);
12152
12153
12154 switch (rpc_type)
12155 {
12156 #ifndef SERVER
12157 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12158 Param2<bool, string> p = new Param2<bool, string>(false, "");
12159
12161 return;
12162
12163 bool play = p.param1;
12164 string soundSet = p.param2;
12165
12166 if (play)
12167 {
12169 {
12171 {
12173 }
12174 }
12175 else
12176 {
12178 }
12179 }
12180 else
12181 {
12183 }
12184
12185 break;
12186 #endif
12187
12188 }
12189
12191 {
12193 }
12194 }
12195
12196
12197
12198
12200 {
12201 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12202 return plugin.GetID(
name);
12203 }
12204
12206 {
12207 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12208 return plugin.GetName(id);
12209 }
12210
12213 {
12214
12215
12216 int varFlags;
12217 if (!ctx.
Read(varFlags))
12218 return;
12219
12220 if (varFlags & ItemVariableFlags.FLOAT)
12221 {
12223 }
12224 }
12225
12227 {
12228
12229 super.SerializeNumericalVars(floats_out);
12230
12231
12232
12234 {
12236 }
12237
12239 {
12241 }
12242
12244 {
12246 }
12247
12249 {
12254 }
12255
12257 {
12259 }
12260 }
12261
12263 {
12264
12265 super.DeSerializeNumericalVars(floats);
12266
12267
12268 int index = 0;
12269 int mask = Math.Round(floats.Get(index));
12270
12271 index++;
12272
12274 {
12276 {
12278 }
12279 else
12280 {
12281 float quantity = floats.Get(index);
12282 SetQuantity(quantity,
true,
false,
false,
false);
12283 }
12284 index++;
12285 }
12286
12288 {
12289 float wet = floats.Get(index);
12291 index++;
12292 }
12293
12295 {
12296 int liquidtype = Math.Round(floats.Get(index));
12298 index++;
12299 }
12300
12302 {
12304 index++;
12306 index++;
12308 index++;
12310 index++;
12311 }
12312
12314 {
12315 int cleanness = Math.Round(floats.Get(index));
12317 index++;
12318 }
12319 }
12320
12322 {
12323 super.WriteVarsToCTX(ctx);
12324
12325
12327 {
12329 }
12330
12332 {
12334 }
12335
12337 {
12339 }
12340
12342 {
12343 int r,g,b,a;
12349 }
12350
12352 {
12354 }
12355 }
12356
12358 {
12359 if (!super.ReadVarsFromCTX(ctx,version))
12360 return false;
12361
12362 int intValue;
12363 float value;
12364
12365 if (version < 140)
12366 {
12367 if (!ctx.
Read(intValue))
12368 return false;
12369
12370 m_VariablesMask = intValue;
12371 }
12372
12374 {
12375 if (!ctx.
Read(value))
12376 return false;
12377
12379 {
12381 }
12382 else
12383 {
12385 }
12386 }
12387
12388 if (version < 140)
12389 {
12391 {
12392 if (!ctx.
Read(value))
12393 return false;
12394 SetTemperatureDirect(value);
12395 }
12396 }
12397
12399 {
12400 if (!ctx.
Read(value))
12401 return false;
12403 }
12404
12406 {
12407 if (!ctx.
Read(intValue))
12408 return false;
12410 }
12411
12413 {
12414 int r,g,b,a;
12416 return false;
12418 return false;
12420 return false;
12422 return false;
12423
12425 }
12426
12428 {
12429 if (!ctx.
Read(intValue))
12430 return false;
12432 }
12433
12434 if (version >= 138 && version < 140)
12435 {
12437 {
12438 if (!ctx.
Read(intValue))
12439 return false;
12440 SetFrozen(intValue);
12441 }
12442 }
12443
12444 return true;
12445 }
12446
12447
12449 {
12452 {
12454 }
12455
12456 if (!super.OnStoreLoad(ctx, version))
12457 {
12459 return false;
12460 }
12461
12462 if (version >= 114)
12463 {
12464 bool hasQuickBarIndexSaved;
12465
12466 if (!ctx.
Read(hasQuickBarIndexSaved))
12467 {
12469 return false;
12470 }
12471
12472 if (hasQuickBarIndexSaved)
12473 {
12474 int itmQBIndex;
12475
12476
12477 if (!ctx.
Read(itmQBIndex))
12478 {
12480 return false;
12481 }
12482
12483 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12484 if (itmQBIndex != -1 && parentPlayer)
12485 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12486 }
12487 }
12488 else
12489 {
12490
12491 PlayerBase player;
12492 int itemQBIndex;
12493 if (version ==
int.
MAX)
12494 {
12495 if (!ctx.
Read(itemQBIndex))
12496 {
12498 return false;
12499 }
12500 }
12501 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12502 {
12503
12504 if (!ctx.
Read(itemQBIndex))
12505 {
12507 return false;
12508 }
12509 if (itemQBIndex != -1 && player)
12510 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12511 }
12512 }
12513
12514 if (version < 140)
12515 {
12516
12517 if (!LoadVariables(ctx, version))
12518 {
12520 return false;
12521 }
12522 }
12523
12524
12526 {
12528 return false;
12529 }
12530 if (version >= 132)
12531 {
12533 if (raib)
12534 {
12536 {
12538 return false;
12539 }
12540 }
12541 }
12542
12544 return true;
12545 }
12546
12547
12548
12550 {
12551 super.OnStoreSave(ctx);
12552
12553 PlayerBase player;
12554 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12555 {
12557
12558 int itemQBIndex = -1;
12559 itemQBIndex = player.FindQuickBarEntityIndex(this);
12560 ctx.
Write(itemQBIndex);
12561 }
12562 else
12563 {
12565 }
12566
12568
12570 if (raib)
12571 {
12573 }
12574 }
12575
12576
12578 {
12579 super.AfterStoreLoad();
12580
12582 {
12584 }
12585
12587 {
12590 }
12591 }
12592
12594 {
12595 super.EEOnAfterLoad();
12596
12598 {
12600 }
12601
12604 }
12605
12607 {
12608 return false;
12609 }
12610
12611
12612
12614 {
12616 {
12617 #ifdef PLATFORM_CONSOLE
12618
12620 {
12622 if (menu)
12623 {
12625 }
12626 }
12627 #endif
12628 }
12629
12631 {
12634 }
12635
12637 {
12638 SetWeightDirty();
12640 }
12642 {
12645 }
12646
12648 {
12651
12654 }
12656 {
12660 }
12661
12662 super.OnVariablesSynchronized();
12663 }
12664
12665
12666
12668 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12669 {
12670 if (!IsServerCheck(allow_client))
12671 return false;
12672
12674 return false;
12675
12678
12679 if (value <= (min + 0.001))
12680 value = min;
12681
12682 if (value == min)
12683 {
12684 if (destroy_config)
12685 {
12686 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12687 if (dstr)
12688 {
12690 this.Delete();
12691 return true;
12692 }
12693 }
12694 else if (destroy_forced)
12695 {
12697 this.Delete();
12698 return true;
12699 }
12700
12702 }
12703
12706
12708 {
12709 EntityAI parent = GetHierarchyRoot();
12710 InventoryLocation iLoc = new InventoryLocation();
12711 GetInventory().GetCurrentInventoryLocation(iLoc);
12713 {
12714 int iLocSlot = iLoc.
GetSlot();
12716 {
12718 }
12720 {
12722 }
12723 }
12724 }
12725
12727 {
12729
12730 if (delta)
12732 }
12733
12735
12736 return false;
12737 }
12738
12739
12741 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12742 {
12744 }
12745
12747 {
12750 }
12751
12753 {
12756 }
12757
12759 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12760 {
12761 float value_clamped = Math.Clamp(value, 0, 1);
12763 SetQuantity(result, destroy_config, destroy_forced);
12764 }
12765
12766
12769 {
12771 }
12772
12774 {
12776 }
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12788 {
12789 int slot = -1;
12790 GameInventory inventory = GetInventory();
12791 if (inventory)
12792 {
12793 InventoryLocation il = new InventoryLocation;
12796 }
12797
12799 }
12800
12802 {
12803 float quantity_max = 0;
12804
12806 {
12807 if (attSlotID != -1)
12808 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12809
12810 if (quantity_max <= 0)
12812 }
12813
12814 if (quantity_max <= 0)
12816
12817 return quantity_max;
12818 }
12819
12821 {
12823 }
12824
12826 {
12828 }
12829
12830
12832 {
12834 }
12835
12837 {
12839 }
12840
12842 {
12844 }
12845
12846
12848 {
12849
12850 float weightEx = GetWeightEx();
12851 float special = GetInventoryAndCargoWeight();
12852 return weightEx - special;
12853 }
12854
12855
12857 {
12859 }
12860
12862 {
12864 {
12865 #ifdef DEVELOPER
12866 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12867 {
12868 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12870 }
12871 #endif
12872
12873 return GetQuantity() * GetConfigWeightModified();
12874 }
12875 else if (HasEnergyManager())
12876 {
12877 #ifdef DEVELOPER
12878 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12879 {
12880 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12881 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12882 }
12883 #endif
12884 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12885 }
12886 else
12887 {
12888 #ifdef DEVELOPER
12889 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12890 {
12891 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12892 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12893 }
12894 #endif
12895 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12896 }
12897 }
12898
12901 {
12902 int item_count = 0;
12904
12905 GameInventory inventory = GetInventory();
12906 CargoBase cargo = inventory.
GetCargo();
12907 if (cargo != NULL)
12908 {
12910 }
12911
12913 for (int i = 0; i < nAttachments; ++i)
12914 {
12916 if (item)
12917 item_count += item.GetNumberOfItems();
12918 }
12919 return item_count;
12920 }
12921
12924 {
12925 float weight = 0;
12926 float wetness = 1;
12927 if (include_wetness)
12930 {
12931 weight = wetness * m_ConfigWeight;
12932 }
12934 {
12935 weight = 1;
12936 }
12937 return weight;
12938 }
12939
12940
12941
12943 {
12944 GameInventory inventory = GetInventory();
12945 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12946 {
12947 array<EntityAI> items = new array<EntityAI>;
12949 for (int i = 0; i < items.Count(); ++i)
12950 {
12952 if (item)
12953 {
12954 g_Game.ObjectDelete(item);
12955 }
12956 }
12957 }
12958 }
12959
12960
12961
12962
12964 {
12965 float energy = 0;
12966 if (HasEnergyManager())
12967 {
12968 energy = GetCompEM().GetEnergy();
12969 }
12970 return energy;
12971 }
12972
12973
12975 {
12976 super.OnEnergyConsumed();
12977
12979 }
12980
12982 {
12983 super.OnEnergyAdded();
12984
12986 }
12987
12988
12990 {
12991 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12992 {
12994 {
12995 float energy_0to1 = GetCompEM().GetEnergy0To1();
12997 }
12998 }
12999 }
13000
13001
13003 {
13004 return ConfigGetFloat("heatIsolation");
13005 }
13006
13008 {
13010 }
13011
13013 {
13014 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13015 if (
g_Game.ConfigIsExisting(paramPath))
13016 return g_Game.ConfigGetFloat(paramPath);
13017
13018 return 0.0;
13019 }
13020
13022 {
13023 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13024 if (
g_Game.ConfigIsExisting(paramPath))
13025 return g_Game.ConfigGetFloat(paramPath);
13026
13027 return 0.0;
13028 }
13029
13030 override void SetWet(
float value,
bool allow_client =
false)
13031 {
13032 if (!IsServerCheck(allow_client))
13033 return;
13034
13037
13039
13040 m_VarWet = Math.Clamp(value, min, max);
13041
13043 {
13046 }
13047 }
13048
13049 override void AddWet(
float value)
13050 {
13052 }
13053
13055 {
13057 }
13058
13060 {
13062 }
13063
13065 {
13067 }
13068
13070 {
13072 }
13073
13075 {
13077 }
13078
13079 override void OnWetChanged(
float newVal,
float oldVal)
13080 {
13083 if (newLevel != oldLevel)
13084 {
13086 }
13087 }
13088
13090 {
13091 SetWeightDirty();
13092 }
13093
13095 {
13096 return GetWetLevelInternal(
m_VarWet);
13097 }
13098
13099
13100
13102 {
13104 }
13105
13107 {
13109 }
13110
13112 {
13114 }
13115
13117 {
13119 }
13120
13121
13122
13124 {
13125 if (ConfigIsExisting("itemModelLength"))
13126 {
13127 return ConfigGetFloat("itemModelLength");
13128 }
13129 return 0;
13130 }
13131
13133 {
13134 if (ConfigIsExisting("itemAttachOffset"))
13135 {
13136 return ConfigGetFloat("itemAttachOffset");
13137 }
13138 return 0;
13139 }
13140
13141 override void SetCleanness(
int value,
bool allow_client =
false)
13142 {
13143 if (!IsServerCheck(allow_client))
13144 return;
13145
13147
13149
13152 }
13153
13155 {
13157 }
13158
13160 {
13161 return true;
13162 }
13163
13164
13165
13166
13168 {
13170 }
13171
13173 {
13175 }
13176
13177
13178
13179
13180 override void SetColor(
int r,
int g,
int b,
int a)
13181 {
13187 }
13189 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13190 {
13195 }
13196
13198 {
13200 }
13201
13204 {
13205 int r,g,b,a;
13207 r = r/255;
13208 g = g/255;
13209 b = b/255;
13210 a = a/255;
13211 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13212 }
13213
13214
13215
13216 override void SetLiquidType(
int value,
bool allow_client =
false)
13217 {
13218 if (!IsServerCheck(allow_client))
13219 return;
13220
13225 }
13226
13228 {
13229 return ConfigGetInt("varLiquidTypeInit");
13230 }
13231
13233 {
13235 }
13236
13238 {
13240 SetFrozen(false);
13241 }
13242
13245 {
13246 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13247 }
13248
13249
13252 {
13253 PlayerBase nplayer;
13254 if (PlayerBase.CastTo(nplayer, player))
13255 {
13257 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13258 }
13259 }
13260
13261
13264 {
13265 PlayerBase nplayer;
13266 if (PlayerBase.CastTo(nplayer,player))
13267 {
13268 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13269 }
13270
13271 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13272
13273 if (HasEnergyManager())
13274 {
13275 GetCompEM().UpdatePlugState();
13276 }
13277 }
13278
13279
13281 {
13282 super.OnPlacementStarted(player);
13283
13285 }
13286
13287 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13288 {
13290 {
13291 m_AdminLog.OnPlacementComplete(player,
this);
13292 }
13293
13294 super.OnPlacementComplete(player, position, orientation);
13295 }
13296
13297
13298
13299
13300
13302 {
13304 {
13305 return true;
13306 }
13307 else
13308 {
13309 return false;
13310 }
13311 }
13312
13313
13315 {
13317 {
13319 }
13320 }
13321
13322
13324 {
13326 }
13327
13329 {
13331 }
13332
13333 override void InsertAgent(
int agent,
float count = 1)
13334 {
13335 if (count < 1)
13336 return;
13337
13339 }
13340
13343 {
13345 }
13346
13347
13349 {
13351 }
13352
13353
13354
13355
13356
13357
13358
13359
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
13395 {
13397 return false;
13398 return true;
13399 }
13400
13402 {
13403
13405 }
13406
13407
13410 {
13411 super.CheckForRoofLimited(timeTresholdMS);
13412
13413 float time =
g_Game.GetTime();
13414 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13415 {
13416 m_PreviousRoofTestTime = time;
13417 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13418 }
13419 }
13420
13421
13423 {
13425 {
13426 return 0;
13427 }
13428
13429 if (GetInventory().GetAttachmentSlotsCount() != 0)
13430 {
13431 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13432 if (filter)
13433 return filter.GetProtectionLevel(type, false, system);
13434 else
13435 return 0;
13436 }
13437
13438 string subclassPath, entryName;
13439
13440 switch (type)
13441 {
13443 entryName = "biological";
13444 break;
13446 entryName = "chemical";
13447 break;
13448 default:
13449 entryName = "biological";
13450 break;
13451 }
13452
13453 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13454
13455 return g_Game.ConfigGetFloat(subclassPath + entryName);
13456 }
13457
13458
13459
13462 {
13463 if (!IsMagazine())
13465
13467 }
13468
13469
13470
13471
13472
13477 {
13478 return true;
13479 }
13480
13482 {
13484 }
13485
13486
13487
13488
13489
13491 {
13492 if (parent)
13493 {
13494 if (parent.IsInherited(DayZInfected))
13495 return true;
13496
13497 if (!parent.IsRuined())
13498 return true;
13499 }
13500
13501 return true;
13502 }
13503
13505 {
13506 if (!super.CanPutAsAttachment(parent))
13507 {
13508 return false;
13509 }
13510
13511 if (!IsRuined() && !parent.IsRuined())
13512 {
13513 return true;
13514 }
13515
13516 return false;
13517 }
13518
13520 {
13521
13522
13523
13524
13525 return super.CanReceiveItemIntoCargo(item);
13526 }
13527
13529 {
13530
13531
13532
13533
13534 GameInventory attachmentInv = attachment.GetInventory();
13536 {
13537 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13538 return false;
13539 }
13540
13541 InventoryLocation loc = new InventoryLocation();
13542 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13543 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13544 return false;
13545
13546 return super.CanReceiveAttachment(attachment, slotId);
13547 }
13548
13550 {
13551 if (!super.CanReleaseAttachment(attachment))
13552 return false;
13553
13554 return GetInventory().AreChildrenAccessible();
13555 }
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13578 {
13579 int id = muzzle_owner.GetMuzzleID();
13580 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13581
13582 if (WPOF_array)
13583 {
13584 for (int i = 0; i < WPOF_array.Count(); i++)
13585 {
13586 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13587
13588 if (WPOF)
13589 {
13590 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13591 }
13592 }
13593 }
13594 }
13595
13596
13598 {
13599 int id = muzzle_owner.GetMuzzleID();
13601
13602 if (WPOBE_array)
13603 {
13604 for (int i = 0; i < WPOBE_array.Count(); i++)
13605 {
13606 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13607
13608 if (WPOBE)
13609 {
13610 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13611 }
13612 }
13613 }
13614 }
13615
13616
13618 {
13619 int id = muzzle_owner.GetMuzzleID();
13620 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13621
13622 if (WPOOH_array)
13623 {
13624 for (int i = 0; i < WPOOH_array.Count(); i++)
13625 {
13626 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13627
13628 if (WPOOH)
13629 {
13630 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13631 }
13632 }
13633 }
13634 }
13635
13636
13638 {
13639 int id = muzzle_owner.GetMuzzleID();
13640 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13641
13642 if (WPOOH_array)
13643 {
13644 for (int i = 0; i < WPOOH_array.Count(); i++)
13645 {
13646 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13647
13648 if (WPOOH)
13649 {
13650 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13651 }
13652 }
13653 }
13654 }
13655
13656
13658 {
13659 int id = muzzle_owner.GetMuzzleID();
13660 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13661
13662 if (WPOOH_array)
13663 {
13664 for (int i = 0; i < WPOOH_array.Count(); i++)
13665 {
13666 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13667
13668 if (WPOOH)
13669 {
13670 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13671 }
13672 }
13673 }
13674 }
13675
13676
13677
13679 {
13681 {
13682 return true;
13683 }
13684
13685 return false;
13686 }
13687
13689 {
13691 {
13692 return true;
13693 }
13694
13695 return false;
13696 }
13697
13699 {
13701 {
13702 return true;
13703 }
13704
13705 return false;
13706 }
13707
13709 {
13710 return false;
13711 }
13712
13715 {
13716 return UATimeSpent.DEFAULT_DEPLOY;
13717 }
13718
13719
13720
13721
13723 {
13725 SetSynchDirty();
13726 }
13727
13729 {
13731 }
13732
13733
13735 {
13736 return false;
13737 }
13738
13741 {
13742 string att_type = "None";
13743
13744 if (ConfigIsExisting("soundAttType"))
13745 {
13746 att_type = ConfigGetString("soundAttType");
13747 }
13748
13750 }
13751
13753 {
13755 }
13756
13757
13758
13759
13760
13766
13768 {
13771
13773 }
13774
13775
13777 {
13779 return;
13780
13782
13785
13788
13789 SoundParameters params = new SoundParameters();
13793 }
13794
13795
13797 {
13799 {
13802
13803 SetSynchDirty();
13804
13807 }
13808 }
13809
13811 {
13813 }
13814
13815
13817 {
13819 return;
13820
13822 SetSynchDirty();
13823
13826 }
13827
13829 {
13832 }
13833
13835 {
13837 }
13838
13839 void OnApply(PlayerBase player);
13840
13842 {
13843 return 1.0;
13844 };
13845
13847 {
13849 }
13850
13852 {
13854 }
13855
13857
13859 {
13860 SetDynamicPhysicsLifeTime(0.01);
13862 }
13863
13865 {
13866 array<string> zone_names = new array<string>;
13867 GetDamageZones(zone_names);
13868 for (int i = 0; i < zone_names.Count(); i++)
13869 {
13870 SetHealthMax(zone_names.Get(i),"Health");
13871 }
13872 SetHealthMax("","Health");
13873 }
13874
13877 {
13878 float global_health = GetHealth01("","Health");
13879 array<string> zones = new array<string>;
13880 GetDamageZones(zones);
13881
13882 for (int i = 0; i < zones.Count(); i++)
13883 {
13884 SetHealth01(zones.Get(i),"Health",global_health);
13885 }
13886 }
13887
13890 {
13891 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13892 }
13893
13895 {
13896 if (!hasRootAsPlayer)
13897 {
13898 if (refParentIB)
13899 {
13900
13901 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13902 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13903
13904 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13905 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13906
13909 }
13910 else
13911 {
13912
13915 }
13916 }
13917 }
13918
13920 {
13922 {
13923 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13924 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13925 {
13926 float heatPermCoef = 1.0;
13928 while (ent)
13929 {
13930 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13931 ent = ent.GetHierarchyParent();
13932 }
13933
13934 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13935 }
13936 }
13937 }
13938
13940 {
13941
13942 EntityAI parent = GetHierarchyParent();
13943 if (!parent)
13944 {
13945 hasParent = false;
13946 hasRootAsPlayer = false;
13947 }
13948 else
13949 {
13950 hasParent = true;
13951 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13952 refParentIB =
ItemBase.Cast(parent);
13953 }
13954 }
13955
13956 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13957 {
13958
13959 }
13960
13962 {
13963
13964 return false;
13965 }
13966
13968 {
13969
13970
13971 return false;
13972 }
13973
13975 {
13976
13977 return false;
13978 }
13979
13982 {
13983 return !GetIsFrozen() &&
IsOpen();
13984 }
13985
13987 {
13988 bool hasParent = false, hasRootAsPlayer = false;
13990
13991 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13992 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13993
13994 if (wwtu || foodDecay)
13995 {
13999
14000 if (processWetness || processTemperature || processDecay)
14001 {
14003
14004 if (processWetness)
14005 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14006
14007 if (processTemperature)
14009
14010 if (processDecay)
14011 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14012 }
14013 }
14014 }
14015
14018 {
14020 }
14021
14023 {
14026
14027 return super.GetTemperatureFreezeThreshold();
14028 }
14029
14031 {
14034
14035 return super.GetTemperatureThawThreshold();
14036 }
14037
14039 {
14042
14043 return super.GetItemOverheatThreshold();
14044 }
14045
14047 {
14049 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14050
14051 return super.GetTemperatureFreezeTime();
14052 }
14053
14055 {
14057 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14058
14059 return super.GetTemperatureThawTime();
14060 }
14061
14066
14068 {
14069 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14070 }
14071
14073 {
14074 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14075 }
14076
14079 {
14081 }
14082
14084 {
14086 }
14087
14089 {
14091 }
14092
14095 {
14096 return null;
14097 }
14098
14101 {
14102 return false;
14103 }
14104
14106 {
14108 {
14111 if (!trg)
14112 {
14114 explosive = this;
14115 }
14116
14117 explosive.PairRemote(trg);
14119
14120 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14121 trg.SetPersistentPairID(persistentID);
14122 explosive.SetPersistentPairID(persistentID);
14123
14124 return true;
14125 }
14126 return false;
14127 }
14128
14131 {
14132 float ret = 1.0;
14135 ret *= GetHealth01();
14136
14137 return ret;
14138 }
14139
14140 #ifdef DEVELOPER
14141 override void SetDebugItem()
14142 {
14143 super.SetDebugItem();
14144 _itemBase = this;
14145 }
14146
14148 {
14149 string text = super.GetDebugText();
14150
14152 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14153
14154 return text;
14155 }
14156 #endif
14157
14159 {
14160 return true;
14161 }
14162
14164
14166
14168 {
14171 }
14172
14173
14181
14197
14198 [
Obsolete(
"Use ItemSoundHandler instead")]
14201 {
14202 if (!
g_Game.IsDedicatedServer())
14203 {
14204 if (ConfigIsExisting("attachSoundSet"))
14205 {
14206 string cfg_path = "";
14207 string soundset = "";
14208 string type_name =
GetType();
14209
14212 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14213 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14214
14215 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14216 {
14217 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14218 {
14219 if (cfg_slot_array[i] == slot_type)
14220 {
14221 soundset = cfg_soundset_array[i];
14222 break;
14223 }
14224 }
14225 }
14226
14227 if (soundset != "")
14228 {
14229 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14231 }
14232 }
14233 }
14234 }
14235
14237}
14238
14240{
14242 if (entity)
14243 {
14244 bool is_item = entity.IsInherited(
ItemBase);
14245 if (is_item && full_quantity)
14246 {
14249 }
14250 }
14251 else
14252 {
14254 return NULL;
14255 }
14256 return entity;
14257}
14258
14260{
14261 if (item)
14262 {
14263 if (health > 0)
14264 item.SetHealth("", "", health);
14265
14266 if (item.CanHaveTemperature())
14267 {
14269 if (item.CanFreeze())
14270 item.SetFrozen(false);
14271 }
14272
14273 if (item.HasEnergyManager())
14274 {
14275 if (quantity >= 0)
14276 {
14277 item.GetCompEM().SetEnergy0To1(quantity);
14278 }
14279 else
14280 {
14282 }
14283 }
14284 else if (item.IsMagazine())
14285 {
14286 Magazine mag = Magazine.Cast(item);
14287 if (quantity >= 0)
14288 {
14289 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14290 }
14291 else
14292 {
14294 }
14295
14296 }
14297 else
14298 {
14299 if (quantity >= 0)
14300 {
14301 item.SetQuantityNormalized(quantity, false);
14302 }
14303 else
14304 {
14306 }
14307
14308 }
14309 }
14310}
14311
14312#ifdef DEVELOPER
14314#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.