6124{
6126 {
6127 return true;
6128 }
6129};
6130
6132{
6133
6134};
6135
6136
6137
6139{
6143
6145
6148
6149
6150
6151
6152
6161
6167
6172
6177
6198 protected bool m_IsResultOfSplit
6199
6201
6206
6207
6208
6210
6214
6215
6216
6218
6221
6222
6223
6229
6230
6238
6241
6242
6244
6245
6247
6248
6253
6254
6259
6261
6262
6264
6265
6267 {
6272
6273 if (!
g_Game.IsDedicatedServer())
6274 {
6276 {
6278
6280 {
6282 }
6283 }
6284
6287 }
6288
6289 m_OldLocation = null;
6290
6292 {
6294 }
6295
6296 if (ConfigIsExisting("headSelectionsToHide"))
6297 {
6300 }
6301
6303 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6304 {
6306 }
6307
6309
6310 m_IsResultOfSplit = false;
6311
6313 }
6314
6316 {
6317 super.InitItemVariables();
6318
6324 m_Count = ConfigGetInt(
"count");
6325
6328
6333
6336
6341
6353
6357
6358
6361 if (ConfigIsExisting("canBeSplit"))
6362 {
6365 }
6366
6368 if (ConfigIsExisting("itemBehaviour"))
6370
6371
6374 RegisterNetSyncVariableInt("m_VarLiquidType");
6375 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6376
6377 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6378 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6379 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6380
6381 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6382 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6383 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6384 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6385
6386 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6387 RegisterNetSyncVariableBool("m_IsTakeable");
6388 RegisterNetSyncVariableBool("m_IsHologram");
6389
6392 {
6395 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6396 }
6397
6399
6401 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6403
6405 }
6406
6408 {
6410 }
6411
6413 {
6416 {
6421 }
6422 }
6423
6424 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6425 {
6427 {
6430 }
6431
6433 }
6434
6436 {
6442 }
6443
6445
6447 {
6449
6450 if (!action)
6451 {
6452 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6453 return;
6454 }
6455
6457 if (!ai)
6458 {
6460 return;
6461 }
6462
6464 if (!action_array)
6465 {
6466 action_array = new array<ActionBase_Basic>;
6468 }
6469 if (LogManager.IsActionLogEnable())
6470 {
6471 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6472 }
6473
6474 if (action_array.Find(action) != -1)
6475 {
6476 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6477 }
6478 else
6479 {
6480 action_array.Insert(action);
6481 }
6482 }
6483
6485 {
6486 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6487 ActionBase action = player.GetActionManager().GetAction(actionName);
6490
6491 if (action_array)
6492 {
6493 action_array.RemoveItem(action);
6494 }
6495 }
6496
6497
6498
6500 {
6501 ActionOverrideData overrideData = new ActionOverrideData();
6505
6507 if (!actionMap)
6508 {
6511 }
6512
6513 actionMap.Insert(this.
Type(), overrideData);
6514
6515 }
6516
6518
6520
6521
6523 {
6526
6529
6530 string config_to_search = "CfgVehicles";
6531 string muzzle_owner_config;
6532
6534 {
6535 if (IsInherited(Weapon))
6536 config_to_search = "CfgWeapons";
6537
6538 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6539
6540 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6541
6542 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6543
6544 if (config_OnFire_subclass_count > 0)
6545 {
6546 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6547
6548 for (int i = 0; i < config_OnFire_subclass_count; i++)
6549 {
6550 string particle_class = "";
6551 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6552 string config_OnFire_entry = config_OnFire_class + particle_class;
6553 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6554 WPOF_array.Insert(WPOF);
6555 }
6556
6557
6559 }
6560 }
6561
6563 {
6564 config_to_search = "CfgWeapons";
6565 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6566
6567 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6568
6569 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6570
6571 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6572 {
6573 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6574
6575 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6576 {
6577 string particle_class2 = "";
6578 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6579 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6580 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6581 WPOBE_array.Insert(WPOBE);
6582 }
6583
6584
6586 }
6587 }
6588 }
6589
6590
6592 {
6595
6597 {
6598 string config_to_search = "CfgVehicles";
6599
6600 if (IsInherited(Weapon))
6601 config_to_search = "CfgWeapons";
6602
6603 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6604 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6605
6606 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6607 {
6608
6610
6612 {
6614 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6616 return;
6617 }
6618
6621
6622
6623
6624 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6625 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6626
6627 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6628 {
6629 string particle_class = "";
6630 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6631 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6632 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6633
6634 if (entry_type == CT_CLASS)
6635 {
6636 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6637 WPOOH_array.Insert(WPOF);
6638 }
6639 }
6640
6641
6643 }
6644 }
6645 }
6646
6648 {
6650 }
6651
6653 {
6655 {
6657
6660
6663
6664 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6665 }
6666 }
6667
6669 {
6671 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6672
6674 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6675
6677 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6678
6680 {
6682 }
6683 }
6684
6686 {
6688 }
6689
6691 {
6694 else
6696
6698 {
6701 }
6702 else
6703 {
6706
6709 }
6710
6712 }
6713
6715 {
6717 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6718 }
6719
6721 {
6723 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6725 }
6726
6728 {
6730 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6731 }
6732
6734 {
6737
6738 OverheatingParticle OP = new OverheatingParticle();
6743
6745 }
6746
6748 {
6751
6752 return -1;
6753 }
6754
6756 {
6758 {
6761
6762 for (int i = count; i > 0; --i)
6763 {
6764 int id = i - 1;
6767
6770
6771 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6772 {
6773 if (p)
6774 {
6777 }
6778 }
6779 }
6780 }
6781 }
6782
6784 {
6786 {
6788 {
6789 int id = i - 1;
6791
6792 if (OP)
6793 {
6795
6796 if (p)
6797 {
6799 }
6800
6801 delete OP;
6802 }
6803 }
6804
6807 }
6808 }
6809
6812 {
6813 return 0.0;
6814 }
6815
6816
6818 {
6819 return 250;
6820 }
6821
6823 {
6824 return 0;
6825 }
6826
6829 {
6831 return true;
6832
6833 return false;
6834 }
6835
6838 {
6841
6843 {
6845 }
6846 else
6847 {
6848
6850 }
6851
6853 }
6854
6861 {
6862 return -1;
6863 }
6864
6865
6866
6867
6869 {
6871 {
6872 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6873 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6874
6875 if (r_index >= 0)
6876 {
6877 InventoryLocation r_il = new InventoryLocation;
6878 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6879
6880 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6883 {
6884 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6885 }
6887 {
6888 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6889 }
6890
6891 }
6892
6893 player.GetHumanInventory().ClearUserReservedLocation(this);
6894 }
6895
6898 }
6899
6900
6901
6902
6904 {
6905 return ItemBase.m_DebugActionsMask;
6906 }
6907
6909 {
6910 return ItemBase.m_DebugActionsMask & mask;
6911 }
6912
6914 {
6915 ItemBase.m_DebugActionsMask = mask;
6916 }
6917
6919 {
6920 ItemBase.m_DebugActionsMask |= mask;
6921 }
6922
6924 {
6925 ItemBase.m_DebugActionsMask &= ~mask;
6926 }
6927
6929 {
6931 {
6933 }
6934 else
6935 {
6937 }
6938 }
6939
6940
6942 {
6943 if (GetEconomyProfile())
6944 {
6945 float q_max = GetEconomyProfile().GetQuantityMax();
6946 if (q_max > 0)
6947 {
6948 float q_min = GetEconomyProfile().GetQuantityMin();
6949 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6950
6952 {
6953 ComponentEnergyManager comp = GetCompEM();
6955 {
6957 }
6958 }
6960 {
6962
6963 }
6964
6965 }
6966 }
6967 }
6968
6971 {
6972 EntityAI parent = GetHierarchyParent();
6973
6974 if (parent)
6975 {
6976 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6977 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6978 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6979 }
6980 }
6981
6984 {
6985 EntityAI parent = GetHierarchyParent();
6986
6987 if (parent)
6988 {
6989 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6990 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6991 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6992 }
6993 }
6994
6996 {
6997
6998
6999
7000
7002
7004 {
7005 if (ScriptInputUserData.CanStoreInputUserData())
7006 {
7007 ScriptInputUserData ctx = new ScriptInputUserData;
7013 ctx.
Write(use_stack_max);
7016
7018 {
7019 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7020 }
7021 }
7022 }
7023 else if (!
g_Game.IsMultiplayer())
7024 {
7026 }
7027 }
7028
7030 {
7032 }
7033
7035 {
7037 }
7038
7040 {
7042 }
7043
7045 {
7046
7047 return false;
7048 }
7049
7051 {
7052 return false;
7053 }
7054
7058 {
7059 return false;
7060 }
7061
7063 {
7064 return "";
7065 }
7066
7068
7070 {
7071 return false;
7072 }
7073
7075 {
7076 return true;
7077 }
7078
7079
7080
7082 {
7083 return true;
7084 }
7085
7087 {
7088 return true;
7089 }
7090
7092 {
7093 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7095 }
7096
7098 {
7100 }
7101
7103 {
7105 if (!is_being_placed)
7107 SetSynchDirty();
7108 }
7109
7110
7112
7114 {
7116 }
7117
7119 {
7121 }
7122
7124 {
7125 return 1;
7126 }
7127
7129 {
7130 return false;
7131 }
7132
7134 {
7136 SetSynchDirty();
7137 }
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7174 {
7175 super.OnMovedInsideCargo(container);
7176
7177 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7178 }
7179
7180 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7181 {
7182 super.EEItemLocationChanged(oldLoc, newLoc);
7183
7184 PlayerBase newPlayer = null;
7185 PlayerBase oldPlayer = null;
7186
7187 if (newLoc.GetParent())
7188 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7189
7190 if (oldLoc.GetParent())
7191 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7192
7194 {
7195 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7196
7197 if (rIndex >= 0)
7198 {
7199 InventoryLocation rIl = new InventoryLocation;
7200 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7201
7202 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7205 {
7206 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7207 }
7209 {
7211 }
7212
7213 }
7214 }
7215
7217 {
7218 if (newPlayer)
7219 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7220
7221 if (newPlayer == oldPlayer)
7222 {
7223 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7224 {
7226 {
7227 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7228 {
7229 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7230 }
7231 }
7232 else
7233 {
7234 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7235 }
7236 }
7237
7238 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7239 {
7240 int type = oldLoc.GetType();
7242 {
7243 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7244 }
7246 {
7247 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7248 }
7249 }
7250 if (!m_OldLocation)
7251 {
7252 m_OldLocation = new InventoryLocation;
7253 }
7254 m_OldLocation.Copy(oldLoc);
7255 }
7256 else
7257 {
7258 if (m_OldLocation)
7259 {
7260 m_OldLocation.Reset();
7261 }
7262 }
7263
7264 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7265 }
7266 else
7267 {
7268 if (newPlayer)
7269 {
7270 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7271 if (resIndex >= 0)
7272 {
7273 InventoryLocation il = new InventoryLocation;
7274 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7276 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7279 {
7280 il.
GetParent().GetOnReleaseLock().Invoke(it);
7281 }
7283 {
7285 }
7286
7287 }
7288 }
7290 {
7291
7293 }
7294
7295 if (m_OldLocation)
7296 {
7297 m_OldLocation.Reset();
7298 }
7299 }
7300
7302 {
7303 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7304 }
7305
7307 {
7308 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7309 }
7310 }
7311
7312 override void EOnContact(IEntity other, Contact extra)
7313 {
7315 {
7316 int liquidType = -1;
7318 if (impactSpeed > 0.0)
7319 {
7321 #ifndef SERVER
7323 #else
7325 SetSynchDirty();
7326 #endif
7328 }
7329 }
7330
7331 #ifdef SERVER
7332 if (GetCompEM() && GetCompEM().IsPlugged())
7333 {
7334 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7335 GetCompEM().UnplugThis();
7336 }
7337 #endif
7338 }
7339
7341
7343 {
7345 }
7346
7348 {
7349
7350 }
7351
7353 {
7354 super.OnItemLocationChanged(old_owner, new_owner);
7355
7356 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7357 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7358
7359 if (!relatedPlayer && playerNew)
7360 relatedPlayer = playerNew;
7361
7362 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7363 {
7365 if (actionMgr)
7366 {
7367 ActionBase currentAction = actionMgr.GetRunningAction();
7368 if (currentAction)
7370 }
7371 }
7372
7373 Man ownerPlayerOld = null;
7374 Man ownerPlayerNew = null;
7375
7376 if (old_owner)
7377 {
7378 if (old_owner.
IsMan())
7379 {
7380 ownerPlayerOld = Man.Cast(old_owner);
7381 }
7382 else
7383 {
7384 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7385 }
7386 }
7387 else
7388 {
7390 {
7392
7393 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7394 {
7395 GetCompEM().UnplugThis();
7396 }
7397 }
7398 }
7399
7400 if (new_owner)
7401 {
7402 if (new_owner.
IsMan())
7403 {
7404 ownerPlayerNew = Man.Cast(new_owner);
7405 }
7406 else
7407 {
7408 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7409 }
7410 }
7411
7412 if (ownerPlayerOld != ownerPlayerNew)
7413 {
7414 if (ownerPlayerOld)
7415 {
7416 array<EntityAI> subItemsExit = new array<EntityAI>;
7418 for (int i = 0; i < subItemsExit.Count(); i++)
7419 {
7422 }
7423 }
7424
7425 if (ownerPlayerNew)
7426 {
7427 array<EntityAI> subItemsEnter = new array<EntityAI>;
7429 for (int j = 0; j < subItemsEnter.Count(); j++)
7430 {
7433 }
7434 }
7435 }
7436 else if (ownerPlayerNew != null)
7437 {
7438 PlayerBase nplayer;
7439 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7440 {
7441 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7443 for (int k = 0; k < subItemsUpdate.Count(); k++)
7444 {
7446 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7447 }
7448 }
7449 }
7450
7451 if (old_owner)
7452 old_owner.OnChildItemRemoved(this);
7453 if (new_owner)
7454 new_owner.OnChildItemReceived(this);
7455 }
7456
7457
7459 {
7460 super.EEDelete(parent);
7461 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7462 if (player)
7463 {
7465
7466 if (player.IsAlive())
7467 {
7468 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7469 if (r_index >= 0)
7470 {
7471 InventoryLocation r_il = new InventoryLocation;
7472 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7473
7474 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7477 {
7478 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7479 }
7481 {
7482 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7483 }
7484
7485 }
7486
7487 player.RemoveQuickBarEntityShortcut(this);
7488 }
7489 }
7490 }
7491
7493 {
7494 super.EEKilled(killer);
7495
7498 {
7499 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7500 {
7501 if (IsMagazine())
7502 {
7503 if (Magazine.Cast(this).GetAmmoCount() > 0)
7504 {
7506 }
7507 }
7508 else
7509 {
7511 }
7512 }
7513 }
7514 }
7515
7517 {
7518 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7519
7520 super.OnWasAttached(parent, slot_id);
7521
7524
7527 }
7528
7530 {
7531 super.OnWasDetached(parent, slot_id);
7532
7535
7538 }
7539
7541 {
7542 int idx;
7545
7546 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7547 if (inventory_slots.Count() < 1)
7548 {
7549 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7550 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7551 }
7552 else
7553 {
7554 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7555 }
7556
7557 idx = inventory_slots.Find(slot);
7558 if (idx < 0)
7559 return "";
7560
7561 return attach_types.Get(idx);
7562 }
7563
7565 {
7566 int idx = -1;
7567 string slot;
7568
7571
7572 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7573 if (inventory_slots.Count() < 1)
7574 {
7575 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7576 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7577 }
7578 else
7579 {
7580 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7581 if (detach_types.Count() < 1)
7582 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7583 }
7584
7585 for (int i = 0; i < inventory_slots.Count(); i++)
7586 {
7587 slot = inventory_slots.Get(i);
7588 }
7589
7590 if (slot != "")
7591 {
7592 if (detach_types.Count() == 1)
7593 idx = 0;
7594 else
7595 idx = inventory_slots.Find(slot);
7596 }
7597 if (idx < 0)
7598 return "";
7599
7600 return detach_types.Get(idx);
7601 }
7602
7604 {
7605
7607
7608
7609 float min_time = 1;
7610 float max_time = 3;
7611 float delay = Math.RandomFloat(min_time, max_time);
7612
7613 explode_timer.Run(delay, this, "DoAmmoExplosion");
7614 }
7615
7617 {
7618 Magazine magazine = Magazine.Cast(this);
7619 int pop_sounds_count = 6;
7620 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7621
7622
7623 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7624 string sound_name = pop_sounds[ sound_idx ];
7625 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7626
7627
7628 magazine.ServerAddAmmoCount(-1);
7629
7630
7631 float min_temp_to_explode = 100;
7632
7633 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7634 {
7636 }
7637 }
7638
7639
7640 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7641 {
7642 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7643
7644 const int CHANCE_DAMAGE_CARGO = 4;
7645 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7646 const int CHANCE_DAMAGE_NOTHING = 2;
7647
7649 {
7650 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7651 int chances;
7652 int rnd;
7653
7654 if (GetInventory().GetCargo())
7655 {
7656 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7657 rnd = Math.RandomInt(0,chances);
7658
7659 if (rnd < CHANCE_DAMAGE_CARGO)
7660 {
7662 }
7663 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7664 {
7666 }
7667 }
7668 else
7669 {
7670 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7671 rnd = Math.RandomInt(0,chances);
7672
7673 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7674 {
7676 }
7677 }
7678 }
7679 }
7680
7682 {
7683 CargoBase cargo = GetInventory().GetCargo();
7684 if (cargo)
7685 {
7687 if (item_count > 0)
7688 {
7689 int random_pick = Math.RandomInt(0, item_count);
7691 if (!item.IsExplosive())
7692 {
7693 item.AddHealth("","",damage);
7694 return true;
7695 }
7696 }
7697 }
7698 return false;
7699 }
7700
7702 {
7703 GameInventory inventory = GetInventory();
7705 if (attachment_count > 0)
7706 {
7707 int random_pick = Math.RandomInt(0, attachment_count);
7709 if (!attachment.IsExplosive())
7710 {
7711 attachment.AddHealth("","",damage);
7712 return true;
7713 }
7714 }
7715 return false;
7716 }
7717
7719 {
7721 }
7722
7724 {
7726 return GetInventory().CanRemoveEntity();
7727
7728 return false;
7729 }
7730
7732 {
7733
7735 return false;
7736
7737
7739 return false;
7740
7741
7742
7744 if (delta == 0)
7745 return false;
7746
7747
7748 return true;
7749 }
7750
7752 {
7754 {
7755 if (ScriptInputUserData.CanStoreInputUserData())
7756 {
7757 ScriptInputUserData ctx = new ScriptInputUserData;
7762 ctx.
Write(destination_entity);
7766 }
7767 }
7768 else if (!
g_Game.IsMultiplayer())
7769 {
7771 }
7772 }
7773
7775 {
7776 float split_quantity_new;
7780 InventoryLocation loc = new InventoryLocation;
7781
7782 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7783 {
7785 split_quantity_new = stack_max;
7786 else
7788
7790 {
7791 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7792 if (new_item)
7793 {
7794 new_item.SetResultOfSplit(true);
7795 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7797 new_item.
SetQuantity(split_quantity_new,
false,
true);
7798 }
7799 }
7800 }
7801 else if (destination_entity && slot_id == -1)
7802 {
7803 if (quantity > stack_max)
7804 split_quantity_new = stack_max;
7805 else
7806 split_quantity_new = quantity;
7807
7809 {
7810 GameInventory destinationInventory = destination_entity.GetInventory();
7812 {
7815 }
7816
7817 if (new_item)
7818 {
7819 new_item.SetResultOfSplit(true);
7820 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7822 new_item.
SetQuantity(split_quantity_new,
false,
true);
7823 }
7824 }
7825 }
7826 else
7827 {
7828 if (stack_max != 0)
7829 {
7831 {
7833 }
7834
7835 if (split_quantity_new == 0)
7836 {
7837 if (!
g_Game.IsMultiplayer())
7838 player.PhysicalPredictiveDropItem(this);
7839 else
7840 player.ServerDropEntity(this);
7841 return;
7842 }
7843
7845 {
7847
7848 if (new_item)
7849 {
7850 new_item.SetResultOfSplit(true);
7851 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7854 new_item.PlaceOnSurface();
7855 }
7856 }
7857 }
7858 }
7859 }
7860
7862 {
7863 float split_quantity_new;
7867 InventoryLocation loc = new InventoryLocation;
7868
7869 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7870 {
7872 split_quantity_new = stack_max;
7873 else
7875
7877 {
7878 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7879 if (new_item)
7880 {
7881 new_item.SetResultOfSplit(true);
7882 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7884 new_item.
SetQuantity(split_quantity_new,
false,
true);
7885 }
7886 }
7887 }
7888 else if (destination_entity && slot_id == -1)
7889 {
7890 if (quantity > stack_max)
7891 split_quantity_new = stack_max;
7892 else
7893 split_quantity_new = quantity;
7894
7896 {
7897 GameInventory destinationInventory = destination_entity.GetInventory();
7899 {
7902 }
7903
7904 if (new_item)
7905 {
7906 new_item.SetResultOfSplit(true);
7907 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7909 new_item.
SetQuantity(split_quantity_new,
false,
true);
7910 }
7911 }
7912 }
7913 else
7914 {
7915 if (stack_max != 0)
7916 {
7918 {
7920 }
7921
7923 {
7925
7926 if (new_item)
7927 {
7928 new_item.SetResultOfSplit(true);
7929 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7932 new_item.PlaceOnSurface();
7933 }
7934 }
7935 }
7936 }
7937 }
7938
7940 {
7942 {
7943 if (ScriptInputUserData.CanStoreInputUserData())
7944 {
7945 ScriptInputUserData ctx = new ScriptInputUserData;
7950 dst.WriteToContext(ctx);
7952 }
7953 }
7954 else if (!
g_Game.IsMultiplayer())
7955 {
7957 }
7958 }
7959
7961 {
7963 {
7964 if (ScriptInputUserData.CanStoreInputUserData())
7965 {
7966 ScriptInputUserData ctx = new ScriptInputUserData;
7971 ctx.
Write(destination_entity);
7977 }
7978 }
7979 else if (!
g_Game.IsMultiplayer())
7980 {
7982 }
7983 }
7984
7986 {
7988 }
7989
7991 {
7993 float split_quantity_new;
7995 if (dst.IsValid())
7996 {
7997 int slot_id = dst.GetSlot();
7999
8000 if (quantity > stack_max)
8001 split_quantity_new = stack_max;
8002 else
8003 split_quantity_new = quantity;
8004
8006 {
8008
8009 if (new_item)
8010 {
8011 new_item.SetResultOfSplit(true);
8012 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8014 new_item.
SetQuantity(split_quantity_new,
false,
true);
8015 }
8016
8017 return new_item;
8018 }
8019 }
8020
8021 return null;
8022 }
8023
8025 {
8027 float split_quantity_new;
8029 if (destination_entity)
8030 {
8032 if (quantity > stackable)
8033 split_quantity_new = stackable;
8034 else
8035 split_quantity_new = quantity;
8036
8038 {
8039 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8040 if (new_item)
8041 {
8042 new_item.SetResultOfSplit(true);
8043 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8045 new_item.
SetQuantity(split_quantity_new,
false,
true);
8046 }
8047 }
8048 }
8049 }
8050
8052 {
8054 {
8055 if (ScriptInputUserData.CanStoreInputUserData())
8056 {
8057 ScriptInputUserData ctx = new ScriptInputUserData;
8062 ItemBase destination_entity =
this;
8063 ctx.
Write(destination_entity);
8067 }
8068 }
8069 else if (!
g_Game.IsMultiplayer())
8070 {
8072 }
8073 }
8074
8076 {
8078 float split_quantity_new;
8080 if (player)
8081 {
8083 if (quantity > stackable)
8084 split_quantity_new = stackable;
8085 else
8086 split_quantity_new = quantity;
8087
8089 {
8090 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8091 new_item =
ItemBase.Cast(in_hands);
8092 if (new_item)
8093 {
8094 new_item.SetResultOfSplit(true);
8095 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8097 new_item.SetQuantity(split_quantity_new, false, true);
8098 }
8099 }
8100 }
8101 }
8102
8104 {
8106 float split_quantity_new = Math.Floor(quantity * 0.5);
8107
8109 return;
8110
8112
8113 if (new_item)
8114 {
8115 if (new_item.GetQuantityMax() < split_quantity_new)
8116 {
8117 split_quantity_new = new_item.GetQuantityMax();
8118 }
8119
8120 new_item.SetResultOfSplit(true);
8121 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8122
8124 {
8127 }
8128 else
8129 {
8131 new_item.
SetQuantity(split_quantity_new,
false,
true);
8132 }
8133 }
8134 }
8135
8137 {
8139 float split_quantity_new = Math.Floor(quantity / 2);
8140
8142 return;
8143
8144 InventoryLocation invloc = new InventoryLocation;
8146
8148 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8149
8150 if (new_item)
8151 {
8152 if (new_item.GetQuantityMax() < split_quantity_new)
8153 {
8154 split_quantity_new = new_item.GetQuantityMax();
8155 }
8157 {
8160 }
8161 else if (split_quantity_new > 1)
8162 {
8164 new_item.
SetQuantity(split_quantity_new,
false,
true);
8165 }
8166 }
8167 }
8168
8171 {
8172 SetWeightDirty();
8174
8175 if (parent)
8176 parent.OnAttachmentQuantityChangedEx(this, delta);
8177
8179 {
8181 {
8183 }
8185 {
8186 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8188 }
8189 }
8190 }
8191
8194 {
8195
8196 }
8197
8200 {
8202 }
8203
8205 {
8206 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8207
8209 {
8210 if (newLevel == GameConstants.STATE_RUINED)
8211 {
8213 EntityAI parent = GetHierarchyParent();
8214 if (parent && parent.IsFireplace())
8215 {
8216 CargoBase cargo = GetInventory().GetCargo();
8217 if (cargo)
8218 {
8220 {
8222 }
8223 }
8224 }
8225 }
8226
8228 {
8229
8231 return;
8232 }
8233
8234 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8235 {
8237 }
8238 }
8239 }
8240
8241
8243 {
8244 super.OnRightClick();
8245
8247 {
8249 {
8250 if (ScriptInputUserData.CanStoreInputUserData())
8251 {
8252 EntityAI root = GetHierarchyRoot();
8253 Man playerOwner = GetHierarchyRootPlayer();
8254 InventoryLocation dst = new InventoryLocation;
8255
8256
8257 if (!playerOwner && root && root == this)
8258 {
8260 }
8261 else
8262 {
8263
8264 GetInventory().GetCurrentInventoryLocation(dst);
8266 {
8267 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8269 {
8271 }
8272 else
8273 {
8275
8276
8277 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8278 {
8280 }
8281 else
8282 {
8283 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8284 }
8285 }
8286 }
8287 }
8288
8289 ScriptInputUserData ctx = new ScriptInputUserData;
8297 }
8298 }
8299 else if (!
g_Game.IsMultiplayer())
8300 {
8302 }
8303 }
8304 }
8305
8307 {
8308 if (root)
8309 {
8310 vector m4[4];
8311 root.GetTransform(m4);
8312 dst.SetGround(this, m4);
8313 }
8314 else
8315 {
8316 GetInventory().GetCurrentInventoryLocation(dst);
8317 }
8318 }
8319
8320 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8321 {
8322
8323 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8324 return false;
8325
8326 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8327 return false;
8328
8329
8331 return false;
8332
8333
8334 Magazine mag = Magazine.Cast(this);
8335 if (mag)
8336 {
8337 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8338 return false;
8339
8340 if (stack_max_limit)
8341 {
8342 Magazine other_mag = Magazine.Cast(other_item);
8343 if (other_item)
8344 {
8345 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8346 return false;
8347 }
8348
8349 }
8350 }
8351 else
8352 {
8353
8355 return false;
8356
8358 return false;
8359 }
8360
8361 PlayerBase player = null;
8362 if (CastTo(player, GetHierarchyRootPlayer()))
8363 {
8364 if (player.GetInventory().HasAttachment(this))
8365 return false;
8366
8367 if (player.IsItemsToDelete())
8368 return false;
8369 }
8370
8371 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8372 return false;
8373
8374 int slotID;
8376 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8377 return false;
8378
8379 return true;
8380 }
8381
8383 {
8385 }
8386
8388 {
8389 return m_IsResultOfSplit;
8390 }
8391
8393 {
8394 m_IsResultOfSplit = value;
8395 }
8396
8398 {
8400 }
8401
8403 {
8404 float other_item_quantity = other_item.GetQuantity();
8405 float this_free_space;
8406
8408
8410
8411 if (other_item_quantity > this_free_space)
8412 {
8413 return this_free_space;
8414 }
8415 else
8416 {
8417 return other_item_quantity;
8418 }
8419 }
8420
8422 {
8424 }
8425
8427 {
8429 return;
8430
8431 if (!IsMagazine() && other_item)
8432 {
8434 if (quantity_used != 0)
8435 {
8436 float hp1 = GetHealth01("","");
8437 float hp2 = other_item.GetHealth01("","");
8438 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8439 hpResult = hpResult / (
GetQuantity() + quantity_used);
8440
8441 hpResult *= GetMaxHealth();
8442 Math.Round(hpResult);
8443 SetHealth("", "Health", hpResult);
8444
8446 other_item.AddQuantity(-quantity_used);
8447 }
8448 }
8450 }
8451
8453 {
8454 #ifdef SERVER
8455 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8456 GetHierarchyParent().IncreaseLifetimeUp();
8457 #endif
8458 };
8459
8461 {
8462 PlayerBase p = PlayerBase.Cast(player);
8463
8464 array<int> recipesIds = p.m_Recipes;
8465 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8466 if (moduleRecipesManager)
8467 {
8468 EntityAI itemInHands = player.GetEntityInHands();
8469 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8470 }
8471
8472 for (int i = 0;i < recipesIds.Count(); i++)
8473 {
8474 int key = recipesIds.Get(i);
8475 string recipeName = moduleRecipesManager.GetRecipeName(key);
8477 }
8478 }
8479
8480
8481 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8482 {
8483 super.GetDebugActions(outputList);
8484
8485
8491
8492
8497
8502
8503
8507
8508
8510 {
8514 }
8515
8518
8519
8523
8525
8526 InventoryLocation loc = new InventoryLocation();
8527 GetInventory().GetCurrentInventoryLocation(loc);
8529 {
8530 if (Gizmo_IsSupported())
8533 }
8534
8536 }
8537
8538
8539
8540
8542 {
8543 super.OnAction(action_id, player, ctx);
8544
8546 {
8547 switch (action_id)
8548 {
8552 return true;
8556 return true;
8557 }
8558 }
8559
8561 {
8562 switch (action_id)
8563 {
8565 Delete();
8566 return true;
8567 }
8568 }
8569
8570 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8571 {
8572 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8573 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8574 PlayerBase p = PlayerBase.Cast(player);
8575 if (
EActions.RECIPES_RANGE_START < 1000)
8576 {
8577 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8578 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8579 }
8580 }
8581 #ifndef SERVER
8582 else if (action_id ==
EActions.WATCH_PLAYER)
8583 {
8584 PluginDeveloper.SetDeveloperItemClientEx(player);
8585 }
8586 #endif
8588 {
8589 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8590 {
8591 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8592 OnDebugButtonPressServer(id + 1);
8593 }
8594
8595 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8596 {
8597 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8599 }
8600
8601 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8602 {
8603 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8605 }
8606
8607 else if (action_id ==
EActions.ADD_QUANTITY)
8608 {
8609 if (IsMagazine())
8610 {
8611 Magazine mag = Magazine.Cast(this);
8612 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8613 }
8614 else
8615 {
8617 }
8618
8619 if (m_EM)
8620 {
8621 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8622 }
8623
8624 }
8625
8626 else if (action_id ==
EActions.REMOVE_QUANTITY)
8627 {
8628 if (IsMagazine())
8629 {
8630 Magazine mag2 = Magazine.Cast(this);
8631 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8632 }
8633 else
8634 {
8636 }
8637 if (m_EM)
8638 {
8639 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8640 }
8641
8642 }
8643
8644 else if (action_id ==
EActions.SET_QUANTITY_0)
8645 {
8647
8648 if (m_EM)
8649 {
8650 m_EM.SetEnergy(0);
8651 }
8652 }
8653
8654 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8655 {
8657
8658 if (m_EM)
8659 {
8660 m_EM.SetEnergy(m_EM.GetEnergyMax());
8661 }
8662 }
8663
8664 else if (action_id ==
EActions.ADD_HEALTH)
8665 {
8666 AddHealth("","",GetMaxHealth("","Health")/5);
8667 }
8668 else if (action_id ==
EActions.REMOVE_HEALTH)
8669 {
8670 AddHealth("","",-GetMaxHealth("","Health")/5);
8671 }
8672 else if (action_id ==
EActions.DESTROY_HEALTH)
8673 {
8674 SetHealth01("","",0);
8675 }
8676 else if (action_id ==
EActions.WATCH_ITEM)
8677 {
8679 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8680 #ifdef DEVELOPER
8681 SetDebugDeveloper_item(this);
8682 #endif
8683 }
8684
8685 else if (action_id ==
EActions.ADD_TEMPERATURE)
8686 {
8687 AddTemperature(20);
8688
8689 }
8690
8691 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8692 {
8693 AddTemperature(-20);
8694
8695 }
8696
8697 else if (action_id ==
EActions.FLIP_FROZEN)
8698 {
8699 SetFrozen(!GetIsFrozen());
8700
8701 }
8702
8703 else if (action_id ==
EActions.ADD_WETNESS)
8704 {
8706
8707 }
8708
8709 else if (action_id ==
EActions.REMOVE_WETNESS)
8710 {
8712
8713 }
8714
8715 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8716 {
8719
8720
8721 }
8722
8723 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8724 {
8727 }
8728
8729 else if (action_id ==
EActions.MAKE_SPECIAL)
8730 {
8731 auto debugParams = DebugSpawnParams.WithPlayer(player);
8732 OnDebugSpawnEx(debugParams);
8733 }
8734
8735 }
8736
8737
8738 return false;
8739 }
8740
8741
8742
8743
8747
8750
8751
8752
8754 {
8755 return false;
8756 }
8757
8758
8760 {
8761 return true;
8762 }
8763
8764
8766 {
8767 return true;
8768 }
8769
8770
8771
8773 {
8774 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8775 return g_Game.ConfigIsExisting(config_path);
8776 }
8777
8780 {
8781 return null;
8782 }
8783
8785 {
8786 return false;
8787 }
8788
8790 {
8791 return false;
8792 }
8793
8797
8798
8800 {
8801 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8802 return module_repairing.CanRepair(this, item_repair_kit);
8803 }
8804
8805
8806 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8807 {
8808 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8809 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8810 }
8811
8812
8814 {
8815
8816
8817
8818
8819
8820
8821
8822
8823 return 1;
8824 }
8825
8826
8827
8829 {
8831 }
8832
8833
8834
8836 {
8838 }
8839
8840
8849 {
8850 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8851
8852 if (player)
8853 {
8854 player.MessageStatus(text);
8855 }
8856 }
8857
8858
8867 {
8868 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8869
8870 if (player)
8871 {
8872 player.MessageAction(text);
8873 }
8874 }
8875
8876
8885 {
8886 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8887
8888 if (player)
8889 {
8890 player.MessageFriendly(text);
8891 }
8892 }
8893
8894
8903 {
8904 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8905
8906 if (player)
8907 {
8908 player.MessageImportant(text);
8909 }
8910 }
8911
8913 {
8914 return true;
8915 }
8916
8917
8918 override bool KindOf(
string tag)
8919 {
8920 bool found = false;
8921 string item_name = this.
GetType();
8923 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8924
8925 int array_size = item_tag_array.Count();
8926 for (int i = 0; i < array_size; i++)
8927 {
8928 if (item_tag_array.Get(i) == tag)
8929 {
8930 found = true;
8931 break;
8932 }
8933 }
8934 return found;
8935 }
8936
8937
8939 {
8940
8941 super.OnRPC(sender, rpc_type,ctx);
8942
8943
8944 switch (rpc_type)
8945 {
8946 #ifndef SERVER
8947 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8948 Param2<bool, string> p = new Param2<bool, string>(false, "");
8949
8951 return;
8952
8953 bool play = p.param1;
8954 string soundSet = p.param2;
8955
8956 if (play)
8957 {
8959 {
8961 {
8963 }
8964 }
8965 else
8966 {
8968 }
8969 }
8970 else
8971 {
8973 }
8974
8975 break;
8976 #endif
8977
8978 }
8979
8981 {
8983 }
8984 }
8985
8986
8987
8988
8990 {
8991 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8992 return plugin.GetID(
name);
8993 }
8994
8996 {
8997 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8998 return plugin.GetName(id);
8999 }
9000
9003 {
9004
9005
9006 int varFlags;
9007 if (!ctx.
Read(varFlags))
9008 return;
9009
9010 if (varFlags & ItemVariableFlags.FLOAT)
9011 {
9013 }
9014 }
9015
9017 {
9018
9019 super.SerializeNumericalVars(floats_out);
9020
9021
9022
9024 {
9026 }
9027
9029 {
9031 }
9032
9034 {
9036 }
9037
9039 {
9044 }
9045
9047 {
9049 }
9050 }
9051
9053 {
9054
9055 super.DeSerializeNumericalVars(floats);
9056
9057
9058 int index = 0;
9059 int mask = Math.Round(floats.Get(index));
9060
9061 index++;
9062
9064 {
9066 {
9068 }
9069 else
9070 {
9071 float quantity = floats.Get(index);
9073 }
9074 index++;
9075 }
9076
9078 {
9079 float wet = floats.Get(index);
9081 index++;
9082 }
9083
9085 {
9086 int liquidtype = Math.Round(floats.Get(index));
9088 index++;
9089 }
9090
9092 {
9094 index++;
9096 index++;
9098 index++;
9100 index++;
9101 }
9102
9104 {
9105 int cleanness = Math.Round(floats.Get(index));
9107 index++;
9108 }
9109 }
9110
9112 {
9113 super.WriteVarsToCTX(ctx);
9114
9115
9117 {
9119 }
9120
9122 {
9124 }
9125
9127 {
9129 }
9130
9132 {
9133 int r,g,b,a;
9139 }
9140
9142 {
9144 }
9145 }
9146
9148 {
9149 if (!super.ReadVarsFromCTX(ctx,version))
9150 return false;
9151
9152 int intValue;
9153 float value;
9154
9155 if (version < 140)
9156 {
9157 if (!ctx.
Read(intValue))
9158 return false;
9159
9160 m_VariablesMask = intValue;
9161 }
9162
9164 {
9165 if (!ctx.
Read(value))
9166 return false;
9167
9169 {
9171 }
9172 else
9173 {
9175 }
9176 }
9177
9178 if (version < 140)
9179 {
9181 {
9182 if (!ctx.
Read(value))
9183 return false;
9184 SetTemperatureDirect(value);
9185 }
9186 }
9187
9189 {
9190 if (!ctx.
Read(value))
9191 return false;
9193 }
9194
9196 {
9197 if (!ctx.
Read(intValue))
9198 return false;
9200 }
9201
9203 {
9204 int r,g,b,a;
9206 return false;
9208 return false;
9210 return false;
9212 return false;
9213
9215 }
9216
9218 {
9219 if (!ctx.
Read(intValue))
9220 return false;
9222 }
9223
9224 if (version >= 138 && version < 140)
9225 {
9227 {
9228 if (!ctx.
Read(intValue))
9229 return false;
9230 SetFrozen(intValue);
9231 }
9232 }
9233
9234 return true;
9235 }
9236
9237
9239 {
9242 {
9244 }
9245
9246 if (!super.OnStoreLoad(ctx, version))
9247 {
9249 return false;
9250 }
9251
9252 if (version >= 114)
9253 {
9254 bool hasQuickBarIndexSaved;
9255
9256 if (!ctx.
Read(hasQuickBarIndexSaved))
9257 {
9259 return false;
9260 }
9261
9262 if (hasQuickBarIndexSaved)
9263 {
9264 int itmQBIndex;
9265
9266
9267 if (!ctx.
Read(itmQBIndex))
9268 {
9270 return false;
9271 }
9272
9273 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9274 if (itmQBIndex != -1 && parentPlayer)
9275 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9276 }
9277 }
9278 else
9279 {
9280
9281 PlayerBase player;
9282 int itemQBIndex;
9283 if (version ==
int.
MAX)
9284 {
9285 if (!ctx.
Read(itemQBIndex))
9286 {
9288 return false;
9289 }
9290 }
9291 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9292 {
9293
9294 if (!ctx.
Read(itemQBIndex))
9295 {
9297 return false;
9298 }
9299 if (itemQBIndex != -1 && player)
9300 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9301 }
9302 }
9303
9304 if (version < 140)
9305 {
9306
9307 if (!LoadVariables(ctx, version))
9308 {
9310 return false;
9311 }
9312 }
9313
9314
9316 {
9318 return false;
9319 }
9320 if (version >= 132)
9321 {
9323 if (raib)
9324 {
9326 {
9328 return false;
9329 }
9330 }
9331 }
9332
9334 return true;
9335 }
9336
9337
9338
9340 {
9341 super.OnStoreSave(ctx);
9342
9343 PlayerBase player;
9344 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9345 {
9347
9348 int itemQBIndex = -1;
9349 itemQBIndex = player.FindQuickBarEntityIndex(this);
9350 ctx.
Write(itemQBIndex);
9351 }
9352 else
9353 {
9355 }
9356
9358
9360 if (raib)
9361 {
9363 }
9364 }
9365
9366
9368 {
9369 super.AfterStoreLoad();
9370
9372 {
9374 }
9375
9377 {
9380 }
9381 }
9382
9384 {
9385 super.EEOnAfterLoad();
9386
9388 {
9390 }
9391
9394 }
9395
9397 {
9398 return false;
9399 }
9400
9401
9402
9404 {
9406 {
9407 #ifdef PLATFORM_CONSOLE
9408
9410 {
9412 if (menu)
9413 {
9415 }
9416 }
9417 #endif
9418 }
9419
9421 {
9424 }
9425
9427 {
9428 SetWeightDirty();
9430 }
9432 {
9435 }
9436
9438 {
9441
9444 }
9446 {
9450 }
9451
9452 super.OnVariablesSynchronized();
9453 }
9454
9455
9456
9458 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9459 {
9460 if (!IsServerCheck(allow_client))
9461 return false;
9462
9464 return false;
9465
9468
9469 if (value <= (min + 0.001))
9470 value = min;
9471
9472 if (value == min)
9473 {
9474 if (destroy_config)
9475 {
9476 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9477 if (dstr)
9478 {
9480 this.Delete();
9481 return true;
9482 }
9483 }
9484 else if (destroy_forced)
9485 {
9487 this.Delete();
9488 return true;
9489 }
9490
9492 }
9493
9496
9498 {
9499 EntityAI parent = GetHierarchyRoot();
9500 InventoryLocation iLoc = new InventoryLocation();
9501 GetInventory().GetCurrentInventoryLocation(iLoc);
9503 {
9504 int iLocSlot = iLoc.
GetSlot();
9506 {
9508 }
9510 {
9512 }
9513 }
9514 }
9515
9517 {
9519
9520 if (delta)
9522 }
9523
9525
9526 return false;
9527 }
9528
9529
9531 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9532 {
9534 }
9535
9537 {
9540 }
9541
9543 {
9546 }
9547
9549 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9550 {
9551 float value_clamped = Math.Clamp(value, 0, 1);
9553 SetQuantity(result, destroy_config, destroy_forced);
9554 }
9555
9556
9559 {
9561 }
9562
9564 {
9566 }
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9578 {
9579 int slot = -1;
9580 GameInventory inventory = GetInventory();
9581 if (inventory)
9582 {
9583 InventoryLocation il = new InventoryLocation;
9586 }
9587
9589 }
9590
9592 {
9593 float quantity_max = 0;
9594
9596 {
9597 if (attSlotID != -1)
9598 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9599
9600 if (quantity_max <= 0)
9602 }
9603
9604 if (quantity_max <= 0)
9606
9607 return quantity_max;
9608 }
9609
9611 {
9613 }
9614
9616 {
9618 }
9619
9620
9622 {
9624 }
9625
9627 {
9629 }
9630
9632 {
9634 }
9635
9636
9638 {
9639
9640 float weightEx = GetWeightEx();
9641 float special = GetInventoryAndCargoWeight();
9642 return weightEx - special;
9643 }
9644
9645
9647 {
9649 }
9650
9652 {
9654 {
9655 #ifdef DEVELOPER
9656 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9657 {
9658 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9660 }
9661 #endif
9662
9664 }
9665 else if (HasEnergyManager())
9666 {
9667 #ifdef DEVELOPER
9668 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9669 {
9670 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9671 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9672 }
9673 #endif
9674 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9675 }
9676 else
9677 {
9678 #ifdef DEVELOPER
9679 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9680 {
9681 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9682 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9683 }
9684 #endif
9685 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9686 }
9687 }
9688
9691 {
9692 int item_count = 0;
9694
9695 GameInventory inventory = GetInventory();
9696 CargoBase cargo = inventory.
GetCargo();
9697 if (cargo != NULL)
9698 {
9700 }
9701
9703 for (int i = 0; i < nAttachments; ++i)
9704 {
9706 if (item)
9707 item_count += item.GetNumberOfItems();
9708 }
9709 return item_count;
9710 }
9711
9714 {
9715 float weight = 0;
9716 float wetness = 1;
9717 if (include_wetness)
9720 {
9721 weight = wetness * m_ConfigWeight;
9722 }
9724 {
9725 weight = 1;
9726 }
9727 return weight;
9728 }
9729
9730
9731
9733 {
9734 GameInventory inventory = GetInventory();
9735 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9736 {
9737 array<EntityAI> items = new array<EntityAI>;
9739 for (int i = 0; i < items.Count(); ++i)
9740 {
9742 if (item)
9743 {
9744 g_Game.ObjectDelete(item);
9745 }
9746 }
9747 }
9748 }
9749
9750
9751
9752
9754 {
9755 float energy = 0;
9756 if (HasEnergyManager())
9757 {
9758 energy = GetCompEM().GetEnergy();
9759 }
9760 return energy;
9761 }
9762
9763
9765 {
9766 super.OnEnergyConsumed();
9767
9769 }
9770
9772 {
9773 super.OnEnergyAdded();
9774
9776 }
9777
9778
9780 {
9781 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9782 {
9784 {
9785 float energy_0to1 = GetCompEM().GetEnergy0To1();
9787 }
9788 }
9789 }
9790
9791
9793 {
9794 return ConfigGetFloat("heatIsolation");
9795 }
9796
9798 {
9800 }
9801
9803 {
9804 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9805 if (
g_Game.ConfigIsExisting(paramPath))
9806 return g_Game.ConfigGetFloat(paramPath);
9807
9808 return 0.0;
9809 }
9810
9812 {
9813 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9814 if (
g_Game.ConfigIsExisting(paramPath))
9815 return g_Game.ConfigGetFloat(paramPath);
9816
9817 return 0.0;
9818 }
9819
9820 override void SetWet(
float value,
bool allow_client =
false)
9821 {
9822 if (!IsServerCheck(allow_client))
9823 return;
9824
9827
9829
9830 m_VarWet = Math.Clamp(value, min, max);
9831
9833 {
9836 }
9837 }
9838
9839 override void AddWet(
float value)
9840 {
9842 }
9843
9845 {
9847 }
9848
9850 {
9852 }
9853
9855 {
9857 }
9858
9860 {
9862 }
9863
9865 {
9867 }
9868
9870 {
9873 if (newLevel != oldLevel)
9874 {
9876 }
9877 }
9878
9880 {
9881 SetWeightDirty();
9882 }
9883
9885 {
9886 return GetWetLevelInternal(
m_VarWet);
9887 }
9888
9889
9890
9892 {
9894 }
9895
9897 {
9899 }
9900
9902 {
9904 }
9905
9907 {
9909 }
9910
9911
9912
9914 {
9915 if (ConfigIsExisting("itemModelLength"))
9916 {
9917 return ConfigGetFloat("itemModelLength");
9918 }
9919 return 0;
9920 }
9921
9923 {
9924 if (ConfigIsExisting("itemAttachOffset"))
9925 {
9926 return ConfigGetFloat("itemAttachOffset");
9927 }
9928 return 0;
9929 }
9930
9931 override void SetCleanness(
int value,
bool allow_client =
false)
9932 {
9933 if (!IsServerCheck(allow_client))
9934 return;
9935
9937
9939
9942 }
9943
9945 {
9947 }
9948
9950 {
9951 return true;
9952 }
9953
9954
9955
9956
9958 {
9960 }
9961
9963 {
9965 }
9966
9967
9968
9969
9970 override void SetColor(
int r,
int g,
int b,
int a)
9971 {
9977 }
9979 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9980 {
9985 }
9986
9988 {
9990 }
9991
9994 {
9995 int r,g,b,a;
9997 r = r/255;
9998 g = g/255;
9999 b = b/255;
10000 a = a/255;
10001 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10002 }
10003
10004
10005
10006 override void SetLiquidType(
int value,
bool allow_client =
false)
10007 {
10008 if (!IsServerCheck(allow_client))
10009 return;
10010
10015 }
10016
10018 {
10019 return ConfigGetInt("varLiquidTypeInit");
10020 }
10021
10023 {
10025 }
10026
10028 {
10030 SetFrozen(false);
10031 }
10032
10035 {
10036 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10037 }
10038
10039
10042 {
10043 PlayerBase nplayer;
10044 if (PlayerBase.CastTo(nplayer, player))
10045 {
10047 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10048 }
10049 }
10050
10051
10054 {
10055 PlayerBase nplayer;
10056 if (PlayerBase.CastTo(nplayer,player))
10057 {
10058 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10059 }
10060
10061 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10062
10063 if (HasEnergyManager())
10064 {
10065 GetCompEM().UpdatePlugState();
10066 }
10067 }
10068
10069
10071 {
10072 super.OnPlacementStarted(player);
10073
10075 }
10076
10077 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10078 {
10080 {
10081 m_AdminLog.OnPlacementComplete(player,
this);
10082 }
10083
10084 super.OnPlacementComplete(player, position, orientation);
10085 }
10086
10087
10088
10089
10090
10092 {
10094 {
10095 return true;
10096 }
10097 else
10098 {
10099 return false;
10100 }
10101 }
10102
10103
10105 {
10107 {
10109 }
10110 }
10111
10112
10114 {
10116 }
10117
10119 {
10121 }
10122
10123 override void InsertAgent(
int agent,
float count = 1)
10124 {
10125 if (count < 1)
10126 return;
10127
10129 }
10130
10133 {
10135 }
10136
10137
10139 {
10141 }
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10185 {
10187 return false;
10188 return true;
10189 }
10190
10192 {
10193
10195 }
10196
10197
10200 {
10201 super.CheckForRoofLimited(timeTresholdMS);
10202
10203 float time =
g_Game.GetTime();
10204 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10205 {
10206 m_PreviousRoofTestTime = time;
10207 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10208 }
10209 }
10210
10211
10213 {
10215 {
10216 return 0;
10217 }
10218
10219 if (GetInventory().GetAttachmentSlotsCount() != 0)
10220 {
10221 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10222 if (filter)
10223 return filter.GetProtectionLevel(type, false, system);
10224 else
10225 return 0;
10226 }
10227
10228 string subclassPath, entryName;
10229
10230 switch (type)
10231 {
10233 entryName = "biological";
10234 break;
10236 entryName = "chemical";
10237 break;
10238 default:
10239 entryName = "biological";
10240 break;
10241 }
10242
10243 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10244
10245 return g_Game.ConfigGetFloat(subclassPath + entryName);
10246 }
10247
10248
10249
10252 {
10253 if (!IsMagazine())
10255
10257 }
10258
10259
10260
10261
10262
10267 {
10268 return true;
10269 }
10270
10272 {
10274 }
10275
10276
10277
10278
10279
10281 {
10282 if (parent)
10283 {
10284 if (parent.IsInherited(DayZInfected))
10285 return true;
10286
10287 if (!parent.IsRuined())
10288 return true;
10289 }
10290
10291 return true;
10292 }
10293
10295 {
10296 if (!super.CanPutAsAttachment(parent))
10297 {
10298 return false;
10299 }
10300
10301 if (!IsRuined() && !parent.IsRuined())
10302 {
10303 return true;
10304 }
10305
10306 return false;
10307 }
10308
10310 {
10311
10312
10313
10314
10315 return super.CanReceiveItemIntoCargo(item);
10316 }
10317
10319 {
10320
10321
10322
10323
10324 GameInventory attachmentInv = attachment.GetInventory();
10326 {
10327 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10328 return false;
10329 }
10330
10331 InventoryLocation loc = new InventoryLocation();
10332 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10333 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10334 return false;
10335
10336 return super.CanReceiveAttachment(attachment, slotId);
10337 }
10338
10340 {
10341 if (!super.CanReleaseAttachment(attachment))
10342 return false;
10343
10344 return GetInventory().AreChildrenAccessible();
10345 }
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10368 {
10369 int id = muzzle_owner.GetMuzzleID();
10370 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10371
10372 if (WPOF_array)
10373 {
10374 for (int i = 0; i < WPOF_array.Count(); i++)
10375 {
10376 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10377
10378 if (WPOF)
10379 {
10380 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10381 }
10382 }
10383 }
10384 }
10385
10386
10388 {
10389 int id = muzzle_owner.GetMuzzleID();
10391
10392 if (WPOBE_array)
10393 {
10394 for (int i = 0; i < WPOBE_array.Count(); i++)
10395 {
10396 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10397
10398 if (WPOBE)
10399 {
10400 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10401 }
10402 }
10403 }
10404 }
10405
10406
10408 {
10409 int id = muzzle_owner.GetMuzzleID();
10410 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10411
10412 if (WPOOH_array)
10413 {
10414 for (int i = 0; i < WPOOH_array.Count(); i++)
10415 {
10416 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10417
10418 if (WPOOH)
10419 {
10420 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10421 }
10422 }
10423 }
10424 }
10425
10426
10428 {
10429 int id = muzzle_owner.GetMuzzleID();
10430 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10431
10432 if (WPOOH_array)
10433 {
10434 for (int i = 0; i < WPOOH_array.Count(); i++)
10435 {
10436 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10437
10438 if (WPOOH)
10439 {
10440 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10441 }
10442 }
10443 }
10444 }
10445
10446
10448 {
10449 int id = muzzle_owner.GetMuzzleID();
10450 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10451
10452 if (WPOOH_array)
10453 {
10454 for (int i = 0; i < WPOOH_array.Count(); i++)
10455 {
10456 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10457
10458 if (WPOOH)
10459 {
10460 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10461 }
10462 }
10463 }
10464 }
10465
10466
10467
10469 {
10471 {
10472 return true;
10473 }
10474
10475 return false;
10476 }
10477
10479 {
10481 {
10482 return true;
10483 }
10484
10485 return false;
10486 }
10487
10489 {
10491 {
10492 return true;
10493 }
10494
10495 return false;
10496 }
10497
10499 {
10500 return false;
10501 }
10502
10505 {
10506 return UATimeSpent.DEFAULT_DEPLOY;
10507 }
10508
10509
10510
10511
10513 {
10515 SetSynchDirty();
10516 }
10517
10519 {
10521 }
10522
10523
10525 {
10526 return false;
10527 }
10528
10531 {
10532 string att_type = "None";
10533
10534 if (ConfigIsExisting("soundAttType"))
10535 {
10536 att_type = ConfigGetString("soundAttType");
10537 }
10538
10540 }
10541
10543 {
10545 }
10546
10547
10548
10549
10550
10556
10558 {
10561
10563 }
10564
10565
10567 {
10569 return;
10570
10572
10575
10578
10579 SoundParameters params = new SoundParameters();
10583 }
10584
10585
10587 {
10589 {
10592
10593 SetSynchDirty();
10594
10597 }
10598 }
10599
10601 {
10603 }
10604
10605
10607 {
10609 return;
10610
10612 SetSynchDirty();
10613
10616 }
10617
10619 {
10622 }
10623
10625 {
10627 }
10628
10629 void OnApply(PlayerBase player);
10630
10632 {
10633 return 1.0;
10634 };
10635
10637 {
10639 }
10640
10642 {
10644 }
10645
10647
10649 {
10650 SetDynamicPhysicsLifeTime(0.01);
10652 }
10653
10655 {
10656 array<string> zone_names = new array<string>;
10657 GetDamageZones(zone_names);
10658 for (int i = 0; i < zone_names.Count(); i++)
10659 {
10660 SetHealthMax(zone_names.Get(i),"Health");
10661 }
10662 SetHealthMax("","Health");
10663 }
10664
10667 {
10668 float global_health = GetHealth01("","Health");
10669 array<string> zones = new array<string>;
10670 GetDamageZones(zones);
10671
10672 for (int i = 0; i < zones.Count(); i++)
10673 {
10674 SetHealth01(zones.Get(i),"Health",global_health);
10675 }
10676 }
10677
10680 {
10681 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10682 }
10683
10685 {
10686 if (!hasRootAsPlayer)
10687 {
10688 if (refParentIB)
10689 {
10690
10691 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10692 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10693
10694 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10695 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10696
10699 }
10700 else
10701 {
10702
10705 }
10706 }
10707 }
10708
10710 {
10712 {
10713 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10714 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10715 {
10716 float heatPermCoef = 1.0;
10718 while (ent)
10719 {
10720 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10721 ent = ent.GetHierarchyParent();
10722 }
10723
10724 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10725 }
10726 }
10727 }
10728
10730 {
10731
10732 EntityAI parent = GetHierarchyParent();
10733 if (!parent)
10734 {
10735 hasParent = false;
10736 hasRootAsPlayer = false;
10737 }
10738 else
10739 {
10740 hasParent = true;
10741 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10742 refParentIB =
ItemBase.Cast(parent);
10743 }
10744 }
10745
10746 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10747 {
10748
10749 }
10750
10752 {
10753
10754 return false;
10755 }
10756
10758 {
10759
10760
10761 return false;
10762 }
10763
10765 {
10766
10767 return false;
10768 }
10769
10772 {
10773 return !GetIsFrozen() &&
IsOpen();
10774 }
10775
10777 {
10778 bool hasParent = false, hasRootAsPlayer = false;
10780
10781 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10782 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10783
10784 if (wwtu || foodDecay)
10785 {
10789
10790 if (processWetness || processTemperature || processDecay)
10791 {
10793
10794 if (processWetness)
10795 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10796
10797 if (processTemperature)
10799
10800 if (processDecay)
10801 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10802 }
10803 }
10804 }
10805
10808 {
10810 }
10811
10813 {
10816
10817 return super.GetTemperatureFreezeThreshold();
10818 }
10819
10821 {
10824
10825 return super.GetTemperatureThawThreshold();
10826 }
10827
10829 {
10832
10833 return super.GetItemOverheatThreshold();
10834 }
10835
10837 {
10839 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10840
10841 return super.GetTemperatureFreezeTime();
10842 }
10843
10845 {
10847 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10848
10849 return super.GetTemperatureThawTime();
10850 }
10851
10856
10858 {
10859 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10860 }
10861
10863 {
10864 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10865 }
10866
10869 {
10871 }
10872
10874 {
10876 }
10877
10879 {
10881 }
10882
10885 {
10886 return null;
10887 }
10888
10891 {
10892 return false;
10893 }
10894
10896 {
10898 {
10901 if (!trg)
10902 {
10904 explosive = this;
10905 }
10906
10907 explosive.PairRemote(trg);
10909
10910 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10911 trg.SetPersistentPairID(persistentID);
10912 explosive.SetPersistentPairID(persistentID);
10913
10914 return true;
10915 }
10916 return false;
10917 }
10918
10921 {
10922 float ret = 1.0;
10925 ret *= GetHealth01();
10926
10927 return ret;
10928 }
10929
10930 #ifdef DEVELOPER
10931 override void SetDebugItem()
10932 {
10933 super.SetDebugItem();
10934 _itemBase = this;
10935 }
10936
10938 {
10939 string text = super.GetDebugText();
10940
10942 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10943
10944 return text;
10945 }
10946 #endif
10947
10949 {
10950 return true;
10951 }
10952
10954
10956
10958 {
10961 }
10962
10963
10971
10987
10988 [
Obsolete(
"Use ItemSoundHandler instead")]
10991 {
10992 if (!
g_Game.IsDedicatedServer())
10993 {
10994 if (ConfigIsExisting("attachSoundSet"))
10995 {
10996 string cfg_path = "";
10997 string soundset = "";
10998 string type_name =
GetType();
10999
11002 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11003 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11004
11005 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11006 {
11007 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11008 {
11009 if (cfg_slot_array[i] == slot_type)
11010 {
11011 soundset = cfg_soundset_array[i];
11012 break;
11013 }
11014 }
11015 }
11016
11017 if (soundset != "")
11018 {
11019 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11021 }
11022 }
11023 }
11024 }
11025
11027}
11028
11030{
11032 if (entity)
11033 {
11034 bool is_item = entity.IsInherited(
ItemBase);
11035 if (is_item && full_quantity)
11036 {
11039 }
11040 }
11041 else
11042 {
11044 return NULL;
11045 }
11046 return entity;
11047}
11048
11050{
11051 if (item)
11052 {
11053 if (health > 0)
11054 item.SetHealth("", "", health);
11055
11056 if (item.CanHaveTemperature())
11057 {
11059 if (item.CanFreeze())
11060 item.SetFrozen(false);
11061 }
11062
11063 if (item.HasEnergyManager())
11064 {
11065 if (quantity >= 0)
11066 {
11067 item.GetCompEM().SetEnergy0To1(quantity);
11068 }
11069 else
11070 {
11072 }
11073 }
11074 else if (item.IsMagazine())
11075 {
11076 Magazine mag = Magazine.Cast(item);
11077 if (quantity >= 0)
11078 {
11079 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11080 }
11081 else
11082 {
11084 }
11085
11086 }
11087 else
11088 {
11089 if (quantity >= 0)
11090 {
11091 item.SetQuantityNormalized(quantity, false);
11092 }
11093 else
11094 {
11096 }
11097
11098 }
11099 }
11100}
11101
11102#ifdef DEVELOPER
11104#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.