5895{
5897 {
5898 return true;
5899 }
5900};
5901
5903{
5904
5905};
5906
5907
5908
5910{
5914
5916
5919
5920
5921
5922
5923
5932
5938
5943
5948
5969 protected bool m_IsResultOfSplit
5970
5972
5977
5978
5979
5981
5985
5986
5987
5989
5992
5993
5994
6000
6001
6009
6012
6013
6015
6016
6018
6019
6024
6025
6030
6032
6033
6035
6036
6038 {
6043
6044 if (!
g_Game.IsDedicatedServer())
6045 {
6047 {
6049
6051 {
6053 }
6054 }
6055
6058 }
6059
6060 m_OldLocation = null;
6061
6063 {
6065 }
6066
6067 if (ConfigIsExisting("headSelectionsToHide"))
6068 {
6071 }
6072
6074 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6075 {
6077 }
6078
6080
6081 m_IsResultOfSplit = false;
6082
6084 }
6085
6087 {
6088 super.InitItemVariables();
6089
6095 m_Count = ConfigGetInt(
"count");
6096
6099
6104
6107
6112
6124
6128
6129
6132 if (ConfigIsExisting("canBeSplit"))
6133 {
6136 }
6137
6139 if (ConfigIsExisting("itemBehaviour"))
6141
6142
6145 RegisterNetSyncVariableInt("m_VarLiquidType");
6146 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6147
6148 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6149 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6150 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6151
6152 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6153 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6154 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6155 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6156
6157 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6158 RegisterNetSyncVariableBool("m_IsTakeable");
6159 RegisterNetSyncVariableBool("m_IsHologram");
6160
6163 {
6166 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6167 }
6168
6170
6172 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6174
6176 }
6177
6179 {
6181 }
6182
6184 {
6187 {
6192 }
6193 }
6194
6195 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6196 {
6198 {
6201 }
6202
6204 }
6205
6207 {
6213 }
6214
6216
6218 {
6220
6221 if (!action)
6222 {
6223 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6224 return;
6225 }
6226
6228 if (!ai)
6229 {
6231 return;
6232 }
6233
6235 if (!action_array)
6236 {
6237 action_array = new array<ActionBase_Basic>;
6239 }
6240 if (LogManager.IsActionLogEnable())
6241 {
6242 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6243 }
6244
6245 if (action_array.Find(action) != -1)
6246 {
6247 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6248 }
6249 else
6250 {
6251 action_array.Insert(action);
6252 }
6253 }
6254
6256 {
6257 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6258 ActionBase action = player.GetActionManager().GetAction(actionName);
6261
6262 if (action_array)
6263 {
6264 action_array.RemoveItem(action);
6265 }
6266 }
6267
6268
6269
6271 {
6272 ActionOverrideData overrideData = new ActionOverrideData();
6276
6278 if (!actionMap)
6279 {
6282 }
6283
6284 actionMap.Insert(this.
Type(), overrideData);
6285
6286 }
6287
6289
6291
6292
6294 {
6297
6300
6301 string config_to_search = "CfgVehicles";
6302 string muzzle_owner_config;
6303
6305 {
6306 if (IsInherited(Weapon))
6307 config_to_search = "CfgWeapons";
6308
6309 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6310
6311 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6312
6313 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6314
6315 if (config_OnFire_subclass_count > 0)
6316 {
6317 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6318
6319 for (int i = 0; i < config_OnFire_subclass_count; i++)
6320 {
6321 string particle_class = "";
6322 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6323 string config_OnFire_entry = config_OnFire_class + particle_class;
6324 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6325 WPOF_array.Insert(WPOF);
6326 }
6327
6328
6330 }
6331 }
6332
6334 {
6335 config_to_search = "CfgWeapons";
6336 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6337
6338 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6339
6340 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6341
6342 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6343 {
6344 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6345
6346 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6347 {
6348 string particle_class2 = "";
6349 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6350 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6351 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6352 WPOBE_array.Insert(WPOBE);
6353 }
6354
6355
6357 }
6358 }
6359 }
6360
6361
6363 {
6366
6368 {
6369 string config_to_search = "CfgVehicles";
6370
6371 if (IsInherited(Weapon))
6372 config_to_search = "CfgWeapons";
6373
6374 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6375 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6376
6377 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6378 {
6379
6381
6383 {
6385 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6387 return;
6388 }
6389
6392
6393
6394
6395 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6396 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6397
6398 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6399 {
6400 string particle_class = "";
6401 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6402 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6403 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6404
6405 if (entry_type == CT_CLASS)
6406 {
6407 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6408 WPOOH_array.Insert(WPOF);
6409 }
6410 }
6411
6412
6414 }
6415 }
6416 }
6417
6419 {
6421 }
6422
6424 {
6426 {
6428
6431
6434
6435 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6436 }
6437 }
6438
6440 {
6442 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6443
6445 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6446
6448 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6449
6451 {
6453 }
6454 }
6455
6457 {
6459 }
6460
6462 {
6465 else
6467
6469 {
6472 }
6473 else
6474 {
6477
6480 }
6481
6483 }
6484
6486 {
6488 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6489 }
6490
6492 {
6494 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6496 }
6497
6499 {
6501 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6502 }
6503
6505 {
6508
6509 OverheatingParticle OP = new OverheatingParticle();
6514
6516 }
6517
6519 {
6522
6523 return -1;
6524 }
6525
6527 {
6529 {
6532
6533 for (int i = count; i > 0; --i)
6534 {
6535 int id = i - 1;
6538
6541
6542 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6543 {
6544 if (p)
6545 {
6548 }
6549 }
6550 }
6551 }
6552 }
6553
6555 {
6557 {
6559 {
6560 int id = i - 1;
6562
6563 if (OP)
6564 {
6566
6567 if (p)
6568 {
6570 }
6571
6572 delete OP;
6573 }
6574 }
6575
6578 }
6579 }
6580
6583 {
6584 return 0.0;
6585 }
6586
6587
6589 {
6590 return 250;
6591 }
6592
6594 {
6595 return 0;
6596 }
6597
6600 {
6602 return true;
6603
6604 return false;
6605 }
6606
6609 {
6612
6614 {
6616 }
6617 else
6618 {
6619
6621 }
6622
6624 }
6625
6632 {
6633 return -1;
6634 }
6635
6636
6637
6638
6640 {
6642 {
6643 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6644 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6645
6646 if (r_index >= 0)
6647 {
6648 InventoryLocation r_il = new InventoryLocation;
6649 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6650
6651 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6654 {
6655 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6656 }
6658 {
6659 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6660 }
6661
6662 }
6663
6664 player.GetHumanInventory().ClearUserReservedLocation(this);
6665 }
6666
6669 }
6670
6671
6672
6673
6675 {
6676 return ItemBase.m_DebugActionsMask;
6677 }
6678
6680 {
6681 return ItemBase.m_DebugActionsMask & mask;
6682 }
6683
6685 {
6686 ItemBase.m_DebugActionsMask = mask;
6687 }
6688
6690 {
6691 ItemBase.m_DebugActionsMask |= mask;
6692 }
6693
6695 {
6696 ItemBase.m_DebugActionsMask &= ~mask;
6697 }
6698
6700 {
6702 {
6704 }
6705 else
6706 {
6708 }
6709 }
6710
6711
6713 {
6714 if (GetEconomyProfile())
6715 {
6716 float q_max = GetEconomyProfile().GetQuantityMax();
6717 if (q_max > 0)
6718 {
6719 float q_min = GetEconomyProfile().GetQuantityMin();
6720 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6721
6723 {
6724 ComponentEnergyManager comp = GetCompEM();
6726 {
6728 }
6729 }
6731 {
6733
6734 }
6735
6736 }
6737 }
6738 }
6739
6742 {
6743 EntityAI parent = GetHierarchyParent();
6744
6745 if (parent)
6746 {
6747 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6748 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6749 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6750 }
6751 }
6752
6755 {
6756 EntityAI parent = GetHierarchyParent();
6757
6758 if (parent)
6759 {
6760 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6761 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6762 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6763 }
6764 }
6765
6767 {
6768
6769
6770
6771
6773
6775 {
6776 if (ScriptInputUserData.CanStoreInputUserData())
6777 {
6778 ScriptInputUserData ctx = new ScriptInputUserData;
6784 ctx.
Write(use_stack_max);
6787
6789 {
6790 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6791 }
6792 }
6793 }
6794 else if (!
g_Game.IsMultiplayer())
6795 {
6797 }
6798 }
6799
6801 {
6803 }
6804
6806 {
6808 }
6809
6811 {
6813 }
6814
6816 {
6817
6818 return false;
6819 }
6820
6822 {
6823 return false;
6824 }
6825
6829 {
6830 return false;
6831 }
6832
6834 {
6835 return "";
6836 }
6837
6839
6841 {
6842 return false;
6843 }
6844
6846 {
6847 return true;
6848 }
6849
6850
6851
6853 {
6854 return true;
6855 }
6856
6858 {
6859 return true;
6860 }
6861
6863 {
6864 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6866 }
6867
6869 {
6871 }
6872
6874 {
6876 if (!is_being_placed)
6878 SetSynchDirty();
6879 }
6880
6881
6883
6885 {
6887 }
6888
6890 {
6892 }
6893
6895 {
6896 return 1;
6897 }
6898
6900 {
6901 return false;
6902 }
6903
6905 {
6907 SetSynchDirty();
6908 }
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6945 {
6946 super.OnMovedInsideCargo(container);
6947
6948 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6949 }
6950
6951 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6952 {
6953 super.EEItemLocationChanged(oldLoc, newLoc);
6954
6955 PlayerBase newPlayer = null;
6956 PlayerBase oldPlayer = null;
6957
6958 if (newLoc.GetParent())
6959 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6960
6961 if (oldLoc.GetParent())
6962 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6963
6965 {
6966 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6967
6968 if (rIndex >= 0)
6969 {
6970 InventoryLocation rIl = new InventoryLocation;
6971 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6972
6973 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6976 {
6977 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6978 }
6980 {
6982 }
6983
6984 }
6985 }
6986
6988 {
6989 if (newPlayer)
6990 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6991
6992 if (newPlayer == oldPlayer)
6993 {
6994 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6995 {
6997 {
6998 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6999 {
7000 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7001 }
7002 }
7003 else
7004 {
7005 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7006 }
7007 }
7008
7009 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7010 {
7011 int type = oldLoc.GetType();
7013 {
7014 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7015 }
7017 {
7018 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7019 }
7020 }
7021 if (!m_OldLocation)
7022 {
7023 m_OldLocation = new InventoryLocation;
7024 }
7025 m_OldLocation.Copy(oldLoc);
7026 }
7027 else
7028 {
7029 if (m_OldLocation)
7030 {
7031 m_OldLocation.Reset();
7032 }
7033 }
7034
7035 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7036 }
7037 else
7038 {
7039 if (newPlayer)
7040 {
7041 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7042 if (resIndex >= 0)
7043 {
7044 InventoryLocation il = new InventoryLocation;
7045 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7047 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7050 {
7051 il.
GetParent().GetOnReleaseLock().Invoke(it);
7052 }
7054 {
7056 }
7057
7058 }
7059 }
7061 {
7062
7064 }
7065
7066 if (m_OldLocation)
7067 {
7068 m_OldLocation.Reset();
7069 }
7070 }
7071
7073 {
7074 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7075 }
7076
7078 {
7079 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7080 }
7081 }
7082
7083 override void EOnContact(IEntity other, Contact extra)
7084 {
7086 {
7087 int liquidType = -1;
7089 if (impactSpeed > 0.0)
7090 {
7092 #ifndef SERVER
7094 #else
7096 SetSynchDirty();
7097 #endif
7099 }
7100 }
7101
7102 #ifdef SERVER
7103 if (GetCompEM() && GetCompEM().IsPlugged())
7104 {
7105 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7106 GetCompEM().UnplugThis();
7107 }
7108 #endif
7109 }
7110
7112
7114 {
7116 }
7117
7119 {
7120
7121 }
7122
7124 {
7125 super.OnItemLocationChanged(old_owner, new_owner);
7126
7127 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7128 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7129
7130 if (!relatedPlayer && playerNew)
7131 relatedPlayer = playerNew;
7132
7133 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7134 {
7136 if (actionMgr)
7137 {
7138 ActionBase currentAction = actionMgr.GetRunningAction();
7139 if (currentAction)
7141 }
7142 }
7143
7144 Man ownerPlayerOld = null;
7145 Man ownerPlayerNew = null;
7146
7147 if (old_owner)
7148 {
7149 if (old_owner.
IsMan())
7150 {
7151 ownerPlayerOld = Man.Cast(old_owner);
7152 }
7153 else
7154 {
7155 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7156 }
7157 }
7158 else
7159 {
7161 {
7163
7164 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7165 {
7166 GetCompEM().UnplugThis();
7167 }
7168 }
7169 }
7170
7171 if (new_owner)
7172 {
7173 if (new_owner.
IsMan())
7174 {
7175 ownerPlayerNew = Man.Cast(new_owner);
7176 }
7177 else
7178 {
7179 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7180 }
7181 }
7182
7183 if (ownerPlayerOld != ownerPlayerNew)
7184 {
7185 if (ownerPlayerOld)
7186 {
7187 array<EntityAI> subItemsExit = new array<EntityAI>;
7189 for (int i = 0; i < subItemsExit.Count(); i++)
7190 {
7193 }
7194 }
7195
7196 if (ownerPlayerNew)
7197 {
7198 array<EntityAI> subItemsEnter = new array<EntityAI>;
7200 for (int j = 0; j < subItemsEnter.Count(); j++)
7201 {
7204 }
7205 }
7206 }
7207 else if (ownerPlayerNew != null)
7208 {
7209 PlayerBase nplayer;
7210 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7211 {
7212 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7214 for (int k = 0; k < subItemsUpdate.Count(); k++)
7215 {
7217 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7218 }
7219 }
7220 }
7221
7222 if (old_owner)
7223 old_owner.OnChildItemRemoved(this);
7224 if (new_owner)
7225 new_owner.OnChildItemReceived(this);
7226 }
7227
7228
7230 {
7231 super.EEDelete(parent);
7232 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7233 if (player)
7234 {
7236
7237 if (player.IsAlive())
7238 {
7239 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7240 if (r_index >= 0)
7241 {
7242 InventoryLocation r_il = new InventoryLocation;
7243 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7244
7245 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7248 {
7249 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7250 }
7252 {
7253 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7254 }
7255
7256 }
7257
7258 player.RemoveQuickBarEntityShortcut(this);
7259 }
7260 }
7261 }
7262
7264 {
7265 super.EEKilled(killer);
7266
7269 {
7270 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7271 {
7272 if (IsMagazine())
7273 {
7274 if (Magazine.Cast(this).GetAmmoCount() > 0)
7275 {
7277 }
7278 }
7279 else
7280 {
7282 }
7283 }
7284 }
7285 }
7286
7288 {
7289 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7290
7291 super.OnWasAttached(parent, slot_id);
7292
7295
7298 }
7299
7301 {
7302 super.OnWasDetached(parent, slot_id);
7303
7306
7309 }
7310
7312 {
7313 int idx;
7316
7317 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7318 if (inventory_slots.Count() < 1)
7319 {
7320 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7321 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7322 }
7323 else
7324 {
7325 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7326 }
7327
7328 idx = inventory_slots.Find(slot);
7329 if (idx < 0)
7330 return "";
7331
7332 return attach_types.Get(idx);
7333 }
7334
7336 {
7337 int idx = -1;
7338 string slot;
7339
7342
7343 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7344 if (inventory_slots.Count() < 1)
7345 {
7346 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7347 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7348 }
7349 else
7350 {
7351 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7352 if (detach_types.Count() < 1)
7353 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7354 }
7355
7356 for (int i = 0; i < inventory_slots.Count(); i++)
7357 {
7358 slot = inventory_slots.Get(i);
7359 }
7360
7361 if (slot != "")
7362 {
7363 if (detach_types.Count() == 1)
7364 idx = 0;
7365 else
7366 idx = inventory_slots.Find(slot);
7367 }
7368 if (idx < 0)
7369 return "";
7370
7371 return detach_types.Get(idx);
7372 }
7373
7375 {
7376
7378
7379
7380 float min_time = 1;
7381 float max_time = 3;
7382 float delay = Math.RandomFloat(min_time, max_time);
7383
7384 explode_timer.Run(delay, this, "DoAmmoExplosion");
7385 }
7386
7388 {
7389 Magazine magazine = Magazine.Cast(this);
7390 int pop_sounds_count = 6;
7391 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7392
7393
7394 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7395 string sound_name = pop_sounds[ sound_idx ];
7396 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7397
7398
7399 magazine.ServerAddAmmoCount(-1);
7400
7401
7402 float min_temp_to_explode = 100;
7403
7404 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7405 {
7407 }
7408 }
7409
7410
7411 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7412 {
7413 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7414
7415 const int CHANCE_DAMAGE_CARGO = 4;
7416 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7417 const int CHANCE_DAMAGE_NOTHING = 2;
7418
7420 {
7421 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7422 int chances;
7423 int rnd;
7424
7425 if (GetInventory().GetCargo())
7426 {
7427 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7428 rnd = Math.RandomInt(0,chances);
7429
7430 if (rnd < CHANCE_DAMAGE_CARGO)
7431 {
7433 }
7434 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7435 {
7437 }
7438 }
7439 else
7440 {
7441 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7442 rnd = Math.RandomInt(0,chances);
7443
7444 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7445 {
7447 }
7448 }
7449 }
7450 }
7451
7453 {
7454 CargoBase cargo = GetInventory().GetCargo();
7455 if (cargo)
7456 {
7458 if (item_count > 0)
7459 {
7460 int random_pick = Math.RandomInt(0, item_count);
7462 if (!item.IsExplosive())
7463 {
7464 item.AddHealth("","",damage);
7465 return true;
7466 }
7467 }
7468 }
7469 return false;
7470 }
7471
7473 {
7474 GameInventory inventory = GetInventory();
7476 if (attachment_count > 0)
7477 {
7478 int random_pick = Math.RandomInt(0, attachment_count);
7480 if (!attachment.IsExplosive())
7481 {
7482 attachment.AddHealth("","",damage);
7483 return true;
7484 }
7485 }
7486 return false;
7487 }
7488
7490 {
7492 }
7493
7495 {
7497 return GetInventory().CanRemoveEntity();
7498
7499 return false;
7500 }
7501
7503 {
7504
7506 return false;
7507
7508
7510 return false;
7511
7512
7513
7515 if (delta == 0)
7516 return false;
7517
7518
7519 return true;
7520 }
7521
7523 {
7525 {
7526 if (ScriptInputUserData.CanStoreInputUserData())
7527 {
7528 ScriptInputUserData ctx = new ScriptInputUserData;
7533 ctx.
Write(destination_entity);
7537 }
7538 }
7539 else if (!
g_Game.IsMultiplayer())
7540 {
7542 }
7543 }
7544
7546 {
7547 float split_quantity_new;
7551 InventoryLocation loc = new InventoryLocation;
7552
7553 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7554 {
7556 split_quantity_new = stack_max;
7557 else
7559
7561 {
7562 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7563 if (new_item)
7564 {
7565 new_item.SetResultOfSplit(true);
7566 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7568 new_item.
SetQuantity(split_quantity_new,
false,
true);
7569 }
7570 }
7571 }
7572 else if (destination_entity && slot_id == -1)
7573 {
7574 if (quantity > stack_max)
7575 split_quantity_new = stack_max;
7576 else
7577 split_quantity_new = quantity;
7578
7580 {
7581 GameInventory destinationInventory = destination_entity.GetInventory();
7583 {
7586 }
7587
7588 if (new_item)
7589 {
7590 new_item.SetResultOfSplit(true);
7591 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7593 new_item.
SetQuantity(split_quantity_new,
false,
true);
7594 }
7595 }
7596 }
7597 else
7598 {
7599 if (stack_max != 0)
7600 {
7602 {
7604 }
7605
7606 if (split_quantity_new == 0)
7607 {
7608 if (!
g_Game.IsMultiplayer())
7609 player.PhysicalPredictiveDropItem(this);
7610 else
7611 player.ServerDropEntity(this);
7612 return;
7613 }
7614
7616 {
7618
7619 if (new_item)
7620 {
7621 new_item.SetResultOfSplit(true);
7622 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7625 new_item.PlaceOnSurface();
7626 }
7627 }
7628 }
7629 }
7630 }
7631
7633 {
7634 float split_quantity_new;
7638 InventoryLocation loc = new InventoryLocation;
7639
7640 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7641 {
7643 split_quantity_new = stack_max;
7644 else
7646
7648 {
7649 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7650 if (new_item)
7651 {
7652 new_item.SetResultOfSplit(true);
7653 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7655 new_item.
SetQuantity(split_quantity_new,
false,
true);
7656 }
7657 }
7658 }
7659 else if (destination_entity && slot_id == -1)
7660 {
7661 if (quantity > stack_max)
7662 split_quantity_new = stack_max;
7663 else
7664 split_quantity_new = quantity;
7665
7667 {
7668 GameInventory destinationInventory = destination_entity.GetInventory();
7670 {
7673 }
7674
7675 if (new_item)
7676 {
7677 new_item.SetResultOfSplit(true);
7678 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7680 new_item.
SetQuantity(split_quantity_new,
false,
true);
7681 }
7682 }
7683 }
7684 else
7685 {
7686 if (stack_max != 0)
7687 {
7689 {
7691 }
7692
7694 {
7696
7697 if (new_item)
7698 {
7699 new_item.SetResultOfSplit(true);
7700 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7703 new_item.PlaceOnSurface();
7704 }
7705 }
7706 }
7707 }
7708 }
7709
7711 {
7713 {
7714 if (ScriptInputUserData.CanStoreInputUserData())
7715 {
7716 ScriptInputUserData ctx = new ScriptInputUserData;
7721 dst.WriteToContext(ctx);
7723 }
7724 }
7725 else if (!
g_Game.IsMultiplayer())
7726 {
7728 }
7729 }
7730
7732 {
7734 {
7735 if (ScriptInputUserData.CanStoreInputUserData())
7736 {
7737 ScriptInputUserData ctx = new ScriptInputUserData;
7742 ctx.
Write(destination_entity);
7748 }
7749 }
7750 else if (!
g_Game.IsMultiplayer())
7751 {
7753 }
7754 }
7755
7757 {
7759 }
7760
7762 {
7764 float split_quantity_new;
7766 if (dst.IsValid())
7767 {
7768 int slot_id = dst.GetSlot();
7770
7771 if (quantity > stack_max)
7772 split_quantity_new = stack_max;
7773 else
7774 split_quantity_new = quantity;
7775
7777 {
7779
7780 if (new_item)
7781 {
7782 new_item.SetResultOfSplit(true);
7783 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7785 new_item.
SetQuantity(split_quantity_new,
false,
true);
7786 }
7787
7788 return new_item;
7789 }
7790 }
7791
7792 return null;
7793 }
7794
7796 {
7798 float split_quantity_new;
7800 if (destination_entity)
7801 {
7803 if (quantity > stackable)
7804 split_quantity_new = stackable;
7805 else
7806 split_quantity_new = quantity;
7807
7809 {
7810 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7811 if (new_item)
7812 {
7813 new_item.SetResultOfSplit(true);
7814 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7816 new_item.
SetQuantity(split_quantity_new,
false,
true);
7817 }
7818 }
7819 }
7820 }
7821
7823 {
7825 {
7826 if (ScriptInputUserData.CanStoreInputUserData())
7827 {
7828 ScriptInputUserData ctx = new ScriptInputUserData;
7833 ItemBase destination_entity =
this;
7834 ctx.
Write(destination_entity);
7838 }
7839 }
7840 else if (!
g_Game.IsMultiplayer())
7841 {
7843 }
7844 }
7845
7847 {
7849 float split_quantity_new;
7851 if (player)
7852 {
7854 if (quantity > stackable)
7855 split_quantity_new = stackable;
7856 else
7857 split_quantity_new = quantity;
7858
7860 {
7861 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7862 new_item =
ItemBase.Cast(in_hands);
7863 if (new_item)
7864 {
7865 new_item.SetResultOfSplit(true);
7866 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7868 new_item.SetQuantity(split_quantity_new, false, true);
7869 }
7870 }
7871 }
7872 }
7873
7875 {
7877 float split_quantity_new = Math.Floor(quantity * 0.5);
7878
7880 return;
7881
7883
7884 if (new_item)
7885 {
7886 if (new_item.GetQuantityMax() < split_quantity_new)
7887 {
7888 split_quantity_new = new_item.GetQuantityMax();
7889 }
7890
7891 new_item.SetResultOfSplit(true);
7892 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7893
7895 {
7898 }
7899 else
7900 {
7902 new_item.
SetQuantity(split_quantity_new,
false,
true);
7903 }
7904 }
7905 }
7906
7908 {
7910 float split_quantity_new = Math.Floor(quantity / 2);
7911
7913 return;
7914
7915 InventoryLocation invloc = new InventoryLocation;
7917
7919 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7920
7921 if (new_item)
7922 {
7923 if (new_item.GetQuantityMax() < split_quantity_new)
7924 {
7925 split_quantity_new = new_item.GetQuantityMax();
7926 }
7928 {
7931 }
7932 else if (split_quantity_new > 1)
7933 {
7935 new_item.
SetQuantity(split_quantity_new,
false,
true);
7936 }
7937 }
7938 }
7939
7942 {
7943 SetWeightDirty();
7945
7946 if (parent)
7947 parent.OnAttachmentQuantityChangedEx(this, delta);
7948
7950 {
7952 {
7954 }
7956 {
7957 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7959 }
7960 }
7961 }
7962
7965 {
7966
7967 }
7968
7971 {
7973 }
7974
7976 {
7977 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7978
7980 {
7981 if (newLevel == GameConstants.STATE_RUINED)
7982 {
7984 EntityAI parent = GetHierarchyParent();
7985 if (parent && parent.IsFireplace())
7986 {
7987 CargoBase cargo = GetInventory().GetCargo();
7988 if (cargo)
7989 {
7991 {
7993 }
7994 }
7995 }
7996 }
7997
7999 {
8000
8002 return;
8003 }
8004
8005 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8006 {
8008 }
8009 }
8010 }
8011
8012
8014 {
8015 super.OnRightClick();
8016
8018 {
8020 {
8021 if (ScriptInputUserData.CanStoreInputUserData())
8022 {
8023 EntityAI root = GetHierarchyRoot();
8024 Man playerOwner = GetHierarchyRootPlayer();
8025 InventoryLocation dst = new InventoryLocation;
8026
8027
8028 if (!playerOwner && root && root == this)
8029 {
8031 }
8032 else
8033 {
8034
8035 GetInventory().GetCurrentInventoryLocation(dst);
8037 {
8038 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8040 {
8042 }
8043 else
8044 {
8046
8047
8048 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8049 {
8051 }
8052 else
8053 {
8054 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8055 }
8056 }
8057 }
8058 }
8059
8060 ScriptInputUserData ctx = new ScriptInputUserData;
8068 }
8069 }
8070 else if (!
g_Game.IsMultiplayer())
8071 {
8073 }
8074 }
8075 }
8076
8078 {
8079 if (root)
8080 {
8081 vector m4[4];
8082 root.GetTransform(m4);
8083 dst.SetGround(this, m4);
8084 }
8085 else
8086 {
8087 GetInventory().GetCurrentInventoryLocation(dst);
8088 }
8089 }
8090
8091 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8092 {
8093
8094 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8095 return false;
8096
8097 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8098 return false;
8099
8100
8102 return false;
8103
8104
8105 Magazine mag = Magazine.Cast(this);
8106 if (mag)
8107 {
8108 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8109 return false;
8110
8111 if (stack_max_limit)
8112 {
8113 Magazine other_mag = Magazine.Cast(other_item);
8114 if (other_item)
8115 {
8116 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8117 return false;
8118 }
8119
8120 }
8121 }
8122 else
8123 {
8124
8126 return false;
8127
8129 return false;
8130 }
8131
8132 PlayerBase player = null;
8133 if (CastTo(player, GetHierarchyRootPlayer()))
8134 {
8135 if (player.GetInventory().HasAttachment(this))
8136 return false;
8137
8138 if (player.IsItemsToDelete())
8139 return false;
8140 }
8141
8142 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8143 return false;
8144
8145 int slotID;
8147 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8148 return false;
8149
8150 return true;
8151 }
8152
8154 {
8156 }
8157
8159 {
8160 return m_IsResultOfSplit;
8161 }
8162
8164 {
8165 m_IsResultOfSplit = value;
8166 }
8167
8169 {
8171 }
8172
8174 {
8175 float other_item_quantity = other_item.GetQuantity();
8176 float this_free_space;
8177
8179
8181
8182 if (other_item_quantity > this_free_space)
8183 {
8184 return this_free_space;
8185 }
8186 else
8187 {
8188 return other_item_quantity;
8189 }
8190 }
8191
8193 {
8195 }
8196
8198 {
8200 return;
8201
8202 if (!IsMagazine() && other_item)
8203 {
8205 if (quantity_used != 0)
8206 {
8207 float hp1 = GetHealth01("","");
8208 float hp2 = other_item.GetHealth01("","");
8209 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8210 hpResult = hpResult / (
GetQuantity() + quantity_used);
8211
8212 hpResult *= GetMaxHealth();
8213 Math.Round(hpResult);
8214 SetHealth("", "Health", hpResult);
8215
8217 other_item.AddQuantity(-quantity_used);
8218 }
8219 }
8221 }
8222
8224 {
8225 #ifdef SERVER
8226 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8227 GetHierarchyParent().IncreaseLifetimeUp();
8228 #endif
8229 };
8230
8232 {
8233 PlayerBase p = PlayerBase.Cast(player);
8234
8235 array<int> recipesIds = p.m_Recipes;
8236 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8237 if (moduleRecipesManager)
8238 {
8239 EntityAI itemInHands = player.GetEntityInHands();
8240 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8241 }
8242
8243 for (int i = 0;i < recipesIds.Count(); i++)
8244 {
8245 int key = recipesIds.Get(i);
8246 string recipeName = moduleRecipesManager.GetRecipeName(key);
8248 }
8249 }
8250
8251
8252 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8253 {
8254 super.GetDebugActions(outputList);
8255
8256
8262
8263
8268
8273
8274
8278
8279
8281 {
8285 }
8286
8289
8290
8294
8296
8297 InventoryLocation loc = new InventoryLocation();
8298 GetInventory().GetCurrentInventoryLocation(loc);
8300 {
8301 if (Gizmo_IsSupported())
8304 }
8305
8307 }
8308
8309
8310
8311
8313 {
8314 super.OnAction(action_id, player, ctx);
8315
8317 {
8318 switch (action_id)
8319 {
8323 return true;
8327 return true;
8328 }
8329 }
8330
8332 {
8333 switch (action_id)
8334 {
8336 Delete();
8337 return true;
8338 }
8339 }
8340
8341 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8342 {
8343 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8344 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8345 PlayerBase p = PlayerBase.Cast(player);
8346 if (
EActions.RECIPES_RANGE_START < 1000)
8347 {
8348 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8349 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8350 }
8351 }
8352 #ifndef SERVER
8353 else if (action_id ==
EActions.WATCH_PLAYER)
8354 {
8355 PluginDeveloper.SetDeveloperItemClientEx(player);
8356 }
8357 #endif
8359 {
8360 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8361 {
8362 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8363 OnDebugButtonPressServer(id + 1);
8364 }
8365
8366 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8367 {
8368 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8370 }
8371
8372 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8373 {
8374 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8376 }
8377
8378 else if (action_id ==
EActions.ADD_QUANTITY)
8379 {
8380 if (IsMagazine())
8381 {
8382 Magazine mag = Magazine.Cast(this);
8383 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8384 }
8385 else
8386 {
8388 }
8389
8390 if (m_EM)
8391 {
8392 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8393 }
8394
8395 }
8396
8397 else if (action_id ==
EActions.REMOVE_QUANTITY)
8398 {
8399 if (IsMagazine())
8400 {
8401 Magazine mag2 = Magazine.Cast(this);
8402 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8403 }
8404 else
8405 {
8407 }
8408 if (m_EM)
8409 {
8410 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8411 }
8412
8413 }
8414
8415 else if (action_id ==
EActions.SET_QUANTITY_0)
8416 {
8418
8419 if (m_EM)
8420 {
8421 m_EM.SetEnergy(0);
8422 }
8423 }
8424
8425 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8426 {
8428
8429 if (m_EM)
8430 {
8431 m_EM.SetEnergy(m_EM.GetEnergyMax());
8432 }
8433 }
8434
8435 else if (action_id ==
EActions.ADD_HEALTH)
8436 {
8437 AddHealth("","",GetMaxHealth("","Health")/5);
8438 }
8439 else if (action_id ==
EActions.REMOVE_HEALTH)
8440 {
8441 AddHealth("","",-GetMaxHealth("","Health")/5);
8442 }
8443 else if (action_id ==
EActions.DESTROY_HEALTH)
8444 {
8445 SetHealth01("","",0);
8446 }
8447 else if (action_id ==
EActions.WATCH_ITEM)
8448 {
8450 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8451 #ifdef DEVELOPER
8452 SetDebugDeveloper_item(this);
8453 #endif
8454 }
8455
8456 else if (action_id ==
EActions.ADD_TEMPERATURE)
8457 {
8458 AddTemperature(20);
8459
8460 }
8461
8462 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8463 {
8464 AddTemperature(-20);
8465
8466 }
8467
8468 else if (action_id ==
EActions.FLIP_FROZEN)
8469 {
8470 SetFrozen(!GetIsFrozen());
8471
8472 }
8473
8474 else if (action_id ==
EActions.ADD_WETNESS)
8475 {
8477
8478 }
8479
8480 else if (action_id ==
EActions.REMOVE_WETNESS)
8481 {
8483
8484 }
8485
8486 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8487 {
8490
8491
8492 }
8493
8494 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8495 {
8498 }
8499
8500 else if (action_id ==
EActions.MAKE_SPECIAL)
8501 {
8502 auto debugParams = DebugSpawnParams.WithPlayer(player);
8503 OnDebugSpawnEx(debugParams);
8504 }
8505
8506 }
8507
8508
8509 return false;
8510 }
8511
8512
8513
8514
8518
8521
8522
8523
8525 {
8526 return false;
8527 }
8528
8529
8531 {
8532 return true;
8533 }
8534
8535
8537 {
8538 return true;
8539 }
8540
8541
8542
8544 {
8545 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8546 return g_Game.ConfigIsExisting(config_path);
8547 }
8548
8551 {
8552 return null;
8553 }
8554
8556 {
8557 return false;
8558 }
8559
8561 {
8562 return false;
8563 }
8564
8568
8569
8571 {
8572 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8573 return module_repairing.CanRepair(this, item_repair_kit);
8574 }
8575
8576
8577 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8578 {
8579 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8580 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8581 }
8582
8583
8585 {
8586
8587
8588
8589
8590
8591
8592
8593
8594 return 1;
8595 }
8596
8597
8598
8600 {
8602 }
8603
8604
8605
8607 {
8609 }
8610
8611
8620 {
8621 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8622
8623 if (player)
8624 {
8625 player.MessageStatus(text);
8626 }
8627 }
8628
8629
8638 {
8639 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8640
8641 if (player)
8642 {
8643 player.MessageAction(text);
8644 }
8645 }
8646
8647
8656 {
8657 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8658
8659 if (player)
8660 {
8661 player.MessageFriendly(text);
8662 }
8663 }
8664
8665
8674 {
8675 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8676
8677 if (player)
8678 {
8679 player.MessageImportant(text);
8680 }
8681 }
8682
8684 {
8685 return true;
8686 }
8687
8688
8689 override bool KindOf(
string tag)
8690 {
8691 bool found = false;
8692 string item_name = this.
GetType();
8694 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8695
8696 int array_size = item_tag_array.Count();
8697 for (int i = 0; i < array_size; i++)
8698 {
8699 if (item_tag_array.Get(i) == tag)
8700 {
8701 found = true;
8702 break;
8703 }
8704 }
8705 return found;
8706 }
8707
8708
8710 {
8711
8712 super.OnRPC(sender, rpc_type,ctx);
8713
8714
8715 switch (rpc_type)
8716 {
8717 #ifndef SERVER
8718 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8719 Param2<bool, string> p = new Param2<bool, string>(false, "");
8720
8722 return;
8723
8724 bool play = p.param1;
8725 string soundSet = p.param2;
8726
8727 if (play)
8728 {
8730 {
8732 {
8734 }
8735 }
8736 else
8737 {
8739 }
8740 }
8741 else
8742 {
8744 }
8745
8746 break;
8747 #endif
8748
8749 }
8750
8752 {
8754 }
8755 }
8756
8757
8758
8759
8761 {
8762 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8763 return plugin.GetID(
name);
8764 }
8765
8767 {
8768 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8769 return plugin.GetName(id);
8770 }
8771
8774 {
8775
8776
8777 int varFlags;
8778 if (!ctx.
Read(varFlags))
8779 return;
8780
8781 if (varFlags & ItemVariableFlags.FLOAT)
8782 {
8784 }
8785 }
8786
8788 {
8789
8790 super.SerializeNumericalVars(floats_out);
8791
8792
8793
8795 {
8797 }
8798
8800 {
8802 }
8803
8805 {
8807 }
8808
8810 {
8815 }
8816
8818 {
8820 }
8821 }
8822
8824 {
8825
8826 super.DeSerializeNumericalVars(floats);
8827
8828
8829 int index = 0;
8830 int mask = Math.Round(floats.Get(index));
8831
8832 index++;
8833
8835 {
8837 {
8839 }
8840 else
8841 {
8842 float quantity = floats.Get(index);
8844 }
8845 index++;
8846 }
8847
8849 {
8850 float wet = floats.Get(index);
8852 index++;
8853 }
8854
8856 {
8857 int liquidtype = Math.Round(floats.Get(index));
8859 index++;
8860 }
8861
8863 {
8865 index++;
8867 index++;
8869 index++;
8871 index++;
8872 }
8873
8875 {
8876 int cleanness = Math.Round(floats.Get(index));
8878 index++;
8879 }
8880 }
8881
8883 {
8884 super.WriteVarsToCTX(ctx);
8885
8886
8888 {
8890 }
8891
8893 {
8895 }
8896
8898 {
8900 }
8901
8903 {
8904 int r,g,b,a;
8910 }
8911
8913 {
8915 }
8916 }
8917
8919 {
8920 if (!super.ReadVarsFromCTX(ctx,version))
8921 return false;
8922
8923 int intValue;
8924 float value;
8925
8926 if (version < 140)
8927 {
8928 if (!ctx.
Read(intValue))
8929 return false;
8930
8931 m_VariablesMask = intValue;
8932 }
8933
8935 {
8936 if (!ctx.
Read(value))
8937 return false;
8938
8940 {
8942 }
8943 else
8944 {
8946 }
8947 }
8948
8949 if (version < 140)
8950 {
8952 {
8953 if (!ctx.
Read(value))
8954 return false;
8955 SetTemperatureDirect(value);
8956 }
8957 }
8958
8960 {
8961 if (!ctx.
Read(value))
8962 return false;
8964 }
8965
8967 {
8968 if (!ctx.
Read(intValue))
8969 return false;
8971 }
8972
8974 {
8975 int r,g,b,a;
8977 return false;
8979 return false;
8981 return false;
8983 return false;
8984
8986 }
8987
8989 {
8990 if (!ctx.
Read(intValue))
8991 return false;
8993 }
8994
8995 if (version >= 138 && version < 140)
8996 {
8998 {
8999 if (!ctx.
Read(intValue))
9000 return false;
9001 SetFrozen(intValue);
9002 }
9003 }
9004
9005 return true;
9006 }
9007
9008
9010 {
9013 {
9015 }
9016
9017 if (!super.OnStoreLoad(ctx, version))
9018 {
9020 return false;
9021 }
9022
9023 if (version >= 114)
9024 {
9025 bool hasQuickBarIndexSaved;
9026
9027 if (!ctx.
Read(hasQuickBarIndexSaved))
9028 {
9030 return false;
9031 }
9032
9033 if (hasQuickBarIndexSaved)
9034 {
9035 int itmQBIndex;
9036
9037
9038 if (!ctx.
Read(itmQBIndex))
9039 {
9041 return false;
9042 }
9043
9044 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9045 if (itmQBIndex != -1 && parentPlayer)
9046 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9047 }
9048 }
9049 else
9050 {
9051
9052 PlayerBase player;
9053 int itemQBIndex;
9054 if (version ==
int.
MAX)
9055 {
9056 if (!ctx.
Read(itemQBIndex))
9057 {
9059 return false;
9060 }
9061 }
9062 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9063 {
9064
9065 if (!ctx.
Read(itemQBIndex))
9066 {
9068 return false;
9069 }
9070 if (itemQBIndex != -1 && player)
9071 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9072 }
9073 }
9074
9075 if (version < 140)
9076 {
9077
9078 if (!LoadVariables(ctx, version))
9079 {
9081 return false;
9082 }
9083 }
9084
9085
9087 {
9089 return false;
9090 }
9091 if (version >= 132)
9092 {
9094 if (raib)
9095 {
9097 {
9099 return false;
9100 }
9101 }
9102 }
9103
9105 return true;
9106 }
9107
9108
9109
9111 {
9112 super.OnStoreSave(ctx);
9113
9114 PlayerBase player;
9115 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9116 {
9118
9119 int itemQBIndex = -1;
9120 itemQBIndex = player.FindQuickBarEntityIndex(this);
9121 ctx.
Write(itemQBIndex);
9122 }
9123 else
9124 {
9126 }
9127
9129
9131 if (raib)
9132 {
9134 }
9135 }
9136
9137
9139 {
9140 super.AfterStoreLoad();
9141
9143 {
9145 }
9146
9148 {
9151 }
9152 }
9153
9155 {
9156 super.EEOnAfterLoad();
9157
9159 {
9161 }
9162
9165 }
9166
9168 {
9169 return false;
9170 }
9171
9172
9173
9175 {
9177 {
9178 #ifdef PLATFORM_CONSOLE
9179
9181 {
9183 if (menu)
9184 {
9186 }
9187 }
9188 #endif
9189 }
9190
9192 {
9195 }
9196
9198 {
9199 SetWeightDirty();
9201 }
9203 {
9206 }
9207
9209 {
9212
9215 }
9217 {
9221 }
9222
9223 super.OnVariablesSynchronized();
9224 }
9225
9226
9227
9229 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9230 {
9231 if (!IsServerCheck(allow_client))
9232 return false;
9233
9235 return false;
9236
9239
9240 if (value <= (min + 0.001))
9241 value = min;
9242
9243 if (value == min)
9244 {
9245 if (destroy_config)
9246 {
9247 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9248 if (dstr)
9249 {
9251 this.Delete();
9252 return true;
9253 }
9254 }
9255 else if (destroy_forced)
9256 {
9258 this.Delete();
9259 return true;
9260 }
9261
9263 }
9264
9267
9269 {
9270 EntityAI parent = GetHierarchyRoot();
9271 InventoryLocation iLoc = new InventoryLocation();
9272 GetInventory().GetCurrentInventoryLocation(iLoc);
9274 {
9275 int iLocSlot = iLoc.
GetSlot();
9277 {
9279 }
9281 {
9283 }
9284 }
9285 }
9286
9288 {
9290
9291 if (delta)
9293 }
9294
9296
9297 return false;
9298 }
9299
9300
9302 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9303 {
9305 }
9306
9308 {
9311 }
9312
9314 {
9317 }
9318
9320 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9321 {
9322 float value_clamped = Math.Clamp(value, 0, 1);
9324 SetQuantity(result, destroy_config, destroy_forced);
9325 }
9326
9327
9330 {
9332 }
9333
9335 {
9337 }
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9349 {
9350 int slot = -1;
9351 GameInventory inventory = GetInventory();
9352 if (inventory)
9353 {
9354 InventoryLocation il = new InventoryLocation;
9357 }
9358
9360 }
9361
9363 {
9364 float quantity_max = 0;
9365
9367 {
9368 if (attSlotID != -1)
9369 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9370
9371 if (quantity_max <= 0)
9373 }
9374
9375 if (quantity_max <= 0)
9377
9378 return quantity_max;
9379 }
9380
9382 {
9384 }
9385
9387 {
9389 }
9390
9391
9393 {
9395 }
9396
9398 {
9400 }
9401
9403 {
9405 }
9406
9407
9409 {
9410
9411 float weightEx = GetWeightEx();
9412 float special = GetInventoryAndCargoWeight();
9413 return weightEx - special;
9414 }
9415
9416
9418 {
9420 }
9421
9423 {
9425 {
9426 #ifdef DEVELOPER
9427 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9428 {
9429 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9431 }
9432 #endif
9433
9435 }
9436 else if (HasEnergyManager())
9437 {
9438 #ifdef DEVELOPER
9439 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9440 {
9441 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9442 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9443 }
9444 #endif
9445 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9446 }
9447 else
9448 {
9449 #ifdef DEVELOPER
9450 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9451 {
9452 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9453 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9454 }
9455 #endif
9456 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9457 }
9458 }
9459
9462 {
9463 int item_count = 0;
9465
9466 GameInventory inventory = GetInventory();
9467 CargoBase cargo = inventory.
GetCargo();
9468 if (cargo != NULL)
9469 {
9471 }
9472
9474 for (int i = 0; i < nAttachments; ++i)
9475 {
9477 if (item)
9478 item_count += item.GetNumberOfItems();
9479 }
9480 return item_count;
9481 }
9482
9485 {
9486 float weight = 0;
9487 float wetness = 1;
9488 if (include_wetness)
9491 {
9492 weight = wetness * m_ConfigWeight;
9493 }
9495 {
9496 weight = 1;
9497 }
9498 return weight;
9499 }
9500
9501
9502
9504 {
9505 GameInventory inventory = GetInventory();
9506 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9507 {
9508 array<EntityAI> items = new array<EntityAI>;
9510 for (int i = 0; i < items.Count(); ++i)
9511 {
9513 if (item)
9514 {
9515 g_Game.ObjectDelete(item);
9516 }
9517 }
9518 }
9519 }
9520
9521
9522
9523
9525 {
9526 float energy = 0;
9527 if (HasEnergyManager())
9528 {
9529 energy = GetCompEM().GetEnergy();
9530 }
9531 return energy;
9532 }
9533
9534
9536 {
9537 super.OnEnergyConsumed();
9538
9540 }
9541
9543 {
9544 super.OnEnergyAdded();
9545
9547 }
9548
9549
9551 {
9552 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9553 {
9555 {
9556 float energy_0to1 = GetCompEM().GetEnergy0To1();
9558 }
9559 }
9560 }
9561
9562
9564 {
9565 return ConfigGetFloat("heatIsolation");
9566 }
9567
9569 {
9571 }
9572
9574 {
9575 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9576 if (
g_Game.ConfigIsExisting(paramPath))
9577 return g_Game.ConfigGetFloat(paramPath);
9578
9579 return 0.0;
9580 }
9581
9583 {
9584 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9585 if (
g_Game.ConfigIsExisting(paramPath))
9586 return g_Game.ConfigGetFloat(paramPath);
9587
9588 return 0.0;
9589 }
9590
9591 override void SetWet(
float value,
bool allow_client =
false)
9592 {
9593 if (!IsServerCheck(allow_client))
9594 return;
9595
9598
9600
9601 m_VarWet = Math.Clamp(value, min, max);
9602
9604 {
9607 }
9608 }
9609
9610 override void AddWet(
float value)
9611 {
9613 }
9614
9616 {
9618 }
9619
9621 {
9623 }
9624
9626 {
9628 }
9629
9631 {
9633 }
9634
9636 {
9638 }
9639
9641 {
9644 if (newLevel != oldLevel)
9645 {
9647 }
9648 }
9649
9651 {
9652 SetWeightDirty();
9653 }
9654
9656 {
9657 return GetWetLevelInternal(
m_VarWet);
9658 }
9659
9660
9661
9663 {
9665 }
9666
9668 {
9670 }
9671
9673 {
9675 }
9676
9678 {
9680 }
9681
9682
9683
9685 {
9686 if (ConfigIsExisting("itemModelLength"))
9687 {
9688 return ConfigGetFloat("itemModelLength");
9689 }
9690 return 0;
9691 }
9692
9694 {
9695 if (ConfigIsExisting("itemAttachOffset"))
9696 {
9697 return ConfigGetFloat("itemAttachOffset");
9698 }
9699 return 0;
9700 }
9701
9702 override void SetCleanness(
int value,
bool allow_client =
false)
9703 {
9704 if (!IsServerCheck(allow_client))
9705 return;
9706
9708
9710
9713 }
9714
9716 {
9718 }
9719
9721 {
9722 return true;
9723 }
9724
9725
9726
9727
9729 {
9731 }
9732
9734 {
9736 }
9737
9738
9739
9740
9741 override void SetColor(
int r,
int g,
int b,
int a)
9742 {
9748 }
9750 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9751 {
9756 }
9757
9759 {
9761 }
9762
9765 {
9766 int r,g,b,a;
9768 r = r/255;
9769 g = g/255;
9770 b = b/255;
9771 a = a/255;
9772 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9773 }
9774
9775
9776
9777 override void SetLiquidType(
int value,
bool allow_client =
false)
9778 {
9779 if (!IsServerCheck(allow_client))
9780 return;
9781
9786 }
9787
9789 {
9790 return ConfigGetInt("varLiquidTypeInit");
9791 }
9792
9794 {
9796 }
9797
9799 {
9801 SetFrozen(false);
9802 }
9803
9806 {
9807 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9808 }
9809
9810
9813 {
9814 PlayerBase nplayer;
9815 if (PlayerBase.CastTo(nplayer, player))
9816 {
9818 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9819 }
9820 }
9821
9822
9825 {
9826 PlayerBase nplayer;
9827 if (PlayerBase.CastTo(nplayer,player))
9828 {
9829 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9830 }
9831
9832 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9833
9834 if (HasEnergyManager())
9835 {
9836 GetCompEM().UpdatePlugState();
9837 }
9838 }
9839
9840
9842 {
9843 super.OnPlacementStarted(player);
9844
9846 }
9847
9848 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9849 {
9851 {
9852 m_AdminLog.OnPlacementComplete(player,
this);
9853 }
9854
9855 super.OnPlacementComplete(player, position, orientation);
9856 }
9857
9858
9859
9860
9861
9863 {
9865 {
9866 return true;
9867 }
9868 else
9869 {
9870 return false;
9871 }
9872 }
9873
9874
9876 {
9878 {
9880 }
9881 }
9882
9883
9885 {
9887 }
9888
9890 {
9892 }
9893
9894 override void InsertAgent(
int agent,
float count = 1)
9895 {
9896 if (count < 1)
9897 return;
9898
9900 }
9901
9904 {
9906 }
9907
9908
9910 {
9912 }
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9956 {
9958 return false;
9959 return true;
9960 }
9961
9963 {
9964
9966 }
9967
9968
9971 {
9972 super.CheckForRoofLimited(timeTresholdMS);
9973
9974 float time =
g_Game.GetTime();
9975 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9976 {
9977 m_PreviousRoofTestTime = time;
9978 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9979 }
9980 }
9981
9982
9984 {
9986 {
9987 return 0;
9988 }
9989
9990 if (GetInventory().GetAttachmentSlotsCount() != 0)
9991 {
9992 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9993 if (filter)
9994 return filter.GetProtectionLevel(type, false, system);
9995 else
9996 return 0;
9997 }
9998
9999 string subclassPath, entryName;
10000
10001 switch (type)
10002 {
10004 entryName = "biological";
10005 break;
10007 entryName = "chemical";
10008 break;
10009 default:
10010 entryName = "biological";
10011 break;
10012 }
10013
10014 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10015
10016 return g_Game.ConfigGetFloat(subclassPath + entryName);
10017 }
10018
10019
10020
10023 {
10024 if (!IsMagazine())
10026
10028 }
10029
10030
10031
10032
10033
10038 {
10039 return true;
10040 }
10041
10043 {
10045 }
10046
10047
10048
10049
10050
10052 {
10053 if (parent)
10054 {
10055 if (parent.IsInherited(DayZInfected))
10056 return true;
10057
10058 if (!parent.IsRuined())
10059 return true;
10060 }
10061
10062 return true;
10063 }
10064
10066 {
10067 if (!super.CanPutAsAttachment(parent))
10068 {
10069 return false;
10070 }
10071
10072 if (!IsRuined() && !parent.IsRuined())
10073 {
10074 return true;
10075 }
10076
10077 return false;
10078 }
10079
10081 {
10082
10083
10084
10085
10086 return super.CanReceiveItemIntoCargo(item);
10087 }
10088
10090 {
10091
10092
10093
10094
10095 GameInventory attachmentInv = attachment.GetInventory();
10097 {
10098 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10099 return false;
10100 }
10101
10102 InventoryLocation loc = new InventoryLocation();
10103 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10104 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10105 return false;
10106
10107 return super.CanReceiveAttachment(attachment, slotId);
10108 }
10109
10111 {
10112 if (!super.CanReleaseAttachment(attachment))
10113 return false;
10114
10115 return GetInventory().AreChildrenAccessible();
10116 }
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10139 {
10140 int id = muzzle_owner.GetMuzzleID();
10141 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10142
10143 if (WPOF_array)
10144 {
10145 for (int i = 0; i < WPOF_array.Count(); i++)
10146 {
10147 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10148
10149 if (WPOF)
10150 {
10151 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10152 }
10153 }
10154 }
10155 }
10156
10157
10159 {
10160 int id = muzzle_owner.GetMuzzleID();
10162
10163 if (WPOBE_array)
10164 {
10165 for (int i = 0; i < WPOBE_array.Count(); i++)
10166 {
10167 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10168
10169 if (WPOBE)
10170 {
10171 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10172 }
10173 }
10174 }
10175 }
10176
10177
10179 {
10180 int id = muzzle_owner.GetMuzzleID();
10181 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10182
10183 if (WPOOH_array)
10184 {
10185 for (int i = 0; i < WPOOH_array.Count(); i++)
10186 {
10187 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10188
10189 if (WPOOH)
10190 {
10191 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10192 }
10193 }
10194 }
10195 }
10196
10197
10199 {
10200 int id = muzzle_owner.GetMuzzleID();
10201 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10202
10203 if (WPOOH_array)
10204 {
10205 for (int i = 0; i < WPOOH_array.Count(); i++)
10206 {
10207 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10208
10209 if (WPOOH)
10210 {
10211 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10212 }
10213 }
10214 }
10215 }
10216
10217
10219 {
10220 int id = muzzle_owner.GetMuzzleID();
10221 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10222
10223 if (WPOOH_array)
10224 {
10225 for (int i = 0; i < WPOOH_array.Count(); i++)
10226 {
10227 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10228
10229 if (WPOOH)
10230 {
10231 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10232 }
10233 }
10234 }
10235 }
10236
10237
10238
10240 {
10242 {
10243 return true;
10244 }
10245
10246 return false;
10247 }
10248
10250 {
10252 {
10253 return true;
10254 }
10255
10256 return false;
10257 }
10258
10260 {
10262 {
10263 return true;
10264 }
10265
10266 return false;
10267 }
10268
10270 {
10271 return false;
10272 }
10273
10276 {
10277 return UATimeSpent.DEFAULT_DEPLOY;
10278 }
10279
10280
10281
10282
10284 {
10286 SetSynchDirty();
10287 }
10288
10290 {
10292 }
10293
10294
10296 {
10297 return false;
10298 }
10299
10302 {
10303 string att_type = "None";
10304
10305 if (ConfigIsExisting("soundAttType"))
10306 {
10307 att_type = ConfigGetString("soundAttType");
10308 }
10309
10311 }
10312
10314 {
10316 }
10317
10318
10319
10320
10321
10327
10329 {
10332
10334 }
10335
10336
10338 {
10340 return;
10341
10343
10346
10349
10350 SoundParameters params = new SoundParameters();
10354 }
10355
10356
10358 {
10360 {
10363
10364 SetSynchDirty();
10365
10368 }
10369 }
10370
10372 {
10374 }
10375
10376
10378 {
10380 return;
10381
10383 SetSynchDirty();
10384
10387 }
10388
10390 {
10393 }
10394
10396 {
10398 }
10399
10400 void OnApply(PlayerBase player);
10401
10403 {
10404 return 1.0;
10405 };
10406
10408 {
10410 }
10411
10413 {
10415 }
10416
10418
10420 {
10421 SetDynamicPhysicsLifeTime(0.01);
10423 }
10424
10426 {
10427 array<string> zone_names = new array<string>;
10428 GetDamageZones(zone_names);
10429 for (int i = 0; i < zone_names.Count(); i++)
10430 {
10431 SetHealthMax(zone_names.Get(i),"Health");
10432 }
10433 SetHealthMax("","Health");
10434 }
10435
10438 {
10439 float global_health = GetHealth01("","Health");
10440 array<string> zones = new array<string>;
10441 GetDamageZones(zones);
10442
10443 for (int i = 0; i < zones.Count(); i++)
10444 {
10445 SetHealth01(zones.Get(i),"Health",global_health);
10446 }
10447 }
10448
10451 {
10452 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10453 }
10454
10456 {
10457 if (!hasRootAsPlayer)
10458 {
10459 if (refParentIB)
10460 {
10461
10462 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10463 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10464
10465 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10466 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10467
10470 }
10471 else
10472 {
10473
10476 }
10477 }
10478 }
10479
10481 {
10483 {
10484 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10485 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10486 {
10487 float heatPermCoef = 1.0;
10489 while (ent)
10490 {
10491 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10492 ent = ent.GetHierarchyParent();
10493 }
10494
10495 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10496 }
10497 }
10498 }
10499
10501 {
10502
10503 EntityAI parent = GetHierarchyParent();
10504 if (!parent)
10505 {
10506 hasParent = false;
10507 hasRootAsPlayer = false;
10508 }
10509 else
10510 {
10511 hasParent = true;
10512 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10513 refParentIB =
ItemBase.Cast(parent);
10514 }
10515 }
10516
10517 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10518 {
10519
10520 }
10521
10523 {
10524
10525 return false;
10526 }
10527
10529 {
10530
10531
10532 return false;
10533 }
10534
10536 {
10537
10538 return false;
10539 }
10540
10543 {
10544 return !GetIsFrozen() &&
IsOpen();
10545 }
10546
10548 {
10549 bool hasParent = false, hasRootAsPlayer = false;
10551
10552 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10553 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10554
10555 if (wwtu || foodDecay)
10556 {
10560
10561 if (processWetness || processTemperature || processDecay)
10562 {
10564
10565 if (processWetness)
10566 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10567
10568 if (processTemperature)
10570
10571 if (processDecay)
10572 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10573 }
10574 }
10575 }
10576
10579 {
10581 }
10582
10584 {
10587
10588 return super.GetTemperatureFreezeThreshold();
10589 }
10590
10592 {
10595
10596 return super.GetTemperatureThawThreshold();
10597 }
10598
10600 {
10603
10604 return super.GetItemOverheatThreshold();
10605 }
10606
10608 {
10610 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10611
10612 return super.GetTemperatureFreezeTime();
10613 }
10614
10616 {
10618 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10619
10620 return super.GetTemperatureThawTime();
10621 }
10622
10627
10629 {
10630 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10631 }
10632
10634 {
10635 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10636 }
10637
10640 {
10642 }
10643
10645 {
10647 }
10648
10650 {
10652 }
10653
10656 {
10657 return null;
10658 }
10659
10662 {
10663 return false;
10664 }
10665
10667 {
10669 {
10672 if (!trg)
10673 {
10675 explosive = this;
10676 }
10677
10678 explosive.PairRemote(trg);
10680
10681 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10682 trg.SetPersistentPairID(persistentID);
10683 explosive.SetPersistentPairID(persistentID);
10684
10685 return true;
10686 }
10687 return false;
10688 }
10689
10692 {
10693 float ret = 1.0;
10696 ret *= GetHealth01();
10697
10698 return ret;
10699 }
10700
10701 #ifdef DEVELOPER
10702 override void SetDebugItem()
10703 {
10704 super.SetDebugItem();
10705 _itemBase = this;
10706 }
10707
10709 {
10710 string text = super.GetDebugText();
10711
10713 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10714
10715 return text;
10716 }
10717 #endif
10718
10720 {
10721 return true;
10722 }
10723
10725
10727
10729 {
10732 }
10733
10734
10742
10758
10759 [
Obsolete(
"Use ItemSoundHandler instead")]
10762 {
10763 if (!
g_Game.IsDedicatedServer())
10764 {
10765 if (ConfigIsExisting("attachSoundSet"))
10766 {
10767 string cfg_path = "";
10768 string soundset = "";
10769 string type_name =
GetType();
10770
10773 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10774 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10775
10776 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10777 {
10778 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10779 {
10780 if (cfg_slot_array[i] == slot_type)
10781 {
10782 soundset = cfg_soundset_array[i];
10783 break;
10784 }
10785 }
10786 }
10787
10788 if (soundset != "")
10789 {
10790 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10792 }
10793 }
10794 }
10795 }
10796
10798}
10799
10801{
10803 if (entity)
10804 {
10805 bool is_item = entity.IsInherited(
ItemBase);
10806 if (is_item && full_quantity)
10807 {
10810 }
10811 }
10812 else
10813 {
10815 return NULL;
10816 }
10817 return entity;
10818}
10819
10821{
10822 if (item)
10823 {
10824 if (health > 0)
10825 item.SetHealth("", "", health);
10826
10827 if (item.CanHaveTemperature())
10828 {
10830 if (item.CanFreeze())
10831 item.SetFrozen(false);
10832 }
10833
10834 if (item.HasEnergyManager())
10835 {
10836 if (quantity >= 0)
10837 {
10838 item.GetCompEM().SetEnergy0To1(quantity);
10839 }
10840 else
10841 {
10843 }
10844 }
10845 else if (item.IsMagazine())
10846 {
10847 Magazine mag = Magazine.Cast(item);
10848 if (quantity >= 0)
10849 {
10850 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10851 }
10852 else
10853 {
10855 }
10856
10857 }
10858 else
10859 {
10860 if (quantity >= 0)
10861 {
10862 item.SetQuantityNormalized(quantity, false);
10863 }
10864 else
10865 {
10867 }
10868
10869 }
10870 }
10871}
10872
10873#ifdef DEVELOPER
10875#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.