6129{
6131 {
6132 return true;
6133 }
6134};
6135
6137{
6138
6139};
6140
6141
6142
6144{
6148
6150
6153
6154
6155
6156
6157
6166
6172
6177
6182
6203 protected bool m_IsResultOfSplit
6204
6206
6211
6212
6213
6215
6219
6220
6221
6223
6226
6227
6228
6234
6235
6243
6246
6247
6249
6250
6252
6253
6258
6259
6264
6266
6267
6269
6270
6272 {
6277
6278 if (!
g_Game.IsDedicatedServer())
6279 {
6281 {
6283
6285 {
6287 }
6288 }
6289
6292 }
6293
6294 m_OldLocation = null;
6295
6297 {
6299 }
6300
6301 if (ConfigIsExisting("headSelectionsToHide"))
6302 {
6305 }
6306
6308 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6309 {
6311 }
6312
6314
6315 m_IsResultOfSplit = false;
6316
6318 }
6319
6321 {
6322 super.InitItemVariables();
6323
6329 m_Count = ConfigGetInt(
"count");
6330
6333
6338
6341
6346
6358
6362
6363
6366 if (ConfigIsExisting("canBeSplit"))
6367 {
6370 }
6371
6373 if (ConfigIsExisting("itemBehaviour"))
6375
6376
6379 RegisterNetSyncVariableInt("m_VarLiquidType");
6380 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6381
6382 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6383 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6384 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6385
6386 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6387 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6388 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6389 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6390
6391 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6392 RegisterNetSyncVariableBool("m_IsTakeable");
6393 RegisterNetSyncVariableBool("m_IsHologram");
6394
6397 {
6400 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6401 }
6402
6404
6406 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6408
6410 }
6411
6413 {
6415 }
6416
6418 {
6421 {
6426 }
6427 }
6428
6429 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6430 {
6432 {
6435 }
6436
6438 }
6439
6441 {
6447 }
6448
6450
6452 {
6454
6455 if (!action)
6456 {
6457 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6458 return;
6459 }
6460
6462 if (!ai)
6463 {
6465 return;
6466 }
6467
6469 if (!action_array)
6470 {
6471 action_array = new array<ActionBase_Basic>;
6473 }
6474 if (LogManager.IsActionLogEnable())
6475 {
6476 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6477 }
6478
6479 if (action_array.Find(action) != -1)
6480 {
6481 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6482 }
6483 else
6484 {
6485 action_array.Insert(action);
6486 }
6487 }
6488
6490 {
6491 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6492 ActionBase action = player.GetActionManager().GetAction(actionName);
6495
6496 if (action_array)
6497 {
6498 action_array.RemoveItem(action);
6499 }
6500 }
6501
6502
6503
6505 {
6506 ActionOverrideData overrideData = new ActionOverrideData();
6510
6512 if (!actionMap)
6513 {
6516 }
6517
6518 actionMap.Insert(this.
Type(), overrideData);
6519
6520 }
6521
6523
6525
6526
6528 {
6531
6534
6535 string config_to_search = "CfgVehicles";
6536 string muzzle_owner_config;
6537
6539 {
6540 if (IsInherited(Weapon))
6541 config_to_search = "CfgWeapons";
6542
6543 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6544
6545 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6546
6547 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6548
6549 if (config_OnFire_subclass_count > 0)
6550 {
6551 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6552
6553 for (int i = 0; i < config_OnFire_subclass_count; i++)
6554 {
6555 string particle_class = "";
6556 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6557 string config_OnFire_entry = config_OnFire_class + particle_class;
6558 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6559 WPOF_array.Insert(WPOF);
6560 }
6561
6562
6564 }
6565 }
6566
6568 {
6569 config_to_search = "CfgWeapons";
6570 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6571
6572 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6573
6574 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6575
6576 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6577 {
6578 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6579
6580 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6581 {
6582 string particle_class2 = "";
6583 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6584 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6585 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6586 WPOBE_array.Insert(WPOBE);
6587 }
6588
6589
6591 }
6592 }
6593 }
6594
6595
6597 {
6600
6602 {
6603 string config_to_search = "CfgVehicles";
6604
6605 if (IsInherited(Weapon))
6606 config_to_search = "CfgWeapons";
6607
6608 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6609 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6610
6611 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6612 {
6613
6615
6617 {
6619 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6621 return;
6622 }
6623
6626
6627
6628
6629 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6630 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6631
6632 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6633 {
6634 string particle_class = "";
6635 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6636 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6637 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6638
6639 if (entry_type == CT_CLASS)
6640 {
6641 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6642 WPOOH_array.Insert(WPOF);
6643 }
6644 }
6645
6646
6648 }
6649 }
6650 }
6651
6653 {
6655 }
6656
6658 {
6660 {
6662
6665
6668
6669 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6670 }
6671 }
6672
6674 {
6676 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6677
6679 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6680
6682 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6683
6685 {
6687 }
6688 }
6689
6691 {
6693 }
6694
6696 {
6699 else
6701
6703 {
6706 }
6707 else
6708 {
6711
6714 }
6715
6717 }
6718
6720 {
6722 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6723 }
6724
6726 {
6728 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6730 }
6731
6733 {
6735 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6736 }
6737
6739 {
6742
6743 OverheatingParticle OP = new OverheatingParticle();
6748
6750 }
6751
6753 {
6756
6757 return -1;
6758 }
6759
6761 {
6763 {
6766
6767 for (int i = count; i > 0; --i)
6768 {
6769 int id = i - 1;
6772
6775
6776 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6777 {
6778 if (p)
6779 {
6782 }
6783 }
6784 }
6785 }
6786 }
6787
6789 {
6791 {
6793 {
6794 int id = i - 1;
6796
6797 if (OP)
6798 {
6800
6801 if (p)
6802 {
6804 }
6805
6806 delete OP;
6807 }
6808 }
6809
6812 }
6813 }
6814
6817 {
6818 return 0.0;
6819 }
6820
6821
6823 {
6824 return 250;
6825 }
6826
6828 {
6829 return 0;
6830 }
6831
6834 {
6836 return true;
6837
6838 return false;
6839 }
6840
6843 {
6846
6848 {
6850 }
6851 else
6852 {
6853
6855 }
6856
6858 }
6859
6866 {
6867 return -1;
6868 }
6869
6870
6871
6872
6874 {
6876 {
6877 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6878 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6879
6880 if (r_index >= 0)
6881 {
6882 InventoryLocation r_il = new InventoryLocation;
6883 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6884
6885 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6888 {
6889 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6890 }
6892 {
6893 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6894 }
6895
6896 }
6897
6898 player.GetHumanInventory().ClearUserReservedLocation(this);
6899 }
6900
6903 }
6904
6905
6906
6907
6909 {
6910 return ItemBase.m_DebugActionsMask;
6911 }
6912
6914 {
6915 return ItemBase.m_DebugActionsMask & mask;
6916 }
6917
6919 {
6920 ItemBase.m_DebugActionsMask = mask;
6921 }
6922
6924 {
6925 ItemBase.m_DebugActionsMask |= mask;
6926 }
6927
6929 {
6930 ItemBase.m_DebugActionsMask &= ~mask;
6931 }
6932
6934 {
6936 {
6938 }
6939 else
6940 {
6942 }
6943 }
6944
6945
6947 {
6948 if (GetEconomyProfile())
6949 {
6950 float q_max = GetEconomyProfile().GetQuantityMax();
6951 if (q_max > 0)
6952 {
6953 float q_min = GetEconomyProfile().GetQuantityMin();
6954 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6955
6957 {
6958 ComponentEnergyManager comp = GetCompEM();
6960 {
6962 }
6963 }
6965 {
6967
6968 }
6969
6970 }
6971 }
6972 }
6973
6976 {
6977 EntityAI parent = GetHierarchyParent();
6978
6979 if (parent)
6980 {
6981 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6982 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6983 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6984 }
6985 }
6986
6989 {
6990 EntityAI parent = GetHierarchyParent();
6991
6992 if (parent)
6993 {
6994 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6995 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6996 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6997 }
6998 }
6999
7001 {
7002
7003
7004
7005
7007
7009 {
7010 if (ScriptInputUserData.CanStoreInputUserData())
7011 {
7012 ScriptInputUserData ctx = new ScriptInputUserData;
7018 ctx.
Write(use_stack_max);
7021
7023 {
7024 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7025 }
7026 }
7027 }
7028 else if (!
g_Game.IsMultiplayer())
7029 {
7031 }
7032 }
7033
7035 {
7037 }
7038
7040 {
7042 }
7043
7045 {
7047 }
7048
7050 {
7051
7052 return false;
7053 }
7054
7056 {
7057 return false;
7058 }
7059
7063 {
7064 return false;
7065 }
7066
7068 {
7069 return "";
7070 }
7071
7073
7075 {
7076 return false;
7077 }
7078
7080 {
7081 return true;
7082 }
7083
7084
7085
7087 {
7088 return true;
7089 }
7090
7092 {
7093 return true;
7094 }
7095
7097 {
7098 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7100 }
7101
7103 {
7105 }
7106
7108 {
7110 if (!is_being_placed)
7112 SetSynchDirty();
7113 }
7114
7115
7117
7119 {
7121 }
7122
7124 {
7126 }
7127
7129 {
7130 return 1;
7131 }
7132
7134 {
7135 return false;
7136 }
7137
7139 {
7141 SetSynchDirty();
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
7173
7174
7175
7176
7177
7179 {
7180 super.OnMovedInsideCargo(container);
7181
7182 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7183 }
7184
7185 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7186 {
7187 super.EEItemLocationChanged(oldLoc, newLoc);
7188
7189 PlayerBase newPlayer = null;
7190 PlayerBase oldPlayer = null;
7191
7192 if (newLoc.GetParent())
7193 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7194
7195 if (oldLoc.GetParent())
7196 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7197
7199 {
7200 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7201
7202 if (rIndex >= 0)
7203 {
7204 InventoryLocation rIl = new InventoryLocation;
7205 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7206
7207 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7210 {
7211 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7212 }
7214 {
7216 }
7217
7218 }
7219 }
7220
7222 {
7223 if (newPlayer)
7224 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7225
7226 if (newPlayer == oldPlayer)
7227 {
7228 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7229 {
7231 {
7232 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7233 {
7234 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7235 }
7236 }
7237 else
7238 {
7239 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7240 }
7241 }
7242
7243 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7244 {
7245 int type = oldLoc.GetType();
7247 {
7248 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7249 }
7251 {
7252 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7253 }
7254 }
7255 if (!m_OldLocation)
7256 {
7257 m_OldLocation = new InventoryLocation;
7258 }
7259 m_OldLocation.Copy(oldLoc);
7260 }
7261 else
7262 {
7263 if (m_OldLocation)
7264 {
7265 m_OldLocation.Reset();
7266 }
7267 }
7268
7269 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7270 }
7271 else
7272 {
7273 if (newPlayer)
7274 {
7275 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7276 if (resIndex >= 0)
7277 {
7278 InventoryLocation il = new InventoryLocation;
7279 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7281 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7284 {
7285 il.
GetParent().GetOnReleaseLock().Invoke(it);
7286 }
7288 {
7290 }
7291
7292 }
7293 }
7295 {
7296
7298 }
7299
7300 if (m_OldLocation)
7301 {
7302 m_OldLocation.Reset();
7303 }
7304 }
7305
7307 {
7308 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7309 }
7310
7312 {
7313 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7314 }
7315 }
7316
7317 override void EOnContact(IEntity other, Contact extra)
7318 {
7320 {
7321 int liquidType = -1;
7323 if (impactSpeed > 0.0)
7324 {
7326 #ifndef SERVER
7328 #else
7330 SetSynchDirty();
7331 #endif
7333 }
7334 }
7335
7336 #ifdef SERVER
7337 if (GetCompEM() && GetCompEM().IsPlugged())
7338 {
7339 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7340 GetCompEM().UnplugThis();
7341 }
7342 #endif
7343 }
7344
7346
7348 {
7350 }
7351
7353 {
7354
7355 }
7356
7358 {
7359 super.OnItemLocationChanged(old_owner, new_owner);
7360
7361 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7362 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7363
7364 if (!relatedPlayer && playerNew)
7365 relatedPlayer = playerNew;
7366
7367 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7368 {
7370 if (actionMgr)
7371 {
7372 ActionBase currentAction = actionMgr.GetRunningAction();
7373 if (currentAction)
7375 }
7376 }
7377
7378 Man ownerPlayerOld = null;
7379 Man ownerPlayerNew = null;
7380
7381 if (old_owner)
7382 {
7383 if (old_owner.
IsMan())
7384 {
7385 ownerPlayerOld = Man.Cast(old_owner);
7386 }
7387 else
7388 {
7389 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7390 }
7391 }
7392 else
7393 {
7395 {
7397
7398 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7399 {
7400 GetCompEM().UnplugThis();
7401 }
7402 }
7403 }
7404
7405 if (new_owner)
7406 {
7407 if (new_owner.
IsMan())
7408 {
7409 ownerPlayerNew = Man.Cast(new_owner);
7410 }
7411 else
7412 {
7413 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7414 }
7415 }
7416
7417 if (ownerPlayerOld != ownerPlayerNew)
7418 {
7419 if (ownerPlayerOld)
7420 {
7421 array<EntityAI> subItemsExit = new array<EntityAI>;
7423 for (int i = 0; i < subItemsExit.Count(); i++)
7424 {
7427 }
7428 }
7429
7430 if (ownerPlayerNew)
7431 {
7432 array<EntityAI> subItemsEnter = new array<EntityAI>;
7434 for (int j = 0; j < subItemsEnter.Count(); j++)
7435 {
7438 }
7439 }
7440 }
7441 else if (ownerPlayerNew != null)
7442 {
7443 PlayerBase nplayer;
7444 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7445 {
7446 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7448 for (int k = 0; k < subItemsUpdate.Count(); k++)
7449 {
7451 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7452 }
7453 }
7454 }
7455
7456 if (old_owner)
7457 old_owner.OnChildItemRemoved(this);
7458 if (new_owner)
7459 new_owner.OnChildItemReceived(this);
7460 }
7461
7462
7464 {
7465 super.EEDelete(parent);
7466 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7467 if (player)
7468 {
7470
7471 if (player.IsAlive())
7472 {
7473 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7474 if (r_index >= 0)
7475 {
7476 InventoryLocation r_il = new InventoryLocation;
7477 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7478
7479 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7482 {
7483 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7484 }
7486 {
7487 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7488 }
7489
7490 }
7491
7492 player.RemoveQuickBarEntityShortcut(this);
7493 }
7494 }
7495 }
7496
7498 {
7499 super.EEKilled(killer);
7500
7503 {
7504 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7505 {
7506 if (IsMagazine())
7507 {
7508 if (Magazine.Cast(this).GetAmmoCount() > 0)
7509 {
7511 }
7512 }
7513 else
7514 {
7516 }
7517 }
7518 }
7519 }
7520
7522 {
7523 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7524
7525 super.OnWasAttached(parent, slot_id);
7526
7529
7532 }
7533
7535 {
7536 super.OnWasDetached(parent, slot_id);
7537
7540
7543 }
7544
7546 {
7547 int idx;
7550
7551 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7552 if (inventory_slots.Count() < 1)
7553 {
7554 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7555 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7556 }
7557 else
7558 {
7559 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7560 }
7561
7562 idx = inventory_slots.Find(slot);
7563 if (idx < 0)
7564 return "";
7565
7566 return attach_types.Get(idx);
7567 }
7568
7570 {
7571 int idx = -1;
7572 string slot;
7573
7576
7577 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7578 if (inventory_slots.Count() < 1)
7579 {
7580 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7581 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7582 }
7583 else
7584 {
7585 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7586 if (detach_types.Count() < 1)
7587 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7588 }
7589
7590 for (int i = 0; i < inventory_slots.Count(); i++)
7591 {
7592 slot = inventory_slots.Get(i);
7593 }
7594
7595 if (slot != "")
7596 {
7597 if (detach_types.Count() == 1)
7598 idx = 0;
7599 else
7600 idx = inventory_slots.Find(slot);
7601 }
7602 if (idx < 0)
7603 return "";
7604
7605 return detach_types.Get(idx);
7606 }
7607
7609 {
7610
7612
7613
7614 float min_time = 1;
7615 float max_time = 3;
7616 float delay = Math.RandomFloat(min_time, max_time);
7617
7618 explode_timer.Run(delay, this, "DoAmmoExplosion");
7619 }
7620
7622 {
7623 Magazine magazine = Magazine.Cast(this);
7624 int pop_sounds_count = 6;
7625 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7626
7627
7628 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7629 string sound_name = pop_sounds[ sound_idx ];
7630 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7631
7632
7633 magazine.ServerAddAmmoCount(-1);
7634
7635
7636 float min_temp_to_explode = 100;
7637
7638 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7639 {
7641 }
7642 }
7643
7644
7645 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7646 {
7647 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7648
7649 const int CHANCE_DAMAGE_CARGO = 4;
7650 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7651 const int CHANCE_DAMAGE_NOTHING = 2;
7652
7654 {
7655 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7656 int chances;
7657 int rnd;
7658
7659 if (GetInventory().GetCargo())
7660 {
7661 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7662 rnd = Math.RandomInt(0,chances);
7663
7664 if (rnd < CHANCE_DAMAGE_CARGO)
7665 {
7667 }
7668 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7669 {
7671 }
7672 }
7673 else
7674 {
7675 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7676 rnd = Math.RandomInt(0,chances);
7677
7678 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7679 {
7681 }
7682 }
7683 }
7684 }
7685
7687 {
7688 CargoBase cargo = GetInventory().GetCargo();
7689 if (cargo)
7690 {
7692 if (item_count > 0)
7693 {
7694 int random_pick = Math.RandomInt(0, item_count);
7696 if (!item.IsExplosive())
7697 {
7698 item.AddHealth("","",damage);
7699 return true;
7700 }
7701 }
7702 }
7703 return false;
7704 }
7705
7707 {
7708 GameInventory inventory = GetInventory();
7710 if (attachment_count > 0)
7711 {
7712 int random_pick = Math.RandomInt(0, attachment_count);
7714 if (!attachment.IsExplosive())
7715 {
7716 attachment.AddHealth("","",damage);
7717 return true;
7718 }
7719 }
7720 return false;
7721 }
7722
7724 {
7726 }
7727
7729 {
7731 return GetInventory().CanRemoveEntity();
7732
7733 return false;
7734 }
7735
7737 {
7738
7740 return false;
7741
7742
7744 return false;
7745
7746
7747
7749 if (delta == 0)
7750 return false;
7751
7752
7753 return true;
7754 }
7755
7757 {
7759 {
7760 if (ScriptInputUserData.CanStoreInputUserData())
7761 {
7762 ScriptInputUserData ctx = new ScriptInputUserData;
7767 ctx.
Write(destination_entity);
7771 }
7772 }
7773 else if (!
g_Game.IsMultiplayer())
7774 {
7776 }
7777 }
7778
7780 {
7781 float split_quantity_new;
7785 InventoryLocation loc = new InventoryLocation;
7786
7787 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7788 {
7790 split_quantity_new = stack_max;
7791 else
7793
7795 {
7796 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7797 if (new_item)
7798 {
7799 new_item.SetResultOfSplit(true);
7800 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7802 new_item.
SetQuantity(split_quantity_new,
false,
true);
7803 }
7804 }
7805 }
7806 else if (destination_entity && slot_id == -1)
7807 {
7808 if (quantity > stack_max)
7809 split_quantity_new = stack_max;
7810 else
7811 split_quantity_new = quantity;
7812
7814 {
7815 GameInventory destinationInventory = destination_entity.GetInventory();
7817 {
7820 }
7821
7822 if (new_item)
7823 {
7824 new_item.SetResultOfSplit(true);
7825 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7827 new_item.
SetQuantity(split_quantity_new,
false,
true);
7828 }
7829 }
7830 }
7831 else
7832 {
7833 if (stack_max != 0)
7834 {
7836 {
7838 }
7839
7840 if (split_quantity_new == 0)
7841 {
7842 if (!
g_Game.IsMultiplayer())
7843 player.PhysicalPredictiveDropItem(this);
7844 else
7845 player.ServerDropEntity(this);
7846 return;
7847 }
7848
7850 {
7852
7853 if (new_item)
7854 {
7855 new_item.SetResultOfSplit(true);
7856 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7859 new_item.PlaceOnSurface();
7860 }
7861 }
7862 }
7863 }
7864 }
7865
7867 {
7868 float split_quantity_new;
7872 InventoryLocation loc = new InventoryLocation;
7873
7874 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7875 {
7877 split_quantity_new = stack_max;
7878 else
7880
7882 {
7883 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7884 if (new_item)
7885 {
7886 new_item.SetResultOfSplit(true);
7887 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7889 new_item.
SetQuantity(split_quantity_new,
false,
true);
7890 }
7891 }
7892 }
7893 else if (destination_entity && slot_id == -1)
7894 {
7895 if (quantity > stack_max)
7896 split_quantity_new = stack_max;
7897 else
7898 split_quantity_new = quantity;
7899
7901 {
7902 GameInventory destinationInventory = destination_entity.GetInventory();
7904 {
7907 }
7908
7909 if (new_item)
7910 {
7911 new_item.SetResultOfSplit(true);
7912 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7914 new_item.
SetQuantity(split_quantity_new,
false,
true);
7915 }
7916 }
7917 }
7918 else
7919 {
7920 if (stack_max != 0)
7921 {
7923 {
7925 }
7926
7928 {
7930
7931 if (new_item)
7932 {
7933 new_item.SetResultOfSplit(true);
7934 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7937 new_item.PlaceOnSurface();
7938 }
7939 }
7940 }
7941 }
7942 }
7943
7945 {
7947 {
7948 if (ScriptInputUserData.CanStoreInputUserData())
7949 {
7950 ScriptInputUserData ctx = new ScriptInputUserData;
7955 dst.WriteToContext(ctx);
7957 }
7958 }
7959 else if (!
g_Game.IsMultiplayer())
7960 {
7962 }
7963 }
7964
7966 {
7968 {
7969 if (ScriptInputUserData.CanStoreInputUserData())
7970 {
7971 ScriptInputUserData ctx = new ScriptInputUserData;
7976 ctx.
Write(destination_entity);
7982 }
7983 }
7984 else if (!
g_Game.IsMultiplayer())
7985 {
7987 }
7988 }
7989
7991 {
7993 }
7994
7996 {
7998 float split_quantity_new;
8000 if (dst.IsValid())
8001 {
8002 int slot_id = dst.GetSlot();
8004
8005 if (quantity > stack_max)
8006 split_quantity_new = stack_max;
8007 else
8008 split_quantity_new = quantity;
8009
8011 {
8013
8014 if (new_item)
8015 {
8016 new_item.SetResultOfSplit(true);
8017 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8019 new_item.
SetQuantity(split_quantity_new,
false,
true);
8020 }
8021
8022 return new_item;
8023 }
8024 }
8025
8026 return null;
8027 }
8028
8030 {
8032 float split_quantity_new;
8034 if (destination_entity)
8035 {
8037 if (quantity > stackable)
8038 split_quantity_new = stackable;
8039 else
8040 split_quantity_new = quantity;
8041
8043 {
8044 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8045 if (new_item)
8046 {
8047 new_item.SetResultOfSplit(true);
8048 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8050 new_item.
SetQuantity(split_quantity_new,
false,
true);
8051 }
8052 }
8053 }
8054 }
8055
8057 {
8059 {
8060 if (ScriptInputUserData.CanStoreInputUserData())
8061 {
8062 ScriptInputUserData ctx = new ScriptInputUserData;
8067 ItemBase destination_entity =
this;
8068 ctx.
Write(destination_entity);
8072 }
8073 }
8074 else if (!
g_Game.IsMultiplayer())
8075 {
8077 }
8078 }
8079
8081 {
8083 float split_quantity_new;
8085 if (player)
8086 {
8088 if (quantity > stackable)
8089 split_quantity_new = stackable;
8090 else
8091 split_quantity_new = quantity;
8092
8094 {
8095 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8096 new_item =
ItemBase.Cast(in_hands);
8097 if (new_item)
8098 {
8099 new_item.SetResultOfSplit(true);
8100 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8102 new_item.SetQuantity(split_quantity_new, false, true);
8103 }
8104 }
8105 }
8106 }
8107
8109 {
8111 float split_quantity_new = Math.Floor(quantity * 0.5);
8112
8114 return;
8115
8117
8118 if (new_item)
8119 {
8120 if (new_item.GetQuantityMax() < split_quantity_new)
8121 {
8122 split_quantity_new = new_item.GetQuantityMax();
8123 }
8124
8125 new_item.SetResultOfSplit(true);
8126 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8127
8129 {
8132 }
8133 else
8134 {
8136 new_item.
SetQuantity(split_quantity_new,
false,
true);
8137 }
8138 }
8139 }
8140
8142 {
8144 float split_quantity_new = Math.Floor(quantity / 2);
8145
8147 return;
8148
8149 InventoryLocation invloc = new InventoryLocation;
8151
8153 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8154
8155 if (new_item)
8156 {
8157 if (new_item.GetQuantityMax() < split_quantity_new)
8158 {
8159 split_quantity_new = new_item.GetQuantityMax();
8160 }
8162 {
8165 }
8166 else if (split_quantity_new > 1)
8167 {
8169 new_item.
SetQuantity(split_quantity_new,
false,
true);
8170 }
8171 }
8172 }
8173
8176 {
8177 SetWeightDirty();
8179
8180 if (parent)
8181 parent.OnAttachmentQuantityChangedEx(this, delta);
8182
8184 {
8186 {
8188 }
8190 {
8191 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8193 }
8194 }
8195 }
8196
8199 {
8200
8201 }
8202
8205 {
8207 }
8208
8210 {
8211 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8212
8214 {
8215 if (newLevel == GameConstants.STATE_RUINED)
8216 {
8218 EntityAI parent = GetHierarchyParent();
8219 if (parent && parent.IsFireplace())
8220 {
8221 CargoBase cargo = GetInventory().GetCargo();
8222 if (cargo)
8223 {
8225 {
8227 }
8228 }
8229 }
8230 }
8231
8233 {
8234
8236 return;
8237 }
8238
8239 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8240 {
8242 }
8243 }
8244 }
8245
8246
8248 {
8249 super.OnRightClick();
8250
8252 {
8254 {
8255 if (ScriptInputUserData.CanStoreInputUserData())
8256 {
8257 EntityAI root = GetHierarchyRoot();
8258 Man playerOwner = GetHierarchyRootPlayer();
8259 InventoryLocation dst = new InventoryLocation;
8260
8261
8262 if (!playerOwner && root && root == this)
8263 {
8265 }
8266 else
8267 {
8268
8269 GetInventory().GetCurrentInventoryLocation(dst);
8271 {
8272 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8274 {
8276 }
8277 else
8278 {
8280
8281
8282 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8283 {
8285 }
8286 else
8287 {
8288 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8289 }
8290 }
8291 }
8292 }
8293
8294 ScriptInputUserData ctx = new ScriptInputUserData;
8302 }
8303 }
8304 else if (!
g_Game.IsMultiplayer())
8305 {
8307 }
8308 }
8309 }
8310
8312 {
8313 if (root)
8314 {
8315 vector m4[4];
8316 root.GetTransform(m4);
8317 dst.SetGround(this, m4);
8318 }
8319 else
8320 {
8321 GetInventory().GetCurrentInventoryLocation(dst);
8322 }
8323 }
8324
8325 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8326 {
8327
8328 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8329 return false;
8330
8331 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8332 return false;
8333
8334
8336 return false;
8337
8338
8339 Magazine mag = Magazine.Cast(this);
8340 if (mag)
8341 {
8342 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8343 return false;
8344
8345 if (stack_max_limit)
8346 {
8347 Magazine other_mag = Magazine.Cast(other_item);
8348 if (other_item)
8349 {
8350 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8351 return false;
8352 }
8353
8354 }
8355 }
8356 else
8357 {
8358
8360 return false;
8361
8363 return false;
8364 }
8365
8366 PlayerBase player = null;
8367 if (CastTo(player, GetHierarchyRootPlayer()))
8368 {
8369 if (player.GetInventory().HasAttachment(this))
8370 return false;
8371
8372 if (player.IsItemsToDelete())
8373 return false;
8374 }
8375
8376 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8377 return false;
8378
8379 int slotID;
8381 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8382 return false;
8383
8384 return true;
8385 }
8386
8388 {
8390 }
8391
8393 {
8394 return m_IsResultOfSplit;
8395 }
8396
8398 {
8399 m_IsResultOfSplit = value;
8400 }
8401
8403 {
8405 }
8406
8408 {
8409 float other_item_quantity = other_item.GetQuantity();
8410 float this_free_space;
8411
8413
8415
8416 if (other_item_quantity > this_free_space)
8417 {
8418 return this_free_space;
8419 }
8420 else
8421 {
8422 return other_item_quantity;
8423 }
8424 }
8425
8427 {
8429 }
8430
8432 {
8434 return;
8435
8436 if (!IsMagazine() && other_item)
8437 {
8439 if (quantity_used != 0)
8440 {
8441 float hp1 = GetHealth01("","");
8442 float hp2 = other_item.GetHealth01("","");
8443 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8444 hpResult = hpResult / (
GetQuantity() + quantity_used);
8445
8446 hpResult *= GetMaxHealth();
8447 Math.Round(hpResult);
8448 SetHealth("", "Health", hpResult);
8449
8451 other_item.AddQuantity(-quantity_used);
8452 }
8453 }
8455 }
8456
8458 {
8459 #ifdef SERVER
8460 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8461 GetHierarchyParent().IncreaseLifetimeUp();
8462 #endif
8463 };
8464
8466 {
8467 PlayerBase p = PlayerBase.Cast(player);
8468
8469 array<int> recipesIds = p.m_Recipes;
8470 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8471 if (moduleRecipesManager)
8472 {
8473 EntityAI itemInHands = player.GetEntityInHands();
8474 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8475 }
8476
8477 for (int i = 0;i < recipesIds.Count(); i++)
8478 {
8479 int key = recipesIds.Get(i);
8480 string recipeName = moduleRecipesManager.GetRecipeName(key);
8482 }
8483 }
8484
8485
8486 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8487 {
8488 super.GetDebugActions(outputList);
8489
8490
8496
8497
8502
8507
8508
8512
8513
8515 {
8519 }
8520
8523
8524
8528
8530
8531 InventoryLocation loc = new InventoryLocation();
8532 GetInventory().GetCurrentInventoryLocation(loc);
8534 {
8535 if (Gizmo_IsSupported())
8538 }
8539
8541 }
8542
8543
8544
8545
8547 {
8548 super.OnAction(action_id, player, ctx);
8549
8551 {
8552 switch (action_id)
8553 {
8557 return true;
8561 return true;
8562 }
8563 }
8564
8566 {
8567 switch (action_id)
8568 {
8570 Delete();
8571 return true;
8572 }
8573 }
8574
8575 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8576 {
8577 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8578 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8579 PlayerBase p = PlayerBase.Cast(player);
8580 if (
EActions.RECIPES_RANGE_START < 1000)
8581 {
8582 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8583 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8584 }
8585 }
8586 #ifndef SERVER
8587 else if (action_id ==
EActions.WATCH_PLAYER)
8588 {
8589 PluginDeveloper.SetDeveloperItemClientEx(player);
8590 }
8591 #endif
8593 {
8594 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8595 {
8596 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8597 OnDebugButtonPressServer(id + 1);
8598 }
8599
8600 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8601 {
8602 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8604 }
8605
8606 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8607 {
8608 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8610 }
8611
8612 else if (action_id ==
EActions.ADD_QUANTITY)
8613 {
8614 if (IsMagazine())
8615 {
8616 Magazine mag = Magazine.Cast(this);
8617 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8618 }
8619 else
8620 {
8622 }
8623
8624 if (m_EM)
8625 {
8626 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8627 }
8628
8629 }
8630
8631 else if (action_id ==
EActions.REMOVE_QUANTITY)
8632 {
8633 if (IsMagazine())
8634 {
8635 Magazine mag2 = Magazine.Cast(this);
8636 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8637 }
8638 else
8639 {
8641 }
8642 if (m_EM)
8643 {
8644 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8645 }
8646
8647 }
8648
8649 else if (action_id ==
EActions.SET_QUANTITY_0)
8650 {
8652
8653 if (m_EM)
8654 {
8655 m_EM.SetEnergy(0);
8656 }
8657 }
8658
8659 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8660 {
8662
8663 if (m_EM)
8664 {
8665 m_EM.SetEnergy(m_EM.GetEnergyMax());
8666 }
8667 }
8668
8669 else if (action_id ==
EActions.ADD_HEALTH)
8670 {
8671 AddHealth("","",GetMaxHealth("","Health")/5);
8672 }
8673 else if (action_id ==
EActions.REMOVE_HEALTH)
8674 {
8675 AddHealth("","",-GetMaxHealth("","Health")/5);
8676 }
8677 else if (action_id ==
EActions.DESTROY_HEALTH)
8678 {
8679 SetHealth01("","",0);
8680 }
8681 else if (action_id ==
EActions.WATCH_ITEM)
8682 {
8684 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8685 #ifdef DEVELOPER
8686 SetDebugDeveloper_item(this);
8687 #endif
8688 }
8689
8690 else if (action_id ==
EActions.ADD_TEMPERATURE)
8691 {
8692 AddTemperature(20);
8693
8694 }
8695
8696 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8697 {
8698 AddTemperature(-20);
8699
8700 }
8701
8702 else if (action_id ==
EActions.FLIP_FROZEN)
8703 {
8704 SetFrozen(!GetIsFrozen());
8705
8706 }
8707
8708 else if (action_id ==
EActions.ADD_WETNESS)
8709 {
8711
8712 }
8713
8714 else if (action_id ==
EActions.REMOVE_WETNESS)
8715 {
8717
8718 }
8719
8720 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8721 {
8724
8725
8726 }
8727
8728 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8729 {
8732 }
8733
8734 else if (action_id ==
EActions.MAKE_SPECIAL)
8735 {
8736 auto debugParams = DebugSpawnParams.WithPlayer(player);
8737 OnDebugSpawnEx(debugParams);
8738 }
8739
8740 }
8741
8742
8743 return false;
8744 }
8745
8746
8747
8748
8752
8755
8756
8757
8759 {
8760 return false;
8761 }
8762
8763
8765 {
8766 return true;
8767 }
8768
8769
8771 {
8772 return true;
8773 }
8774
8775
8776
8778 {
8779 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8780 return g_Game.ConfigIsExisting(config_path);
8781 }
8782
8785 {
8786 return null;
8787 }
8788
8790 {
8791 return false;
8792 }
8793
8795 {
8796 return false;
8797 }
8798
8802
8803
8805 {
8806 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8807 return module_repairing.CanRepair(this, item_repair_kit);
8808 }
8809
8810
8811 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8812 {
8813 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8814 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8815 }
8816
8817
8819 {
8820
8821
8822
8823
8824
8825
8826
8827
8828 return 1;
8829 }
8830
8831
8832
8834 {
8836 }
8837
8838
8839
8841 {
8843 }
8844
8845
8854 {
8855 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8856
8857 if (player)
8858 {
8859 player.MessageStatus(text);
8860 }
8861 }
8862
8863
8872 {
8873 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8874
8875 if (player)
8876 {
8877 player.MessageAction(text);
8878 }
8879 }
8880
8881
8890 {
8891 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8892
8893 if (player)
8894 {
8895 player.MessageFriendly(text);
8896 }
8897 }
8898
8899
8908 {
8909 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8910
8911 if (player)
8912 {
8913 player.MessageImportant(text);
8914 }
8915 }
8916
8918 {
8919 return true;
8920 }
8921
8922
8923 override bool KindOf(
string tag)
8924 {
8925 bool found = false;
8926 string item_name = this.
GetType();
8928 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8929
8930 int array_size = item_tag_array.Count();
8931 for (int i = 0; i < array_size; i++)
8932 {
8933 if (item_tag_array.Get(i) == tag)
8934 {
8935 found = true;
8936 break;
8937 }
8938 }
8939 return found;
8940 }
8941
8942
8944 {
8945
8946 super.OnRPC(sender, rpc_type,ctx);
8947
8948
8949 switch (rpc_type)
8950 {
8951 #ifndef SERVER
8952 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8953 Param2<bool, string> p = new Param2<bool, string>(false, "");
8954
8956 return;
8957
8958 bool play = p.param1;
8959 string soundSet = p.param2;
8960
8961 if (play)
8962 {
8964 {
8966 {
8968 }
8969 }
8970 else
8971 {
8973 }
8974 }
8975 else
8976 {
8978 }
8979
8980 break;
8981 #endif
8982
8983 }
8984
8986 {
8988 }
8989 }
8990
8991
8992
8993
8995 {
8996 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8997 return plugin.GetID(
name);
8998 }
8999
9001 {
9002 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9003 return plugin.GetName(id);
9004 }
9005
9008 {
9009
9010
9011 int varFlags;
9012 if (!ctx.
Read(varFlags))
9013 return;
9014
9015 if (varFlags & ItemVariableFlags.FLOAT)
9016 {
9018 }
9019 }
9020
9022 {
9023
9024 super.SerializeNumericalVars(floats_out);
9025
9026
9027
9029 {
9031 }
9032
9034 {
9036 }
9037
9039 {
9041 }
9042
9044 {
9049 }
9050
9052 {
9054 }
9055 }
9056
9058 {
9059
9060 super.DeSerializeNumericalVars(floats);
9061
9062
9063 int index = 0;
9064 int mask = Math.Round(floats.Get(index));
9065
9066 index++;
9067
9069 {
9071 {
9073 }
9074 else
9075 {
9076 float quantity = floats.Get(index);
9078 }
9079 index++;
9080 }
9081
9083 {
9084 float wet = floats.Get(index);
9086 index++;
9087 }
9088
9090 {
9091 int liquidtype = Math.Round(floats.Get(index));
9093 index++;
9094 }
9095
9097 {
9099 index++;
9101 index++;
9103 index++;
9105 index++;
9106 }
9107
9109 {
9110 int cleanness = Math.Round(floats.Get(index));
9112 index++;
9113 }
9114 }
9115
9117 {
9118 super.WriteVarsToCTX(ctx);
9119
9120
9122 {
9124 }
9125
9127 {
9129 }
9130
9132 {
9134 }
9135
9137 {
9138 int r,g,b,a;
9144 }
9145
9147 {
9149 }
9150 }
9151
9153 {
9154 if (!super.ReadVarsFromCTX(ctx,version))
9155 return false;
9156
9157 int intValue;
9158 float value;
9159
9160 if (version < 140)
9161 {
9162 if (!ctx.
Read(intValue))
9163 return false;
9164
9165 m_VariablesMask = intValue;
9166 }
9167
9169 {
9170 if (!ctx.
Read(value))
9171 return false;
9172
9174 {
9176 }
9177 else
9178 {
9180 }
9181 }
9182
9183 if (version < 140)
9184 {
9186 {
9187 if (!ctx.
Read(value))
9188 return false;
9189 SetTemperatureDirect(value);
9190 }
9191 }
9192
9194 {
9195 if (!ctx.
Read(value))
9196 return false;
9198 }
9199
9201 {
9202 if (!ctx.
Read(intValue))
9203 return false;
9205 }
9206
9208 {
9209 int r,g,b,a;
9211 return false;
9213 return false;
9215 return false;
9217 return false;
9218
9220 }
9221
9223 {
9224 if (!ctx.
Read(intValue))
9225 return false;
9227 }
9228
9229 if (version >= 138 && version < 140)
9230 {
9232 {
9233 if (!ctx.
Read(intValue))
9234 return false;
9235 SetFrozen(intValue);
9236 }
9237 }
9238
9239 return true;
9240 }
9241
9242
9244 {
9247 {
9249 }
9250
9251 if (!super.OnStoreLoad(ctx, version))
9252 {
9254 return false;
9255 }
9256
9257 if (version >= 114)
9258 {
9259 bool hasQuickBarIndexSaved;
9260
9261 if (!ctx.
Read(hasQuickBarIndexSaved))
9262 {
9264 return false;
9265 }
9266
9267 if (hasQuickBarIndexSaved)
9268 {
9269 int itmQBIndex;
9270
9271
9272 if (!ctx.
Read(itmQBIndex))
9273 {
9275 return false;
9276 }
9277
9278 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9279 if (itmQBIndex != -1 && parentPlayer)
9280 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9281 }
9282 }
9283 else
9284 {
9285
9286 PlayerBase player;
9287 int itemQBIndex;
9288 if (version ==
int.
MAX)
9289 {
9290 if (!ctx.
Read(itemQBIndex))
9291 {
9293 return false;
9294 }
9295 }
9296 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9297 {
9298
9299 if (!ctx.
Read(itemQBIndex))
9300 {
9302 return false;
9303 }
9304 if (itemQBIndex != -1 && player)
9305 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9306 }
9307 }
9308
9309 if (version < 140)
9310 {
9311
9312 if (!LoadVariables(ctx, version))
9313 {
9315 return false;
9316 }
9317 }
9318
9319
9321 {
9323 return false;
9324 }
9325 if (version >= 132)
9326 {
9328 if (raib)
9329 {
9331 {
9333 return false;
9334 }
9335 }
9336 }
9337
9339 return true;
9340 }
9341
9342
9343
9345 {
9346 super.OnStoreSave(ctx);
9347
9348 PlayerBase player;
9349 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9350 {
9352
9353 int itemQBIndex = -1;
9354 itemQBIndex = player.FindQuickBarEntityIndex(this);
9355 ctx.
Write(itemQBIndex);
9356 }
9357 else
9358 {
9360 }
9361
9363
9365 if (raib)
9366 {
9368 }
9369 }
9370
9371
9373 {
9374 super.AfterStoreLoad();
9375
9377 {
9379 }
9380
9382 {
9385 }
9386 }
9387
9389 {
9390 super.EEOnAfterLoad();
9391
9393 {
9395 }
9396
9399 }
9400
9402 {
9403 return false;
9404 }
9405
9406
9407
9409 {
9411 {
9412 #ifdef PLATFORM_CONSOLE
9413
9415 {
9417 if (menu)
9418 {
9420 }
9421 }
9422 #endif
9423 }
9424
9426 {
9429 }
9430
9432 {
9433 SetWeightDirty();
9435 }
9437 {
9440 }
9441
9443 {
9446
9449 }
9451 {
9455 }
9456
9457 super.OnVariablesSynchronized();
9458 }
9459
9460
9461
9463 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9464 {
9465 if (!IsServerCheck(allow_client))
9466 return false;
9467
9469 return false;
9470
9473
9474 if (value <= (min + 0.001))
9475 value = min;
9476
9477 if (value == min)
9478 {
9479 if (destroy_config)
9480 {
9481 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9482 if (dstr)
9483 {
9485 this.Delete();
9486 return true;
9487 }
9488 }
9489 else if (destroy_forced)
9490 {
9492 this.Delete();
9493 return true;
9494 }
9495
9497 }
9498
9501
9503 {
9504 EntityAI parent = GetHierarchyRoot();
9505 InventoryLocation iLoc = new InventoryLocation();
9506 GetInventory().GetCurrentInventoryLocation(iLoc);
9508 {
9509 int iLocSlot = iLoc.
GetSlot();
9511 {
9513 }
9515 {
9517 }
9518 }
9519 }
9520
9522 {
9524
9525 if (delta)
9527 }
9528
9530
9531 return false;
9532 }
9533
9534
9536 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9537 {
9539 }
9540
9542 {
9545 }
9546
9548 {
9551 }
9552
9554 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9555 {
9556 float value_clamped = Math.Clamp(value, 0, 1);
9558 SetQuantity(result, destroy_config, destroy_forced);
9559 }
9560
9561
9564 {
9566 }
9567
9569 {
9571 }
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9583 {
9584 int slot = -1;
9585 GameInventory inventory = GetInventory();
9586 if (inventory)
9587 {
9588 InventoryLocation il = new InventoryLocation;
9591 }
9592
9594 }
9595
9597 {
9598 float quantity_max = 0;
9599
9601 {
9602 if (attSlotID != -1)
9603 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9604
9605 if (quantity_max <= 0)
9607 }
9608
9609 if (quantity_max <= 0)
9611
9612 return quantity_max;
9613 }
9614
9616 {
9618 }
9619
9621 {
9623 }
9624
9625
9627 {
9629 }
9630
9632 {
9634 }
9635
9637 {
9639 }
9640
9641
9643 {
9644
9645 float weightEx = GetWeightEx();
9646 float special = GetInventoryAndCargoWeight();
9647 return weightEx - special;
9648 }
9649
9650
9652 {
9654 }
9655
9657 {
9659 {
9660 #ifdef DEVELOPER
9661 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9662 {
9663 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9665 }
9666 #endif
9667
9669 }
9670 else if (HasEnergyManager())
9671 {
9672 #ifdef DEVELOPER
9673 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9674 {
9675 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9676 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9677 }
9678 #endif
9679 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9680 }
9681 else
9682 {
9683 #ifdef DEVELOPER
9684 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9685 {
9686 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9687 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9688 }
9689 #endif
9690 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9691 }
9692 }
9693
9696 {
9697 int item_count = 0;
9699
9700 GameInventory inventory = GetInventory();
9701 CargoBase cargo = inventory.
GetCargo();
9702 if (cargo != NULL)
9703 {
9705 }
9706
9708 for (int i = 0; i < nAttachments; ++i)
9709 {
9711 if (item)
9712 item_count += item.GetNumberOfItems();
9713 }
9714 return item_count;
9715 }
9716
9719 {
9720 float weight = 0;
9721 float wetness = 1;
9722 if (include_wetness)
9725 {
9726 weight = wetness * m_ConfigWeight;
9727 }
9729 {
9730 weight = 1;
9731 }
9732 return weight;
9733 }
9734
9735
9736
9738 {
9739 GameInventory inventory = GetInventory();
9740 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9741 {
9742 array<EntityAI> items = new array<EntityAI>;
9744 for (int i = 0; i < items.Count(); ++i)
9745 {
9747 if (item)
9748 {
9749 g_Game.ObjectDelete(item);
9750 }
9751 }
9752 }
9753 }
9754
9755
9756
9757
9759 {
9760 float energy = 0;
9761 if (HasEnergyManager())
9762 {
9763 energy = GetCompEM().GetEnergy();
9764 }
9765 return energy;
9766 }
9767
9768
9770 {
9771 super.OnEnergyConsumed();
9772
9774 }
9775
9777 {
9778 super.OnEnergyAdded();
9779
9781 }
9782
9783
9785 {
9786 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9787 {
9789 {
9790 float energy_0to1 = GetCompEM().GetEnergy0To1();
9792 }
9793 }
9794 }
9795
9796
9798 {
9799 return ConfigGetFloat("heatIsolation");
9800 }
9801
9803 {
9805 }
9806
9808 {
9809 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9810 if (
g_Game.ConfigIsExisting(paramPath))
9811 return g_Game.ConfigGetFloat(paramPath);
9812
9813 return 0.0;
9814 }
9815
9817 {
9818 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9819 if (
g_Game.ConfigIsExisting(paramPath))
9820 return g_Game.ConfigGetFloat(paramPath);
9821
9822 return 0.0;
9823 }
9824
9825 override void SetWet(
float value,
bool allow_client =
false)
9826 {
9827 if (!IsServerCheck(allow_client))
9828 return;
9829
9832
9834
9835 m_VarWet = Math.Clamp(value, min, max);
9836
9838 {
9841 }
9842 }
9843
9844 override void AddWet(
float value)
9845 {
9847 }
9848
9850 {
9852 }
9853
9855 {
9857 }
9858
9860 {
9862 }
9863
9865 {
9867 }
9868
9870 {
9872 }
9873
9875 {
9878 if (newLevel != oldLevel)
9879 {
9881 }
9882 }
9883
9885 {
9886 SetWeightDirty();
9887 }
9888
9890 {
9891 return GetWetLevelInternal(
m_VarWet);
9892 }
9893
9894
9895
9897 {
9899 }
9900
9902 {
9904 }
9905
9907 {
9909 }
9910
9912 {
9914 }
9915
9916
9917
9919 {
9920 if (ConfigIsExisting("itemModelLength"))
9921 {
9922 return ConfigGetFloat("itemModelLength");
9923 }
9924 return 0;
9925 }
9926
9928 {
9929 if (ConfigIsExisting("itemAttachOffset"))
9930 {
9931 return ConfigGetFloat("itemAttachOffset");
9932 }
9933 return 0;
9934 }
9935
9936 override void SetCleanness(
int value,
bool allow_client =
false)
9937 {
9938 if (!IsServerCheck(allow_client))
9939 return;
9940
9942
9944
9947 }
9948
9950 {
9952 }
9953
9955 {
9956 return true;
9957 }
9958
9959
9960
9961
9963 {
9965 }
9966
9968 {
9970 }
9971
9972
9973
9974
9975 override void SetColor(
int r,
int g,
int b,
int a)
9976 {
9982 }
9984 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9985 {
9990 }
9991
9993 {
9995 }
9996
9999 {
10000 int r,g,b,a;
10002 r = r/255;
10003 g = g/255;
10004 b = b/255;
10005 a = a/255;
10006 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10007 }
10008
10009
10010
10011 override void SetLiquidType(
int value,
bool allow_client =
false)
10012 {
10013 if (!IsServerCheck(allow_client))
10014 return;
10015
10020 }
10021
10023 {
10024 return ConfigGetInt("varLiquidTypeInit");
10025 }
10026
10028 {
10030 }
10031
10033 {
10035 SetFrozen(false);
10036 }
10037
10040 {
10041 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10042 }
10043
10044
10047 {
10048 PlayerBase nplayer;
10049 if (PlayerBase.CastTo(nplayer, player))
10050 {
10052 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10053 }
10054 }
10055
10056
10059 {
10060 PlayerBase nplayer;
10061 if (PlayerBase.CastTo(nplayer,player))
10062 {
10063 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10064 }
10065
10066 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10067
10068 if (HasEnergyManager())
10069 {
10070 GetCompEM().UpdatePlugState();
10071 }
10072 }
10073
10074
10076 {
10077 super.OnPlacementStarted(player);
10078
10080 }
10081
10082 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10083 {
10085 {
10086 m_AdminLog.OnPlacementComplete(player,
this);
10087 }
10088
10089 super.OnPlacementComplete(player, position, orientation);
10090 }
10091
10092
10093
10094
10095
10097 {
10099 {
10100 return true;
10101 }
10102 else
10103 {
10104 return false;
10105 }
10106 }
10107
10108
10110 {
10112 {
10114 }
10115 }
10116
10117
10119 {
10121 }
10122
10124 {
10126 }
10127
10128 override void InsertAgent(
int agent,
float count = 1)
10129 {
10130 if (count < 1)
10131 return;
10132
10134 }
10135
10138 {
10140 }
10141
10142
10144 {
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
10184
10185
10186
10187
10188
10190 {
10192 return false;
10193 return true;
10194 }
10195
10197 {
10198
10200 }
10201
10202
10205 {
10206 super.CheckForRoofLimited(timeTresholdMS);
10207
10208 float time =
g_Game.GetTime();
10209 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10210 {
10211 m_PreviousRoofTestTime = time;
10212 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10213 }
10214 }
10215
10216
10218 {
10220 {
10221 return 0;
10222 }
10223
10224 if (GetInventory().GetAttachmentSlotsCount() != 0)
10225 {
10226 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10227 if (filter)
10228 return filter.GetProtectionLevel(type, false, system);
10229 else
10230 return 0;
10231 }
10232
10233 string subclassPath, entryName;
10234
10235 switch (type)
10236 {
10238 entryName = "biological";
10239 break;
10241 entryName = "chemical";
10242 break;
10243 default:
10244 entryName = "biological";
10245 break;
10246 }
10247
10248 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10249
10250 return g_Game.ConfigGetFloat(subclassPath + entryName);
10251 }
10252
10253
10254
10257 {
10258 if (!IsMagazine())
10260
10262 }
10263
10264
10265
10266
10267
10272 {
10273 return true;
10274 }
10275
10277 {
10279 }
10280
10281
10282
10283
10284
10286 {
10287 if (parent)
10288 {
10289 if (parent.IsInherited(DayZInfected))
10290 return true;
10291
10292 if (!parent.IsRuined())
10293 return true;
10294 }
10295
10296 return true;
10297 }
10298
10300 {
10301 if (!super.CanPutAsAttachment(parent))
10302 {
10303 return false;
10304 }
10305
10306 if (!IsRuined() && !parent.IsRuined())
10307 {
10308 return true;
10309 }
10310
10311 return false;
10312 }
10313
10315 {
10316
10317
10318
10319
10320 return super.CanReceiveItemIntoCargo(item);
10321 }
10322
10324 {
10325
10326
10327
10328
10329 GameInventory attachmentInv = attachment.GetInventory();
10331 {
10332 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10333 return false;
10334 }
10335
10336 InventoryLocation loc = new InventoryLocation();
10337 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10338 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10339 return false;
10340
10341 return super.CanReceiveAttachment(attachment, slotId);
10342 }
10343
10345 {
10346 if (!super.CanReleaseAttachment(attachment))
10347 return false;
10348
10349 return GetInventory().AreChildrenAccessible();
10350 }
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10373 {
10374 int id = muzzle_owner.GetMuzzleID();
10375 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10376
10377 if (WPOF_array)
10378 {
10379 for (int i = 0; i < WPOF_array.Count(); i++)
10380 {
10381 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10382
10383 if (WPOF)
10384 {
10385 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10386 }
10387 }
10388 }
10389 }
10390
10391
10393 {
10394 int id = muzzle_owner.GetMuzzleID();
10396
10397 if (WPOBE_array)
10398 {
10399 for (int i = 0; i < WPOBE_array.Count(); i++)
10400 {
10401 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10402
10403 if (WPOBE)
10404 {
10405 WPOBE.OnActivate(weapon, 0, 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.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10426 }
10427 }
10428 }
10429 }
10430
10431
10433 {
10434 int id = muzzle_owner.GetMuzzleID();
10435 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10436
10437 if (WPOOH_array)
10438 {
10439 for (int i = 0; i < WPOOH_array.Count(); i++)
10440 {
10441 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10442
10443 if (WPOOH)
10444 {
10445 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10446 }
10447 }
10448 }
10449 }
10450
10451
10453 {
10454 int id = muzzle_owner.GetMuzzleID();
10455 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10456
10457 if (WPOOH_array)
10458 {
10459 for (int i = 0; i < WPOOH_array.Count(); i++)
10460 {
10461 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10462
10463 if (WPOOH)
10464 {
10465 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10466 }
10467 }
10468 }
10469 }
10470
10471
10472
10474 {
10476 {
10477 return true;
10478 }
10479
10480 return false;
10481 }
10482
10484 {
10486 {
10487 return true;
10488 }
10489
10490 return false;
10491 }
10492
10494 {
10496 {
10497 return true;
10498 }
10499
10500 return false;
10501 }
10502
10504 {
10505 return false;
10506 }
10507
10510 {
10511 return UATimeSpent.DEFAULT_DEPLOY;
10512 }
10513
10514
10515
10516
10518 {
10520 SetSynchDirty();
10521 }
10522
10524 {
10526 }
10527
10528
10530 {
10531 return false;
10532 }
10533
10536 {
10537 string att_type = "None";
10538
10539 if (ConfigIsExisting("soundAttType"))
10540 {
10541 att_type = ConfigGetString("soundAttType");
10542 }
10543
10545 }
10546
10548 {
10550 }
10551
10552
10553
10554
10555
10561
10563 {
10566
10568 }
10569
10570
10572 {
10574 return;
10575
10577
10580
10583
10584 SoundParameters params = new SoundParameters();
10588 }
10589
10590
10592 {
10594 {
10597
10598 SetSynchDirty();
10599
10602 }
10603 }
10604
10606 {
10608 }
10609
10610
10612 {
10614 return;
10615
10617 SetSynchDirty();
10618
10621 }
10622
10624 {
10627 }
10628
10630 {
10632 }
10633
10634 void OnApply(PlayerBase player);
10635
10637 {
10638 return 1.0;
10639 };
10640
10642 {
10644 }
10645
10647 {
10649 }
10650
10652
10654 {
10655 SetDynamicPhysicsLifeTime(0.01);
10657 }
10658
10660 {
10661 array<string> zone_names = new array<string>;
10662 GetDamageZones(zone_names);
10663 for (int i = 0; i < zone_names.Count(); i++)
10664 {
10665 SetHealthMax(zone_names.Get(i),"Health");
10666 }
10667 SetHealthMax("","Health");
10668 }
10669
10672 {
10673 float global_health = GetHealth01("","Health");
10674 array<string> zones = new array<string>;
10675 GetDamageZones(zones);
10676
10677 for (int i = 0; i < zones.Count(); i++)
10678 {
10679 SetHealth01(zones.Get(i),"Health",global_health);
10680 }
10681 }
10682
10685 {
10686 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10687 }
10688
10690 {
10691 if (!hasRootAsPlayer)
10692 {
10693 if (refParentIB)
10694 {
10695
10696 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10697 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10698
10699 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10700 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10701
10704 }
10705 else
10706 {
10707
10710 }
10711 }
10712 }
10713
10715 {
10717 {
10718 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10719 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10720 {
10721 float heatPermCoef = 1.0;
10723 while (ent)
10724 {
10725 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10726 ent = ent.GetHierarchyParent();
10727 }
10728
10729 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10730 }
10731 }
10732 }
10733
10735 {
10736
10737 EntityAI parent = GetHierarchyParent();
10738 if (!parent)
10739 {
10740 hasParent = false;
10741 hasRootAsPlayer = false;
10742 }
10743 else
10744 {
10745 hasParent = true;
10746 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10747 refParentIB =
ItemBase.Cast(parent);
10748 }
10749 }
10750
10751 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10752 {
10753
10754 }
10755
10757 {
10758
10759 return false;
10760 }
10761
10763 {
10764
10765
10766 return false;
10767 }
10768
10770 {
10771
10772 return false;
10773 }
10774
10777 {
10778 return !GetIsFrozen() &&
IsOpen();
10779 }
10780
10782 {
10783 bool hasParent = false, hasRootAsPlayer = false;
10785
10786 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10787 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10788
10789 if (wwtu || foodDecay)
10790 {
10794
10795 if (processWetness || processTemperature || processDecay)
10796 {
10798
10799 if (processWetness)
10800 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10801
10802 if (processTemperature)
10804
10805 if (processDecay)
10806 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10807 }
10808 }
10809 }
10810
10813 {
10815 }
10816
10818 {
10821
10822 return super.GetTemperatureFreezeThreshold();
10823 }
10824
10826 {
10829
10830 return super.GetTemperatureThawThreshold();
10831 }
10832
10834 {
10837
10838 return super.GetItemOverheatThreshold();
10839 }
10840
10842 {
10844 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10845
10846 return super.GetTemperatureFreezeTime();
10847 }
10848
10850 {
10852 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10853
10854 return super.GetTemperatureThawTime();
10855 }
10856
10861
10863 {
10864 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10865 }
10866
10868 {
10869 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10870 }
10871
10874 {
10876 }
10877
10879 {
10881 }
10882
10884 {
10886 }
10887
10890 {
10891 return null;
10892 }
10893
10896 {
10897 return false;
10898 }
10899
10901 {
10903 {
10906 if (!trg)
10907 {
10909 explosive = this;
10910 }
10911
10912 explosive.PairRemote(trg);
10914
10915 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10916 trg.SetPersistentPairID(persistentID);
10917 explosive.SetPersistentPairID(persistentID);
10918
10919 return true;
10920 }
10921 return false;
10922 }
10923
10926 {
10927 float ret = 1.0;
10930 ret *= GetHealth01();
10931
10932 return ret;
10933 }
10934
10935 #ifdef DEVELOPER
10936 override void SetDebugItem()
10937 {
10938 super.SetDebugItem();
10939 _itemBase = this;
10940 }
10941
10943 {
10944 string text = super.GetDebugText();
10945
10947 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10948
10949 return text;
10950 }
10951 #endif
10952
10954 {
10955 return true;
10956 }
10957
10959
10961
10963 {
10966 }
10967
10968
10976
10992
10993 [
Obsolete(
"Use ItemSoundHandler instead")]
10996 {
10997 if (!
g_Game.IsDedicatedServer())
10998 {
10999 if (ConfigIsExisting("attachSoundSet"))
11000 {
11001 string cfg_path = "";
11002 string soundset = "";
11003 string type_name =
GetType();
11004
11007 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11008 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11009
11010 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11011 {
11012 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11013 {
11014 if (cfg_slot_array[i] == slot_type)
11015 {
11016 soundset = cfg_soundset_array[i];
11017 break;
11018 }
11019 }
11020 }
11021
11022 if (soundset != "")
11023 {
11024 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11026 }
11027 }
11028 }
11029 }
11030
11032}
11033
11035{
11037 if (entity)
11038 {
11039 bool is_item = entity.IsInherited(
ItemBase);
11040 if (is_item && full_quantity)
11041 {
11044 }
11045 }
11046 else
11047 {
11049 return NULL;
11050 }
11051 return entity;
11052}
11053
11055{
11056 if (item)
11057 {
11058 if (health > 0)
11059 item.SetHealth("", "", health);
11060
11061 if (item.CanHaveTemperature())
11062 {
11064 if (item.CanFreeze())
11065 item.SetFrozen(false);
11066 }
11067
11068 if (item.HasEnergyManager())
11069 {
11070 if (quantity >= 0)
11071 {
11072 item.GetCompEM().SetEnergy0To1(quantity);
11073 }
11074 else
11075 {
11077 }
11078 }
11079 else if (item.IsMagazine())
11080 {
11081 Magazine mag = Magazine.Cast(item);
11082 if (quantity >= 0)
11083 {
11084 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11085 }
11086 else
11087 {
11089 }
11090
11091 }
11092 else
11093 {
11094 if (quantity >= 0)
11095 {
11096 item.SetQuantityNormalized(quantity, false);
11097 }
11098 else
11099 {
11101 }
11102
11103 }
11104 }
11105}
11106
11107#ifdef DEVELOPER
11109#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.