5868{
5870 {
5871 return true;
5872 }
5873};
5874
5876{
5877
5878};
5879
5880
5881
5883{
5887
5889
5892
5893
5894
5895
5896
5905
5911
5916
5921
5942 protected bool m_IsResultOfSplit
5943
5945
5950
5951
5952
5954
5958
5959
5960
5962
5965
5966
5967
5973
5974
5982
5985
5986
5988
5989
5991
5992
5997
5998
6003
6005
6006
6008
6009
6011 {
6016
6017 if (!
g_Game.IsDedicatedServer())
6018 {
6020 {
6022
6024 {
6026 }
6027 }
6028
6031 }
6032
6033 m_OldLocation = null;
6034
6036 {
6038 }
6039
6040 if (ConfigIsExisting("headSelectionsToHide"))
6041 {
6044 }
6045
6047 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6048 {
6050 }
6051
6053
6054 m_IsResultOfSplit = false;
6055
6057 }
6058
6060 {
6061 super.InitItemVariables();
6062
6068 m_Count = ConfigGetInt(
"count");
6069
6072
6077
6080
6085
6097
6101
6102
6105 if (ConfigIsExisting("canBeSplit"))
6106 {
6109 }
6110
6112 if (ConfigIsExisting("itemBehaviour"))
6114
6115
6118 RegisterNetSyncVariableInt("m_VarLiquidType");
6119 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6120
6121 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6122 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6123 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6124
6125 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6126 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6127 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6128 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6129
6130 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6131 RegisterNetSyncVariableBool("m_IsTakeable");
6132 RegisterNetSyncVariableBool("m_IsHologram");
6133
6136 {
6139 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6140 }
6141
6143
6145 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6147
6149 }
6150
6152 {
6154 }
6155
6157 {
6160 {
6165 }
6166 }
6167
6168 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6169 {
6171 {
6174 }
6175
6177 }
6178
6180 {
6186 }
6187
6189
6191 {
6193
6194 if (!action)
6195 {
6196 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6197 return;
6198 }
6199
6201 if (!ai)
6202 {
6204 return;
6205 }
6206
6208 if (!action_array)
6209 {
6210 action_array = new array<ActionBase_Basic>;
6212 }
6213 if (LogManager.IsActionLogEnable())
6214 {
6215 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6216 }
6217
6218 if (action_array.Find(action) != -1)
6219 {
6220 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6221 }
6222 else
6223 {
6224 action_array.Insert(action);
6225 }
6226 }
6227
6229 {
6230 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6231 ActionBase action = player.GetActionManager().GetAction(actionName);
6234
6235 if (action_array)
6236 {
6237 action_array.RemoveItem(action);
6238 }
6239 }
6240
6241
6242
6244 {
6245 ActionOverrideData overrideData = new ActionOverrideData();
6249
6251 if (!actionMap)
6252 {
6255 }
6256
6257 actionMap.Insert(this.
Type(), overrideData);
6258
6259 }
6260
6262
6264
6265
6267 {
6270
6273
6274 string config_to_search = "CfgVehicles";
6275 string muzzle_owner_config;
6276
6278 {
6279 if (IsInherited(Weapon))
6280 config_to_search = "CfgWeapons";
6281
6282 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6283
6284 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6285
6286 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6287
6288 if (config_OnFire_subclass_count > 0)
6289 {
6290 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6291
6292 for (int i = 0; i < config_OnFire_subclass_count; i++)
6293 {
6294 string particle_class = "";
6295 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6296 string config_OnFire_entry = config_OnFire_class + particle_class;
6297 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6298 WPOF_array.Insert(WPOF);
6299 }
6300
6301
6303 }
6304 }
6305
6307 {
6308 config_to_search = "CfgWeapons";
6309 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6310
6311 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6312
6313 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6314
6315 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6316 {
6317 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6318
6319 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6320 {
6321 string particle_class2 = "";
6322 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6323 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6324 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6325 WPOBE_array.Insert(WPOBE);
6326 }
6327
6328
6330 }
6331 }
6332 }
6333
6334
6336 {
6339
6341 {
6342 string config_to_search = "CfgVehicles";
6343
6344 if (IsInherited(Weapon))
6345 config_to_search = "CfgWeapons";
6346
6347 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6348 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6349
6350 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6351 {
6352
6354
6356 {
6358 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6360 return;
6361 }
6362
6365
6366
6367
6368 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6369 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6370
6371 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6372 {
6373 string particle_class = "";
6374 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6375 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6376 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6377
6378 if (entry_type == CT_CLASS)
6379 {
6380 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6381 WPOOH_array.Insert(WPOF);
6382 }
6383 }
6384
6385
6387 }
6388 }
6389 }
6390
6392 {
6394 }
6395
6397 {
6399 {
6401
6404
6407
6408 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6409 }
6410 }
6411
6413 {
6415 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6416
6418 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6419
6421 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6422
6424 {
6426 }
6427 }
6428
6430 {
6432 }
6433
6435 {
6438 else
6440
6442 {
6445 }
6446 else
6447 {
6450
6453 }
6454
6456 }
6457
6459 {
6461 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6462 }
6463
6465 {
6467 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6469 }
6470
6472 {
6474 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6475 }
6476
6478 {
6481
6482 OverheatingParticle OP = new OverheatingParticle();
6487
6489 }
6490
6492 {
6495
6496 return -1;
6497 }
6498
6500 {
6502 {
6505
6506 for (int i = count; i > 0; --i)
6507 {
6508 int id = i - 1;
6511
6514
6515 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6516 {
6517 if (p)
6518 {
6521 }
6522 }
6523 }
6524 }
6525 }
6526
6528 {
6530 {
6532 {
6533 int id = i - 1;
6535
6536 if (OP)
6537 {
6539
6540 if (p)
6541 {
6543 }
6544
6545 delete OP;
6546 }
6547 }
6548
6551 }
6552 }
6553
6556 {
6557 return 0.0;
6558 }
6559
6560
6562 {
6563 return 250;
6564 }
6565
6567 {
6568 return 0;
6569 }
6570
6573 {
6575 return true;
6576
6577 return false;
6578 }
6579
6582 {
6585
6587 {
6589 }
6590 else
6591 {
6592
6594 }
6595
6597 }
6598
6605 {
6606 return -1;
6607 }
6608
6609
6610
6611
6613 {
6615 {
6616 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6617 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6618
6619 if (r_index >= 0)
6620 {
6621 InventoryLocation r_il = new InventoryLocation;
6622 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6623
6624 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6627 {
6628 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6629 }
6631 {
6632 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6633 }
6634
6635 }
6636
6637 player.GetHumanInventory().ClearUserReservedLocation(this);
6638 }
6639
6642 }
6643
6644
6645
6646
6648 {
6649 return ItemBase.m_DebugActionsMask;
6650 }
6651
6653 {
6654 return ItemBase.m_DebugActionsMask & mask;
6655 }
6656
6658 {
6659 ItemBase.m_DebugActionsMask = mask;
6660 }
6661
6663 {
6664 ItemBase.m_DebugActionsMask |= mask;
6665 }
6666
6668 {
6669 ItemBase.m_DebugActionsMask &= ~mask;
6670 }
6671
6673 {
6675 {
6677 }
6678 else
6679 {
6681 }
6682 }
6683
6684
6686 {
6687 if (GetEconomyProfile())
6688 {
6689 float q_max = GetEconomyProfile().GetQuantityMax();
6690 if (q_max > 0)
6691 {
6692 float q_min = GetEconomyProfile().GetQuantityMin();
6693 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6694
6696 {
6697 ComponentEnergyManager comp = GetCompEM();
6699 {
6701 }
6702 }
6704 {
6706
6707 }
6708
6709 }
6710 }
6711 }
6712
6715 {
6716 EntityAI parent = GetHierarchyParent();
6717
6718 if (parent)
6719 {
6720 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6721 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6722 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6723 }
6724 }
6725
6728 {
6729 EntityAI parent = GetHierarchyParent();
6730
6731 if (parent)
6732 {
6733 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6734 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6735 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6736 }
6737 }
6738
6740 {
6741
6742
6743
6744
6746
6748 {
6749 if (ScriptInputUserData.CanStoreInputUserData())
6750 {
6751 ScriptInputUserData ctx = new ScriptInputUserData;
6757 ctx.
Write(use_stack_max);
6760
6762 {
6763 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6764 }
6765 }
6766 }
6767 else if (!
g_Game.IsMultiplayer())
6768 {
6770 }
6771 }
6772
6774 {
6776 }
6777
6779 {
6781 }
6782
6784 {
6786 }
6787
6789 {
6790
6791 return false;
6792 }
6793
6795 {
6796 return false;
6797 }
6798
6802 {
6803 return false;
6804 }
6805
6807 {
6808 return "";
6809 }
6810
6812
6814 {
6815 return false;
6816 }
6817
6819 {
6820 return true;
6821 }
6822
6823
6824
6826 {
6827 return true;
6828 }
6829
6831 {
6832 return true;
6833 }
6834
6836 {
6837 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6839 }
6840
6842 {
6844 }
6845
6847 {
6849 if (!is_being_placed)
6851 SetSynchDirty();
6852 }
6853
6854
6856
6858 {
6860 }
6861
6863 {
6865 }
6866
6868 {
6869 return 1;
6870 }
6871
6873 {
6874 return false;
6875 }
6876
6878 {
6880 SetSynchDirty();
6881 }
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6918 {
6919 super.OnMovedInsideCargo(container);
6920
6921 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6922 }
6923
6924 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6925 {
6926 super.EEItemLocationChanged(oldLoc, newLoc);
6927
6928 PlayerBase newPlayer = null;
6929 PlayerBase oldPlayer = null;
6930
6931 if (newLoc.GetParent())
6932 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6933
6934 if (oldLoc.GetParent())
6935 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6936
6938 {
6939 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6940
6941 if (rIndex >= 0)
6942 {
6943 InventoryLocation rIl = new InventoryLocation;
6944 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6945
6946 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6949 {
6950 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6951 }
6953 {
6955 }
6956
6957 }
6958 }
6959
6961 {
6962 if (newPlayer)
6963 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6964
6965 if (newPlayer == oldPlayer)
6966 {
6967 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6968 {
6970 {
6971 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6972 {
6973 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6974 }
6975 }
6976 else
6977 {
6978 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6979 }
6980 }
6981
6982 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6983 {
6984 int type = oldLoc.GetType();
6986 {
6987 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6988 }
6990 {
6991 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6992 }
6993 }
6994 if (!m_OldLocation)
6995 {
6996 m_OldLocation = new InventoryLocation;
6997 }
6998 m_OldLocation.Copy(oldLoc);
6999 }
7000 else
7001 {
7002 if (m_OldLocation)
7003 {
7004 m_OldLocation.Reset();
7005 }
7006 }
7007
7008 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7009 }
7010 else
7011 {
7012 if (newPlayer)
7013 {
7014 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7015 if (resIndex >= 0)
7016 {
7017 InventoryLocation il = new InventoryLocation;
7018 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7020 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7023 {
7024 il.
GetParent().GetOnReleaseLock().Invoke(it);
7025 }
7027 {
7029 }
7030
7031 }
7032 }
7034 {
7035
7037 }
7038
7039 if (m_OldLocation)
7040 {
7041 m_OldLocation.Reset();
7042 }
7043 }
7044
7046 {
7047 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7048 }
7049
7051 {
7052 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7053 }
7054 }
7055
7056 override void EOnContact(IEntity other, Contact extra)
7057 {
7059 {
7060 int liquidType = -1;
7062 if (impactSpeed > 0.0)
7063 {
7065 #ifndef SERVER
7067 #else
7069 SetSynchDirty();
7070 #endif
7072 }
7073 }
7074
7075 #ifdef SERVER
7076 if (GetCompEM() && GetCompEM().IsPlugged())
7077 {
7078 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7079 GetCompEM().UnplugThis();
7080 }
7081 #endif
7082 }
7083
7085
7087 {
7089 }
7090
7092 {
7093
7094 }
7095
7097 {
7098 super.OnItemLocationChanged(old_owner, new_owner);
7099
7100 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7101 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7102
7103 if (!relatedPlayer && playerNew)
7104 relatedPlayer = playerNew;
7105
7106 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7107 {
7109 if (actionMgr)
7110 {
7111 ActionBase currentAction = actionMgr.GetRunningAction();
7112 if (currentAction)
7114 }
7115 }
7116
7117 Man ownerPlayerOld = null;
7118 Man ownerPlayerNew = null;
7119
7120 if (old_owner)
7121 {
7122 if (old_owner.
IsMan())
7123 {
7124 ownerPlayerOld = Man.Cast(old_owner);
7125 }
7126 else
7127 {
7128 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7129 }
7130 }
7131 else
7132 {
7134 {
7136
7137 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7138 {
7139 GetCompEM().UnplugThis();
7140 }
7141 }
7142 }
7143
7144 if (new_owner)
7145 {
7146 if (new_owner.
IsMan())
7147 {
7148 ownerPlayerNew = Man.Cast(new_owner);
7149 }
7150 else
7151 {
7152 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7153 }
7154 }
7155
7156 if (ownerPlayerOld != ownerPlayerNew)
7157 {
7158 if (ownerPlayerOld)
7159 {
7160 array<EntityAI> subItemsExit = new array<EntityAI>;
7162 for (int i = 0; i < subItemsExit.Count(); i++)
7163 {
7166 }
7167 }
7168
7169 if (ownerPlayerNew)
7170 {
7171 array<EntityAI> subItemsEnter = new array<EntityAI>;
7173 for (int j = 0; j < subItemsEnter.Count(); j++)
7174 {
7177 }
7178 }
7179 }
7180 else if (ownerPlayerNew != null)
7181 {
7182 PlayerBase nplayer;
7183 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7184 {
7185 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7187 for (int k = 0; k < subItemsUpdate.Count(); k++)
7188 {
7190 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7191 }
7192 }
7193 }
7194
7195 if (old_owner)
7196 old_owner.OnChildItemRemoved(this);
7197 if (new_owner)
7198 new_owner.OnChildItemReceived(this);
7199 }
7200
7201
7203 {
7204 super.EEDelete(parent);
7205 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7206 if (player)
7207 {
7209
7210 if (player.IsAlive())
7211 {
7212 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7213 if (r_index >= 0)
7214 {
7215 InventoryLocation r_il = new InventoryLocation;
7216 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7217
7218 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7221 {
7222 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7223 }
7225 {
7226 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7227 }
7228
7229 }
7230
7231 player.RemoveQuickBarEntityShortcut(this);
7232 }
7233 }
7234 }
7235
7237 {
7238 super.EEKilled(killer);
7239
7242 {
7243 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7244 {
7245 if (IsMagazine())
7246 {
7247 if (Magazine.Cast(this).GetAmmoCount() > 0)
7248 {
7250 }
7251 }
7252 else
7253 {
7255 }
7256 }
7257 }
7258 }
7259
7261 {
7262 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7263
7264 super.OnWasAttached(parent, slot_id);
7265
7268
7271 }
7272
7274 {
7275 super.OnWasDetached(parent, slot_id);
7276
7279
7282 }
7283
7285 {
7286 int idx;
7289
7290 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7291 if (inventory_slots.Count() < 1)
7292 {
7293 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7294 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7295 }
7296 else
7297 {
7298 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7299 }
7300
7301 idx = inventory_slots.Find(slot);
7302 if (idx < 0)
7303 return "";
7304
7305 return attach_types.Get(idx);
7306 }
7307
7309 {
7310 int idx = -1;
7311 string slot;
7312
7315
7316 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7317 if (inventory_slots.Count() < 1)
7318 {
7319 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7320 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7321 }
7322 else
7323 {
7324 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7325 if (detach_types.Count() < 1)
7326 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7327 }
7328
7329 for (int i = 0; i < inventory_slots.Count(); i++)
7330 {
7331 slot = inventory_slots.Get(i);
7332 }
7333
7334 if (slot != "")
7335 {
7336 if (detach_types.Count() == 1)
7337 idx = 0;
7338 else
7339 idx = inventory_slots.Find(slot);
7340 }
7341 if (idx < 0)
7342 return "";
7343
7344 return detach_types.Get(idx);
7345 }
7346
7348 {
7349
7351
7352
7353 float min_time = 1;
7354 float max_time = 3;
7355 float delay = Math.RandomFloat(min_time, max_time);
7356
7357 explode_timer.Run(delay, this, "DoAmmoExplosion");
7358 }
7359
7361 {
7362 Magazine magazine = Magazine.Cast(this);
7363 int pop_sounds_count = 6;
7364 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7365
7366
7367 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7368 string sound_name = pop_sounds[ sound_idx ];
7369 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7370
7371
7372 magazine.ServerAddAmmoCount(-1);
7373
7374
7375 float min_temp_to_explode = 100;
7376
7377 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7378 {
7380 }
7381 }
7382
7383
7384 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7385 {
7386 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7387
7388 const int CHANCE_DAMAGE_CARGO = 4;
7389 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7390 const int CHANCE_DAMAGE_NOTHING = 2;
7391
7393 {
7394 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7395 int chances;
7396 int rnd;
7397
7398 if (GetInventory().GetCargo())
7399 {
7400 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7401 rnd = Math.RandomInt(0,chances);
7402
7403 if (rnd < CHANCE_DAMAGE_CARGO)
7404 {
7406 }
7407 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7408 {
7410 }
7411 }
7412 else
7413 {
7414 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7415 rnd = Math.RandomInt(0,chances);
7416
7417 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7418 {
7420 }
7421 }
7422 }
7423 }
7424
7426 {
7427 CargoBase cargo = GetInventory().GetCargo();
7428 if (cargo)
7429 {
7431 if (item_count > 0)
7432 {
7433 int random_pick = Math.RandomInt(0, item_count);
7435 if (!item.IsExplosive())
7436 {
7437 item.AddHealth("","",damage);
7438 return true;
7439 }
7440 }
7441 }
7442 return false;
7443 }
7444
7446 {
7447 GameInventory inventory = GetInventory();
7449 if (attachment_count > 0)
7450 {
7451 int random_pick = Math.RandomInt(0, attachment_count);
7453 if (!attachment.IsExplosive())
7454 {
7455 attachment.AddHealth("","",damage);
7456 return true;
7457 }
7458 }
7459 return false;
7460 }
7461
7463 {
7465 }
7466
7468 {
7470 return GetInventory().CanRemoveEntity();
7471
7472 return false;
7473 }
7474
7476 {
7477
7479 return false;
7480
7481
7483 return false;
7484
7485
7486
7488 if (delta == 0)
7489 return false;
7490
7491
7492 return true;
7493 }
7494
7496 {
7498 {
7499 if (ScriptInputUserData.CanStoreInputUserData())
7500 {
7501 ScriptInputUserData ctx = new ScriptInputUserData;
7506 ctx.
Write(destination_entity);
7510 }
7511 }
7512 else if (!
g_Game.IsMultiplayer())
7513 {
7515 }
7516 }
7517
7519 {
7520 float split_quantity_new;
7524 InventoryLocation loc = new InventoryLocation;
7525
7526 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7527 {
7529 split_quantity_new = stack_max;
7530 else
7532
7534 {
7535 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7536 if (new_item)
7537 {
7538 new_item.SetResultOfSplit(true);
7539 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7541 new_item.
SetQuantity(split_quantity_new,
false,
true);
7542 }
7543 }
7544 }
7545 else if (destination_entity && slot_id == -1)
7546 {
7547 if (quantity > stack_max)
7548 split_quantity_new = stack_max;
7549 else
7550 split_quantity_new = quantity;
7551
7553 {
7554 GameInventory destinationInventory = destination_entity.GetInventory();
7556 {
7559 }
7560
7561 if (new_item)
7562 {
7563 new_item.SetResultOfSplit(true);
7564 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7566 new_item.
SetQuantity(split_quantity_new,
false,
true);
7567 }
7568 }
7569 }
7570 else
7571 {
7572 if (stack_max != 0)
7573 {
7575 {
7577 }
7578
7579 if (split_quantity_new == 0)
7580 {
7581 if (!
g_Game.IsMultiplayer())
7582 player.PhysicalPredictiveDropItem(this);
7583 else
7584 player.ServerDropEntity(this);
7585 return;
7586 }
7587
7589 {
7591
7592 if (new_item)
7593 {
7594 new_item.SetResultOfSplit(true);
7595 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7598 new_item.PlaceOnSurface();
7599 }
7600 }
7601 }
7602 }
7603 }
7604
7606 {
7607 float split_quantity_new;
7611 InventoryLocation loc = new InventoryLocation;
7612
7613 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7614 {
7616 split_quantity_new = stack_max;
7617 else
7619
7621 {
7622 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7623 if (new_item)
7624 {
7625 new_item.SetResultOfSplit(true);
7626 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7628 new_item.
SetQuantity(split_quantity_new,
false,
true);
7629 }
7630 }
7631 }
7632 else if (destination_entity && slot_id == -1)
7633 {
7634 if (quantity > stack_max)
7635 split_quantity_new = stack_max;
7636 else
7637 split_quantity_new = quantity;
7638
7640 {
7641 GameInventory destinationInventory = destination_entity.GetInventory();
7643 {
7646 }
7647
7648 if (new_item)
7649 {
7650 new_item.SetResultOfSplit(true);
7651 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7653 new_item.
SetQuantity(split_quantity_new,
false,
true);
7654 }
7655 }
7656 }
7657 else
7658 {
7659 if (stack_max != 0)
7660 {
7662 {
7664 }
7665
7667 {
7669
7670 if (new_item)
7671 {
7672 new_item.SetResultOfSplit(true);
7673 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7676 new_item.PlaceOnSurface();
7677 }
7678 }
7679 }
7680 }
7681 }
7682
7684 {
7686 {
7687 if (ScriptInputUserData.CanStoreInputUserData())
7688 {
7689 ScriptInputUserData ctx = new ScriptInputUserData;
7694 dst.WriteToContext(ctx);
7696 }
7697 }
7698 else if (!
g_Game.IsMultiplayer())
7699 {
7701 }
7702 }
7703
7705 {
7707 {
7708 if (ScriptInputUserData.CanStoreInputUserData())
7709 {
7710 ScriptInputUserData ctx = new ScriptInputUserData;
7715 ctx.
Write(destination_entity);
7721 }
7722 }
7723 else if (!
g_Game.IsMultiplayer())
7724 {
7726 }
7727 }
7728
7730 {
7732 }
7733
7735 {
7737 float split_quantity_new;
7739 if (dst.IsValid())
7740 {
7741 int slot_id = dst.GetSlot();
7743
7744 if (quantity > stack_max)
7745 split_quantity_new = stack_max;
7746 else
7747 split_quantity_new = quantity;
7748
7750 {
7752
7753 if (new_item)
7754 {
7755 new_item.SetResultOfSplit(true);
7756 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7758 new_item.
SetQuantity(split_quantity_new,
false,
true);
7759 }
7760
7761 return new_item;
7762 }
7763 }
7764
7765 return null;
7766 }
7767
7769 {
7771 float split_quantity_new;
7773 if (destination_entity)
7774 {
7776 if (quantity > stackable)
7777 split_quantity_new = stackable;
7778 else
7779 split_quantity_new = quantity;
7780
7782 {
7783 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7784 if (new_item)
7785 {
7786 new_item.SetResultOfSplit(true);
7787 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7789 new_item.
SetQuantity(split_quantity_new,
false,
true);
7790 }
7791 }
7792 }
7793 }
7794
7796 {
7798 {
7799 if (ScriptInputUserData.CanStoreInputUserData())
7800 {
7801 ScriptInputUserData ctx = new ScriptInputUserData;
7806 ItemBase destination_entity =
this;
7807 ctx.
Write(destination_entity);
7811 }
7812 }
7813 else if (!
g_Game.IsMultiplayer())
7814 {
7816 }
7817 }
7818
7820 {
7822 float split_quantity_new;
7824 if (player)
7825 {
7827 if (quantity > stackable)
7828 split_quantity_new = stackable;
7829 else
7830 split_quantity_new = quantity;
7831
7833 {
7834 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7835 new_item =
ItemBase.Cast(in_hands);
7836 if (new_item)
7837 {
7838 new_item.SetResultOfSplit(true);
7839 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7841 new_item.SetQuantity(split_quantity_new, false, true);
7842 }
7843 }
7844 }
7845 }
7846
7848 {
7850 float split_quantity_new = Math.Floor(quantity * 0.5);
7851
7853 return;
7854
7856
7857 if (new_item)
7858 {
7859 if (new_item.GetQuantityMax() < split_quantity_new)
7860 {
7861 split_quantity_new = new_item.GetQuantityMax();
7862 }
7863
7864 new_item.SetResultOfSplit(true);
7865 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7866
7868 {
7871 }
7872 else
7873 {
7875 new_item.
SetQuantity(split_quantity_new,
false,
true);
7876 }
7877 }
7878 }
7879
7881 {
7883 float split_quantity_new = Math.Floor(quantity / 2);
7884
7886 return;
7887
7888 InventoryLocation invloc = new InventoryLocation;
7890
7892 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7893
7894 if (new_item)
7895 {
7896 if (new_item.GetQuantityMax() < split_quantity_new)
7897 {
7898 split_quantity_new = new_item.GetQuantityMax();
7899 }
7901 {
7904 }
7905 else if (split_quantity_new > 1)
7906 {
7908 new_item.
SetQuantity(split_quantity_new,
false,
true);
7909 }
7910 }
7911 }
7912
7915 {
7916 SetWeightDirty();
7918
7919 if (parent)
7920 parent.OnAttachmentQuantityChangedEx(this, delta);
7921
7923 {
7925 {
7927 }
7929 {
7930 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7932 }
7933 }
7934 }
7935
7938 {
7939
7940 }
7941
7944 {
7946 }
7947
7949 {
7950 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7951
7953 {
7954 if (newLevel == GameConstants.STATE_RUINED)
7955 {
7957 EntityAI parent = GetHierarchyParent();
7958 if (parent && parent.IsFireplace())
7959 {
7960 CargoBase cargo = GetInventory().GetCargo();
7961 if (cargo)
7962 {
7964 {
7966 }
7967 }
7968 }
7969 }
7970
7972 {
7973
7975 return;
7976 }
7977
7978 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7979 {
7981 }
7982 }
7983 }
7984
7985
7987 {
7988 super.OnRightClick();
7989
7991 {
7993 {
7994 if (ScriptInputUserData.CanStoreInputUserData())
7995 {
7996 EntityAI root = GetHierarchyRoot();
7997 Man playerOwner = GetHierarchyRootPlayer();
7998 InventoryLocation dst = new InventoryLocation;
7999
8000
8001 if (!playerOwner && root && root == this)
8002 {
8004 }
8005 else
8006 {
8007
8008 GetInventory().GetCurrentInventoryLocation(dst);
8010 {
8011 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8013 {
8015 }
8016 else
8017 {
8019
8020
8021 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8022 {
8024 }
8025 else
8026 {
8027 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8028 }
8029 }
8030 }
8031 }
8032
8033 ScriptInputUserData ctx = new ScriptInputUserData;
8041 }
8042 }
8043 else if (!
g_Game.IsMultiplayer())
8044 {
8046 }
8047 }
8048 }
8049
8051 {
8052 if (root)
8053 {
8054 vector m4[4];
8055 root.GetTransform(m4);
8056 dst.SetGround(this, m4);
8057 }
8058 else
8059 {
8060 GetInventory().GetCurrentInventoryLocation(dst);
8061 }
8062 }
8063
8064 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8065 {
8066
8067 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8068 return false;
8069
8070 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8071 return false;
8072
8073
8075 return false;
8076
8077
8078 Magazine mag = Magazine.Cast(this);
8079 if (mag)
8080 {
8081 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8082 return false;
8083
8084 if (stack_max_limit)
8085 {
8086 Magazine other_mag = Magazine.Cast(other_item);
8087 if (other_item)
8088 {
8089 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8090 return false;
8091 }
8092
8093 }
8094 }
8095 else
8096 {
8097
8099 return false;
8100
8102 return false;
8103 }
8104
8105 PlayerBase player = null;
8106 if (CastTo(player, GetHierarchyRootPlayer()))
8107 {
8108 if (player.GetInventory().HasAttachment(this))
8109 return false;
8110
8111 if (player.IsItemsToDelete())
8112 return false;
8113 }
8114
8115 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8116 return false;
8117
8118 int slotID;
8120 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8121 return false;
8122
8123 return true;
8124 }
8125
8127 {
8129 }
8130
8132 {
8133 return m_IsResultOfSplit;
8134 }
8135
8137 {
8138 m_IsResultOfSplit = value;
8139 }
8140
8142 {
8144 }
8145
8147 {
8148 float other_item_quantity = other_item.GetQuantity();
8149 float this_free_space;
8150
8152
8154
8155 if (other_item_quantity > this_free_space)
8156 {
8157 return this_free_space;
8158 }
8159 else
8160 {
8161 return other_item_quantity;
8162 }
8163 }
8164
8166 {
8168 }
8169
8171 {
8173 return;
8174
8175 if (!IsMagazine() && other_item)
8176 {
8178 if (quantity_used != 0)
8179 {
8180 float hp1 = GetHealth01("","");
8181 float hp2 = other_item.GetHealth01("","");
8182 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8183 hpResult = hpResult / (
GetQuantity() + quantity_used);
8184
8185 hpResult *= GetMaxHealth();
8186 Math.Round(hpResult);
8187 SetHealth("", "Health", hpResult);
8188
8190 other_item.AddQuantity(-quantity_used);
8191 }
8192 }
8194 }
8195
8197 {
8198 #ifdef SERVER
8199 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8200 GetHierarchyParent().IncreaseLifetimeUp();
8201 #endif
8202 };
8203
8205 {
8206 PlayerBase p = PlayerBase.Cast(player);
8207
8208 array<int> recipesIds = p.m_Recipes;
8209 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8210 if (moduleRecipesManager)
8211 {
8212 EntityAI itemInHands = player.GetEntityInHands();
8213 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8214 }
8215
8216 for (int i = 0;i < recipesIds.Count(); i++)
8217 {
8218 int key = recipesIds.Get(i);
8219 string recipeName = moduleRecipesManager.GetRecipeName(key);
8221 }
8222 }
8223
8224
8225 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8226 {
8227 super.GetDebugActions(outputList);
8228
8229
8235
8236
8241
8246
8247
8251
8252
8254 {
8258 }
8259
8262
8263
8267
8269
8270 InventoryLocation loc = new InventoryLocation();
8271 GetInventory().GetCurrentInventoryLocation(loc);
8273 {
8274 if (Gizmo_IsSupported())
8277 }
8278
8280 }
8281
8282
8283
8284
8286 {
8287 super.OnAction(action_id, player, ctx);
8288
8290 {
8291 switch (action_id)
8292 {
8296 return true;
8300 return true;
8301 }
8302 }
8303
8305 {
8306 switch (action_id)
8307 {
8309 Delete();
8310 return true;
8311 }
8312 }
8313
8314 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8315 {
8316 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8317 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8318 PlayerBase p = PlayerBase.Cast(player);
8319 if (
EActions.RECIPES_RANGE_START < 1000)
8320 {
8321 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8322 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8323 }
8324 }
8325 #ifndef SERVER
8326 else if (action_id ==
EActions.WATCH_PLAYER)
8327 {
8328 PluginDeveloper.SetDeveloperItemClientEx(player);
8329 }
8330 #endif
8332 {
8333 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8334 {
8335 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8336 OnDebugButtonPressServer(id + 1);
8337 }
8338
8339 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8340 {
8341 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8343 }
8344
8345 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8346 {
8347 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8349 }
8350
8351 else if (action_id ==
EActions.ADD_QUANTITY)
8352 {
8353 if (IsMagazine())
8354 {
8355 Magazine mag = Magazine.Cast(this);
8356 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8357 }
8358 else
8359 {
8361 }
8362
8363 if (m_EM)
8364 {
8365 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8366 }
8367
8368 }
8369
8370 else if (action_id ==
EActions.REMOVE_QUANTITY)
8371 {
8372 if (IsMagazine())
8373 {
8374 Magazine mag2 = Magazine.Cast(this);
8375 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8376 }
8377 else
8378 {
8380 }
8381 if (m_EM)
8382 {
8383 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8384 }
8385
8386 }
8387
8388 else if (action_id ==
EActions.SET_QUANTITY_0)
8389 {
8391
8392 if (m_EM)
8393 {
8394 m_EM.SetEnergy(0);
8395 }
8396 }
8397
8398 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8399 {
8401
8402 if (m_EM)
8403 {
8404 m_EM.SetEnergy(m_EM.GetEnergyMax());
8405 }
8406 }
8407
8408 else if (action_id ==
EActions.ADD_HEALTH)
8409 {
8410 AddHealth("","",GetMaxHealth("","Health")/5);
8411 }
8412 else if (action_id ==
EActions.REMOVE_HEALTH)
8413 {
8414 AddHealth("","",-GetMaxHealth("","Health")/5);
8415 }
8416 else if (action_id ==
EActions.DESTROY_HEALTH)
8417 {
8418 SetHealth01("","",0);
8419 }
8420 else if (action_id ==
EActions.WATCH_ITEM)
8421 {
8423 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8424 #ifdef DEVELOPER
8425 SetDebugDeveloper_item(this);
8426 #endif
8427 }
8428
8429 else if (action_id ==
EActions.ADD_TEMPERATURE)
8430 {
8431 AddTemperature(20);
8432
8433 }
8434
8435 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8436 {
8437 AddTemperature(-20);
8438
8439 }
8440
8441 else if (action_id ==
EActions.FLIP_FROZEN)
8442 {
8443 SetFrozen(!GetIsFrozen());
8444
8445 }
8446
8447 else if (action_id ==
EActions.ADD_WETNESS)
8448 {
8450
8451 }
8452
8453 else if (action_id ==
EActions.REMOVE_WETNESS)
8454 {
8456
8457 }
8458
8459 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8460 {
8463
8464
8465 }
8466
8467 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8468 {
8471 }
8472
8473 else if (action_id ==
EActions.MAKE_SPECIAL)
8474 {
8475 auto debugParams = DebugSpawnParams.WithPlayer(player);
8476 OnDebugSpawnEx(debugParams);
8477 }
8478
8479 }
8480
8481
8482 return false;
8483 }
8484
8485
8486
8487
8491
8494
8495
8496
8498 {
8499 return false;
8500 }
8501
8502
8504 {
8505 return true;
8506 }
8507
8508
8510 {
8511 return true;
8512 }
8513
8514
8515
8517 {
8518 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8519 return g_Game.ConfigIsExisting(config_path);
8520 }
8521
8524 {
8525 return null;
8526 }
8527
8529 {
8530 return false;
8531 }
8532
8534 {
8535 return false;
8536 }
8537
8541
8542
8544 {
8545 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8546 return module_repairing.CanRepair(this, item_repair_kit);
8547 }
8548
8549
8550 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8551 {
8552 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8553 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8554 }
8555
8556
8558 {
8559
8560
8561
8562
8563
8564
8565
8566
8567 return 1;
8568 }
8569
8570
8571
8573 {
8575 }
8576
8577
8578
8580 {
8582 }
8583
8584
8593 {
8594 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8595
8596 if (player)
8597 {
8598 player.MessageStatus(text);
8599 }
8600 }
8601
8602
8611 {
8612 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8613
8614 if (player)
8615 {
8616 player.MessageAction(text);
8617 }
8618 }
8619
8620
8629 {
8630 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8631
8632 if (player)
8633 {
8634 player.MessageFriendly(text);
8635 }
8636 }
8637
8638
8647 {
8648 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8649
8650 if (player)
8651 {
8652 player.MessageImportant(text);
8653 }
8654 }
8655
8657 {
8658 return true;
8659 }
8660
8661
8662 override bool KindOf(
string tag)
8663 {
8664 bool found = false;
8665 string item_name = this.
GetType();
8667 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8668
8669 int array_size = item_tag_array.Count();
8670 for (int i = 0; i < array_size; i++)
8671 {
8672 if (item_tag_array.Get(i) == tag)
8673 {
8674 found = true;
8675 break;
8676 }
8677 }
8678 return found;
8679 }
8680
8681
8683 {
8684
8685 super.OnRPC(sender, rpc_type,ctx);
8686
8687
8688 switch (rpc_type)
8689 {
8690 #ifndef SERVER
8691 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8692 Param2<bool, string> p = new Param2<bool, string>(false, "");
8693
8695 return;
8696
8697 bool play = p.param1;
8698 string soundSet = p.param2;
8699
8700 if (play)
8701 {
8703 {
8705 {
8707 }
8708 }
8709 else
8710 {
8712 }
8713 }
8714 else
8715 {
8717 }
8718
8719 break;
8720 #endif
8721
8722 }
8723
8725 {
8727 }
8728 }
8729
8730
8731
8732
8734 {
8735 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8736 return plugin.GetID(
name);
8737 }
8738
8740 {
8741 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8742 return plugin.GetName(id);
8743 }
8744
8747 {
8748
8749
8750 int varFlags;
8751 if (!ctx.
Read(varFlags))
8752 return;
8753
8754 if (varFlags & ItemVariableFlags.FLOAT)
8755 {
8757 }
8758 }
8759
8761 {
8762
8763 super.SerializeNumericalVars(floats_out);
8764
8765
8766
8768 {
8770 }
8771
8773 {
8775 }
8776
8778 {
8780 }
8781
8783 {
8788 }
8789
8791 {
8793 }
8794 }
8795
8797 {
8798
8799 super.DeSerializeNumericalVars(floats);
8800
8801
8802 int index = 0;
8803 int mask = Math.Round(floats.Get(index));
8804
8805 index++;
8806
8808 {
8810 {
8812 }
8813 else
8814 {
8815 float quantity = floats.Get(index);
8817 }
8818 index++;
8819 }
8820
8822 {
8823 float wet = floats.Get(index);
8825 index++;
8826 }
8827
8829 {
8830 int liquidtype = Math.Round(floats.Get(index));
8832 index++;
8833 }
8834
8836 {
8838 index++;
8840 index++;
8842 index++;
8844 index++;
8845 }
8846
8848 {
8849 int cleanness = Math.Round(floats.Get(index));
8851 index++;
8852 }
8853 }
8854
8856 {
8857 super.WriteVarsToCTX(ctx);
8858
8859
8861 {
8863 }
8864
8866 {
8868 }
8869
8871 {
8873 }
8874
8876 {
8877 int r,g,b,a;
8883 }
8884
8886 {
8888 }
8889 }
8890
8892 {
8893 if (!super.ReadVarsFromCTX(ctx,version))
8894 return false;
8895
8896 int intValue;
8897 float value;
8898
8899 if (version < 140)
8900 {
8901 if (!ctx.
Read(intValue))
8902 return false;
8903
8904 m_VariablesMask = intValue;
8905 }
8906
8908 {
8909 if (!ctx.
Read(value))
8910 return false;
8911
8913 {
8915 }
8916 else
8917 {
8919 }
8920 }
8921
8922 if (version < 140)
8923 {
8925 {
8926 if (!ctx.
Read(value))
8927 return false;
8928 SetTemperatureDirect(value);
8929 }
8930 }
8931
8933 {
8934 if (!ctx.
Read(value))
8935 return false;
8937 }
8938
8940 {
8941 if (!ctx.
Read(intValue))
8942 return false;
8944 }
8945
8947 {
8948 int r,g,b,a;
8950 return false;
8952 return false;
8954 return false;
8956 return false;
8957
8959 }
8960
8962 {
8963 if (!ctx.
Read(intValue))
8964 return false;
8966 }
8967
8968 if (version >= 138 && version < 140)
8969 {
8971 {
8972 if (!ctx.
Read(intValue))
8973 return false;
8974 SetFrozen(intValue);
8975 }
8976 }
8977
8978 return true;
8979 }
8980
8981
8983 {
8986 {
8988 }
8989
8990 if (!super.OnStoreLoad(ctx, version))
8991 {
8993 return false;
8994 }
8995
8996 if (version >= 114)
8997 {
8998 bool hasQuickBarIndexSaved;
8999
9000 if (!ctx.
Read(hasQuickBarIndexSaved))
9001 {
9003 return false;
9004 }
9005
9006 if (hasQuickBarIndexSaved)
9007 {
9008 int itmQBIndex;
9009
9010
9011 if (!ctx.
Read(itmQBIndex))
9012 {
9014 return false;
9015 }
9016
9017 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9018 if (itmQBIndex != -1 && parentPlayer)
9019 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9020 }
9021 }
9022 else
9023 {
9024
9025 PlayerBase player;
9026 int itemQBIndex;
9027 if (version ==
int.
MAX)
9028 {
9029 if (!ctx.
Read(itemQBIndex))
9030 {
9032 return false;
9033 }
9034 }
9035 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9036 {
9037
9038 if (!ctx.
Read(itemQBIndex))
9039 {
9041 return false;
9042 }
9043 if (itemQBIndex != -1 && player)
9044 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9045 }
9046 }
9047
9048 if (version < 140)
9049 {
9050
9051 if (!LoadVariables(ctx, version))
9052 {
9054 return false;
9055 }
9056 }
9057
9058
9060 {
9062 return false;
9063 }
9064 if (version >= 132)
9065 {
9067 if (raib)
9068 {
9070 {
9072 return false;
9073 }
9074 }
9075 }
9076
9078 return true;
9079 }
9080
9081
9082
9084 {
9085 super.OnStoreSave(ctx);
9086
9087 PlayerBase player;
9088 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9089 {
9091
9092 int itemQBIndex = -1;
9093 itemQBIndex = player.FindQuickBarEntityIndex(this);
9094 ctx.
Write(itemQBIndex);
9095 }
9096 else
9097 {
9099 }
9100
9102
9104 if (raib)
9105 {
9107 }
9108 }
9109
9110
9112 {
9113 super.AfterStoreLoad();
9114
9116 {
9118 }
9119
9121 {
9124 }
9125 }
9126
9128 {
9129 super.EEOnAfterLoad();
9130
9132 {
9134 }
9135
9138 }
9139
9141 {
9142 return false;
9143 }
9144
9145
9146
9148 {
9150 {
9151 #ifdef PLATFORM_CONSOLE
9152
9154 {
9156 if (menu)
9157 {
9159 }
9160 }
9161 #endif
9162 }
9163
9165 {
9168 }
9169
9171 {
9172 SetWeightDirty();
9174 }
9176 {
9179 }
9180
9182 {
9185
9188 }
9190 {
9194 }
9195
9196 super.OnVariablesSynchronized();
9197 }
9198
9199
9200
9202 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9203 {
9204 if (!IsServerCheck(allow_client))
9205 return false;
9206
9208 return false;
9209
9212
9213 if (value <= (min + 0.001))
9214 value = min;
9215
9216 if (value == min)
9217 {
9218 if (destroy_config)
9219 {
9220 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9221 if (dstr)
9222 {
9224 this.Delete();
9225 return true;
9226 }
9227 }
9228 else if (destroy_forced)
9229 {
9231 this.Delete();
9232 return true;
9233 }
9234
9236 }
9237
9240
9242 {
9243 EntityAI parent = GetHierarchyRoot();
9244 InventoryLocation iLoc = new InventoryLocation();
9245 GetInventory().GetCurrentInventoryLocation(iLoc);
9247 {
9248 int iLocSlot = iLoc.
GetSlot();
9250 {
9252 }
9254 {
9256 }
9257 }
9258 }
9259
9261 {
9263
9264 if (delta)
9266 }
9267
9269
9270 return false;
9271 }
9272
9273
9275 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9276 {
9278 }
9279
9281 {
9284 }
9285
9287 {
9290 }
9291
9293 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9294 {
9295 float value_clamped = Math.Clamp(value, 0, 1);
9297 SetQuantity(result, destroy_config, destroy_forced);
9298 }
9299
9300
9303 {
9305 }
9306
9308 {
9310 }
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9322 {
9323 int slot = -1;
9324 GameInventory inventory = GetInventory();
9325 if (inventory)
9326 {
9327 InventoryLocation il = new InventoryLocation;
9330 }
9331
9333 }
9334
9336 {
9337 float quantity_max = 0;
9338
9340 {
9341 if (attSlotID != -1)
9342 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9343
9344 if (quantity_max <= 0)
9346 }
9347
9348 if (quantity_max <= 0)
9350
9351 return quantity_max;
9352 }
9353
9355 {
9357 }
9358
9360 {
9362 }
9363
9364
9366 {
9368 }
9369
9371 {
9373 }
9374
9376 {
9378 }
9379
9380
9382 {
9383
9384 float weightEx = GetWeightEx();
9385 float special = GetInventoryAndCargoWeight();
9386 return weightEx - special;
9387 }
9388
9389
9391 {
9393 }
9394
9396 {
9398 {
9399 #ifdef DEVELOPER
9400 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9401 {
9402 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9404 }
9405 #endif
9406
9408 }
9409 else if (HasEnergyManager())
9410 {
9411 #ifdef DEVELOPER
9412 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9413 {
9414 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9415 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9416 }
9417 #endif
9418 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9419 }
9420 else
9421 {
9422 #ifdef DEVELOPER
9423 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9424 {
9425 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9426 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9427 }
9428 #endif
9429 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9430 }
9431 }
9432
9435 {
9436 int item_count = 0;
9438
9439 GameInventory inventory = GetInventory();
9440 CargoBase cargo = inventory.
GetCargo();
9441 if (cargo != NULL)
9442 {
9444 }
9445
9447 for (int i = 0; i < nAttachments; ++i)
9448 {
9450 if (item)
9451 item_count += item.GetNumberOfItems();
9452 }
9453 return item_count;
9454 }
9455
9458 {
9459 float weight = 0;
9460 float wetness = 1;
9461 if (include_wetness)
9464 {
9465 weight = wetness * m_ConfigWeight;
9466 }
9468 {
9469 weight = 1;
9470 }
9471 return weight;
9472 }
9473
9474
9475
9477 {
9478 GameInventory inventory = GetInventory();
9479 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9480 {
9481 array<EntityAI> items = new array<EntityAI>;
9483 for (int i = 0; i < items.Count(); ++i)
9484 {
9486 if (item)
9487 {
9488 g_Game.ObjectDelete(item);
9489 }
9490 }
9491 }
9492 }
9493
9494
9495
9496
9498 {
9499 float energy = 0;
9500 if (HasEnergyManager())
9501 {
9502 energy = GetCompEM().GetEnergy();
9503 }
9504 return energy;
9505 }
9506
9507
9509 {
9510 super.OnEnergyConsumed();
9511
9513 }
9514
9516 {
9517 super.OnEnergyAdded();
9518
9520 }
9521
9522
9524 {
9525 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9526 {
9528 {
9529 float energy_0to1 = GetCompEM().GetEnergy0To1();
9531 }
9532 }
9533 }
9534
9535
9537 {
9538 return ConfigGetFloat("heatIsolation");
9539 }
9540
9542 {
9544 }
9545
9547 {
9548 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9549 if (
g_Game.ConfigIsExisting(paramPath))
9550 return g_Game.ConfigGetFloat(paramPath);
9551
9552 return 0.0;
9553 }
9554
9556 {
9557 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9558 if (
g_Game.ConfigIsExisting(paramPath))
9559 return g_Game.ConfigGetFloat(paramPath);
9560
9561 return 0.0;
9562 }
9563
9564 override void SetWet(
float value,
bool allow_client =
false)
9565 {
9566 if (!IsServerCheck(allow_client))
9567 return;
9568
9571
9573
9574 m_VarWet = Math.Clamp(value, min, max);
9575
9577 {
9580 }
9581 }
9582
9583 override void AddWet(
float value)
9584 {
9586 }
9587
9589 {
9591 }
9592
9594 {
9596 }
9597
9599 {
9601 }
9602
9604 {
9606 }
9607
9609 {
9611 }
9612
9614 {
9617 if (newLevel != oldLevel)
9618 {
9620 }
9621 }
9622
9624 {
9625 SetWeightDirty();
9626 }
9627
9629 {
9630 return GetWetLevelInternal(
m_VarWet);
9631 }
9632
9633
9634
9636 {
9638 }
9639
9641 {
9643 }
9644
9646 {
9648 }
9649
9651 {
9653 }
9654
9655
9656
9658 {
9659 if (ConfigIsExisting("itemModelLength"))
9660 {
9661 return ConfigGetFloat("itemModelLength");
9662 }
9663 return 0;
9664 }
9665
9667 {
9668 if (ConfigIsExisting("itemAttachOffset"))
9669 {
9670 return ConfigGetFloat("itemAttachOffset");
9671 }
9672 return 0;
9673 }
9674
9675 override void SetCleanness(
int value,
bool allow_client =
false)
9676 {
9677 if (!IsServerCheck(allow_client))
9678 return;
9679
9681
9683
9686 }
9687
9689 {
9691 }
9692
9694 {
9695 return true;
9696 }
9697
9698
9699
9700
9702 {
9704 }
9705
9707 {
9709 }
9710
9711
9712
9713
9714 override void SetColor(
int r,
int g,
int b,
int a)
9715 {
9721 }
9723 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9724 {
9729 }
9730
9732 {
9734 }
9735
9738 {
9739 int r,g,b,a;
9741 r = r/255;
9742 g = g/255;
9743 b = b/255;
9744 a = a/255;
9745 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9746 }
9747
9748
9749
9750 override void SetLiquidType(
int value,
bool allow_client =
false)
9751 {
9752 if (!IsServerCheck(allow_client))
9753 return;
9754
9759 }
9760
9762 {
9763 return ConfigGetInt("varLiquidTypeInit");
9764 }
9765
9767 {
9769 }
9770
9772 {
9774 SetFrozen(false);
9775 }
9776
9779 {
9780 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9781 }
9782
9783
9786 {
9787 PlayerBase nplayer;
9788 if (PlayerBase.CastTo(nplayer, player))
9789 {
9791 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9792 }
9793 }
9794
9795
9798 {
9799 PlayerBase nplayer;
9800 if (PlayerBase.CastTo(nplayer,player))
9801 {
9802 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9803 }
9804
9805 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9806
9807 if (HasEnergyManager())
9808 {
9809 GetCompEM().UpdatePlugState();
9810 }
9811 }
9812
9813
9815 {
9816 super.OnPlacementStarted(player);
9817
9819 }
9820
9821 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9822 {
9824 {
9825 m_AdminLog.OnPlacementComplete(player,
this);
9826 }
9827
9828 super.OnPlacementComplete(player, position, orientation);
9829 }
9830
9831
9832
9833
9834
9836 {
9838 {
9839 return true;
9840 }
9841 else
9842 {
9843 return false;
9844 }
9845 }
9846
9847
9849 {
9851 {
9853 }
9854 }
9855
9856
9858 {
9860 }
9861
9863 {
9865 }
9866
9867 override void InsertAgent(
int agent,
float count = 1)
9868 {
9869 if (count < 1)
9870 return;
9871
9873 }
9874
9877 {
9879 }
9880
9881
9883 {
9885 }
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9929 {
9931 return false;
9932 return true;
9933 }
9934
9936 {
9937
9939 }
9940
9941
9944 {
9945 super.CheckForRoofLimited(timeTresholdMS);
9946
9947 float time =
g_Game.GetTime();
9948 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9949 {
9950 m_PreviousRoofTestTime = time;
9951 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9952 }
9953 }
9954
9955
9957 {
9959 {
9960 return 0;
9961 }
9962
9963 if (GetInventory().GetAttachmentSlotsCount() != 0)
9964 {
9965 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9966 if (filter)
9967 return filter.GetProtectionLevel(type, false, system);
9968 else
9969 return 0;
9970 }
9971
9972 string subclassPath, entryName;
9973
9974 switch (type)
9975 {
9977 entryName = "biological";
9978 break;
9980 entryName = "chemical";
9981 break;
9982 default:
9983 entryName = "biological";
9984 break;
9985 }
9986
9987 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9988
9989 return g_Game.ConfigGetFloat(subclassPath + entryName);
9990 }
9991
9992
9993
9996 {
9997 if (!IsMagazine())
9999
10001 }
10002
10003
10004
10005
10006
10011 {
10012 return true;
10013 }
10014
10016 {
10018 }
10019
10020
10021
10022
10023
10025 {
10026 if (parent)
10027 {
10028 if (parent.IsInherited(DayZInfected))
10029 return true;
10030
10031 if (!parent.IsRuined())
10032 return true;
10033 }
10034
10035 return true;
10036 }
10037
10039 {
10040 if (!super.CanPutAsAttachment(parent))
10041 {
10042 return false;
10043 }
10044
10045 if (!IsRuined() && !parent.IsRuined())
10046 {
10047 return true;
10048 }
10049
10050 return false;
10051 }
10052
10054 {
10055
10056
10057
10058
10059 return super.CanReceiveItemIntoCargo(item);
10060 }
10061
10063 {
10064
10065
10066
10067
10068 GameInventory attachmentInv = attachment.GetInventory();
10070 {
10071 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10072 return false;
10073 }
10074
10075 InventoryLocation loc = new InventoryLocation();
10076 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10077 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10078 return false;
10079
10080 return super.CanReceiveAttachment(attachment, slotId);
10081 }
10082
10084 {
10085 if (!super.CanReleaseAttachment(attachment))
10086 return false;
10087
10088 return GetInventory().AreChildrenAccessible();
10089 }
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10112 {
10113 int id = muzzle_owner.GetMuzzleID();
10114 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10115
10116 if (WPOF_array)
10117 {
10118 for (int i = 0; i < WPOF_array.Count(); i++)
10119 {
10120 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10121
10122 if (WPOF)
10123 {
10124 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10125 }
10126 }
10127 }
10128 }
10129
10130
10132 {
10133 int id = muzzle_owner.GetMuzzleID();
10135
10136 if (WPOBE_array)
10137 {
10138 for (int i = 0; i < WPOBE_array.Count(); i++)
10139 {
10140 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10141
10142 if (WPOBE)
10143 {
10144 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10145 }
10146 }
10147 }
10148 }
10149
10150
10152 {
10153 int id = muzzle_owner.GetMuzzleID();
10154 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10155
10156 if (WPOOH_array)
10157 {
10158 for (int i = 0; i < WPOOH_array.Count(); i++)
10159 {
10160 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10161
10162 if (WPOOH)
10163 {
10164 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10165 }
10166 }
10167 }
10168 }
10169
10170
10172 {
10173 int id = muzzle_owner.GetMuzzleID();
10174 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10175
10176 if (WPOOH_array)
10177 {
10178 for (int i = 0; i < WPOOH_array.Count(); i++)
10179 {
10180 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10181
10182 if (WPOOH)
10183 {
10184 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10185 }
10186 }
10187 }
10188 }
10189
10190
10192 {
10193 int id = muzzle_owner.GetMuzzleID();
10194 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10195
10196 if (WPOOH_array)
10197 {
10198 for (int i = 0; i < WPOOH_array.Count(); i++)
10199 {
10200 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10201
10202 if (WPOOH)
10203 {
10204 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10205 }
10206 }
10207 }
10208 }
10209
10210
10211
10213 {
10215 {
10216 return true;
10217 }
10218
10219 return false;
10220 }
10221
10223 {
10225 {
10226 return true;
10227 }
10228
10229 return false;
10230 }
10231
10233 {
10235 {
10236 return true;
10237 }
10238
10239 return false;
10240 }
10241
10243 {
10244 return false;
10245 }
10246
10249 {
10250 return UATimeSpent.DEFAULT_DEPLOY;
10251 }
10252
10253
10254
10255
10257 {
10259 SetSynchDirty();
10260 }
10261
10263 {
10265 }
10266
10267
10269 {
10270 return false;
10271 }
10272
10275 {
10276 string att_type = "None";
10277
10278 if (ConfigIsExisting("soundAttType"))
10279 {
10280 att_type = ConfigGetString("soundAttType");
10281 }
10282
10284 }
10285
10287 {
10289 }
10290
10291
10292
10293
10294
10300
10302 {
10305
10307 }
10308
10309
10311 {
10313 return;
10314
10316
10319
10322
10323 SoundParameters params = new SoundParameters();
10327 }
10328
10329
10331 {
10333 {
10336
10337 SetSynchDirty();
10338
10341 }
10342 }
10343
10345 {
10347 }
10348
10349
10351 {
10353 return;
10354
10356 SetSynchDirty();
10357
10360 }
10361
10363 {
10366 }
10367
10369 {
10371 }
10372
10373 void OnApply(PlayerBase player);
10374
10376 {
10377 return 1.0;
10378 };
10379
10381 {
10383 }
10384
10386 {
10388 }
10389
10391
10393 {
10394 SetDynamicPhysicsLifeTime(0.01);
10396 }
10397
10399 {
10400 array<string> zone_names = new array<string>;
10401 GetDamageZones(zone_names);
10402 for (int i = 0; i < zone_names.Count(); i++)
10403 {
10404 SetHealthMax(zone_names.Get(i),"Health");
10405 }
10406 SetHealthMax("","Health");
10407 }
10408
10411 {
10412 float global_health = GetHealth01("","Health");
10413 array<string> zones = new array<string>;
10414 GetDamageZones(zones);
10415
10416 for (int i = 0; i < zones.Count(); i++)
10417 {
10418 SetHealth01(zones.Get(i),"Health",global_health);
10419 }
10420 }
10421
10424 {
10425 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10426 }
10427
10429 {
10430 if (!hasRootAsPlayer)
10431 {
10432 if (refParentIB)
10433 {
10434
10435 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10436 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10437
10438 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10439 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10440
10443 }
10444 else
10445 {
10446
10449 }
10450 }
10451 }
10452
10454 {
10456 {
10457 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10458 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10459 {
10460 float heatPermCoef = 1.0;
10462 while (ent)
10463 {
10464 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10465 ent = ent.GetHierarchyParent();
10466 }
10467
10468 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10469 }
10470 }
10471 }
10472
10474 {
10475
10476 EntityAI parent = GetHierarchyParent();
10477 if (!parent)
10478 {
10479 hasParent = false;
10480 hasRootAsPlayer = false;
10481 }
10482 else
10483 {
10484 hasParent = true;
10485 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10486 refParentIB =
ItemBase.Cast(parent);
10487 }
10488 }
10489
10490 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10491 {
10492
10493 }
10494
10496 {
10497
10498 return false;
10499 }
10500
10502 {
10503
10504
10505 return false;
10506 }
10507
10509 {
10510
10511 return false;
10512 }
10513
10516 {
10517 return !GetIsFrozen() &&
IsOpen();
10518 }
10519
10521 {
10522 bool hasParent = false, hasRootAsPlayer = false;
10524
10525 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10526 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10527
10528 if (wwtu || foodDecay)
10529 {
10533
10534 if (processWetness || processTemperature || processDecay)
10535 {
10537
10538 if (processWetness)
10539 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10540
10541 if (processTemperature)
10543
10544 if (processDecay)
10545 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10546 }
10547 }
10548 }
10549
10552 {
10554 }
10555
10557 {
10560
10561 return super.GetTemperatureFreezeThreshold();
10562 }
10563
10565 {
10568
10569 return super.GetTemperatureThawThreshold();
10570 }
10571
10573 {
10576
10577 return super.GetItemOverheatThreshold();
10578 }
10579
10581 {
10583 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10584
10585 return super.GetTemperatureFreezeTime();
10586 }
10587
10589 {
10591 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10592
10593 return super.GetTemperatureThawTime();
10594 }
10595
10600
10602 {
10603 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10604 }
10605
10607 {
10608 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10609 }
10610
10613 {
10615 }
10616
10618 {
10620 }
10621
10623 {
10625 }
10626
10629 {
10630 return null;
10631 }
10632
10635 {
10636 return false;
10637 }
10638
10640 {
10642 {
10645 if (!trg)
10646 {
10648 explosive = this;
10649 }
10650
10651 explosive.PairRemote(trg);
10653
10654 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10655 trg.SetPersistentPairID(persistentID);
10656 explosive.SetPersistentPairID(persistentID);
10657
10658 return true;
10659 }
10660 return false;
10661 }
10662
10665 {
10666 float ret = 1.0;
10669 ret *= GetHealth01();
10670
10671 return ret;
10672 }
10673
10674 #ifdef DEVELOPER
10675 override void SetDebugItem()
10676 {
10677 super.SetDebugItem();
10678 _itemBase = this;
10679 }
10680
10682 {
10683 string text = super.GetDebugText();
10684
10686 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10687
10688 return text;
10689 }
10690 #endif
10691
10693 {
10694 return true;
10695 }
10696
10698
10700
10702 {
10705 }
10706
10707
10715
10731
10732 [
Obsolete(
"Use ItemSoundHandler instead")]
10735 {
10736 if (!
g_Game.IsDedicatedServer())
10737 {
10738 if (ConfigIsExisting("attachSoundSet"))
10739 {
10740 string cfg_path = "";
10741 string soundset = "";
10742 string type_name =
GetType();
10743
10746 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10747 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10748
10749 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10750 {
10751 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10752 {
10753 if (cfg_slot_array[i] == slot_type)
10754 {
10755 soundset = cfg_soundset_array[i];
10756 break;
10757 }
10758 }
10759 }
10760
10761 if (soundset != "")
10762 {
10763 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10765 }
10766 }
10767 }
10768 }
10769
10771}
10772
10774{
10776 if (entity)
10777 {
10778 bool is_item = entity.IsInherited(
ItemBase);
10779 if (is_item && full_quantity)
10780 {
10783 }
10784 }
10785 else
10786 {
10788 return NULL;
10789 }
10790 return entity;
10791}
10792
10794{
10795 if (item)
10796 {
10797 if (health > 0)
10798 item.SetHealth("", "", health);
10799
10800 if (item.CanHaveTemperature())
10801 {
10803 if (item.CanFreeze())
10804 item.SetFrozen(false);
10805 }
10806
10807 if (item.HasEnergyManager())
10808 {
10809 if (quantity >= 0)
10810 {
10811 item.GetCompEM().SetEnergy0To1(quantity);
10812 }
10813 else
10814 {
10816 }
10817 }
10818 else if (item.IsMagazine())
10819 {
10820 Magazine mag = Magazine.Cast(item);
10821 if (quantity >= 0)
10822 {
10823 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10824 }
10825 else
10826 {
10828 }
10829
10830 }
10831 else
10832 {
10833 if (quantity >= 0)
10834 {
10835 item.SetQuantityNormalized(quantity, false);
10836 }
10837 else
10838 {
10840 }
10841
10842 }
10843 }
10844}
10845
10846#ifdef DEVELOPER
10848#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.