5467{
5469 {
5470 return true;
5471 }
5472};
5473
5475{
5476
5477};
5478
5479
5480
5482{
5486
5488
5491
5492
5493
5494
5495
5504
5510
5515
5520
5541 protected bool m_IsResultOfSplit
5542
5544
5549
5550
5551
5553
5557
5558
5559
5561
5564
5565
5566
5572
5573
5581
5584
5585
5587
5588
5590
5591
5596
5597
5602
5604
5605
5607
5608
5610 {
5615
5616 if (!
g_Game.IsDedicatedServer())
5617 {
5619 {
5621
5623 {
5625 }
5626 }
5627
5630 }
5631
5632 m_OldLocation = null;
5633
5635 {
5637 }
5638
5639 if (ConfigIsExisting("headSelectionsToHide"))
5640 {
5643 }
5644
5646 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5647 {
5649 }
5650
5652
5653 m_IsResultOfSplit = false;
5654
5656 }
5657
5659 {
5660 super.InitItemVariables();
5661
5667 m_Count = ConfigGetInt(
"count");
5668
5671
5676
5679
5684
5696
5700
5701
5704 if (ConfigIsExisting("canBeSplit"))
5705 {
5708 }
5709
5711 if (ConfigIsExisting("itemBehaviour"))
5713
5714
5717 RegisterNetSyncVariableInt("m_VarLiquidType");
5718 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5719
5720 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5721 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5722 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5723
5724 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5725 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5726 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5727 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5728
5729 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5730 RegisterNetSyncVariableBool("m_IsTakeable");
5731 RegisterNetSyncVariableBool("m_IsHologram");
5732
5735 {
5738 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5739 }
5740
5742
5744 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5746
5748 }
5749
5751 {
5753 }
5754
5756 {
5759 {
5764 }
5765 }
5766
5767 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5768 {
5770 {
5773 }
5774
5776 }
5777
5779 {
5785 }
5786
5788
5790 {
5792
5793 if (!action)
5794 {
5795 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5796 return;
5797 }
5798
5800 if (!ai)
5801 {
5803 return;
5804 }
5805
5807 if (!action_array)
5808 {
5809 action_array = new array<ActionBase_Basic>;
5811 }
5812 if (LogManager.IsActionLogEnable())
5813 {
5814 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5815 }
5816
5817 if (action_array.Find(action) != -1)
5818 {
5819 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5820 }
5821 else
5822 {
5823 action_array.Insert(action);
5824 }
5825 }
5826
5828 {
5829 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5830 ActionBase action = player.GetActionManager().GetAction(actionName);
5833
5834 if (action_array)
5835 {
5836 action_array.RemoveItem(action);
5837 }
5838 }
5839
5840
5841
5843 {
5844 ActionOverrideData overrideData = new ActionOverrideData();
5848
5850 if (!actionMap)
5851 {
5854 }
5855
5856 actionMap.Insert(this.
Type(), overrideData);
5857
5858 }
5859
5861
5863
5864
5866 {
5869
5872
5873 string config_to_search = "CfgVehicles";
5874 string muzzle_owner_config;
5875
5877 {
5878 if (IsInherited(Weapon))
5879 config_to_search = "CfgWeapons";
5880
5881 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5882
5883 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5884
5885 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5886
5887 if (config_OnFire_subclass_count > 0)
5888 {
5889 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5890
5891 for (int i = 0; i < config_OnFire_subclass_count; i++)
5892 {
5893 string particle_class = "";
5894 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5895 string config_OnFire_entry = config_OnFire_class + particle_class;
5896 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5897 WPOF_array.Insert(WPOF);
5898 }
5899
5900
5902 }
5903 }
5904
5906 {
5907 config_to_search = "CfgWeapons";
5908 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5909
5910 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5911
5912 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5913
5914 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5915 {
5916 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5917
5918 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5919 {
5920 string particle_class2 = "";
5921 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5922 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5923 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5924 WPOBE_array.Insert(WPOBE);
5925 }
5926
5927
5929 }
5930 }
5931 }
5932
5933
5935 {
5938
5940 {
5941 string config_to_search = "CfgVehicles";
5942
5943 if (IsInherited(Weapon))
5944 config_to_search = "CfgWeapons";
5945
5946 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5947 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5948
5949 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5950 {
5951
5953
5955 {
5957 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5959 return;
5960 }
5961
5964
5965
5966
5967 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5968 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5969
5970 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5971 {
5972 string particle_class = "";
5973 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5974 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5975 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5976
5977 if (entry_type == CT_CLASS)
5978 {
5979 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5980 WPOOH_array.Insert(WPOF);
5981 }
5982 }
5983
5984
5986 }
5987 }
5988 }
5989
5991 {
5993 }
5994
5996 {
5998 {
6000
6003
6006
6007 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6008 }
6009 }
6010
6012 {
6014 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6015
6017 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6018
6020 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6021
6023 {
6025 }
6026 }
6027
6029 {
6031 }
6032
6034 {
6037 else
6039
6041 {
6044 }
6045 else
6046 {
6049
6052 }
6053
6055 }
6056
6058 {
6060 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6061 }
6062
6064 {
6066 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6068 }
6069
6071 {
6073 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6074 }
6075
6077 {
6080
6081 OverheatingParticle OP = new OverheatingParticle();
6086
6088 }
6089
6091 {
6094
6095 return -1;
6096 }
6097
6099 {
6101 {
6104
6105 for (int i = count; i > 0; --i)
6106 {
6107 int id = i - 1;
6110
6113
6114 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6115 {
6116 if (p)
6117 {
6120 }
6121 }
6122 }
6123 }
6124 }
6125
6127 {
6129 {
6131 {
6132 int id = i - 1;
6134
6135 if (OP)
6136 {
6138
6139 if (p)
6140 {
6142 }
6143
6144 delete OP;
6145 }
6146 }
6147
6150 }
6151 }
6152
6155 {
6156 return 0.0;
6157 }
6158
6159
6161 {
6162 return 250;
6163 }
6164
6166 {
6167 return 0;
6168 }
6169
6172 {
6174 return true;
6175
6176 return false;
6177 }
6178
6181 {
6184
6186 {
6188 }
6189 else
6190 {
6191
6193 }
6194
6196 }
6197
6204 {
6205 return -1;
6206 }
6207
6208
6209
6210
6212 {
6214 {
6215 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6216 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6217
6218 if (r_index >= 0)
6219 {
6220 InventoryLocation r_il = new InventoryLocation;
6221 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6222
6223 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6226 {
6227 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6228 }
6230 {
6231 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6232 }
6233
6234 }
6235
6236 player.GetHumanInventory().ClearUserReservedLocation(this);
6237 }
6238
6241 }
6242
6243
6244
6245
6247 {
6248 return ItemBase.m_DebugActionsMask;
6249 }
6250
6252 {
6253 return ItemBase.m_DebugActionsMask & mask;
6254 }
6255
6257 {
6258 ItemBase.m_DebugActionsMask = mask;
6259 }
6260
6262 {
6263 ItemBase.m_DebugActionsMask |= mask;
6264 }
6265
6267 {
6268 ItemBase.m_DebugActionsMask &= ~mask;
6269 }
6270
6272 {
6274 {
6276 }
6277 else
6278 {
6280 }
6281 }
6282
6283
6285 {
6286 if (GetEconomyProfile())
6287 {
6288 float q_max = GetEconomyProfile().GetQuantityMax();
6289 if (q_max > 0)
6290 {
6291 float q_min = GetEconomyProfile().GetQuantityMin();
6292 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6293
6295 {
6296 ComponentEnergyManager comp = GetCompEM();
6298 {
6300 }
6301 }
6303 {
6305
6306 }
6307
6308 }
6309 }
6310 }
6311
6314 {
6315 EntityAI parent = GetHierarchyParent();
6316
6317 if (parent)
6318 {
6319 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6320 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6321 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6322 }
6323 }
6324
6327 {
6328 EntityAI parent = GetHierarchyParent();
6329
6330 if (parent)
6331 {
6332 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6333 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6334 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6335 }
6336 }
6337
6339 {
6340
6341
6342
6343
6345
6347 {
6348 if (ScriptInputUserData.CanStoreInputUserData())
6349 {
6350 ScriptInputUserData ctx = new ScriptInputUserData;
6356 ctx.
Write(use_stack_max);
6359
6361 {
6362 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6363 }
6364 }
6365 }
6366 else if (!
g_Game.IsMultiplayer())
6367 {
6369 }
6370 }
6371
6373 {
6375 }
6376
6378 {
6380 }
6381
6383 {
6385 }
6386
6388 {
6389
6390 return false;
6391 }
6392
6394 {
6395 return false;
6396 }
6397
6401 {
6402 return false;
6403 }
6404
6406 {
6407 return "";
6408 }
6409
6411
6413 {
6414 return false;
6415 }
6416
6418 {
6419 return true;
6420 }
6421
6422
6423
6425 {
6426 return true;
6427 }
6428
6430 {
6431 return true;
6432 }
6433
6435 {
6436 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6438 }
6439
6441 {
6443 }
6444
6446 {
6448 if (!is_being_placed)
6450 SetSynchDirty();
6451 }
6452
6453
6455
6457 {
6459 }
6460
6462 {
6464 }
6465
6467 {
6468 return 1;
6469 }
6470
6472 {
6473 return false;
6474 }
6475
6477 {
6479 SetSynchDirty();
6480 }
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6517 {
6518 super.OnMovedInsideCargo(container);
6519
6520 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6521 }
6522
6523 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6524 {
6525 super.EEItemLocationChanged(oldLoc, newLoc);
6526
6527 PlayerBase newPlayer = null;
6528 PlayerBase oldPlayer = null;
6529
6530 if (newLoc.GetParent())
6531 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6532
6533 if (oldLoc.GetParent())
6534 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6535
6537 {
6538 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6539
6540 if (rIndex >= 0)
6541 {
6542 InventoryLocation rIl = new InventoryLocation;
6543 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6544
6545 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6548 {
6549 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6550 }
6552 {
6554 }
6555
6556 }
6557 }
6558
6560 {
6561 if (newPlayer)
6562 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6563
6564 if (newPlayer == oldPlayer)
6565 {
6566 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6567 {
6569 {
6570 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6571 {
6572 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6573 }
6574 }
6575 else
6576 {
6577 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6578 }
6579 }
6580
6581 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6582 {
6583 int type = oldLoc.GetType();
6585 {
6586 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6587 }
6589 {
6590 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6591 }
6592 }
6593 if (!m_OldLocation)
6594 {
6595 m_OldLocation = new InventoryLocation;
6596 }
6597 m_OldLocation.Copy(oldLoc);
6598 }
6599 else
6600 {
6601 if (m_OldLocation)
6602 {
6603 m_OldLocation.Reset();
6604 }
6605 }
6606
6607 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6608 }
6609 else
6610 {
6611 if (newPlayer)
6612 {
6613 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6614 if (resIndex >= 0)
6615 {
6616 InventoryLocation il = new InventoryLocation;
6617 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6619 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6622 {
6623 il.
GetParent().GetOnReleaseLock().Invoke(it);
6624 }
6626 {
6628 }
6629
6630 }
6631 }
6633 {
6634
6636 }
6637
6638 if (m_OldLocation)
6639 {
6640 m_OldLocation.Reset();
6641 }
6642 }
6643
6645 {
6646 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6647 }
6648
6650 {
6651 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6652 }
6653 }
6654
6655 override void EOnContact(IEntity other, Contact extra)
6656 {
6658 {
6659 int liquidType = -1;
6661 if (impactSpeed > 0.0)
6662 {
6664 #ifndef SERVER
6666 #else
6668 SetSynchDirty();
6669 #endif
6671 }
6672 }
6673
6674 #ifdef SERVER
6675 if (GetCompEM() && GetCompEM().IsPlugged())
6676 {
6677 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6678 GetCompEM().UnplugThis();
6679 }
6680 #endif
6681 }
6682
6684
6686 {
6688 }
6689
6691 {
6692
6693 }
6694
6696 {
6697 super.OnItemLocationChanged(old_owner, new_owner);
6698
6699 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6700 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6701
6702 if (!relatedPlayer && playerNew)
6703 relatedPlayer = playerNew;
6704
6705 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6706 {
6708 if (actionMgr)
6709 {
6710 ActionBase currentAction = actionMgr.GetRunningAction();
6711 if (currentAction)
6713 }
6714 }
6715
6716 Man ownerPlayerOld = null;
6717 Man ownerPlayerNew = null;
6718
6719 if (old_owner)
6720 {
6721 if (old_owner.
IsMan())
6722 {
6723 ownerPlayerOld = Man.Cast(old_owner);
6724 }
6725 else
6726 {
6727 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6728 }
6729 }
6730 else
6731 {
6733 {
6735
6736 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6737 {
6738 GetCompEM().UnplugThis();
6739 }
6740 }
6741 }
6742
6743 if (new_owner)
6744 {
6745 if (new_owner.
IsMan())
6746 {
6747 ownerPlayerNew = Man.Cast(new_owner);
6748 }
6749 else
6750 {
6751 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6752 }
6753 }
6754
6755 if (ownerPlayerOld != ownerPlayerNew)
6756 {
6757 if (ownerPlayerOld)
6758 {
6759 array<EntityAI> subItemsExit = new array<EntityAI>;
6761 for (int i = 0; i < subItemsExit.Count(); i++)
6762 {
6765 }
6766 }
6767
6768 if (ownerPlayerNew)
6769 {
6770 array<EntityAI> subItemsEnter = new array<EntityAI>;
6772 for (int j = 0; j < subItemsEnter.Count(); j++)
6773 {
6776 }
6777 }
6778 }
6779 else if (ownerPlayerNew != null)
6780 {
6781 PlayerBase nplayer;
6782 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6783 {
6784 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6786 for (int k = 0; k < subItemsUpdate.Count(); k++)
6787 {
6789 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6790 }
6791 }
6792 }
6793
6794 if (old_owner)
6795 old_owner.OnChildItemRemoved(this);
6796 if (new_owner)
6797 new_owner.OnChildItemReceived(this);
6798 }
6799
6800
6802 {
6803 super.EEDelete(parent);
6804 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6805 if (player)
6806 {
6808
6809 if (player.IsAlive())
6810 {
6811 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6812 if (r_index >= 0)
6813 {
6814 InventoryLocation r_il = new InventoryLocation;
6815 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6816
6817 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6820 {
6821 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6822 }
6824 {
6825 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6826 }
6827
6828 }
6829
6830 player.RemoveQuickBarEntityShortcut(this);
6831 }
6832 }
6833 }
6834
6836 {
6837 super.EEKilled(killer);
6838
6841 {
6842 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6843 {
6844 if (IsMagazine())
6845 {
6846 if (Magazine.Cast(this).GetAmmoCount() > 0)
6847 {
6849 }
6850 }
6851 else
6852 {
6854 }
6855 }
6856 }
6857 }
6858
6860 {
6861 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6862
6863 super.OnWasAttached(parent, slot_id);
6864
6867
6870 }
6871
6873 {
6874 super.OnWasDetached(parent, slot_id);
6875
6878
6881 }
6882
6884 {
6885 int idx;
6888
6889 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6890 if (inventory_slots.Count() < 1)
6891 {
6892 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6893 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6894 }
6895 else
6896 {
6897 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6898 }
6899
6900 idx = inventory_slots.Find(slot);
6901 if (idx < 0)
6902 return "";
6903
6904 return attach_types.Get(idx);
6905 }
6906
6908 {
6909 int idx = -1;
6910 string slot;
6911
6914
6915 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6916 if (inventory_slots.Count() < 1)
6917 {
6918 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6919 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6920 }
6921 else
6922 {
6923 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6924 if (detach_types.Count() < 1)
6925 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6926 }
6927
6928 for (int i = 0; i < inventory_slots.Count(); i++)
6929 {
6930 slot = inventory_slots.Get(i);
6931 }
6932
6933 if (slot != "")
6934 {
6935 if (detach_types.Count() == 1)
6936 idx = 0;
6937 else
6938 idx = inventory_slots.Find(slot);
6939 }
6940 if (idx < 0)
6941 return "";
6942
6943 return detach_types.Get(idx);
6944 }
6945
6947 {
6948
6950
6951
6952 float min_time = 1;
6953 float max_time = 3;
6954 float delay = Math.RandomFloat(min_time, max_time);
6955
6956 explode_timer.Run(delay, this, "DoAmmoExplosion");
6957 }
6958
6960 {
6961 Magazine magazine = Magazine.Cast(this);
6962 int pop_sounds_count = 6;
6963 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6964
6965
6966 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6967 string sound_name = pop_sounds[ sound_idx ];
6968 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6969
6970
6971 magazine.ServerAddAmmoCount(-1);
6972
6973
6974 float min_temp_to_explode = 100;
6975
6976 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6977 {
6979 }
6980 }
6981
6982
6983 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6984 {
6985 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6986
6987 const int CHANCE_DAMAGE_CARGO = 4;
6988 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6989 const int CHANCE_DAMAGE_NOTHING = 2;
6990
6992 {
6993 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6994 int chances;
6995 int rnd;
6996
6997 if (GetInventory().GetCargo())
6998 {
6999 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7000 rnd = Math.RandomInt(0,chances);
7001
7002 if (rnd < CHANCE_DAMAGE_CARGO)
7003 {
7005 }
7006 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7007 {
7009 }
7010 }
7011 else
7012 {
7013 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7014 rnd = Math.RandomInt(0,chances);
7015
7016 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7017 {
7019 }
7020 }
7021 }
7022 }
7023
7025 {
7026 CargoBase cargo = GetInventory().GetCargo();
7027 if (cargo)
7028 {
7030 if (item_count > 0)
7031 {
7032 int random_pick = Math.RandomInt(0, item_count);
7034 if (!item.IsExplosive())
7035 {
7036 item.AddHealth("","",damage);
7037 return true;
7038 }
7039 }
7040 }
7041 return false;
7042 }
7043
7045 {
7046 GameInventory inventory = GetInventory();
7048 if (attachment_count > 0)
7049 {
7050 int random_pick = Math.RandomInt(0, attachment_count);
7052 if (!attachment.IsExplosive())
7053 {
7054 attachment.AddHealth("","",damage);
7055 return true;
7056 }
7057 }
7058 return false;
7059 }
7060
7062 {
7064 }
7065
7067 {
7069 return GetInventory().CanRemoveEntity();
7070
7071 return false;
7072 }
7073
7075 {
7076
7078 return false;
7079
7080
7082 return false;
7083
7084
7085
7087 if (delta == 0)
7088 return false;
7089
7090
7091 return true;
7092 }
7093
7095 {
7097 {
7098 if (ScriptInputUserData.CanStoreInputUserData())
7099 {
7100 ScriptInputUserData ctx = new ScriptInputUserData;
7105 ctx.
Write(destination_entity);
7109 }
7110 }
7111 else if (!
g_Game.IsMultiplayer())
7112 {
7114 }
7115 }
7116
7118 {
7119 float split_quantity_new;
7123 InventoryLocation loc = new InventoryLocation;
7124
7125 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7126 {
7128 split_quantity_new = stack_max;
7129 else
7131
7133 {
7134 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7135 if (new_item)
7136 {
7137 new_item.SetResultOfSplit(true);
7138 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7140 new_item.
SetQuantity(split_quantity_new,
false,
true);
7141 }
7142 }
7143 }
7144 else if (destination_entity && slot_id == -1)
7145 {
7146 if (quantity > stack_max)
7147 split_quantity_new = stack_max;
7148 else
7149 split_quantity_new = quantity;
7150
7152 {
7153 GameInventory destinationInventory = destination_entity.GetInventory();
7155 {
7158 }
7159
7160 if (new_item)
7161 {
7162 new_item.SetResultOfSplit(true);
7163 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7165 new_item.
SetQuantity(split_quantity_new,
false,
true);
7166 }
7167 }
7168 }
7169 else
7170 {
7171 if (stack_max != 0)
7172 {
7174 {
7176 }
7177
7178 if (split_quantity_new == 0)
7179 {
7180 if (!
g_Game.IsMultiplayer())
7181 player.PhysicalPredictiveDropItem(this);
7182 else
7183 player.ServerDropEntity(this);
7184 return;
7185 }
7186
7188 {
7190
7191 if (new_item)
7192 {
7193 new_item.SetResultOfSplit(true);
7194 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7197 new_item.PlaceOnSurface();
7198 }
7199 }
7200 }
7201 }
7202 }
7203
7205 {
7206 float split_quantity_new;
7210 InventoryLocation loc = new InventoryLocation;
7211
7212 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7213 {
7215 split_quantity_new = stack_max;
7216 else
7218
7220 {
7221 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7222 if (new_item)
7223 {
7224 new_item.SetResultOfSplit(true);
7225 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7227 new_item.
SetQuantity(split_quantity_new,
false,
true);
7228 }
7229 }
7230 }
7231 else if (destination_entity && slot_id == -1)
7232 {
7233 if (quantity > stack_max)
7234 split_quantity_new = stack_max;
7235 else
7236 split_quantity_new = quantity;
7237
7239 {
7240 GameInventory destinationInventory = destination_entity.GetInventory();
7242 {
7245 }
7246
7247 if (new_item)
7248 {
7249 new_item.SetResultOfSplit(true);
7250 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7252 new_item.
SetQuantity(split_quantity_new,
false,
true);
7253 }
7254 }
7255 }
7256 else
7257 {
7258 if (stack_max != 0)
7259 {
7261 {
7263 }
7264
7266 {
7268
7269 if (new_item)
7270 {
7271 new_item.SetResultOfSplit(true);
7272 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7275 new_item.PlaceOnSurface();
7276 }
7277 }
7278 }
7279 }
7280 }
7281
7283 {
7285 {
7286 if (ScriptInputUserData.CanStoreInputUserData())
7287 {
7288 ScriptInputUserData ctx = new ScriptInputUserData;
7293 dst.WriteToContext(ctx);
7295 }
7296 }
7297 else if (!
g_Game.IsMultiplayer())
7298 {
7300 }
7301 }
7302
7304 {
7306 {
7307 if (ScriptInputUserData.CanStoreInputUserData())
7308 {
7309 ScriptInputUserData ctx = new ScriptInputUserData;
7314 ctx.
Write(destination_entity);
7320 }
7321 }
7322 else if (!
g_Game.IsMultiplayer())
7323 {
7325 }
7326 }
7327
7329 {
7331 }
7332
7334 {
7336 float split_quantity_new;
7338 if (dst.IsValid())
7339 {
7340 int slot_id = dst.GetSlot();
7342
7343 if (quantity > stack_max)
7344 split_quantity_new = stack_max;
7345 else
7346 split_quantity_new = quantity;
7347
7349 {
7351
7352 if (new_item)
7353 {
7354 new_item.SetResultOfSplit(true);
7355 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7357 new_item.
SetQuantity(split_quantity_new,
false,
true);
7358 }
7359
7360 return new_item;
7361 }
7362 }
7363
7364 return null;
7365 }
7366
7368 {
7370 float split_quantity_new;
7372 if (destination_entity)
7373 {
7375 if (quantity > stackable)
7376 split_quantity_new = stackable;
7377 else
7378 split_quantity_new = quantity;
7379
7381 {
7382 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7383 if (new_item)
7384 {
7385 new_item.SetResultOfSplit(true);
7386 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7388 new_item.
SetQuantity(split_quantity_new,
false,
true);
7389 }
7390 }
7391 }
7392 }
7393
7395 {
7397 {
7398 if (ScriptInputUserData.CanStoreInputUserData())
7399 {
7400 ScriptInputUserData ctx = new ScriptInputUserData;
7405 ItemBase destination_entity =
this;
7406 ctx.
Write(destination_entity);
7410 }
7411 }
7412 else if (!
g_Game.IsMultiplayer())
7413 {
7415 }
7416 }
7417
7419 {
7421 float split_quantity_new;
7423 if (player)
7424 {
7426 if (quantity > stackable)
7427 split_quantity_new = stackable;
7428 else
7429 split_quantity_new = quantity;
7430
7432 {
7433 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7434 new_item =
ItemBase.Cast(in_hands);
7435 if (new_item)
7436 {
7437 new_item.SetResultOfSplit(true);
7438 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7440 new_item.SetQuantity(split_quantity_new, false, true);
7441 }
7442 }
7443 }
7444 }
7445
7447 {
7449 float split_quantity_new = Math.Floor(quantity * 0.5);
7450
7452 return;
7453
7455
7456 if (new_item)
7457 {
7458 if (new_item.GetQuantityMax() < split_quantity_new)
7459 {
7460 split_quantity_new = new_item.GetQuantityMax();
7461 }
7462
7463 new_item.SetResultOfSplit(true);
7464 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7465
7467 {
7470 }
7471 else
7472 {
7474 new_item.
SetQuantity(split_quantity_new,
false,
true);
7475 }
7476 }
7477 }
7478
7480 {
7482 float split_quantity_new = Math.Floor(quantity / 2);
7483
7485 return;
7486
7487 InventoryLocation invloc = new InventoryLocation;
7489
7491 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7492
7493 if (new_item)
7494 {
7495 if (new_item.GetQuantityMax() < split_quantity_new)
7496 {
7497 split_quantity_new = new_item.GetQuantityMax();
7498 }
7500 {
7503 }
7504 else if (split_quantity_new > 1)
7505 {
7507 new_item.
SetQuantity(split_quantity_new,
false,
true);
7508 }
7509 }
7510 }
7511
7514 {
7515 SetWeightDirty();
7517
7518 if (parent)
7519 parent.OnAttachmentQuantityChangedEx(this, delta);
7520
7522 {
7524 {
7526 }
7528 {
7529 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7531 }
7532 }
7533 }
7534
7537 {
7538
7539 }
7540
7543 {
7545 }
7546
7548 {
7549 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7550
7552 {
7553 if (newLevel == GameConstants.STATE_RUINED)
7554 {
7556 EntityAI parent = GetHierarchyParent();
7557 if (parent && parent.IsFireplace())
7558 {
7559 CargoBase cargo = GetInventory().GetCargo();
7560 if (cargo)
7561 {
7563 {
7565 }
7566 }
7567 }
7568 }
7569
7571 {
7572
7574 return;
7575 }
7576
7577 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7578 {
7580 }
7581 }
7582 }
7583
7584
7586 {
7587 super.OnRightClick();
7588
7590 {
7592 {
7593 if (ScriptInputUserData.CanStoreInputUserData())
7594 {
7595 EntityAI root = GetHierarchyRoot();
7596 Man playerOwner = GetHierarchyRootPlayer();
7597 InventoryLocation dst = new InventoryLocation;
7598
7599
7600 if (!playerOwner && root && root == this)
7601 {
7603 }
7604 else
7605 {
7606
7607 GetInventory().GetCurrentInventoryLocation(dst);
7609 {
7610 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7612 {
7614 }
7615 else
7616 {
7618
7619
7620 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7621 {
7623 }
7624 else
7625 {
7626 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7627 }
7628 }
7629 }
7630 }
7631
7632 ScriptInputUserData ctx = new ScriptInputUserData;
7640 }
7641 }
7642 else if (!
g_Game.IsMultiplayer())
7643 {
7645 }
7646 }
7647 }
7648
7650 {
7651 if (root)
7652 {
7653 vector m4[4];
7654 root.GetTransform(m4);
7655 dst.SetGround(this, m4);
7656 }
7657 else
7658 {
7659 GetInventory().GetCurrentInventoryLocation(dst);
7660 }
7661 }
7662
7663 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7664 {
7665
7666 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7667 return false;
7668
7669 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7670 return false;
7671
7672
7674 return false;
7675
7676
7677 Magazine mag = Magazine.Cast(this);
7678 if (mag)
7679 {
7680 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7681 return false;
7682
7683 if (stack_max_limit)
7684 {
7685 Magazine other_mag = Magazine.Cast(other_item);
7686 if (other_item)
7687 {
7688 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7689 return false;
7690 }
7691
7692 }
7693 }
7694 else
7695 {
7696
7698 return false;
7699
7701 return false;
7702 }
7703
7704 PlayerBase player = null;
7705 if (CastTo(player, GetHierarchyRootPlayer()))
7706 {
7707 if (player.GetInventory().HasAttachment(this))
7708 return false;
7709
7710 if (player.IsItemsToDelete())
7711 return false;
7712 }
7713
7714 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7715 return false;
7716
7717 int slotID;
7719 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7720 return false;
7721
7722 return true;
7723 }
7724
7726 {
7728 }
7729
7731 {
7732 return m_IsResultOfSplit;
7733 }
7734
7736 {
7737 m_IsResultOfSplit = value;
7738 }
7739
7741 {
7743 }
7744
7746 {
7747 float other_item_quantity = other_item.GetQuantity();
7748 float this_free_space;
7749
7751
7753
7754 if (other_item_quantity > this_free_space)
7755 {
7756 return this_free_space;
7757 }
7758 else
7759 {
7760 return other_item_quantity;
7761 }
7762 }
7763
7765 {
7767 }
7768
7770 {
7772 return;
7773
7774 if (!IsMagazine() && other_item)
7775 {
7777 if (quantity_used != 0)
7778 {
7779 float hp1 = GetHealth01("","");
7780 float hp2 = other_item.GetHealth01("","");
7781 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7782 hpResult = hpResult / (
GetQuantity() + quantity_used);
7783
7784 hpResult *= GetMaxHealth();
7785 Math.Round(hpResult);
7786 SetHealth("", "Health", hpResult);
7787
7789 other_item.AddQuantity(-quantity_used);
7790 }
7791 }
7793 }
7794
7796 {
7797 #ifdef SERVER
7798 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7799 GetHierarchyParent().IncreaseLifetimeUp();
7800 #endif
7801 };
7802
7804 {
7805 PlayerBase p = PlayerBase.Cast(player);
7806
7807 array<int> recipesIds = p.m_Recipes;
7808 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7809 if (moduleRecipesManager)
7810 {
7811 EntityAI itemInHands = player.GetEntityInHands();
7812 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7813 }
7814
7815 for (int i = 0;i < recipesIds.Count(); i++)
7816 {
7817 int key = recipesIds.Get(i);
7818 string recipeName = moduleRecipesManager.GetRecipeName(key);
7820 }
7821 }
7822
7823
7824 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7825 {
7826 super.GetDebugActions(outputList);
7827
7828
7834
7835
7840
7845
7846
7850
7851
7853 {
7857 }
7858
7861
7862
7866
7868
7869 InventoryLocation loc = new InventoryLocation();
7870 GetInventory().GetCurrentInventoryLocation(loc);
7872 {
7873 if (Gizmo_IsSupported())
7876 }
7877
7879 }
7880
7881
7882
7883
7885 {
7886 super.OnAction(action_id, player, ctx);
7887
7889 {
7890 switch (action_id)
7891 {
7895 return true;
7899 return true;
7900 }
7901 }
7902
7904 {
7905 switch (action_id)
7906 {
7908 Delete();
7909 return true;
7910 }
7911 }
7912
7913 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7914 {
7915 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7916 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7917 PlayerBase p = PlayerBase.Cast(player);
7918 if (
EActions.RECIPES_RANGE_START < 1000)
7919 {
7920 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7921 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7922 }
7923 }
7924 #ifndef SERVER
7925 else if (action_id ==
EActions.WATCH_PLAYER)
7926 {
7927 PluginDeveloper.SetDeveloperItemClientEx(player);
7928 }
7929 #endif
7931 {
7932 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7933 {
7934 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7935 OnDebugButtonPressServer(id + 1);
7936 }
7937
7938 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7939 {
7940 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7942 }
7943
7944 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7945 {
7946 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7948 }
7949
7950 else if (action_id ==
EActions.ADD_QUANTITY)
7951 {
7952 if (IsMagazine())
7953 {
7954 Magazine mag = Magazine.Cast(this);
7955 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7956 }
7957 else
7958 {
7960 }
7961
7962 if (m_EM)
7963 {
7964 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7965 }
7966
7967 }
7968
7969 else if (action_id ==
EActions.REMOVE_QUANTITY)
7970 {
7971 if (IsMagazine())
7972 {
7973 Magazine mag2 = Magazine.Cast(this);
7974 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7975 }
7976 else
7977 {
7979 }
7980 if (m_EM)
7981 {
7982 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7983 }
7984
7985 }
7986
7987 else if (action_id ==
EActions.SET_QUANTITY_0)
7988 {
7990
7991 if (m_EM)
7992 {
7993 m_EM.SetEnergy(0);
7994 }
7995 }
7996
7997 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7998 {
8000
8001 if (m_EM)
8002 {
8003 m_EM.SetEnergy(m_EM.GetEnergyMax());
8004 }
8005 }
8006
8007 else if (action_id ==
EActions.ADD_HEALTH)
8008 {
8009 AddHealth("","",GetMaxHealth("","Health")/5);
8010 }
8011 else if (action_id ==
EActions.REMOVE_HEALTH)
8012 {
8013 AddHealth("","",-GetMaxHealth("","Health")/5);
8014 }
8015 else if (action_id ==
EActions.DESTROY_HEALTH)
8016 {
8017 SetHealth01("","",0);
8018 }
8019 else if (action_id ==
EActions.WATCH_ITEM)
8020 {
8022 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8023 #ifdef DEVELOPER
8024 SetDebugDeveloper_item(this);
8025 #endif
8026 }
8027
8028 else if (action_id ==
EActions.ADD_TEMPERATURE)
8029 {
8030 AddTemperature(20);
8031
8032 }
8033
8034 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8035 {
8036 AddTemperature(-20);
8037
8038 }
8039
8040 else if (action_id ==
EActions.FLIP_FROZEN)
8041 {
8042 SetFrozen(!GetIsFrozen());
8043
8044 }
8045
8046 else if (action_id ==
EActions.ADD_WETNESS)
8047 {
8049
8050 }
8051
8052 else if (action_id ==
EActions.REMOVE_WETNESS)
8053 {
8055
8056 }
8057
8058 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8059 {
8062
8063
8064 }
8065
8066 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8067 {
8070 }
8071
8072 else if (action_id ==
EActions.MAKE_SPECIAL)
8073 {
8074 auto debugParams = DebugSpawnParams.WithPlayer(player);
8075 OnDebugSpawnEx(debugParams);
8076 }
8077
8078 }
8079
8080
8081 return false;
8082 }
8083
8084
8085
8086
8090
8093
8094
8095
8097 {
8098 return false;
8099 }
8100
8101
8103 {
8104 return true;
8105 }
8106
8107
8109 {
8110 return true;
8111 }
8112
8113
8114
8116 {
8117 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8118 return g_Game.ConfigIsExisting(config_path);
8119 }
8120
8123 {
8124 return null;
8125 }
8126
8128 {
8129 return false;
8130 }
8131
8133 {
8134 return false;
8135 }
8136
8140
8141
8143 {
8144 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8145 return module_repairing.CanRepair(this, item_repair_kit);
8146 }
8147
8148
8149 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8150 {
8151 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8152 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8153 }
8154
8155
8157 {
8158
8159
8160
8161
8162
8163
8164
8165
8166 return 1;
8167 }
8168
8169
8170
8172 {
8174 }
8175
8176
8177
8179 {
8181 }
8182
8183
8192 {
8193 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8194
8195 if (player)
8196 {
8197 player.MessageStatus(text);
8198 }
8199 }
8200
8201
8210 {
8211 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8212
8213 if (player)
8214 {
8215 player.MessageAction(text);
8216 }
8217 }
8218
8219
8228 {
8229 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8230
8231 if (player)
8232 {
8233 player.MessageFriendly(text);
8234 }
8235 }
8236
8237
8246 {
8247 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8248
8249 if (player)
8250 {
8251 player.MessageImportant(text);
8252 }
8253 }
8254
8256 {
8257 return true;
8258 }
8259
8260
8261 override bool KindOf(
string tag)
8262 {
8263 bool found = false;
8264 string item_name = this.
GetType();
8266 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8267
8268 int array_size = item_tag_array.Count();
8269 for (int i = 0; i < array_size; i++)
8270 {
8271 if (item_tag_array.Get(i) == tag)
8272 {
8273 found = true;
8274 break;
8275 }
8276 }
8277 return found;
8278 }
8279
8280
8282 {
8283
8284 super.OnRPC(sender, rpc_type,ctx);
8285
8286
8287 switch (rpc_type)
8288 {
8289 #ifndef SERVER
8290 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8291 Param2<bool, string> p = new Param2<bool, string>(false, "");
8292
8294 return;
8295
8296 bool play = p.param1;
8297 string soundSet = p.param2;
8298
8299 if (play)
8300 {
8302 {
8304 {
8306 }
8307 }
8308 else
8309 {
8311 }
8312 }
8313 else
8314 {
8316 }
8317
8318 break;
8319 #endif
8320
8321 }
8322
8324 {
8326 }
8327 }
8328
8329
8330
8331
8333 {
8334 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8335 return plugin.GetID(
name);
8336 }
8337
8339 {
8340 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8341 return plugin.GetName(id);
8342 }
8343
8346 {
8347
8348
8349 int varFlags;
8350 if (!ctx.
Read(varFlags))
8351 return;
8352
8353 if (varFlags & ItemVariableFlags.FLOAT)
8354 {
8356 }
8357 }
8358
8360 {
8361
8362 super.SerializeNumericalVars(floats_out);
8363
8364
8365
8367 {
8369 }
8370
8372 {
8374 }
8375
8377 {
8379 }
8380
8382 {
8387 }
8388
8390 {
8392 }
8393 }
8394
8396 {
8397
8398 super.DeSerializeNumericalVars(floats);
8399
8400
8401 int index = 0;
8402 int mask = Math.Round(floats.Get(index));
8403
8404 index++;
8405
8407 {
8409 {
8411 }
8412 else
8413 {
8414 float quantity = floats.Get(index);
8416 }
8417 index++;
8418 }
8419
8421 {
8422 float wet = floats.Get(index);
8424 index++;
8425 }
8426
8428 {
8429 int liquidtype = Math.Round(floats.Get(index));
8431 index++;
8432 }
8433
8435 {
8437 index++;
8439 index++;
8441 index++;
8443 index++;
8444 }
8445
8447 {
8448 int cleanness = Math.Round(floats.Get(index));
8450 index++;
8451 }
8452 }
8453
8455 {
8456 super.WriteVarsToCTX(ctx);
8457
8458
8460 {
8462 }
8463
8465 {
8467 }
8468
8470 {
8472 }
8473
8475 {
8476 int r,g,b,a;
8482 }
8483
8485 {
8487 }
8488 }
8489
8491 {
8492 if (!super.ReadVarsFromCTX(ctx,version))
8493 return false;
8494
8495 int intValue;
8496 float value;
8497
8498 if (version < 140)
8499 {
8500 if (!ctx.
Read(intValue))
8501 return false;
8502
8503 m_VariablesMask = intValue;
8504 }
8505
8507 {
8508 if (!ctx.
Read(value))
8509 return false;
8510
8512 {
8514 }
8515 else
8516 {
8518 }
8519 }
8520
8521 if (version < 140)
8522 {
8524 {
8525 if (!ctx.
Read(value))
8526 return false;
8527 SetTemperatureDirect(value);
8528 }
8529 }
8530
8532 {
8533 if (!ctx.
Read(value))
8534 return false;
8536 }
8537
8539 {
8540 if (!ctx.
Read(intValue))
8541 return false;
8543 }
8544
8546 {
8547 int r,g,b,a;
8549 return false;
8551 return false;
8553 return false;
8555 return false;
8556
8558 }
8559
8561 {
8562 if (!ctx.
Read(intValue))
8563 return false;
8565 }
8566
8567 if (version >= 138 && version < 140)
8568 {
8570 {
8571 if (!ctx.
Read(intValue))
8572 return false;
8573 SetFrozen(intValue);
8574 }
8575 }
8576
8577 return true;
8578 }
8579
8580
8582 {
8585 {
8587 }
8588
8589 if (!super.OnStoreLoad(ctx, version))
8590 {
8592 return false;
8593 }
8594
8595 if (version >= 114)
8596 {
8597 bool hasQuickBarIndexSaved;
8598
8599 if (!ctx.
Read(hasQuickBarIndexSaved))
8600 {
8602 return false;
8603 }
8604
8605 if (hasQuickBarIndexSaved)
8606 {
8607 int itmQBIndex;
8608
8609
8610 if (!ctx.
Read(itmQBIndex))
8611 {
8613 return false;
8614 }
8615
8616 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8617 if (itmQBIndex != -1 && parentPlayer)
8618 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8619 }
8620 }
8621 else
8622 {
8623
8624 PlayerBase player;
8625 int itemQBIndex;
8626 if (version ==
int.
MAX)
8627 {
8628 if (!ctx.
Read(itemQBIndex))
8629 {
8631 return false;
8632 }
8633 }
8634 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8635 {
8636
8637 if (!ctx.
Read(itemQBIndex))
8638 {
8640 return false;
8641 }
8642 if (itemQBIndex != -1 && player)
8643 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8644 }
8645 }
8646
8647 if (version < 140)
8648 {
8649
8650 if (!LoadVariables(ctx, version))
8651 {
8653 return false;
8654 }
8655 }
8656
8657
8659 {
8661 return false;
8662 }
8663 if (version >= 132)
8664 {
8666 if (raib)
8667 {
8669 {
8671 return false;
8672 }
8673 }
8674 }
8675
8677 return true;
8678 }
8679
8680
8681
8683 {
8684 super.OnStoreSave(ctx);
8685
8686 PlayerBase player;
8687 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8688 {
8690
8691 int itemQBIndex = -1;
8692 itemQBIndex = player.FindQuickBarEntityIndex(this);
8693 ctx.
Write(itemQBIndex);
8694 }
8695 else
8696 {
8698 }
8699
8701
8703 if (raib)
8704 {
8706 }
8707 }
8708
8709
8711 {
8712 super.AfterStoreLoad();
8713
8715 {
8717 }
8718
8720 {
8723 }
8724 }
8725
8727 {
8728 super.EEOnAfterLoad();
8729
8731 {
8733 }
8734
8737 }
8738
8740 {
8741 return false;
8742 }
8743
8744
8745
8747 {
8749 {
8750 #ifdef PLATFORM_CONSOLE
8751
8753 {
8755 if (menu)
8756 {
8758 }
8759 }
8760 #endif
8761 }
8762
8764 {
8767 }
8768
8770 {
8771 SetWeightDirty();
8773 }
8775 {
8778 }
8779
8781 {
8784
8787 }
8789 {
8793 }
8794
8795 super.OnVariablesSynchronized();
8796 }
8797
8798
8799
8801 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8802 {
8803 if (!IsServerCheck(allow_client))
8804 return false;
8805
8807 return false;
8808
8811
8812 if (value <= (min + 0.001))
8813 value = min;
8814
8815 if (value == min)
8816 {
8817 if (destroy_config)
8818 {
8819 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8820 if (dstr)
8821 {
8823 this.Delete();
8824 return true;
8825 }
8826 }
8827 else if (destroy_forced)
8828 {
8830 this.Delete();
8831 return true;
8832 }
8833
8835 }
8836
8839
8841 {
8842 EntityAI parent = GetHierarchyRoot();
8843 InventoryLocation iLoc = new InventoryLocation();
8844 GetInventory().GetCurrentInventoryLocation(iLoc);
8846 {
8847 int iLocSlot = iLoc.
GetSlot();
8849 {
8851 }
8853 {
8855 }
8856 }
8857 }
8858
8860 {
8862
8863 if (delta)
8865 }
8866
8868
8869 return false;
8870 }
8871
8872
8874 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8875 {
8877 }
8878
8880 {
8883 }
8884
8886 {
8889 }
8890
8892 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8893 {
8894 float value_clamped = Math.Clamp(value, 0, 1);
8896 SetQuantity(result, destroy_config, destroy_forced);
8897 }
8898
8899
8902 {
8904 }
8905
8907 {
8909 }
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8921 {
8922 int slot = -1;
8923 GameInventory inventory = GetInventory();
8924 if (inventory)
8925 {
8926 InventoryLocation il = new InventoryLocation;
8929 }
8930
8932 }
8933
8935 {
8936 float quantity_max = 0;
8937
8939 {
8940 if (attSlotID != -1)
8941 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8942
8943 if (quantity_max <= 0)
8945 }
8946
8947 if (quantity_max <= 0)
8949
8950 return quantity_max;
8951 }
8952
8954 {
8956 }
8957
8959 {
8961 }
8962
8963
8965 {
8967 }
8968
8970 {
8972 }
8973
8975 {
8977 }
8978
8979
8981 {
8982
8983 float weightEx = GetWeightEx();
8984 float special = GetInventoryAndCargoWeight();
8985 return weightEx - special;
8986 }
8987
8988
8990 {
8992 }
8993
8995 {
8997 {
8998 #ifdef DEVELOPER
8999 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9000 {
9001 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9003 }
9004 #endif
9005
9007 }
9008 else if (HasEnergyManager())
9009 {
9010 #ifdef DEVELOPER
9011 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9012 {
9013 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9014 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9015 }
9016 #endif
9017 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9018 }
9019 else
9020 {
9021 #ifdef DEVELOPER
9022 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9023 {
9024 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9025 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9026 }
9027 #endif
9028 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9029 }
9030 }
9031
9034 {
9035 int item_count = 0;
9037
9038 GameInventory inventory = GetInventory();
9039 CargoBase cargo = inventory.
GetCargo();
9040 if (cargo != NULL)
9041 {
9043 }
9044
9046 for (int i = 0; i < nAttachments; ++i)
9047 {
9049 if (item)
9050 item_count += item.GetNumberOfItems();
9051 }
9052 return item_count;
9053 }
9054
9057 {
9058 float weight = 0;
9059 float wetness = 1;
9060 if (include_wetness)
9063 {
9064 weight = wetness * m_ConfigWeight;
9065 }
9067 {
9068 weight = 1;
9069 }
9070 return weight;
9071 }
9072
9073
9074
9076 {
9077 GameInventory inventory = GetInventory();
9078 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9079 {
9080 array<EntityAI> items = new array<EntityAI>;
9082 for (int i = 0; i < items.Count(); ++i)
9083 {
9085 if (item)
9086 {
9087 g_Game.ObjectDelete(item);
9088 }
9089 }
9090 }
9091 }
9092
9093
9094
9095
9097 {
9098 float energy = 0;
9099 if (HasEnergyManager())
9100 {
9101 energy = GetCompEM().GetEnergy();
9102 }
9103 return energy;
9104 }
9105
9106
9108 {
9109 super.OnEnergyConsumed();
9110
9112 }
9113
9115 {
9116 super.OnEnergyAdded();
9117
9119 }
9120
9121
9123 {
9124 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9125 {
9127 {
9128 float energy_0to1 = GetCompEM().GetEnergy0To1();
9130 }
9131 }
9132 }
9133
9134
9136 {
9137 return ConfigGetFloat("heatIsolation");
9138 }
9139
9141 {
9143 }
9144
9146 {
9147 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9148 if (
g_Game.ConfigIsExisting(paramPath))
9149 return g_Game.ConfigGetFloat(paramPath);
9150
9151 return 0.0;
9152 }
9153
9155 {
9156 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9157 if (
g_Game.ConfigIsExisting(paramPath))
9158 return g_Game.ConfigGetFloat(paramPath);
9159
9160 return 0.0;
9161 }
9162
9163 override void SetWet(
float value,
bool allow_client =
false)
9164 {
9165 if (!IsServerCheck(allow_client))
9166 return;
9167
9170
9172
9173 m_VarWet = Math.Clamp(value, min, max);
9174
9176 {
9179 }
9180 }
9181
9182 override void AddWet(
float value)
9183 {
9185 }
9186
9188 {
9190 }
9191
9193 {
9195 }
9196
9198 {
9200 }
9201
9203 {
9205 }
9206
9208 {
9210 }
9211
9213 {
9216 if (newLevel != oldLevel)
9217 {
9219 }
9220 }
9221
9223 {
9224 SetWeightDirty();
9225 }
9226
9228 {
9229 return GetWetLevelInternal(
m_VarWet);
9230 }
9231
9232
9233
9235 {
9237 }
9238
9240 {
9242 }
9243
9245 {
9247 }
9248
9250 {
9252 }
9253
9254
9255
9257 {
9258 if (ConfigIsExisting("itemModelLength"))
9259 {
9260 return ConfigGetFloat("itemModelLength");
9261 }
9262 return 0;
9263 }
9264
9266 {
9267 if (ConfigIsExisting("itemAttachOffset"))
9268 {
9269 return ConfigGetFloat("itemAttachOffset");
9270 }
9271 return 0;
9272 }
9273
9274 override void SetCleanness(
int value,
bool allow_client =
false)
9275 {
9276 if (!IsServerCheck(allow_client))
9277 return;
9278
9280
9282
9285 }
9286
9288 {
9290 }
9291
9293 {
9294 return true;
9295 }
9296
9297
9298
9299
9301 {
9303 }
9304
9306 {
9308 }
9309
9310
9311
9312
9313 override void SetColor(
int r,
int g,
int b,
int a)
9314 {
9320 }
9322 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9323 {
9328 }
9329
9331 {
9333 }
9334
9337 {
9338 int r,g,b,a;
9340 r = r/255;
9341 g = g/255;
9342 b = b/255;
9343 a = a/255;
9344 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9345 }
9346
9347
9348
9349 override void SetLiquidType(
int value,
bool allow_client =
false)
9350 {
9351 if (!IsServerCheck(allow_client))
9352 return;
9353
9358 }
9359
9361 {
9362 return ConfigGetInt("varLiquidTypeInit");
9363 }
9364
9366 {
9368 }
9369
9371 {
9373 SetFrozen(false);
9374 }
9375
9378 {
9379 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9380 }
9381
9382
9385 {
9386 PlayerBase nplayer;
9387 if (PlayerBase.CastTo(nplayer, player))
9388 {
9390 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9391 }
9392 }
9393
9394
9397 {
9398 PlayerBase nplayer;
9399 if (PlayerBase.CastTo(nplayer,player))
9400 {
9401 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9402 }
9403
9404 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9405
9406 if (HasEnergyManager())
9407 {
9408 GetCompEM().UpdatePlugState();
9409 }
9410 }
9411
9412
9414 {
9415 super.OnPlacementStarted(player);
9416
9418 }
9419
9420 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9421 {
9423 {
9424 m_AdminLog.OnPlacementComplete(player,
this);
9425 }
9426
9427 super.OnPlacementComplete(player, position, orientation);
9428 }
9429
9430
9431
9432
9433
9435 {
9437 {
9438 return true;
9439 }
9440 else
9441 {
9442 return false;
9443 }
9444 }
9445
9446
9448 {
9450 {
9452 }
9453 }
9454
9455
9457 {
9459 }
9460
9462 {
9464 }
9465
9466 override void InsertAgent(
int agent,
float count = 1)
9467 {
9468 if (count < 1)
9469 return;
9470
9472 }
9473
9476 {
9478 }
9479
9480
9482 {
9484 }
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9528 {
9530 return false;
9531 return true;
9532 }
9533
9535 {
9536
9538 }
9539
9540
9543 {
9544 super.CheckForRoofLimited(timeTresholdMS);
9545
9546 float time =
g_Game.GetTime();
9547 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9548 {
9549 m_PreviousRoofTestTime = time;
9550 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9551 }
9552 }
9553
9554
9556 {
9558 {
9559 return 0;
9560 }
9561
9562 if (GetInventory().GetAttachmentSlotsCount() != 0)
9563 {
9564 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9565 if (filter)
9566 return filter.GetProtectionLevel(type, false, system);
9567 else
9568 return 0;
9569 }
9570
9571 string subclassPath, entryName;
9572
9573 switch (type)
9574 {
9576 entryName = "biological";
9577 break;
9579 entryName = "chemical";
9580 break;
9581 default:
9582 entryName = "biological";
9583 break;
9584 }
9585
9586 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9587
9588 return g_Game.ConfigGetFloat(subclassPath + entryName);
9589 }
9590
9591
9592
9595 {
9596 if (!IsMagazine())
9598
9600 }
9601
9602
9603
9604
9605
9610 {
9611 return true;
9612 }
9613
9615 {
9617 }
9618
9619
9620
9621
9622
9624 {
9625 if (parent)
9626 {
9627 if (parent.IsInherited(DayZInfected))
9628 return true;
9629
9630 if (!parent.IsRuined())
9631 return true;
9632 }
9633
9634 return true;
9635 }
9636
9638 {
9639 if (!super.CanPutAsAttachment(parent))
9640 {
9641 return false;
9642 }
9643
9644 if (!IsRuined() && !parent.IsRuined())
9645 {
9646 return true;
9647 }
9648
9649 return false;
9650 }
9651
9653 {
9654
9655
9656
9657
9658 return super.CanReceiveItemIntoCargo(item);
9659 }
9660
9662 {
9663
9664
9665
9666
9667 GameInventory attachmentInv = attachment.GetInventory();
9669 {
9670 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9671 return false;
9672 }
9673
9674 InventoryLocation loc = new InventoryLocation();
9675 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9676 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9677 return false;
9678
9679 return super.CanReceiveAttachment(attachment, slotId);
9680 }
9681
9683 {
9684 if (!super.CanReleaseAttachment(attachment))
9685 return false;
9686
9687 return GetInventory().AreChildrenAccessible();
9688 }
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9711 {
9712 int id = muzzle_owner.GetMuzzleID();
9713 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9714
9715 if (WPOF_array)
9716 {
9717 for (int i = 0; i < WPOF_array.Count(); i++)
9718 {
9719 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9720
9721 if (WPOF)
9722 {
9723 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9724 }
9725 }
9726 }
9727 }
9728
9729
9731 {
9732 int id = muzzle_owner.GetMuzzleID();
9734
9735 if (WPOBE_array)
9736 {
9737 for (int i = 0; i < WPOBE_array.Count(); i++)
9738 {
9739 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9740
9741 if (WPOBE)
9742 {
9743 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9744 }
9745 }
9746 }
9747 }
9748
9749
9751 {
9752 int id = muzzle_owner.GetMuzzleID();
9753 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9754
9755 if (WPOOH_array)
9756 {
9757 for (int i = 0; i < WPOOH_array.Count(); i++)
9758 {
9759 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9760
9761 if (WPOOH)
9762 {
9763 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9764 }
9765 }
9766 }
9767 }
9768
9769
9771 {
9772 int id = muzzle_owner.GetMuzzleID();
9773 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9774
9775 if (WPOOH_array)
9776 {
9777 for (int i = 0; i < WPOOH_array.Count(); i++)
9778 {
9779 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9780
9781 if (WPOOH)
9782 {
9783 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9784 }
9785 }
9786 }
9787 }
9788
9789
9791 {
9792 int id = muzzle_owner.GetMuzzleID();
9793 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9794
9795 if (WPOOH_array)
9796 {
9797 for (int i = 0; i < WPOOH_array.Count(); i++)
9798 {
9799 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9800
9801 if (WPOOH)
9802 {
9803 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9804 }
9805 }
9806 }
9807 }
9808
9809
9810
9812 {
9814 {
9815 return true;
9816 }
9817
9818 return false;
9819 }
9820
9822 {
9824 {
9825 return true;
9826 }
9827
9828 return false;
9829 }
9830
9832 {
9834 {
9835 return true;
9836 }
9837
9838 return false;
9839 }
9840
9842 {
9843 return false;
9844 }
9845
9848 {
9849 return UATimeSpent.DEFAULT_DEPLOY;
9850 }
9851
9852
9853
9854
9856 {
9858 SetSynchDirty();
9859 }
9860
9862 {
9864 }
9865
9866
9868 {
9869 return false;
9870 }
9871
9874 {
9875 string att_type = "None";
9876
9877 if (ConfigIsExisting("soundAttType"))
9878 {
9879 att_type = ConfigGetString("soundAttType");
9880 }
9881
9883 }
9884
9886 {
9888 }
9889
9890
9891
9892
9893
9899
9901 {
9904
9906 }
9907
9908
9910 {
9912 return;
9913
9915
9918
9921
9922 SoundParameters params = new SoundParameters();
9926 }
9927
9928
9930 {
9932 {
9935
9936 SetSynchDirty();
9937
9940 }
9941 }
9942
9944 {
9946 }
9947
9948
9950 {
9952 return;
9953
9955 SetSynchDirty();
9956
9959 }
9960
9962 {
9965 }
9966
9968 {
9970 }
9971
9972 void OnApply(PlayerBase player);
9973
9975 {
9976 return 1.0;
9977 };
9978
9980 {
9982 }
9983
9985 {
9987 }
9988
9990
9992 {
9993 SetDynamicPhysicsLifeTime(0.01);
9995 }
9996
9998 {
9999 array<string> zone_names = new array<string>;
10000 GetDamageZones(zone_names);
10001 for (int i = 0; i < zone_names.Count(); i++)
10002 {
10003 SetHealthMax(zone_names.Get(i),"Health");
10004 }
10005 SetHealthMax("","Health");
10006 }
10007
10010 {
10011 float global_health = GetHealth01("","Health");
10012 array<string> zones = new array<string>;
10013 GetDamageZones(zones);
10014
10015 for (int i = 0; i < zones.Count(); i++)
10016 {
10017 SetHealth01(zones.Get(i),"Health",global_health);
10018 }
10019 }
10020
10023 {
10024 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10025 }
10026
10028 {
10029 if (!hasRootAsPlayer)
10030 {
10031 if (refParentIB)
10032 {
10033
10034 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10035 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10036
10037 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10038 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10039
10042 }
10043 else
10044 {
10045
10048 }
10049 }
10050 }
10051
10053 {
10055 {
10056 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10057 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10058 {
10059 float heatPermCoef = 1.0;
10061 while (ent)
10062 {
10063 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10064 ent = ent.GetHierarchyParent();
10065 }
10066
10067 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10068 }
10069 }
10070 }
10071
10073 {
10074
10075 EntityAI parent = GetHierarchyParent();
10076 if (!parent)
10077 {
10078 hasParent = false;
10079 hasRootAsPlayer = false;
10080 }
10081 else
10082 {
10083 hasParent = true;
10084 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10085 refParentIB =
ItemBase.Cast(parent);
10086 }
10087 }
10088
10089 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10090 {
10091
10092 }
10093
10095 {
10096
10097 return false;
10098 }
10099
10101 {
10102
10103
10104 return false;
10105 }
10106
10108 {
10109
10110 return false;
10111 }
10112
10115 {
10116 return !GetIsFrozen() &&
IsOpen();
10117 }
10118
10120 {
10121 bool hasParent = false, hasRootAsPlayer = false;
10123
10124 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10125 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10126
10127 if (wwtu || foodDecay)
10128 {
10132
10133 if (processWetness || processTemperature || processDecay)
10134 {
10136
10137 if (processWetness)
10138 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10139
10140 if (processTemperature)
10142
10143 if (processDecay)
10144 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10145 }
10146 }
10147 }
10148
10151 {
10153 }
10154
10156 {
10159
10160 return super.GetTemperatureFreezeThreshold();
10161 }
10162
10164 {
10167
10168 return super.GetTemperatureThawThreshold();
10169 }
10170
10172 {
10175
10176 return super.GetItemOverheatThreshold();
10177 }
10178
10180 {
10182 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10183
10184 return super.GetTemperatureFreezeTime();
10185 }
10186
10188 {
10190 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10191
10192 return super.GetTemperatureThawTime();
10193 }
10194
10199
10201 {
10202 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10203 }
10204
10206 {
10207 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10208 }
10209
10212 {
10214 }
10215
10217 {
10219 }
10220
10222 {
10224 }
10225
10228 {
10229 return null;
10230 }
10231
10234 {
10235 return false;
10236 }
10237
10239 {
10241 {
10244 if (!trg)
10245 {
10247 explosive = this;
10248 }
10249
10250 explosive.PairRemote(trg);
10252
10253 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10254 trg.SetPersistentPairID(persistentID);
10255 explosive.SetPersistentPairID(persistentID);
10256
10257 return true;
10258 }
10259 return false;
10260 }
10261
10264 {
10265 float ret = 1.0;
10268 ret *= GetHealth01();
10269
10270 return ret;
10271 }
10272
10273 #ifdef DEVELOPER
10274 override void SetDebugItem()
10275 {
10276 super.SetDebugItem();
10277 _itemBase = this;
10278 }
10279
10281 {
10282 string text = super.GetDebugText();
10283
10285 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10286
10287 return text;
10288 }
10289 #endif
10290
10292 {
10293 return true;
10294 }
10295
10297
10299
10301 {
10304 }
10305
10306
10314
10330
10331 [
Obsolete(
"Use ItemSoundHandler instead")]
10334 {
10335 if (!
g_Game.IsDedicatedServer())
10336 {
10337 if (ConfigIsExisting("attachSoundSet"))
10338 {
10339 string cfg_path = "";
10340 string soundset = "";
10341 string type_name =
GetType();
10342
10345 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10346 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10347
10348 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10349 {
10350 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10351 {
10352 if (cfg_slot_array[i] == slot_type)
10353 {
10354 soundset = cfg_soundset_array[i];
10355 break;
10356 }
10357 }
10358 }
10359
10360 if (soundset != "")
10361 {
10362 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10364 }
10365 }
10366 }
10367 }
10368
10370}
10371
10373{
10375 if (entity)
10376 {
10377 bool is_item = entity.IsInherited(
ItemBase);
10378 if (is_item && full_quantity)
10379 {
10382 }
10383 }
10384 else
10385 {
10387 return NULL;
10388 }
10389 return entity;
10390}
10391
10393{
10394 if (item)
10395 {
10396 if (health > 0)
10397 item.SetHealth("", "", health);
10398
10399 if (item.CanHaveTemperature())
10400 {
10402 if (item.CanFreeze())
10403 item.SetFrozen(false);
10404 }
10405
10406 if (item.HasEnergyManager())
10407 {
10408 if (quantity >= 0)
10409 {
10410 item.GetCompEM().SetEnergy0To1(quantity);
10411 }
10412 else
10413 {
10415 }
10416 }
10417 else if (item.IsMagazine())
10418 {
10419 Magazine mag = Magazine.Cast(item);
10420 if (quantity >= 0)
10421 {
10422 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10423 }
10424 else
10425 {
10427 }
10428
10429 }
10430 else
10431 {
10432 if (quantity >= 0)
10433 {
10434 item.SetQuantityNormalized(quantity, false);
10435 }
10436 else
10437 {
10439 }
10440
10441 }
10442 }
10443}
10444
10445#ifdef DEVELOPER
10447#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.