5851{
5853 {
5854 return true;
5855 }
5856};
5857
5859{
5860
5861};
5862
5863
5864
5866{
5870
5872
5875
5876
5877
5878
5879
5888
5894
5899
5904
5925 protected bool m_IsResultOfSplit
5926
5928
5933
5934
5935
5937
5941
5942
5943
5945
5948
5949
5950
5956
5957
5965
5968
5969
5971
5972
5974
5975
5980
5981
5986
5988
5989
5991
5992
5994 {
5999
6000 if (!
g_Game.IsDedicatedServer())
6001 {
6003 {
6005
6007 {
6009 }
6010 }
6011
6014 }
6015
6016 m_OldLocation = null;
6017
6019 {
6021 }
6022
6023 if (ConfigIsExisting("headSelectionsToHide"))
6024 {
6027 }
6028
6030 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6031 {
6033 }
6034
6036
6037 m_IsResultOfSplit = false;
6038
6040 }
6041
6043 {
6044 super.InitItemVariables();
6045
6051 m_Count = ConfigGetInt(
"count");
6052
6055
6060
6063
6068
6080
6084
6085
6088 if (ConfigIsExisting("canBeSplit"))
6089 {
6092 }
6093
6095 if (ConfigIsExisting("itemBehaviour"))
6097
6098
6101 RegisterNetSyncVariableInt("m_VarLiquidType");
6102 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6103
6104 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6105 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6106 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6107
6108 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6109 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6110 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6111 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6112
6113 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6114 RegisterNetSyncVariableBool("m_IsTakeable");
6115 RegisterNetSyncVariableBool("m_IsHologram");
6116
6119 {
6122 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6123 }
6124
6126
6128 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6130
6132 }
6133
6135 {
6137 }
6138
6140 {
6143 {
6148 }
6149 }
6150
6151 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6152 {
6154 {
6157 }
6158
6160 }
6161
6163 {
6169 }
6170
6172
6174 {
6176
6177 if (!action)
6178 {
6179 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6180 return;
6181 }
6182
6184 if (!ai)
6185 {
6187 return;
6188 }
6189
6191 if (!action_array)
6192 {
6193 action_array = new array<ActionBase_Basic>;
6195 }
6196 if (LogManager.IsActionLogEnable())
6197 {
6198 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6199 }
6200
6201 if (action_array.Find(action) != -1)
6202 {
6203 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6204 }
6205 else
6206 {
6207 action_array.Insert(action);
6208 }
6209 }
6210
6212 {
6213 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6214 ActionBase action = player.GetActionManager().GetAction(actionName);
6217
6218 if (action_array)
6219 {
6220 action_array.RemoveItem(action);
6221 }
6222 }
6223
6224
6225
6227 {
6228 ActionOverrideData overrideData = new ActionOverrideData();
6232
6234 if (!actionMap)
6235 {
6238 }
6239
6240 actionMap.Insert(this.
Type(), overrideData);
6241
6242 }
6243
6245
6247
6248
6250 {
6253
6256
6257 string config_to_search = "CfgVehicles";
6258 string muzzle_owner_config;
6259
6261 {
6262 if (IsInherited(Weapon))
6263 config_to_search = "CfgWeapons";
6264
6265 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6266
6267 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6268
6269 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6270
6271 if (config_OnFire_subclass_count > 0)
6272 {
6273 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6274
6275 for (int i = 0; i < config_OnFire_subclass_count; i++)
6276 {
6277 string particle_class = "";
6278 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6279 string config_OnFire_entry = config_OnFire_class + particle_class;
6280 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6281 WPOF_array.Insert(WPOF);
6282 }
6283
6284
6286 }
6287 }
6288
6290 {
6291 config_to_search = "CfgWeapons";
6292 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6293
6294 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6295
6296 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6297
6298 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6299 {
6300 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6301
6302 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6303 {
6304 string particle_class2 = "";
6305 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6306 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6307 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6308 WPOBE_array.Insert(WPOBE);
6309 }
6310
6311
6313 }
6314 }
6315 }
6316
6317
6319 {
6322
6324 {
6325 string config_to_search = "CfgVehicles";
6326
6327 if (IsInherited(Weapon))
6328 config_to_search = "CfgWeapons";
6329
6330 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6331 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6332
6333 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6334 {
6335
6337
6339 {
6341 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6343 return;
6344 }
6345
6348
6349
6350
6351 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6352 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6353
6354 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6355 {
6356 string particle_class = "";
6357 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6358 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6359 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6360
6361 if (entry_type == CT_CLASS)
6362 {
6363 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6364 WPOOH_array.Insert(WPOF);
6365 }
6366 }
6367
6368
6370 }
6371 }
6372 }
6373
6375 {
6377 }
6378
6380 {
6382 {
6384
6387
6390
6391 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6392 }
6393 }
6394
6396 {
6398 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6399
6401 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6402
6404 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6405
6407 {
6409 }
6410 }
6411
6413 {
6415 }
6416
6418 {
6421 else
6423
6425 {
6428 }
6429 else
6430 {
6433
6436 }
6437
6439 }
6440
6442 {
6444 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6445 }
6446
6448 {
6450 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6452 }
6453
6455 {
6457 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6458 }
6459
6461 {
6464
6465 OverheatingParticle OP = new OverheatingParticle();
6470
6472 }
6473
6475 {
6478
6479 return -1;
6480 }
6481
6483 {
6485 {
6488
6489 for (int i = count; i > 0; --i)
6490 {
6491 int id = i - 1;
6494
6497
6498 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6499 {
6500 if (p)
6501 {
6504 }
6505 }
6506 }
6507 }
6508 }
6509
6511 {
6513 {
6515 {
6516 int id = i - 1;
6518
6519 if (OP)
6520 {
6522
6523 if (p)
6524 {
6526 }
6527
6528 delete OP;
6529 }
6530 }
6531
6534 }
6535 }
6536
6539 {
6540 return 0.0;
6541 }
6542
6543
6545 {
6546 return 250;
6547 }
6548
6550 {
6551 return 0;
6552 }
6553
6556 {
6558 return true;
6559
6560 return false;
6561 }
6562
6565 {
6568
6570 {
6572 }
6573 else
6574 {
6575
6577 }
6578
6580 }
6581
6588 {
6589 return -1;
6590 }
6591
6592
6593
6594
6596 {
6598 {
6599 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6600 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6601
6602 if (r_index >= 0)
6603 {
6604 InventoryLocation r_il = new InventoryLocation;
6605 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6606
6607 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6610 {
6611 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6612 }
6614 {
6615 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6616 }
6617
6618 }
6619
6620 player.GetHumanInventory().ClearUserReservedLocation(this);
6621 }
6622
6625 }
6626
6627
6628
6629
6631 {
6632 return ItemBase.m_DebugActionsMask;
6633 }
6634
6636 {
6637 return ItemBase.m_DebugActionsMask & mask;
6638 }
6639
6641 {
6642 ItemBase.m_DebugActionsMask = mask;
6643 }
6644
6646 {
6647 ItemBase.m_DebugActionsMask |= mask;
6648 }
6649
6651 {
6652 ItemBase.m_DebugActionsMask &= ~mask;
6653 }
6654
6656 {
6658 {
6660 }
6661 else
6662 {
6664 }
6665 }
6666
6667
6669 {
6670 if (GetEconomyProfile())
6671 {
6672 float q_max = GetEconomyProfile().GetQuantityMax();
6673 if (q_max > 0)
6674 {
6675 float q_min = GetEconomyProfile().GetQuantityMin();
6676 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6677
6679 {
6680 ComponentEnergyManager comp = GetCompEM();
6682 {
6684 }
6685 }
6687 {
6689
6690 }
6691
6692 }
6693 }
6694 }
6695
6698 {
6699 EntityAI parent = GetHierarchyParent();
6700
6701 if (parent)
6702 {
6703 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6704 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6705 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6706 }
6707 }
6708
6711 {
6712 EntityAI parent = GetHierarchyParent();
6713
6714 if (parent)
6715 {
6716 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6717 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6718 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6719 }
6720 }
6721
6723 {
6724
6725
6726
6727
6729
6731 {
6732 if (ScriptInputUserData.CanStoreInputUserData())
6733 {
6734 ScriptInputUserData ctx = new ScriptInputUserData;
6740 ctx.
Write(use_stack_max);
6743
6745 {
6746 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6747 }
6748 }
6749 }
6750 else if (!
g_Game.IsMultiplayer())
6751 {
6753 }
6754 }
6755
6757 {
6759 }
6760
6762 {
6764 }
6765
6767 {
6769 }
6770
6772 {
6773
6774 return false;
6775 }
6776
6778 {
6779 return false;
6780 }
6781
6785 {
6786 return false;
6787 }
6788
6790 {
6791 return "";
6792 }
6793
6795
6797 {
6798 return false;
6799 }
6800
6802 {
6803 return true;
6804 }
6805
6806
6807
6809 {
6810 return true;
6811 }
6812
6814 {
6815 return true;
6816 }
6817
6819 {
6820 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6822 }
6823
6825 {
6827 }
6828
6830 {
6832 if (!is_being_placed)
6834 SetSynchDirty();
6835 }
6836
6837
6839
6841 {
6843 }
6844
6846 {
6848 }
6849
6851 {
6852 return 1;
6853 }
6854
6856 {
6857 return false;
6858 }
6859
6861 {
6863 SetSynchDirty();
6864 }
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6901 {
6902 super.OnMovedInsideCargo(container);
6903
6904 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6905 }
6906
6907 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6908 {
6909 super.EEItemLocationChanged(oldLoc, newLoc);
6910
6911 PlayerBase newPlayer = null;
6912 PlayerBase oldPlayer = null;
6913
6914 if (newLoc.GetParent())
6915 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6916
6917 if (oldLoc.GetParent())
6918 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6919
6921 {
6922 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6923
6924 if (rIndex >= 0)
6925 {
6926 InventoryLocation rIl = new InventoryLocation;
6927 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6928
6929 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6932 {
6933 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6934 }
6936 {
6938 }
6939
6940 }
6941 }
6942
6944 {
6945 if (newPlayer)
6946 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6947
6948 if (newPlayer == oldPlayer)
6949 {
6950 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6951 {
6953 {
6954 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6955 {
6956 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6957 }
6958 }
6959 else
6960 {
6961 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6962 }
6963 }
6964
6965 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6966 {
6967 int type = oldLoc.GetType();
6969 {
6970 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6971 }
6973 {
6974 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6975 }
6976 }
6977 if (!m_OldLocation)
6978 {
6979 m_OldLocation = new InventoryLocation;
6980 }
6981 m_OldLocation.Copy(oldLoc);
6982 }
6983 else
6984 {
6985 if (m_OldLocation)
6986 {
6987 m_OldLocation.Reset();
6988 }
6989 }
6990
6991 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6992 }
6993 else
6994 {
6995 if (newPlayer)
6996 {
6997 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6998 if (resIndex >= 0)
6999 {
7000 InventoryLocation il = new InventoryLocation;
7001 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7003 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7006 {
7007 il.
GetParent().GetOnReleaseLock().Invoke(it);
7008 }
7010 {
7012 }
7013
7014 }
7015 }
7017 {
7018
7020 }
7021
7022 if (m_OldLocation)
7023 {
7024 m_OldLocation.Reset();
7025 }
7026 }
7027
7029 {
7030 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7031 }
7032
7034 {
7035 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7036 }
7037 }
7038
7039 override void EOnContact(IEntity other, Contact extra)
7040 {
7042 {
7043 int liquidType = -1;
7045 if (impactSpeed > 0.0)
7046 {
7048 #ifndef SERVER
7050 #else
7052 SetSynchDirty();
7053 #endif
7055 }
7056 }
7057
7058 #ifdef SERVER
7059 if (GetCompEM() && GetCompEM().IsPlugged())
7060 {
7061 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7062 GetCompEM().UnplugThis();
7063 }
7064 #endif
7065 }
7066
7068
7070 {
7072 }
7073
7075 {
7076
7077 }
7078
7080 {
7081 super.OnItemLocationChanged(old_owner, new_owner);
7082
7083 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7084 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7085
7086 if (!relatedPlayer && playerNew)
7087 relatedPlayer = playerNew;
7088
7089 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7090 {
7092 if (actionMgr)
7093 {
7094 ActionBase currentAction = actionMgr.GetRunningAction();
7095 if (currentAction)
7097 }
7098 }
7099
7100 Man ownerPlayerOld = null;
7101 Man ownerPlayerNew = null;
7102
7103 if (old_owner)
7104 {
7105 if (old_owner.
IsMan())
7106 {
7107 ownerPlayerOld = Man.Cast(old_owner);
7108 }
7109 else
7110 {
7111 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7112 }
7113 }
7114 else
7115 {
7117 {
7119
7120 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7121 {
7122 GetCompEM().UnplugThis();
7123 }
7124 }
7125 }
7126
7127 if (new_owner)
7128 {
7129 if (new_owner.
IsMan())
7130 {
7131 ownerPlayerNew = Man.Cast(new_owner);
7132 }
7133 else
7134 {
7135 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7136 }
7137 }
7138
7139 if (ownerPlayerOld != ownerPlayerNew)
7140 {
7141 if (ownerPlayerOld)
7142 {
7143 array<EntityAI> subItemsExit = new array<EntityAI>;
7145 for (int i = 0; i < subItemsExit.Count(); i++)
7146 {
7149 }
7150 }
7151
7152 if (ownerPlayerNew)
7153 {
7154 array<EntityAI> subItemsEnter = new array<EntityAI>;
7156 for (int j = 0; j < subItemsEnter.Count(); j++)
7157 {
7160 }
7161 }
7162 }
7163 else if (ownerPlayerNew != null)
7164 {
7165 PlayerBase nplayer;
7166 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7167 {
7168 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7170 for (int k = 0; k < subItemsUpdate.Count(); k++)
7171 {
7173 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7174 }
7175 }
7176 }
7177
7178 if (old_owner)
7179 old_owner.OnChildItemRemoved(this);
7180 if (new_owner)
7181 new_owner.OnChildItemReceived(this);
7182 }
7183
7184
7186 {
7187 super.EEDelete(parent);
7188 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7189 if (player)
7190 {
7192
7193 if (player.IsAlive())
7194 {
7195 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7196 if (r_index >= 0)
7197 {
7198 InventoryLocation r_il = new InventoryLocation;
7199 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7200
7201 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7204 {
7205 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7206 }
7208 {
7209 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7210 }
7211
7212 }
7213
7214 player.RemoveQuickBarEntityShortcut(this);
7215 }
7216 }
7217 }
7218
7220 {
7221 super.EEKilled(killer);
7222
7225 {
7226 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7227 {
7228 if (IsMagazine())
7229 {
7230 if (Magazine.Cast(this).GetAmmoCount() > 0)
7231 {
7233 }
7234 }
7235 else
7236 {
7238 }
7239 }
7240 }
7241 }
7242
7244 {
7245 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7246
7247 super.OnWasAttached(parent, slot_id);
7248
7251
7254 }
7255
7257 {
7258 super.OnWasDetached(parent, slot_id);
7259
7262
7265 }
7266
7268 {
7269 int idx;
7272
7273 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7274 if (inventory_slots.Count() < 1)
7275 {
7276 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7277 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7278 }
7279 else
7280 {
7281 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7282 }
7283
7284 idx = inventory_slots.Find(slot);
7285 if (idx < 0)
7286 return "";
7287
7288 return attach_types.Get(idx);
7289 }
7290
7292 {
7293 int idx = -1;
7294 string slot;
7295
7298
7299 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7300 if (inventory_slots.Count() < 1)
7301 {
7302 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7303 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7304 }
7305 else
7306 {
7307 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7308 if (detach_types.Count() < 1)
7309 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7310 }
7311
7312 for (int i = 0; i < inventory_slots.Count(); i++)
7313 {
7314 slot = inventory_slots.Get(i);
7315 }
7316
7317 if (slot != "")
7318 {
7319 if (detach_types.Count() == 1)
7320 idx = 0;
7321 else
7322 idx = inventory_slots.Find(slot);
7323 }
7324 if (idx < 0)
7325 return "";
7326
7327 return detach_types.Get(idx);
7328 }
7329
7331 {
7332
7334
7335
7336 float min_time = 1;
7337 float max_time = 3;
7338 float delay = Math.RandomFloat(min_time, max_time);
7339
7340 explode_timer.Run(delay, this, "DoAmmoExplosion");
7341 }
7342
7344 {
7345 Magazine magazine = Magazine.Cast(this);
7346 int pop_sounds_count = 6;
7347 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7348
7349
7350 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7351 string sound_name = pop_sounds[ sound_idx ];
7352 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7353
7354
7355 magazine.ServerAddAmmoCount(-1);
7356
7357
7358 float min_temp_to_explode = 100;
7359
7360 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7361 {
7363 }
7364 }
7365
7366
7367 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7368 {
7369 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7370
7371 const int CHANCE_DAMAGE_CARGO = 4;
7372 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7373 const int CHANCE_DAMAGE_NOTHING = 2;
7374
7376 {
7377 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7378 int chances;
7379 int rnd;
7380
7381 if (GetInventory().GetCargo())
7382 {
7383 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7384 rnd = Math.RandomInt(0,chances);
7385
7386 if (rnd < CHANCE_DAMAGE_CARGO)
7387 {
7389 }
7390 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7391 {
7393 }
7394 }
7395 else
7396 {
7397 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7398 rnd = Math.RandomInt(0,chances);
7399
7400 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7401 {
7403 }
7404 }
7405 }
7406 }
7407
7409 {
7410 CargoBase cargo = GetInventory().GetCargo();
7411 if (cargo)
7412 {
7414 if (item_count > 0)
7415 {
7416 int random_pick = Math.RandomInt(0, item_count);
7418 if (!item.IsExplosive())
7419 {
7420 item.AddHealth("","",damage);
7421 return true;
7422 }
7423 }
7424 }
7425 return false;
7426 }
7427
7429 {
7430 GameInventory inventory = GetInventory();
7432 if (attachment_count > 0)
7433 {
7434 int random_pick = Math.RandomInt(0, attachment_count);
7436 if (!attachment.IsExplosive())
7437 {
7438 attachment.AddHealth("","",damage);
7439 return true;
7440 }
7441 }
7442 return false;
7443 }
7444
7446 {
7448 }
7449
7451 {
7453 return GetInventory().CanRemoveEntity();
7454
7455 return false;
7456 }
7457
7459 {
7460
7462 return false;
7463
7464
7466 return false;
7467
7468
7469
7471 if (delta == 0)
7472 return false;
7473
7474
7475 return true;
7476 }
7477
7479 {
7481 {
7482 if (ScriptInputUserData.CanStoreInputUserData())
7483 {
7484 ScriptInputUserData ctx = new ScriptInputUserData;
7489 ctx.
Write(destination_entity);
7493 }
7494 }
7495 else if (!
g_Game.IsMultiplayer())
7496 {
7498 }
7499 }
7500
7502 {
7503 float split_quantity_new;
7507 InventoryLocation loc = new InventoryLocation;
7508
7509 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7510 {
7512 split_quantity_new = stack_max;
7513 else
7515
7517 {
7518 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7519 if (new_item)
7520 {
7521 new_item.SetResultOfSplit(true);
7522 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7524 new_item.
SetQuantity(split_quantity_new,
false,
true);
7525 }
7526 }
7527 }
7528 else if (destination_entity && slot_id == -1)
7529 {
7530 if (quantity > stack_max)
7531 split_quantity_new = stack_max;
7532 else
7533 split_quantity_new = quantity;
7534
7536 {
7537 GameInventory destinationInventory = destination_entity.GetInventory();
7539 {
7542 }
7543
7544 if (new_item)
7545 {
7546 new_item.SetResultOfSplit(true);
7547 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7549 new_item.
SetQuantity(split_quantity_new,
false,
true);
7550 }
7551 }
7552 }
7553 else
7554 {
7555 if (stack_max != 0)
7556 {
7558 {
7560 }
7561
7562 if (split_quantity_new == 0)
7563 {
7564 if (!
g_Game.IsMultiplayer())
7565 player.PhysicalPredictiveDropItem(this);
7566 else
7567 player.ServerDropEntity(this);
7568 return;
7569 }
7570
7572 {
7574
7575 if (new_item)
7576 {
7577 new_item.SetResultOfSplit(true);
7578 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7581 new_item.PlaceOnSurface();
7582 }
7583 }
7584 }
7585 }
7586 }
7587
7589 {
7590 float split_quantity_new;
7594 InventoryLocation loc = new InventoryLocation;
7595
7596 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7597 {
7599 split_quantity_new = stack_max;
7600 else
7602
7604 {
7605 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7606 if (new_item)
7607 {
7608 new_item.SetResultOfSplit(true);
7609 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7611 new_item.
SetQuantity(split_quantity_new,
false,
true);
7612 }
7613 }
7614 }
7615 else if (destination_entity && slot_id == -1)
7616 {
7617 if (quantity > stack_max)
7618 split_quantity_new = stack_max;
7619 else
7620 split_quantity_new = quantity;
7621
7623 {
7624 GameInventory destinationInventory = destination_entity.GetInventory();
7626 {
7629 }
7630
7631 if (new_item)
7632 {
7633 new_item.SetResultOfSplit(true);
7634 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7636 new_item.
SetQuantity(split_quantity_new,
false,
true);
7637 }
7638 }
7639 }
7640 else
7641 {
7642 if (stack_max != 0)
7643 {
7645 {
7647 }
7648
7650 {
7652
7653 if (new_item)
7654 {
7655 new_item.SetResultOfSplit(true);
7656 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7659 new_item.PlaceOnSurface();
7660 }
7661 }
7662 }
7663 }
7664 }
7665
7667 {
7669 {
7670 if (ScriptInputUserData.CanStoreInputUserData())
7671 {
7672 ScriptInputUserData ctx = new ScriptInputUserData;
7677 dst.WriteToContext(ctx);
7679 }
7680 }
7681 else if (!
g_Game.IsMultiplayer())
7682 {
7684 }
7685 }
7686
7688 {
7690 {
7691 if (ScriptInputUserData.CanStoreInputUserData())
7692 {
7693 ScriptInputUserData ctx = new ScriptInputUserData;
7698 ctx.
Write(destination_entity);
7704 }
7705 }
7706 else if (!
g_Game.IsMultiplayer())
7707 {
7709 }
7710 }
7711
7713 {
7715 }
7716
7718 {
7720 float split_quantity_new;
7722 if (dst.IsValid())
7723 {
7724 int slot_id = dst.GetSlot();
7726
7727 if (quantity > stack_max)
7728 split_quantity_new = stack_max;
7729 else
7730 split_quantity_new = quantity;
7731
7733 {
7735
7736 if (new_item)
7737 {
7738 new_item.SetResultOfSplit(true);
7739 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7741 new_item.
SetQuantity(split_quantity_new,
false,
true);
7742 }
7743
7744 return new_item;
7745 }
7746 }
7747
7748 return null;
7749 }
7750
7752 {
7754 float split_quantity_new;
7756 if (destination_entity)
7757 {
7759 if (quantity > stackable)
7760 split_quantity_new = stackable;
7761 else
7762 split_quantity_new = quantity;
7763
7765 {
7766 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7767 if (new_item)
7768 {
7769 new_item.SetResultOfSplit(true);
7770 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7772 new_item.
SetQuantity(split_quantity_new,
false,
true);
7773 }
7774 }
7775 }
7776 }
7777
7779 {
7781 {
7782 if (ScriptInputUserData.CanStoreInputUserData())
7783 {
7784 ScriptInputUserData ctx = new ScriptInputUserData;
7789 ItemBase destination_entity =
this;
7790 ctx.
Write(destination_entity);
7794 }
7795 }
7796 else if (!
g_Game.IsMultiplayer())
7797 {
7799 }
7800 }
7801
7803 {
7805 float split_quantity_new;
7807 if (player)
7808 {
7810 if (quantity > stackable)
7811 split_quantity_new = stackable;
7812 else
7813 split_quantity_new = quantity;
7814
7816 {
7817 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7818 new_item =
ItemBase.Cast(in_hands);
7819 if (new_item)
7820 {
7821 new_item.SetResultOfSplit(true);
7822 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7824 new_item.SetQuantity(split_quantity_new, false, true);
7825 }
7826 }
7827 }
7828 }
7829
7831 {
7833 float split_quantity_new = Math.Floor(quantity * 0.5);
7834
7836 return;
7837
7839
7840 if (new_item)
7841 {
7842 if (new_item.GetQuantityMax() < split_quantity_new)
7843 {
7844 split_quantity_new = new_item.GetQuantityMax();
7845 }
7846
7847 new_item.SetResultOfSplit(true);
7848 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7849
7851 {
7854 }
7855 else
7856 {
7858 new_item.
SetQuantity(split_quantity_new,
false,
true);
7859 }
7860 }
7861 }
7862
7864 {
7866 float split_quantity_new = Math.Floor(quantity / 2);
7867
7869 return;
7870
7871 InventoryLocation invloc = new InventoryLocation;
7873
7875 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7876
7877 if (new_item)
7878 {
7879 if (new_item.GetQuantityMax() < split_quantity_new)
7880 {
7881 split_quantity_new = new_item.GetQuantityMax();
7882 }
7884 {
7887 }
7888 else if (split_quantity_new > 1)
7889 {
7891 new_item.
SetQuantity(split_quantity_new,
false,
true);
7892 }
7893 }
7894 }
7895
7898 {
7899 SetWeightDirty();
7901
7902 if (parent)
7903 parent.OnAttachmentQuantityChangedEx(this, delta);
7904
7906 {
7908 {
7910 }
7912 {
7913 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7915 }
7916 }
7917 }
7918
7921 {
7922
7923 }
7924
7927 {
7929 }
7930
7932 {
7933 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7934
7936 {
7937 if (newLevel == GameConstants.STATE_RUINED)
7938 {
7940 EntityAI parent = GetHierarchyParent();
7941 if (parent && parent.IsFireplace())
7942 {
7943 CargoBase cargo = GetInventory().GetCargo();
7944 if (cargo)
7945 {
7947 {
7949 }
7950 }
7951 }
7952 }
7953
7955 {
7956
7958 return;
7959 }
7960
7961 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7962 {
7964 }
7965 }
7966 }
7967
7968
7970 {
7971 super.OnRightClick();
7972
7974 {
7976 {
7977 if (ScriptInputUserData.CanStoreInputUserData())
7978 {
7979 EntityAI root = GetHierarchyRoot();
7980 Man playerOwner = GetHierarchyRootPlayer();
7981 InventoryLocation dst = new InventoryLocation;
7982
7983
7984 if (!playerOwner && root && root == this)
7985 {
7987 }
7988 else
7989 {
7990
7991 GetInventory().GetCurrentInventoryLocation(dst);
7993 {
7994 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7996 {
7998 }
7999 else
8000 {
8002
8003
8004 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8005 {
8007 }
8008 else
8009 {
8010 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8011 }
8012 }
8013 }
8014 }
8015
8016 ScriptInputUserData ctx = new ScriptInputUserData;
8024 }
8025 }
8026 else if (!
g_Game.IsMultiplayer())
8027 {
8029 }
8030 }
8031 }
8032
8034 {
8035 if (root)
8036 {
8037 vector m4[4];
8038 root.GetTransform(m4);
8039 dst.SetGround(this, m4);
8040 }
8041 else
8042 {
8043 GetInventory().GetCurrentInventoryLocation(dst);
8044 }
8045 }
8046
8047 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8048 {
8049
8050 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8051 return false;
8052
8053 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8054 return false;
8055
8056
8058 return false;
8059
8060
8061 Magazine mag = Magazine.Cast(this);
8062 if (mag)
8063 {
8064 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8065 return false;
8066
8067 if (stack_max_limit)
8068 {
8069 Magazine other_mag = Magazine.Cast(other_item);
8070 if (other_item)
8071 {
8072 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8073 return false;
8074 }
8075
8076 }
8077 }
8078 else
8079 {
8080
8082 return false;
8083
8085 return false;
8086 }
8087
8088 PlayerBase player = null;
8089 if (CastTo(player, GetHierarchyRootPlayer()))
8090 {
8091 if (player.GetInventory().HasAttachment(this))
8092 return false;
8093
8094 if (player.IsItemsToDelete())
8095 return false;
8096 }
8097
8098 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8099 return false;
8100
8101 int slotID;
8103 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8104 return false;
8105
8106 return true;
8107 }
8108
8110 {
8112 }
8113
8115 {
8116 return m_IsResultOfSplit;
8117 }
8118
8120 {
8121 m_IsResultOfSplit = value;
8122 }
8123
8125 {
8127 }
8128
8130 {
8131 float other_item_quantity = other_item.GetQuantity();
8132 float this_free_space;
8133
8135
8137
8138 if (other_item_quantity > this_free_space)
8139 {
8140 return this_free_space;
8141 }
8142 else
8143 {
8144 return other_item_quantity;
8145 }
8146 }
8147
8149 {
8151 }
8152
8154 {
8156 return;
8157
8158 if (!IsMagazine() && other_item)
8159 {
8161 if (quantity_used != 0)
8162 {
8163 float hp1 = GetHealth01("","");
8164 float hp2 = other_item.GetHealth01("","");
8165 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8166 hpResult = hpResult / (
GetQuantity() + quantity_used);
8167
8168 hpResult *= GetMaxHealth();
8169 Math.Round(hpResult);
8170 SetHealth("", "Health", hpResult);
8171
8173 other_item.AddQuantity(-quantity_used);
8174 }
8175 }
8177 }
8178
8180 {
8181 #ifdef SERVER
8182 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8183 GetHierarchyParent().IncreaseLifetimeUp();
8184 #endif
8185 };
8186
8188 {
8189 PlayerBase p = PlayerBase.Cast(player);
8190
8191 array<int> recipesIds = p.m_Recipes;
8192 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8193 if (moduleRecipesManager)
8194 {
8195 EntityAI itemInHands = player.GetEntityInHands();
8196 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8197 }
8198
8199 for (int i = 0;i < recipesIds.Count(); i++)
8200 {
8201 int key = recipesIds.Get(i);
8202 string recipeName = moduleRecipesManager.GetRecipeName(key);
8204 }
8205 }
8206
8207
8208 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8209 {
8210 super.GetDebugActions(outputList);
8211
8212
8218
8219
8224
8229
8230
8234
8235
8237 {
8241 }
8242
8245
8246
8250
8252
8253 InventoryLocation loc = new InventoryLocation();
8254 GetInventory().GetCurrentInventoryLocation(loc);
8256 {
8257 if (Gizmo_IsSupported())
8260 }
8261
8263 }
8264
8265
8266
8267
8269 {
8270 super.OnAction(action_id, player, ctx);
8271
8273 {
8274 switch (action_id)
8275 {
8279 return true;
8283 return true;
8284 }
8285 }
8286
8288 {
8289 switch (action_id)
8290 {
8292 Delete();
8293 return true;
8294 }
8295 }
8296
8297 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8298 {
8299 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8300 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8301 PlayerBase p = PlayerBase.Cast(player);
8302 if (
EActions.RECIPES_RANGE_START < 1000)
8303 {
8304 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8305 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8306 }
8307 }
8308 #ifndef SERVER
8309 else if (action_id ==
EActions.WATCH_PLAYER)
8310 {
8311 PluginDeveloper.SetDeveloperItemClientEx(player);
8312 }
8313 #endif
8315 {
8316 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8317 {
8318 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8319 OnDebugButtonPressServer(id + 1);
8320 }
8321
8322 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8323 {
8324 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8326 }
8327
8328 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8329 {
8330 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8332 }
8333
8334 else if (action_id ==
EActions.ADD_QUANTITY)
8335 {
8336 if (IsMagazine())
8337 {
8338 Magazine mag = Magazine.Cast(this);
8339 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8340 }
8341 else
8342 {
8344 }
8345
8346 if (m_EM)
8347 {
8348 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8349 }
8350
8351 }
8352
8353 else if (action_id ==
EActions.REMOVE_QUANTITY)
8354 {
8355 if (IsMagazine())
8356 {
8357 Magazine mag2 = Magazine.Cast(this);
8358 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8359 }
8360 else
8361 {
8363 }
8364 if (m_EM)
8365 {
8366 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8367 }
8368
8369 }
8370
8371 else if (action_id ==
EActions.SET_QUANTITY_0)
8372 {
8374
8375 if (m_EM)
8376 {
8377 m_EM.SetEnergy(0);
8378 }
8379 }
8380
8381 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8382 {
8384
8385 if (m_EM)
8386 {
8387 m_EM.SetEnergy(m_EM.GetEnergyMax());
8388 }
8389 }
8390
8391 else if (action_id ==
EActions.ADD_HEALTH)
8392 {
8393 AddHealth("","",GetMaxHealth("","Health")/5);
8394 }
8395 else if (action_id ==
EActions.REMOVE_HEALTH)
8396 {
8397 AddHealth("","",-GetMaxHealth("","Health")/5);
8398 }
8399 else if (action_id ==
EActions.DESTROY_HEALTH)
8400 {
8401 SetHealth01("","",0);
8402 }
8403 else if (action_id ==
EActions.WATCH_ITEM)
8404 {
8406 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8407 #ifdef DEVELOPER
8408 SetDebugDeveloper_item(this);
8409 #endif
8410 }
8411
8412 else if (action_id ==
EActions.ADD_TEMPERATURE)
8413 {
8414 AddTemperature(20);
8415
8416 }
8417
8418 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8419 {
8420 AddTemperature(-20);
8421
8422 }
8423
8424 else if (action_id ==
EActions.FLIP_FROZEN)
8425 {
8426 SetFrozen(!GetIsFrozen());
8427
8428 }
8429
8430 else if (action_id ==
EActions.ADD_WETNESS)
8431 {
8433
8434 }
8435
8436 else if (action_id ==
EActions.REMOVE_WETNESS)
8437 {
8439
8440 }
8441
8442 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8443 {
8446
8447
8448 }
8449
8450 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8451 {
8454 }
8455
8456 else if (action_id ==
EActions.MAKE_SPECIAL)
8457 {
8458 auto debugParams = DebugSpawnParams.WithPlayer(player);
8459 OnDebugSpawnEx(debugParams);
8460 }
8461
8462 }
8463
8464
8465 return false;
8466 }
8467
8468
8469
8470
8474
8477
8478
8479
8481 {
8482 return false;
8483 }
8484
8485
8487 {
8488 return true;
8489 }
8490
8491
8493 {
8494 return true;
8495 }
8496
8497
8498
8500 {
8501 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8502 return g_Game.ConfigIsExisting(config_path);
8503 }
8504
8507 {
8508 return null;
8509 }
8510
8512 {
8513 return false;
8514 }
8515
8517 {
8518 return false;
8519 }
8520
8524
8525
8527 {
8528 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8529 return module_repairing.CanRepair(this, item_repair_kit);
8530 }
8531
8532
8533 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8534 {
8535 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8536 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8537 }
8538
8539
8541 {
8542
8543
8544
8545
8546
8547
8548
8549
8550 return 1;
8551 }
8552
8553
8554
8556 {
8558 }
8559
8560
8561
8563 {
8565 }
8566
8567
8576 {
8577 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8578
8579 if (player)
8580 {
8581 player.MessageStatus(text);
8582 }
8583 }
8584
8585
8594 {
8595 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8596
8597 if (player)
8598 {
8599 player.MessageAction(text);
8600 }
8601 }
8602
8603
8612 {
8613 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8614
8615 if (player)
8616 {
8617 player.MessageFriendly(text);
8618 }
8619 }
8620
8621
8630 {
8631 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8632
8633 if (player)
8634 {
8635 player.MessageImportant(text);
8636 }
8637 }
8638
8640 {
8641 return true;
8642 }
8643
8644
8645 override bool KindOf(
string tag)
8646 {
8647 bool found = false;
8648 string item_name = this.
GetType();
8650 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8651
8652 int array_size = item_tag_array.Count();
8653 for (int i = 0; i < array_size; i++)
8654 {
8655 if (item_tag_array.Get(i) == tag)
8656 {
8657 found = true;
8658 break;
8659 }
8660 }
8661 return found;
8662 }
8663
8664
8666 {
8667
8668 super.OnRPC(sender, rpc_type,ctx);
8669
8670
8671 switch (rpc_type)
8672 {
8673 #ifndef SERVER
8674 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8675 Param2<bool, string> p = new Param2<bool, string>(false, "");
8676
8678 return;
8679
8680 bool play = p.param1;
8681 string soundSet = p.param2;
8682
8683 if (play)
8684 {
8686 {
8688 {
8690 }
8691 }
8692 else
8693 {
8695 }
8696 }
8697 else
8698 {
8700 }
8701
8702 break;
8703 #endif
8704
8705 }
8706
8708 {
8710 }
8711 }
8712
8713
8714
8715
8717 {
8718 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8719 return plugin.GetID(
name);
8720 }
8721
8723 {
8724 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8725 return plugin.GetName(id);
8726 }
8727
8730 {
8731
8732
8733 int varFlags;
8734 if (!ctx.
Read(varFlags))
8735 return;
8736
8737 if (varFlags & ItemVariableFlags.FLOAT)
8738 {
8740 }
8741 }
8742
8744 {
8745
8746 super.SerializeNumericalVars(floats_out);
8747
8748
8749
8751 {
8753 }
8754
8756 {
8758 }
8759
8761 {
8763 }
8764
8766 {
8771 }
8772
8774 {
8776 }
8777 }
8778
8780 {
8781
8782 super.DeSerializeNumericalVars(floats);
8783
8784
8785 int index = 0;
8786 int mask = Math.Round(floats.Get(index));
8787
8788 index++;
8789
8791 {
8793 {
8795 }
8796 else
8797 {
8798 float quantity = floats.Get(index);
8800 }
8801 index++;
8802 }
8803
8805 {
8806 float wet = floats.Get(index);
8808 index++;
8809 }
8810
8812 {
8813 int liquidtype = Math.Round(floats.Get(index));
8815 index++;
8816 }
8817
8819 {
8821 index++;
8823 index++;
8825 index++;
8827 index++;
8828 }
8829
8831 {
8832 int cleanness = Math.Round(floats.Get(index));
8834 index++;
8835 }
8836 }
8837
8839 {
8840 super.WriteVarsToCTX(ctx);
8841
8842
8844 {
8846 }
8847
8849 {
8851 }
8852
8854 {
8856 }
8857
8859 {
8860 int r,g,b,a;
8866 }
8867
8869 {
8871 }
8872 }
8873
8875 {
8876 if (!super.ReadVarsFromCTX(ctx,version))
8877 return false;
8878
8879 int intValue;
8880 float value;
8881
8882 if (version < 140)
8883 {
8884 if (!ctx.
Read(intValue))
8885 return false;
8886
8887 m_VariablesMask = intValue;
8888 }
8889
8891 {
8892 if (!ctx.
Read(value))
8893 return false;
8894
8896 {
8898 }
8899 else
8900 {
8902 }
8903 }
8904
8905 if (version < 140)
8906 {
8908 {
8909 if (!ctx.
Read(value))
8910 return false;
8911 SetTemperatureDirect(value);
8912 }
8913 }
8914
8916 {
8917 if (!ctx.
Read(value))
8918 return false;
8920 }
8921
8923 {
8924 if (!ctx.
Read(intValue))
8925 return false;
8927 }
8928
8930 {
8931 int r,g,b,a;
8933 return false;
8935 return false;
8937 return false;
8939 return false;
8940
8942 }
8943
8945 {
8946 if (!ctx.
Read(intValue))
8947 return false;
8949 }
8950
8951 if (version >= 138 && version < 140)
8952 {
8954 {
8955 if (!ctx.
Read(intValue))
8956 return false;
8957 SetFrozen(intValue);
8958 }
8959 }
8960
8961 return true;
8962 }
8963
8964
8966 {
8969 {
8971 }
8972
8973 if (!super.OnStoreLoad(ctx, version))
8974 {
8976 return false;
8977 }
8978
8979 if (version >= 114)
8980 {
8981 bool hasQuickBarIndexSaved;
8982
8983 if (!ctx.
Read(hasQuickBarIndexSaved))
8984 {
8986 return false;
8987 }
8988
8989 if (hasQuickBarIndexSaved)
8990 {
8991 int itmQBIndex;
8992
8993
8994 if (!ctx.
Read(itmQBIndex))
8995 {
8997 return false;
8998 }
8999
9000 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9001 if (itmQBIndex != -1 && parentPlayer)
9002 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9003 }
9004 }
9005 else
9006 {
9007
9008 PlayerBase player;
9009 int itemQBIndex;
9010 if (version ==
int.
MAX)
9011 {
9012 if (!ctx.
Read(itemQBIndex))
9013 {
9015 return false;
9016 }
9017 }
9018 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9019 {
9020
9021 if (!ctx.
Read(itemQBIndex))
9022 {
9024 return false;
9025 }
9026 if (itemQBIndex != -1 && player)
9027 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9028 }
9029 }
9030
9031 if (version < 140)
9032 {
9033
9034 if (!LoadVariables(ctx, version))
9035 {
9037 return false;
9038 }
9039 }
9040
9041
9043 {
9045 return false;
9046 }
9047 if (version >= 132)
9048 {
9050 if (raib)
9051 {
9053 {
9055 return false;
9056 }
9057 }
9058 }
9059
9061 return true;
9062 }
9063
9064
9065
9067 {
9068 super.OnStoreSave(ctx);
9069
9070 PlayerBase player;
9071 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9072 {
9074
9075 int itemQBIndex = -1;
9076 itemQBIndex = player.FindQuickBarEntityIndex(this);
9077 ctx.
Write(itemQBIndex);
9078 }
9079 else
9080 {
9082 }
9083
9085
9087 if (raib)
9088 {
9090 }
9091 }
9092
9093
9095 {
9096 super.AfterStoreLoad();
9097
9099 {
9101 }
9102
9104 {
9107 }
9108 }
9109
9111 {
9112 super.EEOnAfterLoad();
9113
9115 {
9117 }
9118
9121 }
9122
9124 {
9125 return false;
9126 }
9127
9128
9129
9131 {
9133 {
9134 #ifdef PLATFORM_CONSOLE
9135
9137 {
9139 if (menu)
9140 {
9142 }
9143 }
9144 #endif
9145 }
9146
9148 {
9151 }
9152
9154 {
9155 SetWeightDirty();
9157 }
9159 {
9162 }
9163
9165 {
9168
9171 }
9173 {
9177 }
9178
9179 super.OnVariablesSynchronized();
9180 }
9181
9182
9183
9185 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9186 {
9187 if (!IsServerCheck(allow_client))
9188 return false;
9189
9191 return false;
9192
9195
9196 if (value <= (min + 0.001))
9197 value = min;
9198
9199 if (value == min)
9200 {
9201 if (destroy_config)
9202 {
9203 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9204 if (dstr)
9205 {
9207 this.Delete();
9208 return true;
9209 }
9210 }
9211 else if (destroy_forced)
9212 {
9214 this.Delete();
9215 return true;
9216 }
9217
9219 }
9220
9223
9225 {
9226 EntityAI parent = GetHierarchyRoot();
9227 InventoryLocation iLoc = new InventoryLocation();
9228 GetInventory().GetCurrentInventoryLocation(iLoc);
9230 {
9231 int iLocSlot = iLoc.
GetSlot();
9233 {
9235 }
9237 {
9239 }
9240 }
9241 }
9242
9244 {
9246
9247 if (delta)
9249 }
9250
9252
9253 return false;
9254 }
9255
9256
9258 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9259 {
9261 }
9262
9264 {
9267 }
9268
9270 {
9273 }
9274
9276 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9277 {
9278 float value_clamped = Math.Clamp(value, 0, 1);
9280 SetQuantity(result, destroy_config, destroy_forced);
9281 }
9282
9283
9286 {
9288 }
9289
9291 {
9293 }
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9305 {
9306 int slot = -1;
9307 GameInventory inventory = GetInventory();
9308 if (inventory)
9309 {
9310 InventoryLocation il = new InventoryLocation;
9313 }
9314
9316 }
9317
9319 {
9320 float quantity_max = 0;
9321
9323 {
9324 if (attSlotID != -1)
9325 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9326
9327 if (quantity_max <= 0)
9329 }
9330
9331 if (quantity_max <= 0)
9333
9334 return quantity_max;
9335 }
9336
9338 {
9340 }
9341
9343 {
9345 }
9346
9347
9349 {
9351 }
9352
9354 {
9356 }
9357
9359 {
9361 }
9362
9363
9365 {
9366
9367 float weightEx = GetWeightEx();
9368 float special = GetInventoryAndCargoWeight();
9369 return weightEx - special;
9370 }
9371
9372
9374 {
9376 }
9377
9379 {
9381 {
9382 #ifdef DEVELOPER
9383 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9384 {
9385 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9387 }
9388 #endif
9389
9391 }
9392 else if (HasEnergyManager())
9393 {
9394 #ifdef DEVELOPER
9395 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9396 {
9397 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9398 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9399 }
9400 #endif
9401 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9402 }
9403 else
9404 {
9405 #ifdef DEVELOPER
9406 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9407 {
9408 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9409 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9410 }
9411 #endif
9412 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9413 }
9414 }
9415
9418 {
9419 int item_count = 0;
9421
9422 GameInventory inventory = GetInventory();
9423 CargoBase cargo = inventory.
GetCargo();
9424 if (cargo != NULL)
9425 {
9427 }
9428
9430 for (int i = 0; i < nAttachments; ++i)
9431 {
9433 if (item)
9434 item_count += item.GetNumberOfItems();
9435 }
9436 return item_count;
9437 }
9438
9441 {
9442 float weight = 0;
9443 float wetness = 1;
9444 if (include_wetness)
9447 {
9448 weight = wetness * m_ConfigWeight;
9449 }
9451 {
9452 weight = 1;
9453 }
9454 return weight;
9455 }
9456
9457
9458
9460 {
9461 GameInventory inventory = GetInventory();
9462 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9463 {
9464 array<EntityAI> items = new array<EntityAI>;
9466 for (int i = 0; i < items.Count(); ++i)
9467 {
9469 if (item)
9470 {
9471 g_Game.ObjectDelete(item);
9472 }
9473 }
9474 }
9475 }
9476
9477
9478
9479
9481 {
9482 float energy = 0;
9483 if (HasEnergyManager())
9484 {
9485 energy = GetCompEM().GetEnergy();
9486 }
9487 return energy;
9488 }
9489
9490
9492 {
9493 super.OnEnergyConsumed();
9494
9496 }
9497
9499 {
9500 super.OnEnergyAdded();
9501
9503 }
9504
9505
9507 {
9508 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9509 {
9511 {
9512 float energy_0to1 = GetCompEM().GetEnergy0To1();
9514 }
9515 }
9516 }
9517
9518
9520 {
9521 return ConfigGetFloat("heatIsolation");
9522 }
9523
9525 {
9527 }
9528
9530 {
9531 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9532 if (
g_Game.ConfigIsExisting(paramPath))
9533 return g_Game.ConfigGetFloat(paramPath);
9534
9535 return 0.0;
9536 }
9537
9539 {
9540 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9541 if (
g_Game.ConfigIsExisting(paramPath))
9542 return g_Game.ConfigGetFloat(paramPath);
9543
9544 return 0.0;
9545 }
9546
9547 override void SetWet(
float value,
bool allow_client =
false)
9548 {
9549 if (!IsServerCheck(allow_client))
9550 return;
9551
9554
9556
9557 m_VarWet = Math.Clamp(value, min, max);
9558
9560 {
9563 }
9564 }
9565
9566 override void AddWet(
float value)
9567 {
9569 }
9570
9572 {
9574 }
9575
9577 {
9579 }
9580
9582 {
9584 }
9585
9587 {
9589 }
9590
9592 {
9594 }
9595
9597 {
9600 if (newLevel != oldLevel)
9601 {
9603 }
9604 }
9605
9607 {
9608 SetWeightDirty();
9609 }
9610
9612 {
9613 return GetWetLevelInternal(
m_VarWet);
9614 }
9615
9616
9617
9619 {
9621 }
9622
9624 {
9626 }
9627
9629 {
9631 }
9632
9634 {
9636 }
9637
9638
9639
9641 {
9642 if (ConfigIsExisting("itemModelLength"))
9643 {
9644 return ConfigGetFloat("itemModelLength");
9645 }
9646 return 0;
9647 }
9648
9650 {
9651 if (ConfigIsExisting("itemAttachOffset"))
9652 {
9653 return ConfigGetFloat("itemAttachOffset");
9654 }
9655 return 0;
9656 }
9657
9658 override void SetCleanness(
int value,
bool allow_client =
false)
9659 {
9660 if (!IsServerCheck(allow_client))
9661 return;
9662
9664
9666
9669 }
9670
9672 {
9674 }
9675
9677 {
9678 return true;
9679 }
9680
9681
9682
9683
9685 {
9687 }
9688
9690 {
9692 }
9693
9694
9695
9696
9697 override void SetColor(
int r,
int g,
int b,
int a)
9698 {
9704 }
9706 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9707 {
9712 }
9713
9715 {
9717 }
9718
9721 {
9722 int r,g,b,a;
9724 r = r/255;
9725 g = g/255;
9726 b = b/255;
9727 a = a/255;
9728 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9729 }
9730
9731
9732
9733 override void SetLiquidType(
int value,
bool allow_client =
false)
9734 {
9735 if (!IsServerCheck(allow_client))
9736 return;
9737
9742 }
9743
9745 {
9746 return ConfigGetInt("varLiquidTypeInit");
9747 }
9748
9750 {
9752 }
9753
9755 {
9757 SetFrozen(false);
9758 }
9759
9762 {
9763 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9764 }
9765
9766
9769 {
9770 PlayerBase nplayer;
9771 if (PlayerBase.CastTo(nplayer, player))
9772 {
9774 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9775 }
9776 }
9777
9778
9781 {
9782 PlayerBase nplayer;
9783 if (PlayerBase.CastTo(nplayer,player))
9784 {
9785 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9786 }
9787
9788 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9789
9790 if (HasEnergyManager())
9791 {
9792 GetCompEM().UpdatePlugState();
9793 }
9794 }
9795
9796
9798 {
9799 super.OnPlacementStarted(player);
9800
9802 }
9803
9804 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9805 {
9807 {
9808 m_AdminLog.OnPlacementComplete(player,
this);
9809 }
9810
9811 super.OnPlacementComplete(player, position, orientation);
9812 }
9813
9814
9815
9816
9817
9819 {
9821 {
9822 return true;
9823 }
9824 else
9825 {
9826 return false;
9827 }
9828 }
9829
9830
9832 {
9834 {
9836 }
9837 }
9838
9839
9841 {
9843 }
9844
9846 {
9848 }
9849
9850 override void InsertAgent(
int agent,
float count = 1)
9851 {
9852 if (count < 1)
9853 return;
9854
9856 }
9857
9860 {
9862 }
9863
9864
9866 {
9868 }
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9912 {
9914 return false;
9915 return true;
9916 }
9917
9919 {
9920
9922 }
9923
9924
9927 {
9928 super.CheckForRoofLimited(timeTresholdMS);
9929
9930 float time =
g_Game.GetTime();
9931 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9932 {
9933 m_PreviousRoofTestTime = time;
9934 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9935 }
9936 }
9937
9938
9940 {
9942 {
9943 return 0;
9944 }
9945
9946 if (GetInventory().GetAttachmentSlotsCount() != 0)
9947 {
9948 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9949 if (filter)
9950 return filter.GetProtectionLevel(type, false, system);
9951 else
9952 return 0;
9953 }
9954
9955 string subclassPath, entryName;
9956
9957 switch (type)
9958 {
9960 entryName = "biological";
9961 break;
9963 entryName = "chemical";
9964 break;
9965 default:
9966 entryName = "biological";
9967 break;
9968 }
9969
9970 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9971
9972 return g_Game.ConfigGetFloat(subclassPath + entryName);
9973 }
9974
9975
9976
9979 {
9980 if (!IsMagazine())
9982
9984 }
9985
9986
9987
9988
9989
9994 {
9995 return true;
9996 }
9997
9999 {
10001 }
10002
10003
10004
10005
10006
10008 {
10009 if (parent)
10010 {
10011 if (parent.IsInherited(DayZInfected))
10012 return true;
10013
10014 if (!parent.IsRuined())
10015 return true;
10016 }
10017
10018 return true;
10019 }
10020
10022 {
10023 if (!super.CanPutAsAttachment(parent))
10024 {
10025 return false;
10026 }
10027
10028 if (!IsRuined() && !parent.IsRuined())
10029 {
10030 return true;
10031 }
10032
10033 return false;
10034 }
10035
10037 {
10038
10039
10040
10041
10042 return super.CanReceiveItemIntoCargo(item);
10043 }
10044
10046 {
10047
10048
10049
10050
10051 GameInventory attachmentInv = attachment.GetInventory();
10053 {
10054 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10055 return false;
10056 }
10057
10058 InventoryLocation loc = new InventoryLocation();
10059 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10060 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10061 return false;
10062
10063 return super.CanReceiveAttachment(attachment, slotId);
10064 }
10065
10067 {
10068 if (!super.CanReleaseAttachment(attachment))
10069 return false;
10070
10071 return GetInventory().AreChildrenAccessible();
10072 }
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10095 {
10096 int id = muzzle_owner.GetMuzzleID();
10097 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10098
10099 if (WPOF_array)
10100 {
10101 for (int i = 0; i < WPOF_array.Count(); i++)
10102 {
10103 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10104
10105 if (WPOF)
10106 {
10107 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10108 }
10109 }
10110 }
10111 }
10112
10113
10115 {
10116 int id = muzzle_owner.GetMuzzleID();
10118
10119 if (WPOBE_array)
10120 {
10121 for (int i = 0; i < WPOBE_array.Count(); i++)
10122 {
10123 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10124
10125 if (WPOBE)
10126 {
10127 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10128 }
10129 }
10130 }
10131 }
10132
10133
10135 {
10136 int id = muzzle_owner.GetMuzzleID();
10137 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10138
10139 if (WPOOH_array)
10140 {
10141 for (int i = 0; i < WPOOH_array.Count(); i++)
10142 {
10143 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10144
10145 if (WPOOH)
10146 {
10147 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10148 }
10149 }
10150 }
10151 }
10152
10153
10155 {
10156 int id = muzzle_owner.GetMuzzleID();
10157 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10158
10159 if (WPOOH_array)
10160 {
10161 for (int i = 0; i < WPOOH_array.Count(); i++)
10162 {
10163 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10164
10165 if (WPOOH)
10166 {
10167 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10168 }
10169 }
10170 }
10171 }
10172
10173
10175 {
10176 int id = muzzle_owner.GetMuzzleID();
10177 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10178
10179 if (WPOOH_array)
10180 {
10181 for (int i = 0; i < WPOOH_array.Count(); i++)
10182 {
10183 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10184
10185 if (WPOOH)
10186 {
10187 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10188 }
10189 }
10190 }
10191 }
10192
10193
10194
10196 {
10198 {
10199 return true;
10200 }
10201
10202 return false;
10203 }
10204
10206 {
10208 {
10209 return true;
10210 }
10211
10212 return false;
10213 }
10214
10216 {
10218 {
10219 return true;
10220 }
10221
10222 return false;
10223 }
10224
10226 {
10227 return false;
10228 }
10229
10232 {
10233 return UATimeSpent.DEFAULT_DEPLOY;
10234 }
10235
10236
10237
10238
10240 {
10242 SetSynchDirty();
10243 }
10244
10246 {
10248 }
10249
10250
10252 {
10253 return false;
10254 }
10255
10258 {
10259 string att_type = "None";
10260
10261 if (ConfigIsExisting("soundAttType"))
10262 {
10263 att_type = ConfigGetString("soundAttType");
10264 }
10265
10267 }
10268
10270 {
10272 }
10273
10274
10275
10276
10277
10283
10285 {
10288
10290 }
10291
10292
10294 {
10296 return;
10297
10299
10302
10305
10306 SoundParameters params = new SoundParameters();
10310 }
10311
10312
10314 {
10316 {
10319
10320 SetSynchDirty();
10321
10324 }
10325 }
10326
10328 {
10330 }
10331
10332
10334 {
10336 return;
10337
10339 SetSynchDirty();
10340
10343 }
10344
10346 {
10349 }
10350
10352 {
10354 }
10355
10356 void OnApply(PlayerBase player);
10357
10359 {
10360 return 1.0;
10361 };
10362
10364 {
10366 }
10367
10369 {
10371 }
10372
10374
10376 {
10377 SetDynamicPhysicsLifeTime(0.01);
10379 }
10380
10382 {
10383 array<string> zone_names = new array<string>;
10384 GetDamageZones(zone_names);
10385 for (int i = 0; i < zone_names.Count(); i++)
10386 {
10387 SetHealthMax(zone_names.Get(i),"Health");
10388 }
10389 SetHealthMax("","Health");
10390 }
10391
10394 {
10395 float global_health = GetHealth01("","Health");
10396 array<string> zones = new array<string>;
10397 GetDamageZones(zones);
10398
10399 for (int i = 0; i < zones.Count(); i++)
10400 {
10401 SetHealth01(zones.Get(i),"Health",global_health);
10402 }
10403 }
10404
10407 {
10408 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10409 }
10410
10412 {
10413 if (!hasRootAsPlayer)
10414 {
10415 if (refParentIB)
10416 {
10417
10418 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10419 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10420
10421 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10422 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10423
10426 }
10427 else
10428 {
10429
10432 }
10433 }
10434 }
10435
10437 {
10439 {
10440 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10441 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10442 {
10443 float heatPermCoef = 1.0;
10445 while (ent)
10446 {
10447 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10448 ent = ent.GetHierarchyParent();
10449 }
10450
10451 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10452 }
10453 }
10454 }
10455
10457 {
10458
10459 EntityAI parent = GetHierarchyParent();
10460 if (!parent)
10461 {
10462 hasParent = false;
10463 hasRootAsPlayer = false;
10464 }
10465 else
10466 {
10467 hasParent = true;
10468 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10469 refParentIB =
ItemBase.Cast(parent);
10470 }
10471 }
10472
10473 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10474 {
10475
10476 }
10477
10479 {
10480
10481 return false;
10482 }
10483
10485 {
10486
10487
10488 return false;
10489 }
10490
10492 {
10493
10494 return false;
10495 }
10496
10499 {
10500 return !GetIsFrozen() &&
IsOpen();
10501 }
10502
10504 {
10505 bool hasParent = false, hasRootAsPlayer = false;
10507
10508 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10509 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10510
10511 if (wwtu || foodDecay)
10512 {
10516
10517 if (processWetness || processTemperature || processDecay)
10518 {
10520
10521 if (processWetness)
10522 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10523
10524 if (processTemperature)
10526
10527 if (processDecay)
10528 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10529 }
10530 }
10531 }
10532
10535 {
10537 }
10538
10540 {
10543
10544 return super.GetTemperatureFreezeThreshold();
10545 }
10546
10548 {
10551
10552 return super.GetTemperatureThawThreshold();
10553 }
10554
10556 {
10559
10560 return super.GetItemOverheatThreshold();
10561 }
10562
10564 {
10566 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10567
10568 return super.GetTemperatureFreezeTime();
10569 }
10570
10572 {
10574 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10575
10576 return super.GetTemperatureThawTime();
10577 }
10578
10583
10585 {
10586 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10587 }
10588
10590 {
10591 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10592 }
10593
10596 {
10598 }
10599
10601 {
10603 }
10604
10606 {
10608 }
10609
10612 {
10613 return null;
10614 }
10615
10618 {
10619 return false;
10620 }
10621
10623 {
10625 {
10628 if (!trg)
10629 {
10631 explosive = this;
10632 }
10633
10634 explosive.PairRemote(trg);
10636
10637 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10638 trg.SetPersistentPairID(persistentID);
10639 explosive.SetPersistentPairID(persistentID);
10640
10641 return true;
10642 }
10643 return false;
10644 }
10645
10648 {
10649 float ret = 1.0;
10652 ret *= GetHealth01();
10653
10654 return ret;
10655 }
10656
10657 #ifdef DEVELOPER
10658 override void SetDebugItem()
10659 {
10660 super.SetDebugItem();
10661 _itemBase = this;
10662 }
10663
10665 {
10666 string text = super.GetDebugText();
10667
10669 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10670
10671 return text;
10672 }
10673 #endif
10674
10676 {
10677 return true;
10678 }
10679
10681
10683
10685 {
10688 }
10689
10690
10698
10714
10715 [
Obsolete(
"Use ItemSoundHandler instead")]
10718 {
10719 if (!
g_Game.IsDedicatedServer())
10720 {
10721 if (ConfigIsExisting("attachSoundSet"))
10722 {
10723 string cfg_path = "";
10724 string soundset = "";
10725 string type_name =
GetType();
10726
10729 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10730 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10731
10732 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10733 {
10734 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10735 {
10736 if (cfg_slot_array[i] == slot_type)
10737 {
10738 soundset = cfg_soundset_array[i];
10739 break;
10740 }
10741 }
10742 }
10743
10744 if (soundset != "")
10745 {
10746 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10748 }
10749 }
10750 }
10751 }
10752
10754}
10755
10757{
10759 if (entity)
10760 {
10761 bool is_item = entity.IsInherited(
ItemBase);
10762 if (is_item && full_quantity)
10763 {
10766 }
10767 }
10768 else
10769 {
10771 return NULL;
10772 }
10773 return entity;
10774}
10775
10777{
10778 if (item)
10779 {
10780 if (health > 0)
10781 item.SetHealth("", "", health);
10782
10783 if (item.CanHaveTemperature())
10784 {
10786 if (item.CanFreeze())
10787 item.SetFrozen(false);
10788 }
10789
10790 if (item.HasEnergyManager())
10791 {
10792 if (quantity >= 0)
10793 {
10794 item.GetCompEM().SetEnergy0To1(quantity);
10795 }
10796 else
10797 {
10799 }
10800 }
10801 else if (item.IsMagazine())
10802 {
10803 Magazine mag = Magazine.Cast(item);
10804 if (quantity >= 0)
10805 {
10806 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10807 }
10808 else
10809 {
10811 }
10812
10813 }
10814 else
10815 {
10816 if (quantity >= 0)
10817 {
10818 item.SetQuantityNormalized(quantity, false);
10819 }
10820 else
10821 {
10823 }
10824
10825 }
10826 }
10827}
10828
10829#ifdef DEVELOPER
10831#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.