5890{
5892 {
5893 return true;
5894 }
5895};
5896
5898{
5899
5900};
5901
5902
5903
5905{
5909
5911
5914
5915
5916
5917
5918
5927
5933
5938
5943
5964 protected bool m_IsResultOfSplit
5965
5967
5972
5973
5974
5976
5980
5981
5982
5984
5987
5988
5989
5995
5996
6004
6007
6008
6010
6011
6013
6014
6019
6020
6025
6027
6028
6030
6031
6033 {
6038
6039 if (!
g_Game.IsDedicatedServer())
6040 {
6042 {
6044
6046 {
6048 }
6049 }
6050
6053 }
6054
6055 m_OldLocation = null;
6056
6058 {
6060 }
6061
6062 if (ConfigIsExisting("headSelectionsToHide"))
6063 {
6066 }
6067
6069 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6070 {
6072 }
6073
6075
6076 m_IsResultOfSplit = false;
6077
6079 }
6080
6082 {
6083 super.InitItemVariables();
6084
6090 m_Count = ConfigGetInt(
"count");
6091
6094
6099
6102
6107
6119
6123
6124
6127 if (ConfigIsExisting("canBeSplit"))
6128 {
6131 }
6132
6134 if (ConfigIsExisting("itemBehaviour"))
6136
6137
6140 RegisterNetSyncVariableInt("m_VarLiquidType");
6141 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6142
6143 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6144 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6145 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6146
6147 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6148 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6149 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6150 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6151
6152 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6153 RegisterNetSyncVariableBool("m_IsTakeable");
6154 RegisterNetSyncVariableBool("m_IsHologram");
6155
6158 {
6161 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6162 }
6163
6165
6167 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6169
6171 }
6172
6174 {
6176 }
6177
6179 {
6182 {
6187 }
6188 }
6189
6190 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6191 {
6193 {
6196 }
6197
6199 }
6200
6202 {
6208 }
6209
6211
6213 {
6215
6216 if (!action)
6217 {
6218 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6219 return;
6220 }
6221
6223 if (!ai)
6224 {
6226 return;
6227 }
6228
6230 if (!action_array)
6231 {
6232 action_array = new array<ActionBase_Basic>;
6234 }
6235 if (LogManager.IsActionLogEnable())
6236 {
6237 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6238 }
6239
6240 if (action_array.Find(action) != -1)
6241 {
6242 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6243 }
6244 else
6245 {
6246 action_array.Insert(action);
6247 }
6248 }
6249
6251 {
6252 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6253 ActionBase action = player.GetActionManager().GetAction(actionName);
6256
6257 if (action_array)
6258 {
6259 action_array.RemoveItem(action);
6260 }
6261 }
6262
6263
6264
6266 {
6267 ActionOverrideData overrideData = new ActionOverrideData();
6271
6273 if (!actionMap)
6274 {
6277 }
6278
6279 actionMap.Insert(this.
Type(), overrideData);
6280
6281 }
6282
6284
6286
6287
6289 {
6292
6295
6296 string config_to_search = "CfgVehicles";
6297 string muzzle_owner_config;
6298
6300 {
6301 if (IsInherited(Weapon))
6302 config_to_search = "CfgWeapons";
6303
6304 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6305
6306 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6307
6308 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6309
6310 if (config_OnFire_subclass_count > 0)
6311 {
6312 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6313
6314 for (int i = 0; i < config_OnFire_subclass_count; i++)
6315 {
6316 string particle_class = "";
6317 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6318 string config_OnFire_entry = config_OnFire_class + particle_class;
6319 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6320 WPOF_array.Insert(WPOF);
6321 }
6322
6323
6325 }
6326 }
6327
6329 {
6330 config_to_search = "CfgWeapons";
6331 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6332
6333 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6334
6335 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6336
6337 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6338 {
6339 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6340
6341 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6342 {
6343 string particle_class2 = "";
6344 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6345 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6346 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6347 WPOBE_array.Insert(WPOBE);
6348 }
6349
6350
6352 }
6353 }
6354 }
6355
6356
6358 {
6361
6363 {
6364 string config_to_search = "CfgVehicles";
6365
6366 if (IsInherited(Weapon))
6367 config_to_search = "CfgWeapons";
6368
6369 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6370 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6371
6372 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6373 {
6374
6376
6378 {
6380 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6382 return;
6383 }
6384
6387
6388
6389
6390 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6391 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6392
6393 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6394 {
6395 string particle_class = "";
6396 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6397 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6398 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6399
6400 if (entry_type == CT_CLASS)
6401 {
6402 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6403 WPOOH_array.Insert(WPOF);
6404 }
6405 }
6406
6407
6409 }
6410 }
6411 }
6412
6414 {
6416 }
6417
6419 {
6421 {
6423
6426
6429
6430 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6431 }
6432 }
6433
6435 {
6437 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6438
6440 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6441
6443 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6444
6446 {
6448 }
6449 }
6450
6452 {
6454 }
6455
6457 {
6460 else
6462
6464 {
6467 }
6468 else
6469 {
6472
6475 }
6476
6478 }
6479
6481 {
6483 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6484 }
6485
6487 {
6489 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6491 }
6492
6494 {
6496 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6497 }
6498
6500 {
6503
6504 OverheatingParticle OP = new OverheatingParticle();
6509
6511 }
6512
6514 {
6517
6518 return -1;
6519 }
6520
6522 {
6524 {
6527
6528 for (int i = count; i > 0; --i)
6529 {
6530 int id = i - 1;
6533
6536
6537 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6538 {
6539 if (p)
6540 {
6543 }
6544 }
6545 }
6546 }
6547 }
6548
6550 {
6552 {
6554 {
6555 int id = i - 1;
6557
6558 if (OP)
6559 {
6561
6562 if (p)
6563 {
6565 }
6566
6567 delete OP;
6568 }
6569 }
6570
6573 }
6574 }
6575
6578 {
6579 return 0.0;
6580 }
6581
6582
6584 {
6585 return 250;
6586 }
6587
6589 {
6590 return 0;
6591 }
6592
6595 {
6597 return true;
6598
6599 return false;
6600 }
6601
6604 {
6607
6609 {
6611 }
6612 else
6613 {
6614
6616 }
6617
6619 }
6620
6627 {
6628 return -1;
6629 }
6630
6631
6632
6633
6635 {
6637 {
6638 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6639 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6640
6641 if (r_index >= 0)
6642 {
6643 InventoryLocation r_il = new InventoryLocation;
6644 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6645
6646 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6649 {
6650 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6651 }
6653 {
6654 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6655 }
6656
6657 }
6658
6659 player.GetHumanInventory().ClearUserReservedLocation(this);
6660 }
6661
6664 }
6665
6666
6667
6668
6670 {
6671 return ItemBase.m_DebugActionsMask;
6672 }
6673
6675 {
6676 return ItemBase.m_DebugActionsMask & mask;
6677 }
6678
6680 {
6681 ItemBase.m_DebugActionsMask = mask;
6682 }
6683
6685 {
6686 ItemBase.m_DebugActionsMask |= mask;
6687 }
6688
6690 {
6691 ItemBase.m_DebugActionsMask &= ~mask;
6692 }
6693
6695 {
6697 {
6699 }
6700 else
6701 {
6703 }
6704 }
6705
6706
6708 {
6709 if (GetEconomyProfile())
6710 {
6711 float q_max = GetEconomyProfile().GetQuantityMax();
6712 if (q_max > 0)
6713 {
6714 float q_min = GetEconomyProfile().GetQuantityMin();
6715 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6716
6718 {
6719 ComponentEnergyManager comp = GetCompEM();
6721 {
6723 }
6724 }
6726 {
6728
6729 }
6730
6731 }
6732 }
6733 }
6734
6737 {
6738 EntityAI parent = GetHierarchyParent();
6739
6740 if (parent)
6741 {
6742 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6743 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6744 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6745 }
6746 }
6747
6750 {
6751 EntityAI parent = GetHierarchyParent();
6752
6753 if (parent)
6754 {
6755 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6756 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6757 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6758 }
6759 }
6760
6762 {
6763
6764
6765
6766
6768
6770 {
6771 if (ScriptInputUserData.CanStoreInputUserData())
6772 {
6773 ScriptInputUserData ctx = new ScriptInputUserData;
6779 ctx.
Write(use_stack_max);
6782
6784 {
6785 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6786 }
6787 }
6788 }
6789 else if (!
g_Game.IsMultiplayer())
6790 {
6792 }
6793 }
6794
6796 {
6798 }
6799
6801 {
6803 }
6804
6806 {
6808 }
6809
6811 {
6812
6813 return false;
6814 }
6815
6817 {
6818 return false;
6819 }
6820
6824 {
6825 return false;
6826 }
6827
6829 {
6830 return "";
6831 }
6832
6834
6836 {
6837 return false;
6838 }
6839
6841 {
6842 return true;
6843 }
6844
6845
6846
6848 {
6849 return true;
6850 }
6851
6853 {
6854 return true;
6855 }
6856
6858 {
6859 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6861 }
6862
6864 {
6866 }
6867
6869 {
6871 if (!is_being_placed)
6873 SetSynchDirty();
6874 }
6875
6876
6878
6880 {
6882 }
6883
6885 {
6887 }
6888
6890 {
6891 return 1;
6892 }
6893
6895 {
6896 return false;
6897 }
6898
6900 {
6902 SetSynchDirty();
6903 }
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6940 {
6941 super.OnMovedInsideCargo(container);
6942
6943 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6944 }
6945
6946 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6947 {
6948 super.EEItemLocationChanged(oldLoc, newLoc);
6949
6950 PlayerBase newPlayer = null;
6951 PlayerBase oldPlayer = null;
6952
6953 if (newLoc.GetParent())
6954 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6955
6956 if (oldLoc.GetParent())
6957 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6958
6960 {
6961 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6962
6963 if (rIndex >= 0)
6964 {
6965 InventoryLocation rIl = new InventoryLocation;
6966 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6967
6968 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6971 {
6972 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6973 }
6975 {
6977 }
6978
6979 }
6980 }
6981
6983 {
6984 if (newPlayer)
6985 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6986
6987 if (newPlayer == oldPlayer)
6988 {
6989 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6990 {
6992 {
6993 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6994 {
6995 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6996 }
6997 }
6998 else
6999 {
7000 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7001 }
7002 }
7003
7004 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7005 {
7006 int type = oldLoc.GetType();
7008 {
7009 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7010 }
7012 {
7013 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7014 }
7015 }
7016 if (!m_OldLocation)
7017 {
7018 m_OldLocation = new InventoryLocation;
7019 }
7020 m_OldLocation.Copy(oldLoc);
7021 }
7022 else
7023 {
7024 if (m_OldLocation)
7025 {
7026 m_OldLocation.Reset();
7027 }
7028 }
7029
7030 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7031 }
7032 else
7033 {
7034 if (newPlayer)
7035 {
7036 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7037 if (resIndex >= 0)
7038 {
7039 InventoryLocation il = new InventoryLocation;
7040 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7042 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7045 {
7046 il.
GetParent().GetOnReleaseLock().Invoke(it);
7047 }
7049 {
7051 }
7052
7053 }
7054 }
7056 {
7057
7059 }
7060
7061 if (m_OldLocation)
7062 {
7063 m_OldLocation.Reset();
7064 }
7065 }
7066
7068 {
7069 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7070 }
7071
7073 {
7074 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7075 }
7076 }
7077
7078 override void EOnContact(IEntity other, Contact extra)
7079 {
7081 {
7082 int liquidType = -1;
7084 if (impactSpeed > 0.0)
7085 {
7087 #ifndef SERVER
7089 #else
7091 SetSynchDirty();
7092 #endif
7094 }
7095 }
7096
7097 #ifdef SERVER
7098 if (GetCompEM() && GetCompEM().IsPlugged())
7099 {
7100 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7101 GetCompEM().UnplugThis();
7102 }
7103 #endif
7104 }
7105
7107
7109 {
7111 }
7112
7114 {
7115
7116 }
7117
7119 {
7120 super.OnItemLocationChanged(old_owner, new_owner);
7121
7122 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7123 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7124
7125 if (!relatedPlayer && playerNew)
7126 relatedPlayer = playerNew;
7127
7128 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7129 {
7131 if (actionMgr)
7132 {
7133 ActionBase currentAction = actionMgr.GetRunningAction();
7134 if (currentAction)
7136 }
7137 }
7138
7139 Man ownerPlayerOld = null;
7140 Man ownerPlayerNew = null;
7141
7142 if (old_owner)
7143 {
7144 if (old_owner.
IsMan())
7145 {
7146 ownerPlayerOld = Man.Cast(old_owner);
7147 }
7148 else
7149 {
7150 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7151 }
7152 }
7153 else
7154 {
7156 {
7158
7159 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7160 {
7161 GetCompEM().UnplugThis();
7162 }
7163 }
7164 }
7165
7166 if (new_owner)
7167 {
7168 if (new_owner.
IsMan())
7169 {
7170 ownerPlayerNew = Man.Cast(new_owner);
7171 }
7172 else
7173 {
7174 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7175 }
7176 }
7177
7178 if (ownerPlayerOld != ownerPlayerNew)
7179 {
7180 if (ownerPlayerOld)
7181 {
7182 array<EntityAI> subItemsExit = new array<EntityAI>;
7184 for (int i = 0; i < subItemsExit.Count(); i++)
7185 {
7188 }
7189 }
7190
7191 if (ownerPlayerNew)
7192 {
7193 array<EntityAI> subItemsEnter = new array<EntityAI>;
7195 for (int j = 0; j < subItemsEnter.Count(); j++)
7196 {
7199 }
7200 }
7201 }
7202 else if (ownerPlayerNew != null)
7203 {
7204 PlayerBase nplayer;
7205 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7206 {
7207 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7209 for (int k = 0; k < subItemsUpdate.Count(); k++)
7210 {
7212 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7213 }
7214 }
7215 }
7216
7217 if (old_owner)
7218 old_owner.OnChildItemRemoved(this);
7219 if (new_owner)
7220 new_owner.OnChildItemReceived(this);
7221 }
7222
7223
7225 {
7226 super.EEDelete(parent);
7227 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7228 if (player)
7229 {
7231
7232 if (player.IsAlive())
7233 {
7234 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7235 if (r_index >= 0)
7236 {
7237 InventoryLocation r_il = new InventoryLocation;
7238 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7239
7240 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7243 {
7244 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7245 }
7247 {
7248 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7249 }
7250
7251 }
7252
7253 player.RemoveQuickBarEntityShortcut(this);
7254 }
7255 }
7256 }
7257
7259 {
7260 super.EEKilled(killer);
7261
7264 {
7265 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7266 {
7267 if (IsMagazine())
7268 {
7269 if (Magazine.Cast(this).GetAmmoCount() > 0)
7270 {
7272 }
7273 }
7274 else
7275 {
7277 }
7278 }
7279 }
7280 }
7281
7283 {
7284 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7285
7286 super.OnWasAttached(parent, slot_id);
7287
7290
7293 }
7294
7296 {
7297 super.OnWasDetached(parent, slot_id);
7298
7301
7304 }
7305
7307 {
7308 int idx;
7311
7312 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7313 if (inventory_slots.Count() < 1)
7314 {
7315 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7316 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7317 }
7318 else
7319 {
7320 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7321 }
7322
7323 idx = inventory_slots.Find(slot);
7324 if (idx < 0)
7325 return "";
7326
7327 return attach_types.Get(idx);
7328 }
7329
7331 {
7332 int idx = -1;
7333 string slot;
7334
7337
7338 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7339 if (inventory_slots.Count() < 1)
7340 {
7341 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7342 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7343 }
7344 else
7345 {
7346 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7347 if (detach_types.Count() < 1)
7348 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7349 }
7350
7351 for (int i = 0; i < inventory_slots.Count(); i++)
7352 {
7353 slot = inventory_slots.Get(i);
7354 }
7355
7356 if (slot != "")
7357 {
7358 if (detach_types.Count() == 1)
7359 idx = 0;
7360 else
7361 idx = inventory_slots.Find(slot);
7362 }
7363 if (idx < 0)
7364 return "";
7365
7366 return detach_types.Get(idx);
7367 }
7368
7370 {
7371
7373
7374
7375 float min_time = 1;
7376 float max_time = 3;
7377 float delay = Math.RandomFloat(min_time, max_time);
7378
7379 explode_timer.Run(delay, this, "DoAmmoExplosion");
7380 }
7381
7383 {
7384 Magazine magazine = Magazine.Cast(this);
7385 int pop_sounds_count = 6;
7386 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7387
7388
7389 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7390 string sound_name = pop_sounds[ sound_idx ];
7391 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7392
7393
7394 magazine.ServerAddAmmoCount(-1);
7395
7396
7397 float min_temp_to_explode = 100;
7398
7399 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7400 {
7402 }
7403 }
7404
7405
7406 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7407 {
7408 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7409
7410 const int CHANCE_DAMAGE_CARGO = 4;
7411 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7412 const int CHANCE_DAMAGE_NOTHING = 2;
7413
7415 {
7416 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7417 int chances;
7418 int rnd;
7419
7420 if (GetInventory().GetCargo())
7421 {
7422 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7423 rnd = Math.RandomInt(0,chances);
7424
7425 if (rnd < CHANCE_DAMAGE_CARGO)
7426 {
7428 }
7429 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7430 {
7432 }
7433 }
7434 else
7435 {
7436 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7437 rnd = Math.RandomInt(0,chances);
7438
7439 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7440 {
7442 }
7443 }
7444 }
7445 }
7446
7448 {
7449 CargoBase cargo = GetInventory().GetCargo();
7450 if (cargo)
7451 {
7453 if (item_count > 0)
7454 {
7455 int random_pick = Math.RandomInt(0, item_count);
7457 if (!item.IsExplosive())
7458 {
7459 item.AddHealth("","",damage);
7460 return true;
7461 }
7462 }
7463 }
7464 return false;
7465 }
7466
7468 {
7469 GameInventory inventory = GetInventory();
7471 if (attachment_count > 0)
7472 {
7473 int random_pick = Math.RandomInt(0, attachment_count);
7475 if (!attachment.IsExplosive())
7476 {
7477 attachment.AddHealth("","",damage);
7478 return true;
7479 }
7480 }
7481 return false;
7482 }
7483
7485 {
7487 }
7488
7490 {
7492 return GetInventory().CanRemoveEntity();
7493
7494 return false;
7495 }
7496
7498 {
7499
7501 return false;
7502
7503
7505 return false;
7506
7507
7508
7510 if (delta == 0)
7511 return false;
7512
7513
7514 return true;
7515 }
7516
7518 {
7520 {
7521 if (ScriptInputUserData.CanStoreInputUserData())
7522 {
7523 ScriptInputUserData ctx = new ScriptInputUserData;
7528 ctx.
Write(destination_entity);
7532 }
7533 }
7534 else if (!
g_Game.IsMultiplayer())
7535 {
7537 }
7538 }
7539
7541 {
7542 float split_quantity_new;
7546 InventoryLocation loc = new InventoryLocation;
7547
7548 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7549 {
7551 split_quantity_new = stack_max;
7552 else
7554
7556 {
7557 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7558 if (new_item)
7559 {
7560 new_item.SetResultOfSplit(true);
7561 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7563 new_item.
SetQuantity(split_quantity_new,
false,
true);
7564 }
7565 }
7566 }
7567 else if (destination_entity && slot_id == -1)
7568 {
7569 if (quantity > stack_max)
7570 split_quantity_new = stack_max;
7571 else
7572 split_quantity_new = quantity;
7573
7575 {
7576 GameInventory destinationInventory = destination_entity.GetInventory();
7578 {
7581 }
7582
7583 if (new_item)
7584 {
7585 new_item.SetResultOfSplit(true);
7586 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7588 new_item.
SetQuantity(split_quantity_new,
false,
true);
7589 }
7590 }
7591 }
7592 else
7593 {
7594 if (stack_max != 0)
7595 {
7597 {
7599 }
7600
7601 if (split_quantity_new == 0)
7602 {
7603 if (!
g_Game.IsMultiplayer())
7604 player.PhysicalPredictiveDropItem(this);
7605 else
7606 player.ServerDropEntity(this);
7607 return;
7608 }
7609
7611 {
7613
7614 if (new_item)
7615 {
7616 new_item.SetResultOfSplit(true);
7617 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7620 new_item.PlaceOnSurface();
7621 }
7622 }
7623 }
7624 }
7625 }
7626
7628 {
7629 float split_quantity_new;
7633 InventoryLocation loc = new InventoryLocation;
7634
7635 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7636 {
7638 split_quantity_new = stack_max;
7639 else
7641
7643 {
7644 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7645 if (new_item)
7646 {
7647 new_item.SetResultOfSplit(true);
7648 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7650 new_item.
SetQuantity(split_quantity_new,
false,
true);
7651 }
7652 }
7653 }
7654 else if (destination_entity && slot_id == -1)
7655 {
7656 if (quantity > stack_max)
7657 split_quantity_new = stack_max;
7658 else
7659 split_quantity_new = quantity;
7660
7662 {
7663 GameInventory destinationInventory = destination_entity.GetInventory();
7665 {
7668 }
7669
7670 if (new_item)
7671 {
7672 new_item.SetResultOfSplit(true);
7673 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7675 new_item.
SetQuantity(split_quantity_new,
false,
true);
7676 }
7677 }
7678 }
7679 else
7680 {
7681 if (stack_max != 0)
7682 {
7684 {
7686 }
7687
7689 {
7691
7692 if (new_item)
7693 {
7694 new_item.SetResultOfSplit(true);
7695 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7698 new_item.PlaceOnSurface();
7699 }
7700 }
7701 }
7702 }
7703 }
7704
7706 {
7708 {
7709 if (ScriptInputUserData.CanStoreInputUserData())
7710 {
7711 ScriptInputUserData ctx = new ScriptInputUserData;
7716 dst.WriteToContext(ctx);
7718 }
7719 }
7720 else if (!
g_Game.IsMultiplayer())
7721 {
7723 }
7724 }
7725
7727 {
7729 {
7730 if (ScriptInputUserData.CanStoreInputUserData())
7731 {
7732 ScriptInputUserData ctx = new ScriptInputUserData;
7737 ctx.
Write(destination_entity);
7743 }
7744 }
7745 else if (!
g_Game.IsMultiplayer())
7746 {
7748 }
7749 }
7750
7752 {
7754 }
7755
7757 {
7759 float split_quantity_new;
7761 if (dst.IsValid())
7762 {
7763 int slot_id = dst.GetSlot();
7765
7766 if (quantity > stack_max)
7767 split_quantity_new = stack_max;
7768 else
7769 split_quantity_new = quantity;
7770
7772 {
7774
7775 if (new_item)
7776 {
7777 new_item.SetResultOfSplit(true);
7778 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7780 new_item.
SetQuantity(split_quantity_new,
false,
true);
7781 }
7782
7783 return new_item;
7784 }
7785 }
7786
7787 return null;
7788 }
7789
7791 {
7793 float split_quantity_new;
7795 if (destination_entity)
7796 {
7798 if (quantity > stackable)
7799 split_quantity_new = stackable;
7800 else
7801 split_quantity_new = quantity;
7802
7804 {
7805 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7806 if (new_item)
7807 {
7808 new_item.SetResultOfSplit(true);
7809 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7811 new_item.
SetQuantity(split_quantity_new,
false,
true);
7812 }
7813 }
7814 }
7815 }
7816
7818 {
7820 {
7821 if (ScriptInputUserData.CanStoreInputUserData())
7822 {
7823 ScriptInputUserData ctx = new ScriptInputUserData;
7828 ItemBase destination_entity =
this;
7829 ctx.
Write(destination_entity);
7833 }
7834 }
7835 else if (!
g_Game.IsMultiplayer())
7836 {
7838 }
7839 }
7840
7842 {
7844 float split_quantity_new;
7846 if (player)
7847 {
7849 if (quantity > stackable)
7850 split_quantity_new = stackable;
7851 else
7852 split_quantity_new = quantity;
7853
7855 {
7856 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7857 new_item =
ItemBase.Cast(in_hands);
7858 if (new_item)
7859 {
7860 new_item.SetResultOfSplit(true);
7861 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7863 new_item.SetQuantity(split_quantity_new, false, true);
7864 }
7865 }
7866 }
7867 }
7868
7870 {
7872 float split_quantity_new = Math.Floor(quantity * 0.5);
7873
7875 return;
7876
7878
7879 if (new_item)
7880 {
7881 if (new_item.GetQuantityMax() < split_quantity_new)
7882 {
7883 split_quantity_new = new_item.GetQuantityMax();
7884 }
7885
7886 new_item.SetResultOfSplit(true);
7887 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7888
7890 {
7893 }
7894 else
7895 {
7897 new_item.
SetQuantity(split_quantity_new,
false,
true);
7898 }
7899 }
7900 }
7901
7903 {
7905 float split_quantity_new = Math.Floor(quantity / 2);
7906
7908 return;
7909
7910 InventoryLocation invloc = new InventoryLocation;
7912
7914 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7915
7916 if (new_item)
7917 {
7918 if (new_item.GetQuantityMax() < split_quantity_new)
7919 {
7920 split_quantity_new = new_item.GetQuantityMax();
7921 }
7923 {
7926 }
7927 else if (split_quantity_new > 1)
7928 {
7930 new_item.
SetQuantity(split_quantity_new,
false,
true);
7931 }
7932 }
7933 }
7934
7937 {
7938 SetWeightDirty();
7940
7941 if (parent)
7942 parent.OnAttachmentQuantityChangedEx(this, delta);
7943
7945 {
7947 {
7949 }
7951 {
7952 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7954 }
7955 }
7956 }
7957
7960 {
7961
7962 }
7963
7966 {
7968 }
7969
7971 {
7972 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7973
7975 {
7976 if (newLevel == GameConstants.STATE_RUINED)
7977 {
7979 EntityAI parent = GetHierarchyParent();
7980 if (parent && parent.IsFireplace())
7981 {
7982 CargoBase cargo = GetInventory().GetCargo();
7983 if (cargo)
7984 {
7986 {
7988 }
7989 }
7990 }
7991 }
7992
7994 {
7995
7997 return;
7998 }
7999
8000 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8001 {
8003 }
8004 }
8005 }
8006
8007
8009 {
8010 super.OnRightClick();
8011
8013 {
8015 {
8016 if (ScriptInputUserData.CanStoreInputUserData())
8017 {
8018 EntityAI root = GetHierarchyRoot();
8019 Man playerOwner = GetHierarchyRootPlayer();
8020 InventoryLocation dst = new InventoryLocation;
8021
8022
8023 if (!playerOwner && root && root == this)
8024 {
8026 }
8027 else
8028 {
8029
8030 GetInventory().GetCurrentInventoryLocation(dst);
8032 {
8033 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8035 {
8037 }
8038 else
8039 {
8041
8042
8043 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8044 {
8046 }
8047 else
8048 {
8049 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8050 }
8051 }
8052 }
8053 }
8054
8055 ScriptInputUserData ctx = new ScriptInputUserData;
8063 }
8064 }
8065 else if (!
g_Game.IsMultiplayer())
8066 {
8068 }
8069 }
8070 }
8071
8073 {
8074 if (root)
8075 {
8076 vector m4[4];
8077 root.GetTransform(m4);
8078 dst.SetGround(this, m4);
8079 }
8080 else
8081 {
8082 GetInventory().GetCurrentInventoryLocation(dst);
8083 }
8084 }
8085
8086 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8087 {
8088
8089 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8090 return false;
8091
8092 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8093 return false;
8094
8095
8097 return false;
8098
8099
8100 Magazine mag = Magazine.Cast(this);
8101 if (mag)
8102 {
8103 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8104 return false;
8105
8106 if (stack_max_limit)
8107 {
8108 Magazine other_mag = Magazine.Cast(other_item);
8109 if (other_item)
8110 {
8111 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8112 return false;
8113 }
8114
8115 }
8116 }
8117 else
8118 {
8119
8121 return false;
8122
8124 return false;
8125 }
8126
8127 PlayerBase player = null;
8128 if (CastTo(player, GetHierarchyRootPlayer()))
8129 {
8130 if (player.GetInventory().HasAttachment(this))
8131 return false;
8132
8133 if (player.IsItemsToDelete())
8134 return false;
8135 }
8136
8137 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8138 return false;
8139
8140 int slotID;
8142 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8143 return false;
8144
8145 return true;
8146 }
8147
8149 {
8151 }
8152
8154 {
8155 return m_IsResultOfSplit;
8156 }
8157
8159 {
8160 m_IsResultOfSplit = value;
8161 }
8162
8164 {
8166 }
8167
8169 {
8170 float other_item_quantity = other_item.GetQuantity();
8171 float this_free_space;
8172
8174
8176
8177 if (other_item_quantity > this_free_space)
8178 {
8179 return this_free_space;
8180 }
8181 else
8182 {
8183 return other_item_quantity;
8184 }
8185 }
8186
8188 {
8190 }
8191
8193 {
8195 return;
8196
8197 if (!IsMagazine() && other_item)
8198 {
8200 if (quantity_used != 0)
8201 {
8202 float hp1 = GetHealth01("","");
8203 float hp2 = other_item.GetHealth01("","");
8204 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8205 hpResult = hpResult / (
GetQuantity() + quantity_used);
8206
8207 hpResult *= GetMaxHealth();
8208 Math.Round(hpResult);
8209 SetHealth("", "Health", hpResult);
8210
8212 other_item.AddQuantity(-quantity_used);
8213 }
8214 }
8216 }
8217
8219 {
8220 #ifdef SERVER
8221 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8222 GetHierarchyParent().IncreaseLifetimeUp();
8223 #endif
8224 };
8225
8227 {
8228 PlayerBase p = PlayerBase.Cast(player);
8229
8230 array<int> recipesIds = p.m_Recipes;
8231 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8232 if (moduleRecipesManager)
8233 {
8234 EntityAI itemInHands = player.GetEntityInHands();
8235 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8236 }
8237
8238 for (int i = 0;i < recipesIds.Count(); i++)
8239 {
8240 int key = recipesIds.Get(i);
8241 string recipeName = moduleRecipesManager.GetRecipeName(key);
8243 }
8244 }
8245
8246
8247 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8248 {
8249 super.GetDebugActions(outputList);
8250
8251
8257
8258
8263
8268
8269
8273
8274
8276 {
8280 }
8281
8284
8285
8289
8291
8292 InventoryLocation loc = new InventoryLocation();
8293 GetInventory().GetCurrentInventoryLocation(loc);
8295 {
8296 if (Gizmo_IsSupported())
8299 }
8300
8302 }
8303
8304
8305
8306
8308 {
8309 super.OnAction(action_id, player, ctx);
8310
8312 {
8313 switch (action_id)
8314 {
8318 return true;
8322 return true;
8323 }
8324 }
8325
8327 {
8328 switch (action_id)
8329 {
8331 Delete();
8332 return true;
8333 }
8334 }
8335
8336 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8337 {
8338 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8339 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8340 PlayerBase p = PlayerBase.Cast(player);
8341 if (
EActions.RECIPES_RANGE_START < 1000)
8342 {
8343 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8344 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8345 }
8346 }
8347 #ifndef SERVER
8348 else if (action_id ==
EActions.WATCH_PLAYER)
8349 {
8350 PluginDeveloper.SetDeveloperItemClientEx(player);
8351 }
8352 #endif
8354 {
8355 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8356 {
8357 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8358 OnDebugButtonPressServer(id + 1);
8359 }
8360
8361 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8362 {
8363 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8365 }
8366
8367 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8368 {
8369 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8371 }
8372
8373 else if (action_id ==
EActions.ADD_QUANTITY)
8374 {
8375 if (IsMagazine())
8376 {
8377 Magazine mag = Magazine.Cast(this);
8378 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8379 }
8380 else
8381 {
8383 }
8384
8385 if (m_EM)
8386 {
8387 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8388 }
8389
8390 }
8391
8392 else if (action_id ==
EActions.REMOVE_QUANTITY)
8393 {
8394 if (IsMagazine())
8395 {
8396 Magazine mag2 = Magazine.Cast(this);
8397 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8398 }
8399 else
8400 {
8402 }
8403 if (m_EM)
8404 {
8405 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8406 }
8407
8408 }
8409
8410 else if (action_id ==
EActions.SET_QUANTITY_0)
8411 {
8413
8414 if (m_EM)
8415 {
8416 m_EM.SetEnergy(0);
8417 }
8418 }
8419
8420 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8421 {
8423
8424 if (m_EM)
8425 {
8426 m_EM.SetEnergy(m_EM.GetEnergyMax());
8427 }
8428 }
8429
8430 else if (action_id ==
EActions.ADD_HEALTH)
8431 {
8432 AddHealth("","",GetMaxHealth("","Health")/5);
8433 }
8434 else if (action_id ==
EActions.REMOVE_HEALTH)
8435 {
8436 AddHealth("","",-GetMaxHealth("","Health")/5);
8437 }
8438 else if (action_id ==
EActions.DESTROY_HEALTH)
8439 {
8440 SetHealth01("","",0);
8441 }
8442 else if (action_id ==
EActions.WATCH_ITEM)
8443 {
8445 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8446 #ifdef DEVELOPER
8447 SetDebugDeveloper_item(this);
8448 #endif
8449 }
8450
8451 else if (action_id ==
EActions.ADD_TEMPERATURE)
8452 {
8453 AddTemperature(20);
8454
8455 }
8456
8457 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8458 {
8459 AddTemperature(-20);
8460
8461 }
8462
8463 else if (action_id ==
EActions.FLIP_FROZEN)
8464 {
8465 SetFrozen(!GetIsFrozen());
8466
8467 }
8468
8469 else if (action_id ==
EActions.ADD_WETNESS)
8470 {
8472
8473 }
8474
8475 else if (action_id ==
EActions.REMOVE_WETNESS)
8476 {
8478
8479 }
8480
8481 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8482 {
8485
8486
8487 }
8488
8489 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8490 {
8493 }
8494
8495 else if (action_id ==
EActions.MAKE_SPECIAL)
8496 {
8497 auto debugParams = DebugSpawnParams.WithPlayer(player);
8498 OnDebugSpawnEx(debugParams);
8499 }
8500
8501 }
8502
8503
8504 return false;
8505 }
8506
8507
8508
8509
8513
8516
8517
8518
8520 {
8521 return false;
8522 }
8523
8524
8526 {
8527 return true;
8528 }
8529
8530
8532 {
8533 return true;
8534 }
8535
8536
8537
8539 {
8540 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8541 return g_Game.ConfigIsExisting(config_path);
8542 }
8543
8546 {
8547 return null;
8548 }
8549
8551 {
8552 return false;
8553 }
8554
8556 {
8557 return false;
8558 }
8559
8563
8564
8566 {
8567 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8568 return module_repairing.CanRepair(this, item_repair_kit);
8569 }
8570
8571
8572 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8573 {
8574 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8575 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8576 }
8577
8578
8580 {
8581
8582
8583
8584
8585
8586
8587
8588
8589 return 1;
8590 }
8591
8592
8593
8595 {
8597 }
8598
8599
8600
8602 {
8604 }
8605
8606
8615 {
8616 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8617
8618 if (player)
8619 {
8620 player.MessageStatus(text);
8621 }
8622 }
8623
8624
8633 {
8634 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8635
8636 if (player)
8637 {
8638 player.MessageAction(text);
8639 }
8640 }
8641
8642
8651 {
8652 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8653
8654 if (player)
8655 {
8656 player.MessageFriendly(text);
8657 }
8658 }
8659
8660
8669 {
8670 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8671
8672 if (player)
8673 {
8674 player.MessageImportant(text);
8675 }
8676 }
8677
8679 {
8680 return true;
8681 }
8682
8683
8684 override bool KindOf(
string tag)
8685 {
8686 bool found = false;
8687 string item_name = this.
GetType();
8689 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8690
8691 int array_size = item_tag_array.Count();
8692 for (int i = 0; i < array_size; i++)
8693 {
8694 if (item_tag_array.Get(i) == tag)
8695 {
8696 found = true;
8697 break;
8698 }
8699 }
8700 return found;
8701 }
8702
8703
8705 {
8706
8707 super.OnRPC(sender, rpc_type,ctx);
8708
8709
8710 switch (rpc_type)
8711 {
8712 #ifndef SERVER
8713 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8714 Param2<bool, string> p = new Param2<bool, string>(false, "");
8715
8717 return;
8718
8719 bool play = p.param1;
8720 string soundSet = p.param2;
8721
8722 if (play)
8723 {
8725 {
8727 {
8729 }
8730 }
8731 else
8732 {
8734 }
8735 }
8736 else
8737 {
8739 }
8740
8741 break;
8742 #endif
8743
8744 }
8745
8747 {
8749 }
8750 }
8751
8752
8753
8754
8756 {
8757 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8758 return plugin.GetID(
name);
8759 }
8760
8762 {
8763 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8764 return plugin.GetName(id);
8765 }
8766
8769 {
8770
8771
8772 int varFlags;
8773 if (!ctx.
Read(varFlags))
8774 return;
8775
8776 if (varFlags & ItemVariableFlags.FLOAT)
8777 {
8779 }
8780 }
8781
8783 {
8784
8785 super.SerializeNumericalVars(floats_out);
8786
8787
8788
8790 {
8792 }
8793
8795 {
8797 }
8798
8800 {
8802 }
8803
8805 {
8810 }
8811
8813 {
8815 }
8816 }
8817
8819 {
8820
8821 super.DeSerializeNumericalVars(floats);
8822
8823
8824 int index = 0;
8825 int mask = Math.Round(floats.Get(index));
8826
8827 index++;
8828
8830 {
8832 {
8834 }
8835 else
8836 {
8837 float quantity = floats.Get(index);
8839 }
8840 index++;
8841 }
8842
8844 {
8845 float wet = floats.Get(index);
8847 index++;
8848 }
8849
8851 {
8852 int liquidtype = Math.Round(floats.Get(index));
8854 index++;
8855 }
8856
8858 {
8860 index++;
8862 index++;
8864 index++;
8866 index++;
8867 }
8868
8870 {
8871 int cleanness = Math.Round(floats.Get(index));
8873 index++;
8874 }
8875 }
8876
8878 {
8879 super.WriteVarsToCTX(ctx);
8880
8881
8883 {
8885 }
8886
8888 {
8890 }
8891
8893 {
8895 }
8896
8898 {
8899 int r,g,b,a;
8905 }
8906
8908 {
8910 }
8911 }
8912
8914 {
8915 if (!super.ReadVarsFromCTX(ctx,version))
8916 return false;
8917
8918 int intValue;
8919 float value;
8920
8921 if (version < 140)
8922 {
8923 if (!ctx.
Read(intValue))
8924 return false;
8925
8926 m_VariablesMask = intValue;
8927 }
8928
8930 {
8931 if (!ctx.
Read(value))
8932 return false;
8933
8935 {
8937 }
8938 else
8939 {
8941 }
8942 }
8943
8944 if (version < 140)
8945 {
8947 {
8948 if (!ctx.
Read(value))
8949 return false;
8950 SetTemperatureDirect(value);
8951 }
8952 }
8953
8955 {
8956 if (!ctx.
Read(value))
8957 return false;
8959 }
8960
8962 {
8963 if (!ctx.
Read(intValue))
8964 return false;
8966 }
8967
8969 {
8970 int r,g,b,a;
8972 return false;
8974 return false;
8976 return false;
8978 return false;
8979
8981 }
8982
8984 {
8985 if (!ctx.
Read(intValue))
8986 return false;
8988 }
8989
8990 if (version >= 138 && version < 140)
8991 {
8993 {
8994 if (!ctx.
Read(intValue))
8995 return false;
8996 SetFrozen(intValue);
8997 }
8998 }
8999
9000 return true;
9001 }
9002
9003
9005 {
9008 {
9010 }
9011
9012 if (!super.OnStoreLoad(ctx, version))
9013 {
9015 return false;
9016 }
9017
9018 if (version >= 114)
9019 {
9020 bool hasQuickBarIndexSaved;
9021
9022 if (!ctx.
Read(hasQuickBarIndexSaved))
9023 {
9025 return false;
9026 }
9027
9028 if (hasQuickBarIndexSaved)
9029 {
9030 int itmQBIndex;
9031
9032
9033 if (!ctx.
Read(itmQBIndex))
9034 {
9036 return false;
9037 }
9038
9039 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9040 if (itmQBIndex != -1 && parentPlayer)
9041 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9042 }
9043 }
9044 else
9045 {
9046
9047 PlayerBase player;
9048 int itemQBIndex;
9049 if (version ==
int.
MAX)
9050 {
9051 if (!ctx.
Read(itemQBIndex))
9052 {
9054 return false;
9055 }
9056 }
9057 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9058 {
9059
9060 if (!ctx.
Read(itemQBIndex))
9061 {
9063 return false;
9064 }
9065 if (itemQBIndex != -1 && player)
9066 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9067 }
9068 }
9069
9070 if (version < 140)
9071 {
9072
9073 if (!LoadVariables(ctx, version))
9074 {
9076 return false;
9077 }
9078 }
9079
9080
9082 {
9084 return false;
9085 }
9086 if (version >= 132)
9087 {
9089 if (raib)
9090 {
9092 {
9094 return false;
9095 }
9096 }
9097 }
9098
9100 return true;
9101 }
9102
9103
9104
9106 {
9107 super.OnStoreSave(ctx);
9108
9109 PlayerBase player;
9110 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9111 {
9113
9114 int itemQBIndex = -1;
9115 itemQBIndex = player.FindQuickBarEntityIndex(this);
9116 ctx.
Write(itemQBIndex);
9117 }
9118 else
9119 {
9121 }
9122
9124
9126 if (raib)
9127 {
9129 }
9130 }
9131
9132
9134 {
9135 super.AfterStoreLoad();
9136
9138 {
9140 }
9141
9143 {
9146 }
9147 }
9148
9150 {
9151 super.EEOnAfterLoad();
9152
9154 {
9156 }
9157
9160 }
9161
9163 {
9164 return false;
9165 }
9166
9167
9168
9170 {
9172 {
9173 #ifdef PLATFORM_CONSOLE
9174
9176 {
9178 if (menu)
9179 {
9181 }
9182 }
9183 #endif
9184 }
9185
9187 {
9190 }
9191
9193 {
9194 SetWeightDirty();
9196 }
9198 {
9201 }
9202
9204 {
9207
9210 }
9212 {
9216 }
9217
9218 super.OnVariablesSynchronized();
9219 }
9220
9221
9222
9224 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9225 {
9226 if (!IsServerCheck(allow_client))
9227 return false;
9228
9230 return false;
9231
9234
9235 if (value <= (min + 0.001))
9236 value = min;
9237
9238 if (value == min)
9239 {
9240 if (destroy_config)
9241 {
9242 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9243 if (dstr)
9244 {
9246 this.Delete();
9247 return true;
9248 }
9249 }
9250 else if (destroy_forced)
9251 {
9253 this.Delete();
9254 return true;
9255 }
9256
9258 }
9259
9262
9264 {
9265 EntityAI parent = GetHierarchyRoot();
9266 InventoryLocation iLoc = new InventoryLocation();
9267 GetInventory().GetCurrentInventoryLocation(iLoc);
9269 {
9270 int iLocSlot = iLoc.
GetSlot();
9272 {
9274 }
9276 {
9278 }
9279 }
9280 }
9281
9283 {
9285
9286 if (delta)
9288 }
9289
9291
9292 return false;
9293 }
9294
9295
9297 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9298 {
9300 }
9301
9303 {
9306 }
9307
9309 {
9312 }
9313
9315 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9316 {
9317 float value_clamped = Math.Clamp(value, 0, 1);
9319 SetQuantity(result, destroy_config, destroy_forced);
9320 }
9321
9322
9325 {
9327 }
9328
9330 {
9332 }
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9344 {
9345 int slot = -1;
9346 GameInventory inventory = GetInventory();
9347 if (inventory)
9348 {
9349 InventoryLocation il = new InventoryLocation;
9352 }
9353
9355 }
9356
9358 {
9359 float quantity_max = 0;
9360
9362 {
9363 if (attSlotID != -1)
9364 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9365
9366 if (quantity_max <= 0)
9368 }
9369
9370 if (quantity_max <= 0)
9372
9373 return quantity_max;
9374 }
9375
9377 {
9379 }
9380
9382 {
9384 }
9385
9386
9388 {
9390 }
9391
9393 {
9395 }
9396
9398 {
9400 }
9401
9402
9404 {
9405
9406 float weightEx = GetWeightEx();
9407 float special = GetInventoryAndCargoWeight();
9408 return weightEx - special;
9409 }
9410
9411
9413 {
9415 }
9416
9418 {
9420 {
9421 #ifdef DEVELOPER
9422 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9423 {
9424 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9426 }
9427 #endif
9428
9430 }
9431 else if (HasEnergyManager())
9432 {
9433 #ifdef DEVELOPER
9434 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9435 {
9436 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9437 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9438 }
9439 #endif
9440 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9441 }
9442 else
9443 {
9444 #ifdef DEVELOPER
9445 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9446 {
9447 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9448 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9449 }
9450 #endif
9451 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9452 }
9453 }
9454
9457 {
9458 int item_count = 0;
9460
9461 GameInventory inventory = GetInventory();
9462 CargoBase cargo = inventory.
GetCargo();
9463 if (cargo != NULL)
9464 {
9466 }
9467
9469 for (int i = 0; i < nAttachments; ++i)
9470 {
9472 if (item)
9473 item_count += item.GetNumberOfItems();
9474 }
9475 return item_count;
9476 }
9477
9480 {
9481 float weight = 0;
9482 float wetness = 1;
9483 if (include_wetness)
9486 {
9487 weight = wetness * m_ConfigWeight;
9488 }
9490 {
9491 weight = 1;
9492 }
9493 return weight;
9494 }
9495
9496
9497
9499 {
9500 GameInventory inventory = GetInventory();
9501 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9502 {
9503 array<EntityAI> items = new array<EntityAI>;
9505 for (int i = 0; i < items.Count(); ++i)
9506 {
9508 if (item)
9509 {
9510 g_Game.ObjectDelete(item);
9511 }
9512 }
9513 }
9514 }
9515
9516
9517
9518
9520 {
9521 float energy = 0;
9522 if (HasEnergyManager())
9523 {
9524 energy = GetCompEM().GetEnergy();
9525 }
9526 return energy;
9527 }
9528
9529
9531 {
9532 super.OnEnergyConsumed();
9533
9535 }
9536
9538 {
9539 super.OnEnergyAdded();
9540
9542 }
9543
9544
9546 {
9547 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9548 {
9550 {
9551 float energy_0to1 = GetCompEM().GetEnergy0To1();
9553 }
9554 }
9555 }
9556
9557
9559 {
9560 return ConfigGetFloat("heatIsolation");
9561 }
9562
9564 {
9566 }
9567
9569 {
9570 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9571 if (
g_Game.ConfigIsExisting(paramPath))
9572 return g_Game.ConfigGetFloat(paramPath);
9573
9574 return 0.0;
9575 }
9576
9578 {
9579 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9580 if (
g_Game.ConfigIsExisting(paramPath))
9581 return g_Game.ConfigGetFloat(paramPath);
9582
9583 return 0.0;
9584 }
9585
9586 override void SetWet(
float value,
bool allow_client =
false)
9587 {
9588 if (!IsServerCheck(allow_client))
9589 return;
9590
9593
9595
9596 m_VarWet = Math.Clamp(value, min, max);
9597
9599 {
9602 }
9603 }
9604
9605 override void AddWet(
float value)
9606 {
9608 }
9609
9611 {
9613 }
9614
9616 {
9618 }
9619
9621 {
9623 }
9624
9626 {
9628 }
9629
9631 {
9633 }
9634
9636 {
9639 if (newLevel != oldLevel)
9640 {
9642 }
9643 }
9644
9646 {
9647 SetWeightDirty();
9648 }
9649
9651 {
9652 return GetWetLevelInternal(
m_VarWet);
9653 }
9654
9655
9656
9658 {
9660 }
9661
9663 {
9665 }
9666
9668 {
9670 }
9671
9673 {
9675 }
9676
9677
9678
9680 {
9681 if (ConfigIsExisting("itemModelLength"))
9682 {
9683 return ConfigGetFloat("itemModelLength");
9684 }
9685 return 0;
9686 }
9687
9689 {
9690 if (ConfigIsExisting("itemAttachOffset"))
9691 {
9692 return ConfigGetFloat("itemAttachOffset");
9693 }
9694 return 0;
9695 }
9696
9697 override void SetCleanness(
int value,
bool allow_client =
false)
9698 {
9699 if (!IsServerCheck(allow_client))
9700 return;
9701
9703
9705
9708 }
9709
9711 {
9713 }
9714
9716 {
9717 return true;
9718 }
9719
9720
9721
9722
9724 {
9726 }
9727
9729 {
9731 }
9732
9733
9734
9735
9736 override void SetColor(
int r,
int g,
int b,
int a)
9737 {
9743 }
9745 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9746 {
9751 }
9752
9754 {
9756 }
9757
9760 {
9761 int r,g,b,a;
9763 r = r/255;
9764 g = g/255;
9765 b = b/255;
9766 a = a/255;
9767 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9768 }
9769
9770
9771
9772 override void SetLiquidType(
int value,
bool allow_client =
false)
9773 {
9774 if (!IsServerCheck(allow_client))
9775 return;
9776
9781 }
9782
9784 {
9785 return ConfigGetInt("varLiquidTypeInit");
9786 }
9787
9789 {
9791 }
9792
9794 {
9796 SetFrozen(false);
9797 }
9798
9801 {
9802 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9803 }
9804
9805
9808 {
9809 PlayerBase nplayer;
9810 if (PlayerBase.CastTo(nplayer, player))
9811 {
9813 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9814 }
9815 }
9816
9817
9820 {
9821 PlayerBase nplayer;
9822 if (PlayerBase.CastTo(nplayer,player))
9823 {
9824 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9825 }
9826
9827 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9828
9829 if (HasEnergyManager())
9830 {
9831 GetCompEM().UpdatePlugState();
9832 }
9833 }
9834
9835
9837 {
9838 super.OnPlacementStarted(player);
9839
9841 }
9842
9843 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9844 {
9846 {
9847 m_AdminLog.OnPlacementComplete(player,
this);
9848 }
9849
9850 super.OnPlacementComplete(player, position, orientation);
9851 }
9852
9853
9854
9855
9856
9858 {
9860 {
9861 return true;
9862 }
9863 else
9864 {
9865 return false;
9866 }
9867 }
9868
9869
9871 {
9873 {
9875 }
9876 }
9877
9878
9880 {
9882 }
9883
9885 {
9887 }
9888
9889 override void InsertAgent(
int agent,
float count = 1)
9890 {
9891 if (count < 1)
9892 return;
9893
9895 }
9896
9899 {
9901 }
9902
9903
9905 {
9907 }
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9951 {
9953 return false;
9954 return true;
9955 }
9956
9958 {
9959
9961 }
9962
9963
9966 {
9967 super.CheckForRoofLimited(timeTresholdMS);
9968
9969 float time =
g_Game.GetTime();
9970 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9971 {
9972 m_PreviousRoofTestTime = time;
9973 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9974 }
9975 }
9976
9977
9979 {
9981 {
9982 return 0;
9983 }
9984
9985 if (GetInventory().GetAttachmentSlotsCount() != 0)
9986 {
9987 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9988 if (filter)
9989 return filter.GetProtectionLevel(type, false, system);
9990 else
9991 return 0;
9992 }
9993
9994 string subclassPath, entryName;
9995
9996 switch (type)
9997 {
9999 entryName = "biological";
10000 break;
10002 entryName = "chemical";
10003 break;
10004 default:
10005 entryName = "biological";
10006 break;
10007 }
10008
10009 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10010
10011 return g_Game.ConfigGetFloat(subclassPath + entryName);
10012 }
10013
10014
10015
10018 {
10019 if (!IsMagazine())
10021
10023 }
10024
10025
10026
10027
10028
10033 {
10034 return true;
10035 }
10036
10038 {
10040 }
10041
10042
10043
10044
10045
10047 {
10048 if (parent)
10049 {
10050 if (parent.IsInherited(DayZInfected))
10051 return true;
10052
10053 if (!parent.IsRuined())
10054 return true;
10055 }
10056
10057 return true;
10058 }
10059
10061 {
10062 if (!super.CanPutAsAttachment(parent))
10063 {
10064 return false;
10065 }
10066
10067 if (!IsRuined() && !parent.IsRuined())
10068 {
10069 return true;
10070 }
10071
10072 return false;
10073 }
10074
10076 {
10077
10078
10079
10080
10081 return super.CanReceiveItemIntoCargo(item);
10082 }
10083
10085 {
10086
10087
10088
10089
10090 GameInventory attachmentInv = attachment.GetInventory();
10092 {
10093 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10094 return false;
10095 }
10096
10097 InventoryLocation loc = new InventoryLocation();
10098 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10099 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10100 return false;
10101
10102 return super.CanReceiveAttachment(attachment, slotId);
10103 }
10104
10106 {
10107 if (!super.CanReleaseAttachment(attachment))
10108 return false;
10109
10110 return GetInventory().AreChildrenAccessible();
10111 }
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10134 {
10135 int id = muzzle_owner.GetMuzzleID();
10136 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10137
10138 if (WPOF_array)
10139 {
10140 for (int i = 0; i < WPOF_array.Count(); i++)
10141 {
10142 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10143
10144 if (WPOF)
10145 {
10146 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10147 }
10148 }
10149 }
10150 }
10151
10152
10154 {
10155 int id = muzzle_owner.GetMuzzleID();
10157
10158 if (WPOBE_array)
10159 {
10160 for (int i = 0; i < WPOBE_array.Count(); i++)
10161 {
10162 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10163
10164 if (WPOBE)
10165 {
10166 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10167 }
10168 }
10169 }
10170 }
10171
10172
10174 {
10175 int id = muzzle_owner.GetMuzzleID();
10176 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10177
10178 if (WPOOH_array)
10179 {
10180 for (int i = 0; i < WPOOH_array.Count(); i++)
10181 {
10182 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10183
10184 if (WPOOH)
10185 {
10186 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10187 }
10188 }
10189 }
10190 }
10191
10192
10194 {
10195 int id = muzzle_owner.GetMuzzleID();
10196 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10197
10198 if (WPOOH_array)
10199 {
10200 for (int i = 0; i < WPOOH_array.Count(); i++)
10201 {
10202 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10203
10204 if (WPOOH)
10205 {
10206 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10207 }
10208 }
10209 }
10210 }
10211
10212
10214 {
10215 int id = muzzle_owner.GetMuzzleID();
10216 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10217
10218 if (WPOOH_array)
10219 {
10220 for (int i = 0; i < WPOOH_array.Count(); i++)
10221 {
10222 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10223
10224 if (WPOOH)
10225 {
10226 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10227 }
10228 }
10229 }
10230 }
10231
10232
10233
10235 {
10237 {
10238 return true;
10239 }
10240
10241 return false;
10242 }
10243
10245 {
10247 {
10248 return true;
10249 }
10250
10251 return false;
10252 }
10253
10255 {
10257 {
10258 return true;
10259 }
10260
10261 return false;
10262 }
10263
10265 {
10266 return false;
10267 }
10268
10271 {
10272 return UATimeSpent.DEFAULT_DEPLOY;
10273 }
10274
10275
10276
10277
10279 {
10281 SetSynchDirty();
10282 }
10283
10285 {
10287 }
10288
10289
10291 {
10292 return false;
10293 }
10294
10297 {
10298 string att_type = "None";
10299
10300 if (ConfigIsExisting("soundAttType"))
10301 {
10302 att_type = ConfigGetString("soundAttType");
10303 }
10304
10306 }
10307
10309 {
10311 }
10312
10313
10314
10315
10316
10322
10324 {
10327
10329 }
10330
10331
10333 {
10335 return;
10336
10338
10341
10344
10345 SoundParameters params = new SoundParameters();
10349 }
10350
10351
10353 {
10355 {
10358
10359 SetSynchDirty();
10360
10363 }
10364 }
10365
10367 {
10369 }
10370
10371
10373 {
10375 return;
10376
10378 SetSynchDirty();
10379
10382 }
10383
10385 {
10388 }
10389
10391 {
10393 }
10394
10395 void OnApply(PlayerBase player);
10396
10398 {
10399 return 1.0;
10400 };
10401
10403 {
10405 }
10406
10408 {
10410 }
10411
10413
10415 {
10416 SetDynamicPhysicsLifeTime(0.01);
10418 }
10419
10421 {
10422 array<string> zone_names = new array<string>;
10423 GetDamageZones(zone_names);
10424 for (int i = 0; i < zone_names.Count(); i++)
10425 {
10426 SetHealthMax(zone_names.Get(i),"Health");
10427 }
10428 SetHealthMax("","Health");
10429 }
10430
10433 {
10434 float global_health = GetHealth01("","Health");
10435 array<string> zones = new array<string>;
10436 GetDamageZones(zones);
10437
10438 for (int i = 0; i < zones.Count(); i++)
10439 {
10440 SetHealth01(zones.Get(i),"Health",global_health);
10441 }
10442 }
10443
10446 {
10447 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10448 }
10449
10451 {
10452 if (!hasRootAsPlayer)
10453 {
10454 if (refParentIB)
10455 {
10456
10457 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10458 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10459
10460 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10461 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10462
10465 }
10466 else
10467 {
10468
10471 }
10472 }
10473 }
10474
10476 {
10478 {
10479 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10480 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10481 {
10482 float heatPermCoef = 1.0;
10484 while (ent)
10485 {
10486 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10487 ent = ent.GetHierarchyParent();
10488 }
10489
10490 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10491 }
10492 }
10493 }
10494
10496 {
10497
10498 EntityAI parent = GetHierarchyParent();
10499 if (!parent)
10500 {
10501 hasParent = false;
10502 hasRootAsPlayer = false;
10503 }
10504 else
10505 {
10506 hasParent = true;
10507 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10508 refParentIB =
ItemBase.Cast(parent);
10509 }
10510 }
10511
10512 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10513 {
10514
10515 }
10516
10518 {
10519
10520 return false;
10521 }
10522
10524 {
10525
10526
10527 return false;
10528 }
10529
10531 {
10532
10533 return false;
10534 }
10535
10538 {
10539 return !GetIsFrozen() &&
IsOpen();
10540 }
10541
10543 {
10544 bool hasParent = false, hasRootAsPlayer = false;
10546
10547 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10548 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10549
10550 if (wwtu || foodDecay)
10551 {
10555
10556 if (processWetness || processTemperature || processDecay)
10557 {
10559
10560 if (processWetness)
10561 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10562
10563 if (processTemperature)
10565
10566 if (processDecay)
10567 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10568 }
10569 }
10570 }
10571
10574 {
10576 }
10577
10579 {
10582
10583 return super.GetTemperatureFreezeThreshold();
10584 }
10585
10587 {
10590
10591 return super.GetTemperatureThawThreshold();
10592 }
10593
10595 {
10598
10599 return super.GetItemOverheatThreshold();
10600 }
10601
10603 {
10605 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10606
10607 return super.GetTemperatureFreezeTime();
10608 }
10609
10611 {
10613 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10614
10615 return super.GetTemperatureThawTime();
10616 }
10617
10622
10624 {
10625 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10626 }
10627
10629 {
10630 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10631 }
10632
10635 {
10637 }
10638
10640 {
10642 }
10643
10645 {
10647 }
10648
10651 {
10652 return null;
10653 }
10654
10657 {
10658 return false;
10659 }
10660
10662 {
10664 {
10667 if (!trg)
10668 {
10670 explosive = this;
10671 }
10672
10673 explosive.PairRemote(trg);
10675
10676 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10677 trg.SetPersistentPairID(persistentID);
10678 explosive.SetPersistentPairID(persistentID);
10679
10680 return true;
10681 }
10682 return false;
10683 }
10684
10687 {
10688 float ret = 1.0;
10691 ret *= GetHealth01();
10692
10693 return ret;
10694 }
10695
10696 #ifdef DEVELOPER
10697 override void SetDebugItem()
10698 {
10699 super.SetDebugItem();
10700 _itemBase = this;
10701 }
10702
10704 {
10705 string text = super.GetDebugText();
10706
10708 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10709
10710 return text;
10711 }
10712 #endif
10713
10715 {
10716 return true;
10717 }
10718
10720
10722
10724 {
10727 }
10728
10729
10737
10753
10754 [
Obsolete(
"Use ItemSoundHandler instead")]
10757 {
10758 if (!
g_Game.IsDedicatedServer())
10759 {
10760 if (ConfigIsExisting("attachSoundSet"))
10761 {
10762 string cfg_path = "";
10763 string soundset = "";
10764 string type_name =
GetType();
10765
10768 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10769 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10770
10771 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10772 {
10773 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10774 {
10775 if (cfg_slot_array[i] == slot_type)
10776 {
10777 soundset = cfg_soundset_array[i];
10778 break;
10779 }
10780 }
10781 }
10782
10783 if (soundset != "")
10784 {
10785 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10787 }
10788 }
10789 }
10790 }
10791
10793}
10794
10796{
10798 if (entity)
10799 {
10800 bool is_item = entity.IsInherited(
ItemBase);
10801 if (is_item && full_quantity)
10802 {
10805 }
10806 }
10807 else
10808 {
10810 return NULL;
10811 }
10812 return entity;
10813}
10814
10816{
10817 if (item)
10818 {
10819 if (health > 0)
10820 item.SetHealth("", "", health);
10821
10822 if (item.CanHaveTemperature())
10823 {
10825 if (item.CanFreeze())
10826 item.SetFrozen(false);
10827 }
10828
10829 if (item.HasEnergyManager())
10830 {
10831 if (quantity >= 0)
10832 {
10833 item.GetCompEM().SetEnergy0To1(quantity);
10834 }
10835 else
10836 {
10838 }
10839 }
10840 else if (item.IsMagazine())
10841 {
10842 Magazine mag = Magazine.Cast(item);
10843 if (quantity >= 0)
10844 {
10845 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10846 }
10847 else
10848 {
10850 }
10851
10852 }
10853 else
10854 {
10855 if (quantity >= 0)
10856 {
10857 item.SetQuantityNormalized(quantity, false);
10858 }
10859 else
10860 {
10862 }
10863
10864 }
10865 }
10866}
10867
10868#ifdef DEVELOPER
10870#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.