6089{
6091 {
6092 return true;
6093 }
6094};
6095
6097{
6098
6099};
6100
6101
6102
6104{
6108
6110
6113
6114
6115
6116
6117
6126
6132
6137
6142
6163 protected bool m_IsResultOfSplit
6164
6166
6171
6172
6173
6175
6179
6180
6181
6183
6186
6187
6188
6194
6195
6203
6206
6207
6209
6210
6212
6213
6218
6219
6224
6226
6227
6229
6230
6232 {
6237
6238 if (!
g_Game.IsDedicatedServer())
6239 {
6241 {
6243
6245 {
6247 }
6248 }
6249
6252 }
6253
6254 m_OldLocation = null;
6255
6257 {
6259 }
6260
6261 if (ConfigIsExisting("headSelectionsToHide"))
6262 {
6265 }
6266
6268 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6269 {
6271 }
6272
6274
6275 m_IsResultOfSplit = false;
6276
6278 }
6279
6281 {
6282 super.InitItemVariables();
6283
6289 m_Count = ConfigGetInt(
"count");
6290
6293
6298
6301
6306
6318
6322
6323
6326 if (ConfigIsExisting("canBeSplit"))
6327 {
6330 }
6331
6333 if (ConfigIsExisting("itemBehaviour"))
6335
6336
6339 RegisterNetSyncVariableInt("m_VarLiquidType");
6340 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6341
6342 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6343 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6344 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6345
6346 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6347 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6348 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6349 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6350
6351 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6352 RegisterNetSyncVariableBool("m_IsTakeable");
6353 RegisterNetSyncVariableBool("m_IsHologram");
6354
6357 {
6360 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6361 }
6362
6364
6366 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6368
6370 }
6371
6373 {
6375 }
6376
6378 {
6381 {
6386 }
6387 }
6388
6389 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6390 {
6392 {
6395 }
6396
6398 }
6399
6401 {
6407 }
6408
6410
6412 {
6414
6415 if (!action)
6416 {
6417 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6418 return;
6419 }
6420
6422 if (!ai)
6423 {
6425 return;
6426 }
6427
6429 if (!action_array)
6430 {
6431 action_array = new array<ActionBase_Basic>;
6433 }
6434 if (LogManager.IsActionLogEnable())
6435 {
6436 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6437 }
6438
6439 if (action_array.Find(action) != -1)
6440 {
6441 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6442 }
6443 else
6444 {
6445 action_array.Insert(action);
6446 }
6447 }
6448
6450 {
6451 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6452 ActionBase action = player.GetActionManager().GetAction(actionName);
6455
6456 if (action_array)
6457 {
6458 action_array.RemoveItem(action);
6459 }
6460 }
6461
6462
6463
6465 {
6466 ActionOverrideData overrideData = new ActionOverrideData();
6470
6472 if (!actionMap)
6473 {
6476 }
6477
6478 actionMap.Insert(this.
Type(), overrideData);
6479
6480 }
6481
6483
6485
6486
6488 {
6491
6494
6495 string config_to_search = "CfgVehicles";
6496 string muzzle_owner_config;
6497
6499 {
6500 if (IsInherited(Weapon))
6501 config_to_search = "CfgWeapons";
6502
6503 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6504
6505 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6506
6507 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6508
6509 if (config_OnFire_subclass_count > 0)
6510 {
6511 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6512
6513 for (int i = 0; i < config_OnFire_subclass_count; i++)
6514 {
6515 string particle_class = "";
6516 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6517 string config_OnFire_entry = config_OnFire_class + particle_class;
6518 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6519 WPOF_array.Insert(WPOF);
6520 }
6521
6522
6524 }
6525 }
6526
6528 {
6529 config_to_search = "CfgWeapons";
6530 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6531
6532 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6533
6534 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6535
6536 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6537 {
6538 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6539
6540 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6541 {
6542 string particle_class2 = "";
6543 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6544 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6545 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6546 WPOBE_array.Insert(WPOBE);
6547 }
6548
6549
6551 }
6552 }
6553 }
6554
6555
6557 {
6560
6562 {
6563 string config_to_search = "CfgVehicles";
6564
6565 if (IsInherited(Weapon))
6566 config_to_search = "CfgWeapons";
6567
6568 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6569 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6570
6571 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6572 {
6573
6575
6577 {
6579 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6581 return;
6582 }
6583
6586
6587
6588
6589 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6590 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6591
6592 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6593 {
6594 string particle_class = "";
6595 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6596 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6597 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6598
6599 if (entry_type == CT_CLASS)
6600 {
6601 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6602 WPOOH_array.Insert(WPOF);
6603 }
6604 }
6605
6606
6608 }
6609 }
6610 }
6611
6613 {
6615 }
6616
6618 {
6620 {
6622
6625
6628
6629 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6630 }
6631 }
6632
6634 {
6636 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6637
6639 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6640
6642 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6643
6645 {
6647 }
6648 }
6649
6651 {
6653 }
6654
6656 {
6659 else
6661
6663 {
6666 }
6667 else
6668 {
6671
6674 }
6675
6677 }
6678
6680 {
6682 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6683 }
6684
6686 {
6688 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6690 }
6691
6693 {
6695 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6696 }
6697
6699 {
6702
6703 OverheatingParticle OP = new OverheatingParticle();
6708
6710 }
6711
6713 {
6716
6717 return -1;
6718 }
6719
6721 {
6723 {
6726
6727 for (int i = count; i > 0; --i)
6728 {
6729 int id = i - 1;
6732
6735
6736 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6737 {
6738 if (p)
6739 {
6742 }
6743 }
6744 }
6745 }
6746 }
6747
6749 {
6751 {
6753 {
6754 int id = i - 1;
6756
6757 if (OP)
6758 {
6760
6761 if (p)
6762 {
6764 }
6765
6766 delete OP;
6767 }
6768 }
6769
6772 }
6773 }
6774
6777 {
6778 return 0.0;
6779 }
6780
6781
6783 {
6784 return 250;
6785 }
6786
6788 {
6789 return 0;
6790 }
6791
6794 {
6796 return true;
6797
6798 return false;
6799 }
6800
6803 {
6806
6808 {
6810 }
6811 else
6812 {
6813
6815 }
6816
6818 }
6819
6826 {
6827 return -1;
6828 }
6829
6830
6831
6832
6834 {
6836 {
6837 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6838 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6839
6840 if (r_index >= 0)
6841 {
6842 InventoryLocation r_il = new InventoryLocation;
6843 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6844
6845 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6848 {
6849 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6850 }
6852 {
6853 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6854 }
6855
6856 }
6857
6858 player.GetHumanInventory().ClearUserReservedLocation(this);
6859 }
6860
6863 }
6864
6865
6866
6867
6869 {
6870 return ItemBase.m_DebugActionsMask;
6871 }
6872
6874 {
6875 return ItemBase.m_DebugActionsMask & mask;
6876 }
6877
6879 {
6880 ItemBase.m_DebugActionsMask = mask;
6881 }
6882
6884 {
6885 ItemBase.m_DebugActionsMask |= mask;
6886 }
6887
6889 {
6890 ItemBase.m_DebugActionsMask &= ~mask;
6891 }
6892
6894 {
6896 {
6898 }
6899 else
6900 {
6902 }
6903 }
6904
6905
6907 {
6908 if (GetEconomyProfile())
6909 {
6910 float q_max = GetEconomyProfile().GetQuantityMax();
6911 if (q_max > 0)
6912 {
6913 float q_min = GetEconomyProfile().GetQuantityMin();
6914 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6915
6917 {
6918 ComponentEnergyManager comp = GetCompEM();
6920 {
6922 }
6923 }
6925 {
6927
6928 }
6929
6930 }
6931 }
6932 }
6933
6936 {
6937 EntityAI parent = GetHierarchyParent();
6938
6939 if (parent)
6940 {
6941 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6942 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6943 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6944 }
6945 }
6946
6949 {
6950 EntityAI parent = GetHierarchyParent();
6951
6952 if (parent)
6953 {
6954 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6955 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6956 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6957 }
6958 }
6959
6961 {
6962
6963
6964
6965
6967
6969 {
6970 if (ScriptInputUserData.CanStoreInputUserData())
6971 {
6972 ScriptInputUserData ctx = new ScriptInputUserData;
6978 ctx.
Write(use_stack_max);
6981
6983 {
6984 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6985 }
6986 }
6987 }
6988 else if (!
g_Game.IsMultiplayer())
6989 {
6991 }
6992 }
6993
6995 {
6997 }
6998
7000 {
7002 }
7003
7005 {
7007 }
7008
7010 {
7011
7012 return false;
7013 }
7014
7016 {
7017 return false;
7018 }
7019
7023 {
7024 return false;
7025 }
7026
7028 {
7029 return "";
7030 }
7031
7033
7035 {
7036 return false;
7037 }
7038
7040 {
7041 return true;
7042 }
7043
7044
7045
7047 {
7048 return true;
7049 }
7050
7052 {
7053 return true;
7054 }
7055
7057 {
7058 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7060 }
7061
7063 {
7065 }
7066
7068 {
7070 if (!is_being_placed)
7072 SetSynchDirty();
7073 }
7074
7075
7077
7079 {
7081 }
7082
7084 {
7086 }
7087
7089 {
7090 return 1;
7091 }
7092
7094 {
7095 return false;
7096 }
7097
7099 {
7101 SetSynchDirty();
7102 }
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7139 {
7140 super.OnMovedInsideCargo(container);
7141
7142 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7143 }
7144
7145 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7146 {
7147 super.EEItemLocationChanged(oldLoc, newLoc);
7148
7149 PlayerBase newPlayer = null;
7150 PlayerBase oldPlayer = null;
7151
7152 if (newLoc.GetParent())
7153 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7154
7155 if (oldLoc.GetParent())
7156 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7157
7159 {
7160 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7161
7162 if (rIndex >= 0)
7163 {
7164 InventoryLocation rIl = new InventoryLocation;
7165 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7166
7167 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7170 {
7171 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7172 }
7174 {
7176 }
7177
7178 }
7179 }
7180
7182 {
7183 if (newPlayer)
7184 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7185
7186 if (newPlayer == oldPlayer)
7187 {
7188 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7189 {
7191 {
7192 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7193 {
7194 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7195 }
7196 }
7197 else
7198 {
7199 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7200 }
7201 }
7202
7203 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7204 {
7205 int type = oldLoc.GetType();
7207 {
7208 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7209 }
7211 {
7212 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7213 }
7214 }
7215 if (!m_OldLocation)
7216 {
7217 m_OldLocation = new InventoryLocation;
7218 }
7219 m_OldLocation.Copy(oldLoc);
7220 }
7221 else
7222 {
7223 if (m_OldLocation)
7224 {
7225 m_OldLocation.Reset();
7226 }
7227 }
7228
7229 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7230 }
7231 else
7232 {
7233 if (newPlayer)
7234 {
7235 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7236 if (resIndex >= 0)
7237 {
7238 InventoryLocation il = new InventoryLocation;
7239 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7241 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7244 {
7245 il.
GetParent().GetOnReleaseLock().Invoke(it);
7246 }
7248 {
7250 }
7251
7252 }
7253 }
7255 {
7256
7258 }
7259
7260 if (m_OldLocation)
7261 {
7262 m_OldLocation.Reset();
7263 }
7264 }
7265
7267 {
7268 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7269 }
7270
7272 {
7273 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7274 }
7275 }
7276
7277 override void EOnContact(IEntity other, Contact extra)
7278 {
7280 {
7281 int liquidType = -1;
7283 if (impactSpeed > 0.0)
7284 {
7286 #ifndef SERVER
7288 #else
7290 SetSynchDirty();
7291 #endif
7293 }
7294 }
7295
7296 #ifdef SERVER
7297 if (GetCompEM() && GetCompEM().IsPlugged())
7298 {
7299 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7300 GetCompEM().UnplugThis();
7301 }
7302 #endif
7303 }
7304
7306
7308 {
7310 }
7311
7313 {
7314
7315 }
7316
7318 {
7319 super.OnItemLocationChanged(old_owner, new_owner);
7320
7321 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7322 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7323
7324 if (!relatedPlayer && playerNew)
7325 relatedPlayer = playerNew;
7326
7327 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7328 {
7330 if (actionMgr)
7331 {
7332 ActionBase currentAction = actionMgr.GetRunningAction();
7333 if (currentAction)
7335 }
7336 }
7337
7338 Man ownerPlayerOld = null;
7339 Man ownerPlayerNew = null;
7340
7341 if (old_owner)
7342 {
7343 if (old_owner.
IsMan())
7344 {
7345 ownerPlayerOld = Man.Cast(old_owner);
7346 }
7347 else
7348 {
7349 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7350 }
7351 }
7352 else
7353 {
7355 {
7357
7358 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7359 {
7360 GetCompEM().UnplugThis();
7361 }
7362 }
7363 }
7364
7365 if (new_owner)
7366 {
7367 if (new_owner.
IsMan())
7368 {
7369 ownerPlayerNew = Man.Cast(new_owner);
7370 }
7371 else
7372 {
7373 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7374 }
7375 }
7376
7377 if (ownerPlayerOld != ownerPlayerNew)
7378 {
7379 if (ownerPlayerOld)
7380 {
7381 array<EntityAI> subItemsExit = new array<EntityAI>;
7383 for (int i = 0; i < subItemsExit.Count(); i++)
7384 {
7387 }
7388 }
7389
7390 if (ownerPlayerNew)
7391 {
7392 array<EntityAI> subItemsEnter = new array<EntityAI>;
7394 for (int j = 0; j < subItemsEnter.Count(); j++)
7395 {
7398 }
7399 }
7400 }
7401 else if (ownerPlayerNew != null)
7402 {
7403 PlayerBase nplayer;
7404 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7405 {
7406 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7408 for (int k = 0; k < subItemsUpdate.Count(); k++)
7409 {
7411 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7412 }
7413 }
7414 }
7415
7416 if (old_owner)
7417 old_owner.OnChildItemRemoved(this);
7418 if (new_owner)
7419 new_owner.OnChildItemReceived(this);
7420 }
7421
7422
7424 {
7425 super.EEDelete(parent);
7426 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7427 if (player)
7428 {
7430
7431 if (player.IsAlive())
7432 {
7433 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7434 if (r_index >= 0)
7435 {
7436 InventoryLocation r_il = new InventoryLocation;
7437 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7438
7439 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7442 {
7443 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7444 }
7446 {
7447 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7448 }
7449
7450 }
7451
7452 player.RemoveQuickBarEntityShortcut(this);
7453 }
7454 }
7455 }
7456
7458 {
7459 super.EEKilled(killer);
7460
7463 {
7464 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7465 {
7466 if (IsMagazine())
7467 {
7468 if (Magazine.Cast(this).GetAmmoCount() > 0)
7469 {
7471 }
7472 }
7473 else
7474 {
7476 }
7477 }
7478 }
7479 }
7480
7482 {
7483 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7484
7485 super.OnWasAttached(parent, slot_id);
7486
7489
7492 }
7493
7495 {
7496 super.OnWasDetached(parent, slot_id);
7497
7500
7503 }
7504
7506 {
7507 int idx;
7510
7511 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7512 if (inventory_slots.Count() < 1)
7513 {
7514 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7515 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7516 }
7517 else
7518 {
7519 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7520 }
7521
7522 idx = inventory_slots.Find(slot);
7523 if (idx < 0)
7524 return "";
7525
7526 return attach_types.Get(idx);
7527 }
7528
7530 {
7531 int idx = -1;
7532 string slot;
7533
7536
7537 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7538 if (inventory_slots.Count() < 1)
7539 {
7540 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7541 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7542 }
7543 else
7544 {
7545 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7546 if (detach_types.Count() < 1)
7547 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7548 }
7549
7550 for (int i = 0; i < inventory_slots.Count(); i++)
7551 {
7552 slot = inventory_slots.Get(i);
7553 }
7554
7555 if (slot != "")
7556 {
7557 if (detach_types.Count() == 1)
7558 idx = 0;
7559 else
7560 idx = inventory_slots.Find(slot);
7561 }
7562 if (idx < 0)
7563 return "";
7564
7565 return detach_types.Get(idx);
7566 }
7567
7569 {
7570
7572
7573
7574 float min_time = 1;
7575 float max_time = 3;
7576 float delay = Math.RandomFloat(min_time, max_time);
7577
7578 explode_timer.Run(delay, this, "DoAmmoExplosion");
7579 }
7580
7582 {
7583 Magazine magazine = Magazine.Cast(this);
7584 int pop_sounds_count = 6;
7585 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7586
7587
7588 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7589 string sound_name = pop_sounds[ sound_idx ];
7590 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7591
7592
7593 magazine.ServerAddAmmoCount(-1);
7594
7595
7596 float min_temp_to_explode = 100;
7597
7598 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7599 {
7601 }
7602 }
7603
7604
7605 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7606 {
7607 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7608
7609 const int CHANCE_DAMAGE_CARGO = 4;
7610 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7611 const int CHANCE_DAMAGE_NOTHING = 2;
7612
7614 {
7615 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7616 int chances;
7617 int rnd;
7618
7619 if (GetInventory().GetCargo())
7620 {
7621 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7622 rnd = Math.RandomInt(0,chances);
7623
7624 if (rnd < CHANCE_DAMAGE_CARGO)
7625 {
7627 }
7628 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7629 {
7631 }
7632 }
7633 else
7634 {
7635 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7636 rnd = Math.RandomInt(0,chances);
7637
7638 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7639 {
7641 }
7642 }
7643 }
7644 }
7645
7647 {
7648 CargoBase cargo = GetInventory().GetCargo();
7649 if (cargo)
7650 {
7652 if (item_count > 0)
7653 {
7654 int random_pick = Math.RandomInt(0, item_count);
7656 if (!item.IsExplosive())
7657 {
7658 item.AddHealth("","",damage);
7659 return true;
7660 }
7661 }
7662 }
7663 return false;
7664 }
7665
7667 {
7668 GameInventory inventory = GetInventory();
7670 if (attachment_count > 0)
7671 {
7672 int random_pick = Math.RandomInt(0, attachment_count);
7674 if (!attachment.IsExplosive())
7675 {
7676 attachment.AddHealth("","",damage);
7677 return true;
7678 }
7679 }
7680 return false;
7681 }
7682
7684 {
7686 }
7687
7689 {
7691 return GetInventory().CanRemoveEntity();
7692
7693 return false;
7694 }
7695
7697 {
7698
7700 return false;
7701
7702
7704 return false;
7705
7706
7707
7709 if (delta == 0)
7710 return false;
7711
7712
7713 return true;
7714 }
7715
7717 {
7719 {
7720 if (ScriptInputUserData.CanStoreInputUserData())
7721 {
7722 ScriptInputUserData ctx = new ScriptInputUserData;
7727 ctx.
Write(destination_entity);
7731 }
7732 }
7733 else if (!
g_Game.IsMultiplayer())
7734 {
7736 }
7737 }
7738
7740 {
7741 float split_quantity_new;
7745 InventoryLocation loc = new InventoryLocation;
7746
7747 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7748 {
7750 split_quantity_new = stack_max;
7751 else
7753
7755 {
7756 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7757 if (new_item)
7758 {
7759 new_item.SetResultOfSplit(true);
7760 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7762 new_item.
SetQuantity(split_quantity_new,
false,
true);
7763 }
7764 }
7765 }
7766 else if (destination_entity && slot_id == -1)
7767 {
7768 if (quantity > stack_max)
7769 split_quantity_new = stack_max;
7770 else
7771 split_quantity_new = quantity;
7772
7774 {
7775 GameInventory destinationInventory = destination_entity.GetInventory();
7777 {
7780 }
7781
7782 if (new_item)
7783 {
7784 new_item.SetResultOfSplit(true);
7785 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7787 new_item.
SetQuantity(split_quantity_new,
false,
true);
7788 }
7789 }
7790 }
7791 else
7792 {
7793 if (stack_max != 0)
7794 {
7796 {
7798 }
7799
7800 if (split_quantity_new == 0)
7801 {
7802 if (!
g_Game.IsMultiplayer())
7803 player.PhysicalPredictiveDropItem(this);
7804 else
7805 player.ServerDropEntity(this);
7806 return;
7807 }
7808
7810 {
7812
7813 if (new_item)
7814 {
7815 new_item.SetResultOfSplit(true);
7816 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7819 new_item.PlaceOnSurface();
7820 }
7821 }
7822 }
7823 }
7824 }
7825
7827 {
7828 float split_quantity_new;
7832 InventoryLocation loc = new InventoryLocation;
7833
7834 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7835 {
7837 split_quantity_new = stack_max;
7838 else
7840
7842 {
7843 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7844 if (new_item)
7845 {
7846 new_item.SetResultOfSplit(true);
7847 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7849 new_item.
SetQuantity(split_quantity_new,
false,
true);
7850 }
7851 }
7852 }
7853 else if (destination_entity && slot_id == -1)
7854 {
7855 if (quantity > stack_max)
7856 split_quantity_new = stack_max;
7857 else
7858 split_quantity_new = quantity;
7859
7861 {
7862 GameInventory destinationInventory = destination_entity.GetInventory();
7864 {
7867 }
7868
7869 if (new_item)
7870 {
7871 new_item.SetResultOfSplit(true);
7872 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7874 new_item.
SetQuantity(split_quantity_new,
false,
true);
7875 }
7876 }
7877 }
7878 else
7879 {
7880 if (stack_max != 0)
7881 {
7883 {
7885 }
7886
7888 {
7890
7891 if (new_item)
7892 {
7893 new_item.SetResultOfSplit(true);
7894 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7897 new_item.PlaceOnSurface();
7898 }
7899 }
7900 }
7901 }
7902 }
7903
7905 {
7907 {
7908 if (ScriptInputUserData.CanStoreInputUserData())
7909 {
7910 ScriptInputUserData ctx = new ScriptInputUserData;
7915 dst.WriteToContext(ctx);
7917 }
7918 }
7919 else if (!
g_Game.IsMultiplayer())
7920 {
7922 }
7923 }
7924
7926 {
7928 {
7929 if (ScriptInputUserData.CanStoreInputUserData())
7930 {
7931 ScriptInputUserData ctx = new ScriptInputUserData;
7936 ctx.
Write(destination_entity);
7942 }
7943 }
7944 else if (!
g_Game.IsMultiplayer())
7945 {
7947 }
7948 }
7949
7951 {
7953 }
7954
7956 {
7958 float split_quantity_new;
7960 if (dst.IsValid())
7961 {
7962 int slot_id = dst.GetSlot();
7964
7965 if (quantity > stack_max)
7966 split_quantity_new = stack_max;
7967 else
7968 split_quantity_new = quantity;
7969
7971 {
7973
7974 if (new_item)
7975 {
7976 new_item.SetResultOfSplit(true);
7977 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7979 new_item.
SetQuantity(split_quantity_new,
false,
true);
7980 }
7981
7982 return new_item;
7983 }
7984 }
7985
7986 return null;
7987 }
7988
7990 {
7992 float split_quantity_new;
7994 if (destination_entity)
7995 {
7997 if (quantity > stackable)
7998 split_quantity_new = stackable;
7999 else
8000 split_quantity_new = quantity;
8001
8003 {
8004 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8005 if (new_item)
8006 {
8007 new_item.SetResultOfSplit(true);
8008 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8010 new_item.
SetQuantity(split_quantity_new,
false,
true);
8011 }
8012 }
8013 }
8014 }
8015
8017 {
8019 {
8020 if (ScriptInputUserData.CanStoreInputUserData())
8021 {
8022 ScriptInputUserData ctx = new ScriptInputUserData;
8027 ItemBase destination_entity =
this;
8028 ctx.
Write(destination_entity);
8032 }
8033 }
8034 else if (!
g_Game.IsMultiplayer())
8035 {
8037 }
8038 }
8039
8041 {
8043 float split_quantity_new;
8045 if (player)
8046 {
8048 if (quantity > stackable)
8049 split_quantity_new = stackable;
8050 else
8051 split_quantity_new = quantity;
8052
8054 {
8055 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8056 new_item =
ItemBase.Cast(in_hands);
8057 if (new_item)
8058 {
8059 new_item.SetResultOfSplit(true);
8060 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8062 new_item.SetQuantity(split_quantity_new, false, true);
8063 }
8064 }
8065 }
8066 }
8067
8069 {
8071 float split_quantity_new = Math.Floor(quantity * 0.5);
8072
8074 return;
8075
8077
8078 if (new_item)
8079 {
8080 if (new_item.GetQuantityMax() < split_quantity_new)
8081 {
8082 split_quantity_new = new_item.GetQuantityMax();
8083 }
8084
8085 new_item.SetResultOfSplit(true);
8086 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8087
8089 {
8092 }
8093 else
8094 {
8096 new_item.
SetQuantity(split_quantity_new,
false,
true);
8097 }
8098 }
8099 }
8100
8102 {
8104 float split_quantity_new = Math.Floor(quantity / 2);
8105
8107 return;
8108
8109 InventoryLocation invloc = new InventoryLocation;
8111
8113 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8114
8115 if (new_item)
8116 {
8117 if (new_item.GetQuantityMax() < split_quantity_new)
8118 {
8119 split_quantity_new = new_item.GetQuantityMax();
8120 }
8122 {
8125 }
8126 else if (split_quantity_new > 1)
8127 {
8129 new_item.
SetQuantity(split_quantity_new,
false,
true);
8130 }
8131 }
8132 }
8133
8136 {
8137 SetWeightDirty();
8139
8140 if (parent)
8141 parent.OnAttachmentQuantityChangedEx(this, delta);
8142
8144 {
8146 {
8148 }
8150 {
8151 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8153 }
8154 }
8155 }
8156
8159 {
8160
8161 }
8162
8165 {
8167 }
8168
8170 {
8171 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8172
8174 {
8175 if (newLevel == GameConstants.STATE_RUINED)
8176 {
8178 EntityAI parent = GetHierarchyParent();
8179 if (parent && parent.IsFireplace())
8180 {
8181 CargoBase cargo = GetInventory().GetCargo();
8182 if (cargo)
8183 {
8185 {
8187 }
8188 }
8189 }
8190 }
8191
8193 {
8194
8196 return;
8197 }
8198
8199 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8200 {
8202 }
8203 }
8204 }
8205
8206
8208 {
8209 super.OnRightClick();
8210
8212 {
8214 {
8215 if (ScriptInputUserData.CanStoreInputUserData())
8216 {
8217 EntityAI root = GetHierarchyRoot();
8218 Man playerOwner = GetHierarchyRootPlayer();
8219 InventoryLocation dst = new InventoryLocation;
8220
8221
8222 if (!playerOwner && root && root == this)
8223 {
8225 }
8226 else
8227 {
8228
8229 GetInventory().GetCurrentInventoryLocation(dst);
8231 {
8232 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8234 {
8236 }
8237 else
8238 {
8240
8241
8242 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8243 {
8245 }
8246 else
8247 {
8248 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8249 }
8250 }
8251 }
8252 }
8253
8254 ScriptInputUserData ctx = new ScriptInputUserData;
8262 }
8263 }
8264 else if (!
g_Game.IsMultiplayer())
8265 {
8267 }
8268 }
8269 }
8270
8272 {
8273 if (root)
8274 {
8275 vector m4[4];
8276 root.GetTransform(m4);
8277 dst.SetGround(this, m4);
8278 }
8279 else
8280 {
8281 GetInventory().GetCurrentInventoryLocation(dst);
8282 }
8283 }
8284
8285 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8286 {
8287
8288 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8289 return false;
8290
8291 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8292 return false;
8293
8294
8296 return false;
8297
8298
8299 Magazine mag = Magazine.Cast(this);
8300 if (mag)
8301 {
8302 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8303 return false;
8304
8305 if (stack_max_limit)
8306 {
8307 Magazine other_mag = Magazine.Cast(other_item);
8308 if (other_item)
8309 {
8310 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8311 return false;
8312 }
8313
8314 }
8315 }
8316 else
8317 {
8318
8320 return false;
8321
8323 return false;
8324 }
8325
8326 PlayerBase player = null;
8327 if (CastTo(player, GetHierarchyRootPlayer()))
8328 {
8329 if (player.GetInventory().HasAttachment(this))
8330 return false;
8331
8332 if (player.IsItemsToDelete())
8333 return false;
8334 }
8335
8336 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8337 return false;
8338
8339 int slotID;
8341 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8342 return false;
8343
8344 return true;
8345 }
8346
8348 {
8350 }
8351
8353 {
8354 return m_IsResultOfSplit;
8355 }
8356
8358 {
8359 m_IsResultOfSplit = value;
8360 }
8361
8363 {
8365 }
8366
8368 {
8369 float other_item_quantity = other_item.GetQuantity();
8370 float this_free_space;
8371
8373
8375
8376 if (other_item_quantity > this_free_space)
8377 {
8378 return this_free_space;
8379 }
8380 else
8381 {
8382 return other_item_quantity;
8383 }
8384 }
8385
8387 {
8389 }
8390
8392 {
8394 return;
8395
8396 if (!IsMagazine() && other_item)
8397 {
8399 if (quantity_used != 0)
8400 {
8401 float hp1 = GetHealth01("","");
8402 float hp2 = other_item.GetHealth01("","");
8403 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8404 hpResult = hpResult / (
GetQuantity() + quantity_used);
8405
8406 hpResult *= GetMaxHealth();
8407 Math.Round(hpResult);
8408 SetHealth("", "Health", hpResult);
8409
8411 other_item.AddQuantity(-quantity_used);
8412 }
8413 }
8415 }
8416
8418 {
8419 #ifdef SERVER
8420 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8421 GetHierarchyParent().IncreaseLifetimeUp();
8422 #endif
8423 };
8424
8426 {
8427 PlayerBase p = PlayerBase.Cast(player);
8428
8429 array<int> recipesIds = p.m_Recipes;
8430 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8431 if (moduleRecipesManager)
8432 {
8433 EntityAI itemInHands = player.GetEntityInHands();
8434 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8435 }
8436
8437 for (int i = 0;i < recipesIds.Count(); i++)
8438 {
8439 int key = recipesIds.Get(i);
8440 string recipeName = moduleRecipesManager.GetRecipeName(key);
8442 }
8443 }
8444
8445
8446 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8447 {
8448 super.GetDebugActions(outputList);
8449
8450
8456
8457
8462
8467
8468
8472
8473
8475 {
8479 }
8480
8483
8484
8488
8490
8491 InventoryLocation loc = new InventoryLocation();
8492 GetInventory().GetCurrentInventoryLocation(loc);
8494 {
8495 if (Gizmo_IsSupported())
8498 }
8499
8501 }
8502
8503
8504
8505
8507 {
8508 super.OnAction(action_id, player, ctx);
8509
8511 {
8512 switch (action_id)
8513 {
8517 return true;
8521 return true;
8522 }
8523 }
8524
8526 {
8527 switch (action_id)
8528 {
8530 Delete();
8531 return true;
8532 }
8533 }
8534
8535 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8536 {
8537 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8538 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8539 PlayerBase p = PlayerBase.Cast(player);
8540 if (
EActions.RECIPES_RANGE_START < 1000)
8541 {
8542 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8543 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8544 }
8545 }
8546 #ifndef SERVER
8547 else if (action_id ==
EActions.WATCH_PLAYER)
8548 {
8549 PluginDeveloper.SetDeveloperItemClientEx(player);
8550 }
8551 #endif
8553 {
8554 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8555 {
8556 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8557 OnDebugButtonPressServer(id + 1);
8558 }
8559
8560 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8561 {
8562 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8564 }
8565
8566 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8567 {
8568 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8570 }
8571
8572 else if (action_id ==
EActions.ADD_QUANTITY)
8573 {
8574 if (IsMagazine())
8575 {
8576 Magazine mag = Magazine.Cast(this);
8577 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8578 }
8579 else
8580 {
8582 }
8583
8584 if (m_EM)
8585 {
8586 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8587 }
8588
8589 }
8590
8591 else if (action_id ==
EActions.REMOVE_QUANTITY)
8592 {
8593 if (IsMagazine())
8594 {
8595 Magazine mag2 = Magazine.Cast(this);
8596 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8597 }
8598 else
8599 {
8601 }
8602 if (m_EM)
8603 {
8604 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8605 }
8606
8607 }
8608
8609 else if (action_id ==
EActions.SET_QUANTITY_0)
8610 {
8612
8613 if (m_EM)
8614 {
8615 m_EM.SetEnergy(0);
8616 }
8617 }
8618
8619 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8620 {
8622
8623 if (m_EM)
8624 {
8625 m_EM.SetEnergy(m_EM.GetEnergyMax());
8626 }
8627 }
8628
8629 else if (action_id ==
EActions.ADD_HEALTH)
8630 {
8631 AddHealth("","",GetMaxHealth("","Health")/5);
8632 }
8633 else if (action_id ==
EActions.REMOVE_HEALTH)
8634 {
8635 AddHealth("","",-GetMaxHealth("","Health")/5);
8636 }
8637 else if (action_id ==
EActions.DESTROY_HEALTH)
8638 {
8639 SetHealth01("","",0);
8640 }
8641 else if (action_id ==
EActions.WATCH_ITEM)
8642 {
8644 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8645 #ifdef DEVELOPER
8646 SetDebugDeveloper_item(this);
8647 #endif
8648 }
8649
8650 else if (action_id ==
EActions.ADD_TEMPERATURE)
8651 {
8652 AddTemperature(20);
8653
8654 }
8655
8656 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8657 {
8658 AddTemperature(-20);
8659
8660 }
8661
8662 else if (action_id ==
EActions.FLIP_FROZEN)
8663 {
8664 SetFrozen(!GetIsFrozen());
8665
8666 }
8667
8668 else if (action_id ==
EActions.ADD_WETNESS)
8669 {
8671
8672 }
8673
8674 else if (action_id ==
EActions.REMOVE_WETNESS)
8675 {
8677
8678 }
8679
8680 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8681 {
8684
8685
8686 }
8687
8688 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8689 {
8692 }
8693
8694 else if (action_id ==
EActions.MAKE_SPECIAL)
8695 {
8696 auto debugParams = DebugSpawnParams.WithPlayer(player);
8697 OnDebugSpawnEx(debugParams);
8698 }
8699
8700 }
8701
8702
8703 return false;
8704 }
8705
8706
8707
8708
8712
8715
8716
8717
8719 {
8720 return false;
8721 }
8722
8723
8725 {
8726 return true;
8727 }
8728
8729
8731 {
8732 return true;
8733 }
8734
8735
8736
8738 {
8739 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8740 return g_Game.ConfigIsExisting(config_path);
8741 }
8742
8745 {
8746 return null;
8747 }
8748
8750 {
8751 return false;
8752 }
8753
8755 {
8756 return false;
8757 }
8758
8762
8763
8765 {
8766 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8767 return module_repairing.CanRepair(this, item_repair_kit);
8768 }
8769
8770
8771 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8772 {
8773 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8774 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8775 }
8776
8777
8779 {
8780
8781
8782
8783
8784
8785
8786
8787
8788 return 1;
8789 }
8790
8791
8792
8794 {
8796 }
8797
8798
8799
8801 {
8803 }
8804
8805
8814 {
8815 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8816
8817 if (player)
8818 {
8819 player.MessageStatus(text);
8820 }
8821 }
8822
8823
8832 {
8833 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8834
8835 if (player)
8836 {
8837 player.MessageAction(text);
8838 }
8839 }
8840
8841
8850 {
8851 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8852
8853 if (player)
8854 {
8855 player.MessageFriendly(text);
8856 }
8857 }
8858
8859
8868 {
8869 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8870
8871 if (player)
8872 {
8873 player.MessageImportant(text);
8874 }
8875 }
8876
8878 {
8879 return true;
8880 }
8881
8882
8883 override bool KindOf(
string tag)
8884 {
8885 bool found = false;
8886 string item_name = this.
GetType();
8888 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8889
8890 int array_size = item_tag_array.Count();
8891 for (int i = 0; i < array_size; i++)
8892 {
8893 if (item_tag_array.Get(i) == tag)
8894 {
8895 found = true;
8896 break;
8897 }
8898 }
8899 return found;
8900 }
8901
8902
8904 {
8905
8906 super.OnRPC(sender, rpc_type,ctx);
8907
8908
8909 switch (rpc_type)
8910 {
8911 #ifndef SERVER
8912 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8913 Param2<bool, string> p = new Param2<bool, string>(false, "");
8914
8916 return;
8917
8918 bool play = p.param1;
8919 string soundSet = p.param2;
8920
8921 if (play)
8922 {
8924 {
8926 {
8928 }
8929 }
8930 else
8931 {
8933 }
8934 }
8935 else
8936 {
8938 }
8939
8940 break;
8941 #endif
8942
8943 }
8944
8946 {
8948 }
8949 }
8950
8951
8952
8953
8955 {
8956 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8957 return plugin.GetID(
name);
8958 }
8959
8961 {
8962 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8963 return plugin.GetName(id);
8964 }
8965
8968 {
8969
8970
8971 int varFlags;
8972 if (!ctx.
Read(varFlags))
8973 return;
8974
8975 if (varFlags & ItemVariableFlags.FLOAT)
8976 {
8978 }
8979 }
8980
8982 {
8983
8984 super.SerializeNumericalVars(floats_out);
8985
8986
8987
8989 {
8991 }
8992
8994 {
8996 }
8997
8999 {
9001 }
9002
9004 {
9009 }
9010
9012 {
9014 }
9015 }
9016
9018 {
9019
9020 super.DeSerializeNumericalVars(floats);
9021
9022
9023 int index = 0;
9024 int mask = Math.Round(floats.Get(index));
9025
9026 index++;
9027
9029 {
9031 {
9033 }
9034 else
9035 {
9036 float quantity = floats.Get(index);
9038 }
9039 index++;
9040 }
9041
9043 {
9044 float wet = floats.Get(index);
9046 index++;
9047 }
9048
9050 {
9051 int liquidtype = Math.Round(floats.Get(index));
9053 index++;
9054 }
9055
9057 {
9059 index++;
9061 index++;
9063 index++;
9065 index++;
9066 }
9067
9069 {
9070 int cleanness = Math.Round(floats.Get(index));
9072 index++;
9073 }
9074 }
9075
9077 {
9078 super.WriteVarsToCTX(ctx);
9079
9080
9082 {
9084 }
9085
9087 {
9089 }
9090
9092 {
9094 }
9095
9097 {
9098 int r,g,b,a;
9104 }
9105
9107 {
9109 }
9110 }
9111
9113 {
9114 if (!super.ReadVarsFromCTX(ctx,version))
9115 return false;
9116
9117 int intValue;
9118 float value;
9119
9120 if (version < 140)
9121 {
9122 if (!ctx.
Read(intValue))
9123 return false;
9124
9125 m_VariablesMask = intValue;
9126 }
9127
9129 {
9130 if (!ctx.
Read(value))
9131 return false;
9132
9134 {
9136 }
9137 else
9138 {
9140 }
9141 }
9142
9143 if (version < 140)
9144 {
9146 {
9147 if (!ctx.
Read(value))
9148 return false;
9149 SetTemperatureDirect(value);
9150 }
9151 }
9152
9154 {
9155 if (!ctx.
Read(value))
9156 return false;
9158 }
9159
9161 {
9162 if (!ctx.
Read(intValue))
9163 return false;
9165 }
9166
9168 {
9169 int r,g,b,a;
9171 return false;
9173 return false;
9175 return false;
9177 return false;
9178
9180 }
9181
9183 {
9184 if (!ctx.
Read(intValue))
9185 return false;
9187 }
9188
9189 if (version >= 138 && version < 140)
9190 {
9192 {
9193 if (!ctx.
Read(intValue))
9194 return false;
9195 SetFrozen(intValue);
9196 }
9197 }
9198
9199 return true;
9200 }
9201
9202
9204 {
9207 {
9209 }
9210
9211 if (!super.OnStoreLoad(ctx, version))
9212 {
9214 return false;
9215 }
9216
9217 if (version >= 114)
9218 {
9219 bool hasQuickBarIndexSaved;
9220
9221 if (!ctx.
Read(hasQuickBarIndexSaved))
9222 {
9224 return false;
9225 }
9226
9227 if (hasQuickBarIndexSaved)
9228 {
9229 int itmQBIndex;
9230
9231
9232 if (!ctx.
Read(itmQBIndex))
9233 {
9235 return false;
9236 }
9237
9238 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9239 if (itmQBIndex != -1 && parentPlayer)
9240 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9241 }
9242 }
9243 else
9244 {
9245
9246 PlayerBase player;
9247 int itemQBIndex;
9248 if (version ==
int.
MAX)
9249 {
9250 if (!ctx.
Read(itemQBIndex))
9251 {
9253 return false;
9254 }
9255 }
9256 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9257 {
9258
9259 if (!ctx.
Read(itemQBIndex))
9260 {
9262 return false;
9263 }
9264 if (itemQBIndex != -1 && player)
9265 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9266 }
9267 }
9268
9269 if (version < 140)
9270 {
9271
9272 if (!LoadVariables(ctx, version))
9273 {
9275 return false;
9276 }
9277 }
9278
9279
9281 {
9283 return false;
9284 }
9285 if (version >= 132)
9286 {
9288 if (raib)
9289 {
9291 {
9293 return false;
9294 }
9295 }
9296 }
9297
9299 return true;
9300 }
9301
9302
9303
9305 {
9306 super.OnStoreSave(ctx);
9307
9308 PlayerBase player;
9309 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9310 {
9312
9313 int itemQBIndex = -1;
9314 itemQBIndex = player.FindQuickBarEntityIndex(this);
9315 ctx.
Write(itemQBIndex);
9316 }
9317 else
9318 {
9320 }
9321
9323
9325 if (raib)
9326 {
9328 }
9329 }
9330
9331
9333 {
9334 super.AfterStoreLoad();
9335
9337 {
9339 }
9340
9342 {
9345 }
9346 }
9347
9349 {
9350 super.EEOnAfterLoad();
9351
9353 {
9355 }
9356
9359 }
9360
9362 {
9363 return false;
9364 }
9365
9366
9367
9369 {
9371 {
9372 #ifdef PLATFORM_CONSOLE
9373
9375 {
9377 if (menu)
9378 {
9380 }
9381 }
9382 #endif
9383 }
9384
9386 {
9389 }
9390
9392 {
9393 SetWeightDirty();
9395 }
9397 {
9400 }
9401
9403 {
9406
9409 }
9411 {
9415 }
9416
9417 super.OnVariablesSynchronized();
9418 }
9419
9420
9421
9423 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9424 {
9425 if (!IsServerCheck(allow_client))
9426 return false;
9427
9429 return false;
9430
9433
9434 if (value <= (min + 0.001))
9435 value = min;
9436
9437 if (value == min)
9438 {
9439 if (destroy_config)
9440 {
9441 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9442 if (dstr)
9443 {
9445 this.Delete();
9446 return true;
9447 }
9448 }
9449 else if (destroy_forced)
9450 {
9452 this.Delete();
9453 return true;
9454 }
9455
9457 }
9458
9461
9463 {
9464 EntityAI parent = GetHierarchyRoot();
9465 InventoryLocation iLoc = new InventoryLocation();
9466 GetInventory().GetCurrentInventoryLocation(iLoc);
9468 {
9469 int iLocSlot = iLoc.
GetSlot();
9471 {
9473 }
9475 {
9477 }
9478 }
9479 }
9480
9482 {
9484
9485 if (delta)
9487 }
9488
9490
9491 return false;
9492 }
9493
9494
9496 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9497 {
9499 }
9500
9502 {
9505 }
9506
9508 {
9511 }
9512
9514 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9515 {
9516 float value_clamped = Math.Clamp(value, 0, 1);
9518 SetQuantity(result, destroy_config, destroy_forced);
9519 }
9520
9521
9524 {
9526 }
9527
9529 {
9531 }
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9543 {
9544 int slot = -1;
9545 GameInventory inventory = GetInventory();
9546 if (inventory)
9547 {
9548 InventoryLocation il = new InventoryLocation;
9551 }
9552
9554 }
9555
9557 {
9558 float quantity_max = 0;
9559
9561 {
9562 if (attSlotID != -1)
9563 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9564
9565 if (quantity_max <= 0)
9567 }
9568
9569 if (quantity_max <= 0)
9571
9572 return quantity_max;
9573 }
9574
9576 {
9578 }
9579
9581 {
9583 }
9584
9585
9587 {
9589 }
9590
9592 {
9594 }
9595
9597 {
9599 }
9600
9601
9603 {
9604
9605 float weightEx = GetWeightEx();
9606 float special = GetInventoryAndCargoWeight();
9607 return weightEx - special;
9608 }
9609
9610
9612 {
9614 }
9615
9617 {
9619 {
9620 #ifdef DEVELOPER
9621 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9622 {
9623 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9625 }
9626 #endif
9627
9629 }
9630 else if (HasEnergyManager())
9631 {
9632 #ifdef DEVELOPER
9633 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9634 {
9635 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9636 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9637 }
9638 #endif
9639 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9640 }
9641 else
9642 {
9643 #ifdef DEVELOPER
9644 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9645 {
9646 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9647 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9648 }
9649 #endif
9650 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9651 }
9652 }
9653
9656 {
9657 int item_count = 0;
9659
9660 GameInventory inventory = GetInventory();
9661 CargoBase cargo = inventory.
GetCargo();
9662 if (cargo != NULL)
9663 {
9665 }
9666
9668 for (int i = 0; i < nAttachments; ++i)
9669 {
9671 if (item)
9672 item_count += item.GetNumberOfItems();
9673 }
9674 return item_count;
9675 }
9676
9679 {
9680 float weight = 0;
9681 float wetness = 1;
9682 if (include_wetness)
9685 {
9686 weight = wetness * m_ConfigWeight;
9687 }
9689 {
9690 weight = 1;
9691 }
9692 return weight;
9693 }
9694
9695
9696
9698 {
9699 GameInventory inventory = GetInventory();
9700 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9701 {
9702 array<EntityAI> items = new array<EntityAI>;
9704 for (int i = 0; i < items.Count(); ++i)
9705 {
9707 if (item)
9708 {
9709 g_Game.ObjectDelete(item);
9710 }
9711 }
9712 }
9713 }
9714
9715
9716
9717
9719 {
9720 float energy = 0;
9721 if (HasEnergyManager())
9722 {
9723 energy = GetCompEM().GetEnergy();
9724 }
9725 return energy;
9726 }
9727
9728
9730 {
9731 super.OnEnergyConsumed();
9732
9734 }
9735
9737 {
9738 super.OnEnergyAdded();
9739
9741 }
9742
9743
9745 {
9746 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9747 {
9749 {
9750 float energy_0to1 = GetCompEM().GetEnergy0To1();
9752 }
9753 }
9754 }
9755
9756
9758 {
9759 return ConfigGetFloat("heatIsolation");
9760 }
9761
9763 {
9765 }
9766
9768 {
9769 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9770 if (
g_Game.ConfigIsExisting(paramPath))
9771 return g_Game.ConfigGetFloat(paramPath);
9772
9773 return 0.0;
9774 }
9775
9777 {
9778 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9779 if (
g_Game.ConfigIsExisting(paramPath))
9780 return g_Game.ConfigGetFloat(paramPath);
9781
9782 return 0.0;
9783 }
9784
9785 override void SetWet(
float value,
bool allow_client =
false)
9786 {
9787 if (!IsServerCheck(allow_client))
9788 return;
9789
9792
9794
9795 m_VarWet = Math.Clamp(value, min, max);
9796
9798 {
9801 }
9802 }
9803
9804 override void AddWet(
float value)
9805 {
9807 }
9808
9810 {
9812 }
9813
9815 {
9817 }
9818
9820 {
9822 }
9823
9825 {
9827 }
9828
9830 {
9832 }
9833
9835 {
9838 if (newLevel != oldLevel)
9839 {
9841 }
9842 }
9843
9845 {
9846 SetWeightDirty();
9847 }
9848
9850 {
9851 return GetWetLevelInternal(
m_VarWet);
9852 }
9853
9854
9855
9857 {
9859 }
9860
9862 {
9864 }
9865
9867 {
9869 }
9870
9872 {
9874 }
9875
9876
9877
9879 {
9880 if (ConfigIsExisting("itemModelLength"))
9881 {
9882 return ConfigGetFloat("itemModelLength");
9883 }
9884 return 0;
9885 }
9886
9888 {
9889 if (ConfigIsExisting("itemAttachOffset"))
9890 {
9891 return ConfigGetFloat("itemAttachOffset");
9892 }
9893 return 0;
9894 }
9895
9896 override void SetCleanness(
int value,
bool allow_client =
false)
9897 {
9898 if (!IsServerCheck(allow_client))
9899 return;
9900
9902
9904
9907 }
9908
9910 {
9912 }
9913
9915 {
9916 return true;
9917 }
9918
9919
9920
9921
9923 {
9925 }
9926
9928 {
9930 }
9931
9932
9933
9934
9935 override void SetColor(
int r,
int g,
int b,
int a)
9936 {
9942 }
9944 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9945 {
9950 }
9951
9953 {
9955 }
9956
9959 {
9960 int r,g,b,a;
9962 r = r/255;
9963 g = g/255;
9964 b = b/255;
9965 a = a/255;
9966 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9967 }
9968
9969
9970
9971 override void SetLiquidType(
int value,
bool allow_client =
false)
9972 {
9973 if (!IsServerCheck(allow_client))
9974 return;
9975
9980 }
9981
9983 {
9984 return ConfigGetInt("varLiquidTypeInit");
9985 }
9986
9988 {
9990 }
9991
9993 {
9995 SetFrozen(false);
9996 }
9997
10000 {
10001 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10002 }
10003
10004
10007 {
10008 PlayerBase nplayer;
10009 if (PlayerBase.CastTo(nplayer, player))
10010 {
10012 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10013 }
10014 }
10015
10016
10019 {
10020 PlayerBase nplayer;
10021 if (PlayerBase.CastTo(nplayer,player))
10022 {
10023 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10024 }
10025
10026 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10027
10028 if (HasEnergyManager())
10029 {
10030 GetCompEM().UpdatePlugState();
10031 }
10032 }
10033
10034
10036 {
10037 super.OnPlacementStarted(player);
10038
10040 }
10041
10042 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10043 {
10045 {
10046 m_AdminLog.OnPlacementComplete(player,
this);
10047 }
10048
10049 super.OnPlacementComplete(player, position, orientation);
10050 }
10051
10052
10053
10054
10055
10057 {
10059 {
10060 return true;
10061 }
10062 else
10063 {
10064 return false;
10065 }
10066 }
10067
10068
10070 {
10072 {
10074 }
10075 }
10076
10077
10079 {
10081 }
10082
10084 {
10086 }
10087
10088 override void InsertAgent(
int agent,
float count = 1)
10089 {
10090 if (count < 1)
10091 return;
10092
10094 }
10095
10098 {
10100 }
10101
10102
10104 {
10106 }
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10150 {
10152 return false;
10153 return true;
10154 }
10155
10157 {
10158
10160 }
10161
10162
10165 {
10166 super.CheckForRoofLimited(timeTresholdMS);
10167
10168 float time =
g_Game.GetTime();
10169 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10170 {
10171 m_PreviousRoofTestTime = time;
10172 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10173 }
10174 }
10175
10176
10178 {
10180 {
10181 return 0;
10182 }
10183
10184 if (GetInventory().GetAttachmentSlotsCount() != 0)
10185 {
10186 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10187 if (filter)
10188 return filter.GetProtectionLevel(type, false, system);
10189 else
10190 return 0;
10191 }
10192
10193 string subclassPath, entryName;
10194
10195 switch (type)
10196 {
10198 entryName = "biological";
10199 break;
10201 entryName = "chemical";
10202 break;
10203 default:
10204 entryName = "biological";
10205 break;
10206 }
10207
10208 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10209
10210 return g_Game.ConfigGetFloat(subclassPath + entryName);
10211 }
10212
10213
10214
10217 {
10218 if (!IsMagazine())
10220
10222 }
10223
10224
10225
10226
10227
10232 {
10233 return true;
10234 }
10235
10237 {
10239 }
10240
10241
10242
10243
10244
10246 {
10247 if (parent)
10248 {
10249 if (parent.IsInherited(DayZInfected))
10250 return true;
10251
10252 if (!parent.IsRuined())
10253 return true;
10254 }
10255
10256 return true;
10257 }
10258
10260 {
10261 if (!super.CanPutAsAttachment(parent))
10262 {
10263 return false;
10264 }
10265
10266 if (!IsRuined() && !parent.IsRuined())
10267 {
10268 return true;
10269 }
10270
10271 return false;
10272 }
10273
10275 {
10276
10277
10278
10279
10280 return super.CanReceiveItemIntoCargo(item);
10281 }
10282
10284 {
10285
10286
10287
10288
10289 GameInventory attachmentInv = attachment.GetInventory();
10291 {
10292 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10293 return false;
10294 }
10295
10296 InventoryLocation loc = new InventoryLocation();
10297 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10298 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10299 return false;
10300
10301 return super.CanReceiveAttachment(attachment, slotId);
10302 }
10303
10305 {
10306 if (!super.CanReleaseAttachment(attachment))
10307 return false;
10308
10309 return GetInventory().AreChildrenAccessible();
10310 }
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10333 {
10334 int id = muzzle_owner.GetMuzzleID();
10335 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10336
10337 if (WPOF_array)
10338 {
10339 for (int i = 0; i < WPOF_array.Count(); i++)
10340 {
10341 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10342
10343 if (WPOF)
10344 {
10345 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10346 }
10347 }
10348 }
10349 }
10350
10351
10353 {
10354 int id = muzzle_owner.GetMuzzleID();
10356
10357 if (WPOBE_array)
10358 {
10359 for (int i = 0; i < WPOBE_array.Count(); i++)
10360 {
10361 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10362
10363 if (WPOBE)
10364 {
10365 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10366 }
10367 }
10368 }
10369 }
10370
10371
10373 {
10374 int id = muzzle_owner.GetMuzzleID();
10375 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10376
10377 if (WPOOH_array)
10378 {
10379 for (int i = 0; i < WPOOH_array.Count(); i++)
10380 {
10381 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10382
10383 if (WPOOH)
10384 {
10385 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10386 }
10387 }
10388 }
10389 }
10390
10391
10393 {
10394 int id = muzzle_owner.GetMuzzleID();
10395 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10396
10397 if (WPOOH_array)
10398 {
10399 for (int i = 0; i < WPOOH_array.Count(); i++)
10400 {
10401 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10402
10403 if (WPOOH)
10404 {
10405 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10406 }
10407 }
10408 }
10409 }
10410
10411
10413 {
10414 int id = muzzle_owner.GetMuzzleID();
10415 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10416
10417 if (WPOOH_array)
10418 {
10419 for (int i = 0; i < WPOOH_array.Count(); i++)
10420 {
10421 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10422
10423 if (WPOOH)
10424 {
10425 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10426 }
10427 }
10428 }
10429 }
10430
10431
10432
10434 {
10436 {
10437 return true;
10438 }
10439
10440 return false;
10441 }
10442
10444 {
10446 {
10447 return true;
10448 }
10449
10450 return false;
10451 }
10452
10454 {
10456 {
10457 return true;
10458 }
10459
10460 return false;
10461 }
10462
10464 {
10465 return false;
10466 }
10467
10470 {
10471 return UATimeSpent.DEFAULT_DEPLOY;
10472 }
10473
10474
10475
10476
10478 {
10480 SetSynchDirty();
10481 }
10482
10484 {
10486 }
10487
10488
10490 {
10491 return false;
10492 }
10493
10496 {
10497 string att_type = "None";
10498
10499 if (ConfigIsExisting("soundAttType"))
10500 {
10501 att_type = ConfigGetString("soundAttType");
10502 }
10503
10505 }
10506
10508 {
10510 }
10511
10512
10513
10514
10515
10521
10523 {
10526
10528 }
10529
10530
10532 {
10534 return;
10535
10537
10540
10543
10544 SoundParameters params = new SoundParameters();
10548 }
10549
10550
10552 {
10554 {
10557
10558 SetSynchDirty();
10559
10562 }
10563 }
10564
10566 {
10568 }
10569
10570
10572 {
10574 return;
10575
10577 SetSynchDirty();
10578
10581 }
10582
10584 {
10587 }
10588
10590 {
10592 }
10593
10594 void OnApply(PlayerBase player);
10595
10597 {
10598 return 1.0;
10599 };
10600
10602 {
10604 }
10605
10607 {
10609 }
10610
10612
10614 {
10615 SetDynamicPhysicsLifeTime(0.01);
10617 }
10618
10620 {
10621 array<string> zone_names = new array<string>;
10622 GetDamageZones(zone_names);
10623 for (int i = 0; i < zone_names.Count(); i++)
10624 {
10625 SetHealthMax(zone_names.Get(i),"Health");
10626 }
10627 SetHealthMax("","Health");
10628 }
10629
10632 {
10633 float global_health = GetHealth01("","Health");
10634 array<string> zones = new array<string>;
10635 GetDamageZones(zones);
10636
10637 for (int i = 0; i < zones.Count(); i++)
10638 {
10639 SetHealth01(zones.Get(i),"Health",global_health);
10640 }
10641 }
10642
10645 {
10646 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10647 }
10648
10650 {
10651 if (!hasRootAsPlayer)
10652 {
10653 if (refParentIB)
10654 {
10655
10656 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10657 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10658
10659 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10660 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10661
10664 }
10665 else
10666 {
10667
10670 }
10671 }
10672 }
10673
10675 {
10677 {
10678 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10679 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10680 {
10681 float heatPermCoef = 1.0;
10683 while (ent)
10684 {
10685 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10686 ent = ent.GetHierarchyParent();
10687 }
10688
10689 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10690 }
10691 }
10692 }
10693
10695 {
10696
10697 EntityAI parent = GetHierarchyParent();
10698 if (!parent)
10699 {
10700 hasParent = false;
10701 hasRootAsPlayer = false;
10702 }
10703 else
10704 {
10705 hasParent = true;
10706 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10707 refParentIB =
ItemBase.Cast(parent);
10708 }
10709 }
10710
10711 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10712 {
10713
10714 }
10715
10717 {
10718
10719 return false;
10720 }
10721
10723 {
10724
10725
10726 return false;
10727 }
10728
10730 {
10731
10732 return false;
10733 }
10734
10737 {
10738 return !GetIsFrozen() &&
IsOpen();
10739 }
10740
10742 {
10743 bool hasParent = false, hasRootAsPlayer = false;
10745
10746 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10747 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10748
10749 if (wwtu || foodDecay)
10750 {
10754
10755 if (processWetness || processTemperature || processDecay)
10756 {
10758
10759 if (processWetness)
10760 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10761
10762 if (processTemperature)
10764
10765 if (processDecay)
10766 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10767 }
10768 }
10769 }
10770
10773 {
10775 }
10776
10778 {
10781
10782 return super.GetTemperatureFreezeThreshold();
10783 }
10784
10786 {
10789
10790 return super.GetTemperatureThawThreshold();
10791 }
10792
10794 {
10797
10798 return super.GetItemOverheatThreshold();
10799 }
10800
10802 {
10804 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10805
10806 return super.GetTemperatureFreezeTime();
10807 }
10808
10810 {
10812 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10813
10814 return super.GetTemperatureThawTime();
10815 }
10816
10821
10823 {
10824 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10825 }
10826
10828 {
10829 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10830 }
10831
10834 {
10836 }
10837
10839 {
10841 }
10842
10844 {
10846 }
10847
10850 {
10851 return null;
10852 }
10853
10856 {
10857 return false;
10858 }
10859
10861 {
10863 {
10866 if (!trg)
10867 {
10869 explosive = this;
10870 }
10871
10872 explosive.PairRemote(trg);
10874
10875 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10876 trg.SetPersistentPairID(persistentID);
10877 explosive.SetPersistentPairID(persistentID);
10878
10879 return true;
10880 }
10881 return false;
10882 }
10883
10886 {
10887 float ret = 1.0;
10890 ret *= GetHealth01();
10891
10892 return ret;
10893 }
10894
10895 #ifdef DEVELOPER
10896 override void SetDebugItem()
10897 {
10898 super.SetDebugItem();
10899 _itemBase = this;
10900 }
10901
10903 {
10904 string text = super.GetDebugText();
10905
10907 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10908
10909 return text;
10910 }
10911 #endif
10912
10914 {
10915 return true;
10916 }
10917
10919
10921
10923 {
10926 }
10927
10928
10936
10952
10953 [
Obsolete(
"Use ItemSoundHandler instead")]
10956 {
10957 if (!
g_Game.IsDedicatedServer())
10958 {
10959 if (ConfigIsExisting("attachSoundSet"))
10960 {
10961 string cfg_path = "";
10962 string soundset = "";
10963 string type_name =
GetType();
10964
10967 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10968 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10969
10970 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10971 {
10972 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10973 {
10974 if (cfg_slot_array[i] == slot_type)
10975 {
10976 soundset = cfg_soundset_array[i];
10977 break;
10978 }
10979 }
10980 }
10981
10982 if (soundset != "")
10983 {
10984 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10986 }
10987 }
10988 }
10989 }
10990
10992}
10993
10995{
10997 if (entity)
10998 {
10999 bool is_item = entity.IsInherited(
ItemBase);
11000 if (is_item && full_quantity)
11001 {
11004 }
11005 }
11006 else
11007 {
11009 return NULL;
11010 }
11011 return entity;
11012}
11013
11015{
11016 if (item)
11017 {
11018 if (health > 0)
11019 item.SetHealth("", "", health);
11020
11021 if (item.CanHaveTemperature())
11022 {
11024 if (item.CanFreeze())
11025 item.SetFrozen(false);
11026 }
11027
11028 if (item.HasEnergyManager())
11029 {
11030 if (quantity >= 0)
11031 {
11032 item.GetCompEM().SetEnergy0To1(quantity);
11033 }
11034 else
11035 {
11037 }
11038 }
11039 else if (item.IsMagazine())
11040 {
11041 Magazine mag = Magazine.Cast(item);
11042 if (quantity >= 0)
11043 {
11044 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11045 }
11046 else
11047 {
11049 }
11050
11051 }
11052 else
11053 {
11054 if (quantity >= 0)
11055 {
11056 item.SetQuantityNormalized(quantity, false);
11057 }
11058 else
11059 {
11061 }
11062
11063 }
11064 }
11065}
11066
11067#ifdef DEVELOPER
11069#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.