5900{
5902 {
5903 return true;
5904 }
5905};
5906
5908{
5909
5910};
5911
5912
5913
5915{
5919
5921
5924
5925
5926
5927
5928
5937
5943
5948
5953
5974 protected bool m_IsResultOfSplit
5975
5977
5982
5983
5984
5986
5990
5991
5992
5994
5997
5998
5999
6005
6006
6014
6017
6018
6020
6021
6023
6024
6029
6030
6035
6037
6038
6040
6041
6043 {
6048
6049 if (!
g_Game.IsDedicatedServer())
6050 {
6052 {
6054
6056 {
6058 }
6059 }
6060
6063 }
6064
6065 m_OldLocation = null;
6066
6068 {
6070 }
6071
6072 if (ConfigIsExisting("headSelectionsToHide"))
6073 {
6076 }
6077
6079 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6080 {
6082 }
6083
6085
6086 m_IsResultOfSplit = false;
6087
6089 }
6090
6092 {
6093 super.InitItemVariables();
6094
6100 m_Count = ConfigGetInt(
"count");
6101
6104
6109
6112
6117
6129
6133
6134
6137 if (ConfigIsExisting("canBeSplit"))
6138 {
6141 }
6142
6144 if (ConfigIsExisting("itemBehaviour"))
6146
6147
6150 RegisterNetSyncVariableInt("m_VarLiquidType");
6151 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6152
6153 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6154 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6155 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6156
6157 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6158 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6159 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6160 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6161
6162 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6163 RegisterNetSyncVariableBool("m_IsTakeable");
6164 RegisterNetSyncVariableBool("m_IsHologram");
6165
6168 {
6171 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6172 }
6173
6175
6177 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6179
6181 }
6182
6184 {
6186 }
6187
6189 {
6192 {
6197 }
6198 }
6199
6200 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6201 {
6203 {
6206 }
6207
6209 }
6210
6212 {
6218 }
6219
6221
6223 {
6225
6226 if (!action)
6227 {
6228 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6229 return;
6230 }
6231
6233 if (!ai)
6234 {
6236 return;
6237 }
6238
6240 if (!action_array)
6241 {
6242 action_array = new array<ActionBase_Basic>;
6244 }
6245 if (LogManager.IsActionLogEnable())
6246 {
6247 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6248 }
6249
6250 if (action_array.Find(action) != -1)
6251 {
6252 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6253 }
6254 else
6255 {
6256 action_array.Insert(action);
6257 }
6258 }
6259
6261 {
6262 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6263 ActionBase action = player.GetActionManager().GetAction(actionName);
6266
6267 if (action_array)
6268 {
6269 action_array.RemoveItem(action);
6270 }
6271 }
6272
6273
6274
6276 {
6277 ActionOverrideData overrideData = new ActionOverrideData();
6281
6283 if (!actionMap)
6284 {
6287 }
6288
6289 actionMap.Insert(this.
Type(), overrideData);
6290
6291 }
6292
6294
6296
6297
6299 {
6302
6305
6306 string config_to_search = "CfgVehicles";
6307 string muzzle_owner_config;
6308
6310 {
6311 if (IsInherited(Weapon))
6312 config_to_search = "CfgWeapons";
6313
6314 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6315
6316 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6317
6318 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6319
6320 if (config_OnFire_subclass_count > 0)
6321 {
6322 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6323
6324 for (int i = 0; i < config_OnFire_subclass_count; i++)
6325 {
6326 string particle_class = "";
6327 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6328 string config_OnFire_entry = config_OnFire_class + particle_class;
6329 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6330 WPOF_array.Insert(WPOF);
6331 }
6332
6333
6335 }
6336 }
6337
6339 {
6340 config_to_search = "CfgWeapons";
6341 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6342
6343 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6344
6345 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6346
6347 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6348 {
6349 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6350
6351 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6352 {
6353 string particle_class2 = "";
6354 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6355 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6356 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6357 WPOBE_array.Insert(WPOBE);
6358 }
6359
6360
6362 }
6363 }
6364 }
6365
6366
6368 {
6371
6373 {
6374 string config_to_search = "CfgVehicles";
6375
6376 if (IsInherited(Weapon))
6377 config_to_search = "CfgWeapons";
6378
6379 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6380 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6381
6382 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6383 {
6384
6386
6388 {
6390 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6392 return;
6393 }
6394
6397
6398
6399
6400 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6401 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6402
6403 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6404 {
6405 string particle_class = "";
6406 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6407 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6408 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6409
6410 if (entry_type == CT_CLASS)
6411 {
6412 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6413 WPOOH_array.Insert(WPOF);
6414 }
6415 }
6416
6417
6419 }
6420 }
6421 }
6422
6424 {
6426 }
6427
6429 {
6431 {
6433
6436
6439
6440 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6441 }
6442 }
6443
6445 {
6447 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6448
6450 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6451
6453 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6454
6456 {
6458 }
6459 }
6460
6462 {
6464 }
6465
6467 {
6470 else
6472
6474 {
6477 }
6478 else
6479 {
6482
6485 }
6486
6488 }
6489
6491 {
6493 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6494 }
6495
6497 {
6499 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6501 }
6502
6504 {
6506 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6507 }
6508
6510 {
6513
6514 OverheatingParticle OP = new OverheatingParticle();
6519
6521 }
6522
6524 {
6527
6528 return -1;
6529 }
6530
6532 {
6534 {
6537
6538 for (int i = count; i > 0; --i)
6539 {
6540 int id = i - 1;
6543
6546
6547 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6548 {
6549 if (p)
6550 {
6553 }
6554 }
6555 }
6556 }
6557 }
6558
6560 {
6562 {
6564 {
6565 int id = i - 1;
6567
6568 if (OP)
6569 {
6571
6572 if (p)
6573 {
6575 }
6576
6577 delete OP;
6578 }
6579 }
6580
6583 }
6584 }
6585
6588 {
6589 return 0.0;
6590 }
6591
6592
6594 {
6595 return 250;
6596 }
6597
6599 {
6600 return 0;
6601 }
6602
6605 {
6607 return true;
6608
6609 return false;
6610 }
6611
6614 {
6617
6619 {
6621 }
6622 else
6623 {
6624
6626 }
6627
6629 }
6630
6637 {
6638 return -1;
6639 }
6640
6641
6642
6643
6645 {
6647 {
6648 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6649 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6650
6651 if (r_index >= 0)
6652 {
6653 InventoryLocation r_il = new InventoryLocation;
6654 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6655
6656 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6659 {
6660 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6661 }
6663 {
6664 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6665 }
6666
6667 }
6668
6669 player.GetHumanInventory().ClearUserReservedLocation(this);
6670 }
6671
6674 }
6675
6676
6677
6678
6680 {
6681 return ItemBase.m_DebugActionsMask;
6682 }
6683
6685 {
6686 return ItemBase.m_DebugActionsMask & mask;
6687 }
6688
6690 {
6691 ItemBase.m_DebugActionsMask = mask;
6692 }
6693
6695 {
6696 ItemBase.m_DebugActionsMask |= mask;
6697 }
6698
6700 {
6701 ItemBase.m_DebugActionsMask &= ~mask;
6702 }
6703
6705 {
6707 {
6709 }
6710 else
6711 {
6713 }
6714 }
6715
6716
6718 {
6719 if (GetEconomyProfile())
6720 {
6721 float q_max = GetEconomyProfile().GetQuantityMax();
6722 if (q_max > 0)
6723 {
6724 float q_min = GetEconomyProfile().GetQuantityMin();
6725 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6726
6728 {
6729 ComponentEnergyManager comp = GetCompEM();
6731 {
6733 }
6734 }
6736 {
6738
6739 }
6740
6741 }
6742 }
6743 }
6744
6747 {
6748 EntityAI parent = GetHierarchyParent();
6749
6750 if (parent)
6751 {
6752 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6753 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6754 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6755 }
6756 }
6757
6760 {
6761 EntityAI parent = GetHierarchyParent();
6762
6763 if (parent)
6764 {
6765 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6766 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6767 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6768 }
6769 }
6770
6772 {
6773
6774
6775
6776
6778
6780 {
6781 if (ScriptInputUserData.CanStoreInputUserData())
6782 {
6783 ScriptInputUserData ctx = new ScriptInputUserData;
6789 ctx.
Write(use_stack_max);
6792
6794 {
6795 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6796 }
6797 }
6798 }
6799 else if (!
g_Game.IsMultiplayer())
6800 {
6802 }
6803 }
6804
6806 {
6808 }
6809
6811 {
6813 }
6814
6816 {
6818 }
6819
6821 {
6822
6823 return false;
6824 }
6825
6827 {
6828 return false;
6829 }
6830
6834 {
6835 return false;
6836 }
6837
6839 {
6840 return "";
6841 }
6842
6844
6846 {
6847 return false;
6848 }
6849
6851 {
6852 return true;
6853 }
6854
6855
6856
6858 {
6859 return true;
6860 }
6861
6863 {
6864 return true;
6865 }
6866
6868 {
6869 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6871 }
6872
6874 {
6876 }
6877
6879 {
6881 if (!is_being_placed)
6883 SetSynchDirty();
6884 }
6885
6886
6888
6890 {
6892 }
6893
6895 {
6897 }
6898
6900 {
6901 return 1;
6902 }
6903
6905 {
6906 return false;
6907 }
6908
6910 {
6912 SetSynchDirty();
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
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6950 {
6951 super.OnMovedInsideCargo(container);
6952
6953 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6954 }
6955
6956 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6957 {
6958 super.EEItemLocationChanged(oldLoc, newLoc);
6959
6960 PlayerBase newPlayer = null;
6961 PlayerBase oldPlayer = null;
6962
6963 if (newLoc.GetParent())
6964 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6965
6966 if (oldLoc.GetParent())
6967 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6968
6970 {
6971 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6972
6973 if (rIndex >= 0)
6974 {
6975 InventoryLocation rIl = new InventoryLocation;
6976 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6977
6978 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6981 {
6982 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6983 }
6985 {
6987 }
6988
6989 }
6990 }
6991
6993 {
6994 if (newPlayer)
6995 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6996
6997 if (newPlayer == oldPlayer)
6998 {
6999 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7000 {
7002 {
7003 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7004 {
7005 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7006 }
7007 }
7008 else
7009 {
7010 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7011 }
7012 }
7013
7014 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7015 {
7016 int type = oldLoc.GetType();
7018 {
7019 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7020 }
7022 {
7023 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7024 }
7025 }
7026 if (!m_OldLocation)
7027 {
7028 m_OldLocation = new InventoryLocation;
7029 }
7030 m_OldLocation.Copy(oldLoc);
7031 }
7032 else
7033 {
7034 if (m_OldLocation)
7035 {
7036 m_OldLocation.Reset();
7037 }
7038 }
7039
7040 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7041 }
7042 else
7043 {
7044 if (newPlayer)
7045 {
7046 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7047 if (resIndex >= 0)
7048 {
7049 InventoryLocation il = new InventoryLocation;
7050 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7052 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7055 {
7056 il.
GetParent().GetOnReleaseLock().Invoke(it);
7057 }
7059 {
7061 }
7062
7063 }
7064 }
7066 {
7067
7069 }
7070
7071 if (m_OldLocation)
7072 {
7073 m_OldLocation.Reset();
7074 }
7075 }
7076
7078 {
7079 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7080 }
7081
7083 {
7084 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7085 }
7086 }
7087
7088 override void EOnContact(IEntity other, Contact extra)
7089 {
7091 {
7092 int liquidType = -1;
7094 if (impactSpeed > 0.0)
7095 {
7097 #ifndef SERVER
7099 #else
7101 SetSynchDirty();
7102 #endif
7104 }
7105 }
7106
7107 #ifdef SERVER
7108 if (GetCompEM() && GetCompEM().IsPlugged())
7109 {
7110 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7111 GetCompEM().UnplugThis();
7112 }
7113 #endif
7114 }
7115
7117
7119 {
7121 }
7122
7124 {
7125
7126 }
7127
7129 {
7130 super.OnItemLocationChanged(old_owner, new_owner);
7131
7132 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7133 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7134
7135 if (!relatedPlayer && playerNew)
7136 relatedPlayer = playerNew;
7137
7138 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7139 {
7141 if (actionMgr)
7142 {
7143 ActionBase currentAction = actionMgr.GetRunningAction();
7144 if (currentAction)
7146 }
7147 }
7148
7149 Man ownerPlayerOld = null;
7150 Man ownerPlayerNew = null;
7151
7152 if (old_owner)
7153 {
7154 if (old_owner.
IsMan())
7155 {
7156 ownerPlayerOld = Man.Cast(old_owner);
7157 }
7158 else
7159 {
7160 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7161 }
7162 }
7163 else
7164 {
7166 {
7168
7169 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7170 {
7171 GetCompEM().UnplugThis();
7172 }
7173 }
7174 }
7175
7176 if (new_owner)
7177 {
7178 if (new_owner.
IsMan())
7179 {
7180 ownerPlayerNew = Man.Cast(new_owner);
7181 }
7182 else
7183 {
7184 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7185 }
7186 }
7187
7188 if (ownerPlayerOld != ownerPlayerNew)
7189 {
7190 if (ownerPlayerOld)
7191 {
7192 array<EntityAI> subItemsExit = new array<EntityAI>;
7194 for (int i = 0; i < subItemsExit.Count(); i++)
7195 {
7198 }
7199 }
7200
7201 if (ownerPlayerNew)
7202 {
7203 array<EntityAI> subItemsEnter = new array<EntityAI>;
7205 for (int j = 0; j < subItemsEnter.Count(); j++)
7206 {
7209 }
7210 }
7211 }
7212 else if (ownerPlayerNew != null)
7213 {
7214 PlayerBase nplayer;
7215 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7216 {
7217 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7219 for (int k = 0; k < subItemsUpdate.Count(); k++)
7220 {
7222 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7223 }
7224 }
7225 }
7226
7227 if (old_owner)
7228 old_owner.OnChildItemRemoved(this);
7229 if (new_owner)
7230 new_owner.OnChildItemReceived(this);
7231 }
7232
7233
7235 {
7236 super.EEDelete(parent);
7237 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7238 if (player)
7239 {
7241
7242 if (player.IsAlive())
7243 {
7244 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7245 if (r_index >= 0)
7246 {
7247 InventoryLocation r_il = new InventoryLocation;
7248 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7249
7250 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7253 {
7254 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7255 }
7257 {
7258 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7259 }
7260
7261 }
7262
7263 player.RemoveQuickBarEntityShortcut(this);
7264 }
7265 }
7266 }
7267
7269 {
7270 super.EEKilled(killer);
7271
7274 {
7275 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7276 {
7277 if (IsMagazine())
7278 {
7279 if (Magazine.Cast(this).GetAmmoCount() > 0)
7280 {
7282 }
7283 }
7284 else
7285 {
7287 }
7288 }
7289 }
7290 }
7291
7293 {
7294 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7295
7296 super.OnWasAttached(parent, slot_id);
7297
7300
7303 }
7304
7306 {
7307 super.OnWasDetached(parent, slot_id);
7308
7311
7314 }
7315
7317 {
7318 int idx;
7321
7322 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7323 if (inventory_slots.Count() < 1)
7324 {
7325 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7326 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7327 }
7328 else
7329 {
7330 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7331 }
7332
7333 idx = inventory_slots.Find(slot);
7334 if (idx < 0)
7335 return "";
7336
7337 return attach_types.Get(idx);
7338 }
7339
7341 {
7342 int idx = -1;
7343 string slot;
7344
7347
7348 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7349 if (inventory_slots.Count() < 1)
7350 {
7351 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7352 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7353 }
7354 else
7355 {
7356 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7357 if (detach_types.Count() < 1)
7358 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7359 }
7360
7361 for (int i = 0; i < inventory_slots.Count(); i++)
7362 {
7363 slot = inventory_slots.Get(i);
7364 }
7365
7366 if (slot != "")
7367 {
7368 if (detach_types.Count() == 1)
7369 idx = 0;
7370 else
7371 idx = inventory_slots.Find(slot);
7372 }
7373 if (idx < 0)
7374 return "";
7375
7376 return detach_types.Get(idx);
7377 }
7378
7380 {
7381
7383
7384
7385 float min_time = 1;
7386 float max_time = 3;
7387 float delay = Math.RandomFloat(min_time, max_time);
7388
7389 explode_timer.Run(delay, this, "DoAmmoExplosion");
7390 }
7391
7393 {
7394 Magazine magazine = Magazine.Cast(this);
7395 int pop_sounds_count = 6;
7396 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7397
7398
7399 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7400 string sound_name = pop_sounds[ sound_idx ];
7401 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7402
7403
7404 magazine.ServerAddAmmoCount(-1);
7405
7406
7407 float min_temp_to_explode = 100;
7408
7409 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7410 {
7412 }
7413 }
7414
7415
7416 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7417 {
7418 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7419
7420 const int CHANCE_DAMAGE_CARGO = 4;
7421 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7422 const int CHANCE_DAMAGE_NOTHING = 2;
7423
7425 {
7426 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7427 int chances;
7428 int rnd;
7429
7430 if (GetInventory().GetCargo())
7431 {
7432 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7433 rnd = Math.RandomInt(0,chances);
7434
7435 if (rnd < CHANCE_DAMAGE_CARGO)
7436 {
7438 }
7439 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7440 {
7442 }
7443 }
7444 else
7445 {
7446 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7447 rnd = Math.RandomInt(0,chances);
7448
7449 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7450 {
7452 }
7453 }
7454 }
7455 }
7456
7458 {
7459 CargoBase cargo = GetInventory().GetCargo();
7460 if (cargo)
7461 {
7463 if (item_count > 0)
7464 {
7465 int random_pick = Math.RandomInt(0, item_count);
7467 if (!item.IsExplosive())
7468 {
7469 item.AddHealth("","",damage);
7470 return true;
7471 }
7472 }
7473 }
7474 return false;
7475 }
7476
7478 {
7479 GameInventory inventory = GetInventory();
7481 if (attachment_count > 0)
7482 {
7483 int random_pick = Math.RandomInt(0, attachment_count);
7485 if (!attachment.IsExplosive())
7486 {
7487 attachment.AddHealth("","",damage);
7488 return true;
7489 }
7490 }
7491 return false;
7492 }
7493
7495 {
7497 }
7498
7500 {
7502 return GetInventory().CanRemoveEntity();
7503
7504 return false;
7505 }
7506
7508 {
7509
7511 return false;
7512
7513
7515 return false;
7516
7517
7518
7520 if (delta == 0)
7521 return false;
7522
7523
7524 return true;
7525 }
7526
7528 {
7530 {
7531 if (ScriptInputUserData.CanStoreInputUserData())
7532 {
7533 ScriptInputUserData ctx = new ScriptInputUserData;
7538 ctx.
Write(destination_entity);
7542 }
7543 }
7544 else if (!
g_Game.IsMultiplayer())
7545 {
7547 }
7548 }
7549
7551 {
7552 float split_quantity_new;
7556 InventoryLocation loc = new InventoryLocation;
7557
7558 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7559 {
7561 split_quantity_new = stack_max;
7562 else
7564
7566 {
7567 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7568 if (new_item)
7569 {
7570 new_item.SetResultOfSplit(true);
7571 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7573 new_item.
SetQuantity(split_quantity_new,
false,
true);
7574 }
7575 }
7576 }
7577 else if (destination_entity && slot_id == -1)
7578 {
7579 if (quantity > stack_max)
7580 split_quantity_new = stack_max;
7581 else
7582 split_quantity_new = quantity;
7583
7585 {
7586 GameInventory destinationInventory = destination_entity.GetInventory();
7588 {
7591 }
7592
7593 if (new_item)
7594 {
7595 new_item.SetResultOfSplit(true);
7596 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7598 new_item.
SetQuantity(split_quantity_new,
false,
true);
7599 }
7600 }
7601 }
7602 else
7603 {
7604 if (stack_max != 0)
7605 {
7607 {
7609 }
7610
7611 if (split_quantity_new == 0)
7612 {
7613 if (!
g_Game.IsMultiplayer())
7614 player.PhysicalPredictiveDropItem(this);
7615 else
7616 player.ServerDropEntity(this);
7617 return;
7618 }
7619
7621 {
7623
7624 if (new_item)
7625 {
7626 new_item.SetResultOfSplit(true);
7627 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7630 new_item.PlaceOnSurface();
7631 }
7632 }
7633 }
7634 }
7635 }
7636
7638 {
7639 float split_quantity_new;
7643 InventoryLocation loc = new InventoryLocation;
7644
7645 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7646 {
7648 split_quantity_new = stack_max;
7649 else
7651
7653 {
7654 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7655 if (new_item)
7656 {
7657 new_item.SetResultOfSplit(true);
7658 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7660 new_item.
SetQuantity(split_quantity_new,
false,
true);
7661 }
7662 }
7663 }
7664 else if (destination_entity && slot_id == -1)
7665 {
7666 if (quantity > stack_max)
7667 split_quantity_new = stack_max;
7668 else
7669 split_quantity_new = quantity;
7670
7672 {
7673 GameInventory destinationInventory = destination_entity.GetInventory();
7675 {
7678 }
7679
7680 if (new_item)
7681 {
7682 new_item.SetResultOfSplit(true);
7683 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7685 new_item.
SetQuantity(split_quantity_new,
false,
true);
7686 }
7687 }
7688 }
7689 else
7690 {
7691 if (stack_max != 0)
7692 {
7694 {
7696 }
7697
7699 {
7701
7702 if (new_item)
7703 {
7704 new_item.SetResultOfSplit(true);
7705 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7708 new_item.PlaceOnSurface();
7709 }
7710 }
7711 }
7712 }
7713 }
7714
7716 {
7718 {
7719 if (ScriptInputUserData.CanStoreInputUserData())
7720 {
7721 ScriptInputUserData ctx = new ScriptInputUserData;
7726 dst.WriteToContext(ctx);
7728 }
7729 }
7730 else if (!
g_Game.IsMultiplayer())
7731 {
7733 }
7734 }
7735
7737 {
7739 {
7740 if (ScriptInputUserData.CanStoreInputUserData())
7741 {
7742 ScriptInputUserData ctx = new ScriptInputUserData;
7747 ctx.
Write(destination_entity);
7753 }
7754 }
7755 else if (!
g_Game.IsMultiplayer())
7756 {
7758 }
7759 }
7760
7762 {
7764 }
7765
7767 {
7769 float split_quantity_new;
7771 if (dst.IsValid())
7772 {
7773 int slot_id = dst.GetSlot();
7775
7776 if (quantity > stack_max)
7777 split_quantity_new = stack_max;
7778 else
7779 split_quantity_new = quantity;
7780
7782 {
7784
7785 if (new_item)
7786 {
7787 new_item.SetResultOfSplit(true);
7788 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7790 new_item.
SetQuantity(split_quantity_new,
false,
true);
7791 }
7792
7793 return new_item;
7794 }
7795 }
7796
7797 return null;
7798 }
7799
7801 {
7803 float split_quantity_new;
7805 if (destination_entity)
7806 {
7808 if (quantity > stackable)
7809 split_quantity_new = stackable;
7810 else
7811 split_quantity_new = quantity;
7812
7814 {
7815 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7816 if (new_item)
7817 {
7818 new_item.SetResultOfSplit(true);
7819 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7821 new_item.
SetQuantity(split_quantity_new,
false,
true);
7822 }
7823 }
7824 }
7825 }
7826
7828 {
7830 {
7831 if (ScriptInputUserData.CanStoreInputUserData())
7832 {
7833 ScriptInputUserData ctx = new ScriptInputUserData;
7838 ItemBase destination_entity =
this;
7839 ctx.
Write(destination_entity);
7843 }
7844 }
7845 else if (!
g_Game.IsMultiplayer())
7846 {
7848 }
7849 }
7850
7852 {
7854 float split_quantity_new;
7856 if (player)
7857 {
7859 if (quantity > stackable)
7860 split_quantity_new = stackable;
7861 else
7862 split_quantity_new = quantity;
7863
7865 {
7866 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7867 new_item =
ItemBase.Cast(in_hands);
7868 if (new_item)
7869 {
7870 new_item.SetResultOfSplit(true);
7871 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7873 new_item.SetQuantity(split_quantity_new, false, true);
7874 }
7875 }
7876 }
7877 }
7878
7880 {
7882 float split_quantity_new = Math.Floor(quantity * 0.5);
7883
7885 return;
7886
7888
7889 if (new_item)
7890 {
7891 if (new_item.GetQuantityMax() < split_quantity_new)
7892 {
7893 split_quantity_new = new_item.GetQuantityMax();
7894 }
7895
7896 new_item.SetResultOfSplit(true);
7897 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7898
7900 {
7903 }
7904 else
7905 {
7907 new_item.
SetQuantity(split_quantity_new,
false,
true);
7908 }
7909 }
7910 }
7911
7913 {
7915 float split_quantity_new = Math.Floor(quantity / 2);
7916
7918 return;
7919
7920 InventoryLocation invloc = new InventoryLocation;
7922
7924 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7925
7926 if (new_item)
7927 {
7928 if (new_item.GetQuantityMax() < split_quantity_new)
7929 {
7930 split_quantity_new = new_item.GetQuantityMax();
7931 }
7933 {
7936 }
7937 else if (split_quantity_new > 1)
7938 {
7940 new_item.
SetQuantity(split_quantity_new,
false,
true);
7941 }
7942 }
7943 }
7944
7947 {
7948 SetWeightDirty();
7950
7951 if (parent)
7952 parent.OnAttachmentQuantityChangedEx(this, delta);
7953
7955 {
7957 {
7959 }
7961 {
7962 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7964 }
7965 }
7966 }
7967
7970 {
7971
7972 }
7973
7976 {
7978 }
7979
7981 {
7982 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7983
7985 {
7986 if (newLevel == GameConstants.STATE_RUINED)
7987 {
7989 EntityAI parent = GetHierarchyParent();
7990 if (parent && parent.IsFireplace())
7991 {
7992 CargoBase cargo = GetInventory().GetCargo();
7993 if (cargo)
7994 {
7996 {
7998 }
7999 }
8000 }
8001 }
8002
8004 {
8005
8007 return;
8008 }
8009
8010 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8011 {
8013 }
8014 }
8015 }
8016
8017
8019 {
8020 super.OnRightClick();
8021
8023 {
8025 {
8026 if (ScriptInputUserData.CanStoreInputUserData())
8027 {
8028 EntityAI root = GetHierarchyRoot();
8029 Man playerOwner = GetHierarchyRootPlayer();
8030 InventoryLocation dst = new InventoryLocation;
8031
8032
8033 if (!playerOwner && root && root == this)
8034 {
8036 }
8037 else
8038 {
8039
8040 GetInventory().GetCurrentInventoryLocation(dst);
8042 {
8043 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8045 {
8047 }
8048 else
8049 {
8051
8052
8053 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8054 {
8056 }
8057 else
8058 {
8059 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8060 }
8061 }
8062 }
8063 }
8064
8065 ScriptInputUserData ctx = new ScriptInputUserData;
8073 }
8074 }
8075 else if (!
g_Game.IsMultiplayer())
8076 {
8078 }
8079 }
8080 }
8081
8083 {
8084 if (root)
8085 {
8086 vector m4[4];
8087 root.GetTransform(m4);
8088 dst.SetGround(this, m4);
8089 }
8090 else
8091 {
8092 GetInventory().GetCurrentInventoryLocation(dst);
8093 }
8094 }
8095
8096 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8097 {
8098
8099 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8100 return false;
8101
8102 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8103 return false;
8104
8105
8107 return false;
8108
8109
8110 Magazine mag = Magazine.Cast(this);
8111 if (mag)
8112 {
8113 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8114 return false;
8115
8116 if (stack_max_limit)
8117 {
8118 Magazine other_mag = Magazine.Cast(other_item);
8119 if (other_item)
8120 {
8121 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8122 return false;
8123 }
8124
8125 }
8126 }
8127 else
8128 {
8129
8131 return false;
8132
8134 return false;
8135 }
8136
8137 PlayerBase player = null;
8138 if (CastTo(player, GetHierarchyRootPlayer()))
8139 {
8140 if (player.GetInventory().HasAttachment(this))
8141 return false;
8142
8143 if (player.IsItemsToDelete())
8144 return false;
8145 }
8146
8147 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8148 return false;
8149
8150 int slotID;
8152 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8153 return false;
8154
8155 return true;
8156 }
8157
8159 {
8161 }
8162
8164 {
8165 return m_IsResultOfSplit;
8166 }
8167
8169 {
8170 m_IsResultOfSplit = value;
8171 }
8172
8174 {
8176 }
8177
8179 {
8180 float other_item_quantity = other_item.GetQuantity();
8181 float this_free_space;
8182
8184
8186
8187 if (other_item_quantity > this_free_space)
8188 {
8189 return this_free_space;
8190 }
8191 else
8192 {
8193 return other_item_quantity;
8194 }
8195 }
8196
8198 {
8200 }
8201
8203 {
8205 return;
8206
8207 if (!IsMagazine() && other_item)
8208 {
8210 if (quantity_used != 0)
8211 {
8212 float hp1 = GetHealth01("","");
8213 float hp2 = other_item.GetHealth01("","");
8214 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8215 hpResult = hpResult / (
GetQuantity() + quantity_used);
8216
8217 hpResult *= GetMaxHealth();
8218 Math.Round(hpResult);
8219 SetHealth("", "Health", hpResult);
8220
8222 other_item.AddQuantity(-quantity_used);
8223 }
8224 }
8226 }
8227
8229 {
8230 #ifdef SERVER
8231 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8232 GetHierarchyParent().IncreaseLifetimeUp();
8233 #endif
8234 };
8235
8237 {
8238 PlayerBase p = PlayerBase.Cast(player);
8239
8240 array<int> recipesIds = p.m_Recipes;
8241 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8242 if (moduleRecipesManager)
8243 {
8244 EntityAI itemInHands = player.GetEntityInHands();
8245 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8246 }
8247
8248 for (int i = 0;i < recipesIds.Count(); i++)
8249 {
8250 int key = recipesIds.Get(i);
8251 string recipeName = moduleRecipesManager.GetRecipeName(key);
8253 }
8254 }
8255
8256
8257 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8258 {
8259 super.GetDebugActions(outputList);
8260
8261
8267
8268
8273
8278
8279
8283
8284
8286 {
8290 }
8291
8294
8295
8299
8301
8302 InventoryLocation loc = new InventoryLocation();
8303 GetInventory().GetCurrentInventoryLocation(loc);
8305 {
8306 if (Gizmo_IsSupported())
8309 }
8310
8312 }
8313
8314
8315
8316
8318 {
8319 super.OnAction(action_id, player, ctx);
8320
8322 {
8323 switch (action_id)
8324 {
8328 return true;
8332 return true;
8333 }
8334 }
8335
8337 {
8338 switch (action_id)
8339 {
8341 Delete();
8342 return true;
8343 }
8344 }
8345
8346 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8347 {
8348 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8349 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8350 PlayerBase p = PlayerBase.Cast(player);
8351 if (
EActions.RECIPES_RANGE_START < 1000)
8352 {
8353 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8354 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8355 }
8356 }
8357 #ifndef SERVER
8358 else if (action_id ==
EActions.WATCH_PLAYER)
8359 {
8360 PluginDeveloper.SetDeveloperItemClientEx(player);
8361 }
8362 #endif
8364 {
8365 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8366 {
8367 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8368 OnDebugButtonPressServer(id + 1);
8369 }
8370
8371 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8372 {
8373 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8375 }
8376
8377 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8378 {
8379 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8381 }
8382
8383 else if (action_id ==
EActions.ADD_QUANTITY)
8384 {
8385 if (IsMagazine())
8386 {
8387 Magazine mag = Magazine.Cast(this);
8388 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8389 }
8390 else
8391 {
8393 }
8394
8395 if (m_EM)
8396 {
8397 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8398 }
8399
8400 }
8401
8402 else if (action_id ==
EActions.REMOVE_QUANTITY)
8403 {
8404 if (IsMagazine())
8405 {
8406 Magazine mag2 = Magazine.Cast(this);
8407 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8408 }
8409 else
8410 {
8412 }
8413 if (m_EM)
8414 {
8415 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8416 }
8417
8418 }
8419
8420 else if (action_id ==
EActions.SET_QUANTITY_0)
8421 {
8423
8424 if (m_EM)
8425 {
8426 m_EM.SetEnergy(0);
8427 }
8428 }
8429
8430 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8431 {
8433
8434 if (m_EM)
8435 {
8436 m_EM.SetEnergy(m_EM.GetEnergyMax());
8437 }
8438 }
8439
8440 else if (action_id ==
EActions.ADD_HEALTH)
8441 {
8442 AddHealth("","",GetMaxHealth("","Health")/5);
8443 }
8444 else if (action_id ==
EActions.REMOVE_HEALTH)
8445 {
8446 AddHealth("","",-GetMaxHealth("","Health")/5);
8447 }
8448 else if (action_id ==
EActions.DESTROY_HEALTH)
8449 {
8450 SetHealth01("","",0);
8451 }
8452 else if (action_id ==
EActions.WATCH_ITEM)
8453 {
8455 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8456 #ifdef DEVELOPER
8457 SetDebugDeveloper_item(this);
8458 #endif
8459 }
8460
8461 else if (action_id ==
EActions.ADD_TEMPERATURE)
8462 {
8463 AddTemperature(20);
8464
8465 }
8466
8467 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8468 {
8469 AddTemperature(-20);
8470
8471 }
8472
8473 else if (action_id ==
EActions.FLIP_FROZEN)
8474 {
8475 SetFrozen(!GetIsFrozen());
8476
8477 }
8478
8479 else if (action_id ==
EActions.ADD_WETNESS)
8480 {
8482
8483 }
8484
8485 else if (action_id ==
EActions.REMOVE_WETNESS)
8486 {
8488
8489 }
8490
8491 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8492 {
8495
8496
8497 }
8498
8499 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8500 {
8503 }
8504
8505 else if (action_id ==
EActions.MAKE_SPECIAL)
8506 {
8507 auto debugParams = DebugSpawnParams.WithPlayer(player);
8508 OnDebugSpawnEx(debugParams);
8509 }
8510
8511 }
8512
8513
8514 return false;
8515 }
8516
8517
8518
8519
8523
8526
8527
8528
8530 {
8531 return false;
8532 }
8533
8534
8536 {
8537 return true;
8538 }
8539
8540
8542 {
8543 return true;
8544 }
8545
8546
8547
8549 {
8550 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8551 return g_Game.ConfigIsExisting(config_path);
8552 }
8553
8556 {
8557 return null;
8558 }
8559
8561 {
8562 return false;
8563 }
8564
8566 {
8567 return false;
8568 }
8569
8573
8574
8576 {
8577 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8578 return module_repairing.CanRepair(this, item_repair_kit);
8579 }
8580
8581
8582 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8583 {
8584 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8585 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8586 }
8587
8588
8590 {
8591
8592
8593
8594
8595
8596
8597
8598
8599 return 1;
8600 }
8601
8602
8603
8605 {
8607 }
8608
8609
8610
8612 {
8614 }
8615
8616
8625 {
8626 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8627
8628 if (player)
8629 {
8630 player.MessageStatus(text);
8631 }
8632 }
8633
8634
8643 {
8644 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8645
8646 if (player)
8647 {
8648 player.MessageAction(text);
8649 }
8650 }
8651
8652
8661 {
8662 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8663
8664 if (player)
8665 {
8666 player.MessageFriendly(text);
8667 }
8668 }
8669
8670
8679 {
8680 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8681
8682 if (player)
8683 {
8684 player.MessageImportant(text);
8685 }
8686 }
8687
8689 {
8690 return true;
8691 }
8692
8693
8694 override bool KindOf(
string tag)
8695 {
8696 bool found = false;
8697 string item_name = this.
GetType();
8699 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8700
8701 int array_size = item_tag_array.Count();
8702 for (int i = 0; i < array_size; i++)
8703 {
8704 if (item_tag_array.Get(i) == tag)
8705 {
8706 found = true;
8707 break;
8708 }
8709 }
8710 return found;
8711 }
8712
8713
8715 {
8716
8717 super.OnRPC(sender, rpc_type,ctx);
8718
8719
8720 switch (rpc_type)
8721 {
8722 #ifndef SERVER
8723 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8724 Param2<bool, string> p = new Param2<bool, string>(false, "");
8725
8727 return;
8728
8729 bool play = p.param1;
8730 string soundSet = p.param2;
8731
8732 if (play)
8733 {
8735 {
8737 {
8739 }
8740 }
8741 else
8742 {
8744 }
8745 }
8746 else
8747 {
8749 }
8750
8751 break;
8752 #endif
8753
8754 }
8755
8757 {
8759 }
8760 }
8761
8762
8763
8764
8766 {
8767 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8768 return plugin.GetID(
name);
8769 }
8770
8772 {
8773 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8774 return plugin.GetName(id);
8775 }
8776
8779 {
8780
8781
8782 int varFlags;
8783 if (!ctx.
Read(varFlags))
8784 return;
8785
8786 if (varFlags & ItemVariableFlags.FLOAT)
8787 {
8789 }
8790 }
8791
8793 {
8794
8795 super.SerializeNumericalVars(floats_out);
8796
8797
8798
8800 {
8802 }
8803
8805 {
8807 }
8808
8810 {
8812 }
8813
8815 {
8820 }
8821
8823 {
8825 }
8826 }
8827
8829 {
8830
8831 super.DeSerializeNumericalVars(floats);
8832
8833
8834 int index = 0;
8835 int mask = Math.Round(floats.Get(index));
8836
8837 index++;
8838
8840 {
8842 {
8844 }
8845 else
8846 {
8847 float quantity = floats.Get(index);
8849 }
8850 index++;
8851 }
8852
8854 {
8855 float wet = floats.Get(index);
8857 index++;
8858 }
8859
8861 {
8862 int liquidtype = Math.Round(floats.Get(index));
8864 index++;
8865 }
8866
8868 {
8870 index++;
8872 index++;
8874 index++;
8876 index++;
8877 }
8878
8880 {
8881 int cleanness = Math.Round(floats.Get(index));
8883 index++;
8884 }
8885 }
8886
8888 {
8889 super.WriteVarsToCTX(ctx);
8890
8891
8893 {
8895 }
8896
8898 {
8900 }
8901
8903 {
8905 }
8906
8908 {
8909 int r,g,b,a;
8915 }
8916
8918 {
8920 }
8921 }
8922
8924 {
8925 if (!super.ReadVarsFromCTX(ctx,version))
8926 return false;
8927
8928 int intValue;
8929 float value;
8930
8931 if (version < 140)
8932 {
8933 if (!ctx.
Read(intValue))
8934 return false;
8935
8936 m_VariablesMask = intValue;
8937 }
8938
8940 {
8941 if (!ctx.
Read(value))
8942 return false;
8943
8945 {
8947 }
8948 else
8949 {
8951 }
8952 }
8953
8954 if (version < 140)
8955 {
8957 {
8958 if (!ctx.
Read(value))
8959 return false;
8960 SetTemperatureDirect(value);
8961 }
8962 }
8963
8965 {
8966 if (!ctx.
Read(value))
8967 return false;
8969 }
8970
8972 {
8973 if (!ctx.
Read(intValue))
8974 return false;
8976 }
8977
8979 {
8980 int r,g,b,a;
8982 return false;
8984 return false;
8986 return false;
8988 return false;
8989
8991 }
8992
8994 {
8995 if (!ctx.
Read(intValue))
8996 return false;
8998 }
8999
9000 if (version >= 138 && version < 140)
9001 {
9003 {
9004 if (!ctx.
Read(intValue))
9005 return false;
9006 SetFrozen(intValue);
9007 }
9008 }
9009
9010 return true;
9011 }
9012
9013
9015 {
9018 {
9020 }
9021
9022 if (!super.OnStoreLoad(ctx, version))
9023 {
9025 return false;
9026 }
9027
9028 if (version >= 114)
9029 {
9030 bool hasQuickBarIndexSaved;
9031
9032 if (!ctx.
Read(hasQuickBarIndexSaved))
9033 {
9035 return false;
9036 }
9037
9038 if (hasQuickBarIndexSaved)
9039 {
9040 int itmQBIndex;
9041
9042
9043 if (!ctx.
Read(itmQBIndex))
9044 {
9046 return false;
9047 }
9048
9049 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9050 if (itmQBIndex != -1 && parentPlayer)
9051 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9052 }
9053 }
9054 else
9055 {
9056
9057 PlayerBase player;
9058 int itemQBIndex;
9059 if (version ==
int.
MAX)
9060 {
9061 if (!ctx.
Read(itemQBIndex))
9062 {
9064 return false;
9065 }
9066 }
9067 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9068 {
9069
9070 if (!ctx.
Read(itemQBIndex))
9071 {
9073 return false;
9074 }
9075 if (itemQBIndex != -1 && player)
9076 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9077 }
9078 }
9079
9080 if (version < 140)
9081 {
9082
9083 if (!LoadVariables(ctx, version))
9084 {
9086 return false;
9087 }
9088 }
9089
9090
9092 {
9094 return false;
9095 }
9096 if (version >= 132)
9097 {
9099 if (raib)
9100 {
9102 {
9104 return false;
9105 }
9106 }
9107 }
9108
9110 return true;
9111 }
9112
9113
9114
9116 {
9117 super.OnStoreSave(ctx);
9118
9119 PlayerBase player;
9120 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9121 {
9123
9124 int itemQBIndex = -1;
9125 itemQBIndex = player.FindQuickBarEntityIndex(this);
9126 ctx.
Write(itemQBIndex);
9127 }
9128 else
9129 {
9131 }
9132
9134
9136 if (raib)
9137 {
9139 }
9140 }
9141
9142
9144 {
9145 super.AfterStoreLoad();
9146
9148 {
9150 }
9151
9153 {
9156 }
9157 }
9158
9160 {
9161 super.EEOnAfterLoad();
9162
9164 {
9166 }
9167
9170 }
9171
9173 {
9174 return false;
9175 }
9176
9177
9178
9180 {
9182 {
9183 #ifdef PLATFORM_CONSOLE
9184
9186 {
9188 if (menu)
9189 {
9191 }
9192 }
9193 #endif
9194 }
9195
9197 {
9200 }
9201
9203 {
9204 SetWeightDirty();
9206 }
9208 {
9211 }
9212
9214 {
9217
9220 }
9222 {
9226 }
9227
9228 super.OnVariablesSynchronized();
9229 }
9230
9231
9232
9234 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9235 {
9236 if (!IsServerCheck(allow_client))
9237 return false;
9238
9240 return false;
9241
9244
9245 if (value <= (min + 0.001))
9246 value = min;
9247
9248 if (value == min)
9249 {
9250 if (destroy_config)
9251 {
9252 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9253 if (dstr)
9254 {
9256 this.Delete();
9257 return true;
9258 }
9259 }
9260 else if (destroy_forced)
9261 {
9263 this.Delete();
9264 return true;
9265 }
9266
9268 }
9269
9272
9274 {
9275 EntityAI parent = GetHierarchyRoot();
9276 InventoryLocation iLoc = new InventoryLocation();
9277 GetInventory().GetCurrentInventoryLocation(iLoc);
9279 {
9280 int iLocSlot = iLoc.
GetSlot();
9282 {
9284 }
9286 {
9288 }
9289 }
9290 }
9291
9293 {
9295
9296 if (delta)
9298 }
9299
9301
9302 return false;
9303 }
9304
9305
9307 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9308 {
9310 }
9311
9313 {
9316 }
9317
9319 {
9322 }
9323
9325 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9326 {
9327 float value_clamped = Math.Clamp(value, 0, 1);
9329 SetQuantity(result, destroy_config, destroy_forced);
9330 }
9331
9332
9335 {
9337 }
9338
9340 {
9342 }
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9354 {
9355 int slot = -1;
9356 GameInventory inventory = GetInventory();
9357 if (inventory)
9358 {
9359 InventoryLocation il = new InventoryLocation;
9362 }
9363
9365 }
9366
9368 {
9369 float quantity_max = 0;
9370
9372 {
9373 if (attSlotID != -1)
9374 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9375
9376 if (quantity_max <= 0)
9378 }
9379
9380 if (quantity_max <= 0)
9382
9383 return quantity_max;
9384 }
9385
9387 {
9389 }
9390
9392 {
9394 }
9395
9396
9398 {
9400 }
9401
9403 {
9405 }
9406
9408 {
9410 }
9411
9412
9414 {
9415
9416 float weightEx = GetWeightEx();
9417 float special = GetInventoryAndCargoWeight();
9418 return weightEx - special;
9419 }
9420
9421
9423 {
9425 }
9426
9428 {
9430 {
9431 #ifdef DEVELOPER
9432 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9433 {
9434 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9436 }
9437 #endif
9438
9440 }
9441 else if (HasEnergyManager())
9442 {
9443 #ifdef DEVELOPER
9444 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9445 {
9446 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9447 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9448 }
9449 #endif
9450 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9451 }
9452 else
9453 {
9454 #ifdef DEVELOPER
9455 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9456 {
9457 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9458 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9459 }
9460 #endif
9461 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9462 }
9463 }
9464
9467 {
9468 int item_count = 0;
9470
9471 GameInventory inventory = GetInventory();
9472 CargoBase cargo = inventory.
GetCargo();
9473 if (cargo != NULL)
9474 {
9476 }
9477
9479 for (int i = 0; i < nAttachments; ++i)
9480 {
9482 if (item)
9483 item_count += item.GetNumberOfItems();
9484 }
9485 return item_count;
9486 }
9487
9490 {
9491 float weight = 0;
9492 float wetness = 1;
9493 if (include_wetness)
9496 {
9497 weight = wetness * m_ConfigWeight;
9498 }
9500 {
9501 weight = 1;
9502 }
9503 return weight;
9504 }
9505
9506
9507
9509 {
9510 GameInventory inventory = GetInventory();
9511 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9512 {
9513 array<EntityAI> items = new array<EntityAI>;
9515 for (int i = 0; i < items.Count(); ++i)
9516 {
9518 if (item)
9519 {
9520 g_Game.ObjectDelete(item);
9521 }
9522 }
9523 }
9524 }
9525
9526
9527
9528
9530 {
9531 float energy = 0;
9532 if (HasEnergyManager())
9533 {
9534 energy = GetCompEM().GetEnergy();
9535 }
9536 return energy;
9537 }
9538
9539
9541 {
9542 super.OnEnergyConsumed();
9543
9545 }
9546
9548 {
9549 super.OnEnergyAdded();
9550
9552 }
9553
9554
9556 {
9557 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9558 {
9560 {
9561 float energy_0to1 = GetCompEM().GetEnergy0To1();
9563 }
9564 }
9565 }
9566
9567
9569 {
9570 return ConfigGetFloat("heatIsolation");
9571 }
9572
9574 {
9576 }
9577
9579 {
9580 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9581 if (
g_Game.ConfigIsExisting(paramPath))
9582 return g_Game.ConfigGetFloat(paramPath);
9583
9584 return 0.0;
9585 }
9586
9588 {
9589 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9590 if (
g_Game.ConfigIsExisting(paramPath))
9591 return g_Game.ConfigGetFloat(paramPath);
9592
9593 return 0.0;
9594 }
9595
9596 override void SetWet(
float value,
bool allow_client =
false)
9597 {
9598 if (!IsServerCheck(allow_client))
9599 return;
9600
9603
9605
9606 m_VarWet = Math.Clamp(value, min, max);
9607
9609 {
9612 }
9613 }
9614
9615 override void AddWet(
float value)
9616 {
9618 }
9619
9621 {
9623 }
9624
9626 {
9628 }
9629
9631 {
9633 }
9634
9636 {
9638 }
9639
9641 {
9643 }
9644
9646 {
9649 if (newLevel != oldLevel)
9650 {
9652 }
9653 }
9654
9656 {
9657 SetWeightDirty();
9658 }
9659
9661 {
9662 return GetWetLevelInternal(
m_VarWet);
9663 }
9664
9665
9666
9668 {
9670 }
9671
9673 {
9675 }
9676
9678 {
9680 }
9681
9683 {
9685 }
9686
9687
9688
9690 {
9691 if (ConfigIsExisting("itemModelLength"))
9692 {
9693 return ConfigGetFloat("itemModelLength");
9694 }
9695 return 0;
9696 }
9697
9699 {
9700 if (ConfigIsExisting("itemAttachOffset"))
9701 {
9702 return ConfigGetFloat("itemAttachOffset");
9703 }
9704 return 0;
9705 }
9706
9707 override void SetCleanness(
int value,
bool allow_client =
false)
9708 {
9709 if (!IsServerCheck(allow_client))
9710 return;
9711
9713
9715
9718 }
9719
9721 {
9723 }
9724
9726 {
9727 return true;
9728 }
9729
9730
9731
9732
9734 {
9736 }
9737
9739 {
9741 }
9742
9743
9744
9745
9746 override void SetColor(
int r,
int g,
int b,
int a)
9747 {
9753 }
9755 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9756 {
9761 }
9762
9764 {
9766 }
9767
9770 {
9771 int r,g,b,a;
9773 r = r/255;
9774 g = g/255;
9775 b = b/255;
9776 a = a/255;
9777 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9778 }
9779
9780
9781
9782 override void SetLiquidType(
int value,
bool allow_client =
false)
9783 {
9784 if (!IsServerCheck(allow_client))
9785 return;
9786
9791 }
9792
9794 {
9795 return ConfigGetInt("varLiquidTypeInit");
9796 }
9797
9799 {
9801 }
9802
9804 {
9806 SetFrozen(false);
9807 }
9808
9811 {
9812 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9813 }
9814
9815
9818 {
9819 PlayerBase nplayer;
9820 if (PlayerBase.CastTo(nplayer, player))
9821 {
9823 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9824 }
9825 }
9826
9827
9830 {
9831 PlayerBase nplayer;
9832 if (PlayerBase.CastTo(nplayer,player))
9833 {
9834 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9835 }
9836
9837 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9838
9839 if (HasEnergyManager())
9840 {
9841 GetCompEM().UpdatePlugState();
9842 }
9843 }
9844
9845
9847 {
9848 super.OnPlacementStarted(player);
9849
9851 }
9852
9853 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9854 {
9856 {
9857 m_AdminLog.OnPlacementComplete(player,
this);
9858 }
9859
9860 super.OnPlacementComplete(player, position, orientation);
9861 }
9862
9863
9864
9865
9866
9868 {
9870 {
9871 return true;
9872 }
9873 else
9874 {
9875 return false;
9876 }
9877 }
9878
9879
9881 {
9883 {
9885 }
9886 }
9887
9888
9890 {
9892 }
9893
9895 {
9897 }
9898
9899 override void InsertAgent(
int agent,
float count = 1)
9900 {
9901 if (count < 1)
9902 return;
9903
9905 }
9906
9909 {
9911 }
9912
9913
9915 {
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
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9961 {
9963 return false;
9964 return true;
9965 }
9966
9968 {
9969
9971 }
9972
9973
9976 {
9977 super.CheckForRoofLimited(timeTresholdMS);
9978
9979 float time =
g_Game.GetTime();
9980 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9981 {
9982 m_PreviousRoofTestTime = time;
9983 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9984 }
9985 }
9986
9987
9989 {
9991 {
9992 return 0;
9993 }
9994
9995 if (GetInventory().GetAttachmentSlotsCount() != 0)
9996 {
9997 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9998 if (filter)
9999 return filter.GetProtectionLevel(type, false, system);
10000 else
10001 return 0;
10002 }
10003
10004 string subclassPath, entryName;
10005
10006 switch (type)
10007 {
10009 entryName = "biological";
10010 break;
10012 entryName = "chemical";
10013 break;
10014 default:
10015 entryName = "biological";
10016 break;
10017 }
10018
10019 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10020
10021 return g_Game.ConfigGetFloat(subclassPath + entryName);
10022 }
10023
10024
10025
10028 {
10029 if (!IsMagazine())
10031
10033 }
10034
10035
10036
10037
10038
10043 {
10044 return true;
10045 }
10046
10048 {
10050 }
10051
10052
10053
10054
10055
10057 {
10058 if (parent)
10059 {
10060 if (parent.IsInherited(DayZInfected))
10061 return true;
10062
10063 if (!parent.IsRuined())
10064 return true;
10065 }
10066
10067 return true;
10068 }
10069
10071 {
10072 if (!super.CanPutAsAttachment(parent))
10073 {
10074 return false;
10075 }
10076
10077 if (!IsRuined() && !parent.IsRuined())
10078 {
10079 return true;
10080 }
10081
10082 return false;
10083 }
10084
10086 {
10087
10088
10089
10090
10091 return super.CanReceiveItemIntoCargo(item);
10092 }
10093
10095 {
10096
10097
10098
10099
10100 GameInventory attachmentInv = attachment.GetInventory();
10102 {
10103 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10104 return false;
10105 }
10106
10107 InventoryLocation loc = new InventoryLocation();
10108 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10109 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10110 return false;
10111
10112 return super.CanReceiveAttachment(attachment, slotId);
10113 }
10114
10116 {
10117 if (!super.CanReleaseAttachment(attachment))
10118 return false;
10119
10120 return GetInventory().AreChildrenAccessible();
10121 }
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10144 {
10145 int id = muzzle_owner.GetMuzzleID();
10146 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10147
10148 if (WPOF_array)
10149 {
10150 for (int i = 0; i < WPOF_array.Count(); i++)
10151 {
10152 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10153
10154 if (WPOF)
10155 {
10156 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10157 }
10158 }
10159 }
10160 }
10161
10162
10164 {
10165 int id = muzzle_owner.GetMuzzleID();
10167
10168 if (WPOBE_array)
10169 {
10170 for (int i = 0; i < WPOBE_array.Count(); i++)
10171 {
10172 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10173
10174 if (WPOBE)
10175 {
10176 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10177 }
10178 }
10179 }
10180 }
10181
10182
10184 {
10185 int id = muzzle_owner.GetMuzzleID();
10186 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10187
10188 if (WPOOH_array)
10189 {
10190 for (int i = 0; i < WPOOH_array.Count(); i++)
10191 {
10192 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10193
10194 if (WPOOH)
10195 {
10196 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10197 }
10198 }
10199 }
10200 }
10201
10202
10204 {
10205 int id = muzzle_owner.GetMuzzleID();
10206 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10207
10208 if (WPOOH_array)
10209 {
10210 for (int i = 0; i < WPOOH_array.Count(); i++)
10211 {
10212 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10213
10214 if (WPOOH)
10215 {
10216 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10217 }
10218 }
10219 }
10220 }
10221
10222
10224 {
10225 int id = muzzle_owner.GetMuzzleID();
10226 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10227
10228 if (WPOOH_array)
10229 {
10230 for (int i = 0; i < WPOOH_array.Count(); i++)
10231 {
10232 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10233
10234 if (WPOOH)
10235 {
10236 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10237 }
10238 }
10239 }
10240 }
10241
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 {
10267 {
10268 return true;
10269 }
10270
10271 return false;
10272 }
10273
10275 {
10276 return false;
10277 }
10278
10281 {
10282 return UATimeSpent.DEFAULT_DEPLOY;
10283 }
10284
10285
10286
10287
10289 {
10291 SetSynchDirty();
10292 }
10293
10295 {
10297 }
10298
10299
10301 {
10302 return false;
10303 }
10304
10307 {
10308 string att_type = "None";
10309
10310 if (ConfigIsExisting("soundAttType"))
10311 {
10312 att_type = ConfigGetString("soundAttType");
10313 }
10314
10316 }
10317
10319 {
10321 }
10322
10323
10324
10325
10326
10332
10334 {
10337
10339 }
10340
10341
10343 {
10345 return;
10346
10348
10351
10354
10355 SoundParameters params = new SoundParameters();
10359 }
10360
10361
10363 {
10365 {
10368
10369 SetSynchDirty();
10370
10373 }
10374 }
10375
10377 {
10379 }
10380
10381
10383 {
10385 return;
10386
10388 SetSynchDirty();
10389
10392 }
10393
10395 {
10398 }
10399
10401 {
10403 }
10404
10405 void OnApply(PlayerBase player);
10406
10408 {
10409 return 1.0;
10410 };
10411
10413 {
10415 }
10416
10418 {
10420 }
10421
10423
10425 {
10426 SetDynamicPhysicsLifeTime(0.01);
10428 }
10429
10431 {
10432 array<string> zone_names = new array<string>;
10433 GetDamageZones(zone_names);
10434 for (int i = 0; i < zone_names.Count(); i++)
10435 {
10436 SetHealthMax(zone_names.Get(i),"Health");
10437 }
10438 SetHealthMax("","Health");
10439 }
10440
10443 {
10444 float global_health = GetHealth01("","Health");
10445 array<string> zones = new array<string>;
10446 GetDamageZones(zones);
10447
10448 for (int i = 0; i < zones.Count(); i++)
10449 {
10450 SetHealth01(zones.Get(i),"Health",global_health);
10451 }
10452 }
10453
10456 {
10457 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10458 }
10459
10461 {
10462 if (!hasRootAsPlayer)
10463 {
10464 if (refParentIB)
10465 {
10466
10467 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10468 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10469
10470 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10471 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10472
10475 }
10476 else
10477 {
10478
10481 }
10482 }
10483 }
10484
10486 {
10488 {
10489 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10490 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10491 {
10492 float heatPermCoef = 1.0;
10494 while (ent)
10495 {
10496 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10497 ent = ent.GetHierarchyParent();
10498 }
10499
10500 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10501 }
10502 }
10503 }
10504
10506 {
10507
10508 EntityAI parent = GetHierarchyParent();
10509 if (!parent)
10510 {
10511 hasParent = false;
10512 hasRootAsPlayer = false;
10513 }
10514 else
10515 {
10516 hasParent = true;
10517 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10518 refParentIB =
ItemBase.Cast(parent);
10519 }
10520 }
10521
10522 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10523 {
10524
10525 }
10526
10528 {
10529
10530 return false;
10531 }
10532
10534 {
10535
10536
10537 return false;
10538 }
10539
10541 {
10542
10543 return false;
10544 }
10545
10548 {
10549 return !GetIsFrozen() &&
IsOpen();
10550 }
10551
10553 {
10554 bool hasParent = false, hasRootAsPlayer = false;
10556
10557 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10558 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10559
10560 if (wwtu || foodDecay)
10561 {
10565
10566 if (processWetness || processTemperature || processDecay)
10567 {
10569
10570 if (processWetness)
10571 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10572
10573 if (processTemperature)
10575
10576 if (processDecay)
10577 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10578 }
10579 }
10580 }
10581
10584 {
10586 }
10587
10589 {
10592
10593 return super.GetTemperatureFreezeThreshold();
10594 }
10595
10597 {
10600
10601 return super.GetTemperatureThawThreshold();
10602 }
10603
10605 {
10608
10609 return super.GetItemOverheatThreshold();
10610 }
10611
10613 {
10615 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10616
10617 return super.GetTemperatureFreezeTime();
10618 }
10619
10621 {
10623 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10624
10625 return super.GetTemperatureThawTime();
10626 }
10627
10632
10634 {
10635 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10636 }
10637
10639 {
10640 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10641 }
10642
10645 {
10647 }
10648
10650 {
10652 }
10653
10655 {
10657 }
10658
10661 {
10662 return null;
10663 }
10664
10667 {
10668 return false;
10669 }
10670
10672 {
10674 {
10677 if (!trg)
10678 {
10680 explosive = this;
10681 }
10682
10683 explosive.PairRemote(trg);
10685
10686 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10687 trg.SetPersistentPairID(persistentID);
10688 explosive.SetPersistentPairID(persistentID);
10689
10690 return true;
10691 }
10692 return false;
10693 }
10694
10697 {
10698 float ret = 1.0;
10701 ret *= GetHealth01();
10702
10703 return ret;
10704 }
10705
10706 #ifdef DEVELOPER
10707 override void SetDebugItem()
10708 {
10709 super.SetDebugItem();
10710 _itemBase = this;
10711 }
10712
10714 {
10715 string text = super.GetDebugText();
10716
10718 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10719
10720 return text;
10721 }
10722 #endif
10723
10725 {
10726 return true;
10727 }
10728
10730
10732
10734 {
10737 }
10738
10739
10747
10763
10764 [
Obsolete(
"Use ItemSoundHandler instead")]
10767 {
10768 if (!
g_Game.IsDedicatedServer())
10769 {
10770 if (ConfigIsExisting("attachSoundSet"))
10771 {
10772 string cfg_path = "";
10773 string soundset = "";
10774 string type_name =
GetType();
10775
10778 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10779 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10780
10781 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10782 {
10783 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10784 {
10785 if (cfg_slot_array[i] == slot_type)
10786 {
10787 soundset = cfg_soundset_array[i];
10788 break;
10789 }
10790 }
10791 }
10792
10793 if (soundset != "")
10794 {
10795 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10797 }
10798 }
10799 }
10800 }
10801
10803}
10804
10806{
10808 if (entity)
10809 {
10810 bool is_item = entity.IsInherited(
ItemBase);
10811 if (is_item && full_quantity)
10812 {
10815 }
10816 }
10817 else
10818 {
10820 return NULL;
10821 }
10822 return entity;
10823}
10824
10826{
10827 if (item)
10828 {
10829 if (health > 0)
10830 item.SetHealth("", "", health);
10831
10832 if (item.CanHaveTemperature())
10833 {
10835 if (item.CanFreeze())
10836 item.SetFrozen(false);
10837 }
10838
10839 if (item.HasEnergyManager())
10840 {
10841 if (quantity >= 0)
10842 {
10843 item.GetCompEM().SetEnergy0To1(quantity);
10844 }
10845 else
10846 {
10848 }
10849 }
10850 else if (item.IsMagazine())
10851 {
10852 Magazine mag = Magazine.Cast(item);
10853 if (quantity >= 0)
10854 {
10855 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10856 }
10857 else
10858 {
10860 }
10861
10862 }
10863 else
10864 {
10865 if (quantity >= 0)
10866 {
10867 item.SetQuantityNormalized(quantity, false);
10868 }
10869 else
10870 {
10872 }
10873
10874 }
10875 }
10876}
10877
10878#ifdef DEVELOPER
10880#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.