5846{
5848 {
5849 return true;
5850 }
5851};
5852
5854{
5855
5856};
5857
5858
5859
5861{
5865
5867
5870
5871
5872
5873
5874
5883
5889
5894
5899
5920 protected bool m_IsResultOfSplit
5921
5923
5928
5929
5930
5932
5936
5937
5938
5940
5943
5944
5945
5951
5952
5960
5963
5964
5966
5967
5969
5970
5975
5976
5981
5983
5984
5986
5987
5989 {
5994
5995 if (!
g_Game.IsDedicatedServer())
5996 {
5998 {
6000
6002 {
6004 }
6005 }
6006
6009 }
6010
6011 m_OldLocation = null;
6012
6014 {
6016 }
6017
6018 if (ConfigIsExisting("headSelectionsToHide"))
6019 {
6022 }
6023
6025 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6026 {
6028 }
6029
6031
6032 m_IsResultOfSplit = false;
6033
6035 }
6036
6038 {
6039 super.InitItemVariables();
6040
6046 m_Count = ConfigGetInt(
"count");
6047
6050
6055
6058
6063
6075
6079
6080
6083 if (ConfigIsExisting("canBeSplit"))
6084 {
6087 }
6088
6090 if (ConfigIsExisting("itemBehaviour"))
6092
6093
6096 RegisterNetSyncVariableInt("m_VarLiquidType");
6097 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6098
6099 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6100 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6101 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6102
6103 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6104 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6105 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6106 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6107
6108 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6109 RegisterNetSyncVariableBool("m_IsTakeable");
6110 RegisterNetSyncVariableBool("m_IsHologram");
6111
6114 {
6117 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6118 }
6119
6121
6123 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6125
6127 }
6128
6130 {
6132 }
6133
6135 {
6138 {
6143 }
6144 }
6145
6146 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6147 {
6149 {
6152 }
6153
6155 }
6156
6158 {
6164 }
6165
6167
6169 {
6171
6172 if (!action)
6173 {
6174 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6175 return;
6176 }
6177
6179 if (!ai)
6180 {
6182 return;
6183 }
6184
6186 if (!action_array)
6187 {
6188 action_array = new array<ActionBase_Basic>;
6190 }
6191 if (LogManager.IsActionLogEnable())
6192 {
6193 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6194 }
6195
6196 if (action_array.Find(action) != -1)
6197 {
6198 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6199 }
6200 else
6201 {
6202 action_array.Insert(action);
6203 }
6204 }
6205
6207 {
6208 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6209 ActionBase action = player.GetActionManager().GetAction(actionName);
6212
6213 if (action_array)
6214 {
6215 action_array.RemoveItem(action);
6216 }
6217 }
6218
6219
6220
6222 {
6223 ActionOverrideData overrideData = new ActionOverrideData();
6227
6229 if (!actionMap)
6230 {
6233 }
6234
6235 actionMap.Insert(this.
Type(), overrideData);
6236
6237 }
6238
6240
6242
6243
6245 {
6248
6251
6252 string config_to_search = "CfgVehicles";
6253 string muzzle_owner_config;
6254
6256 {
6257 if (IsInherited(Weapon))
6258 config_to_search = "CfgWeapons";
6259
6260 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6261
6262 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6263
6264 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6265
6266 if (config_OnFire_subclass_count > 0)
6267 {
6268 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6269
6270 for (int i = 0; i < config_OnFire_subclass_count; i++)
6271 {
6272 string particle_class = "";
6273 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6274 string config_OnFire_entry = config_OnFire_class + particle_class;
6275 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6276 WPOF_array.Insert(WPOF);
6277 }
6278
6279
6281 }
6282 }
6283
6285 {
6286 config_to_search = "CfgWeapons";
6287 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6288
6289 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6290
6291 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6292
6293 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6294 {
6295 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6296
6297 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6298 {
6299 string particle_class2 = "";
6300 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6301 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6302 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6303 WPOBE_array.Insert(WPOBE);
6304 }
6305
6306
6308 }
6309 }
6310 }
6311
6312
6314 {
6317
6319 {
6320 string config_to_search = "CfgVehicles";
6321
6322 if (IsInherited(Weapon))
6323 config_to_search = "CfgWeapons";
6324
6325 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6326 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6327
6328 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6329 {
6330
6332
6334 {
6336 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6338 return;
6339 }
6340
6343
6344
6345
6346 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6347 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6348
6349 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6350 {
6351 string particle_class = "";
6352 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6353 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6354 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6355
6356 if (entry_type == CT_CLASS)
6357 {
6358 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6359 WPOOH_array.Insert(WPOF);
6360 }
6361 }
6362
6363
6365 }
6366 }
6367 }
6368
6370 {
6372 }
6373
6375 {
6377 {
6379
6382
6385
6386 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6387 }
6388 }
6389
6391 {
6393 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6394
6396 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6397
6399 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6400
6402 {
6404 }
6405 }
6406
6408 {
6410 }
6411
6413 {
6416 else
6418
6420 {
6423 }
6424 else
6425 {
6428
6431 }
6432
6434 }
6435
6437 {
6439 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6440 }
6441
6443 {
6445 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6447 }
6448
6450 {
6452 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6453 }
6454
6456 {
6459
6460 OverheatingParticle OP = new OverheatingParticle();
6465
6467 }
6468
6470 {
6473
6474 return -1;
6475 }
6476
6478 {
6480 {
6483
6484 for (int i = count; i > 0; --i)
6485 {
6486 int id = i - 1;
6489
6492
6493 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6494 {
6495 if (p)
6496 {
6499 }
6500 }
6501 }
6502 }
6503 }
6504
6506 {
6508 {
6510 {
6511 int id = i - 1;
6513
6514 if (OP)
6515 {
6517
6518 if (p)
6519 {
6521 }
6522
6523 delete OP;
6524 }
6525 }
6526
6529 }
6530 }
6531
6534 {
6535 return 0.0;
6536 }
6537
6538
6540 {
6541 return 250;
6542 }
6543
6545 {
6546 return 0;
6547 }
6548
6551 {
6553 return true;
6554
6555 return false;
6556 }
6557
6560 {
6563
6565 {
6567 }
6568 else
6569 {
6570
6572 }
6573
6575 }
6576
6583 {
6584 return -1;
6585 }
6586
6587
6588
6589
6591 {
6593 {
6594 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6595 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6596
6597 if (r_index >= 0)
6598 {
6599 InventoryLocation r_il = new InventoryLocation;
6600 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6601
6602 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6605 {
6606 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6607 }
6609 {
6610 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6611 }
6612
6613 }
6614
6615 player.GetHumanInventory().ClearUserReservedLocation(this);
6616 }
6617
6620 }
6621
6622
6623
6624
6626 {
6627 return ItemBase.m_DebugActionsMask;
6628 }
6629
6631 {
6632 return ItemBase.m_DebugActionsMask & mask;
6633 }
6634
6636 {
6637 ItemBase.m_DebugActionsMask = mask;
6638 }
6639
6641 {
6642 ItemBase.m_DebugActionsMask |= mask;
6643 }
6644
6646 {
6647 ItemBase.m_DebugActionsMask &= ~mask;
6648 }
6649
6651 {
6653 {
6655 }
6656 else
6657 {
6659 }
6660 }
6661
6662
6664 {
6665 if (GetEconomyProfile())
6666 {
6667 float q_max = GetEconomyProfile().GetQuantityMax();
6668 if (q_max > 0)
6669 {
6670 float q_min = GetEconomyProfile().GetQuantityMin();
6671 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6672
6674 {
6675 ComponentEnergyManager comp = GetCompEM();
6677 {
6679 }
6680 }
6682 {
6684
6685 }
6686
6687 }
6688 }
6689 }
6690
6693 {
6694 EntityAI parent = GetHierarchyParent();
6695
6696 if (parent)
6697 {
6698 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6699 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6700 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6701 }
6702 }
6703
6706 {
6707 EntityAI parent = GetHierarchyParent();
6708
6709 if (parent)
6710 {
6711 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6712 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6713 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6714 }
6715 }
6716
6718 {
6719
6720
6721
6722
6724
6726 {
6727 if (ScriptInputUserData.CanStoreInputUserData())
6728 {
6729 ScriptInputUserData ctx = new ScriptInputUserData;
6735 ctx.
Write(use_stack_max);
6738
6740 {
6741 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6742 }
6743 }
6744 }
6745 else if (!
g_Game.IsMultiplayer())
6746 {
6748 }
6749 }
6750
6752 {
6754 }
6755
6757 {
6759 }
6760
6762 {
6764 }
6765
6767 {
6768
6769 return false;
6770 }
6771
6773 {
6774 return false;
6775 }
6776
6780 {
6781 return false;
6782 }
6783
6785 {
6786 return "";
6787 }
6788
6790
6792 {
6793 return false;
6794 }
6795
6797 {
6798 return true;
6799 }
6800
6801
6802
6804 {
6805 return true;
6806 }
6807
6809 {
6810 return true;
6811 }
6812
6814 {
6815 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6817 }
6818
6820 {
6822 }
6823
6825 {
6827 if (!is_being_placed)
6829 SetSynchDirty();
6830 }
6831
6832
6834
6836 {
6838 }
6839
6841 {
6843 }
6844
6846 {
6847 return 1;
6848 }
6849
6851 {
6852 return false;
6853 }
6854
6856 {
6858 SetSynchDirty();
6859 }
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6896 {
6897 super.OnMovedInsideCargo(container);
6898
6899 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6900 }
6901
6902 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6903 {
6904 super.EEItemLocationChanged(oldLoc, newLoc);
6905
6906 PlayerBase newPlayer = null;
6907 PlayerBase oldPlayer = null;
6908
6909 if (newLoc.GetParent())
6910 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6911
6912 if (oldLoc.GetParent())
6913 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6914
6916 {
6917 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6918
6919 if (rIndex >= 0)
6920 {
6921 InventoryLocation rIl = new InventoryLocation;
6922 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6923
6924 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6927 {
6928 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6929 }
6931 {
6933 }
6934
6935 }
6936 }
6937
6939 {
6940 if (newPlayer)
6941 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6942
6943 if (newPlayer == oldPlayer)
6944 {
6945 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6946 {
6948 {
6949 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6950 {
6951 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6952 }
6953 }
6954 else
6955 {
6956 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6957 }
6958 }
6959
6960 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6961 {
6962 int type = oldLoc.GetType();
6964 {
6965 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6966 }
6968 {
6969 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6970 }
6971 }
6972 if (!m_OldLocation)
6973 {
6974 m_OldLocation = new InventoryLocation;
6975 }
6976 m_OldLocation.Copy(oldLoc);
6977 }
6978 else
6979 {
6980 if (m_OldLocation)
6981 {
6982 m_OldLocation.Reset();
6983 }
6984 }
6985
6986 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6987 }
6988 else
6989 {
6990 if (newPlayer)
6991 {
6992 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6993 if (resIndex >= 0)
6994 {
6995 InventoryLocation il = new InventoryLocation;
6996 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6998 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7001 {
7002 il.
GetParent().GetOnReleaseLock().Invoke(it);
7003 }
7005 {
7007 }
7008
7009 }
7010 }
7012 {
7013
7015 }
7016
7017 if (m_OldLocation)
7018 {
7019 m_OldLocation.Reset();
7020 }
7021 }
7022
7024 {
7025 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7026 }
7027
7029 {
7030 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7031 }
7032 }
7033
7034 override void EOnContact(IEntity other, Contact extra)
7035 {
7037 {
7038 int liquidType = -1;
7040 if (impactSpeed > 0.0)
7041 {
7043 #ifndef SERVER
7045 #else
7047 SetSynchDirty();
7048 #endif
7050 }
7051 }
7052
7053 #ifdef SERVER
7054 if (GetCompEM() && GetCompEM().IsPlugged())
7055 {
7056 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7057 GetCompEM().UnplugThis();
7058 }
7059 #endif
7060 }
7061
7063
7065 {
7067 }
7068
7070 {
7071
7072 }
7073
7075 {
7076 super.OnItemLocationChanged(old_owner, new_owner);
7077
7078 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7079 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7080
7081 if (!relatedPlayer && playerNew)
7082 relatedPlayer = playerNew;
7083
7084 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7085 {
7087 if (actionMgr)
7088 {
7089 ActionBase currentAction = actionMgr.GetRunningAction();
7090 if (currentAction)
7092 }
7093 }
7094
7095 Man ownerPlayerOld = null;
7096 Man ownerPlayerNew = null;
7097
7098 if (old_owner)
7099 {
7100 if (old_owner.
IsMan())
7101 {
7102 ownerPlayerOld = Man.Cast(old_owner);
7103 }
7104 else
7105 {
7106 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7107 }
7108 }
7109 else
7110 {
7112 {
7114
7115 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7116 {
7117 GetCompEM().UnplugThis();
7118 }
7119 }
7120 }
7121
7122 if (new_owner)
7123 {
7124 if (new_owner.
IsMan())
7125 {
7126 ownerPlayerNew = Man.Cast(new_owner);
7127 }
7128 else
7129 {
7130 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7131 }
7132 }
7133
7134 if (ownerPlayerOld != ownerPlayerNew)
7135 {
7136 if (ownerPlayerOld)
7137 {
7138 array<EntityAI> subItemsExit = new array<EntityAI>;
7140 for (int i = 0; i < subItemsExit.Count(); i++)
7141 {
7144 }
7145 }
7146
7147 if (ownerPlayerNew)
7148 {
7149 array<EntityAI> subItemsEnter = new array<EntityAI>;
7151 for (int j = 0; j < subItemsEnter.Count(); j++)
7152 {
7155 }
7156 }
7157 }
7158 else if (ownerPlayerNew != null)
7159 {
7160 PlayerBase nplayer;
7161 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7162 {
7163 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7165 for (int k = 0; k < subItemsUpdate.Count(); k++)
7166 {
7168 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7169 }
7170 }
7171 }
7172
7173 if (old_owner)
7174 old_owner.OnChildItemRemoved(this);
7175 if (new_owner)
7176 new_owner.OnChildItemReceived(this);
7177 }
7178
7179
7181 {
7182 super.EEDelete(parent);
7183 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7184 if (player)
7185 {
7187
7188 if (player.IsAlive())
7189 {
7190 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7191 if (r_index >= 0)
7192 {
7193 InventoryLocation r_il = new InventoryLocation;
7194 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7195
7196 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7199 {
7200 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7201 }
7203 {
7204 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7205 }
7206
7207 }
7208
7209 player.RemoveQuickBarEntityShortcut(this);
7210 }
7211 }
7212 }
7213
7215 {
7216 super.EEKilled(killer);
7217
7220 {
7221 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7222 {
7223 if (IsMagazine())
7224 {
7225 if (Magazine.Cast(this).GetAmmoCount() > 0)
7226 {
7228 }
7229 }
7230 else
7231 {
7233 }
7234 }
7235 }
7236 }
7237
7239 {
7240 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7241
7242 super.OnWasAttached(parent, slot_id);
7243
7246
7249 }
7250
7252 {
7253 super.OnWasDetached(parent, slot_id);
7254
7257
7260 }
7261
7263 {
7264 int idx;
7267
7268 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7269 if (inventory_slots.Count() < 1)
7270 {
7271 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7272 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7273 }
7274 else
7275 {
7276 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7277 }
7278
7279 idx = inventory_slots.Find(slot);
7280 if (idx < 0)
7281 return "";
7282
7283 return attach_types.Get(idx);
7284 }
7285
7287 {
7288 int idx = -1;
7289 string slot;
7290
7293
7294 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7295 if (inventory_slots.Count() < 1)
7296 {
7297 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7298 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7299 }
7300 else
7301 {
7302 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7303 if (detach_types.Count() < 1)
7304 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7305 }
7306
7307 for (int i = 0; i < inventory_slots.Count(); i++)
7308 {
7309 slot = inventory_slots.Get(i);
7310 }
7311
7312 if (slot != "")
7313 {
7314 if (detach_types.Count() == 1)
7315 idx = 0;
7316 else
7317 idx = inventory_slots.Find(slot);
7318 }
7319 if (idx < 0)
7320 return "";
7321
7322 return detach_types.Get(idx);
7323 }
7324
7326 {
7327
7329
7330
7331 float min_time = 1;
7332 float max_time = 3;
7333 float delay = Math.RandomFloat(min_time, max_time);
7334
7335 explode_timer.Run(delay, this, "DoAmmoExplosion");
7336 }
7337
7339 {
7340 Magazine magazine = Magazine.Cast(this);
7341 int pop_sounds_count = 6;
7342 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7343
7344
7345 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7346 string sound_name = pop_sounds[ sound_idx ];
7347 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7348
7349
7350 magazine.ServerAddAmmoCount(-1);
7351
7352
7353 float min_temp_to_explode = 100;
7354
7355 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7356 {
7358 }
7359 }
7360
7361
7362 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7363 {
7364 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7365
7366 const int CHANCE_DAMAGE_CARGO = 4;
7367 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7368 const int CHANCE_DAMAGE_NOTHING = 2;
7369
7371 {
7372 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7373 int chances;
7374 int rnd;
7375
7376 if (GetInventory().GetCargo())
7377 {
7378 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7379 rnd = Math.RandomInt(0,chances);
7380
7381 if (rnd < CHANCE_DAMAGE_CARGO)
7382 {
7384 }
7385 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7386 {
7388 }
7389 }
7390 else
7391 {
7392 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7393 rnd = Math.RandomInt(0,chances);
7394
7395 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7396 {
7398 }
7399 }
7400 }
7401 }
7402
7404 {
7405 CargoBase cargo = GetInventory().GetCargo();
7406 if (cargo)
7407 {
7409 if (item_count > 0)
7410 {
7411 int random_pick = Math.RandomInt(0, item_count);
7413 if (!item.IsExplosive())
7414 {
7415 item.AddHealth("","",damage);
7416 return true;
7417 }
7418 }
7419 }
7420 return false;
7421 }
7422
7424 {
7425 GameInventory inventory = GetInventory();
7427 if (attachment_count > 0)
7428 {
7429 int random_pick = Math.RandomInt(0, attachment_count);
7431 if (!attachment.IsExplosive())
7432 {
7433 attachment.AddHealth("","",damage);
7434 return true;
7435 }
7436 }
7437 return false;
7438 }
7439
7441 {
7443 }
7444
7446 {
7448 return GetInventory().CanRemoveEntity();
7449
7450 return false;
7451 }
7452
7454 {
7455
7457 return false;
7458
7459
7461 return false;
7462
7463
7464
7466 if (delta == 0)
7467 return false;
7468
7469
7470 return true;
7471 }
7472
7474 {
7476 {
7477 if (ScriptInputUserData.CanStoreInputUserData())
7478 {
7479 ScriptInputUserData ctx = new ScriptInputUserData;
7484 ctx.
Write(destination_entity);
7488 }
7489 }
7490 else if (!
g_Game.IsMultiplayer())
7491 {
7493 }
7494 }
7495
7497 {
7498 float split_quantity_new;
7502 InventoryLocation loc = new InventoryLocation;
7503
7504 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7505 {
7507 split_quantity_new = stack_max;
7508 else
7510
7512 {
7513 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7514 if (new_item)
7515 {
7516 new_item.SetResultOfSplit(true);
7517 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7519 new_item.
SetQuantity(split_quantity_new,
false,
true);
7520 }
7521 }
7522 }
7523 else if (destination_entity && slot_id == -1)
7524 {
7525 if (quantity > stack_max)
7526 split_quantity_new = stack_max;
7527 else
7528 split_quantity_new = quantity;
7529
7531 {
7532 GameInventory destinationInventory = destination_entity.GetInventory();
7534 {
7537 }
7538
7539 if (new_item)
7540 {
7541 new_item.SetResultOfSplit(true);
7542 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7544 new_item.
SetQuantity(split_quantity_new,
false,
true);
7545 }
7546 }
7547 }
7548 else
7549 {
7550 if (stack_max != 0)
7551 {
7553 {
7555 }
7556
7557 if (split_quantity_new == 0)
7558 {
7559 if (!
g_Game.IsMultiplayer())
7560 player.PhysicalPredictiveDropItem(this);
7561 else
7562 player.ServerDropEntity(this);
7563 return;
7564 }
7565
7567 {
7569
7570 if (new_item)
7571 {
7572 new_item.SetResultOfSplit(true);
7573 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7576 new_item.PlaceOnSurface();
7577 }
7578 }
7579 }
7580 }
7581 }
7582
7584 {
7585 float split_quantity_new;
7589 InventoryLocation loc = new InventoryLocation;
7590
7591 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7592 {
7594 split_quantity_new = stack_max;
7595 else
7597
7599 {
7600 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7601 if (new_item)
7602 {
7603 new_item.SetResultOfSplit(true);
7604 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7606 new_item.
SetQuantity(split_quantity_new,
false,
true);
7607 }
7608 }
7609 }
7610 else if (destination_entity && slot_id == -1)
7611 {
7612 if (quantity > stack_max)
7613 split_quantity_new = stack_max;
7614 else
7615 split_quantity_new = quantity;
7616
7618 {
7619 GameInventory destinationInventory = destination_entity.GetInventory();
7621 {
7624 }
7625
7626 if (new_item)
7627 {
7628 new_item.SetResultOfSplit(true);
7629 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7631 new_item.
SetQuantity(split_quantity_new,
false,
true);
7632 }
7633 }
7634 }
7635 else
7636 {
7637 if (stack_max != 0)
7638 {
7640 {
7642 }
7643
7645 {
7647
7648 if (new_item)
7649 {
7650 new_item.SetResultOfSplit(true);
7651 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7654 new_item.PlaceOnSurface();
7655 }
7656 }
7657 }
7658 }
7659 }
7660
7662 {
7664 {
7665 if (ScriptInputUserData.CanStoreInputUserData())
7666 {
7667 ScriptInputUserData ctx = new ScriptInputUserData;
7672 dst.WriteToContext(ctx);
7674 }
7675 }
7676 else if (!
g_Game.IsMultiplayer())
7677 {
7679 }
7680 }
7681
7683 {
7685 {
7686 if (ScriptInputUserData.CanStoreInputUserData())
7687 {
7688 ScriptInputUserData ctx = new ScriptInputUserData;
7693 ctx.
Write(destination_entity);
7699 }
7700 }
7701 else if (!
g_Game.IsMultiplayer())
7702 {
7704 }
7705 }
7706
7708 {
7710 }
7711
7713 {
7715 float split_quantity_new;
7717 if (dst.IsValid())
7718 {
7719 int slot_id = dst.GetSlot();
7721
7722 if (quantity > stack_max)
7723 split_quantity_new = stack_max;
7724 else
7725 split_quantity_new = quantity;
7726
7728 {
7730
7731 if (new_item)
7732 {
7733 new_item.SetResultOfSplit(true);
7734 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7736 new_item.
SetQuantity(split_quantity_new,
false,
true);
7737 }
7738
7739 return new_item;
7740 }
7741 }
7742
7743 return null;
7744 }
7745
7747 {
7749 float split_quantity_new;
7751 if (destination_entity)
7752 {
7754 if (quantity > stackable)
7755 split_quantity_new = stackable;
7756 else
7757 split_quantity_new = quantity;
7758
7760 {
7761 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7762 if (new_item)
7763 {
7764 new_item.SetResultOfSplit(true);
7765 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7767 new_item.
SetQuantity(split_quantity_new,
false,
true);
7768 }
7769 }
7770 }
7771 }
7772
7774 {
7776 {
7777 if (ScriptInputUserData.CanStoreInputUserData())
7778 {
7779 ScriptInputUserData ctx = new ScriptInputUserData;
7784 ItemBase destination_entity =
this;
7785 ctx.
Write(destination_entity);
7789 }
7790 }
7791 else if (!
g_Game.IsMultiplayer())
7792 {
7794 }
7795 }
7796
7798 {
7800 float split_quantity_new;
7802 if (player)
7803 {
7805 if (quantity > stackable)
7806 split_quantity_new = stackable;
7807 else
7808 split_quantity_new = quantity;
7809
7811 {
7812 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7813 new_item =
ItemBase.Cast(in_hands);
7814 if (new_item)
7815 {
7816 new_item.SetResultOfSplit(true);
7817 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7819 new_item.SetQuantity(split_quantity_new, false, true);
7820 }
7821 }
7822 }
7823 }
7824
7826 {
7828 float split_quantity_new = Math.Floor(quantity * 0.5);
7829
7831 return;
7832
7834
7835 if (new_item)
7836 {
7837 if (new_item.GetQuantityMax() < split_quantity_new)
7838 {
7839 split_quantity_new = new_item.GetQuantityMax();
7840 }
7841
7842 new_item.SetResultOfSplit(true);
7843 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7844
7846 {
7849 }
7850 else
7851 {
7853 new_item.
SetQuantity(split_quantity_new,
false,
true);
7854 }
7855 }
7856 }
7857
7859 {
7861 float split_quantity_new = Math.Floor(quantity / 2);
7862
7864 return;
7865
7866 InventoryLocation invloc = new InventoryLocation;
7868
7870 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7871
7872 if (new_item)
7873 {
7874 if (new_item.GetQuantityMax() < split_quantity_new)
7875 {
7876 split_quantity_new = new_item.GetQuantityMax();
7877 }
7879 {
7882 }
7883 else if (split_quantity_new > 1)
7884 {
7886 new_item.
SetQuantity(split_quantity_new,
false,
true);
7887 }
7888 }
7889 }
7890
7893 {
7894 SetWeightDirty();
7896
7897 if (parent)
7898 parent.OnAttachmentQuantityChangedEx(this, delta);
7899
7901 {
7903 {
7905 }
7907 {
7908 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7910 }
7911 }
7912 }
7913
7916 {
7917
7918 }
7919
7922 {
7924 }
7925
7927 {
7928 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7929
7931 {
7932 if (newLevel == GameConstants.STATE_RUINED)
7933 {
7935 EntityAI parent = GetHierarchyParent();
7936 if (parent && parent.IsFireplace())
7937 {
7938 CargoBase cargo = GetInventory().GetCargo();
7939 if (cargo)
7940 {
7942 {
7944 }
7945 }
7946 }
7947 }
7948
7950 {
7951
7953 return;
7954 }
7955
7956 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7957 {
7959 }
7960 }
7961 }
7962
7963
7965 {
7966 super.OnRightClick();
7967
7969 {
7971 {
7972 if (ScriptInputUserData.CanStoreInputUserData())
7973 {
7974 EntityAI root = GetHierarchyRoot();
7975 Man playerOwner = GetHierarchyRootPlayer();
7976 InventoryLocation dst = new InventoryLocation;
7977
7978
7979 if (!playerOwner && root && root == this)
7980 {
7982 }
7983 else
7984 {
7985
7986 GetInventory().GetCurrentInventoryLocation(dst);
7988 {
7989 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7991 {
7993 }
7994 else
7995 {
7997
7998
7999 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8000 {
8002 }
8003 else
8004 {
8005 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8006 }
8007 }
8008 }
8009 }
8010
8011 ScriptInputUserData ctx = new ScriptInputUserData;
8019 }
8020 }
8021 else if (!
g_Game.IsMultiplayer())
8022 {
8024 }
8025 }
8026 }
8027
8029 {
8030 if (root)
8031 {
8032 vector m4[4];
8033 root.GetTransform(m4);
8034 dst.SetGround(this, m4);
8035 }
8036 else
8037 {
8038 GetInventory().GetCurrentInventoryLocation(dst);
8039 }
8040 }
8041
8042 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8043 {
8044
8045 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8046 return false;
8047
8048 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8049 return false;
8050
8051
8053 return false;
8054
8055
8056 Magazine mag = Magazine.Cast(this);
8057 if (mag)
8058 {
8059 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8060 return false;
8061
8062 if (stack_max_limit)
8063 {
8064 Magazine other_mag = Magazine.Cast(other_item);
8065 if (other_item)
8066 {
8067 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8068 return false;
8069 }
8070
8071 }
8072 }
8073 else
8074 {
8075
8077 return false;
8078
8080 return false;
8081 }
8082
8083 PlayerBase player = null;
8084 if (CastTo(player, GetHierarchyRootPlayer()))
8085 {
8086 if (player.GetInventory().HasAttachment(this))
8087 return false;
8088
8089 if (player.IsItemsToDelete())
8090 return false;
8091 }
8092
8093 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8094 return false;
8095
8096 int slotID;
8098 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8099 return false;
8100
8101 return true;
8102 }
8103
8105 {
8107 }
8108
8110 {
8111 return m_IsResultOfSplit;
8112 }
8113
8115 {
8116 m_IsResultOfSplit = value;
8117 }
8118
8120 {
8122 }
8123
8125 {
8126 float other_item_quantity = other_item.GetQuantity();
8127 float this_free_space;
8128
8130
8132
8133 if (other_item_quantity > this_free_space)
8134 {
8135 return this_free_space;
8136 }
8137 else
8138 {
8139 return other_item_quantity;
8140 }
8141 }
8142
8144 {
8146 }
8147
8149 {
8151 return;
8152
8153 if (!IsMagazine() && other_item)
8154 {
8156 if (quantity_used != 0)
8157 {
8158 float hp1 = GetHealth01("","");
8159 float hp2 = other_item.GetHealth01("","");
8160 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8161 hpResult = hpResult / (
GetQuantity() + quantity_used);
8162
8163 hpResult *= GetMaxHealth();
8164 Math.Round(hpResult);
8165 SetHealth("", "Health", hpResult);
8166
8168 other_item.AddQuantity(-quantity_used);
8169 }
8170 }
8172 }
8173
8175 {
8176 #ifdef SERVER
8177 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8178 GetHierarchyParent().IncreaseLifetimeUp();
8179 #endif
8180 };
8181
8183 {
8184 PlayerBase p = PlayerBase.Cast(player);
8185
8186 array<int> recipesIds = p.m_Recipes;
8187 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8188 if (moduleRecipesManager)
8189 {
8190 EntityAI itemInHands = player.GetEntityInHands();
8191 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8192 }
8193
8194 for (int i = 0;i < recipesIds.Count(); i++)
8195 {
8196 int key = recipesIds.Get(i);
8197 string recipeName = moduleRecipesManager.GetRecipeName(key);
8199 }
8200 }
8201
8202
8203 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8204 {
8205 super.GetDebugActions(outputList);
8206
8207
8213
8214
8219
8224
8225
8229
8230
8232 {
8236 }
8237
8240
8241
8245
8247
8248 InventoryLocation loc = new InventoryLocation();
8249 GetInventory().GetCurrentInventoryLocation(loc);
8251 {
8252 if (Gizmo_IsSupported())
8255 }
8256
8258 }
8259
8260
8261
8262
8264 {
8265 super.OnAction(action_id, player, ctx);
8266
8268 {
8269 switch (action_id)
8270 {
8274 return true;
8278 return true;
8279 }
8280 }
8281
8283 {
8284 switch (action_id)
8285 {
8287 Delete();
8288 return true;
8289 }
8290 }
8291
8292 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8293 {
8294 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8295 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8296 PlayerBase p = PlayerBase.Cast(player);
8297 if (
EActions.RECIPES_RANGE_START < 1000)
8298 {
8299 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8300 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8301 }
8302 }
8303 #ifndef SERVER
8304 else if (action_id ==
EActions.WATCH_PLAYER)
8305 {
8306 PluginDeveloper.SetDeveloperItemClientEx(player);
8307 }
8308 #endif
8310 {
8311 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8312 {
8313 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8314 OnDebugButtonPressServer(id + 1);
8315 }
8316
8317 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8318 {
8319 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8321 }
8322
8323 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8324 {
8325 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8327 }
8328
8329 else if (action_id ==
EActions.ADD_QUANTITY)
8330 {
8331 if (IsMagazine())
8332 {
8333 Magazine mag = Magazine.Cast(this);
8334 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8335 }
8336 else
8337 {
8339 }
8340
8341 if (m_EM)
8342 {
8343 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8344 }
8345
8346 }
8347
8348 else if (action_id ==
EActions.REMOVE_QUANTITY)
8349 {
8350 if (IsMagazine())
8351 {
8352 Magazine mag2 = Magazine.Cast(this);
8353 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8354 }
8355 else
8356 {
8358 }
8359 if (m_EM)
8360 {
8361 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8362 }
8363
8364 }
8365
8366 else if (action_id ==
EActions.SET_QUANTITY_0)
8367 {
8369
8370 if (m_EM)
8371 {
8372 m_EM.SetEnergy(0);
8373 }
8374 }
8375
8376 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8377 {
8379
8380 if (m_EM)
8381 {
8382 m_EM.SetEnergy(m_EM.GetEnergyMax());
8383 }
8384 }
8385
8386 else if (action_id ==
EActions.ADD_HEALTH)
8387 {
8388 AddHealth("","",GetMaxHealth("","Health")/5);
8389 }
8390 else if (action_id ==
EActions.REMOVE_HEALTH)
8391 {
8392 AddHealth("","",-GetMaxHealth("","Health")/5);
8393 }
8394 else if (action_id ==
EActions.DESTROY_HEALTH)
8395 {
8396 SetHealth01("","",0);
8397 }
8398 else if (action_id ==
EActions.WATCH_ITEM)
8399 {
8401 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8402 #ifdef DEVELOPER
8403 SetDebugDeveloper_item(this);
8404 #endif
8405 }
8406
8407 else if (action_id ==
EActions.ADD_TEMPERATURE)
8408 {
8409 AddTemperature(20);
8410
8411 }
8412
8413 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8414 {
8415 AddTemperature(-20);
8416
8417 }
8418
8419 else if (action_id ==
EActions.FLIP_FROZEN)
8420 {
8421 SetFrozen(!GetIsFrozen());
8422
8423 }
8424
8425 else if (action_id ==
EActions.ADD_WETNESS)
8426 {
8428
8429 }
8430
8431 else if (action_id ==
EActions.REMOVE_WETNESS)
8432 {
8434
8435 }
8436
8437 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8438 {
8441
8442
8443 }
8444
8445 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8446 {
8449 }
8450
8451 else if (action_id ==
EActions.MAKE_SPECIAL)
8452 {
8453 auto debugParams = DebugSpawnParams.WithPlayer(player);
8454 OnDebugSpawnEx(debugParams);
8455 }
8456
8457 }
8458
8459
8460 return false;
8461 }
8462
8463
8464
8465
8469
8472
8473
8474
8476 {
8477 return false;
8478 }
8479
8480
8482 {
8483 return true;
8484 }
8485
8486
8488 {
8489 return true;
8490 }
8491
8492
8493
8495 {
8496 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8497 return g_Game.ConfigIsExisting(config_path);
8498 }
8499
8502 {
8503 return null;
8504 }
8505
8507 {
8508 return false;
8509 }
8510
8512 {
8513 return false;
8514 }
8515
8519
8520
8522 {
8523 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8524 return module_repairing.CanRepair(this, item_repair_kit);
8525 }
8526
8527
8528 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8529 {
8530 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8531 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8532 }
8533
8534
8536 {
8537
8538
8539
8540
8541
8542
8543
8544
8545 return 1;
8546 }
8547
8548
8549
8551 {
8553 }
8554
8555
8556
8558 {
8560 }
8561
8562
8571 {
8572 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8573
8574 if (player)
8575 {
8576 player.MessageStatus(text);
8577 }
8578 }
8579
8580
8589 {
8590 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8591
8592 if (player)
8593 {
8594 player.MessageAction(text);
8595 }
8596 }
8597
8598
8607 {
8608 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8609
8610 if (player)
8611 {
8612 player.MessageFriendly(text);
8613 }
8614 }
8615
8616
8625 {
8626 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8627
8628 if (player)
8629 {
8630 player.MessageImportant(text);
8631 }
8632 }
8633
8635 {
8636 return true;
8637 }
8638
8639
8640 override bool KindOf(
string tag)
8641 {
8642 bool found = false;
8643 string item_name = this.
GetType();
8645 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8646
8647 int array_size = item_tag_array.Count();
8648 for (int i = 0; i < array_size; i++)
8649 {
8650 if (item_tag_array.Get(i) == tag)
8651 {
8652 found = true;
8653 break;
8654 }
8655 }
8656 return found;
8657 }
8658
8659
8661 {
8662
8663 super.OnRPC(sender, rpc_type,ctx);
8664
8665
8666 switch (rpc_type)
8667 {
8668 #ifndef SERVER
8669 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8670 Param2<bool, string> p = new Param2<bool, string>(false, "");
8671
8673 return;
8674
8675 bool play = p.param1;
8676 string soundSet = p.param2;
8677
8678 if (play)
8679 {
8681 {
8683 {
8685 }
8686 }
8687 else
8688 {
8690 }
8691 }
8692 else
8693 {
8695 }
8696
8697 break;
8698 #endif
8699
8700 }
8701
8703 {
8705 }
8706 }
8707
8708
8709
8710
8712 {
8713 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8714 return plugin.GetID(
name);
8715 }
8716
8718 {
8719 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8720 return plugin.GetName(id);
8721 }
8722
8725 {
8726
8727
8728 int varFlags;
8729 if (!ctx.
Read(varFlags))
8730 return;
8731
8732 if (varFlags & ItemVariableFlags.FLOAT)
8733 {
8735 }
8736 }
8737
8739 {
8740
8741 super.SerializeNumericalVars(floats_out);
8742
8743
8744
8746 {
8748 }
8749
8751 {
8753 }
8754
8756 {
8758 }
8759
8761 {
8766 }
8767
8769 {
8771 }
8772 }
8773
8775 {
8776
8777 super.DeSerializeNumericalVars(floats);
8778
8779
8780 int index = 0;
8781 int mask = Math.Round(floats.Get(index));
8782
8783 index++;
8784
8786 {
8788 {
8790 }
8791 else
8792 {
8793 float quantity = floats.Get(index);
8795 }
8796 index++;
8797 }
8798
8800 {
8801 float wet = floats.Get(index);
8803 index++;
8804 }
8805
8807 {
8808 int liquidtype = Math.Round(floats.Get(index));
8810 index++;
8811 }
8812
8814 {
8816 index++;
8818 index++;
8820 index++;
8822 index++;
8823 }
8824
8826 {
8827 int cleanness = Math.Round(floats.Get(index));
8829 index++;
8830 }
8831 }
8832
8834 {
8835 super.WriteVarsToCTX(ctx);
8836
8837
8839 {
8841 }
8842
8844 {
8846 }
8847
8849 {
8851 }
8852
8854 {
8855 int r,g,b,a;
8861 }
8862
8864 {
8866 }
8867 }
8868
8870 {
8871 if (!super.ReadVarsFromCTX(ctx,version))
8872 return false;
8873
8874 int intValue;
8875 float value;
8876
8877 if (version < 140)
8878 {
8879 if (!ctx.
Read(intValue))
8880 return false;
8881
8882 m_VariablesMask = intValue;
8883 }
8884
8886 {
8887 if (!ctx.
Read(value))
8888 return false;
8889
8891 {
8893 }
8894 else
8895 {
8897 }
8898 }
8899
8900 if (version < 140)
8901 {
8903 {
8904 if (!ctx.
Read(value))
8905 return false;
8906 SetTemperatureDirect(value);
8907 }
8908 }
8909
8911 {
8912 if (!ctx.
Read(value))
8913 return false;
8915 }
8916
8918 {
8919 if (!ctx.
Read(intValue))
8920 return false;
8922 }
8923
8925 {
8926 int r,g,b,a;
8928 return false;
8930 return false;
8932 return false;
8934 return false;
8935
8937 }
8938
8940 {
8941 if (!ctx.
Read(intValue))
8942 return false;
8944 }
8945
8946 if (version >= 138 && version < 140)
8947 {
8949 {
8950 if (!ctx.
Read(intValue))
8951 return false;
8952 SetFrozen(intValue);
8953 }
8954 }
8955
8956 return true;
8957 }
8958
8959
8961 {
8964 {
8966 }
8967
8968 if (!super.OnStoreLoad(ctx, version))
8969 {
8971 return false;
8972 }
8973
8974 if (version >= 114)
8975 {
8976 bool hasQuickBarIndexSaved;
8977
8978 if (!ctx.
Read(hasQuickBarIndexSaved))
8979 {
8981 return false;
8982 }
8983
8984 if (hasQuickBarIndexSaved)
8985 {
8986 int itmQBIndex;
8987
8988
8989 if (!ctx.
Read(itmQBIndex))
8990 {
8992 return false;
8993 }
8994
8995 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8996 if (itmQBIndex != -1 && parentPlayer)
8997 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8998 }
8999 }
9000 else
9001 {
9002
9003 PlayerBase player;
9004 int itemQBIndex;
9005 if (version ==
int.
MAX)
9006 {
9007 if (!ctx.
Read(itemQBIndex))
9008 {
9010 return false;
9011 }
9012 }
9013 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9014 {
9015
9016 if (!ctx.
Read(itemQBIndex))
9017 {
9019 return false;
9020 }
9021 if (itemQBIndex != -1 && player)
9022 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9023 }
9024 }
9025
9026 if (version < 140)
9027 {
9028
9029 if (!LoadVariables(ctx, version))
9030 {
9032 return false;
9033 }
9034 }
9035
9036
9038 {
9040 return false;
9041 }
9042 if (version >= 132)
9043 {
9045 if (raib)
9046 {
9048 {
9050 return false;
9051 }
9052 }
9053 }
9054
9056 return true;
9057 }
9058
9059
9060
9062 {
9063 super.OnStoreSave(ctx);
9064
9065 PlayerBase player;
9066 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9067 {
9069
9070 int itemQBIndex = -1;
9071 itemQBIndex = player.FindQuickBarEntityIndex(this);
9072 ctx.
Write(itemQBIndex);
9073 }
9074 else
9075 {
9077 }
9078
9080
9082 if (raib)
9083 {
9085 }
9086 }
9087
9088
9090 {
9091 super.AfterStoreLoad();
9092
9094 {
9096 }
9097
9099 {
9102 }
9103 }
9104
9106 {
9107 super.EEOnAfterLoad();
9108
9110 {
9112 }
9113
9116 }
9117
9119 {
9120 return false;
9121 }
9122
9123
9124
9126 {
9128 {
9129 #ifdef PLATFORM_CONSOLE
9130
9132 {
9134 if (menu)
9135 {
9137 }
9138 }
9139 #endif
9140 }
9141
9143 {
9146 }
9147
9149 {
9150 SetWeightDirty();
9152 }
9154 {
9157 }
9158
9160 {
9163
9166 }
9168 {
9172 }
9173
9174 super.OnVariablesSynchronized();
9175 }
9176
9177
9178
9180 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9181 {
9182 if (!IsServerCheck(allow_client))
9183 return false;
9184
9186 return false;
9187
9190
9191 if (value <= (min + 0.001))
9192 value = min;
9193
9194 if (value == min)
9195 {
9196 if (destroy_config)
9197 {
9198 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9199 if (dstr)
9200 {
9202 this.Delete();
9203 return true;
9204 }
9205 }
9206 else if (destroy_forced)
9207 {
9209 this.Delete();
9210 return true;
9211 }
9212
9214 }
9215
9218
9220 {
9221 EntityAI parent = GetHierarchyRoot();
9222 InventoryLocation iLoc = new InventoryLocation();
9223 GetInventory().GetCurrentInventoryLocation(iLoc);
9225 {
9226 int iLocSlot = iLoc.
GetSlot();
9228 {
9230 }
9232 {
9234 }
9235 }
9236 }
9237
9239 {
9241
9242 if (delta)
9244 }
9245
9247
9248 return false;
9249 }
9250
9251
9253 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9254 {
9256 }
9257
9259 {
9262 }
9263
9265 {
9268 }
9269
9271 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9272 {
9273 float value_clamped = Math.Clamp(value, 0, 1);
9275 SetQuantity(result, destroy_config, destroy_forced);
9276 }
9277
9278
9281 {
9283 }
9284
9286 {
9288 }
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9300 {
9301 int slot = -1;
9302 GameInventory inventory = GetInventory();
9303 if (inventory)
9304 {
9305 InventoryLocation il = new InventoryLocation;
9308 }
9309
9311 }
9312
9314 {
9315 float quantity_max = 0;
9316
9318 {
9319 if (attSlotID != -1)
9320 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9321
9322 if (quantity_max <= 0)
9324 }
9325
9326 if (quantity_max <= 0)
9328
9329 return quantity_max;
9330 }
9331
9333 {
9335 }
9336
9338 {
9340 }
9341
9342
9344 {
9346 }
9347
9349 {
9351 }
9352
9354 {
9356 }
9357
9358
9360 {
9361
9362 float weightEx = GetWeightEx();
9363 float special = GetInventoryAndCargoWeight();
9364 return weightEx - special;
9365 }
9366
9367
9369 {
9371 }
9372
9374 {
9376 {
9377 #ifdef DEVELOPER
9378 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9379 {
9380 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9382 }
9383 #endif
9384
9386 }
9387 else if (HasEnergyManager())
9388 {
9389 #ifdef DEVELOPER
9390 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9391 {
9392 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9393 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9394 }
9395 #endif
9396 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9397 }
9398 else
9399 {
9400 #ifdef DEVELOPER
9401 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9402 {
9403 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9404 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9405 }
9406 #endif
9407 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9408 }
9409 }
9410
9413 {
9414 int item_count = 0;
9416
9417 GameInventory inventory = GetInventory();
9418 CargoBase cargo = inventory.
GetCargo();
9419 if (cargo != NULL)
9420 {
9422 }
9423
9425 for (int i = 0; i < nAttachments; ++i)
9426 {
9428 if (item)
9429 item_count += item.GetNumberOfItems();
9430 }
9431 return item_count;
9432 }
9433
9436 {
9437 float weight = 0;
9438 float wetness = 1;
9439 if (include_wetness)
9442 {
9443 weight = wetness * m_ConfigWeight;
9444 }
9446 {
9447 weight = 1;
9448 }
9449 return weight;
9450 }
9451
9452
9453
9455 {
9456 GameInventory inventory = GetInventory();
9457 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9458 {
9459 array<EntityAI> items = new array<EntityAI>;
9461 for (int i = 0; i < items.Count(); ++i)
9462 {
9464 if (item)
9465 {
9466 g_Game.ObjectDelete(item);
9467 }
9468 }
9469 }
9470 }
9471
9472
9473
9474
9476 {
9477 float energy = 0;
9478 if (HasEnergyManager())
9479 {
9480 energy = GetCompEM().GetEnergy();
9481 }
9482 return energy;
9483 }
9484
9485
9487 {
9488 super.OnEnergyConsumed();
9489
9491 }
9492
9494 {
9495 super.OnEnergyAdded();
9496
9498 }
9499
9500
9502 {
9503 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9504 {
9506 {
9507 float energy_0to1 = GetCompEM().GetEnergy0To1();
9509 }
9510 }
9511 }
9512
9513
9515 {
9516 return ConfigGetFloat("heatIsolation");
9517 }
9518
9520 {
9522 }
9523
9525 {
9526 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9527 if (
g_Game.ConfigIsExisting(paramPath))
9528 return g_Game.ConfigGetFloat(paramPath);
9529
9530 return 0.0;
9531 }
9532
9534 {
9535 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9536 if (
g_Game.ConfigIsExisting(paramPath))
9537 return g_Game.ConfigGetFloat(paramPath);
9538
9539 return 0.0;
9540 }
9541
9542 override void SetWet(
float value,
bool allow_client =
false)
9543 {
9544 if (!IsServerCheck(allow_client))
9545 return;
9546
9549
9551
9552 m_VarWet = Math.Clamp(value, min, max);
9553
9555 {
9558 }
9559 }
9560
9561 override void AddWet(
float value)
9562 {
9564 }
9565
9567 {
9569 }
9570
9572 {
9574 }
9575
9577 {
9579 }
9580
9582 {
9584 }
9585
9587 {
9589 }
9590
9592 {
9595 if (newLevel != oldLevel)
9596 {
9598 }
9599 }
9600
9602 {
9603 SetWeightDirty();
9604 }
9605
9607 {
9608 return GetWetLevelInternal(
m_VarWet);
9609 }
9610
9611
9612
9614 {
9616 }
9617
9619 {
9621 }
9622
9624 {
9626 }
9627
9629 {
9631 }
9632
9633
9634
9636 {
9637 if (ConfigIsExisting("itemModelLength"))
9638 {
9639 return ConfigGetFloat("itemModelLength");
9640 }
9641 return 0;
9642 }
9643
9645 {
9646 if (ConfigIsExisting("itemAttachOffset"))
9647 {
9648 return ConfigGetFloat("itemAttachOffset");
9649 }
9650 return 0;
9651 }
9652
9653 override void SetCleanness(
int value,
bool allow_client =
false)
9654 {
9655 if (!IsServerCheck(allow_client))
9656 return;
9657
9659
9661
9664 }
9665
9667 {
9669 }
9670
9672 {
9673 return true;
9674 }
9675
9676
9677
9678
9680 {
9682 }
9683
9685 {
9687 }
9688
9689
9690
9691
9692 override void SetColor(
int r,
int g,
int b,
int a)
9693 {
9699 }
9701 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9702 {
9707 }
9708
9710 {
9712 }
9713
9716 {
9717 int r,g,b,a;
9719 r = r/255;
9720 g = g/255;
9721 b = b/255;
9722 a = a/255;
9723 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9724 }
9725
9726
9727
9728 override void SetLiquidType(
int value,
bool allow_client =
false)
9729 {
9730 if (!IsServerCheck(allow_client))
9731 return;
9732
9737 }
9738
9740 {
9741 return ConfigGetInt("varLiquidTypeInit");
9742 }
9743
9745 {
9747 }
9748
9750 {
9752 SetFrozen(false);
9753 }
9754
9757 {
9758 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9759 }
9760
9761
9764 {
9765 PlayerBase nplayer;
9766 if (PlayerBase.CastTo(nplayer, player))
9767 {
9769 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9770 }
9771 }
9772
9773
9776 {
9777 PlayerBase nplayer;
9778 if (PlayerBase.CastTo(nplayer,player))
9779 {
9780 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9781 }
9782
9783 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9784
9785 if (HasEnergyManager())
9786 {
9787 GetCompEM().UpdatePlugState();
9788 }
9789 }
9790
9791
9793 {
9794 super.OnPlacementStarted(player);
9795
9797 }
9798
9799 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9800 {
9802 {
9803 m_AdminLog.OnPlacementComplete(player,
this);
9804 }
9805
9806 super.OnPlacementComplete(player, position, orientation);
9807 }
9808
9809
9810
9811
9812
9814 {
9816 {
9817 return true;
9818 }
9819 else
9820 {
9821 return false;
9822 }
9823 }
9824
9825
9827 {
9829 {
9831 }
9832 }
9833
9834
9836 {
9838 }
9839
9841 {
9843 }
9844
9845 override void InsertAgent(
int agent,
float count = 1)
9846 {
9847 if (count < 1)
9848 return;
9849
9851 }
9852
9855 {
9857 }
9858
9859
9861 {
9863 }
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9907 {
9909 return false;
9910 return true;
9911 }
9912
9914 {
9915
9917 }
9918
9919
9922 {
9923 super.CheckForRoofLimited(timeTresholdMS);
9924
9925 float time =
g_Game.GetTime();
9926 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9927 {
9928 m_PreviousRoofTestTime = time;
9929 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9930 }
9931 }
9932
9933
9935 {
9937 {
9938 return 0;
9939 }
9940
9941 if (GetInventory().GetAttachmentSlotsCount() != 0)
9942 {
9943 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9944 if (filter)
9945 return filter.GetProtectionLevel(type, false, system);
9946 else
9947 return 0;
9948 }
9949
9950 string subclassPath, entryName;
9951
9952 switch (type)
9953 {
9955 entryName = "biological";
9956 break;
9958 entryName = "chemical";
9959 break;
9960 default:
9961 entryName = "biological";
9962 break;
9963 }
9964
9965 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9966
9967 return g_Game.ConfigGetFloat(subclassPath + entryName);
9968 }
9969
9970
9971
9974 {
9975 if (!IsMagazine())
9977
9979 }
9980
9981
9982
9983
9984
9989 {
9990 return true;
9991 }
9992
9994 {
9996 }
9997
9998
9999
10000
10001
10003 {
10004 if (parent)
10005 {
10006 if (parent.IsInherited(DayZInfected))
10007 return true;
10008
10009 if (!parent.IsRuined())
10010 return true;
10011 }
10012
10013 return true;
10014 }
10015
10017 {
10018 if (!super.CanPutAsAttachment(parent))
10019 {
10020 return false;
10021 }
10022
10023 if (!IsRuined() && !parent.IsRuined())
10024 {
10025 return true;
10026 }
10027
10028 return false;
10029 }
10030
10032 {
10033
10034
10035
10036
10037 return super.CanReceiveItemIntoCargo(item);
10038 }
10039
10041 {
10042
10043
10044
10045
10046 GameInventory attachmentInv = attachment.GetInventory();
10048 {
10049 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10050 return false;
10051 }
10052
10053 InventoryLocation loc = new InventoryLocation();
10054 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10055 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10056 return false;
10057
10058 return super.CanReceiveAttachment(attachment, slotId);
10059 }
10060
10062 {
10063 if (!super.CanReleaseAttachment(attachment))
10064 return false;
10065
10066 return GetInventory().AreChildrenAccessible();
10067 }
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10090 {
10091 int id = muzzle_owner.GetMuzzleID();
10092 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10093
10094 if (WPOF_array)
10095 {
10096 for (int i = 0; i < WPOF_array.Count(); i++)
10097 {
10098 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10099
10100 if (WPOF)
10101 {
10102 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10103 }
10104 }
10105 }
10106 }
10107
10108
10110 {
10111 int id = muzzle_owner.GetMuzzleID();
10113
10114 if (WPOBE_array)
10115 {
10116 for (int i = 0; i < WPOBE_array.Count(); i++)
10117 {
10118 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10119
10120 if (WPOBE)
10121 {
10122 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10123 }
10124 }
10125 }
10126 }
10127
10128
10130 {
10131 int id = muzzle_owner.GetMuzzleID();
10132 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10133
10134 if (WPOOH_array)
10135 {
10136 for (int i = 0; i < WPOOH_array.Count(); i++)
10137 {
10138 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10139
10140 if (WPOOH)
10141 {
10142 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10143 }
10144 }
10145 }
10146 }
10147
10148
10150 {
10151 int id = muzzle_owner.GetMuzzleID();
10152 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10153
10154 if (WPOOH_array)
10155 {
10156 for (int i = 0; i < WPOOH_array.Count(); i++)
10157 {
10158 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10159
10160 if (WPOOH)
10161 {
10162 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10163 }
10164 }
10165 }
10166 }
10167
10168
10170 {
10171 int id = muzzle_owner.GetMuzzleID();
10172 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10173
10174 if (WPOOH_array)
10175 {
10176 for (int i = 0; i < WPOOH_array.Count(); i++)
10177 {
10178 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10179
10180 if (WPOOH)
10181 {
10182 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10183 }
10184 }
10185 }
10186 }
10187
10188
10189
10191 {
10193 {
10194 return true;
10195 }
10196
10197 return false;
10198 }
10199
10201 {
10203 {
10204 return true;
10205 }
10206
10207 return false;
10208 }
10209
10211 {
10213 {
10214 return true;
10215 }
10216
10217 return false;
10218 }
10219
10221 {
10222 return false;
10223 }
10224
10227 {
10228 return UATimeSpent.DEFAULT_DEPLOY;
10229 }
10230
10231
10232
10233
10235 {
10237 SetSynchDirty();
10238 }
10239
10241 {
10243 }
10244
10245
10247 {
10248 return false;
10249 }
10250
10253 {
10254 string att_type = "None";
10255
10256 if (ConfigIsExisting("soundAttType"))
10257 {
10258 att_type = ConfigGetString("soundAttType");
10259 }
10260
10262 }
10263
10265 {
10267 }
10268
10269
10270
10271
10272
10278
10280 {
10283
10285 }
10286
10287
10289 {
10291 return;
10292
10294
10297
10300
10301 SoundParameters params = new SoundParameters();
10305 }
10306
10307
10309 {
10311 {
10314
10315 SetSynchDirty();
10316
10319 }
10320 }
10321
10323 {
10325 }
10326
10327
10329 {
10331 return;
10332
10334 SetSynchDirty();
10335
10338 }
10339
10341 {
10344 }
10345
10347 {
10349 }
10350
10351 void OnApply(PlayerBase player);
10352
10354 {
10355 return 1.0;
10356 };
10357
10359 {
10361 }
10362
10364 {
10366 }
10367
10369
10371 {
10372 SetDynamicPhysicsLifeTime(0.01);
10374 }
10375
10377 {
10378 array<string> zone_names = new array<string>;
10379 GetDamageZones(zone_names);
10380 for (int i = 0; i < zone_names.Count(); i++)
10381 {
10382 SetHealthMax(zone_names.Get(i),"Health");
10383 }
10384 SetHealthMax("","Health");
10385 }
10386
10389 {
10390 float global_health = GetHealth01("","Health");
10391 array<string> zones = new array<string>;
10392 GetDamageZones(zones);
10393
10394 for (int i = 0; i < zones.Count(); i++)
10395 {
10396 SetHealth01(zones.Get(i),"Health",global_health);
10397 }
10398 }
10399
10402 {
10403 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10404 }
10405
10407 {
10408 if (!hasRootAsPlayer)
10409 {
10410 if (refParentIB)
10411 {
10412
10413 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10414 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10415
10416 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10417 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10418
10421 }
10422 else
10423 {
10424
10427 }
10428 }
10429 }
10430
10432 {
10434 {
10435 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10436 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10437 {
10438 float heatPermCoef = 1.0;
10440 while (ent)
10441 {
10442 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10443 ent = ent.GetHierarchyParent();
10444 }
10445
10446 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10447 }
10448 }
10449 }
10450
10452 {
10453
10454 EntityAI parent = GetHierarchyParent();
10455 if (!parent)
10456 {
10457 hasParent = false;
10458 hasRootAsPlayer = false;
10459 }
10460 else
10461 {
10462 hasParent = true;
10463 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10464 refParentIB =
ItemBase.Cast(parent);
10465 }
10466 }
10467
10468 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10469 {
10470
10471 }
10472
10474 {
10475
10476 return false;
10477 }
10478
10480 {
10481
10482
10483 return false;
10484 }
10485
10487 {
10488
10489 return false;
10490 }
10491
10494 {
10495 return !GetIsFrozen() &&
IsOpen();
10496 }
10497
10499 {
10500 bool hasParent = false, hasRootAsPlayer = false;
10502
10503 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10504 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10505
10506 if (wwtu || foodDecay)
10507 {
10511
10512 if (processWetness || processTemperature || processDecay)
10513 {
10515
10516 if (processWetness)
10517 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10518
10519 if (processTemperature)
10521
10522 if (processDecay)
10523 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10524 }
10525 }
10526 }
10527
10530 {
10532 }
10533
10535 {
10538
10539 return super.GetTemperatureFreezeThreshold();
10540 }
10541
10543 {
10546
10547 return super.GetTemperatureThawThreshold();
10548 }
10549
10551 {
10554
10555 return super.GetItemOverheatThreshold();
10556 }
10557
10559 {
10561 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10562
10563 return super.GetTemperatureFreezeTime();
10564 }
10565
10567 {
10569 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10570
10571 return super.GetTemperatureThawTime();
10572 }
10573
10578
10580 {
10581 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10582 }
10583
10585 {
10586 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10587 }
10588
10591 {
10593 }
10594
10596 {
10598 }
10599
10601 {
10603 }
10604
10607 {
10608 return null;
10609 }
10610
10613 {
10614 return false;
10615 }
10616
10618 {
10620 {
10623 if (!trg)
10624 {
10626 explosive = this;
10627 }
10628
10629 explosive.PairRemote(trg);
10631
10632 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10633 trg.SetPersistentPairID(persistentID);
10634 explosive.SetPersistentPairID(persistentID);
10635
10636 return true;
10637 }
10638 return false;
10639 }
10640
10643 {
10644 float ret = 1.0;
10647 ret *= GetHealth01();
10648
10649 return ret;
10650 }
10651
10652 #ifdef DEVELOPER
10653 override void SetDebugItem()
10654 {
10655 super.SetDebugItem();
10656 _itemBase = this;
10657 }
10658
10660 {
10661 string text = super.GetDebugText();
10662
10664 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10665
10666 return text;
10667 }
10668 #endif
10669
10671 {
10672 return true;
10673 }
10674
10676
10678
10680 {
10683 }
10684
10685
10693
10709
10710 [
Obsolete(
"Use ItemSoundHandler instead")]
10713 {
10714 if (!
g_Game.IsDedicatedServer())
10715 {
10716 if (ConfigIsExisting("attachSoundSet"))
10717 {
10718 string cfg_path = "";
10719 string soundset = "";
10720 string type_name =
GetType();
10721
10724 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10725 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10726
10727 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10728 {
10729 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10730 {
10731 if (cfg_slot_array[i] == slot_type)
10732 {
10733 soundset = cfg_soundset_array[i];
10734 break;
10735 }
10736 }
10737 }
10738
10739 if (soundset != "")
10740 {
10741 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10743 }
10744 }
10745 }
10746 }
10747
10749}
10750
10752{
10754 if (entity)
10755 {
10756 bool is_item = entity.IsInherited(
ItemBase);
10757 if (is_item && full_quantity)
10758 {
10761 }
10762 }
10763 else
10764 {
10766 return NULL;
10767 }
10768 return entity;
10769}
10770
10772{
10773 if (item)
10774 {
10775 if (health > 0)
10776 item.SetHealth("", "", health);
10777
10778 if (item.CanHaveTemperature())
10779 {
10781 if (item.CanFreeze())
10782 item.SetFrozen(false);
10783 }
10784
10785 if (item.HasEnergyManager())
10786 {
10787 if (quantity >= 0)
10788 {
10789 item.GetCompEM().SetEnergy0To1(quantity);
10790 }
10791 else
10792 {
10794 }
10795 }
10796 else if (item.IsMagazine())
10797 {
10798 Magazine mag = Magazine.Cast(item);
10799 if (quantity >= 0)
10800 {
10801 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10802 }
10803 else
10804 {
10806 }
10807
10808 }
10809 else
10810 {
10811 if (quantity >= 0)
10812 {
10813 item.SetQuantityNormalized(quantity, false);
10814 }
10815 else
10816 {
10818 }
10819
10820 }
10821 }
10822}
10823
10824#ifdef DEVELOPER
10826#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.