5491{
5493 {
5494 return true;
5495 }
5496};
5497
5499{
5500
5501};
5502
5503
5504
5506{
5510
5512
5515
5516
5517
5518
5519
5528
5534
5539
5544
5565 protected bool m_IsResultOfSplit
5566
5568
5573
5574
5575
5577
5581
5582
5583
5585
5588
5589
5590
5596
5597
5605
5608
5609
5611
5612
5614
5615
5620
5621
5626
5628
5629
5631
5632
5634 {
5639
5640 if (!
g_Game.IsDedicatedServer())
5641 {
5643 {
5645
5647 {
5649 }
5650 }
5651
5654 }
5655
5656 m_OldLocation = null;
5657
5659 {
5661 }
5662
5663 if (ConfigIsExisting("headSelectionsToHide"))
5664 {
5667 }
5668
5670 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5671 {
5673 }
5674
5676
5677 m_IsResultOfSplit = false;
5678
5680 }
5681
5683 {
5684 super.InitItemVariables();
5685
5691 m_Count = ConfigGetInt(
"count");
5692
5695
5700
5703
5708
5720
5724
5725
5728 if (ConfigIsExisting("canBeSplit"))
5729 {
5732 }
5733
5735 if (ConfigIsExisting("itemBehaviour"))
5737
5738
5741 RegisterNetSyncVariableInt("m_VarLiquidType");
5742 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5743
5744 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5745 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5746 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5747
5748 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5749 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5750 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5751 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5752
5753 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5754 RegisterNetSyncVariableBool("m_IsTakeable");
5755 RegisterNetSyncVariableBool("m_IsHologram");
5756
5759 {
5762 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5763 }
5764
5766
5768 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5770
5772 }
5773
5775 {
5777 }
5778
5780 {
5783 {
5788 }
5789 }
5790
5791 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5792 {
5794 {
5797 }
5798
5800 }
5801
5803 {
5809 }
5810
5812
5814 {
5816
5817 if (!action)
5818 {
5819 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5820 return;
5821 }
5822
5824 if (!ai)
5825 {
5827 return;
5828 }
5829
5831 if (!action_array)
5832 {
5833 action_array = new array<ActionBase_Basic>;
5835 }
5836 if (LogManager.IsActionLogEnable())
5837 {
5838 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5839 }
5840
5841 if (action_array.Find(action) != -1)
5842 {
5843 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5844 }
5845 else
5846 {
5847 action_array.Insert(action);
5848 }
5849 }
5850
5852 {
5853 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5854 ActionBase action = player.GetActionManager().GetAction(actionName);
5857
5858 if (action_array)
5859 {
5860 action_array.RemoveItem(action);
5861 }
5862 }
5863
5864
5865
5867 {
5868 ActionOverrideData overrideData = new ActionOverrideData();
5872
5874 if (!actionMap)
5875 {
5878 }
5879
5880 actionMap.Insert(this.
Type(), overrideData);
5881
5882 }
5883
5885
5887
5888
5890 {
5893
5896
5897 string config_to_search = "CfgVehicles";
5898 string muzzle_owner_config;
5899
5901 {
5902 if (IsInherited(Weapon))
5903 config_to_search = "CfgWeapons";
5904
5905 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5906
5907 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5908
5909 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5910
5911 if (config_OnFire_subclass_count > 0)
5912 {
5913 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5914
5915 for (int i = 0; i < config_OnFire_subclass_count; i++)
5916 {
5917 string particle_class = "";
5918 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5919 string config_OnFire_entry = config_OnFire_class + particle_class;
5920 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5921 WPOF_array.Insert(WPOF);
5922 }
5923
5924
5926 }
5927 }
5928
5930 {
5931 config_to_search = "CfgWeapons";
5932 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5933
5934 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5935
5936 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5937
5938 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5939 {
5940 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5941
5942 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5943 {
5944 string particle_class2 = "";
5945 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5946 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5947 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5948 WPOBE_array.Insert(WPOBE);
5949 }
5950
5951
5953 }
5954 }
5955 }
5956
5957
5959 {
5962
5964 {
5965 string config_to_search = "CfgVehicles";
5966
5967 if (IsInherited(Weapon))
5968 config_to_search = "CfgWeapons";
5969
5970 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5971 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5972
5973 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5974 {
5975
5977
5979 {
5981 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5983 return;
5984 }
5985
5988
5989
5990
5991 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5992 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5993
5994 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5995 {
5996 string particle_class = "";
5997 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5998 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5999 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6000
6001 if (entry_type == CT_CLASS)
6002 {
6003 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6004 WPOOH_array.Insert(WPOF);
6005 }
6006 }
6007
6008
6010 }
6011 }
6012 }
6013
6015 {
6017 }
6018
6020 {
6022 {
6024
6027
6030
6031 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6032 }
6033 }
6034
6036 {
6038 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6039
6041 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6042
6044 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6045
6047 {
6049 }
6050 }
6051
6053 {
6055 }
6056
6058 {
6061 else
6063
6065 {
6068 }
6069 else
6070 {
6073
6076 }
6077
6079 }
6080
6082 {
6084 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6085 }
6086
6088 {
6090 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6092 }
6093
6095 {
6097 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6098 }
6099
6101 {
6104
6105 OverheatingParticle OP = new OverheatingParticle();
6110
6112 }
6113
6115 {
6118
6119 return -1;
6120 }
6121
6123 {
6125 {
6128
6129 for (int i = count; i > 0; --i)
6130 {
6131 int id = i - 1;
6134
6137
6138 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6139 {
6140 if (p)
6141 {
6144 }
6145 }
6146 }
6147 }
6148 }
6149
6151 {
6153 {
6155 {
6156 int id = i - 1;
6158
6159 if (OP)
6160 {
6162
6163 if (p)
6164 {
6166 }
6167
6168 delete OP;
6169 }
6170 }
6171
6174 }
6175 }
6176
6179 {
6180 return 0.0;
6181 }
6182
6183
6185 {
6186 return 250;
6187 }
6188
6190 {
6191 return 0;
6192 }
6193
6196 {
6198 return true;
6199
6200 return false;
6201 }
6202
6205 {
6208
6210 {
6212 }
6213 else
6214 {
6215
6217 }
6218
6220 }
6221
6228 {
6229 return -1;
6230 }
6231
6232
6233
6234
6236 {
6238 {
6239 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6240 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6241
6242 if (r_index >= 0)
6243 {
6244 InventoryLocation r_il = new InventoryLocation;
6245 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6246
6247 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6250 {
6251 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6252 }
6254 {
6255 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6256 }
6257
6258 }
6259
6260 player.GetHumanInventory().ClearUserReservedLocation(this);
6261 }
6262
6265 }
6266
6267
6268
6269
6271 {
6272 return ItemBase.m_DebugActionsMask;
6273 }
6274
6276 {
6277 return ItemBase.m_DebugActionsMask & mask;
6278 }
6279
6281 {
6282 ItemBase.m_DebugActionsMask = mask;
6283 }
6284
6286 {
6287 ItemBase.m_DebugActionsMask |= mask;
6288 }
6289
6291 {
6292 ItemBase.m_DebugActionsMask &= ~mask;
6293 }
6294
6296 {
6298 {
6300 }
6301 else
6302 {
6304 }
6305 }
6306
6307
6309 {
6310 if (GetEconomyProfile())
6311 {
6312 float q_max = GetEconomyProfile().GetQuantityMax();
6313 if (q_max > 0)
6314 {
6315 float q_min = GetEconomyProfile().GetQuantityMin();
6316 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6317
6319 {
6320 ComponentEnergyManager comp = GetCompEM();
6322 {
6324 }
6325 }
6327 {
6329
6330 }
6331
6332 }
6333 }
6334 }
6335
6338 {
6339 EntityAI parent = GetHierarchyParent();
6340
6341 if (parent)
6342 {
6343 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6344 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6345 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6346 }
6347 }
6348
6351 {
6352 EntityAI parent = GetHierarchyParent();
6353
6354 if (parent)
6355 {
6356 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6357 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6358 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6359 }
6360 }
6361
6363 {
6364
6365
6366
6367
6369
6371 {
6372 if (ScriptInputUserData.CanStoreInputUserData())
6373 {
6374 ScriptInputUserData ctx = new ScriptInputUserData;
6380 ctx.
Write(use_stack_max);
6383
6385 {
6386 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6387 }
6388 }
6389 }
6390 else if (!
g_Game.IsMultiplayer())
6391 {
6393 }
6394 }
6395
6397 {
6399 }
6400
6402 {
6404 }
6405
6407 {
6409 }
6410
6412 {
6413
6414 return false;
6415 }
6416
6418 {
6419 return false;
6420 }
6421
6425 {
6426 return false;
6427 }
6428
6430 {
6431 return "";
6432 }
6433
6435
6437 {
6438 return false;
6439 }
6440
6442 {
6443 return true;
6444 }
6445
6446
6447
6449 {
6450 return true;
6451 }
6452
6454 {
6455 return true;
6456 }
6457
6459 {
6460 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6462 }
6463
6465 {
6467 }
6468
6470 {
6472 if (!is_being_placed)
6474 SetSynchDirty();
6475 }
6476
6477
6479
6481 {
6483 }
6484
6486 {
6488 }
6489
6491 {
6492 return 1;
6493 }
6494
6496 {
6497 return false;
6498 }
6499
6501 {
6503 SetSynchDirty();
6504 }
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6541 {
6542 super.OnMovedInsideCargo(container);
6543
6544 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6545 }
6546
6547 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6548 {
6549 super.EEItemLocationChanged(oldLoc, newLoc);
6550
6551 PlayerBase newPlayer = null;
6552 PlayerBase oldPlayer = null;
6553
6554 if (newLoc.GetParent())
6555 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6556
6557 if (oldLoc.GetParent())
6558 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6559
6561 {
6562 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6563
6564 if (rIndex >= 0)
6565 {
6566 InventoryLocation rIl = new InventoryLocation;
6567 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6568
6569 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6572 {
6573 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6574 }
6576 {
6578 }
6579
6580 }
6581 }
6582
6584 {
6585 if (newPlayer)
6586 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6587
6588 if (newPlayer == oldPlayer)
6589 {
6590 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6591 {
6593 {
6594 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6595 {
6596 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6597 }
6598 }
6599 else
6600 {
6601 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6602 }
6603 }
6604
6605 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6606 {
6607 int type = oldLoc.GetType();
6609 {
6610 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6611 }
6613 {
6614 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6615 }
6616 }
6617 if (!m_OldLocation)
6618 {
6619 m_OldLocation = new InventoryLocation;
6620 }
6621 m_OldLocation.Copy(oldLoc);
6622 }
6623 else
6624 {
6625 if (m_OldLocation)
6626 {
6627 m_OldLocation.Reset();
6628 }
6629 }
6630
6631 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6632 }
6633 else
6634 {
6635 if (newPlayer)
6636 {
6637 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6638 if (resIndex >= 0)
6639 {
6640 InventoryLocation il = new InventoryLocation;
6641 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6643 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6646 {
6647 il.
GetParent().GetOnReleaseLock().Invoke(it);
6648 }
6650 {
6652 }
6653
6654 }
6655 }
6657 {
6658
6660 }
6661
6662 if (m_OldLocation)
6663 {
6664 m_OldLocation.Reset();
6665 }
6666 }
6667
6669 {
6670 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6671 }
6672
6674 {
6675 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6676 }
6677 }
6678
6679 override void EOnContact(IEntity other, Contact extra)
6680 {
6682 {
6683 int liquidType = -1;
6685 if (impactSpeed > 0.0)
6686 {
6688 #ifndef SERVER
6690 #else
6692 SetSynchDirty();
6693 #endif
6695 }
6696 }
6697
6698 #ifdef SERVER
6699 if (GetCompEM() && GetCompEM().IsPlugged())
6700 {
6701 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6702 GetCompEM().UnplugThis();
6703 }
6704 #endif
6705 }
6706
6708
6710 {
6712 }
6713
6715 {
6716
6717 }
6718
6720 {
6721 super.OnItemLocationChanged(old_owner, new_owner);
6722
6723 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6724 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6725
6726 if (!relatedPlayer && playerNew)
6727 relatedPlayer = playerNew;
6728
6729 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6730 {
6732 if (actionMgr)
6733 {
6734 ActionBase currentAction = actionMgr.GetRunningAction();
6735 if (currentAction)
6737 }
6738 }
6739
6740 Man ownerPlayerOld = null;
6741 Man ownerPlayerNew = null;
6742
6743 if (old_owner)
6744 {
6745 if (old_owner.
IsMan())
6746 {
6747 ownerPlayerOld = Man.Cast(old_owner);
6748 }
6749 else
6750 {
6751 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6752 }
6753 }
6754 else
6755 {
6757 {
6759
6760 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6761 {
6762 GetCompEM().UnplugThis();
6763 }
6764 }
6765 }
6766
6767 if (new_owner)
6768 {
6769 if (new_owner.
IsMan())
6770 {
6771 ownerPlayerNew = Man.Cast(new_owner);
6772 }
6773 else
6774 {
6775 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6776 }
6777 }
6778
6779 if (ownerPlayerOld != ownerPlayerNew)
6780 {
6781 if (ownerPlayerOld)
6782 {
6783 array<EntityAI> subItemsExit = new array<EntityAI>;
6785 for (int i = 0; i < subItemsExit.Count(); i++)
6786 {
6789 }
6790 }
6791
6792 if (ownerPlayerNew)
6793 {
6794 array<EntityAI> subItemsEnter = new array<EntityAI>;
6796 for (int j = 0; j < subItemsEnter.Count(); j++)
6797 {
6800 }
6801 }
6802 }
6803 else if (ownerPlayerNew != null)
6804 {
6805 PlayerBase nplayer;
6806 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6807 {
6808 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6810 for (int k = 0; k < subItemsUpdate.Count(); k++)
6811 {
6813 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6814 }
6815 }
6816 }
6817
6818 if (old_owner)
6819 old_owner.OnChildItemRemoved(this);
6820 if (new_owner)
6821 new_owner.OnChildItemReceived(this);
6822 }
6823
6824
6826 {
6827 super.EEDelete(parent);
6828 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6829 if (player)
6830 {
6832
6833 if (player.IsAlive())
6834 {
6835 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6836 if (r_index >= 0)
6837 {
6838 InventoryLocation r_il = new InventoryLocation;
6839 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6840
6841 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6844 {
6845 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6846 }
6848 {
6849 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6850 }
6851
6852 }
6853
6854 player.RemoveQuickBarEntityShortcut(this);
6855 }
6856 }
6857 }
6858
6860 {
6861 super.EEKilled(killer);
6862
6865 {
6866 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6867 {
6868 if (IsMagazine())
6869 {
6870 if (Magazine.Cast(this).GetAmmoCount() > 0)
6871 {
6873 }
6874 }
6875 else
6876 {
6878 }
6879 }
6880 }
6881 }
6882
6884 {
6885 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6886
6887 super.OnWasAttached(parent, slot_id);
6888
6891
6894 }
6895
6897 {
6898 super.OnWasDetached(parent, slot_id);
6899
6902
6905 }
6906
6908 {
6909 int idx;
6912
6913 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6914 if (inventory_slots.Count() < 1)
6915 {
6916 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6917 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6918 }
6919 else
6920 {
6921 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6922 }
6923
6924 idx = inventory_slots.Find(slot);
6925 if (idx < 0)
6926 return "";
6927
6928 return attach_types.Get(idx);
6929 }
6930
6932 {
6933 int idx = -1;
6934 string slot;
6935
6938
6939 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6940 if (inventory_slots.Count() < 1)
6941 {
6942 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6943 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6944 }
6945 else
6946 {
6947 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6948 if (detach_types.Count() < 1)
6949 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6950 }
6951
6952 for (int i = 0; i < inventory_slots.Count(); i++)
6953 {
6954 slot = inventory_slots.Get(i);
6955 }
6956
6957 if (slot != "")
6958 {
6959 if (detach_types.Count() == 1)
6960 idx = 0;
6961 else
6962 idx = inventory_slots.Find(slot);
6963 }
6964 if (idx < 0)
6965 return "";
6966
6967 return detach_types.Get(idx);
6968 }
6969
6971 {
6972
6974
6975
6976 float min_time = 1;
6977 float max_time = 3;
6978 float delay = Math.RandomFloat(min_time, max_time);
6979
6980 explode_timer.Run(delay, this, "DoAmmoExplosion");
6981 }
6982
6984 {
6985 Magazine magazine = Magazine.Cast(this);
6986 int pop_sounds_count = 6;
6987 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6988
6989
6990 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6991 string sound_name = pop_sounds[ sound_idx ];
6992 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6993
6994
6995 magazine.ServerAddAmmoCount(-1);
6996
6997
6998 float min_temp_to_explode = 100;
6999
7000 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7001 {
7003 }
7004 }
7005
7006
7007 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7008 {
7009 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7010
7011 const int CHANCE_DAMAGE_CARGO = 4;
7012 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7013 const int CHANCE_DAMAGE_NOTHING = 2;
7014
7016 {
7017 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7018 int chances;
7019 int rnd;
7020
7021 if (GetInventory().GetCargo())
7022 {
7023 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7024 rnd = Math.RandomInt(0,chances);
7025
7026 if (rnd < CHANCE_DAMAGE_CARGO)
7027 {
7029 }
7030 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7031 {
7033 }
7034 }
7035 else
7036 {
7037 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7038 rnd = Math.RandomInt(0,chances);
7039
7040 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7041 {
7043 }
7044 }
7045 }
7046 }
7047
7049 {
7050 CargoBase cargo = GetInventory().GetCargo();
7051 if (cargo)
7052 {
7054 if (item_count > 0)
7055 {
7056 int random_pick = Math.RandomInt(0, item_count);
7058 if (!item.IsExplosive())
7059 {
7060 item.AddHealth("","",damage);
7061 return true;
7062 }
7063 }
7064 }
7065 return false;
7066 }
7067
7069 {
7070 GameInventory inventory = GetInventory();
7072 if (attachment_count > 0)
7073 {
7074 int random_pick = Math.RandomInt(0, attachment_count);
7076 if (!attachment.IsExplosive())
7077 {
7078 attachment.AddHealth("","",damage);
7079 return true;
7080 }
7081 }
7082 return false;
7083 }
7084
7086 {
7088 }
7089
7091 {
7093 return GetInventory().CanRemoveEntity();
7094
7095 return false;
7096 }
7097
7099 {
7100
7102 return false;
7103
7104
7106 return false;
7107
7108
7109
7111 if (delta == 0)
7112 return false;
7113
7114
7115 return true;
7116 }
7117
7119 {
7121 {
7122 if (ScriptInputUserData.CanStoreInputUserData())
7123 {
7124 ScriptInputUserData ctx = new ScriptInputUserData;
7129 ctx.
Write(destination_entity);
7133 }
7134 }
7135 else if (!
g_Game.IsMultiplayer())
7136 {
7138 }
7139 }
7140
7142 {
7143 float split_quantity_new;
7147 InventoryLocation loc = new InventoryLocation;
7148
7149 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7150 {
7152 split_quantity_new = stack_max;
7153 else
7155
7157 {
7158 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7159 if (new_item)
7160 {
7161 new_item.SetResultOfSplit(true);
7162 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7164 new_item.
SetQuantity(split_quantity_new,
false,
true);
7165 }
7166 }
7167 }
7168 else if (destination_entity && slot_id == -1)
7169 {
7170 if (quantity > stack_max)
7171 split_quantity_new = stack_max;
7172 else
7173 split_quantity_new = quantity;
7174
7176 {
7177 GameInventory destinationInventory = destination_entity.GetInventory();
7179 {
7182 }
7183
7184 if (new_item)
7185 {
7186 new_item.SetResultOfSplit(true);
7187 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7189 new_item.
SetQuantity(split_quantity_new,
false,
true);
7190 }
7191 }
7192 }
7193 else
7194 {
7195 if (stack_max != 0)
7196 {
7198 {
7200 }
7201
7202 if (split_quantity_new == 0)
7203 {
7204 if (!
g_Game.IsMultiplayer())
7205 player.PhysicalPredictiveDropItem(this);
7206 else
7207 player.ServerDropEntity(this);
7208 return;
7209 }
7210
7212 {
7214
7215 if (new_item)
7216 {
7217 new_item.SetResultOfSplit(true);
7218 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7221 new_item.PlaceOnSurface();
7222 }
7223 }
7224 }
7225 }
7226 }
7227
7229 {
7230 float split_quantity_new;
7234 InventoryLocation loc = new InventoryLocation;
7235
7236 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7237 {
7239 split_quantity_new = stack_max;
7240 else
7242
7244 {
7245 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7246 if (new_item)
7247 {
7248 new_item.SetResultOfSplit(true);
7249 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7251 new_item.
SetQuantity(split_quantity_new,
false,
true);
7252 }
7253 }
7254 }
7255 else if (destination_entity && slot_id == -1)
7256 {
7257 if (quantity > stack_max)
7258 split_quantity_new = stack_max;
7259 else
7260 split_quantity_new = quantity;
7261
7263 {
7264 GameInventory destinationInventory = destination_entity.GetInventory();
7266 {
7269 }
7270
7271 if (new_item)
7272 {
7273 new_item.SetResultOfSplit(true);
7274 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7276 new_item.
SetQuantity(split_quantity_new,
false,
true);
7277 }
7278 }
7279 }
7280 else
7281 {
7282 if (stack_max != 0)
7283 {
7285 {
7287 }
7288
7290 {
7292
7293 if (new_item)
7294 {
7295 new_item.SetResultOfSplit(true);
7296 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7299 new_item.PlaceOnSurface();
7300 }
7301 }
7302 }
7303 }
7304 }
7305
7307 {
7309 {
7310 if (ScriptInputUserData.CanStoreInputUserData())
7311 {
7312 ScriptInputUserData ctx = new ScriptInputUserData;
7317 dst.WriteToContext(ctx);
7319 }
7320 }
7321 else if (!
g_Game.IsMultiplayer())
7322 {
7324 }
7325 }
7326
7328 {
7330 {
7331 if (ScriptInputUserData.CanStoreInputUserData())
7332 {
7333 ScriptInputUserData ctx = new ScriptInputUserData;
7338 ctx.
Write(destination_entity);
7344 }
7345 }
7346 else if (!
g_Game.IsMultiplayer())
7347 {
7349 }
7350 }
7351
7353 {
7355 }
7356
7358 {
7360 float split_quantity_new;
7362 if (dst.IsValid())
7363 {
7364 int slot_id = dst.GetSlot();
7366
7367 if (quantity > stack_max)
7368 split_quantity_new = stack_max;
7369 else
7370 split_quantity_new = quantity;
7371
7373 {
7375
7376 if (new_item)
7377 {
7378 new_item.SetResultOfSplit(true);
7379 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7381 new_item.
SetQuantity(split_quantity_new,
false,
true);
7382 }
7383
7384 return new_item;
7385 }
7386 }
7387
7388 return null;
7389 }
7390
7392 {
7394 float split_quantity_new;
7396 if (destination_entity)
7397 {
7399 if (quantity > stackable)
7400 split_quantity_new = stackable;
7401 else
7402 split_quantity_new = quantity;
7403
7405 {
7406 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7407 if (new_item)
7408 {
7409 new_item.SetResultOfSplit(true);
7410 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7412 new_item.
SetQuantity(split_quantity_new,
false,
true);
7413 }
7414 }
7415 }
7416 }
7417
7419 {
7421 {
7422 if (ScriptInputUserData.CanStoreInputUserData())
7423 {
7424 ScriptInputUserData ctx = new ScriptInputUserData;
7429 ItemBase destination_entity =
this;
7430 ctx.
Write(destination_entity);
7434 }
7435 }
7436 else if (!
g_Game.IsMultiplayer())
7437 {
7439 }
7440 }
7441
7443 {
7445 float split_quantity_new;
7447 if (player)
7448 {
7450 if (quantity > stackable)
7451 split_quantity_new = stackable;
7452 else
7453 split_quantity_new = quantity;
7454
7456 {
7457 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7458 new_item =
ItemBase.Cast(in_hands);
7459 if (new_item)
7460 {
7461 new_item.SetResultOfSplit(true);
7462 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7464 new_item.SetQuantity(split_quantity_new, false, true);
7465 }
7466 }
7467 }
7468 }
7469
7471 {
7473 float split_quantity_new = Math.Floor(quantity * 0.5);
7474
7476 return;
7477
7479
7480 if (new_item)
7481 {
7482 if (new_item.GetQuantityMax() < split_quantity_new)
7483 {
7484 split_quantity_new = new_item.GetQuantityMax();
7485 }
7486
7487 new_item.SetResultOfSplit(true);
7488 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7489
7491 {
7494 }
7495 else
7496 {
7498 new_item.
SetQuantity(split_quantity_new,
false,
true);
7499 }
7500 }
7501 }
7502
7504 {
7506 float split_quantity_new = Math.Floor(quantity / 2);
7507
7509 return;
7510
7511 InventoryLocation invloc = new InventoryLocation;
7513
7515 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7516
7517 if (new_item)
7518 {
7519 if (new_item.GetQuantityMax() < split_quantity_new)
7520 {
7521 split_quantity_new = new_item.GetQuantityMax();
7522 }
7524 {
7527 }
7528 else if (split_quantity_new > 1)
7529 {
7531 new_item.
SetQuantity(split_quantity_new,
false,
true);
7532 }
7533 }
7534 }
7535
7538 {
7539 SetWeightDirty();
7541
7542 if (parent)
7543 parent.OnAttachmentQuantityChangedEx(this, delta);
7544
7546 {
7548 {
7550 }
7552 {
7553 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7555 }
7556 }
7557 }
7558
7561 {
7562
7563 }
7564
7567 {
7569 }
7570
7572 {
7573 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7574
7576 {
7577 if (newLevel == GameConstants.STATE_RUINED)
7578 {
7580 EntityAI parent = GetHierarchyParent();
7581 if (parent && parent.IsFireplace())
7582 {
7583 CargoBase cargo = GetInventory().GetCargo();
7584 if (cargo)
7585 {
7587 {
7589 }
7590 }
7591 }
7592 }
7593
7595 {
7596
7598 return;
7599 }
7600
7601 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7602 {
7604 }
7605 }
7606 }
7607
7608
7610 {
7611 super.OnRightClick();
7612
7614 {
7616 {
7617 if (ScriptInputUserData.CanStoreInputUserData())
7618 {
7619 EntityAI root = GetHierarchyRoot();
7620 Man playerOwner = GetHierarchyRootPlayer();
7621 InventoryLocation dst = new InventoryLocation;
7622
7623
7624 if (!playerOwner && root && root == this)
7625 {
7627 }
7628 else
7629 {
7630
7631 GetInventory().GetCurrentInventoryLocation(dst);
7633 {
7634 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7636 {
7638 }
7639 else
7640 {
7642
7643
7644 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7645 {
7647 }
7648 else
7649 {
7650 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7651 }
7652 }
7653 }
7654 }
7655
7656 ScriptInputUserData ctx = new ScriptInputUserData;
7664 }
7665 }
7666 else if (!
g_Game.IsMultiplayer())
7667 {
7669 }
7670 }
7671 }
7672
7674 {
7675 if (root)
7676 {
7677 vector m4[4];
7678 root.GetTransform(m4);
7679 dst.SetGround(this, m4);
7680 }
7681 else
7682 {
7683 GetInventory().GetCurrentInventoryLocation(dst);
7684 }
7685 }
7686
7687 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7688 {
7689
7690 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7691 return false;
7692
7693 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7694 return false;
7695
7696
7698 return false;
7699
7700
7701 Magazine mag = Magazine.Cast(this);
7702 if (mag)
7703 {
7704 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7705 return false;
7706
7707 if (stack_max_limit)
7708 {
7709 Magazine other_mag = Magazine.Cast(other_item);
7710 if (other_item)
7711 {
7712 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7713 return false;
7714 }
7715
7716 }
7717 }
7718 else
7719 {
7720
7722 return false;
7723
7725 return false;
7726 }
7727
7728 PlayerBase player = null;
7729 if (CastTo(player, GetHierarchyRootPlayer()))
7730 {
7731 if (player.GetInventory().HasAttachment(this))
7732 return false;
7733
7734 if (player.IsItemsToDelete())
7735 return false;
7736 }
7737
7738 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7739 return false;
7740
7741 int slotID;
7743 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7744 return false;
7745
7746 return true;
7747 }
7748
7750 {
7752 }
7753
7755 {
7756 return m_IsResultOfSplit;
7757 }
7758
7760 {
7761 m_IsResultOfSplit = value;
7762 }
7763
7765 {
7767 }
7768
7770 {
7771 float other_item_quantity = other_item.GetQuantity();
7772 float this_free_space;
7773
7775
7777
7778 if (other_item_quantity > this_free_space)
7779 {
7780 return this_free_space;
7781 }
7782 else
7783 {
7784 return other_item_quantity;
7785 }
7786 }
7787
7789 {
7791 }
7792
7794 {
7796 return;
7797
7798 if (!IsMagazine() && other_item)
7799 {
7801 if (quantity_used != 0)
7802 {
7803 float hp1 = GetHealth01("","");
7804 float hp2 = other_item.GetHealth01("","");
7805 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7806 hpResult = hpResult / (
GetQuantity() + quantity_used);
7807
7808 hpResult *= GetMaxHealth();
7809 Math.Round(hpResult);
7810 SetHealth("", "Health", hpResult);
7811
7813 other_item.AddQuantity(-quantity_used);
7814 }
7815 }
7817 }
7818
7820 {
7821 #ifdef SERVER
7822 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7823 GetHierarchyParent().IncreaseLifetimeUp();
7824 #endif
7825 };
7826
7828 {
7829 PlayerBase p = PlayerBase.Cast(player);
7830
7831 array<int> recipesIds = p.m_Recipes;
7832 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7833 if (moduleRecipesManager)
7834 {
7835 EntityAI itemInHands = player.GetEntityInHands();
7836 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7837 }
7838
7839 for (int i = 0;i < recipesIds.Count(); i++)
7840 {
7841 int key = recipesIds.Get(i);
7842 string recipeName = moduleRecipesManager.GetRecipeName(key);
7844 }
7845 }
7846
7847
7848 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7849 {
7850 super.GetDebugActions(outputList);
7851
7852
7858
7859
7864
7869
7870
7874
7875
7877 {
7881 }
7882
7885
7886
7890
7892
7893 InventoryLocation loc = new InventoryLocation();
7894 GetInventory().GetCurrentInventoryLocation(loc);
7896 {
7897 if (Gizmo_IsSupported())
7900 }
7901
7903 }
7904
7905
7906
7907
7909 {
7910 super.OnAction(action_id, player, ctx);
7911
7913 {
7914 switch (action_id)
7915 {
7919 return true;
7923 return true;
7924 }
7925 }
7926
7928 {
7929 switch (action_id)
7930 {
7932 Delete();
7933 return true;
7934 }
7935 }
7936
7937 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7938 {
7939 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7940 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7941 PlayerBase p = PlayerBase.Cast(player);
7942 if (
EActions.RECIPES_RANGE_START < 1000)
7943 {
7944 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7945 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7946 }
7947 }
7948 #ifndef SERVER
7949 else if (action_id ==
EActions.WATCH_PLAYER)
7950 {
7951 PluginDeveloper.SetDeveloperItemClientEx(player);
7952 }
7953 #endif
7955 {
7956 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7957 {
7958 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7959 OnDebugButtonPressServer(id + 1);
7960 }
7961
7962 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7963 {
7964 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7966 }
7967
7968 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7969 {
7970 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7972 }
7973
7974 else if (action_id ==
EActions.ADD_QUANTITY)
7975 {
7976 if (IsMagazine())
7977 {
7978 Magazine mag = Magazine.Cast(this);
7979 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7980 }
7981 else
7982 {
7984 }
7985
7986 if (m_EM)
7987 {
7988 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7989 }
7990
7991 }
7992
7993 else if (action_id ==
EActions.REMOVE_QUANTITY)
7994 {
7995 if (IsMagazine())
7996 {
7997 Magazine mag2 = Magazine.Cast(this);
7998 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7999 }
8000 else
8001 {
8003 }
8004 if (m_EM)
8005 {
8006 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8007 }
8008
8009 }
8010
8011 else if (action_id ==
EActions.SET_QUANTITY_0)
8012 {
8014
8015 if (m_EM)
8016 {
8017 m_EM.SetEnergy(0);
8018 }
8019 }
8020
8021 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8022 {
8024
8025 if (m_EM)
8026 {
8027 m_EM.SetEnergy(m_EM.GetEnergyMax());
8028 }
8029 }
8030
8031 else if (action_id ==
EActions.ADD_HEALTH)
8032 {
8033 AddHealth("","",GetMaxHealth("","Health")/5);
8034 }
8035 else if (action_id ==
EActions.REMOVE_HEALTH)
8036 {
8037 AddHealth("","",-GetMaxHealth("","Health")/5);
8038 }
8039 else if (action_id ==
EActions.DESTROY_HEALTH)
8040 {
8041 SetHealth01("","",0);
8042 }
8043 else if (action_id ==
EActions.WATCH_ITEM)
8044 {
8046 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8047 #ifdef DEVELOPER
8048 SetDebugDeveloper_item(this);
8049 #endif
8050 }
8051
8052 else if (action_id ==
EActions.ADD_TEMPERATURE)
8053 {
8054 AddTemperature(20);
8055
8056 }
8057
8058 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8059 {
8060 AddTemperature(-20);
8061
8062 }
8063
8064 else if (action_id ==
EActions.FLIP_FROZEN)
8065 {
8066 SetFrozen(!GetIsFrozen());
8067
8068 }
8069
8070 else if (action_id ==
EActions.ADD_WETNESS)
8071 {
8073
8074 }
8075
8076 else if (action_id ==
EActions.REMOVE_WETNESS)
8077 {
8079
8080 }
8081
8082 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8083 {
8086
8087
8088 }
8089
8090 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8091 {
8094 }
8095
8096 else if (action_id ==
EActions.MAKE_SPECIAL)
8097 {
8098 auto debugParams = DebugSpawnParams.WithPlayer(player);
8099 OnDebugSpawnEx(debugParams);
8100 }
8101
8102 }
8103
8104
8105 return false;
8106 }
8107
8108
8109
8110
8114
8117
8118
8119
8121 {
8122 return false;
8123 }
8124
8125
8127 {
8128 return true;
8129 }
8130
8131
8133 {
8134 return true;
8135 }
8136
8137
8138
8140 {
8141 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8142 return g_Game.ConfigIsExisting(config_path);
8143 }
8144
8147 {
8148 return null;
8149 }
8150
8152 {
8153 return false;
8154 }
8155
8157 {
8158 return false;
8159 }
8160
8164
8165
8167 {
8168 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8169 return module_repairing.CanRepair(this, item_repair_kit);
8170 }
8171
8172
8173 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8174 {
8175 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8176 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8177 }
8178
8179
8181 {
8182
8183
8184
8185
8186
8187
8188
8189
8190 return 1;
8191 }
8192
8193
8194
8196 {
8198 }
8199
8200
8201
8203 {
8205 }
8206
8207
8216 {
8217 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8218
8219 if (player)
8220 {
8221 player.MessageStatus(text);
8222 }
8223 }
8224
8225
8234 {
8235 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8236
8237 if (player)
8238 {
8239 player.MessageAction(text);
8240 }
8241 }
8242
8243
8252 {
8253 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8254
8255 if (player)
8256 {
8257 player.MessageFriendly(text);
8258 }
8259 }
8260
8261
8270 {
8271 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8272
8273 if (player)
8274 {
8275 player.MessageImportant(text);
8276 }
8277 }
8278
8280 {
8281 return true;
8282 }
8283
8284
8285 override bool KindOf(
string tag)
8286 {
8287 bool found = false;
8288 string item_name = this.
GetType();
8290 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8291
8292 int array_size = item_tag_array.Count();
8293 for (int i = 0; i < array_size; i++)
8294 {
8295 if (item_tag_array.Get(i) == tag)
8296 {
8297 found = true;
8298 break;
8299 }
8300 }
8301 return found;
8302 }
8303
8304
8306 {
8307
8308 super.OnRPC(sender, rpc_type,ctx);
8309
8310
8311 switch (rpc_type)
8312 {
8313 #ifndef SERVER
8314 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8315 Param2<bool, string> p = new Param2<bool, string>(false, "");
8316
8318 return;
8319
8320 bool play = p.param1;
8321 string soundSet = p.param2;
8322
8323 if (play)
8324 {
8326 {
8328 {
8330 }
8331 }
8332 else
8333 {
8335 }
8336 }
8337 else
8338 {
8340 }
8341
8342 break;
8343 #endif
8344
8345 }
8346
8348 {
8350 }
8351 }
8352
8353
8354
8355
8357 {
8358 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8359 return plugin.GetID(
name);
8360 }
8361
8363 {
8364 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8365 return plugin.GetName(id);
8366 }
8367
8370 {
8371
8372
8373 int varFlags;
8374 if (!ctx.
Read(varFlags))
8375 return;
8376
8377 if (varFlags & ItemVariableFlags.FLOAT)
8378 {
8380 }
8381 }
8382
8384 {
8385
8386 super.SerializeNumericalVars(floats_out);
8387
8388
8389
8391 {
8393 }
8394
8396 {
8398 }
8399
8401 {
8403 }
8404
8406 {
8411 }
8412
8414 {
8416 }
8417 }
8418
8420 {
8421
8422 super.DeSerializeNumericalVars(floats);
8423
8424
8425 int index = 0;
8426 int mask = Math.Round(floats.Get(index));
8427
8428 index++;
8429
8431 {
8433 {
8435 }
8436 else
8437 {
8438 float quantity = floats.Get(index);
8440 }
8441 index++;
8442 }
8443
8445 {
8446 float wet = floats.Get(index);
8448 index++;
8449 }
8450
8452 {
8453 int liquidtype = Math.Round(floats.Get(index));
8455 index++;
8456 }
8457
8459 {
8461 index++;
8463 index++;
8465 index++;
8467 index++;
8468 }
8469
8471 {
8472 int cleanness = Math.Round(floats.Get(index));
8474 index++;
8475 }
8476 }
8477
8479 {
8480 super.WriteVarsToCTX(ctx);
8481
8482
8484 {
8486 }
8487
8489 {
8491 }
8492
8494 {
8496 }
8497
8499 {
8500 int r,g,b,a;
8506 }
8507
8509 {
8511 }
8512 }
8513
8515 {
8516 if (!super.ReadVarsFromCTX(ctx,version))
8517 return false;
8518
8519 int intValue;
8520 float value;
8521
8522 if (version < 140)
8523 {
8524 if (!ctx.
Read(intValue))
8525 return false;
8526
8527 m_VariablesMask = intValue;
8528 }
8529
8531 {
8532 if (!ctx.
Read(value))
8533 return false;
8534
8536 {
8538 }
8539 else
8540 {
8542 }
8543 }
8544
8545 if (version < 140)
8546 {
8548 {
8549 if (!ctx.
Read(value))
8550 return false;
8551 SetTemperatureDirect(value);
8552 }
8553 }
8554
8556 {
8557 if (!ctx.
Read(value))
8558 return false;
8560 }
8561
8563 {
8564 if (!ctx.
Read(intValue))
8565 return false;
8567 }
8568
8570 {
8571 int r,g,b,a;
8573 return false;
8575 return false;
8577 return false;
8579 return false;
8580
8582 }
8583
8585 {
8586 if (!ctx.
Read(intValue))
8587 return false;
8589 }
8590
8591 if (version >= 138 && version < 140)
8592 {
8594 {
8595 if (!ctx.
Read(intValue))
8596 return false;
8597 SetFrozen(intValue);
8598 }
8599 }
8600
8601 return true;
8602 }
8603
8604
8606 {
8609 {
8611 }
8612
8613 if (!super.OnStoreLoad(ctx, version))
8614 {
8616 return false;
8617 }
8618
8619 if (version >= 114)
8620 {
8621 bool hasQuickBarIndexSaved;
8622
8623 if (!ctx.
Read(hasQuickBarIndexSaved))
8624 {
8626 return false;
8627 }
8628
8629 if (hasQuickBarIndexSaved)
8630 {
8631 int itmQBIndex;
8632
8633
8634 if (!ctx.
Read(itmQBIndex))
8635 {
8637 return false;
8638 }
8639
8640 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8641 if (itmQBIndex != -1 && parentPlayer)
8642 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8643 }
8644 }
8645 else
8646 {
8647
8648 PlayerBase player;
8649 int itemQBIndex;
8650 if (version ==
int.
MAX)
8651 {
8652 if (!ctx.
Read(itemQBIndex))
8653 {
8655 return false;
8656 }
8657 }
8658 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8659 {
8660
8661 if (!ctx.
Read(itemQBIndex))
8662 {
8664 return false;
8665 }
8666 if (itemQBIndex != -1 && player)
8667 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8668 }
8669 }
8670
8671 if (version < 140)
8672 {
8673
8674 if (!LoadVariables(ctx, version))
8675 {
8677 return false;
8678 }
8679 }
8680
8681
8683 {
8685 return false;
8686 }
8687 if (version >= 132)
8688 {
8690 if (raib)
8691 {
8693 {
8695 return false;
8696 }
8697 }
8698 }
8699
8701 return true;
8702 }
8703
8704
8705
8707 {
8708 super.OnStoreSave(ctx);
8709
8710 PlayerBase player;
8711 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8712 {
8714
8715 int itemQBIndex = -1;
8716 itemQBIndex = player.FindQuickBarEntityIndex(this);
8717 ctx.
Write(itemQBIndex);
8718 }
8719 else
8720 {
8722 }
8723
8725
8727 if (raib)
8728 {
8730 }
8731 }
8732
8733
8735 {
8736 super.AfterStoreLoad();
8737
8739 {
8741 }
8742
8744 {
8747 }
8748 }
8749
8751 {
8752 super.EEOnAfterLoad();
8753
8755 {
8757 }
8758
8761 }
8762
8764 {
8765 return false;
8766 }
8767
8768
8769
8771 {
8773 {
8774 #ifdef PLATFORM_CONSOLE
8775
8777 {
8779 if (menu)
8780 {
8782 }
8783 }
8784 #endif
8785 }
8786
8788 {
8791 }
8792
8794 {
8795 SetWeightDirty();
8797 }
8799 {
8802 }
8803
8805 {
8808
8811 }
8813 {
8817 }
8818
8819 super.OnVariablesSynchronized();
8820 }
8821
8822
8823
8825 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8826 {
8827 if (!IsServerCheck(allow_client))
8828 return false;
8829
8831 return false;
8832
8835
8836 if (value <= (min + 0.001))
8837 value = min;
8838
8839 if (value == min)
8840 {
8841 if (destroy_config)
8842 {
8843 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8844 if (dstr)
8845 {
8847 this.Delete();
8848 return true;
8849 }
8850 }
8851 else if (destroy_forced)
8852 {
8854 this.Delete();
8855 return true;
8856 }
8857
8859 }
8860
8863
8865 {
8866 EntityAI parent = GetHierarchyRoot();
8867 InventoryLocation iLoc = new InventoryLocation();
8868 GetInventory().GetCurrentInventoryLocation(iLoc);
8870 {
8871 int iLocSlot = iLoc.
GetSlot();
8873 {
8875 }
8877 {
8879 }
8880 }
8881 }
8882
8884 {
8886
8887 if (delta)
8889 }
8890
8892
8893 return false;
8894 }
8895
8896
8898 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8899 {
8901 }
8902
8904 {
8907 }
8908
8910 {
8913 }
8914
8916 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8917 {
8918 float value_clamped = Math.Clamp(value, 0, 1);
8920 SetQuantity(result, destroy_config, destroy_forced);
8921 }
8922
8923
8926 {
8928 }
8929
8931 {
8933 }
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8945 {
8946 int slot = -1;
8947 GameInventory inventory = GetInventory();
8948 if (inventory)
8949 {
8950 InventoryLocation il = new InventoryLocation;
8953 }
8954
8956 }
8957
8959 {
8960 float quantity_max = 0;
8961
8963 {
8964 if (attSlotID != -1)
8965 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8966
8967 if (quantity_max <= 0)
8969 }
8970
8971 if (quantity_max <= 0)
8973
8974 return quantity_max;
8975 }
8976
8978 {
8980 }
8981
8983 {
8985 }
8986
8987
8989 {
8991 }
8992
8994 {
8996 }
8997
8999 {
9001 }
9002
9003
9005 {
9006
9007 float weightEx = GetWeightEx();
9008 float special = GetInventoryAndCargoWeight();
9009 return weightEx - special;
9010 }
9011
9012
9014 {
9016 }
9017
9019 {
9021 {
9022 #ifdef DEVELOPER
9023 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9024 {
9025 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9027 }
9028 #endif
9029
9031 }
9032 else if (HasEnergyManager())
9033 {
9034 #ifdef DEVELOPER
9035 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9036 {
9037 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9038 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9039 }
9040 #endif
9041 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9042 }
9043 else
9044 {
9045 #ifdef DEVELOPER
9046 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9047 {
9048 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9049 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9050 }
9051 #endif
9052 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9053 }
9054 }
9055
9058 {
9059 int item_count = 0;
9061
9062 GameInventory inventory = GetInventory();
9063 CargoBase cargo = inventory.
GetCargo();
9064 if (cargo != NULL)
9065 {
9067 }
9068
9070 for (int i = 0; i < nAttachments; ++i)
9071 {
9073 if (item)
9074 item_count += item.GetNumberOfItems();
9075 }
9076 return item_count;
9077 }
9078
9081 {
9082 float weight = 0;
9083 float wetness = 1;
9084 if (include_wetness)
9087 {
9088 weight = wetness * m_ConfigWeight;
9089 }
9091 {
9092 weight = 1;
9093 }
9094 return weight;
9095 }
9096
9097
9098
9100 {
9101 GameInventory inventory = GetInventory();
9102 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9103 {
9104 array<EntityAI> items = new array<EntityAI>;
9106 for (int i = 0; i < items.Count(); ++i)
9107 {
9109 if (item)
9110 {
9111 g_Game.ObjectDelete(item);
9112 }
9113 }
9114 }
9115 }
9116
9117
9118
9119
9121 {
9122 float energy = 0;
9123 if (HasEnergyManager())
9124 {
9125 energy = GetCompEM().GetEnergy();
9126 }
9127 return energy;
9128 }
9129
9130
9132 {
9133 super.OnEnergyConsumed();
9134
9136 }
9137
9139 {
9140 super.OnEnergyAdded();
9141
9143 }
9144
9145
9147 {
9148 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9149 {
9151 {
9152 float energy_0to1 = GetCompEM().GetEnergy0To1();
9154 }
9155 }
9156 }
9157
9158
9160 {
9161 return ConfigGetFloat("heatIsolation");
9162 }
9163
9165 {
9167 }
9168
9170 {
9171 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9172 if (
g_Game.ConfigIsExisting(paramPath))
9173 return g_Game.ConfigGetFloat(paramPath);
9174
9175 return 0.0;
9176 }
9177
9179 {
9180 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9181 if (
g_Game.ConfigIsExisting(paramPath))
9182 return g_Game.ConfigGetFloat(paramPath);
9183
9184 return 0.0;
9185 }
9186
9187 override void SetWet(
float value,
bool allow_client =
false)
9188 {
9189 if (!IsServerCheck(allow_client))
9190 return;
9191
9194
9196
9197 m_VarWet = Math.Clamp(value, min, max);
9198
9200 {
9203 }
9204 }
9205
9206 override void AddWet(
float value)
9207 {
9209 }
9210
9212 {
9214 }
9215
9217 {
9219 }
9220
9222 {
9224 }
9225
9227 {
9229 }
9230
9232 {
9234 }
9235
9237 {
9240 if (newLevel != oldLevel)
9241 {
9243 }
9244 }
9245
9247 {
9248 SetWeightDirty();
9249 }
9250
9252 {
9253 return GetWetLevelInternal(
m_VarWet);
9254 }
9255
9256
9257
9259 {
9261 }
9262
9264 {
9266 }
9267
9269 {
9271 }
9272
9274 {
9276 }
9277
9278
9279
9281 {
9282 if (ConfigIsExisting("itemModelLength"))
9283 {
9284 return ConfigGetFloat("itemModelLength");
9285 }
9286 return 0;
9287 }
9288
9290 {
9291 if (ConfigIsExisting("itemAttachOffset"))
9292 {
9293 return ConfigGetFloat("itemAttachOffset");
9294 }
9295 return 0;
9296 }
9297
9298 override void SetCleanness(
int value,
bool allow_client =
false)
9299 {
9300 if (!IsServerCheck(allow_client))
9301 return;
9302
9304
9306
9309 }
9310
9312 {
9314 }
9315
9317 {
9318 return true;
9319 }
9320
9321
9322
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9334
9335
9336
9337 override void SetColor(
int r,
int g,
int b,
int a)
9338 {
9344 }
9346 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9347 {
9352 }
9353
9355 {
9357 }
9358
9361 {
9362 int r,g,b,a;
9364 r = r/255;
9365 g = g/255;
9366 b = b/255;
9367 a = a/255;
9368 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9369 }
9370
9371
9372
9373 override void SetLiquidType(
int value,
bool allow_client =
false)
9374 {
9375 if (!IsServerCheck(allow_client))
9376 return;
9377
9382 }
9383
9385 {
9386 return ConfigGetInt("varLiquidTypeInit");
9387 }
9388
9390 {
9392 }
9393
9395 {
9397 SetFrozen(false);
9398 }
9399
9402 {
9403 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9404 }
9405
9406
9409 {
9410 PlayerBase nplayer;
9411 if (PlayerBase.CastTo(nplayer, player))
9412 {
9414 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9415 }
9416 }
9417
9418
9421 {
9422 PlayerBase nplayer;
9423 if (PlayerBase.CastTo(nplayer,player))
9424 {
9425 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9426 }
9427
9428 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9429
9430 if (HasEnergyManager())
9431 {
9432 GetCompEM().UpdatePlugState();
9433 }
9434 }
9435
9436
9438 {
9439 super.OnPlacementStarted(player);
9440
9442 }
9443
9444 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9445 {
9447 {
9448 m_AdminLog.OnPlacementComplete(player,
this);
9449 }
9450
9451 super.OnPlacementComplete(player, position, orientation);
9452 }
9453
9454
9455
9456
9457
9459 {
9461 {
9462 return true;
9463 }
9464 else
9465 {
9466 return false;
9467 }
9468 }
9469
9470
9472 {
9474 {
9476 }
9477 }
9478
9479
9481 {
9483 }
9484
9486 {
9488 }
9489
9490 override void InsertAgent(
int agent,
float count = 1)
9491 {
9492 if (count < 1)
9493 return;
9494
9496 }
9497
9500 {
9502 }
9503
9504
9506 {
9508 }
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
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
9552 {
9554 return false;
9555 return true;
9556 }
9557
9559 {
9560
9562 }
9563
9564
9567 {
9568 super.CheckForRoofLimited(timeTresholdMS);
9569
9570 float time =
g_Game.GetTime();
9571 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9572 {
9573 m_PreviousRoofTestTime = time;
9574 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9575 }
9576 }
9577
9578
9580 {
9582 {
9583 return 0;
9584 }
9585
9586 if (GetInventory().GetAttachmentSlotsCount() != 0)
9587 {
9588 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9589 if (filter)
9590 return filter.GetProtectionLevel(type, false, system);
9591 else
9592 return 0;
9593 }
9594
9595 string subclassPath, entryName;
9596
9597 switch (type)
9598 {
9600 entryName = "biological";
9601 break;
9603 entryName = "chemical";
9604 break;
9605 default:
9606 entryName = "biological";
9607 break;
9608 }
9609
9610 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9611
9612 return g_Game.ConfigGetFloat(subclassPath + entryName);
9613 }
9614
9615
9616
9619 {
9620 if (!IsMagazine())
9622
9624 }
9625
9626
9627
9628
9629
9634 {
9635 return true;
9636 }
9637
9639 {
9641 }
9642
9643
9644
9645
9646
9648 {
9649 if (parent)
9650 {
9651 if (parent.IsInherited(DayZInfected))
9652 return true;
9653
9654 if (!parent.IsRuined())
9655 return true;
9656 }
9657
9658 return true;
9659 }
9660
9662 {
9663 if (!super.CanPutAsAttachment(parent))
9664 {
9665 return false;
9666 }
9667
9668 if (!IsRuined() && !parent.IsRuined())
9669 {
9670 return true;
9671 }
9672
9673 return false;
9674 }
9675
9677 {
9678
9679
9680
9681
9682 return super.CanReceiveItemIntoCargo(item);
9683 }
9684
9686 {
9687
9688
9689
9690
9691 GameInventory attachmentInv = attachment.GetInventory();
9693 {
9694 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9695 return false;
9696 }
9697
9698 InventoryLocation loc = new InventoryLocation();
9699 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9700 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9701 return false;
9702
9703 return super.CanReceiveAttachment(attachment, slotId);
9704 }
9705
9707 {
9708 if (!super.CanReleaseAttachment(attachment))
9709 return false;
9710
9711 return GetInventory().AreChildrenAccessible();
9712 }
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9735 {
9736 int id = muzzle_owner.GetMuzzleID();
9737 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9738
9739 if (WPOF_array)
9740 {
9741 for (int i = 0; i < WPOF_array.Count(); i++)
9742 {
9743 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9744
9745 if (WPOF)
9746 {
9747 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9748 }
9749 }
9750 }
9751 }
9752
9753
9755 {
9756 int id = muzzle_owner.GetMuzzleID();
9758
9759 if (WPOBE_array)
9760 {
9761 for (int i = 0; i < WPOBE_array.Count(); i++)
9762 {
9763 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9764
9765 if (WPOBE)
9766 {
9767 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9768 }
9769 }
9770 }
9771 }
9772
9773
9775 {
9776 int id = muzzle_owner.GetMuzzleID();
9777 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9778
9779 if (WPOOH_array)
9780 {
9781 for (int i = 0; i < WPOOH_array.Count(); i++)
9782 {
9783 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9784
9785 if (WPOOH)
9786 {
9787 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9788 }
9789 }
9790 }
9791 }
9792
9793
9795 {
9796 int id = muzzle_owner.GetMuzzleID();
9797 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9798
9799 if (WPOOH_array)
9800 {
9801 for (int i = 0; i < WPOOH_array.Count(); i++)
9802 {
9803 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9804
9805 if (WPOOH)
9806 {
9807 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9808 }
9809 }
9810 }
9811 }
9812
9813
9815 {
9816 int id = muzzle_owner.GetMuzzleID();
9817 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9818
9819 if (WPOOH_array)
9820 {
9821 for (int i = 0; i < WPOOH_array.Count(); i++)
9822 {
9823 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9824
9825 if (WPOOH)
9826 {
9827 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9828 }
9829 }
9830 }
9831 }
9832
9833
9834
9836 {
9838 {
9839 return true;
9840 }
9841
9842 return false;
9843 }
9844
9846 {
9848 {
9849 return true;
9850 }
9851
9852 return false;
9853 }
9854
9856 {
9858 {
9859 return true;
9860 }
9861
9862 return false;
9863 }
9864
9866 {
9867 return false;
9868 }
9869
9872 {
9873 return UATimeSpent.DEFAULT_DEPLOY;
9874 }
9875
9876
9877
9878
9880 {
9882 SetSynchDirty();
9883 }
9884
9886 {
9888 }
9889
9890
9892 {
9893 return false;
9894 }
9895
9898 {
9899 string att_type = "None";
9900
9901 if (ConfigIsExisting("soundAttType"))
9902 {
9903 att_type = ConfigGetString("soundAttType");
9904 }
9905
9907 }
9908
9910 {
9912 }
9913
9914
9915
9916
9917
9923
9925 {
9928
9930 }
9931
9932
9934 {
9936 return;
9937
9939
9942
9945
9946 SoundParameters params = new SoundParameters();
9950 }
9951
9952
9954 {
9956 {
9959
9960 SetSynchDirty();
9961
9964 }
9965 }
9966
9968 {
9970 }
9971
9972
9974 {
9976 return;
9977
9979 SetSynchDirty();
9980
9983 }
9984
9986 {
9989 }
9990
9992 {
9994 }
9995
9996 void OnApply(PlayerBase player);
9997
9999 {
10000 return 1.0;
10001 };
10002
10004 {
10006 }
10007
10009 {
10011 }
10012
10014
10016 {
10017 SetDynamicPhysicsLifeTime(0.01);
10019 }
10020
10022 {
10023 array<string> zone_names = new array<string>;
10024 GetDamageZones(zone_names);
10025 for (int i = 0; i < zone_names.Count(); i++)
10026 {
10027 SetHealthMax(zone_names.Get(i),"Health");
10028 }
10029 SetHealthMax("","Health");
10030 }
10031
10034 {
10035 float global_health = GetHealth01("","Health");
10036 array<string> zones = new array<string>;
10037 GetDamageZones(zones);
10038
10039 for (int i = 0; i < zones.Count(); i++)
10040 {
10041 SetHealth01(zones.Get(i),"Health",global_health);
10042 }
10043 }
10044
10047 {
10048 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10049 }
10050
10052 {
10053 if (!hasRootAsPlayer)
10054 {
10055 if (refParentIB)
10056 {
10057
10058 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10059 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10060
10061 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10062 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10063
10066 }
10067 else
10068 {
10069
10072 }
10073 }
10074 }
10075
10077 {
10079 {
10080 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10081 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10082 {
10083 float heatPermCoef = 1.0;
10085 while (ent)
10086 {
10087 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10088 ent = ent.GetHierarchyParent();
10089 }
10090
10091 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10092 }
10093 }
10094 }
10095
10097 {
10098
10099 EntityAI parent = GetHierarchyParent();
10100 if (!parent)
10101 {
10102 hasParent = false;
10103 hasRootAsPlayer = false;
10104 }
10105 else
10106 {
10107 hasParent = true;
10108 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10109 refParentIB =
ItemBase.Cast(parent);
10110 }
10111 }
10112
10113 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10114 {
10115
10116 }
10117
10119 {
10120
10121 return false;
10122 }
10123
10125 {
10126
10127
10128 return false;
10129 }
10130
10132 {
10133
10134 return false;
10135 }
10136
10139 {
10140 return !GetIsFrozen() &&
IsOpen();
10141 }
10142
10144 {
10145 bool hasParent = false, hasRootAsPlayer = false;
10147
10148 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10149 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10150
10151 if (wwtu || foodDecay)
10152 {
10156
10157 if (processWetness || processTemperature || processDecay)
10158 {
10160
10161 if (processWetness)
10162 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10163
10164 if (processTemperature)
10166
10167 if (processDecay)
10168 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10169 }
10170 }
10171 }
10172
10175 {
10177 }
10178
10180 {
10183
10184 return super.GetTemperatureFreezeThreshold();
10185 }
10186
10188 {
10191
10192 return super.GetTemperatureThawThreshold();
10193 }
10194
10196 {
10199
10200 return super.GetItemOverheatThreshold();
10201 }
10202
10204 {
10206 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10207
10208 return super.GetTemperatureFreezeTime();
10209 }
10210
10212 {
10214 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10215
10216 return super.GetTemperatureThawTime();
10217 }
10218
10223
10225 {
10226 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10227 }
10228
10230 {
10231 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10232 }
10233
10236 {
10238 }
10239
10241 {
10243 }
10244
10246 {
10248 }
10249
10252 {
10253 return null;
10254 }
10255
10258 {
10259 return false;
10260 }
10261
10263 {
10265 {
10268 if (!trg)
10269 {
10271 explosive = this;
10272 }
10273
10274 explosive.PairRemote(trg);
10276
10277 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10278 trg.SetPersistentPairID(persistentID);
10279 explosive.SetPersistentPairID(persistentID);
10280
10281 return true;
10282 }
10283 return false;
10284 }
10285
10288 {
10289 float ret = 1.0;
10292 ret *= GetHealth01();
10293
10294 return ret;
10295 }
10296
10297 #ifdef DEVELOPER
10298 override void SetDebugItem()
10299 {
10300 super.SetDebugItem();
10301 _itemBase = this;
10302 }
10303
10305 {
10306 string text = super.GetDebugText();
10307
10309 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10310
10311 return text;
10312 }
10313 #endif
10314
10316 {
10317 return true;
10318 }
10319
10321
10323
10325 {
10328 }
10329
10330
10338
10354
10355 [
Obsolete(
"Use ItemSoundHandler instead")]
10358 {
10359 if (!
g_Game.IsDedicatedServer())
10360 {
10361 if (ConfigIsExisting("attachSoundSet"))
10362 {
10363 string cfg_path = "";
10364 string soundset = "";
10365 string type_name =
GetType();
10366
10369 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10370 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10371
10372 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10373 {
10374 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10375 {
10376 if (cfg_slot_array[i] == slot_type)
10377 {
10378 soundset = cfg_soundset_array[i];
10379 break;
10380 }
10381 }
10382 }
10383
10384 if (soundset != "")
10385 {
10386 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10388 }
10389 }
10390 }
10391 }
10392
10394}
10395
10397{
10399 if (entity)
10400 {
10401 bool is_item = entity.IsInherited(
ItemBase);
10402 if (is_item && full_quantity)
10403 {
10406 }
10407 }
10408 else
10409 {
10411 return NULL;
10412 }
10413 return entity;
10414}
10415
10417{
10418 if (item)
10419 {
10420 if (health > 0)
10421 item.SetHealth("", "", health);
10422
10423 if (item.CanHaveTemperature())
10424 {
10426 if (item.CanFreeze())
10427 item.SetFrozen(false);
10428 }
10429
10430 if (item.HasEnergyManager())
10431 {
10432 if (quantity >= 0)
10433 {
10434 item.GetCompEM().SetEnergy0To1(quantity);
10435 }
10436 else
10437 {
10439 }
10440 }
10441 else if (item.IsMagazine())
10442 {
10443 Magazine mag = Magazine.Cast(item);
10444 if (quantity >= 0)
10445 {
10446 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10447 }
10448 else
10449 {
10451 }
10452
10453 }
10454 else
10455 {
10456 if (quantity >= 0)
10457 {
10458 item.SetQuantityNormalized(quantity, false);
10459 }
10460 else
10461 {
10463 }
10464
10465 }
10466 }
10467}
10468
10469#ifdef DEVELOPER
10471#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.