5839{
5841 {
5842 return true;
5843 }
5844};
5845
5847{
5848
5849};
5850
5851
5852
5854{
5858
5860
5863
5864
5865
5866
5867
5876
5882
5887
5892
5913 protected bool m_IsResultOfSplit
5914
5916
5921
5922
5923
5925
5929
5930
5931
5933
5936
5937
5938
5944
5945
5953
5956
5957
5959
5960
5962
5963
5968
5969
5974
5976
5977
5979
5980
5982 {
5987
5988 if (!
g_Game.IsDedicatedServer())
5989 {
5991 {
5993
5995 {
5997 }
5998 }
5999
6002 }
6003
6004 m_OldLocation = null;
6005
6007 {
6009 }
6010
6011 if (ConfigIsExisting("headSelectionsToHide"))
6012 {
6015 }
6016
6018 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6019 {
6021 }
6022
6024
6025 m_IsResultOfSplit = false;
6026
6028 }
6029
6031 {
6032 super.InitItemVariables();
6033
6039 m_Count = ConfigGetInt(
"count");
6040
6043
6048
6051
6056
6068
6072
6073
6076 if (ConfigIsExisting("canBeSplit"))
6077 {
6080 }
6081
6083 if (ConfigIsExisting("itemBehaviour"))
6085
6086
6089 RegisterNetSyncVariableInt("m_VarLiquidType");
6090 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6091
6092 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6093 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6094 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6095
6096 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6097 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6098 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6099 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6100
6101 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6102 RegisterNetSyncVariableBool("m_IsTakeable");
6103 RegisterNetSyncVariableBool("m_IsHologram");
6104
6107 {
6110 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6111 }
6112
6114
6116 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6118
6120 }
6121
6123 {
6125 }
6126
6128 {
6131 {
6136 }
6137 }
6138
6139 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6140 {
6142 {
6145 }
6146
6148 }
6149
6151 {
6157 }
6158
6160
6162 {
6164
6165 if (!action)
6166 {
6167 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6168 return;
6169 }
6170
6172 if (!ai)
6173 {
6175 return;
6176 }
6177
6179 if (!action_array)
6180 {
6181 action_array = new array<ActionBase_Basic>;
6183 }
6184 if (LogManager.IsActionLogEnable())
6185 {
6186 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6187 }
6188
6189 if (action_array.Find(action) != -1)
6190 {
6191 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6192 }
6193 else
6194 {
6195 action_array.Insert(action);
6196 }
6197 }
6198
6200 {
6201 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6202 ActionBase action = player.GetActionManager().GetAction(actionName);
6205
6206 if (action_array)
6207 {
6208 action_array.RemoveItem(action);
6209 }
6210 }
6211
6212
6213
6215 {
6216 ActionOverrideData overrideData = new ActionOverrideData();
6220
6222 if (!actionMap)
6223 {
6226 }
6227
6228 actionMap.Insert(this.
Type(), overrideData);
6229
6230 }
6231
6233
6235
6236
6238 {
6241
6244
6245 string config_to_search = "CfgVehicles";
6246 string muzzle_owner_config;
6247
6249 {
6250 if (IsInherited(Weapon))
6251 config_to_search = "CfgWeapons";
6252
6253 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6254
6255 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6256
6257 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6258
6259 if (config_OnFire_subclass_count > 0)
6260 {
6261 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6262
6263 for (int i = 0; i < config_OnFire_subclass_count; i++)
6264 {
6265 string particle_class = "";
6266 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6267 string config_OnFire_entry = config_OnFire_class + particle_class;
6268 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6269 WPOF_array.Insert(WPOF);
6270 }
6271
6272
6274 }
6275 }
6276
6278 {
6279 config_to_search = "CfgWeapons";
6280 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6281
6282 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6283
6284 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6285
6286 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6287 {
6288 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6289
6290 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6291 {
6292 string particle_class2 = "";
6293 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6294 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6295 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6296 WPOBE_array.Insert(WPOBE);
6297 }
6298
6299
6301 }
6302 }
6303 }
6304
6305
6307 {
6310
6312 {
6313 string config_to_search = "CfgVehicles";
6314
6315 if (IsInherited(Weapon))
6316 config_to_search = "CfgWeapons";
6317
6318 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6319 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6320
6321 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6322 {
6323
6325
6327 {
6329 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6331 return;
6332 }
6333
6336
6337
6338
6339 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6340 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6341
6342 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6343 {
6344 string particle_class = "";
6345 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6346 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6347 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6348
6349 if (entry_type == CT_CLASS)
6350 {
6351 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6352 WPOOH_array.Insert(WPOF);
6353 }
6354 }
6355
6356
6358 }
6359 }
6360 }
6361
6363 {
6365 }
6366
6368 {
6370 {
6372
6375
6378
6379 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6380 }
6381 }
6382
6384 {
6386 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6387
6389 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6390
6392 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6393
6395 {
6397 }
6398 }
6399
6401 {
6403 }
6404
6406 {
6409 else
6411
6413 {
6416 }
6417 else
6418 {
6421
6424 }
6425
6427 }
6428
6430 {
6432 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6433 }
6434
6436 {
6438 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6440 }
6441
6443 {
6445 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6446 }
6447
6449 {
6452
6453 OverheatingParticle OP = new OverheatingParticle();
6458
6460 }
6461
6463 {
6466
6467 return -1;
6468 }
6469
6471 {
6473 {
6476
6477 for (int i = count; i > 0; --i)
6478 {
6479 int id = i - 1;
6482
6485
6486 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6487 {
6488 if (p)
6489 {
6492 }
6493 }
6494 }
6495 }
6496 }
6497
6499 {
6501 {
6503 {
6504 int id = i - 1;
6506
6507 if (OP)
6508 {
6510
6511 if (p)
6512 {
6514 }
6515
6516 delete OP;
6517 }
6518 }
6519
6522 }
6523 }
6524
6527 {
6528 return 0.0;
6529 }
6530
6531
6533 {
6534 return 250;
6535 }
6536
6538 {
6539 return 0;
6540 }
6541
6544 {
6546 return true;
6547
6548 return false;
6549 }
6550
6553 {
6556
6558 {
6560 }
6561 else
6562 {
6563
6565 }
6566
6568 }
6569
6576 {
6577 return -1;
6578 }
6579
6580
6581
6582
6584 {
6586 {
6587 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6588 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6589
6590 if (r_index >= 0)
6591 {
6592 InventoryLocation r_il = new InventoryLocation;
6593 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6594
6595 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6598 {
6599 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6600 }
6602 {
6603 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6604 }
6605
6606 }
6607
6608 player.GetHumanInventory().ClearUserReservedLocation(this);
6609 }
6610
6613 }
6614
6615
6616
6617
6619 {
6620 return ItemBase.m_DebugActionsMask;
6621 }
6622
6624 {
6625 return ItemBase.m_DebugActionsMask & mask;
6626 }
6627
6629 {
6630 ItemBase.m_DebugActionsMask = mask;
6631 }
6632
6634 {
6635 ItemBase.m_DebugActionsMask |= mask;
6636 }
6637
6639 {
6640 ItemBase.m_DebugActionsMask &= ~mask;
6641 }
6642
6644 {
6646 {
6648 }
6649 else
6650 {
6652 }
6653 }
6654
6655
6657 {
6658 if (GetEconomyProfile())
6659 {
6660 float q_max = GetEconomyProfile().GetQuantityMax();
6661 if (q_max > 0)
6662 {
6663 float q_min = GetEconomyProfile().GetQuantityMin();
6664 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6665
6667 {
6668 ComponentEnergyManager comp = GetCompEM();
6670 {
6672 }
6673 }
6675 {
6677
6678 }
6679
6680 }
6681 }
6682 }
6683
6686 {
6687 EntityAI parent = GetHierarchyParent();
6688
6689 if (parent)
6690 {
6691 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6692 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6693 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6694 }
6695 }
6696
6699 {
6700 EntityAI parent = GetHierarchyParent();
6701
6702 if (parent)
6703 {
6704 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6705 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6706 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6707 }
6708 }
6709
6711 {
6712
6713
6714
6715
6717
6719 {
6720 if (ScriptInputUserData.CanStoreInputUserData())
6721 {
6722 ScriptInputUserData ctx = new ScriptInputUserData;
6728 ctx.
Write(use_stack_max);
6731
6733 {
6734 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6735 }
6736 }
6737 }
6738 else if (!
g_Game.IsMultiplayer())
6739 {
6741 }
6742 }
6743
6745 {
6747 }
6748
6750 {
6752 }
6753
6755 {
6757 }
6758
6760 {
6761
6762 return false;
6763 }
6764
6766 {
6767 return false;
6768 }
6769
6773 {
6774 return false;
6775 }
6776
6778 {
6779 return "";
6780 }
6781
6783
6785 {
6786 return false;
6787 }
6788
6790 {
6791 return true;
6792 }
6793
6794
6795
6797 {
6798 return true;
6799 }
6800
6802 {
6803 return true;
6804 }
6805
6807 {
6808 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6810 }
6811
6813 {
6815 }
6816
6818 {
6820 if (!is_being_placed)
6822 SetSynchDirty();
6823 }
6824
6825
6827
6829 {
6831 }
6832
6834 {
6836 }
6837
6839 {
6840 return 1;
6841 }
6842
6844 {
6845 return false;
6846 }
6847
6849 {
6851 SetSynchDirty();
6852 }
6853
6854
6855
6856
6857
6858
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
6889 {
6890 super.OnMovedInsideCargo(container);
6891
6892 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6893 }
6894
6895 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6896 {
6897 super.EEItemLocationChanged(oldLoc, newLoc);
6898
6899 PlayerBase newPlayer = null;
6900 PlayerBase oldPlayer = null;
6901
6902 if (newLoc.GetParent())
6903 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6904
6905 if (oldLoc.GetParent())
6906 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6907
6909 {
6910 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6911
6912 if (rIndex >= 0)
6913 {
6914 InventoryLocation rIl = new InventoryLocation;
6915 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6916
6917 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6920 {
6921 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6922 }
6924 {
6926 }
6927
6928 }
6929 }
6930
6932 {
6933 if (newPlayer)
6934 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6935
6936 if (newPlayer == oldPlayer)
6937 {
6938 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6939 {
6941 {
6942 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6943 {
6944 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6945 }
6946 }
6947 else
6948 {
6949 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6950 }
6951 }
6952
6953 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6954 {
6955 int type = oldLoc.GetType();
6957 {
6958 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6959 }
6961 {
6962 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6963 }
6964 }
6965 if (!m_OldLocation)
6966 {
6967 m_OldLocation = new InventoryLocation;
6968 }
6969 m_OldLocation.Copy(oldLoc);
6970 }
6971 else
6972 {
6973 if (m_OldLocation)
6974 {
6975 m_OldLocation.Reset();
6976 }
6977 }
6978
6979 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6980 }
6981 else
6982 {
6983 if (newPlayer)
6984 {
6985 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6986 if (resIndex >= 0)
6987 {
6988 InventoryLocation il = new InventoryLocation;
6989 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6991 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6994 {
6995 il.
GetParent().GetOnReleaseLock().Invoke(it);
6996 }
6998 {
7000 }
7001
7002 }
7003 }
7005 {
7006
7008 }
7009
7010 if (m_OldLocation)
7011 {
7012 m_OldLocation.Reset();
7013 }
7014 }
7015
7017 {
7018 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7019 }
7020
7022 {
7023 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7024 }
7025 }
7026
7027 override void EOnContact(IEntity other, Contact extra)
7028 {
7030 {
7031 int liquidType = -1;
7033 if (impactSpeed > 0.0)
7034 {
7036 #ifndef SERVER
7038 #else
7040 SetSynchDirty();
7041 #endif
7043 }
7044 }
7045
7046 #ifdef SERVER
7047 if (GetCompEM() && GetCompEM().IsPlugged())
7048 {
7049 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7050 GetCompEM().UnplugThis();
7051 }
7052 #endif
7053 }
7054
7056
7058 {
7060 }
7061
7063 {
7064
7065 }
7066
7068 {
7069 super.OnItemLocationChanged(old_owner, new_owner);
7070
7071 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7072 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7073
7074 if (!relatedPlayer && playerNew)
7075 relatedPlayer = playerNew;
7076
7077 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7078 {
7080 if (actionMgr)
7081 {
7082 ActionBase currentAction = actionMgr.GetRunningAction();
7083 if (currentAction)
7085 }
7086 }
7087
7088 Man ownerPlayerOld = null;
7089 Man ownerPlayerNew = null;
7090
7091 if (old_owner)
7092 {
7093 if (old_owner.
IsMan())
7094 {
7095 ownerPlayerOld = Man.Cast(old_owner);
7096 }
7097 else
7098 {
7099 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7100 }
7101 }
7102 else
7103 {
7105 {
7107
7108 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7109 {
7110 GetCompEM().UnplugThis();
7111 }
7112 }
7113 }
7114
7115 if (new_owner)
7116 {
7117 if (new_owner.
IsMan())
7118 {
7119 ownerPlayerNew = Man.Cast(new_owner);
7120 }
7121 else
7122 {
7123 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7124 }
7125 }
7126
7127 if (ownerPlayerOld != ownerPlayerNew)
7128 {
7129 if (ownerPlayerOld)
7130 {
7131 array<EntityAI> subItemsExit = new array<EntityAI>;
7133 for (int i = 0; i < subItemsExit.Count(); i++)
7134 {
7137 }
7138 }
7139
7140 if (ownerPlayerNew)
7141 {
7142 array<EntityAI> subItemsEnter = new array<EntityAI>;
7144 for (int j = 0; j < subItemsEnter.Count(); j++)
7145 {
7148 }
7149 }
7150 }
7151 else if (ownerPlayerNew != null)
7152 {
7153 PlayerBase nplayer;
7154 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7155 {
7156 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7158 for (int k = 0; k < subItemsUpdate.Count(); k++)
7159 {
7161 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7162 }
7163 }
7164 }
7165
7166 if (old_owner)
7167 old_owner.OnChildItemRemoved(this);
7168 if (new_owner)
7169 new_owner.OnChildItemReceived(this);
7170 }
7171
7172
7174 {
7175 super.EEDelete(parent);
7176 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7177 if (player)
7178 {
7180
7181 if (player.IsAlive())
7182 {
7183 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7184 if (r_index >= 0)
7185 {
7186 InventoryLocation r_il = new InventoryLocation;
7187 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7188
7189 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7192 {
7193 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7194 }
7196 {
7197 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7198 }
7199
7200 }
7201
7202 player.RemoveQuickBarEntityShortcut(this);
7203 }
7204 }
7205 }
7206
7208 {
7209 super.EEKilled(killer);
7210
7213 {
7214 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7215 {
7216 if (IsMagazine())
7217 {
7218 if (Magazine.Cast(this).GetAmmoCount() > 0)
7219 {
7221 }
7222 }
7223 else
7224 {
7226 }
7227 }
7228 }
7229 }
7230
7232 {
7233 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7234
7235 super.OnWasAttached(parent, slot_id);
7236
7239
7242 }
7243
7245 {
7246 super.OnWasDetached(parent, slot_id);
7247
7250
7253 }
7254
7256 {
7257 int idx;
7260
7261 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7262 if (inventory_slots.Count() < 1)
7263 {
7264 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7265 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7266 }
7267 else
7268 {
7269 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7270 }
7271
7272 idx = inventory_slots.Find(slot);
7273 if (idx < 0)
7274 return "";
7275
7276 return attach_types.Get(idx);
7277 }
7278
7280 {
7281 int idx = -1;
7282 string slot;
7283
7286
7287 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7288 if (inventory_slots.Count() < 1)
7289 {
7290 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7291 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7292 }
7293 else
7294 {
7295 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7296 if (detach_types.Count() < 1)
7297 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7298 }
7299
7300 for (int i = 0; i < inventory_slots.Count(); i++)
7301 {
7302 slot = inventory_slots.Get(i);
7303 }
7304
7305 if (slot != "")
7306 {
7307 if (detach_types.Count() == 1)
7308 idx = 0;
7309 else
7310 idx = inventory_slots.Find(slot);
7311 }
7312 if (idx < 0)
7313 return "";
7314
7315 return detach_types.Get(idx);
7316 }
7317
7319 {
7320
7322
7323
7324 float min_time = 1;
7325 float max_time = 3;
7326 float delay = Math.RandomFloat(min_time, max_time);
7327
7328 explode_timer.Run(delay, this, "DoAmmoExplosion");
7329 }
7330
7332 {
7333 Magazine magazine = Magazine.Cast(this);
7334 int pop_sounds_count = 6;
7335 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7336
7337
7338 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7339 string sound_name = pop_sounds[ sound_idx ];
7340 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7341
7342
7343 magazine.ServerAddAmmoCount(-1);
7344
7345
7346 float min_temp_to_explode = 100;
7347
7348 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7349 {
7351 }
7352 }
7353
7354
7355 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7356 {
7357 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7358
7359 const int CHANCE_DAMAGE_CARGO = 4;
7360 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7361 const int CHANCE_DAMAGE_NOTHING = 2;
7362
7364 {
7365 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7366 int chances;
7367 int rnd;
7368
7369 if (GetInventory().GetCargo())
7370 {
7371 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7372 rnd = Math.RandomInt(0,chances);
7373
7374 if (rnd < CHANCE_DAMAGE_CARGO)
7375 {
7377 }
7378 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7379 {
7381 }
7382 }
7383 else
7384 {
7385 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7386 rnd = Math.RandomInt(0,chances);
7387
7388 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7389 {
7391 }
7392 }
7393 }
7394 }
7395
7397 {
7398 CargoBase cargo = GetInventory().GetCargo();
7399 if (cargo)
7400 {
7402 if (item_count > 0)
7403 {
7404 int random_pick = Math.RandomInt(0, item_count);
7406 if (!item.IsExplosive())
7407 {
7408 item.AddHealth("","",damage);
7409 return true;
7410 }
7411 }
7412 }
7413 return false;
7414 }
7415
7417 {
7418 GameInventory inventory = GetInventory();
7420 if (attachment_count > 0)
7421 {
7422 int random_pick = Math.RandomInt(0, attachment_count);
7424 if (!attachment.IsExplosive())
7425 {
7426 attachment.AddHealth("","",damage);
7427 return true;
7428 }
7429 }
7430 return false;
7431 }
7432
7434 {
7436 }
7437
7439 {
7441 return GetInventory().CanRemoveEntity();
7442
7443 return false;
7444 }
7445
7447 {
7448
7450 return false;
7451
7452
7454 return false;
7455
7456
7457
7459 if (delta == 0)
7460 return false;
7461
7462
7463 return true;
7464 }
7465
7467 {
7469 {
7470 if (ScriptInputUserData.CanStoreInputUserData())
7471 {
7472 ScriptInputUserData ctx = new ScriptInputUserData;
7477 ctx.
Write(destination_entity);
7481 }
7482 }
7483 else if (!
g_Game.IsMultiplayer())
7484 {
7486 }
7487 }
7488
7490 {
7491 float split_quantity_new;
7495 InventoryLocation loc = new InventoryLocation;
7496
7497 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7498 {
7500 split_quantity_new = stack_max;
7501 else
7503
7505 {
7506 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7507 if (new_item)
7508 {
7509 new_item.SetResultOfSplit(true);
7510 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7512 new_item.
SetQuantity(split_quantity_new,
false,
true);
7513 }
7514 }
7515 }
7516 else if (destination_entity && slot_id == -1)
7517 {
7518 if (quantity > stack_max)
7519 split_quantity_new = stack_max;
7520 else
7521 split_quantity_new = quantity;
7522
7524 {
7525 GameInventory destinationInventory = destination_entity.GetInventory();
7527 {
7530 }
7531
7532 if (new_item)
7533 {
7534 new_item.SetResultOfSplit(true);
7535 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7537 new_item.
SetQuantity(split_quantity_new,
false,
true);
7538 }
7539 }
7540 }
7541 else
7542 {
7543 if (stack_max != 0)
7544 {
7546 {
7548 }
7549
7550 if (split_quantity_new == 0)
7551 {
7552 if (!
g_Game.IsMultiplayer())
7553 player.PhysicalPredictiveDropItem(this);
7554 else
7555 player.ServerDropEntity(this);
7556 return;
7557 }
7558
7560 {
7562
7563 if (new_item)
7564 {
7565 new_item.SetResultOfSplit(true);
7566 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7569 new_item.PlaceOnSurface();
7570 }
7571 }
7572 }
7573 }
7574 }
7575
7577 {
7578 float split_quantity_new;
7582 InventoryLocation loc = new InventoryLocation;
7583
7584 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7585 {
7587 split_quantity_new = stack_max;
7588 else
7590
7592 {
7593 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7594 if (new_item)
7595 {
7596 new_item.SetResultOfSplit(true);
7597 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7599 new_item.
SetQuantity(split_quantity_new,
false,
true);
7600 }
7601 }
7602 }
7603 else if (destination_entity && slot_id == -1)
7604 {
7605 if (quantity > stack_max)
7606 split_quantity_new = stack_max;
7607 else
7608 split_quantity_new = quantity;
7609
7611 {
7612 GameInventory destinationInventory = destination_entity.GetInventory();
7614 {
7617 }
7618
7619 if (new_item)
7620 {
7621 new_item.SetResultOfSplit(true);
7622 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7624 new_item.
SetQuantity(split_quantity_new,
false,
true);
7625 }
7626 }
7627 }
7628 else
7629 {
7630 if (stack_max != 0)
7631 {
7633 {
7635 }
7636
7638 {
7640
7641 if (new_item)
7642 {
7643 new_item.SetResultOfSplit(true);
7644 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7647 new_item.PlaceOnSurface();
7648 }
7649 }
7650 }
7651 }
7652 }
7653
7655 {
7657 {
7658 if (ScriptInputUserData.CanStoreInputUserData())
7659 {
7660 ScriptInputUserData ctx = new ScriptInputUserData;
7665 dst.WriteToContext(ctx);
7667 }
7668 }
7669 else if (!
g_Game.IsMultiplayer())
7670 {
7672 }
7673 }
7674
7676 {
7678 {
7679 if (ScriptInputUserData.CanStoreInputUserData())
7680 {
7681 ScriptInputUserData ctx = new ScriptInputUserData;
7686 ctx.
Write(destination_entity);
7692 }
7693 }
7694 else if (!
g_Game.IsMultiplayer())
7695 {
7697 }
7698 }
7699
7701 {
7703 }
7704
7706 {
7708 float split_quantity_new;
7710 if (dst.IsValid())
7711 {
7712 int slot_id = dst.GetSlot();
7714
7715 if (quantity > stack_max)
7716 split_quantity_new = stack_max;
7717 else
7718 split_quantity_new = quantity;
7719
7721 {
7723
7724 if (new_item)
7725 {
7726 new_item.SetResultOfSplit(true);
7727 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7729 new_item.
SetQuantity(split_quantity_new,
false,
true);
7730 }
7731
7732 return new_item;
7733 }
7734 }
7735
7736 return null;
7737 }
7738
7740 {
7742 float split_quantity_new;
7744 if (destination_entity)
7745 {
7747 if (quantity > stackable)
7748 split_quantity_new = stackable;
7749 else
7750 split_quantity_new = quantity;
7751
7753 {
7754 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7755 if (new_item)
7756 {
7757 new_item.SetResultOfSplit(true);
7758 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7760 new_item.
SetQuantity(split_quantity_new,
false,
true);
7761 }
7762 }
7763 }
7764 }
7765
7767 {
7769 {
7770 if (ScriptInputUserData.CanStoreInputUserData())
7771 {
7772 ScriptInputUserData ctx = new ScriptInputUserData;
7777 ItemBase destination_entity =
this;
7778 ctx.
Write(destination_entity);
7782 }
7783 }
7784 else if (!
g_Game.IsMultiplayer())
7785 {
7787 }
7788 }
7789
7791 {
7793 float split_quantity_new;
7795 if (player)
7796 {
7798 if (quantity > stackable)
7799 split_quantity_new = stackable;
7800 else
7801 split_quantity_new = quantity;
7802
7804 {
7805 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7806 new_item =
ItemBase.Cast(in_hands);
7807 if (new_item)
7808 {
7809 new_item.SetResultOfSplit(true);
7810 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7812 new_item.SetQuantity(split_quantity_new, false, true);
7813 }
7814 }
7815 }
7816 }
7817
7819 {
7821 float split_quantity_new = Math.Floor(quantity * 0.5);
7822
7824 return;
7825
7827
7828 if (new_item)
7829 {
7830 if (new_item.GetQuantityMax() < split_quantity_new)
7831 {
7832 split_quantity_new = new_item.GetQuantityMax();
7833 }
7834
7835 new_item.SetResultOfSplit(true);
7836 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7837
7839 {
7842 }
7843 else
7844 {
7846 new_item.
SetQuantity(split_quantity_new,
false,
true);
7847 }
7848 }
7849 }
7850
7852 {
7854 float split_quantity_new = Math.Floor(quantity / 2);
7855
7857 return;
7858
7859 InventoryLocation invloc = new InventoryLocation;
7861
7863 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7864
7865 if (new_item)
7866 {
7867 if (new_item.GetQuantityMax() < split_quantity_new)
7868 {
7869 split_quantity_new = new_item.GetQuantityMax();
7870 }
7872 {
7875 }
7876 else if (split_quantity_new > 1)
7877 {
7879 new_item.
SetQuantity(split_quantity_new,
false,
true);
7880 }
7881 }
7882 }
7883
7886 {
7887 SetWeightDirty();
7889
7890 if (parent)
7891 parent.OnAttachmentQuantityChangedEx(this, delta);
7892
7894 {
7896 {
7898 }
7900 {
7901 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7903 }
7904 }
7905 }
7906
7909 {
7910
7911 }
7912
7915 {
7917 }
7918
7920 {
7921 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7922
7924 {
7925 if (newLevel == GameConstants.STATE_RUINED)
7926 {
7928 EntityAI parent = GetHierarchyParent();
7929 if (parent && parent.IsFireplace())
7930 {
7931 CargoBase cargo = GetInventory().GetCargo();
7932 if (cargo)
7933 {
7935 {
7937 }
7938 }
7939 }
7940 }
7941
7943 {
7944
7946 return;
7947 }
7948
7949 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7950 {
7952 }
7953 }
7954 }
7955
7956
7958 {
7959 super.OnRightClick();
7960
7962 {
7964 {
7965 if (ScriptInputUserData.CanStoreInputUserData())
7966 {
7967 EntityAI root = GetHierarchyRoot();
7968 Man playerOwner = GetHierarchyRootPlayer();
7969 InventoryLocation dst = new InventoryLocation;
7970
7971
7972 if (!playerOwner && root && root == this)
7973 {
7975 }
7976 else
7977 {
7978
7979 GetInventory().GetCurrentInventoryLocation(dst);
7981 {
7982 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7984 {
7986 }
7987 else
7988 {
7990
7991
7992 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7993 {
7995 }
7996 else
7997 {
7998 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7999 }
8000 }
8001 }
8002 }
8003
8004 ScriptInputUserData ctx = new ScriptInputUserData;
8012 }
8013 }
8014 else if (!
g_Game.IsMultiplayer())
8015 {
8017 }
8018 }
8019 }
8020
8022 {
8023 if (root)
8024 {
8025 vector m4[4];
8026 root.GetTransform(m4);
8027 dst.SetGround(this, m4);
8028 }
8029 else
8030 {
8031 GetInventory().GetCurrentInventoryLocation(dst);
8032 }
8033 }
8034
8035 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8036 {
8037
8038 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8039 return false;
8040
8041 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8042 return false;
8043
8044
8046 return false;
8047
8048
8049 Magazine mag = Magazine.Cast(this);
8050 if (mag)
8051 {
8052 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8053 return false;
8054
8055 if (stack_max_limit)
8056 {
8057 Magazine other_mag = Magazine.Cast(other_item);
8058 if (other_item)
8059 {
8060 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8061 return false;
8062 }
8063
8064 }
8065 }
8066 else
8067 {
8068
8070 return false;
8071
8073 return false;
8074 }
8075
8076 PlayerBase player = null;
8077 if (CastTo(player, GetHierarchyRootPlayer()))
8078 {
8079 if (player.GetInventory().HasAttachment(this))
8080 return false;
8081
8082 if (player.IsItemsToDelete())
8083 return false;
8084 }
8085
8086 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8087 return false;
8088
8089 int slotID;
8091 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8092 return false;
8093
8094 return true;
8095 }
8096
8098 {
8100 }
8101
8103 {
8104 return m_IsResultOfSplit;
8105 }
8106
8108 {
8109 m_IsResultOfSplit = value;
8110 }
8111
8113 {
8115 }
8116
8118 {
8119 float other_item_quantity = other_item.GetQuantity();
8120 float this_free_space;
8121
8123
8125
8126 if (other_item_quantity > this_free_space)
8127 {
8128 return this_free_space;
8129 }
8130 else
8131 {
8132 return other_item_quantity;
8133 }
8134 }
8135
8137 {
8139 }
8140
8142 {
8144 return;
8145
8146 if (!IsMagazine() && other_item)
8147 {
8149 if (quantity_used != 0)
8150 {
8151 float hp1 = GetHealth01("","");
8152 float hp2 = other_item.GetHealth01("","");
8153 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8154 hpResult = hpResult / (
GetQuantity() + quantity_used);
8155
8156 hpResult *= GetMaxHealth();
8157 Math.Round(hpResult);
8158 SetHealth("", "Health", hpResult);
8159
8161 other_item.AddQuantity(-quantity_used);
8162 }
8163 }
8165 }
8166
8168 {
8169 #ifdef SERVER
8170 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8171 GetHierarchyParent().IncreaseLifetimeUp();
8172 #endif
8173 };
8174
8176 {
8177 PlayerBase p = PlayerBase.Cast(player);
8178
8179 array<int> recipesIds = p.m_Recipes;
8180 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8181 if (moduleRecipesManager)
8182 {
8183 EntityAI itemInHands = player.GetEntityInHands();
8184 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8185 }
8186
8187 for (int i = 0;i < recipesIds.Count(); i++)
8188 {
8189 int key = recipesIds.Get(i);
8190 string recipeName = moduleRecipesManager.GetRecipeName(key);
8192 }
8193 }
8194
8195
8196 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8197 {
8198 super.GetDebugActions(outputList);
8199
8200
8206
8207
8212
8217
8218
8222
8223
8225 {
8229 }
8230
8233
8234
8238
8240
8241 InventoryLocation loc = new InventoryLocation();
8242 GetInventory().GetCurrentInventoryLocation(loc);
8244 {
8245 if (Gizmo_IsSupported())
8248 }
8249
8251 }
8252
8253
8254
8255
8257 {
8258 super.OnAction(action_id, player, ctx);
8259
8261 {
8262 switch (action_id)
8263 {
8267 return true;
8271 return true;
8272 }
8273 }
8274
8276 {
8277 switch (action_id)
8278 {
8280 Delete();
8281 return true;
8282 }
8283 }
8284
8285 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8286 {
8287 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8288 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8289 PlayerBase p = PlayerBase.Cast(player);
8290 if (
EActions.RECIPES_RANGE_START < 1000)
8291 {
8292 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8293 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8294 }
8295 }
8296 #ifndef SERVER
8297 else if (action_id ==
EActions.WATCH_PLAYER)
8298 {
8299 PluginDeveloper.SetDeveloperItemClientEx(player);
8300 }
8301 #endif
8303 {
8304 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8305 {
8306 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8307 OnDebugButtonPressServer(id + 1);
8308 }
8309
8310 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8311 {
8312 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8314 }
8315
8316 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8317 {
8318 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8320 }
8321
8322 else if (action_id ==
EActions.ADD_QUANTITY)
8323 {
8324 if (IsMagazine())
8325 {
8326 Magazine mag = Magazine.Cast(this);
8327 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8328 }
8329 else
8330 {
8332 }
8333
8334 if (m_EM)
8335 {
8336 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8337 }
8338
8339 }
8340
8341 else if (action_id ==
EActions.REMOVE_QUANTITY)
8342 {
8343 if (IsMagazine())
8344 {
8345 Magazine mag2 = Magazine.Cast(this);
8346 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8347 }
8348 else
8349 {
8351 }
8352 if (m_EM)
8353 {
8354 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8355 }
8356
8357 }
8358
8359 else if (action_id ==
EActions.SET_QUANTITY_0)
8360 {
8362
8363 if (m_EM)
8364 {
8365 m_EM.SetEnergy(0);
8366 }
8367 }
8368
8369 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8370 {
8372
8373 if (m_EM)
8374 {
8375 m_EM.SetEnergy(m_EM.GetEnergyMax());
8376 }
8377 }
8378
8379 else if (action_id ==
EActions.ADD_HEALTH)
8380 {
8381 AddHealth("","",GetMaxHealth("","Health")/5);
8382 }
8383 else if (action_id ==
EActions.REMOVE_HEALTH)
8384 {
8385 AddHealth("","",-GetMaxHealth("","Health")/5);
8386 }
8387 else if (action_id ==
EActions.DESTROY_HEALTH)
8388 {
8389 SetHealth01("","",0);
8390 }
8391 else if (action_id ==
EActions.WATCH_ITEM)
8392 {
8394 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8395 #ifdef DEVELOPER
8396 SetDebugDeveloper_item(this);
8397 #endif
8398 }
8399
8400 else if (action_id ==
EActions.ADD_TEMPERATURE)
8401 {
8402 AddTemperature(20);
8403
8404 }
8405
8406 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8407 {
8408 AddTemperature(-20);
8409
8410 }
8411
8412 else if (action_id ==
EActions.FLIP_FROZEN)
8413 {
8414 SetFrozen(!GetIsFrozen());
8415
8416 }
8417
8418 else if (action_id ==
EActions.ADD_WETNESS)
8419 {
8421
8422 }
8423
8424 else if (action_id ==
EActions.REMOVE_WETNESS)
8425 {
8427
8428 }
8429
8430 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8431 {
8434
8435
8436 }
8437
8438 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8439 {
8442 }
8443
8444 else if (action_id ==
EActions.MAKE_SPECIAL)
8445 {
8446 auto debugParams = DebugSpawnParams.WithPlayer(player);
8447 OnDebugSpawnEx(debugParams);
8448 }
8449
8450 }
8451
8452
8453 return false;
8454 }
8455
8456
8457
8458
8462
8465
8466
8467
8469 {
8470 return false;
8471 }
8472
8473
8475 {
8476 return true;
8477 }
8478
8479
8481 {
8482 return true;
8483 }
8484
8485
8486
8488 {
8489 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8490 return g_Game.ConfigIsExisting(config_path);
8491 }
8492
8495 {
8496 return null;
8497 }
8498
8500 {
8501 return false;
8502 }
8503
8505 {
8506 return false;
8507 }
8508
8512
8513
8515 {
8516 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8517 return module_repairing.CanRepair(this, item_repair_kit);
8518 }
8519
8520
8521 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8522 {
8523 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8524 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8525 }
8526
8527
8529 {
8530
8531
8532
8533
8534
8535
8536
8537
8538 return 1;
8539 }
8540
8541
8542
8544 {
8546 }
8547
8548
8549
8551 {
8553 }
8554
8555
8564 {
8565 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8566
8567 if (player)
8568 {
8569 player.MessageStatus(text);
8570 }
8571 }
8572
8573
8582 {
8583 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8584
8585 if (player)
8586 {
8587 player.MessageAction(text);
8588 }
8589 }
8590
8591
8600 {
8601 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8602
8603 if (player)
8604 {
8605 player.MessageFriendly(text);
8606 }
8607 }
8608
8609
8618 {
8619 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8620
8621 if (player)
8622 {
8623 player.MessageImportant(text);
8624 }
8625 }
8626
8628 {
8629 return true;
8630 }
8631
8632
8633 override bool KindOf(
string tag)
8634 {
8635 bool found = false;
8636 string item_name = this.
GetType();
8638 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8639
8640 int array_size = item_tag_array.Count();
8641 for (int i = 0; i < array_size; i++)
8642 {
8643 if (item_tag_array.Get(i) == tag)
8644 {
8645 found = true;
8646 break;
8647 }
8648 }
8649 return found;
8650 }
8651
8652
8654 {
8655
8656 super.OnRPC(sender, rpc_type,ctx);
8657
8658
8659 switch (rpc_type)
8660 {
8661 #ifndef SERVER
8662 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8663 Param2<bool, string> p = new Param2<bool, string>(false, "");
8664
8666 return;
8667
8668 bool play = p.param1;
8669 string soundSet = p.param2;
8670
8671 if (play)
8672 {
8674 {
8676 {
8678 }
8679 }
8680 else
8681 {
8683 }
8684 }
8685 else
8686 {
8688 }
8689
8690 break;
8691 #endif
8692
8693 }
8694
8696 {
8698 }
8699 }
8700
8701
8702
8703
8705 {
8706 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8707 return plugin.GetID(
name);
8708 }
8709
8711 {
8712 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8713 return plugin.GetName(id);
8714 }
8715
8718 {
8719
8720
8721 int varFlags;
8722 if (!ctx.
Read(varFlags))
8723 return;
8724
8725 if (varFlags & ItemVariableFlags.FLOAT)
8726 {
8728 }
8729 }
8730
8732 {
8733
8734 super.SerializeNumericalVars(floats_out);
8735
8736
8737
8739 {
8741 }
8742
8744 {
8746 }
8747
8749 {
8751 }
8752
8754 {
8759 }
8760
8762 {
8764 }
8765 }
8766
8768 {
8769
8770 super.DeSerializeNumericalVars(floats);
8771
8772
8773 int index = 0;
8774 int mask = Math.Round(floats.Get(index));
8775
8776 index++;
8777
8779 {
8781 {
8783 }
8784 else
8785 {
8786 float quantity = floats.Get(index);
8788 }
8789 index++;
8790 }
8791
8793 {
8794 float wet = floats.Get(index);
8796 index++;
8797 }
8798
8800 {
8801 int liquidtype = Math.Round(floats.Get(index));
8803 index++;
8804 }
8805
8807 {
8809 index++;
8811 index++;
8813 index++;
8815 index++;
8816 }
8817
8819 {
8820 int cleanness = Math.Round(floats.Get(index));
8822 index++;
8823 }
8824 }
8825
8827 {
8828 super.WriteVarsToCTX(ctx);
8829
8830
8832 {
8834 }
8835
8837 {
8839 }
8840
8842 {
8844 }
8845
8847 {
8848 int r,g,b,a;
8854 }
8855
8857 {
8859 }
8860 }
8861
8863 {
8864 if (!super.ReadVarsFromCTX(ctx,version))
8865 return false;
8866
8867 int intValue;
8868 float value;
8869
8870 if (version < 140)
8871 {
8872 if (!ctx.
Read(intValue))
8873 return false;
8874
8875 m_VariablesMask = intValue;
8876 }
8877
8879 {
8880 if (!ctx.
Read(value))
8881 return false;
8882
8884 {
8886 }
8887 else
8888 {
8890 }
8891 }
8892
8893 if (version < 140)
8894 {
8896 {
8897 if (!ctx.
Read(value))
8898 return false;
8899 SetTemperatureDirect(value);
8900 }
8901 }
8902
8904 {
8905 if (!ctx.
Read(value))
8906 return false;
8908 }
8909
8911 {
8912 if (!ctx.
Read(intValue))
8913 return false;
8915 }
8916
8918 {
8919 int r,g,b,a;
8921 return false;
8923 return false;
8925 return false;
8927 return false;
8928
8930 }
8931
8933 {
8934 if (!ctx.
Read(intValue))
8935 return false;
8937 }
8938
8939 if (version >= 138 && version < 140)
8940 {
8942 {
8943 if (!ctx.
Read(intValue))
8944 return false;
8945 SetFrozen(intValue);
8946 }
8947 }
8948
8949 return true;
8950 }
8951
8952
8954 {
8957 {
8959 }
8960
8961 if (!super.OnStoreLoad(ctx, version))
8962 {
8964 return false;
8965 }
8966
8967 if (version >= 114)
8968 {
8969 bool hasQuickBarIndexSaved;
8970
8971 if (!ctx.
Read(hasQuickBarIndexSaved))
8972 {
8974 return false;
8975 }
8976
8977 if (hasQuickBarIndexSaved)
8978 {
8979 int itmQBIndex;
8980
8981
8982 if (!ctx.
Read(itmQBIndex))
8983 {
8985 return false;
8986 }
8987
8988 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8989 if (itmQBIndex != -1 && parentPlayer)
8990 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8991 }
8992 }
8993 else
8994 {
8995
8996 PlayerBase player;
8997 int itemQBIndex;
8998 if (version ==
int.
MAX)
8999 {
9000 if (!ctx.
Read(itemQBIndex))
9001 {
9003 return false;
9004 }
9005 }
9006 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9007 {
9008
9009 if (!ctx.
Read(itemQBIndex))
9010 {
9012 return false;
9013 }
9014 if (itemQBIndex != -1 && player)
9015 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9016 }
9017 }
9018
9019 if (version < 140)
9020 {
9021
9022 if (!LoadVariables(ctx, version))
9023 {
9025 return false;
9026 }
9027 }
9028
9029
9031 {
9033 return false;
9034 }
9035 if (version >= 132)
9036 {
9038 if (raib)
9039 {
9041 {
9043 return false;
9044 }
9045 }
9046 }
9047
9049 return true;
9050 }
9051
9052
9053
9055 {
9056 super.OnStoreSave(ctx);
9057
9058 PlayerBase player;
9059 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9060 {
9062
9063 int itemQBIndex = -1;
9064 itemQBIndex = player.FindQuickBarEntityIndex(this);
9065 ctx.
Write(itemQBIndex);
9066 }
9067 else
9068 {
9070 }
9071
9073
9075 if (raib)
9076 {
9078 }
9079 }
9080
9081
9083 {
9084 super.AfterStoreLoad();
9085
9087 {
9089 }
9090
9092 {
9095 }
9096 }
9097
9099 {
9100 super.EEOnAfterLoad();
9101
9103 {
9105 }
9106
9109 }
9110
9112 {
9113 return false;
9114 }
9115
9116
9117
9119 {
9121 {
9122 #ifdef PLATFORM_CONSOLE
9123
9125 {
9127 if (menu)
9128 {
9130 }
9131 }
9132 #endif
9133 }
9134
9136 {
9139 }
9140
9142 {
9143 SetWeightDirty();
9145 }
9147 {
9150 }
9151
9153 {
9156
9159 }
9161 {
9165 }
9166
9167 super.OnVariablesSynchronized();
9168 }
9169
9170
9171
9173 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9174 {
9175 if (!IsServerCheck(allow_client))
9176 return false;
9177
9179 return false;
9180
9183
9184 if (value <= (min + 0.001))
9185 value = min;
9186
9187 if (value == min)
9188 {
9189 if (destroy_config)
9190 {
9191 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9192 if (dstr)
9193 {
9195 this.Delete();
9196 return true;
9197 }
9198 }
9199 else if (destroy_forced)
9200 {
9202 this.Delete();
9203 return true;
9204 }
9205
9207 }
9208
9211
9213 {
9214 EntityAI parent = GetHierarchyRoot();
9215 InventoryLocation iLoc = new InventoryLocation();
9216 GetInventory().GetCurrentInventoryLocation(iLoc);
9218 {
9219 int iLocSlot = iLoc.
GetSlot();
9221 {
9223 }
9225 {
9227 }
9228 }
9229 }
9230
9232 {
9234
9235 if (delta)
9237 }
9238
9240
9241 return false;
9242 }
9243
9244
9246 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9247 {
9249 }
9250
9252 {
9255 }
9256
9258 {
9261 }
9262
9264 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9265 {
9266 float value_clamped = Math.Clamp(value, 0, 1);
9268 SetQuantity(result, destroy_config, destroy_forced);
9269 }
9270
9271
9274 {
9276 }
9277
9279 {
9281 }
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9293 {
9294 int slot = -1;
9295 GameInventory inventory = GetInventory();
9296 if (inventory)
9297 {
9298 InventoryLocation il = new InventoryLocation;
9301 }
9302
9304 }
9305
9307 {
9308 float quantity_max = 0;
9309
9311 {
9312 if (attSlotID != -1)
9313 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9314
9315 if (quantity_max <= 0)
9317 }
9318
9319 if (quantity_max <= 0)
9321
9322 return quantity_max;
9323 }
9324
9326 {
9328 }
9329
9331 {
9333 }
9334
9335
9337 {
9339 }
9340
9342 {
9344 }
9345
9347 {
9349 }
9350
9351
9353 {
9354
9355 float weightEx = GetWeightEx();
9356 float special = GetInventoryAndCargoWeight();
9357 return weightEx - special;
9358 }
9359
9360
9362 {
9364 }
9365
9367 {
9369 {
9370 #ifdef DEVELOPER
9371 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9372 {
9373 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9375 }
9376 #endif
9377
9379 }
9380 else if (HasEnergyManager())
9381 {
9382 #ifdef DEVELOPER
9383 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9384 {
9385 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9386 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9387 }
9388 #endif
9389 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9390 }
9391 else
9392 {
9393 #ifdef DEVELOPER
9394 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9395 {
9396 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9397 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9398 }
9399 #endif
9400 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9401 }
9402 }
9403
9406 {
9407 int item_count = 0;
9409
9410 GameInventory inventory = GetInventory();
9411 CargoBase cargo = inventory.
GetCargo();
9412 if (cargo != NULL)
9413 {
9415 }
9416
9418 for (int i = 0; i < nAttachments; ++i)
9419 {
9421 if (item)
9422 item_count += item.GetNumberOfItems();
9423 }
9424 return item_count;
9425 }
9426
9429 {
9430 float weight = 0;
9431 float wetness = 1;
9432 if (include_wetness)
9435 {
9436 weight = wetness * m_ConfigWeight;
9437 }
9439 {
9440 weight = 1;
9441 }
9442 return weight;
9443 }
9444
9445
9446
9448 {
9449 GameInventory inventory = GetInventory();
9450 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9451 {
9452 array<EntityAI> items = new array<EntityAI>;
9454 for (int i = 0; i < items.Count(); ++i)
9455 {
9457 if (item)
9458 {
9459 g_Game.ObjectDelete(item);
9460 }
9461 }
9462 }
9463 }
9464
9465
9466
9467
9469 {
9470 float energy = 0;
9471 if (HasEnergyManager())
9472 {
9473 energy = GetCompEM().GetEnergy();
9474 }
9475 return energy;
9476 }
9477
9478
9480 {
9481 super.OnEnergyConsumed();
9482
9484 }
9485
9487 {
9488 super.OnEnergyAdded();
9489
9491 }
9492
9493
9495 {
9496 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9497 {
9499 {
9500 float energy_0to1 = GetCompEM().GetEnergy0To1();
9502 }
9503 }
9504 }
9505
9506
9508 {
9509 return ConfigGetFloat("heatIsolation");
9510 }
9511
9513 {
9515 }
9516
9518 {
9519 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9520 if (
g_Game.ConfigIsExisting(paramPath))
9521 return g_Game.ConfigGetFloat(paramPath);
9522
9523 return 0.0;
9524 }
9525
9527 {
9528 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9529 if (
g_Game.ConfigIsExisting(paramPath))
9530 return g_Game.ConfigGetFloat(paramPath);
9531
9532 return 0.0;
9533 }
9534
9535 override void SetWet(
float value,
bool allow_client =
false)
9536 {
9537 if (!IsServerCheck(allow_client))
9538 return;
9539
9542
9544
9545 m_VarWet = Math.Clamp(value, min, max);
9546
9548 {
9551 }
9552 }
9553
9554 override void AddWet(
float value)
9555 {
9557 }
9558
9560 {
9562 }
9563
9565 {
9567 }
9568
9570 {
9572 }
9573
9575 {
9577 }
9578
9580 {
9582 }
9583
9585 {
9588 if (newLevel != oldLevel)
9589 {
9591 }
9592 }
9593
9595 {
9596 SetWeightDirty();
9597 }
9598
9600 {
9601 return GetWetLevelInternal(
m_VarWet);
9602 }
9603
9604
9605
9607 {
9609 }
9610
9612 {
9614 }
9615
9617 {
9619 }
9620
9622 {
9624 }
9625
9626
9627
9629 {
9630 if (ConfigIsExisting("itemModelLength"))
9631 {
9632 return ConfigGetFloat("itemModelLength");
9633 }
9634 return 0;
9635 }
9636
9638 {
9639 if (ConfigIsExisting("itemAttachOffset"))
9640 {
9641 return ConfigGetFloat("itemAttachOffset");
9642 }
9643 return 0;
9644 }
9645
9646 override void SetCleanness(
int value,
bool allow_client =
false)
9647 {
9648 if (!IsServerCheck(allow_client))
9649 return;
9650
9652
9654
9657 }
9658
9660 {
9662 }
9663
9665 {
9666 return true;
9667 }
9668
9669
9670
9671
9673 {
9675 }
9676
9678 {
9680 }
9681
9682
9683
9684
9685 override void SetColor(
int r,
int g,
int b,
int a)
9686 {
9692 }
9694 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9695 {
9700 }
9701
9703 {
9705 }
9706
9709 {
9710 int r,g,b,a;
9712 r = r/255;
9713 g = g/255;
9714 b = b/255;
9715 a = a/255;
9716 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9717 }
9718
9719
9720
9721 override void SetLiquidType(
int value,
bool allow_client =
false)
9722 {
9723 if (!IsServerCheck(allow_client))
9724 return;
9725
9730 }
9731
9733 {
9734 return ConfigGetInt("varLiquidTypeInit");
9735 }
9736
9738 {
9740 }
9741
9743 {
9745 SetFrozen(false);
9746 }
9747
9750 {
9751 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9752 }
9753
9754
9757 {
9758 PlayerBase nplayer;
9759 if (PlayerBase.CastTo(nplayer, player))
9760 {
9762 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9763 }
9764 }
9765
9766
9769 {
9770 PlayerBase nplayer;
9771 if (PlayerBase.CastTo(nplayer,player))
9772 {
9773 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9774 }
9775
9776 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9777
9778 if (HasEnergyManager())
9779 {
9780 GetCompEM().UpdatePlugState();
9781 }
9782 }
9783
9784
9786 {
9787 super.OnPlacementStarted(player);
9788
9790 }
9791
9792 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9793 {
9795 {
9796 m_AdminLog.OnPlacementComplete(player,
this);
9797 }
9798
9799 super.OnPlacementComplete(player, position, orientation);
9800 }
9801
9802
9803
9804
9805
9807 {
9809 {
9810 return true;
9811 }
9812 else
9813 {
9814 return false;
9815 }
9816 }
9817
9818
9820 {
9822 {
9824 }
9825 }
9826
9827
9829 {
9831 }
9832
9834 {
9836 }
9837
9838 override void InsertAgent(
int agent,
float count = 1)
9839 {
9840 if (count < 1)
9841 return;
9842
9844 }
9845
9848 {
9850 }
9851
9852
9854 {
9856 }
9857
9858
9859
9860
9861
9862
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
9900 {
9902 return false;
9903 return true;
9904 }
9905
9907 {
9908
9910 }
9911
9912
9915 {
9916 super.CheckForRoofLimited(timeTresholdMS);
9917
9918 float time =
g_Game.GetTime();
9919 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9920 {
9921 m_PreviousRoofTestTime = time;
9922 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9923 }
9924 }
9925
9926
9928 {
9930 {
9931 return 0;
9932 }
9933
9934 if (GetInventory().GetAttachmentSlotsCount() != 0)
9935 {
9936 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9937 if (filter)
9938 return filter.GetProtectionLevel(type, false, system);
9939 else
9940 return 0;
9941 }
9942
9943 string subclassPath, entryName;
9944
9945 switch (type)
9946 {
9948 entryName = "biological";
9949 break;
9951 entryName = "chemical";
9952 break;
9953 default:
9954 entryName = "biological";
9955 break;
9956 }
9957
9958 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9959
9960 return g_Game.ConfigGetFloat(subclassPath + entryName);
9961 }
9962
9963
9964
9967 {
9968 if (!IsMagazine())
9970
9972 }
9973
9974
9975
9976
9977
9982 {
9983 return true;
9984 }
9985
9987 {
9989 }
9990
9991
9992
9993
9994
9996 {
9997 if (parent)
9998 {
9999 if (parent.IsInherited(DayZInfected))
10000 return true;
10001
10002 if (!parent.IsRuined())
10003 return true;
10004 }
10005
10006 return true;
10007 }
10008
10010 {
10011 if (!super.CanPutAsAttachment(parent))
10012 {
10013 return false;
10014 }
10015
10016 if (!IsRuined() && !parent.IsRuined())
10017 {
10018 return true;
10019 }
10020
10021 return false;
10022 }
10023
10025 {
10026
10027
10028
10029
10030 return super.CanReceiveItemIntoCargo(item);
10031 }
10032
10034 {
10035
10036
10037
10038
10039 GameInventory attachmentInv = attachment.GetInventory();
10041 {
10042 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10043 return false;
10044 }
10045
10046 InventoryLocation loc = new InventoryLocation();
10047 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10048 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10049 return false;
10050
10051 return super.CanReceiveAttachment(attachment, slotId);
10052 }
10053
10055 {
10056 if (!super.CanReleaseAttachment(attachment))
10057 return false;
10058
10059 return GetInventory().AreChildrenAccessible();
10060 }
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10083 {
10084 int id = muzzle_owner.GetMuzzleID();
10085 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10086
10087 if (WPOF_array)
10088 {
10089 for (int i = 0; i < WPOF_array.Count(); i++)
10090 {
10091 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10092
10093 if (WPOF)
10094 {
10095 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10096 }
10097 }
10098 }
10099 }
10100
10101
10103 {
10104 int id = muzzle_owner.GetMuzzleID();
10106
10107 if (WPOBE_array)
10108 {
10109 for (int i = 0; i < WPOBE_array.Count(); i++)
10110 {
10111 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10112
10113 if (WPOBE)
10114 {
10115 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10116 }
10117 }
10118 }
10119 }
10120
10121
10123 {
10124 int id = muzzle_owner.GetMuzzleID();
10125 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10126
10127 if (WPOOH_array)
10128 {
10129 for (int i = 0; i < WPOOH_array.Count(); i++)
10130 {
10131 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10132
10133 if (WPOOH)
10134 {
10135 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10136 }
10137 }
10138 }
10139 }
10140
10141
10143 {
10144 int id = muzzle_owner.GetMuzzleID();
10145 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10146
10147 if (WPOOH_array)
10148 {
10149 for (int i = 0; i < WPOOH_array.Count(); i++)
10150 {
10151 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10152
10153 if (WPOOH)
10154 {
10155 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10156 }
10157 }
10158 }
10159 }
10160
10161
10163 {
10164 int id = muzzle_owner.GetMuzzleID();
10165 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10166
10167 if (WPOOH_array)
10168 {
10169 for (int i = 0; i < WPOOH_array.Count(); i++)
10170 {
10171 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10172
10173 if (WPOOH)
10174 {
10175 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10176 }
10177 }
10178 }
10179 }
10180
10181
10182
10184 {
10186 {
10187 return true;
10188 }
10189
10190 return false;
10191 }
10192
10194 {
10196 {
10197 return true;
10198 }
10199
10200 return false;
10201 }
10202
10204 {
10206 {
10207 return true;
10208 }
10209
10210 return false;
10211 }
10212
10214 {
10215 return false;
10216 }
10217
10220 {
10221 return UATimeSpent.DEFAULT_DEPLOY;
10222 }
10223
10224
10225
10226
10228 {
10230 SetSynchDirty();
10231 }
10232
10234 {
10236 }
10237
10238
10240 {
10241 return false;
10242 }
10243
10246 {
10247 string att_type = "None";
10248
10249 if (ConfigIsExisting("soundAttType"))
10250 {
10251 att_type = ConfigGetString("soundAttType");
10252 }
10253
10255 }
10256
10258 {
10260 }
10261
10262
10263
10264
10265
10271
10273 {
10276
10278 }
10279
10280
10282 {
10284 return;
10285
10287
10290
10293
10294 SoundParameters params = new SoundParameters();
10298 }
10299
10300
10302 {
10304 {
10307
10308 SetSynchDirty();
10309
10312 }
10313 }
10314
10316 {
10318 }
10319
10320
10322 {
10324 return;
10325
10327 SetSynchDirty();
10328
10331 }
10332
10334 {
10337 }
10338
10340 {
10342 }
10343
10344 void OnApply(PlayerBase player);
10345
10347 {
10348 return 1.0;
10349 };
10350
10352 {
10354 }
10355
10357 {
10359 }
10360
10362
10364 {
10365 SetDynamicPhysicsLifeTime(0.01);
10367 }
10368
10370 {
10371 array<string> zone_names = new array<string>;
10372 GetDamageZones(zone_names);
10373 for (int i = 0; i < zone_names.Count(); i++)
10374 {
10375 SetHealthMax(zone_names.Get(i),"Health");
10376 }
10377 SetHealthMax("","Health");
10378 }
10379
10382 {
10383 float global_health = GetHealth01("","Health");
10384 array<string> zones = new array<string>;
10385 GetDamageZones(zones);
10386
10387 for (int i = 0; i < zones.Count(); i++)
10388 {
10389 SetHealth01(zones.Get(i),"Health",global_health);
10390 }
10391 }
10392
10395 {
10396 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10397 }
10398
10400 {
10401 if (!hasRootAsPlayer)
10402 {
10403 if (refParentIB)
10404 {
10405
10406 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10407 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10408
10409 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10410 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10411
10414 }
10415 else
10416 {
10417
10420 }
10421 }
10422 }
10423
10425 {
10427 {
10428 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10429 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10430 {
10431 float heatPermCoef = 1.0;
10433 while (ent)
10434 {
10435 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10436 ent = ent.GetHierarchyParent();
10437 }
10438
10439 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10440 }
10441 }
10442 }
10443
10445 {
10446
10447 EntityAI parent = GetHierarchyParent();
10448 if (!parent)
10449 {
10450 hasParent = false;
10451 hasRootAsPlayer = false;
10452 }
10453 else
10454 {
10455 hasParent = true;
10456 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10457 refParentIB =
ItemBase.Cast(parent);
10458 }
10459 }
10460
10461 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10462 {
10463
10464 }
10465
10467 {
10468
10469 return false;
10470 }
10471
10473 {
10474
10475
10476 return false;
10477 }
10478
10480 {
10481
10482 return false;
10483 }
10484
10487 {
10488 return !GetIsFrozen() &&
IsOpen();
10489 }
10490
10492 {
10493 bool hasParent = false, hasRootAsPlayer = false;
10495
10496 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10497 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10498
10499 if (wwtu || foodDecay)
10500 {
10504
10505 if (processWetness || processTemperature || processDecay)
10506 {
10508
10509 if (processWetness)
10510 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10511
10512 if (processTemperature)
10514
10515 if (processDecay)
10516 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10517 }
10518 }
10519 }
10520
10523 {
10525 }
10526
10528 {
10531
10532 return super.GetTemperatureFreezeThreshold();
10533 }
10534
10536 {
10539
10540 return super.GetTemperatureThawThreshold();
10541 }
10542
10544 {
10547
10548 return super.GetItemOverheatThreshold();
10549 }
10550
10552 {
10554 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10555
10556 return super.GetTemperatureFreezeTime();
10557 }
10558
10560 {
10562 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10563
10564 return super.GetTemperatureThawTime();
10565 }
10566
10571
10573 {
10574 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10575 }
10576
10578 {
10579 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10580 }
10581
10584 {
10586 }
10587
10589 {
10591 }
10592
10594 {
10596 }
10597
10600 {
10601 return null;
10602 }
10603
10606 {
10607 return false;
10608 }
10609
10611 {
10613 {
10616 if (!trg)
10617 {
10619 explosive = this;
10620 }
10621
10622 explosive.PairRemote(trg);
10624
10625 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10626 trg.SetPersistentPairID(persistentID);
10627 explosive.SetPersistentPairID(persistentID);
10628
10629 return true;
10630 }
10631 return false;
10632 }
10633
10636 {
10637 float ret = 1.0;
10640 ret *= GetHealth01();
10641
10642 return ret;
10643 }
10644
10645 #ifdef DEVELOPER
10646 override void SetDebugItem()
10647 {
10648 super.SetDebugItem();
10649 _itemBase = this;
10650 }
10651
10653 {
10654 string text = super.GetDebugText();
10655
10657 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10658
10659 return text;
10660 }
10661 #endif
10662
10664 {
10665 return true;
10666 }
10667
10669
10671
10673 {
10676 }
10677
10678
10686
10702
10703 [
Obsolete(
"Use ItemSoundHandler instead")]
10706 {
10707 if (!
g_Game.IsDedicatedServer())
10708 {
10709 if (ConfigIsExisting("attachSoundSet"))
10710 {
10711 string cfg_path = "";
10712 string soundset = "";
10713 string type_name =
GetType();
10714
10717 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10718 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10719
10720 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10721 {
10722 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10723 {
10724 if (cfg_slot_array[i] == slot_type)
10725 {
10726 soundset = cfg_soundset_array[i];
10727 break;
10728 }
10729 }
10730 }
10731
10732 if (soundset != "")
10733 {
10734 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10736 }
10737 }
10738 }
10739 }
10740
10742}
10743
10745{
10747 if (entity)
10748 {
10749 bool is_item = entity.IsInherited(
ItemBase);
10750 if (is_item && full_quantity)
10751 {
10754 }
10755 }
10756 else
10757 {
10759 return NULL;
10760 }
10761 return entity;
10762}
10763
10765{
10766 if (item)
10767 {
10768 if (health > 0)
10769 item.SetHealth("", "", health);
10770
10771 if (item.CanHaveTemperature())
10772 {
10774 if (item.CanFreeze())
10775 item.SetFrozen(false);
10776 }
10777
10778 if (item.HasEnergyManager())
10779 {
10780 if (quantity >= 0)
10781 {
10782 item.GetCompEM().SetEnergy0To1(quantity);
10783 }
10784 else
10785 {
10787 }
10788 }
10789 else if (item.IsMagazine())
10790 {
10791 Magazine mag = Magazine.Cast(item);
10792 if (quantity >= 0)
10793 {
10794 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10795 }
10796 else
10797 {
10799 }
10800
10801 }
10802 else
10803 {
10804 if (quantity >= 0)
10805 {
10806 item.SetQuantityNormalized(quantity, false);
10807 }
10808 else
10809 {
10811 }
10812
10813 }
10814 }
10815}
10816
10817#ifdef DEVELOPER
10819#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.