5497{
5499 {
5500 return true;
5501 }
5502};
5503
5505{
5506
5507};
5508
5509
5510
5512{
5516
5518
5521
5522
5523
5524
5525
5534
5540
5545
5550
5571 protected bool m_IsResultOfSplit
5572
5574
5579
5580
5581
5583
5587
5588
5589
5591
5594
5595
5596
5602
5603
5611
5614
5615
5617
5618
5620
5621
5626
5627
5632
5634
5635
5637
5638
5640 {
5645
5646 if (!
g_Game.IsDedicatedServer())
5647 {
5649 {
5651
5653 {
5655 }
5656 }
5657
5660 }
5661
5662 m_OldLocation = null;
5663
5665 {
5667 }
5668
5669 if (ConfigIsExisting("headSelectionsToHide"))
5670 {
5673 }
5674
5676 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5677 {
5679 }
5680
5682
5683 m_IsResultOfSplit = false;
5684
5686 }
5687
5689 {
5690 super.InitItemVariables();
5691
5697 m_Count = ConfigGetInt(
"count");
5698
5701
5706
5709
5714
5726
5730
5731
5734 if (ConfigIsExisting("canBeSplit"))
5735 {
5738 }
5739
5741 if (ConfigIsExisting("itemBehaviour"))
5743
5744
5747 RegisterNetSyncVariableInt("m_VarLiquidType");
5748 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5749
5750 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5751 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5752 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5753
5754 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5755 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5756 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5757 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5758
5759 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5760 RegisterNetSyncVariableBool("m_IsTakeable");
5761 RegisterNetSyncVariableBool("m_IsHologram");
5762
5765 {
5768 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5769 }
5770
5772
5774 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5776
5778 }
5779
5781 {
5783 }
5784
5786 {
5789 {
5794 }
5795 }
5796
5797 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5798 {
5800 {
5803 }
5804
5806 }
5807
5809 {
5815 }
5816
5818
5820 {
5822
5823 if (!action)
5824 {
5825 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5826 return;
5827 }
5828
5830 if (!ai)
5831 {
5833 return;
5834 }
5835
5837 if (!action_array)
5838 {
5839 action_array = new array<ActionBase_Basic>;
5841 }
5842 if (LogManager.IsActionLogEnable())
5843 {
5844 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5845 }
5846
5847 if (action_array.Find(action) != -1)
5848 {
5849 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5850 }
5851 else
5852 {
5853 action_array.Insert(action);
5854 }
5855 }
5856
5858 {
5859 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5860 ActionBase action = player.GetActionManager().GetAction(actionName);
5863
5864 if (action_array)
5865 {
5866 action_array.RemoveItem(action);
5867 }
5868 }
5869
5870
5871
5873 {
5874 ActionOverrideData overrideData = new ActionOverrideData();
5878
5880 if (!actionMap)
5881 {
5884 }
5885
5886 actionMap.Insert(this.
Type(), overrideData);
5887
5888 }
5889
5891
5893
5894
5896 {
5899
5902
5903 string config_to_search = "CfgVehicles";
5904 string muzzle_owner_config;
5905
5907 {
5908 if (IsInherited(Weapon))
5909 config_to_search = "CfgWeapons";
5910
5911 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5912
5913 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5914
5915 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5916
5917 if (config_OnFire_subclass_count > 0)
5918 {
5919 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5920
5921 for (int i = 0; i < config_OnFire_subclass_count; i++)
5922 {
5923 string particle_class = "";
5924 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5925 string config_OnFire_entry = config_OnFire_class + particle_class;
5926 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5927 WPOF_array.Insert(WPOF);
5928 }
5929
5930
5932 }
5933 }
5934
5936 {
5937 config_to_search = "CfgWeapons";
5938 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5939
5940 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5941
5942 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5943
5944 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5945 {
5946 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5947
5948 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5949 {
5950 string particle_class2 = "";
5951 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5952 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5953 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5954 WPOBE_array.Insert(WPOBE);
5955 }
5956
5957
5959 }
5960 }
5961 }
5962
5963
5965 {
5968
5970 {
5971 string config_to_search = "CfgVehicles";
5972
5973 if (IsInherited(Weapon))
5974 config_to_search = "CfgWeapons";
5975
5976 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5977 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5978
5979 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5980 {
5981
5983
5985 {
5987 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5989 return;
5990 }
5991
5994
5995
5996
5997 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5998 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5999
6000 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6001 {
6002 string particle_class = "";
6003 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6004 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6005 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6006
6007 if (entry_type == CT_CLASS)
6008 {
6009 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6010 WPOOH_array.Insert(WPOF);
6011 }
6012 }
6013
6014
6016 }
6017 }
6018 }
6019
6021 {
6023 }
6024
6026 {
6028 {
6030
6033
6036
6037 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6038 }
6039 }
6040
6042 {
6044 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6045
6047 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6048
6050 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6051
6053 {
6055 }
6056 }
6057
6059 {
6061 }
6062
6064 {
6067 else
6069
6071 {
6074 }
6075 else
6076 {
6079
6082 }
6083
6085 }
6086
6088 {
6090 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6091 }
6092
6094 {
6096 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6098 }
6099
6101 {
6103 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6104 }
6105
6107 {
6110
6111 OverheatingParticle OP = new OverheatingParticle();
6116
6118 }
6119
6121 {
6124
6125 return -1;
6126 }
6127
6129 {
6131 {
6134
6135 for (int i = count; i > 0; --i)
6136 {
6137 int id = i - 1;
6140
6143
6144 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6145 {
6146 if (p)
6147 {
6150 }
6151 }
6152 }
6153 }
6154 }
6155
6157 {
6159 {
6161 {
6162 int id = i - 1;
6164
6165 if (OP)
6166 {
6168
6169 if (p)
6170 {
6172 }
6173
6174 delete OP;
6175 }
6176 }
6177
6180 }
6181 }
6182
6185 {
6186 return 0.0;
6187 }
6188
6189
6191 {
6192 return 250;
6193 }
6194
6196 {
6197 return 0;
6198 }
6199
6202 {
6204 return true;
6205
6206 return false;
6207 }
6208
6211 {
6214
6216 {
6218 }
6219 else
6220 {
6221
6223 }
6224
6226 }
6227
6234 {
6235 return -1;
6236 }
6237
6238
6239
6240
6242 {
6244 {
6245 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6246 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6247
6248 if (r_index >= 0)
6249 {
6250 InventoryLocation r_il = new InventoryLocation;
6251 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6252
6253 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6256 {
6257 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6258 }
6260 {
6261 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6262 }
6263
6264 }
6265
6266 player.GetHumanInventory().ClearUserReservedLocation(this);
6267 }
6268
6271 }
6272
6273
6274
6275
6277 {
6278 return ItemBase.m_DebugActionsMask;
6279 }
6280
6282 {
6283 return ItemBase.m_DebugActionsMask & mask;
6284 }
6285
6287 {
6288 ItemBase.m_DebugActionsMask = mask;
6289 }
6290
6292 {
6293 ItemBase.m_DebugActionsMask |= mask;
6294 }
6295
6297 {
6298 ItemBase.m_DebugActionsMask &= ~mask;
6299 }
6300
6302 {
6304 {
6306 }
6307 else
6308 {
6310 }
6311 }
6312
6313
6315 {
6316 if (GetEconomyProfile())
6317 {
6318 float q_max = GetEconomyProfile().GetQuantityMax();
6319 if (q_max > 0)
6320 {
6321 float q_min = GetEconomyProfile().GetQuantityMin();
6322 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6323
6325 {
6326 ComponentEnergyManager comp = GetCompEM();
6328 {
6330 }
6331 }
6333 {
6335
6336 }
6337
6338 }
6339 }
6340 }
6341
6344 {
6345 EntityAI parent = GetHierarchyParent();
6346
6347 if (parent)
6348 {
6349 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6350 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6351 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6352 }
6353 }
6354
6357 {
6358 EntityAI parent = GetHierarchyParent();
6359
6360 if (parent)
6361 {
6362 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6363 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6364 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6365 }
6366 }
6367
6369 {
6370
6371
6372
6373
6375
6377 {
6378 if (ScriptInputUserData.CanStoreInputUserData())
6379 {
6380 ScriptInputUserData ctx = new ScriptInputUserData;
6386 ctx.
Write(use_stack_max);
6389
6391 {
6392 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6393 }
6394 }
6395 }
6396 else if (!
g_Game.IsMultiplayer())
6397 {
6399 }
6400 }
6401
6403 {
6405 }
6406
6408 {
6410 }
6411
6413 {
6415 }
6416
6418 {
6419
6420 return false;
6421 }
6422
6424 {
6425 return false;
6426 }
6427
6431 {
6432 return false;
6433 }
6434
6436 {
6437 return "";
6438 }
6439
6441
6443 {
6444 return false;
6445 }
6446
6448 {
6449 return true;
6450 }
6451
6452
6453
6455 {
6456 return true;
6457 }
6458
6460 {
6461 return true;
6462 }
6463
6465 {
6466 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6468 }
6469
6471 {
6473 }
6474
6476 {
6478 if (!is_being_placed)
6480 SetSynchDirty();
6481 }
6482
6483
6485
6487 {
6489 }
6490
6492 {
6494 }
6495
6497 {
6498 return 1;
6499 }
6500
6502 {
6503 return false;
6504 }
6505
6507 {
6509 SetSynchDirty();
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
6540
6541
6542
6543
6544
6545
6547 {
6548 super.OnMovedInsideCargo(container);
6549
6550 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6551 }
6552
6553 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6554 {
6555 super.EEItemLocationChanged(oldLoc, newLoc);
6556
6557 PlayerBase newPlayer = null;
6558 PlayerBase oldPlayer = null;
6559
6560 if (newLoc.GetParent())
6561 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6562
6563 if (oldLoc.GetParent())
6564 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6565
6567 {
6568 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6569
6570 if (rIndex >= 0)
6571 {
6572 InventoryLocation rIl = new InventoryLocation;
6573 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6574
6575 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6578 {
6579 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6580 }
6582 {
6584 }
6585
6586 }
6587 }
6588
6590 {
6591 if (newPlayer)
6592 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6593
6594 if (newPlayer == oldPlayer)
6595 {
6596 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6597 {
6599 {
6600 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6601 {
6602 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6603 }
6604 }
6605 else
6606 {
6607 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6608 }
6609 }
6610
6611 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6612 {
6613 int type = oldLoc.GetType();
6615 {
6616 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6617 }
6619 {
6620 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6621 }
6622 }
6623 if (!m_OldLocation)
6624 {
6625 m_OldLocation = new InventoryLocation;
6626 }
6627 m_OldLocation.Copy(oldLoc);
6628 }
6629 else
6630 {
6631 if (m_OldLocation)
6632 {
6633 m_OldLocation.Reset();
6634 }
6635 }
6636
6637 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6638 }
6639 else
6640 {
6641 if (newPlayer)
6642 {
6643 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6644 if (resIndex >= 0)
6645 {
6646 InventoryLocation il = new InventoryLocation;
6647 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6649 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6652 {
6653 il.
GetParent().GetOnReleaseLock().Invoke(it);
6654 }
6656 {
6658 }
6659
6660 }
6661 }
6663 {
6664
6666 }
6667
6668 if (m_OldLocation)
6669 {
6670 m_OldLocation.Reset();
6671 }
6672 }
6673
6675 {
6676 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6677 }
6678
6680 {
6681 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6682 }
6683 }
6684
6685 override void EOnContact(IEntity other, Contact extra)
6686 {
6688 {
6689 int liquidType = -1;
6691 if (impactSpeed > 0.0)
6692 {
6694 #ifndef SERVER
6696 #else
6698 SetSynchDirty();
6699 #endif
6701 }
6702 }
6703
6704 #ifdef SERVER
6705 if (GetCompEM() && GetCompEM().IsPlugged())
6706 {
6707 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6708 GetCompEM().UnplugThis();
6709 }
6710 #endif
6711 }
6712
6714
6716 {
6718 }
6719
6721 {
6722
6723 }
6724
6726 {
6727 super.OnItemLocationChanged(old_owner, new_owner);
6728
6729 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6730 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6731
6732 if (!relatedPlayer && playerNew)
6733 relatedPlayer = playerNew;
6734
6735 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6736 {
6738 if (actionMgr)
6739 {
6740 ActionBase currentAction = actionMgr.GetRunningAction();
6741 if (currentAction)
6743 }
6744 }
6745
6746 Man ownerPlayerOld = null;
6747 Man ownerPlayerNew = null;
6748
6749 if (old_owner)
6750 {
6751 if (old_owner.
IsMan())
6752 {
6753 ownerPlayerOld = Man.Cast(old_owner);
6754 }
6755 else
6756 {
6757 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6758 }
6759 }
6760 else
6761 {
6763 {
6765
6766 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6767 {
6768 GetCompEM().UnplugThis();
6769 }
6770 }
6771 }
6772
6773 if (new_owner)
6774 {
6775 if (new_owner.
IsMan())
6776 {
6777 ownerPlayerNew = Man.Cast(new_owner);
6778 }
6779 else
6780 {
6781 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6782 }
6783 }
6784
6785 if (ownerPlayerOld != ownerPlayerNew)
6786 {
6787 if (ownerPlayerOld)
6788 {
6789 array<EntityAI> subItemsExit = new array<EntityAI>;
6791 for (int i = 0; i < subItemsExit.Count(); i++)
6792 {
6795 }
6796 }
6797
6798 if (ownerPlayerNew)
6799 {
6800 array<EntityAI> subItemsEnter = new array<EntityAI>;
6802 for (int j = 0; j < subItemsEnter.Count(); j++)
6803 {
6806 }
6807 }
6808 }
6809 else if (ownerPlayerNew != null)
6810 {
6811 PlayerBase nplayer;
6812 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6813 {
6814 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6816 for (int k = 0; k < subItemsUpdate.Count(); k++)
6817 {
6819 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6820 }
6821 }
6822 }
6823
6824 if (old_owner)
6825 old_owner.OnChildItemRemoved(this);
6826 if (new_owner)
6827 new_owner.OnChildItemReceived(this);
6828 }
6829
6830
6832 {
6833 super.EEDelete(parent);
6834 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6835 if (player)
6836 {
6838
6839 if (player.IsAlive())
6840 {
6841 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6842 if (r_index >= 0)
6843 {
6844 InventoryLocation r_il = new InventoryLocation;
6845 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6846
6847 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6850 {
6851 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6852 }
6854 {
6855 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6856 }
6857
6858 }
6859
6860 player.RemoveQuickBarEntityShortcut(this);
6861 }
6862 }
6863 }
6864
6866 {
6867 super.EEKilled(killer);
6868
6871 {
6872 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6873 {
6874 if (IsMagazine())
6875 {
6876 if (Magazine.Cast(this).GetAmmoCount() > 0)
6877 {
6879 }
6880 }
6881 else
6882 {
6884 }
6885 }
6886 }
6887 }
6888
6890 {
6891 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6892
6893 super.OnWasAttached(parent, slot_id);
6894
6897
6900 }
6901
6903 {
6904 super.OnWasDetached(parent, slot_id);
6905
6908
6911 }
6912
6914 {
6915 int idx;
6918
6919 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6920 if (inventory_slots.Count() < 1)
6921 {
6922 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6923 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6924 }
6925 else
6926 {
6927 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6928 }
6929
6930 idx = inventory_slots.Find(slot);
6931 if (idx < 0)
6932 return "";
6933
6934 return attach_types.Get(idx);
6935 }
6936
6938 {
6939 int idx = -1;
6940 string slot;
6941
6944
6945 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6946 if (inventory_slots.Count() < 1)
6947 {
6948 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6949 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6950 }
6951 else
6952 {
6953 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6954 if (detach_types.Count() < 1)
6955 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6956 }
6957
6958 for (int i = 0; i < inventory_slots.Count(); i++)
6959 {
6960 slot = inventory_slots.Get(i);
6961 }
6962
6963 if (slot != "")
6964 {
6965 if (detach_types.Count() == 1)
6966 idx = 0;
6967 else
6968 idx = inventory_slots.Find(slot);
6969 }
6970 if (idx < 0)
6971 return "";
6972
6973 return detach_types.Get(idx);
6974 }
6975
6977 {
6978
6980
6981
6982 float min_time = 1;
6983 float max_time = 3;
6984 float delay = Math.RandomFloat(min_time, max_time);
6985
6986 explode_timer.Run(delay, this, "DoAmmoExplosion");
6987 }
6988
6990 {
6991 Magazine magazine = Magazine.Cast(this);
6992 int pop_sounds_count = 6;
6993 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6994
6995
6996 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6997 string sound_name = pop_sounds[ sound_idx ];
6998 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6999
7000
7001 magazine.ServerAddAmmoCount(-1);
7002
7003
7004 float min_temp_to_explode = 100;
7005
7006 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7007 {
7009 }
7010 }
7011
7012
7013 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7014 {
7015 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7016
7017 const int CHANCE_DAMAGE_CARGO = 4;
7018 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7019 const int CHANCE_DAMAGE_NOTHING = 2;
7020
7022 {
7023 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7024 int chances;
7025 int rnd;
7026
7027 if (GetInventory().GetCargo())
7028 {
7029 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7030 rnd = Math.RandomInt(0,chances);
7031
7032 if (rnd < CHANCE_DAMAGE_CARGO)
7033 {
7035 }
7036 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7037 {
7039 }
7040 }
7041 else
7042 {
7043 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7044 rnd = Math.RandomInt(0,chances);
7045
7046 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7047 {
7049 }
7050 }
7051 }
7052 }
7053
7055 {
7056 CargoBase cargo = GetInventory().GetCargo();
7057 if (cargo)
7058 {
7060 if (item_count > 0)
7061 {
7062 int random_pick = Math.RandomInt(0, item_count);
7064 if (!item.IsExplosive())
7065 {
7066 item.AddHealth("","",damage);
7067 return true;
7068 }
7069 }
7070 }
7071 return false;
7072 }
7073
7075 {
7076 GameInventory inventory = GetInventory();
7078 if (attachment_count > 0)
7079 {
7080 int random_pick = Math.RandomInt(0, attachment_count);
7082 if (!attachment.IsExplosive())
7083 {
7084 attachment.AddHealth("","",damage);
7085 return true;
7086 }
7087 }
7088 return false;
7089 }
7090
7092 {
7094 }
7095
7097 {
7099 return GetInventory().CanRemoveEntity();
7100
7101 return false;
7102 }
7103
7105 {
7106
7108 return false;
7109
7110
7112 return false;
7113
7114
7115
7117 if (delta == 0)
7118 return false;
7119
7120
7121 return true;
7122 }
7123
7125 {
7127 {
7128 if (ScriptInputUserData.CanStoreInputUserData())
7129 {
7130 ScriptInputUserData ctx = new ScriptInputUserData;
7135 ctx.
Write(destination_entity);
7139 }
7140 }
7141 else if (!
g_Game.IsMultiplayer())
7142 {
7144 }
7145 }
7146
7148 {
7149 float split_quantity_new;
7153 InventoryLocation loc = new InventoryLocation;
7154
7155 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7156 {
7158 split_quantity_new = stack_max;
7159 else
7161
7163 {
7164 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7165 if (new_item)
7166 {
7167 new_item.SetResultOfSplit(true);
7168 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7170 new_item.
SetQuantity(split_quantity_new,
false,
true);
7171 }
7172 }
7173 }
7174 else if (destination_entity && slot_id == -1)
7175 {
7176 if (quantity > stack_max)
7177 split_quantity_new = stack_max;
7178 else
7179 split_quantity_new = quantity;
7180
7182 {
7183 GameInventory destinationInventory = destination_entity.GetInventory();
7185 {
7188 }
7189
7190 if (new_item)
7191 {
7192 new_item.SetResultOfSplit(true);
7193 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7195 new_item.
SetQuantity(split_quantity_new,
false,
true);
7196 }
7197 }
7198 }
7199 else
7200 {
7201 if (stack_max != 0)
7202 {
7204 {
7206 }
7207
7208 if (split_quantity_new == 0)
7209 {
7210 if (!
g_Game.IsMultiplayer())
7211 player.PhysicalPredictiveDropItem(this);
7212 else
7213 player.ServerDropEntity(this);
7214 return;
7215 }
7216
7218 {
7220
7221 if (new_item)
7222 {
7223 new_item.SetResultOfSplit(true);
7224 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7227 new_item.PlaceOnSurface();
7228 }
7229 }
7230 }
7231 }
7232 }
7233
7235 {
7236 float split_quantity_new;
7240 InventoryLocation loc = new InventoryLocation;
7241
7242 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7243 {
7245 split_quantity_new = stack_max;
7246 else
7248
7250 {
7251 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7252 if (new_item)
7253 {
7254 new_item.SetResultOfSplit(true);
7255 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7257 new_item.
SetQuantity(split_quantity_new,
false,
true);
7258 }
7259 }
7260 }
7261 else if (destination_entity && slot_id == -1)
7262 {
7263 if (quantity > stack_max)
7264 split_quantity_new = stack_max;
7265 else
7266 split_quantity_new = quantity;
7267
7269 {
7270 GameInventory destinationInventory = destination_entity.GetInventory();
7272 {
7275 }
7276
7277 if (new_item)
7278 {
7279 new_item.SetResultOfSplit(true);
7280 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7282 new_item.
SetQuantity(split_quantity_new,
false,
true);
7283 }
7284 }
7285 }
7286 else
7287 {
7288 if (stack_max != 0)
7289 {
7291 {
7293 }
7294
7296 {
7298
7299 if (new_item)
7300 {
7301 new_item.SetResultOfSplit(true);
7302 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7305 new_item.PlaceOnSurface();
7306 }
7307 }
7308 }
7309 }
7310 }
7311
7313 {
7315 {
7316 if (ScriptInputUserData.CanStoreInputUserData())
7317 {
7318 ScriptInputUserData ctx = new ScriptInputUserData;
7323 dst.WriteToContext(ctx);
7325 }
7326 }
7327 else if (!
g_Game.IsMultiplayer())
7328 {
7330 }
7331 }
7332
7334 {
7336 {
7337 if (ScriptInputUserData.CanStoreInputUserData())
7338 {
7339 ScriptInputUserData ctx = new ScriptInputUserData;
7344 ctx.
Write(destination_entity);
7350 }
7351 }
7352 else if (!
g_Game.IsMultiplayer())
7353 {
7355 }
7356 }
7357
7359 {
7361 }
7362
7364 {
7366 float split_quantity_new;
7368 if (dst.IsValid())
7369 {
7370 int slot_id = dst.GetSlot();
7372
7373 if (quantity > stack_max)
7374 split_quantity_new = stack_max;
7375 else
7376 split_quantity_new = quantity;
7377
7379 {
7381
7382 if (new_item)
7383 {
7384 new_item.SetResultOfSplit(true);
7385 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7387 new_item.
SetQuantity(split_quantity_new,
false,
true);
7388 }
7389
7390 return new_item;
7391 }
7392 }
7393
7394 return null;
7395 }
7396
7398 {
7400 float split_quantity_new;
7402 if (destination_entity)
7403 {
7405 if (quantity > stackable)
7406 split_quantity_new = stackable;
7407 else
7408 split_quantity_new = quantity;
7409
7411 {
7412 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7413 if (new_item)
7414 {
7415 new_item.SetResultOfSplit(true);
7416 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7418 new_item.
SetQuantity(split_quantity_new,
false,
true);
7419 }
7420 }
7421 }
7422 }
7423
7425 {
7427 {
7428 if (ScriptInputUserData.CanStoreInputUserData())
7429 {
7430 ScriptInputUserData ctx = new ScriptInputUserData;
7435 ItemBase destination_entity =
this;
7436 ctx.
Write(destination_entity);
7440 }
7441 }
7442 else if (!
g_Game.IsMultiplayer())
7443 {
7445 }
7446 }
7447
7449 {
7451 float split_quantity_new;
7453 if (player)
7454 {
7456 if (quantity > stackable)
7457 split_quantity_new = stackable;
7458 else
7459 split_quantity_new = quantity;
7460
7462 {
7463 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7464 new_item =
ItemBase.Cast(in_hands);
7465 if (new_item)
7466 {
7467 new_item.SetResultOfSplit(true);
7468 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7470 new_item.SetQuantity(split_quantity_new, false, true);
7471 }
7472 }
7473 }
7474 }
7475
7477 {
7479 float split_quantity_new = Math.Floor(quantity * 0.5);
7480
7482 return;
7483
7485
7486 if (new_item)
7487 {
7488 if (new_item.GetQuantityMax() < split_quantity_new)
7489 {
7490 split_quantity_new = new_item.GetQuantityMax();
7491 }
7492
7493 new_item.SetResultOfSplit(true);
7494 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7495
7497 {
7500 }
7501 else
7502 {
7504 new_item.
SetQuantity(split_quantity_new,
false,
true);
7505 }
7506 }
7507 }
7508
7510 {
7512 float split_quantity_new = Math.Floor(quantity / 2);
7513
7515 return;
7516
7517 InventoryLocation invloc = new InventoryLocation;
7519
7521 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7522
7523 if (new_item)
7524 {
7525 if (new_item.GetQuantityMax() < split_quantity_new)
7526 {
7527 split_quantity_new = new_item.GetQuantityMax();
7528 }
7530 {
7533 }
7534 else if (split_quantity_new > 1)
7535 {
7537 new_item.
SetQuantity(split_quantity_new,
false,
true);
7538 }
7539 }
7540 }
7541
7544 {
7545 SetWeightDirty();
7547
7548 if (parent)
7549 parent.OnAttachmentQuantityChangedEx(this, delta);
7550
7552 {
7554 {
7556 }
7558 {
7559 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7561 }
7562 }
7563 }
7564
7567 {
7568
7569 }
7570
7573 {
7575 }
7576
7578 {
7579 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7580
7582 {
7583 if (newLevel == GameConstants.STATE_RUINED)
7584 {
7586 EntityAI parent = GetHierarchyParent();
7587 if (parent && parent.IsFireplace())
7588 {
7589 CargoBase cargo = GetInventory().GetCargo();
7590 if (cargo)
7591 {
7593 {
7595 }
7596 }
7597 }
7598 }
7599
7601 {
7602
7604 return;
7605 }
7606
7607 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7608 {
7610 }
7611 }
7612 }
7613
7614
7616 {
7617 super.OnRightClick();
7618
7620 {
7622 {
7623 if (ScriptInputUserData.CanStoreInputUserData())
7624 {
7625 EntityAI root = GetHierarchyRoot();
7626 Man playerOwner = GetHierarchyRootPlayer();
7627 InventoryLocation dst = new InventoryLocation;
7628
7629
7630 if (!playerOwner && root && root == this)
7631 {
7633 }
7634 else
7635 {
7636
7637 GetInventory().GetCurrentInventoryLocation(dst);
7639 {
7640 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7642 {
7644 }
7645 else
7646 {
7648
7649
7650 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7651 {
7653 }
7654 else
7655 {
7656 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7657 }
7658 }
7659 }
7660 }
7661
7662 ScriptInputUserData ctx = new ScriptInputUserData;
7670 }
7671 }
7672 else if (!
g_Game.IsMultiplayer())
7673 {
7675 }
7676 }
7677 }
7678
7680 {
7681 if (root)
7682 {
7683 vector m4[4];
7684 root.GetTransform(m4);
7685 dst.SetGround(this, m4);
7686 }
7687 else
7688 {
7689 GetInventory().GetCurrentInventoryLocation(dst);
7690 }
7691 }
7692
7693 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7694 {
7695
7696 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7697 return false;
7698
7699 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7700 return false;
7701
7702
7704 return false;
7705
7706
7707 Magazine mag = Magazine.Cast(this);
7708 if (mag)
7709 {
7710 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7711 return false;
7712
7713 if (stack_max_limit)
7714 {
7715 Magazine other_mag = Magazine.Cast(other_item);
7716 if (other_item)
7717 {
7718 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7719 return false;
7720 }
7721
7722 }
7723 }
7724 else
7725 {
7726
7728 return false;
7729
7731 return false;
7732 }
7733
7734 PlayerBase player = null;
7735 if (CastTo(player, GetHierarchyRootPlayer()))
7736 {
7737 if (player.GetInventory().HasAttachment(this))
7738 return false;
7739
7740 if (player.IsItemsToDelete())
7741 return false;
7742 }
7743
7744 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7745 return false;
7746
7747 int slotID;
7749 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7750 return false;
7751
7752 return true;
7753 }
7754
7756 {
7758 }
7759
7761 {
7762 return m_IsResultOfSplit;
7763 }
7764
7766 {
7767 m_IsResultOfSplit = value;
7768 }
7769
7771 {
7773 }
7774
7776 {
7777 float other_item_quantity = other_item.GetQuantity();
7778 float this_free_space;
7779
7781
7783
7784 if (other_item_quantity > this_free_space)
7785 {
7786 return this_free_space;
7787 }
7788 else
7789 {
7790 return other_item_quantity;
7791 }
7792 }
7793
7795 {
7797 }
7798
7800 {
7802 return;
7803
7804 if (!IsMagazine() && other_item)
7805 {
7807 if (quantity_used != 0)
7808 {
7809 float hp1 = GetHealth01("","");
7810 float hp2 = other_item.GetHealth01("","");
7811 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7812 hpResult = hpResult / (
GetQuantity() + quantity_used);
7813
7814 hpResult *= GetMaxHealth();
7815 Math.Round(hpResult);
7816 SetHealth("", "Health", hpResult);
7817
7819 other_item.AddQuantity(-quantity_used);
7820 }
7821 }
7823 }
7824
7826 {
7827 #ifdef SERVER
7828 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7829 GetHierarchyParent().IncreaseLifetimeUp();
7830 #endif
7831 };
7832
7834 {
7835 PlayerBase p = PlayerBase.Cast(player);
7836
7837 array<int> recipesIds = p.m_Recipes;
7838 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7839 if (moduleRecipesManager)
7840 {
7841 EntityAI itemInHands = player.GetEntityInHands();
7842 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7843 }
7844
7845 for (int i = 0;i < recipesIds.Count(); i++)
7846 {
7847 int key = recipesIds.Get(i);
7848 string recipeName = moduleRecipesManager.GetRecipeName(key);
7850 }
7851 }
7852
7853
7854 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7855 {
7856 super.GetDebugActions(outputList);
7857
7858
7864
7865
7870
7875
7876
7880
7881
7883 {
7887 }
7888
7891
7892
7896
7898
7899 InventoryLocation loc = new InventoryLocation();
7900 GetInventory().GetCurrentInventoryLocation(loc);
7902 {
7903 if (Gizmo_IsSupported())
7906 }
7907
7909 }
7910
7911
7912
7913
7915 {
7916 super.OnAction(action_id, player, ctx);
7917
7919 {
7920 switch (action_id)
7921 {
7925 return true;
7929 return true;
7930 }
7931 }
7932
7934 {
7935 switch (action_id)
7936 {
7938 Delete();
7939 return true;
7940 }
7941 }
7942
7943 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7944 {
7945 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7946 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7947 PlayerBase p = PlayerBase.Cast(player);
7948 if (
EActions.RECIPES_RANGE_START < 1000)
7949 {
7950 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7951 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7952 }
7953 }
7954 #ifndef SERVER
7955 else if (action_id ==
EActions.WATCH_PLAYER)
7956 {
7957 PluginDeveloper.SetDeveloperItemClientEx(player);
7958 }
7959 #endif
7961 {
7962 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7963 {
7964 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7965 OnDebugButtonPressServer(id + 1);
7966 }
7967
7968 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7969 {
7970 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7972 }
7973
7974 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7975 {
7976 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7978 }
7979
7980 else if (action_id ==
EActions.ADD_QUANTITY)
7981 {
7982 if (IsMagazine())
7983 {
7984 Magazine mag = Magazine.Cast(this);
7985 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7986 }
7987 else
7988 {
7990 }
7991
7992 if (m_EM)
7993 {
7994 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7995 }
7996
7997 }
7998
7999 else if (action_id ==
EActions.REMOVE_QUANTITY)
8000 {
8001 if (IsMagazine())
8002 {
8003 Magazine mag2 = Magazine.Cast(this);
8004 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8005 }
8006 else
8007 {
8009 }
8010 if (m_EM)
8011 {
8012 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8013 }
8014
8015 }
8016
8017 else if (action_id ==
EActions.SET_QUANTITY_0)
8018 {
8020
8021 if (m_EM)
8022 {
8023 m_EM.SetEnergy(0);
8024 }
8025 }
8026
8027 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8028 {
8030
8031 if (m_EM)
8032 {
8033 m_EM.SetEnergy(m_EM.GetEnergyMax());
8034 }
8035 }
8036
8037 else if (action_id ==
EActions.ADD_HEALTH)
8038 {
8039 AddHealth("","",GetMaxHealth("","Health")/5);
8040 }
8041 else if (action_id ==
EActions.REMOVE_HEALTH)
8042 {
8043 AddHealth("","",-GetMaxHealth("","Health")/5);
8044 }
8045 else if (action_id ==
EActions.DESTROY_HEALTH)
8046 {
8047 SetHealth01("","",0);
8048 }
8049 else if (action_id ==
EActions.WATCH_ITEM)
8050 {
8052 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8053 #ifdef DEVELOPER
8054 SetDebugDeveloper_item(this);
8055 #endif
8056 }
8057
8058 else if (action_id ==
EActions.ADD_TEMPERATURE)
8059 {
8060 AddTemperature(20);
8061
8062 }
8063
8064 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8065 {
8066 AddTemperature(-20);
8067
8068 }
8069
8070 else if (action_id ==
EActions.FLIP_FROZEN)
8071 {
8072 SetFrozen(!GetIsFrozen());
8073
8074 }
8075
8076 else if (action_id ==
EActions.ADD_WETNESS)
8077 {
8079
8080 }
8081
8082 else if (action_id ==
EActions.REMOVE_WETNESS)
8083 {
8085
8086 }
8087
8088 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8089 {
8092
8093
8094 }
8095
8096 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8097 {
8100 }
8101
8102 else if (action_id ==
EActions.MAKE_SPECIAL)
8103 {
8104 auto debugParams = DebugSpawnParams.WithPlayer(player);
8105 OnDebugSpawnEx(debugParams);
8106 }
8107
8108 }
8109
8110
8111 return false;
8112 }
8113
8114
8115
8116
8120
8123
8124
8125
8127 {
8128 return false;
8129 }
8130
8131
8133 {
8134 return true;
8135 }
8136
8137
8139 {
8140 return true;
8141 }
8142
8143
8144
8146 {
8147 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8148 return g_Game.ConfigIsExisting(config_path);
8149 }
8150
8153 {
8154 return null;
8155 }
8156
8158 {
8159 return false;
8160 }
8161
8163 {
8164 return false;
8165 }
8166
8170
8171
8173 {
8174 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8175 return module_repairing.CanRepair(this, item_repair_kit);
8176 }
8177
8178
8179 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8180 {
8181 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8182 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8183 }
8184
8185
8187 {
8188
8189
8190
8191
8192
8193
8194
8195
8196 return 1;
8197 }
8198
8199
8200
8202 {
8204 }
8205
8206
8207
8209 {
8211 }
8212
8213
8222 {
8223 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8224
8225 if (player)
8226 {
8227 player.MessageStatus(text);
8228 }
8229 }
8230
8231
8240 {
8241 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8242
8243 if (player)
8244 {
8245 player.MessageAction(text);
8246 }
8247 }
8248
8249
8258 {
8259 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8260
8261 if (player)
8262 {
8263 player.MessageFriendly(text);
8264 }
8265 }
8266
8267
8276 {
8277 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8278
8279 if (player)
8280 {
8281 player.MessageImportant(text);
8282 }
8283 }
8284
8286 {
8287 return true;
8288 }
8289
8290
8291 override bool KindOf(
string tag)
8292 {
8293 bool found = false;
8294 string item_name = this.
GetType();
8296 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8297
8298 int array_size = item_tag_array.Count();
8299 for (int i = 0; i < array_size; i++)
8300 {
8301 if (item_tag_array.Get(i) == tag)
8302 {
8303 found = true;
8304 break;
8305 }
8306 }
8307 return found;
8308 }
8309
8310
8312 {
8313
8314 super.OnRPC(sender, rpc_type,ctx);
8315
8316
8317 switch (rpc_type)
8318 {
8319 #ifndef SERVER
8320 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8321 Param2<bool, string> p = new Param2<bool, string>(false, "");
8322
8324 return;
8325
8326 bool play = p.param1;
8327 string soundSet = p.param2;
8328
8329 if (play)
8330 {
8332 {
8334 {
8336 }
8337 }
8338 else
8339 {
8341 }
8342 }
8343 else
8344 {
8346 }
8347
8348 break;
8349 #endif
8350
8351 }
8352
8354 {
8356 }
8357 }
8358
8359
8360
8361
8363 {
8364 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8365 return plugin.GetID(
name);
8366 }
8367
8369 {
8370 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8371 return plugin.GetName(id);
8372 }
8373
8376 {
8377
8378
8379 int varFlags;
8380 if (!ctx.
Read(varFlags))
8381 return;
8382
8383 if (varFlags & ItemVariableFlags.FLOAT)
8384 {
8386 }
8387 }
8388
8390 {
8391
8392 super.SerializeNumericalVars(floats_out);
8393
8394
8395
8397 {
8399 }
8400
8402 {
8404 }
8405
8407 {
8409 }
8410
8412 {
8417 }
8418
8420 {
8422 }
8423 }
8424
8426 {
8427
8428 super.DeSerializeNumericalVars(floats);
8429
8430
8431 int index = 0;
8432 int mask = Math.Round(floats.Get(index));
8433
8434 index++;
8435
8437 {
8439 {
8441 }
8442 else
8443 {
8444 float quantity = floats.Get(index);
8446 }
8447 index++;
8448 }
8449
8451 {
8452 float wet = floats.Get(index);
8454 index++;
8455 }
8456
8458 {
8459 int liquidtype = Math.Round(floats.Get(index));
8461 index++;
8462 }
8463
8465 {
8467 index++;
8469 index++;
8471 index++;
8473 index++;
8474 }
8475
8477 {
8478 int cleanness = Math.Round(floats.Get(index));
8480 index++;
8481 }
8482 }
8483
8485 {
8486 super.WriteVarsToCTX(ctx);
8487
8488
8490 {
8492 }
8493
8495 {
8497 }
8498
8500 {
8502 }
8503
8505 {
8506 int r,g,b,a;
8512 }
8513
8515 {
8517 }
8518 }
8519
8521 {
8522 if (!super.ReadVarsFromCTX(ctx,version))
8523 return false;
8524
8525 int intValue;
8526 float value;
8527
8528 if (version < 140)
8529 {
8530 if (!ctx.
Read(intValue))
8531 return false;
8532
8533 m_VariablesMask = intValue;
8534 }
8535
8537 {
8538 if (!ctx.
Read(value))
8539 return false;
8540
8542 {
8544 }
8545 else
8546 {
8548 }
8549 }
8550
8551 if (version < 140)
8552 {
8554 {
8555 if (!ctx.
Read(value))
8556 return false;
8557 SetTemperatureDirect(value);
8558 }
8559 }
8560
8562 {
8563 if (!ctx.
Read(value))
8564 return false;
8566 }
8567
8569 {
8570 if (!ctx.
Read(intValue))
8571 return false;
8573 }
8574
8576 {
8577 int r,g,b,a;
8579 return false;
8581 return false;
8583 return false;
8585 return false;
8586
8588 }
8589
8591 {
8592 if (!ctx.
Read(intValue))
8593 return false;
8595 }
8596
8597 if (version >= 138 && version < 140)
8598 {
8600 {
8601 if (!ctx.
Read(intValue))
8602 return false;
8603 SetFrozen(intValue);
8604 }
8605 }
8606
8607 return true;
8608 }
8609
8610
8612 {
8615 {
8617 }
8618
8619 if (!super.OnStoreLoad(ctx, version))
8620 {
8622 return false;
8623 }
8624
8625 if (version >= 114)
8626 {
8627 bool hasQuickBarIndexSaved;
8628
8629 if (!ctx.
Read(hasQuickBarIndexSaved))
8630 {
8632 return false;
8633 }
8634
8635 if (hasQuickBarIndexSaved)
8636 {
8637 int itmQBIndex;
8638
8639
8640 if (!ctx.
Read(itmQBIndex))
8641 {
8643 return false;
8644 }
8645
8646 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8647 if (itmQBIndex != -1 && parentPlayer)
8648 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8649 }
8650 }
8651 else
8652 {
8653
8654 PlayerBase player;
8655 int itemQBIndex;
8656 if (version ==
int.
MAX)
8657 {
8658 if (!ctx.
Read(itemQBIndex))
8659 {
8661 return false;
8662 }
8663 }
8664 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8665 {
8666
8667 if (!ctx.
Read(itemQBIndex))
8668 {
8670 return false;
8671 }
8672 if (itemQBIndex != -1 && player)
8673 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8674 }
8675 }
8676
8677 if (version < 140)
8678 {
8679
8680 if (!LoadVariables(ctx, version))
8681 {
8683 return false;
8684 }
8685 }
8686
8687
8689 {
8691 return false;
8692 }
8693 if (version >= 132)
8694 {
8696 if (raib)
8697 {
8699 {
8701 return false;
8702 }
8703 }
8704 }
8705
8707 return true;
8708 }
8709
8710
8711
8713 {
8714 super.OnStoreSave(ctx);
8715
8716 PlayerBase player;
8717 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8718 {
8720
8721 int itemQBIndex = -1;
8722 itemQBIndex = player.FindQuickBarEntityIndex(this);
8723 ctx.
Write(itemQBIndex);
8724 }
8725 else
8726 {
8728 }
8729
8731
8733 if (raib)
8734 {
8736 }
8737 }
8738
8739
8741 {
8742 super.AfterStoreLoad();
8743
8745 {
8747 }
8748
8750 {
8753 }
8754 }
8755
8757 {
8758 super.EEOnAfterLoad();
8759
8761 {
8763 }
8764
8767 }
8768
8770 {
8771 return false;
8772 }
8773
8774
8775
8777 {
8779 {
8780 #ifdef PLATFORM_CONSOLE
8781
8783 {
8785 if (menu)
8786 {
8788 }
8789 }
8790 #endif
8791 }
8792
8794 {
8797 }
8798
8800 {
8801 SetWeightDirty();
8803 }
8805 {
8808 }
8809
8811 {
8814
8817 }
8819 {
8823 }
8824
8825 super.OnVariablesSynchronized();
8826 }
8827
8828
8829
8831 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8832 {
8833 if (!IsServerCheck(allow_client))
8834 return false;
8835
8837 return false;
8838
8841
8842 if (value <= (min + 0.001))
8843 value = min;
8844
8845 if (value == min)
8846 {
8847 if (destroy_config)
8848 {
8849 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8850 if (dstr)
8851 {
8853 this.Delete();
8854 return true;
8855 }
8856 }
8857 else if (destroy_forced)
8858 {
8860 this.Delete();
8861 return true;
8862 }
8863
8865 }
8866
8869
8871 {
8872 EntityAI parent = GetHierarchyRoot();
8873 InventoryLocation iLoc = new InventoryLocation();
8874 GetInventory().GetCurrentInventoryLocation(iLoc);
8876 {
8877 int iLocSlot = iLoc.
GetSlot();
8879 {
8881 }
8883 {
8885 }
8886 }
8887 }
8888
8890 {
8892
8893 if (delta)
8895 }
8896
8898
8899 return false;
8900 }
8901
8902
8904 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8905 {
8907 }
8908
8910 {
8913 }
8914
8916 {
8919 }
8920
8922 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8923 {
8924 float value_clamped = Math.Clamp(value, 0, 1);
8926 SetQuantity(result, destroy_config, destroy_forced);
8927 }
8928
8929
8932 {
8934 }
8935
8937 {
8939 }
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8951 {
8952 int slot = -1;
8953 GameInventory inventory = GetInventory();
8954 if (inventory)
8955 {
8956 InventoryLocation il = new InventoryLocation;
8959 }
8960
8962 }
8963
8965 {
8966 float quantity_max = 0;
8967
8969 {
8970 if (attSlotID != -1)
8971 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8972
8973 if (quantity_max <= 0)
8975 }
8976
8977 if (quantity_max <= 0)
8979
8980 return quantity_max;
8981 }
8982
8984 {
8986 }
8987
8989 {
8991 }
8992
8993
8995 {
8997 }
8998
9000 {
9002 }
9003
9005 {
9007 }
9008
9009
9011 {
9012
9013 float weightEx = GetWeightEx();
9014 float special = GetInventoryAndCargoWeight();
9015 return weightEx - special;
9016 }
9017
9018
9020 {
9022 }
9023
9025 {
9027 {
9028 #ifdef DEVELOPER
9029 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9030 {
9031 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9033 }
9034 #endif
9035
9037 }
9038 else if (HasEnergyManager())
9039 {
9040 #ifdef DEVELOPER
9041 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9042 {
9043 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9044 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9045 }
9046 #endif
9047 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9048 }
9049 else
9050 {
9051 #ifdef DEVELOPER
9052 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9053 {
9054 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9055 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9056 }
9057 #endif
9058 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9059 }
9060 }
9061
9064 {
9065 int item_count = 0;
9067
9068 GameInventory inventory = GetInventory();
9069 CargoBase cargo = inventory.
GetCargo();
9070 if (cargo != NULL)
9071 {
9073 }
9074
9076 for (int i = 0; i < nAttachments; ++i)
9077 {
9079 if (item)
9080 item_count += item.GetNumberOfItems();
9081 }
9082 return item_count;
9083 }
9084
9087 {
9088 float weight = 0;
9089 float wetness = 1;
9090 if (include_wetness)
9093 {
9094 weight = wetness * m_ConfigWeight;
9095 }
9097 {
9098 weight = 1;
9099 }
9100 return weight;
9101 }
9102
9103
9104
9106 {
9107 GameInventory inventory = GetInventory();
9108 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9109 {
9110 array<EntityAI> items = new array<EntityAI>;
9112 for (int i = 0; i < items.Count(); ++i)
9113 {
9115 if (item)
9116 {
9117 g_Game.ObjectDelete(item);
9118 }
9119 }
9120 }
9121 }
9122
9123
9124
9125
9127 {
9128 float energy = 0;
9129 if (HasEnergyManager())
9130 {
9131 energy = GetCompEM().GetEnergy();
9132 }
9133 return energy;
9134 }
9135
9136
9138 {
9139 super.OnEnergyConsumed();
9140
9142 }
9143
9145 {
9146 super.OnEnergyAdded();
9147
9149 }
9150
9151
9153 {
9154 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9155 {
9157 {
9158 float energy_0to1 = GetCompEM().GetEnergy0To1();
9160 }
9161 }
9162 }
9163
9164
9166 {
9167 return ConfigGetFloat("heatIsolation");
9168 }
9169
9171 {
9173 }
9174
9176 {
9177 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9178 if (
g_Game.ConfigIsExisting(paramPath))
9179 return g_Game.ConfigGetFloat(paramPath);
9180
9181 return 0.0;
9182 }
9183
9185 {
9186 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9187 if (
g_Game.ConfigIsExisting(paramPath))
9188 return g_Game.ConfigGetFloat(paramPath);
9189
9190 return 0.0;
9191 }
9192
9193 override void SetWet(
float value,
bool allow_client =
false)
9194 {
9195 if (!IsServerCheck(allow_client))
9196 return;
9197
9200
9202
9203 m_VarWet = Math.Clamp(value, min, max);
9204
9206 {
9209 }
9210 }
9211
9212 override void AddWet(
float value)
9213 {
9215 }
9216
9218 {
9220 }
9221
9223 {
9225 }
9226
9228 {
9230 }
9231
9233 {
9235 }
9236
9238 {
9240 }
9241
9243 {
9246 if (newLevel != oldLevel)
9247 {
9249 }
9250 }
9251
9253 {
9254 SetWeightDirty();
9255 }
9256
9258 {
9259 return GetWetLevelInternal(
m_VarWet);
9260 }
9261
9262
9263
9265 {
9267 }
9268
9270 {
9272 }
9273
9275 {
9277 }
9278
9280 {
9282 }
9283
9284
9285
9287 {
9288 if (ConfigIsExisting("itemModelLength"))
9289 {
9290 return ConfigGetFloat("itemModelLength");
9291 }
9292 return 0;
9293 }
9294
9296 {
9297 if (ConfigIsExisting("itemAttachOffset"))
9298 {
9299 return ConfigGetFloat("itemAttachOffset");
9300 }
9301 return 0;
9302 }
9303
9304 override void SetCleanness(
int value,
bool allow_client =
false)
9305 {
9306 if (!IsServerCheck(allow_client))
9307 return;
9308
9310
9312
9315 }
9316
9318 {
9320 }
9321
9323 {
9324 return true;
9325 }
9326
9327
9328
9329
9331 {
9333 }
9334
9336 {
9338 }
9339
9340
9341
9342
9343 override void SetColor(
int r,
int g,
int b,
int a)
9344 {
9350 }
9352 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9353 {
9358 }
9359
9361 {
9363 }
9364
9367 {
9368 int r,g,b,a;
9370 r = r/255;
9371 g = g/255;
9372 b = b/255;
9373 a = a/255;
9374 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9375 }
9376
9377
9378
9379 override void SetLiquidType(
int value,
bool allow_client =
false)
9380 {
9381 if (!IsServerCheck(allow_client))
9382 return;
9383
9388 }
9389
9391 {
9392 return ConfigGetInt("varLiquidTypeInit");
9393 }
9394
9396 {
9398 }
9399
9401 {
9403 SetFrozen(false);
9404 }
9405
9408 {
9409 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9410 }
9411
9412
9415 {
9416 PlayerBase nplayer;
9417 if (PlayerBase.CastTo(nplayer, player))
9418 {
9420 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9421 }
9422 }
9423
9424
9427 {
9428 PlayerBase nplayer;
9429 if (PlayerBase.CastTo(nplayer,player))
9430 {
9431 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9432 }
9433
9434 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9435
9436 if (HasEnergyManager())
9437 {
9438 GetCompEM().UpdatePlugState();
9439 }
9440 }
9441
9442
9444 {
9445 super.OnPlacementStarted(player);
9446
9448 }
9449
9450 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9451 {
9453 {
9454 m_AdminLog.OnPlacementComplete(player,
this);
9455 }
9456
9457 super.OnPlacementComplete(player, position, orientation);
9458 }
9459
9460
9461
9462
9463
9465 {
9467 {
9468 return true;
9469 }
9470 else
9471 {
9472 return false;
9473 }
9474 }
9475
9476
9478 {
9480 {
9482 }
9483 }
9484
9485
9487 {
9489 }
9490
9492 {
9494 }
9495
9496 override void InsertAgent(
int agent,
float count = 1)
9497 {
9498 if (count < 1)
9499 return;
9500
9502 }
9503
9506 {
9508 }
9509
9510
9512 {
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
9551
9552
9553
9554
9555
9556
9558 {
9560 return false;
9561 return true;
9562 }
9563
9565 {
9566
9568 }
9569
9570
9573 {
9574 super.CheckForRoofLimited(timeTresholdMS);
9575
9576 float time =
g_Game.GetTime();
9577 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9578 {
9579 m_PreviousRoofTestTime = time;
9580 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9581 }
9582 }
9583
9584
9586 {
9588 {
9589 return 0;
9590 }
9591
9592 if (GetInventory().GetAttachmentSlotsCount() != 0)
9593 {
9594 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9595 if (filter)
9596 return filter.GetProtectionLevel(type, false, system);
9597 else
9598 return 0;
9599 }
9600
9601 string subclassPath, entryName;
9602
9603 switch (type)
9604 {
9606 entryName = "biological";
9607 break;
9609 entryName = "chemical";
9610 break;
9611 default:
9612 entryName = "biological";
9613 break;
9614 }
9615
9616 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9617
9618 return g_Game.ConfigGetFloat(subclassPath + entryName);
9619 }
9620
9621
9622
9625 {
9626 if (!IsMagazine())
9628
9630 }
9631
9632
9633
9634
9635
9640 {
9641 return true;
9642 }
9643
9645 {
9647 }
9648
9649
9650
9651
9652
9654 {
9655 if (parent)
9656 {
9657 if (parent.IsInherited(DayZInfected))
9658 return true;
9659
9660 if (!parent.IsRuined())
9661 return true;
9662 }
9663
9664 return true;
9665 }
9666
9668 {
9669 if (!super.CanPutAsAttachment(parent))
9670 {
9671 return false;
9672 }
9673
9674 if (!IsRuined() && !parent.IsRuined())
9675 {
9676 return true;
9677 }
9678
9679 return false;
9680 }
9681
9683 {
9684
9685
9686
9687
9688 return super.CanReceiveItemIntoCargo(item);
9689 }
9690
9692 {
9693
9694
9695
9696
9697 GameInventory attachmentInv = attachment.GetInventory();
9699 {
9700 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9701 return false;
9702 }
9703
9704 InventoryLocation loc = new InventoryLocation();
9705 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9706 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9707 return false;
9708
9709 return super.CanReceiveAttachment(attachment, slotId);
9710 }
9711
9713 {
9714 if (!super.CanReleaseAttachment(attachment))
9715 return false;
9716
9717 return GetInventory().AreChildrenAccessible();
9718 }
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9741 {
9742 int id = muzzle_owner.GetMuzzleID();
9743 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9744
9745 if (WPOF_array)
9746 {
9747 for (int i = 0; i < WPOF_array.Count(); i++)
9748 {
9749 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9750
9751 if (WPOF)
9752 {
9753 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9754 }
9755 }
9756 }
9757 }
9758
9759
9761 {
9762 int id = muzzle_owner.GetMuzzleID();
9764
9765 if (WPOBE_array)
9766 {
9767 for (int i = 0; i < WPOBE_array.Count(); i++)
9768 {
9769 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9770
9771 if (WPOBE)
9772 {
9773 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9774 }
9775 }
9776 }
9777 }
9778
9779
9781 {
9782 int id = muzzle_owner.GetMuzzleID();
9783 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9784
9785 if (WPOOH_array)
9786 {
9787 for (int i = 0; i < WPOOH_array.Count(); i++)
9788 {
9789 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9790
9791 if (WPOOH)
9792 {
9793 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9794 }
9795 }
9796 }
9797 }
9798
9799
9801 {
9802 int id = muzzle_owner.GetMuzzleID();
9803 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9804
9805 if (WPOOH_array)
9806 {
9807 for (int i = 0; i < WPOOH_array.Count(); i++)
9808 {
9809 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9810
9811 if (WPOOH)
9812 {
9813 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9814 }
9815 }
9816 }
9817 }
9818
9819
9821 {
9822 int id = muzzle_owner.GetMuzzleID();
9823 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9824
9825 if (WPOOH_array)
9826 {
9827 for (int i = 0; i < WPOOH_array.Count(); i++)
9828 {
9829 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9830
9831 if (WPOOH)
9832 {
9833 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9834 }
9835 }
9836 }
9837 }
9838
9839
9840
9842 {
9844 {
9845 return true;
9846 }
9847
9848 return false;
9849 }
9850
9852 {
9854 {
9855 return true;
9856 }
9857
9858 return false;
9859 }
9860
9862 {
9864 {
9865 return true;
9866 }
9867
9868 return false;
9869 }
9870
9872 {
9873 return false;
9874 }
9875
9878 {
9879 return UATimeSpent.DEFAULT_DEPLOY;
9880 }
9881
9882
9883
9884
9886 {
9888 SetSynchDirty();
9889 }
9890
9892 {
9894 }
9895
9896
9898 {
9899 return false;
9900 }
9901
9904 {
9905 string att_type = "None";
9906
9907 if (ConfigIsExisting("soundAttType"))
9908 {
9909 att_type = ConfigGetString("soundAttType");
9910 }
9911
9913 }
9914
9916 {
9918 }
9919
9920
9921
9922
9923
9929
9931 {
9934
9936 }
9937
9938
9940 {
9942 return;
9943
9945
9948
9951
9952 SoundParameters params = new SoundParameters();
9956 }
9957
9958
9960 {
9962 {
9965
9966 SetSynchDirty();
9967
9970 }
9971 }
9972
9974 {
9976 }
9977
9978
9980 {
9982 return;
9983
9985 SetSynchDirty();
9986
9989 }
9990
9992 {
9995 }
9996
9998 {
10000 }
10001
10002 void OnApply(PlayerBase player);
10003
10005 {
10006 return 1.0;
10007 };
10008
10010 {
10012 }
10013
10015 {
10017 }
10018
10020
10022 {
10023 SetDynamicPhysicsLifeTime(0.01);
10025 }
10026
10028 {
10029 array<string> zone_names = new array<string>;
10030 GetDamageZones(zone_names);
10031 for (int i = 0; i < zone_names.Count(); i++)
10032 {
10033 SetHealthMax(zone_names.Get(i),"Health");
10034 }
10035 SetHealthMax("","Health");
10036 }
10037
10040 {
10041 float global_health = GetHealth01("","Health");
10042 array<string> zones = new array<string>;
10043 GetDamageZones(zones);
10044
10045 for (int i = 0; i < zones.Count(); i++)
10046 {
10047 SetHealth01(zones.Get(i),"Health",global_health);
10048 }
10049 }
10050
10053 {
10054 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10055 }
10056
10058 {
10059 if (!hasRootAsPlayer)
10060 {
10061 if (refParentIB)
10062 {
10063
10064 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10065 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10066
10067 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10068 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10069
10072 }
10073 else
10074 {
10075
10078 }
10079 }
10080 }
10081
10083 {
10085 {
10086 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10087 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10088 {
10089 float heatPermCoef = 1.0;
10091 while (ent)
10092 {
10093 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10094 ent = ent.GetHierarchyParent();
10095 }
10096
10097 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10098 }
10099 }
10100 }
10101
10103 {
10104
10105 EntityAI parent = GetHierarchyParent();
10106 if (!parent)
10107 {
10108 hasParent = false;
10109 hasRootAsPlayer = false;
10110 }
10111 else
10112 {
10113 hasParent = true;
10114 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10115 refParentIB =
ItemBase.Cast(parent);
10116 }
10117 }
10118
10119 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10120 {
10121
10122 }
10123
10125 {
10126
10127 return false;
10128 }
10129
10131 {
10132
10133
10134 return false;
10135 }
10136
10138 {
10139
10140 return false;
10141 }
10142
10145 {
10146 return !GetIsFrozen() &&
IsOpen();
10147 }
10148
10150 {
10151 bool hasParent = false, hasRootAsPlayer = false;
10153
10154 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10155 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10156
10157 if (wwtu || foodDecay)
10158 {
10162
10163 if (processWetness || processTemperature || processDecay)
10164 {
10166
10167 if (processWetness)
10168 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10169
10170 if (processTemperature)
10172
10173 if (processDecay)
10174 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10175 }
10176 }
10177 }
10178
10181 {
10183 }
10184
10186 {
10189
10190 return super.GetTemperatureFreezeThreshold();
10191 }
10192
10194 {
10197
10198 return super.GetTemperatureThawThreshold();
10199 }
10200
10202 {
10205
10206 return super.GetItemOverheatThreshold();
10207 }
10208
10210 {
10212 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10213
10214 return super.GetTemperatureFreezeTime();
10215 }
10216
10218 {
10220 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10221
10222 return super.GetTemperatureThawTime();
10223 }
10224
10229
10231 {
10232 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10233 }
10234
10236 {
10237 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10238 }
10239
10242 {
10244 }
10245
10247 {
10249 }
10250
10252 {
10254 }
10255
10258 {
10259 return null;
10260 }
10261
10264 {
10265 return false;
10266 }
10267
10269 {
10271 {
10274 if (!trg)
10275 {
10277 explosive = this;
10278 }
10279
10280 explosive.PairRemote(trg);
10282
10283 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10284 trg.SetPersistentPairID(persistentID);
10285 explosive.SetPersistentPairID(persistentID);
10286
10287 return true;
10288 }
10289 return false;
10290 }
10291
10294 {
10295 float ret = 1.0;
10298 ret *= GetHealth01();
10299
10300 return ret;
10301 }
10302
10303 #ifdef DEVELOPER
10304 override void SetDebugItem()
10305 {
10306 super.SetDebugItem();
10307 _itemBase = this;
10308 }
10309
10311 {
10312 string text = super.GetDebugText();
10313
10315 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10316
10317 return text;
10318 }
10319 #endif
10320
10322 {
10323 return true;
10324 }
10325
10327
10329
10331 {
10334 }
10335
10336
10344
10360
10361 [
Obsolete(
"Use ItemSoundHandler instead")]
10364 {
10365 if (!
g_Game.IsDedicatedServer())
10366 {
10367 if (ConfigIsExisting("attachSoundSet"))
10368 {
10369 string cfg_path = "";
10370 string soundset = "";
10371 string type_name =
GetType();
10372
10375 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10376 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10377
10378 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10379 {
10380 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10381 {
10382 if (cfg_slot_array[i] == slot_type)
10383 {
10384 soundset = cfg_soundset_array[i];
10385 break;
10386 }
10387 }
10388 }
10389
10390 if (soundset != "")
10391 {
10392 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10394 }
10395 }
10396 }
10397 }
10398
10400}
10401
10403{
10405 if (entity)
10406 {
10407 bool is_item = entity.IsInherited(
ItemBase);
10408 if (is_item && full_quantity)
10409 {
10412 }
10413 }
10414 else
10415 {
10417 return NULL;
10418 }
10419 return entity;
10420}
10421
10423{
10424 if (item)
10425 {
10426 if (health > 0)
10427 item.SetHealth("", "", health);
10428
10429 if (item.CanHaveTemperature())
10430 {
10432 if (item.CanFreeze())
10433 item.SetFrozen(false);
10434 }
10435
10436 if (item.HasEnergyManager())
10437 {
10438 if (quantity >= 0)
10439 {
10440 item.GetCompEM().SetEnergy0To1(quantity);
10441 }
10442 else
10443 {
10445 }
10446 }
10447 else if (item.IsMagazine())
10448 {
10449 Magazine mag = Magazine.Cast(item);
10450 if (quantity >= 0)
10451 {
10452 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10453 }
10454 else
10455 {
10457 }
10458
10459 }
10460 else
10461 {
10462 if (quantity >= 0)
10463 {
10464 item.SetQuantityNormalized(quantity, false);
10465 }
10466 else
10467 {
10469 }
10470
10471 }
10472 }
10473}
10474
10475#ifdef DEVELOPER
10477#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.