5504{
5506 {
5507 return true;
5508 }
5509};
5510
5512{
5513
5514};
5515
5516
5517
5519{
5523
5525
5528
5529
5530
5531
5532
5541
5547
5552
5557
5578 protected bool m_IsResultOfSplit
5579
5581
5586
5587
5588
5590
5594
5595
5596
5598
5601
5602
5603
5609
5610
5618
5621
5622
5624
5625
5627
5628
5633
5634
5639
5641
5642
5644
5645
5647 {
5652
5653 if (!
g_Game.IsDedicatedServer())
5654 {
5656 {
5658
5660 {
5662 }
5663 }
5664
5667 }
5668
5669 m_OldLocation = null;
5670
5672 {
5674 }
5675
5676 if (ConfigIsExisting("headSelectionsToHide"))
5677 {
5680 }
5681
5683 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5684 {
5686 }
5687
5689
5690 m_IsResultOfSplit = false;
5691
5693 }
5694
5696 {
5697 super.InitItemVariables();
5698
5704 m_Count = ConfigGetInt(
"count");
5705
5708
5713
5716
5721
5733
5737
5738
5741 if (ConfigIsExisting("canBeSplit"))
5742 {
5745 }
5746
5748 if (ConfigIsExisting("itemBehaviour"))
5750
5751
5754 RegisterNetSyncVariableInt("m_VarLiquidType");
5755 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5756
5757 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5758 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5759 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5760
5761 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5762 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5763 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5764 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5765
5766 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5767 RegisterNetSyncVariableBool("m_IsTakeable");
5768 RegisterNetSyncVariableBool("m_IsHologram");
5769
5772 {
5775 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5776 }
5777
5779
5781 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5783
5785 }
5786
5788 {
5790 }
5791
5793 {
5796 {
5801 }
5802 }
5803
5804 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5805 {
5807 {
5810 }
5811
5813 }
5814
5816 {
5822 }
5823
5825
5827 {
5829
5830 if (!action)
5831 {
5832 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5833 return;
5834 }
5835
5837 if (!ai)
5838 {
5840 return;
5841 }
5842
5844 if (!action_array)
5845 {
5846 action_array = new array<ActionBase_Basic>;
5848 }
5849 if (LogManager.IsActionLogEnable())
5850 {
5851 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5852 }
5853
5854 if (action_array.Find(action) != -1)
5855 {
5856 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5857 }
5858 else
5859 {
5860 action_array.Insert(action);
5861 }
5862 }
5863
5865 {
5866 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5867 ActionBase action = player.GetActionManager().GetAction(actionName);
5870
5871 if (action_array)
5872 {
5873 action_array.RemoveItem(action);
5874 }
5875 }
5876
5877
5878
5880 {
5881 ActionOverrideData overrideData = new ActionOverrideData();
5885
5887 if (!actionMap)
5888 {
5891 }
5892
5893 actionMap.Insert(this.
Type(), overrideData);
5894
5895 }
5896
5898
5900
5901
5903 {
5906
5909
5910 string config_to_search = "CfgVehicles";
5911 string muzzle_owner_config;
5912
5914 {
5915 if (IsInherited(Weapon))
5916 config_to_search = "CfgWeapons";
5917
5918 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5919
5920 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5921
5922 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5923
5924 if (config_OnFire_subclass_count > 0)
5925 {
5926 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5927
5928 for (int i = 0; i < config_OnFire_subclass_count; i++)
5929 {
5930 string particle_class = "";
5931 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5932 string config_OnFire_entry = config_OnFire_class + particle_class;
5933 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5934 WPOF_array.Insert(WPOF);
5935 }
5936
5937
5939 }
5940 }
5941
5943 {
5944 config_to_search = "CfgWeapons";
5945 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5946
5947 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5948
5949 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5950
5951 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5952 {
5953 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5954
5955 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5956 {
5957 string particle_class2 = "";
5958 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5959 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5960 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5961 WPOBE_array.Insert(WPOBE);
5962 }
5963
5964
5966 }
5967 }
5968 }
5969
5970
5972 {
5975
5977 {
5978 string config_to_search = "CfgVehicles";
5979
5980 if (IsInherited(Weapon))
5981 config_to_search = "CfgWeapons";
5982
5983 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5984 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5985
5986 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5987 {
5988
5990
5992 {
5994 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5996 return;
5997 }
5998
6001
6002
6003
6004 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6005 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6006
6007 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6008 {
6009 string particle_class = "";
6010 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6011 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6012 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6013
6014 if (entry_type == CT_CLASS)
6015 {
6016 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6017 WPOOH_array.Insert(WPOF);
6018 }
6019 }
6020
6021
6023 }
6024 }
6025 }
6026
6028 {
6030 }
6031
6033 {
6035 {
6037
6040
6043
6044 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6045 }
6046 }
6047
6049 {
6051 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6052
6054 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6055
6057 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6058
6060 {
6062 }
6063 }
6064
6066 {
6068 }
6069
6071 {
6074 else
6076
6078 {
6081 }
6082 else
6083 {
6086
6089 }
6090
6092 }
6093
6095 {
6097 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6098 }
6099
6101 {
6103 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6105 }
6106
6108 {
6110 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6111 }
6112
6114 {
6117
6118 OverheatingParticle OP = new OverheatingParticle();
6123
6125 }
6126
6128 {
6131
6132 return -1;
6133 }
6134
6136 {
6138 {
6141
6142 for (int i = count; i > 0; --i)
6143 {
6144 int id = i - 1;
6147
6150
6151 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6152 {
6153 if (p)
6154 {
6157 }
6158 }
6159 }
6160 }
6161 }
6162
6164 {
6166 {
6168 {
6169 int id = i - 1;
6171
6172 if (OP)
6173 {
6175
6176 if (p)
6177 {
6179 }
6180
6181 delete OP;
6182 }
6183 }
6184
6187 }
6188 }
6189
6192 {
6193 return 0.0;
6194 }
6195
6196
6198 {
6199 return 250;
6200 }
6201
6203 {
6204 return 0;
6205 }
6206
6209 {
6211 return true;
6212
6213 return false;
6214 }
6215
6218 {
6221
6223 {
6225 }
6226 else
6227 {
6228
6230 }
6231
6233 }
6234
6241 {
6242 return -1;
6243 }
6244
6245
6246
6247
6249 {
6251 {
6252 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6253 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6254
6255 if (r_index >= 0)
6256 {
6257 InventoryLocation r_il = new InventoryLocation;
6258 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6259
6260 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6263 {
6264 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6265 }
6267 {
6268 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6269 }
6270
6271 }
6272
6273 player.GetHumanInventory().ClearUserReservedLocation(this);
6274 }
6275
6278 }
6279
6280
6281
6282
6284 {
6285 return ItemBase.m_DebugActionsMask;
6286 }
6287
6289 {
6290 return ItemBase.m_DebugActionsMask & mask;
6291 }
6292
6294 {
6295 ItemBase.m_DebugActionsMask = mask;
6296 }
6297
6299 {
6300 ItemBase.m_DebugActionsMask |= mask;
6301 }
6302
6304 {
6305 ItemBase.m_DebugActionsMask &= ~mask;
6306 }
6307
6309 {
6311 {
6313 }
6314 else
6315 {
6317 }
6318 }
6319
6320
6322 {
6323 if (GetEconomyProfile())
6324 {
6325 float q_max = GetEconomyProfile().GetQuantityMax();
6326 if (q_max > 0)
6327 {
6328 float q_min = GetEconomyProfile().GetQuantityMin();
6329 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6330
6332 {
6333 ComponentEnergyManager comp = GetCompEM();
6335 {
6337 }
6338 }
6340 {
6342
6343 }
6344
6345 }
6346 }
6347 }
6348
6351 {
6352 EntityAI parent = GetHierarchyParent();
6353
6354 if (parent)
6355 {
6356 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6357 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6358 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6359 }
6360 }
6361
6364 {
6365 EntityAI parent = GetHierarchyParent();
6366
6367 if (parent)
6368 {
6369 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6370 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6371 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6372 }
6373 }
6374
6376 {
6377
6378
6379
6380
6382
6384 {
6385 if (ScriptInputUserData.CanStoreInputUserData())
6386 {
6387 ScriptInputUserData ctx = new ScriptInputUserData;
6393 ctx.
Write(use_stack_max);
6396
6398 {
6399 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6400 }
6401 }
6402 }
6403 else if (!
g_Game.IsMultiplayer())
6404 {
6406 }
6407 }
6408
6410 {
6412 }
6413
6415 {
6417 }
6418
6420 {
6422 }
6423
6425 {
6426
6427 return false;
6428 }
6429
6431 {
6432 return false;
6433 }
6434
6438 {
6439 return false;
6440 }
6441
6443 {
6444 return "";
6445 }
6446
6448
6450 {
6451 return false;
6452 }
6453
6455 {
6456 return true;
6457 }
6458
6459
6460
6462 {
6463 return true;
6464 }
6465
6467 {
6468 return true;
6469 }
6470
6472 {
6473 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6475 }
6476
6478 {
6480 }
6481
6483 {
6485 if (!is_being_placed)
6487 SetSynchDirty();
6488 }
6489
6490
6492
6494 {
6496 }
6497
6499 {
6501 }
6502
6504 {
6505 return 1;
6506 }
6507
6509 {
6510 return false;
6511 }
6512
6514 {
6516 SetSynchDirty();
6517 }
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6554 {
6555 super.OnMovedInsideCargo(container);
6556
6557 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6558 }
6559
6560 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6561 {
6562 super.EEItemLocationChanged(oldLoc, newLoc);
6563
6564 PlayerBase newPlayer = null;
6565 PlayerBase oldPlayer = null;
6566
6567 if (newLoc.GetParent())
6568 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6569
6570 if (oldLoc.GetParent())
6571 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6572
6574 {
6575 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6576
6577 if (rIndex >= 0)
6578 {
6579 InventoryLocation rIl = new InventoryLocation;
6580 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6581
6582 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6585 {
6586 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6587 }
6589 {
6591 }
6592
6593 }
6594 }
6595
6597 {
6598 if (newPlayer)
6599 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6600
6601 if (newPlayer == oldPlayer)
6602 {
6603 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6604 {
6606 {
6607 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6608 {
6609 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6610 }
6611 }
6612 else
6613 {
6614 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6615 }
6616 }
6617
6618 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6619 {
6620 int type = oldLoc.GetType();
6622 {
6623 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6624 }
6626 {
6627 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6628 }
6629 }
6630 if (!m_OldLocation)
6631 {
6632 m_OldLocation = new InventoryLocation;
6633 }
6634 m_OldLocation.Copy(oldLoc);
6635 }
6636 else
6637 {
6638 if (m_OldLocation)
6639 {
6640 m_OldLocation.Reset();
6641 }
6642 }
6643
6644 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6645 }
6646 else
6647 {
6648 if (newPlayer)
6649 {
6650 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6651 if (resIndex >= 0)
6652 {
6653 InventoryLocation il = new InventoryLocation;
6654 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6656 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6659 {
6660 il.
GetParent().GetOnReleaseLock().Invoke(it);
6661 }
6663 {
6665 }
6666
6667 }
6668 }
6670 {
6671
6673 }
6674
6675 if (m_OldLocation)
6676 {
6677 m_OldLocation.Reset();
6678 }
6679 }
6680
6682 {
6683 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6684 }
6685
6687 {
6688 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6689 }
6690 }
6691
6692 override void EOnContact(IEntity other, Contact extra)
6693 {
6695 {
6696 int liquidType = -1;
6698 if (impactSpeed > 0.0)
6699 {
6701 #ifndef SERVER
6703 #else
6705 SetSynchDirty();
6706 #endif
6708 }
6709 }
6710
6711 #ifdef SERVER
6712 if (GetCompEM() && GetCompEM().IsPlugged())
6713 {
6714 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6715 GetCompEM().UnplugThis();
6716 }
6717 #endif
6718 }
6719
6721
6723 {
6725 }
6726
6728 {
6729
6730 }
6731
6733 {
6734 super.OnItemLocationChanged(old_owner, new_owner);
6735
6736 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6737 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6738
6739 if (!relatedPlayer && playerNew)
6740 relatedPlayer = playerNew;
6741
6742 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6743 {
6745 if (actionMgr)
6746 {
6747 ActionBase currentAction = actionMgr.GetRunningAction();
6748 if (currentAction)
6750 }
6751 }
6752
6753 Man ownerPlayerOld = null;
6754 Man ownerPlayerNew = null;
6755
6756 if (old_owner)
6757 {
6758 if (old_owner.
IsMan())
6759 {
6760 ownerPlayerOld = Man.Cast(old_owner);
6761 }
6762 else
6763 {
6764 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6765 }
6766 }
6767 else
6768 {
6770 {
6772
6773 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6774 {
6775 GetCompEM().UnplugThis();
6776 }
6777 }
6778 }
6779
6780 if (new_owner)
6781 {
6782 if (new_owner.
IsMan())
6783 {
6784 ownerPlayerNew = Man.Cast(new_owner);
6785 }
6786 else
6787 {
6788 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6789 }
6790 }
6791
6792 if (ownerPlayerOld != ownerPlayerNew)
6793 {
6794 if (ownerPlayerOld)
6795 {
6796 array<EntityAI> subItemsExit = new array<EntityAI>;
6798 for (int i = 0; i < subItemsExit.Count(); i++)
6799 {
6802 }
6803 }
6804
6805 if (ownerPlayerNew)
6806 {
6807 array<EntityAI> subItemsEnter = new array<EntityAI>;
6809 for (int j = 0; j < subItemsEnter.Count(); j++)
6810 {
6813 }
6814 }
6815 }
6816 else if (ownerPlayerNew != null)
6817 {
6818 PlayerBase nplayer;
6819 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6820 {
6821 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6823 for (int k = 0; k < subItemsUpdate.Count(); k++)
6824 {
6826 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6827 }
6828 }
6829 }
6830
6831 if (old_owner)
6832 old_owner.OnChildItemRemoved(this);
6833 if (new_owner)
6834 new_owner.OnChildItemReceived(this);
6835 }
6836
6837
6839 {
6840 super.EEDelete(parent);
6841 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6842 if (player)
6843 {
6845
6846 if (player.IsAlive())
6847 {
6848 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6849 if (r_index >= 0)
6850 {
6851 InventoryLocation r_il = new InventoryLocation;
6852 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6853
6854 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6857 {
6858 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6859 }
6861 {
6862 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6863 }
6864
6865 }
6866
6867 player.RemoveQuickBarEntityShortcut(this);
6868 }
6869 }
6870 }
6871
6873 {
6874 super.EEKilled(killer);
6875
6878 {
6879 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6880 {
6881 if (IsMagazine())
6882 {
6883 if (Magazine.Cast(this).GetAmmoCount() > 0)
6884 {
6886 }
6887 }
6888 else
6889 {
6891 }
6892 }
6893 }
6894 }
6895
6897 {
6898 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6899
6900 super.OnWasAttached(parent, slot_id);
6901
6904
6907 }
6908
6910 {
6911 super.OnWasDetached(parent, slot_id);
6912
6915
6918 }
6919
6921 {
6922 int idx;
6925
6926 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6927 if (inventory_slots.Count() < 1)
6928 {
6929 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6930 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6931 }
6932 else
6933 {
6934 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6935 }
6936
6937 idx = inventory_slots.Find(slot);
6938 if (idx < 0)
6939 return "";
6940
6941 return attach_types.Get(idx);
6942 }
6943
6945 {
6946 int idx = -1;
6947 string slot;
6948
6951
6952 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6953 if (inventory_slots.Count() < 1)
6954 {
6955 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6956 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6957 }
6958 else
6959 {
6960 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6961 if (detach_types.Count() < 1)
6962 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6963 }
6964
6965 for (int i = 0; i < inventory_slots.Count(); i++)
6966 {
6967 slot = inventory_slots.Get(i);
6968 }
6969
6970 if (slot != "")
6971 {
6972 if (detach_types.Count() == 1)
6973 idx = 0;
6974 else
6975 idx = inventory_slots.Find(slot);
6976 }
6977 if (idx < 0)
6978 return "";
6979
6980 return detach_types.Get(idx);
6981 }
6982
6984 {
6985
6987
6988
6989 float min_time = 1;
6990 float max_time = 3;
6991 float delay = Math.RandomFloat(min_time, max_time);
6992
6993 explode_timer.Run(delay, this, "DoAmmoExplosion");
6994 }
6995
6997 {
6998 Magazine magazine = Magazine.Cast(this);
6999 int pop_sounds_count = 6;
7000 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7001
7002
7003 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7004 string sound_name = pop_sounds[ sound_idx ];
7005 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7006
7007
7008 magazine.ServerAddAmmoCount(-1);
7009
7010
7011 float min_temp_to_explode = 100;
7012
7013 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7014 {
7016 }
7017 }
7018
7019
7020 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7021 {
7022 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7023
7024 const int CHANCE_DAMAGE_CARGO = 4;
7025 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7026 const int CHANCE_DAMAGE_NOTHING = 2;
7027
7029 {
7030 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7031 int chances;
7032 int rnd;
7033
7034 if (GetInventory().GetCargo())
7035 {
7036 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7037 rnd = Math.RandomInt(0,chances);
7038
7039 if (rnd < CHANCE_DAMAGE_CARGO)
7040 {
7042 }
7043 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7044 {
7046 }
7047 }
7048 else
7049 {
7050 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7051 rnd = Math.RandomInt(0,chances);
7052
7053 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7054 {
7056 }
7057 }
7058 }
7059 }
7060
7062 {
7063 CargoBase cargo = GetInventory().GetCargo();
7064 if (cargo)
7065 {
7067 if (item_count > 0)
7068 {
7069 int random_pick = Math.RandomInt(0, item_count);
7071 if (!item.IsExplosive())
7072 {
7073 item.AddHealth("","",damage);
7074 return true;
7075 }
7076 }
7077 }
7078 return false;
7079 }
7080
7082 {
7083 GameInventory inventory = GetInventory();
7085 if (attachment_count > 0)
7086 {
7087 int random_pick = Math.RandomInt(0, attachment_count);
7089 if (!attachment.IsExplosive())
7090 {
7091 attachment.AddHealth("","",damage);
7092 return true;
7093 }
7094 }
7095 return false;
7096 }
7097
7099 {
7101 }
7102
7104 {
7106 return GetInventory().CanRemoveEntity();
7107
7108 return false;
7109 }
7110
7112 {
7113
7115 return false;
7116
7117
7119 return false;
7120
7121
7122
7124 if (delta == 0)
7125 return false;
7126
7127
7128 return true;
7129 }
7130
7132 {
7134 {
7135 if (ScriptInputUserData.CanStoreInputUserData())
7136 {
7137 ScriptInputUserData ctx = new ScriptInputUserData;
7142 ctx.
Write(destination_entity);
7146 }
7147 }
7148 else if (!
g_Game.IsMultiplayer())
7149 {
7151 }
7152 }
7153
7155 {
7156 float split_quantity_new;
7160 InventoryLocation loc = new InventoryLocation;
7161
7162 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7163 {
7165 split_quantity_new = stack_max;
7166 else
7168
7170 {
7171 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7172 if (new_item)
7173 {
7174 new_item.SetResultOfSplit(true);
7175 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7177 new_item.
SetQuantity(split_quantity_new,
false,
true);
7178 }
7179 }
7180 }
7181 else if (destination_entity && slot_id == -1)
7182 {
7183 if (quantity > stack_max)
7184 split_quantity_new = stack_max;
7185 else
7186 split_quantity_new = quantity;
7187
7189 {
7190 GameInventory destinationInventory = destination_entity.GetInventory();
7192 {
7195 }
7196
7197 if (new_item)
7198 {
7199 new_item.SetResultOfSplit(true);
7200 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7202 new_item.
SetQuantity(split_quantity_new,
false,
true);
7203 }
7204 }
7205 }
7206 else
7207 {
7208 if (stack_max != 0)
7209 {
7211 {
7213 }
7214
7215 if (split_quantity_new == 0)
7216 {
7217 if (!
g_Game.IsMultiplayer())
7218 player.PhysicalPredictiveDropItem(this);
7219 else
7220 player.ServerDropEntity(this);
7221 return;
7222 }
7223
7225 {
7227
7228 if (new_item)
7229 {
7230 new_item.SetResultOfSplit(true);
7231 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7234 new_item.PlaceOnSurface();
7235 }
7236 }
7237 }
7238 }
7239 }
7240
7242 {
7243 float split_quantity_new;
7247 InventoryLocation loc = new InventoryLocation;
7248
7249 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7250 {
7252 split_quantity_new = stack_max;
7253 else
7255
7257 {
7258 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7259 if (new_item)
7260 {
7261 new_item.SetResultOfSplit(true);
7262 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7264 new_item.
SetQuantity(split_quantity_new,
false,
true);
7265 }
7266 }
7267 }
7268 else if (destination_entity && slot_id == -1)
7269 {
7270 if (quantity > stack_max)
7271 split_quantity_new = stack_max;
7272 else
7273 split_quantity_new = quantity;
7274
7276 {
7277 GameInventory destinationInventory = destination_entity.GetInventory();
7279 {
7282 }
7283
7284 if (new_item)
7285 {
7286 new_item.SetResultOfSplit(true);
7287 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7289 new_item.
SetQuantity(split_quantity_new,
false,
true);
7290 }
7291 }
7292 }
7293 else
7294 {
7295 if (stack_max != 0)
7296 {
7298 {
7300 }
7301
7303 {
7305
7306 if (new_item)
7307 {
7308 new_item.SetResultOfSplit(true);
7309 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7312 new_item.PlaceOnSurface();
7313 }
7314 }
7315 }
7316 }
7317 }
7318
7320 {
7322 {
7323 if (ScriptInputUserData.CanStoreInputUserData())
7324 {
7325 ScriptInputUserData ctx = new ScriptInputUserData;
7330 dst.WriteToContext(ctx);
7332 }
7333 }
7334 else if (!
g_Game.IsMultiplayer())
7335 {
7337 }
7338 }
7339
7341 {
7343 {
7344 if (ScriptInputUserData.CanStoreInputUserData())
7345 {
7346 ScriptInputUserData ctx = new ScriptInputUserData;
7351 ctx.
Write(destination_entity);
7357 }
7358 }
7359 else if (!
g_Game.IsMultiplayer())
7360 {
7362 }
7363 }
7364
7366 {
7368 }
7369
7371 {
7373 float split_quantity_new;
7375 if (dst.IsValid())
7376 {
7377 int slot_id = dst.GetSlot();
7379
7380 if (quantity > stack_max)
7381 split_quantity_new = stack_max;
7382 else
7383 split_quantity_new = quantity;
7384
7386 {
7388
7389 if (new_item)
7390 {
7391 new_item.SetResultOfSplit(true);
7392 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7394 new_item.
SetQuantity(split_quantity_new,
false,
true);
7395 }
7396
7397 return new_item;
7398 }
7399 }
7400
7401 return null;
7402 }
7403
7405 {
7407 float split_quantity_new;
7409 if (destination_entity)
7410 {
7412 if (quantity > stackable)
7413 split_quantity_new = stackable;
7414 else
7415 split_quantity_new = quantity;
7416
7418 {
7419 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7420 if (new_item)
7421 {
7422 new_item.SetResultOfSplit(true);
7423 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7425 new_item.
SetQuantity(split_quantity_new,
false,
true);
7426 }
7427 }
7428 }
7429 }
7430
7432 {
7434 {
7435 if (ScriptInputUserData.CanStoreInputUserData())
7436 {
7437 ScriptInputUserData ctx = new ScriptInputUserData;
7442 ItemBase destination_entity =
this;
7443 ctx.
Write(destination_entity);
7447 }
7448 }
7449 else if (!
g_Game.IsMultiplayer())
7450 {
7452 }
7453 }
7454
7456 {
7458 float split_quantity_new;
7460 if (player)
7461 {
7463 if (quantity > stackable)
7464 split_quantity_new = stackable;
7465 else
7466 split_quantity_new = quantity;
7467
7469 {
7470 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7471 new_item =
ItemBase.Cast(in_hands);
7472 if (new_item)
7473 {
7474 new_item.SetResultOfSplit(true);
7475 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7477 new_item.SetQuantity(split_quantity_new, false, true);
7478 }
7479 }
7480 }
7481 }
7482
7484 {
7486 float split_quantity_new = Math.Floor(quantity * 0.5);
7487
7489 return;
7490
7492
7493 if (new_item)
7494 {
7495 if (new_item.GetQuantityMax() < split_quantity_new)
7496 {
7497 split_quantity_new = new_item.GetQuantityMax();
7498 }
7499
7500 new_item.SetResultOfSplit(true);
7501 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7502
7504 {
7507 }
7508 else
7509 {
7511 new_item.
SetQuantity(split_quantity_new,
false,
true);
7512 }
7513 }
7514 }
7515
7517 {
7519 float split_quantity_new = Math.Floor(quantity / 2);
7520
7522 return;
7523
7524 InventoryLocation invloc = new InventoryLocation;
7526
7528 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7529
7530 if (new_item)
7531 {
7532 if (new_item.GetQuantityMax() < split_quantity_new)
7533 {
7534 split_quantity_new = new_item.GetQuantityMax();
7535 }
7537 {
7540 }
7541 else if (split_quantity_new > 1)
7542 {
7544 new_item.
SetQuantity(split_quantity_new,
false,
true);
7545 }
7546 }
7547 }
7548
7551 {
7552 SetWeightDirty();
7554
7555 if (parent)
7556 parent.OnAttachmentQuantityChangedEx(this, delta);
7557
7559 {
7561 {
7563 }
7565 {
7566 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7568 }
7569 }
7570 }
7571
7574 {
7575
7576 }
7577
7580 {
7582 }
7583
7585 {
7586 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7587
7589 {
7590 if (newLevel == GameConstants.STATE_RUINED)
7591 {
7593 EntityAI parent = GetHierarchyParent();
7594 if (parent && parent.IsFireplace())
7595 {
7596 CargoBase cargo = GetInventory().GetCargo();
7597 if (cargo)
7598 {
7600 {
7602 }
7603 }
7604 }
7605 }
7606
7608 {
7609
7611 return;
7612 }
7613
7614 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7615 {
7617 }
7618 }
7619 }
7620
7621
7623 {
7624 super.OnRightClick();
7625
7627 {
7629 {
7630 if (ScriptInputUserData.CanStoreInputUserData())
7631 {
7632 EntityAI root = GetHierarchyRoot();
7633 Man playerOwner = GetHierarchyRootPlayer();
7634 InventoryLocation dst = new InventoryLocation;
7635
7636
7637 if (!playerOwner && root && root == this)
7638 {
7640 }
7641 else
7642 {
7643
7644 GetInventory().GetCurrentInventoryLocation(dst);
7646 {
7647 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7649 {
7651 }
7652 else
7653 {
7655
7656
7657 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7658 {
7660 }
7661 else
7662 {
7663 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7664 }
7665 }
7666 }
7667 }
7668
7669 ScriptInputUserData ctx = new ScriptInputUserData;
7677 }
7678 }
7679 else if (!
g_Game.IsMultiplayer())
7680 {
7682 }
7683 }
7684 }
7685
7687 {
7688 if (root)
7689 {
7690 vector m4[4];
7691 root.GetTransform(m4);
7692 dst.SetGround(this, m4);
7693 }
7694 else
7695 {
7696 GetInventory().GetCurrentInventoryLocation(dst);
7697 }
7698 }
7699
7700 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7701 {
7702
7703 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7704 return false;
7705
7706 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7707 return false;
7708
7709
7711 return false;
7712
7713
7714 Magazine mag = Magazine.Cast(this);
7715 if (mag)
7716 {
7717 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7718 return false;
7719
7720 if (stack_max_limit)
7721 {
7722 Magazine other_mag = Magazine.Cast(other_item);
7723 if (other_item)
7724 {
7725 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7726 return false;
7727 }
7728
7729 }
7730 }
7731 else
7732 {
7733
7735 return false;
7736
7738 return false;
7739 }
7740
7741 PlayerBase player = null;
7742 if (CastTo(player, GetHierarchyRootPlayer()))
7743 {
7744 if (player.GetInventory().HasAttachment(this))
7745 return false;
7746
7747 if (player.IsItemsToDelete())
7748 return false;
7749 }
7750
7751 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7752 return false;
7753
7754 int slotID;
7756 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7757 return false;
7758
7759 return true;
7760 }
7761
7763 {
7765 }
7766
7768 {
7769 return m_IsResultOfSplit;
7770 }
7771
7773 {
7774 m_IsResultOfSplit = value;
7775 }
7776
7778 {
7780 }
7781
7783 {
7784 float other_item_quantity = other_item.GetQuantity();
7785 float this_free_space;
7786
7788
7790
7791 if (other_item_quantity > this_free_space)
7792 {
7793 return this_free_space;
7794 }
7795 else
7796 {
7797 return other_item_quantity;
7798 }
7799 }
7800
7802 {
7804 }
7805
7807 {
7809 return;
7810
7811 if (!IsMagazine() && other_item)
7812 {
7814 if (quantity_used != 0)
7815 {
7816 float hp1 = GetHealth01("","");
7817 float hp2 = other_item.GetHealth01("","");
7818 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7819 hpResult = hpResult / (
GetQuantity() + quantity_used);
7820
7821 hpResult *= GetMaxHealth();
7822 Math.Round(hpResult);
7823 SetHealth("", "Health", hpResult);
7824
7826 other_item.AddQuantity(-quantity_used);
7827 }
7828 }
7830 }
7831
7833 {
7834 #ifdef SERVER
7835 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7836 GetHierarchyParent().IncreaseLifetimeUp();
7837 #endif
7838 };
7839
7841 {
7842 PlayerBase p = PlayerBase.Cast(player);
7843
7844 array<int> recipesIds = p.m_Recipes;
7845 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7846 if (moduleRecipesManager)
7847 {
7848 EntityAI itemInHands = player.GetEntityInHands();
7849 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7850 }
7851
7852 for (int i = 0;i < recipesIds.Count(); i++)
7853 {
7854 int key = recipesIds.Get(i);
7855 string recipeName = moduleRecipesManager.GetRecipeName(key);
7857 }
7858 }
7859
7860
7861 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7862 {
7863 super.GetDebugActions(outputList);
7864
7865
7871
7872
7877
7882
7883
7887
7888
7890 {
7894 }
7895
7898
7899
7903
7905
7906 InventoryLocation loc = new InventoryLocation();
7907 GetInventory().GetCurrentInventoryLocation(loc);
7909 {
7910 if (Gizmo_IsSupported())
7913 }
7914
7916 }
7917
7918
7919
7920
7922 {
7923 super.OnAction(action_id, player, ctx);
7924
7926 {
7927 switch (action_id)
7928 {
7932 return true;
7936 return true;
7937 }
7938 }
7939
7941 {
7942 switch (action_id)
7943 {
7945 Delete();
7946 return true;
7947 }
7948 }
7949
7950 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7951 {
7952 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7953 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7954 PlayerBase p = PlayerBase.Cast(player);
7955 if (
EActions.RECIPES_RANGE_START < 1000)
7956 {
7957 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7958 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7959 }
7960 }
7961 #ifndef SERVER
7962 else if (action_id ==
EActions.WATCH_PLAYER)
7963 {
7964 PluginDeveloper.SetDeveloperItemClientEx(player);
7965 }
7966 #endif
7968 {
7969 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7970 {
7971 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7972 OnDebugButtonPressServer(id + 1);
7973 }
7974
7975 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7976 {
7977 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7979 }
7980
7981 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7982 {
7983 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7985 }
7986
7987 else if (action_id ==
EActions.ADD_QUANTITY)
7988 {
7989 if (IsMagazine())
7990 {
7991 Magazine mag = Magazine.Cast(this);
7992 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7993 }
7994 else
7995 {
7997 }
7998
7999 if (m_EM)
8000 {
8001 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8002 }
8003
8004 }
8005
8006 else if (action_id ==
EActions.REMOVE_QUANTITY)
8007 {
8008 if (IsMagazine())
8009 {
8010 Magazine mag2 = Magazine.Cast(this);
8011 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8012 }
8013 else
8014 {
8016 }
8017 if (m_EM)
8018 {
8019 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8020 }
8021
8022 }
8023
8024 else if (action_id ==
EActions.SET_QUANTITY_0)
8025 {
8027
8028 if (m_EM)
8029 {
8030 m_EM.SetEnergy(0);
8031 }
8032 }
8033
8034 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8035 {
8037
8038 if (m_EM)
8039 {
8040 m_EM.SetEnergy(m_EM.GetEnergyMax());
8041 }
8042 }
8043
8044 else if (action_id ==
EActions.ADD_HEALTH)
8045 {
8046 AddHealth("","",GetMaxHealth("","Health")/5);
8047 }
8048 else if (action_id ==
EActions.REMOVE_HEALTH)
8049 {
8050 AddHealth("","",-GetMaxHealth("","Health")/5);
8051 }
8052 else if (action_id ==
EActions.DESTROY_HEALTH)
8053 {
8054 SetHealth01("","",0);
8055 }
8056 else if (action_id ==
EActions.WATCH_ITEM)
8057 {
8059 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8060 #ifdef DEVELOPER
8061 SetDebugDeveloper_item(this);
8062 #endif
8063 }
8064
8065 else if (action_id ==
EActions.ADD_TEMPERATURE)
8066 {
8067 AddTemperature(20);
8068
8069 }
8070
8071 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8072 {
8073 AddTemperature(-20);
8074
8075 }
8076
8077 else if (action_id ==
EActions.FLIP_FROZEN)
8078 {
8079 SetFrozen(!GetIsFrozen());
8080
8081 }
8082
8083 else if (action_id ==
EActions.ADD_WETNESS)
8084 {
8086
8087 }
8088
8089 else if (action_id ==
EActions.REMOVE_WETNESS)
8090 {
8092
8093 }
8094
8095 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8096 {
8099
8100
8101 }
8102
8103 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8104 {
8107 }
8108
8109 else if (action_id ==
EActions.MAKE_SPECIAL)
8110 {
8111 auto debugParams = DebugSpawnParams.WithPlayer(player);
8112 OnDebugSpawnEx(debugParams);
8113 }
8114
8115 }
8116
8117
8118 return false;
8119 }
8120
8121
8122
8123
8127
8130
8131
8132
8134 {
8135 return false;
8136 }
8137
8138
8140 {
8141 return true;
8142 }
8143
8144
8146 {
8147 return true;
8148 }
8149
8150
8151
8153 {
8154 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8155 return g_Game.ConfigIsExisting(config_path);
8156 }
8157
8160 {
8161 return null;
8162 }
8163
8165 {
8166 return false;
8167 }
8168
8170 {
8171 return false;
8172 }
8173
8177
8178
8180 {
8181 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8182 return module_repairing.CanRepair(this, item_repair_kit);
8183 }
8184
8185
8186 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8187 {
8188 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8189 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8190 }
8191
8192
8194 {
8195
8196
8197
8198
8199
8200
8201
8202
8203 return 1;
8204 }
8205
8206
8207
8209 {
8211 }
8212
8213
8214
8216 {
8218 }
8219
8220
8229 {
8230 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8231
8232 if (player)
8233 {
8234 player.MessageStatus(text);
8235 }
8236 }
8237
8238
8247 {
8248 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8249
8250 if (player)
8251 {
8252 player.MessageAction(text);
8253 }
8254 }
8255
8256
8265 {
8266 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8267
8268 if (player)
8269 {
8270 player.MessageFriendly(text);
8271 }
8272 }
8273
8274
8283 {
8284 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8285
8286 if (player)
8287 {
8288 player.MessageImportant(text);
8289 }
8290 }
8291
8293 {
8294 return true;
8295 }
8296
8297
8298 override bool KindOf(
string tag)
8299 {
8300 bool found = false;
8301 string item_name = this.
GetType();
8303 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8304
8305 int array_size = item_tag_array.Count();
8306 for (int i = 0; i < array_size; i++)
8307 {
8308 if (item_tag_array.Get(i) == tag)
8309 {
8310 found = true;
8311 break;
8312 }
8313 }
8314 return found;
8315 }
8316
8317
8319 {
8320
8321 super.OnRPC(sender, rpc_type,ctx);
8322
8323
8324 switch (rpc_type)
8325 {
8326 #ifndef SERVER
8327 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8328 Param2<bool, string> p = new Param2<bool, string>(false, "");
8329
8331 return;
8332
8333 bool play = p.param1;
8334 string soundSet = p.param2;
8335
8336 if (play)
8337 {
8339 {
8341 {
8343 }
8344 }
8345 else
8346 {
8348 }
8349 }
8350 else
8351 {
8353 }
8354
8355 break;
8356 #endif
8357
8358 }
8359
8361 {
8363 }
8364 }
8365
8366
8367
8368
8370 {
8371 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8372 return plugin.GetID(
name);
8373 }
8374
8376 {
8377 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8378 return plugin.GetName(id);
8379 }
8380
8383 {
8384
8385
8386 int varFlags;
8387 if (!ctx.
Read(varFlags))
8388 return;
8389
8390 if (varFlags & ItemVariableFlags.FLOAT)
8391 {
8393 }
8394 }
8395
8397 {
8398
8399 super.SerializeNumericalVars(floats_out);
8400
8401
8402
8404 {
8406 }
8407
8409 {
8411 }
8412
8414 {
8416 }
8417
8419 {
8424 }
8425
8427 {
8429 }
8430 }
8431
8433 {
8434
8435 super.DeSerializeNumericalVars(floats);
8436
8437
8438 int index = 0;
8439 int mask = Math.Round(floats.Get(index));
8440
8441 index++;
8442
8444 {
8446 {
8448 }
8449 else
8450 {
8451 float quantity = floats.Get(index);
8453 }
8454 index++;
8455 }
8456
8458 {
8459 float wet = floats.Get(index);
8461 index++;
8462 }
8463
8465 {
8466 int liquidtype = Math.Round(floats.Get(index));
8468 index++;
8469 }
8470
8472 {
8474 index++;
8476 index++;
8478 index++;
8480 index++;
8481 }
8482
8484 {
8485 int cleanness = Math.Round(floats.Get(index));
8487 index++;
8488 }
8489 }
8490
8492 {
8493 super.WriteVarsToCTX(ctx);
8494
8495
8497 {
8499 }
8500
8502 {
8504 }
8505
8507 {
8509 }
8510
8512 {
8513 int r,g,b,a;
8519 }
8520
8522 {
8524 }
8525 }
8526
8528 {
8529 if (!super.ReadVarsFromCTX(ctx,version))
8530 return false;
8531
8532 int intValue;
8533 float value;
8534
8535 if (version < 140)
8536 {
8537 if (!ctx.
Read(intValue))
8538 return false;
8539
8540 m_VariablesMask = intValue;
8541 }
8542
8544 {
8545 if (!ctx.
Read(value))
8546 return false;
8547
8549 {
8551 }
8552 else
8553 {
8555 }
8556 }
8557
8558 if (version < 140)
8559 {
8561 {
8562 if (!ctx.
Read(value))
8563 return false;
8564 SetTemperatureDirect(value);
8565 }
8566 }
8567
8569 {
8570 if (!ctx.
Read(value))
8571 return false;
8573 }
8574
8576 {
8577 if (!ctx.
Read(intValue))
8578 return false;
8580 }
8581
8583 {
8584 int r,g,b,a;
8586 return false;
8588 return false;
8590 return false;
8592 return false;
8593
8595 }
8596
8598 {
8599 if (!ctx.
Read(intValue))
8600 return false;
8602 }
8603
8604 if (version >= 138 && version < 140)
8605 {
8607 {
8608 if (!ctx.
Read(intValue))
8609 return false;
8610 SetFrozen(intValue);
8611 }
8612 }
8613
8614 return true;
8615 }
8616
8617
8619 {
8622 {
8624 }
8625
8626 if (!super.OnStoreLoad(ctx, version))
8627 {
8629 return false;
8630 }
8631
8632 if (version >= 114)
8633 {
8634 bool hasQuickBarIndexSaved;
8635
8636 if (!ctx.
Read(hasQuickBarIndexSaved))
8637 {
8639 return false;
8640 }
8641
8642 if (hasQuickBarIndexSaved)
8643 {
8644 int itmQBIndex;
8645
8646
8647 if (!ctx.
Read(itmQBIndex))
8648 {
8650 return false;
8651 }
8652
8653 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8654 if (itmQBIndex != -1 && parentPlayer)
8655 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8656 }
8657 }
8658 else
8659 {
8660
8661 PlayerBase player;
8662 int itemQBIndex;
8663 if (version ==
int.
MAX)
8664 {
8665 if (!ctx.
Read(itemQBIndex))
8666 {
8668 return false;
8669 }
8670 }
8671 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8672 {
8673
8674 if (!ctx.
Read(itemQBIndex))
8675 {
8677 return false;
8678 }
8679 if (itemQBIndex != -1 && player)
8680 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8681 }
8682 }
8683
8684 if (version < 140)
8685 {
8686
8687 if (!LoadVariables(ctx, version))
8688 {
8690 return false;
8691 }
8692 }
8693
8694
8696 {
8698 return false;
8699 }
8700 if (version >= 132)
8701 {
8703 if (raib)
8704 {
8706 {
8708 return false;
8709 }
8710 }
8711 }
8712
8714 return true;
8715 }
8716
8717
8718
8720 {
8721 super.OnStoreSave(ctx);
8722
8723 PlayerBase player;
8724 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8725 {
8727
8728 int itemQBIndex = -1;
8729 itemQBIndex = player.FindQuickBarEntityIndex(this);
8730 ctx.
Write(itemQBIndex);
8731 }
8732 else
8733 {
8735 }
8736
8738
8740 if (raib)
8741 {
8743 }
8744 }
8745
8746
8748 {
8749 super.AfterStoreLoad();
8750
8752 {
8754 }
8755
8757 {
8760 }
8761 }
8762
8764 {
8765 super.EEOnAfterLoad();
8766
8768 {
8770 }
8771
8774 }
8775
8777 {
8778 return false;
8779 }
8780
8781
8782
8784 {
8786 {
8787 #ifdef PLATFORM_CONSOLE
8788
8790 {
8792 if (menu)
8793 {
8795 }
8796 }
8797 #endif
8798 }
8799
8801 {
8804 }
8805
8807 {
8808 SetWeightDirty();
8810 }
8812 {
8815 }
8816
8818 {
8821
8824 }
8826 {
8830 }
8831
8832 super.OnVariablesSynchronized();
8833 }
8834
8835
8836
8838 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8839 {
8840 if (!IsServerCheck(allow_client))
8841 return false;
8842
8844 return false;
8845
8848
8849 if (value <= (min + 0.001))
8850 value = min;
8851
8852 if (value == min)
8853 {
8854 if (destroy_config)
8855 {
8856 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8857 if (dstr)
8858 {
8860 this.Delete();
8861 return true;
8862 }
8863 }
8864 else if (destroy_forced)
8865 {
8867 this.Delete();
8868 return true;
8869 }
8870
8872 }
8873
8876
8878 {
8879 EntityAI parent = GetHierarchyRoot();
8880 InventoryLocation iLoc = new InventoryLocation();
8881 GetInventory().GetCurrentInventoryLocation(iLoc);
8883 {
8884 int iLocSlot = iLoc.
GetSlot();
8886 {
8888 }
8890 {
8892 }
8893 }
8894 }
8895
8897 {
8899
8900 if (delta)
8902 }
8903
8905
8906 return false;
8907 }
8908
8909
8911 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8912 {
8914 }
8915
8917 {
8920 }
8921
8923 {
8926 }
8927
8929 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8930 {
8931 float value_clamped = Math.Clamp(value, 0, 1);
8933 SetQuantity(result, destroy_config, destroy_forced);
8934 }
8935
8936
8939 {
8941 }
8942
8944 {
8946 }
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8958 {
8959 int slot = -1;
8960 GameInventory inventory = GetInventory();
8961 if (inventory)
8962 {
8963 InventoryLocation il = new InventoryLocation;
8966 }
8967
8969 }
8970
8972 {
8973 float quantity_max = 0;
8974
8976 {
8977 if (attSlotID != -1)
8978 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8979
8980 if (quantity_max <= 0)
8982 }
8983
8984 if (quantity_max <= 0)
8986
8987 return quantity_max;
8988 }
8989
8991 {
8993 }
8994
8996 {
8998 }
8999
9000
9002 {
9004 }
9005
9007 {
9009 }
9010
9012 {
9014 }
9015
9016
9018 {
9019
9020 float weightEx = GetWeightEx();
9021 float special = GetInventoryAndCargoWeight();
9022 return weightEx - special;
9023 }
9024
9025
9027 {
9029 }
9030
9032 {
9034 {
9035 #ifdef DEVELOPER
9036 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9037 {
9038 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9040 }
9041 #endif
9042
9044 }
9045 else if (HasEnergyManager())
9046 {
9047 #ifdef DEVELOPER
9048 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9049 {
9050 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9051 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9052 }
9053 #endif
9054 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9055 }
9056 else
9057 {
9058 #ifdef DEVELOPER
9059 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9060 {
9061 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9062 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9063 }
9064 #endif
9065 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9066 }
9067 }
9068
9071 {
9072 int item_count = 0;
9074
9075 GameInventory inventory = GetInventory();
9076 CargoBase cargo = inventory.
GetCargo();
9077 if (cargo != NULL)
9078 {
9080 }
9081
9083 for (int i = 0; i < nAttachments; ++i)
9084 {
9086 if (item)
9087 item_count += item.GetNumberOfItems();
9088 }
9089 return item_count;
9090 }
9091
9094 {
9095 float weight = 0;
9096 float wetness = 1;
9097 if (include_wetness)
9100 {
9101 weight = wetness * m_ConfigWeight;
9102 }
9104 {
9105 weight = 1;
9106 }
9107 return weight;
9108 }
9109
9110
9111
9113 {
9114 GameInventory inventory = GetInventory();
9115 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9116 {
9117 array<EntityAI> items = new array<EntityAI>;
9119 for (int i = 0; i < items.Count(); ++i)
9120 {
9122 if (item)
9123 {
9124 g_Game.ObjectDelete(item);
9125 }
9126 }
9127 }
9128 }
9129
9130
9131
9132
9134 {
9135 float energy = 0;
9136 if (HasEnergyManager())
9137 {
9138 energy = GetCompEM().GetEnergy();
9139 }
9140 return energy;
9141 }
9142
9143
9145 {
9146 super.OnEnergyConsumed();
9147
9149 }
9150
9152 {
9153 super.OnEnergyAdded();
9154
9156 }
9157
9158
9160 {
9161 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9162 {
9164 {
9165 float energy_0to1 = GetCompEM().GetEnergy0To1();
9167 }
9168 }
9169 }
9170
9171
9173 {
9174 return ConfigGetFloat("heatIsolation");
9175 }
9176
9178 {
9180 }
9181
9183 {
9184 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9185 if (
g_Game.ConfigIsExisting(paramPath))
9186 return g_Game.ConfigGetFloat(paramPath);
9187
9188 return 0.0;
9189 }
9190
9192 {
9193 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9194 if (
g_Game.ConfigIsExisting(paramPath))
9195 return g_Game.ConfigGetFloat(paramPath);
9196
9197 return 0.0;
9198 }
9199
9200 override void SetWet(
float value,
bool allow_client =
false)
9201 {
9202 if (!IsServerCheck(allow_client))
9203 return;
9204
9207
9209
9210 m_VarWet = Math.Clamp(value, min, max);
9211
9213 {
9216 }
9217 }
9218
9219 override void AddWet(
float value)
9220 {
9222 }
9223
9225 {
9227 }
9228
9230 {
9232 }
9233
9235 {
9237 }
9238
9240 {
9242 }
9243
9245 {
9247 }
9248
9250 {
9253 if (newLevel != oldLevel)
9254 {
9256 }
9257 }
9258
9260 {
9261 SetWeightDirty();
9262 }
9263
9265 {
9266 return GetWetLevelInternal(
m_VarWet);
9267 }
9268
9269
9270
9272 {
9274 }
9275
9277 {
9279 }
9280
9282 {
9284 }
9285
9287 {
9289 }
9290
9291
9292
9294 {
9295 if (ConfigIsExisting("itemModelLength"))
9296 {
9297 return ConfigGetFloat("itemModelLength");
9298 }
9299 return 0;
9300 }
9301
9303 {
9304 if (ConfigIsExisting("itemAttachOffset"))
9305 {
9306 return ConfigGetFloat("itemAttachOffset");
9307 }
9308 return 0;
9309 }
9310
9311 override void SetCleanness(
int value,
bool allow_client =
false)
9312 {
9313 if (!IsServerCheck(allow_client))
9314 return;
9315
9317
9319
9322 }
9323
9325 {
9327 }
9328
9330 {
9331 return true;
9332 }
9333
9334
9335
9336
9338 {
9340 }
9341
9343 {
9345 }
9346
9347
9348
9349
9350 override void SetColor(
int r,
int g,
int b,
int a)
9351 {
9357 }
9359 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9360 {
9365 }
9366
9368 {
9370 }
9371
9374 {
9375 int r,g,b,a;
9377 r = r/255;
9378 g = g/255;
9379 b = b/255;
9380 a = a/255;
9381 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9382 }
9383
9384
9385
9386 override void SetLiquidType(
int value,
bool allow_client =
false)
9387 {
9388 if (!IsServerCheck(allow_client))
9389 return;
9390
9395 }
9396
9398 {
9399 return ConfigGetInt("varLiquidTypeInit");
9400 }
9401
9403 {
9405 }
9406
9408 {
9410 SetFrozen(false);
9411 }
9412
9415 {
9416 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9417 }
9418
9419
9422 {
9423 PlayerBase nplayer;
9424 if (PlayerBase.CastTo(nplayer, player))
9425 {
9427 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9428 }
9429 }
9430
9431
9434 {
9435 PlayerBase nplayer;
9436 if (PlayerBase.CastTo(nplayer,player))
9437 {
9438 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9439 }
9440
9441 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9442
9443 if (HasEnergyManager())
9444 {
9445 GetCompEM().UpdatePlugState();
9446 }
9447 }
9448
9449
9451 {
9452 super.OnPlacementStarted(player);
9453
9455 }
9456
9457 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9458 {
9460 {
9461 m_AdminLog.OnPlacementComplete(player,
this);
9462 }
9463
9464 super.OnPlacementComplete(player, position, orientation);
9465 }
9466
9467
9468
9469
9470
9472 {
9474 {
9475 return true;
9476 }
9477 else
9478 {
9479 return false;
9480 }
9481 }
9482
9483
9485 {
9487 {
9489 }
9490 }
9491
9492
9494 {
9496 }
9497
9499 {
9501 }
9502
9503 override void InsertAgent(
int agent,
float count = 1)
9504 {
9505 if (count < 1)
9506 return;
9507
9509 }
9510
9513 {
9515 }
9516
9517
9519 {
9521 }
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9565 {
9567 return false;
9568 return true;
9569 }
9570
9572 {
9573
9575 }
9576
9577
9580 {
9581 super.CheckForRoofLimited(timeTresholdMS);
9582
9583 float time =
g_Game.GetTime();
9584 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9585 {
9586 m_PreviousRoofTestTime = time;
9587 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9588 }
9589 }
9590
9591
9593 {
9595 {
9596 return 0;
9597 }
9598
9599 if (GetInventory().GetAttachmentSlotsCount() != 0)
9600 {
9601 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9602 if (filter)
9603 return filter.GetProtectionLevel(type, false, system);
9604 else
9605 return 0;
9606 }
9607
9608 string subclassPath, entryName;
9609
9610 switch (type)
9611 {
9613 entryName = "biological";
9614 break;
9616 entryName = "chemical";
9617 break;
9618 default:
9619 entryName = "biological";
9620 break;
9621 }
9622
9623 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9624
9625 return g_Game.ConfigGetFloat(subclassPath + entryName);
9626 }
9627
9628
9629
9632 {
9633 if (!IsMagazine())
9635
9637 }
9638
9639
9640
9641
9642
9647 {
9648 return true;
9649 }
9650
9652 {
9654 }
9655
9656
9657
9658
9659
9661 {
9662 if (parent)
9663 {
9664 if (parent.IsInherited(DayZInfected))
9665 return true;
9666
9667 if (!parent.IsRuined())
9668 return true;
9669 }
9670
9671 return true;
9672 }
9673
9675 {
9676 if (!super.CanPutAsAttachment(parent))
9677 {
9678 return false;
9679 }
9680
9681 if (!IsRuined() && !parent.IsRuined())
9682 {
9683 return true;
9684 }
9685
9686 return false;
9687 }
9688
9690 {
9691
9692
9693
9694
9695 return super.CanReceiveItemIntoCargo(item);
9696 }
9697
9699 {
9700
9701
9702
9703
9704 GameInventory attachmentInv = attachment.GetInventory();
9706 {
9707 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9708 return false;
9709 }
9710
9711 InventoryLocation loc = new InventoryLocation();
9712 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9713 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9714 return false;
9715
9716 return super.CanReceiveAttachment(attachment, slotId);
9717 }
9718
9720 {
9721 if (!super.CanReleaseAttachment(attachment))
9722 return false;
9723
9724 return GetInventory().AreChildrenAccessible();
9725 }
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9748 {
9749 int id = muzzle_owner.GetMuzzleID();
9750 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9751
9752 if (WPOF_array)
9753 {
9754 for (int i = 0; i < WPOF_array.Count(); i++)
9755 {
9756 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9757
9758 if (WPOF)
9759 {
9760 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9761 }
9762 }
9763 }
9764 }
9765
9766
9768 {
9769 int id = muzzle_owner.GetMuzzleID();
9771
9772 if (WPOBE_array)
9773 {
9774 for (int i = 0; i < WPOBE_array.Count(); i++)
9775 {
9776 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9777
9778 if (WPOBE)
9779 {
9780 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9781 }
9782 }
9783 }
9784 }
9785
9786
9788 {
9789 int id = muzzle_owner.GetMuzzleID();
9790 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9791
9792 if (WPOOH_array)
9793 {
9794 for (int i = 0; i < WPOOH_array.Count(); i++)
9795 {
9796 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9797
9798 if (WPOOH)
9799 {
9800 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9801 }
9802 }
9803 }
9804 }
9805
9806
9808 {
9809 int id = muzzle_owner.GetMuzzleID();
9810 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9811
9812 if (WPOOH_array)
9813 {
9814 for (int i = 0; i < WPOOH_array.Count(); i++)
9815 {
9816 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9817
9818 if (WPOOH)
9819 {
9820 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9821 }
9822 }
9823 }
9824 }
9825
9826
9828 {
9829 int id = muzzle_owner.GetMuzzleID();
9830 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9831
9832 if (WPOOH_array)
9833 {
9834 for (int i = 0; i < WPOOH_array.Count(); i++)
9835 {
9836 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9837
9838 if (WPOOH)
9839 {
9840 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9841 }
9842 }
9843 }
9844 }
9845
9846
9847
9849 {
9851 {
9852 return true;
9853 }
9854
9855 return false;
9856 }
9857
9859 {
9861 {
9862 return true;
9863 }
9864
9865 return false;
9866 }
9867
9869 {
9871 {
9872 return true;
9873 }
9874
9875 return false;
9876 }
9877
9879 {
9880 return false;
9881 }
9882
9885 {
9886 return UATimeSpent.DEFAULT_DEPLOY;
9887 }
9888
9889
9890
9891
9893 {
9895 SetSynchDirty();
9896 }
9897
9899 {
9901 }
9902
9903
9905 {
9906 return false;
9907 }
9908
9911 {
9912 string att_type = "None";
9913
9914 if (ConfigIsExisting("soundAttType"))
9915 {
9916 att_type = ConfigGetString("soundAttType");
9917 }
9918
9920 }
9921
9923 {
9925 }
9926
9927
9928
9929
9930
9936
9938 {
9941
9943 }
9944
9945
9947 {
9949 return;
9950
9952
9955
9958
9959 SoundParameters params = new SoundParameters();
9963 }
9964
9965
9967 {
9969 {
9972
9973 SetSynchDirty();
9974
9977 }
9978 }
9979
9981 {
9983 }
9984
9985
9987 {
9989 return;
9990
9992 SetSynchDirty();
9993
9996 }
9997
9999 {
10002 }
10003
10005 {
10007 }
10008
10009 void OnApply(PlayerBase player);
10010
10012 {
10013 return 1.0;
10014 };
10015
10017 {
10019 }
10020
10022 {
10024 }
10025
10027
10029 {
10030 SetDynamicPhysicsLifeTime(0.01);
10032 }
10033
10035 {
10036 array<string> zone_names = new array<string>;
10037 GetDamageZones(zone_names);
10038 for (int i = 0; i < zone_names.Count(); i++)
10039 {
10040 SetHealthMax(zone_names.Get(i),"Health");
10041 }
10042 SetHealthMax("","Health");
10043 }
10044
10047 {
10048 float global_health = GetHealth01("","Health");
10049 array<string> zones = new array<string>;
10050 GetDamageZones(zones);
10051
10052 for (int i = 0; i < zones.Count(); i++)
10053 {
10054 SetHealth01(zones.Get(i),"Health",global_health);
10055 }
10056 }
10057
10060 {
10061 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10062 }
10063
10065 {
10066 if (!hasRootAsPlayer)
10067 {
10068 if (refParentIB)
10069 {
10070
10071 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10072 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10073
10074 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10075 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10076
10079 }
10080 else
10081 {
10082
10085 }
10086 }
10087 }
10088
10090 {
10092 {
10093 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10094 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10095 {
10096 float heatPermCoef = 1.0;
10098 while (ent)
10099 {
10100 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10101 ent = ent.GetHierarchyParent();
10102 }
10103
10104 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10105 }
10106 }
10107 }
10108
10110 {
10111
10112 EntityAI parent = GetHierarchyParent();
10113 if (!parent)
10114 {
10115 hasParent = false;
10116 hasRootAsPlayer = false;
10117 }
10118 else
10119 {
10120 hasParent = true;
10121 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10122 refParentIB =
ItemBase.Cast(parent);
10123 }
10124 }
10125
10126 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10127 {
10128
10129 }
10130
10132 {
10133
10134 return false;
10135 }
10136
10138 {
10139
10140
10141 return false;
10142 }
10143
10145 {
10146
10147 return false;
10148 }
10149
10152 {
10153 return !GetIsFrozen() &&
IsOpen();
10154 }
10155
10157 {
10158 bool hasParent = false, hasRootAsPlayer = false;
10160
10161 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10162 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10163
10164 if (wwtu || foodDecay)
10165 {
10169
10170 if (processWetness || processTemperature || processDecay)
10171 {
10173
10174 if (processWetness)
10175 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10176
10177 if (processTemperature)
10179
10180 if (processDecay)
10181 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10182 }
10183 }
10184 }
10185
10188 {
10190 }
10191
10193 {
10196
10197 return super.GetTemperatureFreezeThreshold();
10198 }
10199
10201 {
10204
10205 return super.GetTemperatureThawThreshold();
10206 }
10207
10209 {
10212
10213 return super.GetItemOverheatThreshold();
10214 }
10215
10217 {
10219 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10220
10221 return super.GetTemperatureFreezeTime();
10222 }
10223
10225 {
10227 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10228
10229 return super.GetTemperatureThawTime();
10230 }
10231
10236
10238 {
10239 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10240 }
10241
10243 {
10244 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10245 }
10246
10249 {
10251 }
10252
10254 {
10256 }
10257
10259 {
10261 }
10262
10265 {
10266 return null;
10267 }
10268
10271 {
10272 return false;
10273 }
10274
10276 {
10278 {
10281 if (!trg)
10282 {
10284 explosive = this;
10285 }
10286
10287 explosive.PairRemote(trg);
10289
10290 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10291 trg.SetPersistentPairID(persistentID);
10292 explosive.SetPersistentPairID(persistentID);
10293
10294 return true;
10295 }
10296 return false;
10297 }
10298
10301 {
10302 float ret = 1.0;
10305 ret *= GetHealth01();
10306
10307 return ret;
10308 }
10309
10310 #ifdef DEVELOPER
10311 override void SetDebugItem()
10312 {
10313 super.SetDebugItem();
10314 _itemBase = this;
10315 }
10316
10318 {
10319 string text = super.GetDebugText();
10320
10322 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10323
10324 return text;
10325 }
10326 #endif
10327
10329 {
10330 return true;
10331 }
10332
10334
10336
10338 {
10341 }
10342
10343
10351
10367
10368 [
Obsolete(
"Use ItemSoundHandler instead")]
10371 {
10372 if (!
g_Game.IsDedicatedServer())
10373 {
10374 if (ConfigIsExisting("attachSoundSet"))
10375 {
10376 string cfg_path = "";
10377 string soundset = "";
10378 string type_name =
GetType();
10379
10382 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10383 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10384
10385 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10386 {
10387 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10388 {
10389 if (cfg_slot_array[i] == slot_type)
10390 {
10391 soundset = cfg_soundset_array[i];
10392 break;
10393 }
10394 }
10395 }
10396
10397 if (soundset != "")
10398 {
10399 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10401 }
10402 }
10403 }
10404 }
10405
10407}
10408
10410{
10412 if (entity)
10413 {
10414 bool is_item = entity.IsInherited(
ItemBase);
10415 if (is_item && full_quantity)
10416 {
10419 }
10420 }
10421 else
10422 {
10424 return NULL;
10425 }
10426 return entity;
10427}
10428
10430{
10431 if (item)
10432 {
10433 if (health > 0)
10434 item.SetHealth("", "", health);
10435
10436 if (item.CanHaveTemperature())
10437 {
10439 if (item.CanFreeze())
10440 item.SetFrozen(false);
10441 }
10442
10443 if (item.HasEnergyManager())
10444 {
10445 if (quantity >= 0)
10446 {
10447 item.GetCompEM().SetEnergy0To1(quantity);
10448 }
10449 else
10450 {
10452 }
10453 }
10454 else if (item.IsMagazine())
10455 {
10456 Magazine mag = Magazine.Cast(item);
10457 if (quantity >= 0)
10458 {
10459 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10460 }
10461 else
10462 {
10464 }
10465
10466 }
10467 else
10468 {
10469 if (quantity >= 0)
10470 {
10471 item.SetQuantityNormalized(quantity, false);
10472 }
10473 else
10474 {
10476 }
10477
10478 }
10479 }
10480}
10481
10482#ifdef DEVELOPER
10484#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.