6054{
6056 {
6057 return true;
6058 }
6059};
6060
6061
6062
6064{
6068
6070
6073
6074
6075
6076
6077
6086
6092
6097
6102
6123 protected bool m_IsResultOfSplit
6124
6126
6131
6132
6133
6135
6139
6140
6141
6143
6146
6147
6148
6154
6155
6163
6166
6167
6169
6170
6172
6173
6178
6179
6184
6185
6187
6188
6190 {
6195
6196 if (!
GetGame().IsDedicatedServer())
6197 {
6199 {
6201
6203 {
6205 }
6206 }
6207
6210 }
6211
6212 m_OldLocation = null;
6213
6215 {
6217 }
6218
6219 if (ConfigIsExisting("headSelectionsToHide"))
6220 {
6223 }
6224
6226 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6227 {
6229 }
6230
6232
6233 m_IsResultOfSplit = false;
6234
6236 }
6237
6239 {
6240 super.InitItemVariables();
6241
6247 m_Count = ConfigGetInt(
"count");
6248
6251
6256
6259
6264
6276
6280
6281
6284 if (ConfigIsExisting("canBeSplit"))
6285 {
6288 }
6289
6291 if (ConfigIsExisting("itemBehaviour"))
6293
6294
6297 RegisterNetSyncVariableInt("m_VarLiquidType");
6298 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6299
6300 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6301 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6302 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6303
6304 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6305 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6306 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6307 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6308
6309 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6310 RegisterNetSyncVariableBool("m_IsTakeable");
6311 RegisterNetSyncVariableBool("m_IsHologram");
6312
6315 {
6318 }
6319
6321
6323 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6325
6326 }
6327
6329 {
6331 }
6332
6334 {
6337 {
6342 }
6343 }
6344
6345 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6346 {
6348 {
6351 }
6352
6354 }
6355
6357 {
6363 }
6364
6366
6368 {
6370
6371 if (!action)
6372 {
6373 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6374 return;
6375 }
6376
6378 if (!ai)
6379 {
6381 return;
6382 }
6383
6385 if (!action_array)
6386 {
6387 action_array = new array<ActionBase_Basic>;
6389 }
6390 if (LogManager.IsActionLogEnable())
6391 {
6392 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6393 }
6394
6395 if (action_array.Find(action) != -1)
6396 {
6397 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6398 }
6399 else
6400 {
6401 action_array.Insert(action);
6402 }
6403 }
6404
6406 {
6408 ActionBase action = player.GetActionManager().GetAction(actionName);
6411
6412 if (action_array)
6413 {
6414 action_array.RemoveItem(action);
6415 }
6416 }
6417
6418
6419
6421 {
6422 ActionOverrideData overrideData = new ActionOverrideData();
6426
6428 if (!actionMap)
6429 {
6432 }
6433
6434 actionMap.Insert(this.
Type(), overrideData);
6435
6436 }
6437
6439
6441
6442
6444 {
6447
6450
6451 string config_to_search = "CfgVehicles";
6452 string muzzle_owner_config;
6453
6455 {
6456 if (IsInherited(Weapon))
6457 config_to_search = "CfgWeapons";
6458
6459 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6460
6461 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6462
6464
6465 if (config_OnFire_subclass_count > 0)
6466 {
6467 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6468
6469 for (int i = 0; i < config_OnFire_subclass_count; i++)
6470 {
6471 string particle_class = "";
6473 string config_OnFire_entry = config_OnFire_class + particle_class;
6474 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6475 WPOF_array.Insert(WPOF);
6476 }
6477
6478
6480 }
6481 }
6482
6484 {
6485 config_to_search = "CfgWeapons";
6486 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6487
6488 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6489
6491
6492 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6493 {
6494 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6495
6496 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6497 {
6498 string particle_class2 = "";
6500 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6501 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6502 WPOBE_array.Insert(WPOBE);
6503 }
6504
6505
6507 }
6508 }
6509 }
6510
6511
6513 {
6516
6518 {
6519 string config_to_search = "CfgVehicles";
6520
6521 if (IsInherited(Weapon))
6522 config_to_search = "CfgWeapons";
6523
6524 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6525 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6526
6527 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6528 {
6529
6531
6533 {
6535 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6537 return;
6538 }
6539
6542
6543
6544
6546 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6547
6548 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6549 {
6550 string particle_class = "";
6552 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6554
6555 if (entry_type == CT_CLASS)
6556 {
6557 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6558 WPOOH_array.Insert(WPOF);
6559 }
6560 }
6561
6562
6564 }
6565 }
6566 }
6567
6569 {
6571 }
6572
6574 {
6576 {
6578
6581
6584
6585 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6586 }
6587 }
6588
6590 {
6592 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6593
6595 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6596
6598 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6599
6601 {
6603 }
6604 }
6605
6607 {
6609 }
6610
6612 {
6615 else
6617
6619 {
6622 }
6623 else
6624 {
6627
6630 }
6631
6633 }
6634
6636 {
6638 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6639 }
6640
6642 {
6644 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6646 }
6647
6649 {
6651 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6652 }
6653
6655 {
6658
6659 OverheatingParticle OP = new OverheatingParticle();
6664
6666 }
6667
6669 {
6672
6673 return -1;
6674 }
6675
6677 {
6679 {
6682
6683 for (int i = count; i > 0; --i)
6684 {
6685 int id = i - 1;
6688
6691
6692 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6693 {
6694 if (p)
6695 {
6698 }
6699 }
6700 }
6701 }
6702 }
6703
6705 {
6707 {
6709 {
6710 int id = i - 1;
6712
6713 if (OP)
6714 {
6716
6717 if (p)
6718 {
6720 }
6721
6722 delete OP;
6723 }
6724 }
6725
6728 }
6729 }
6730
6733 {
6734 return 0.0;
6735 }
6736
6737
6739 {
6740 return 250;
6741 }
6742
6744 {
6745 return 0;
6746 }
6747
6750 {
6752 return true;
6753
6754 return false;
6755 }
6756
6759 {
6762
6764 {
6766 }
6767 else
6768 {
6769
6771 }
6772
6774 }
6775
6782 {
6783 return -1;
6784 }
6785
6786
6787
6788
6790 {
6792 {
6794 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6795
6796 if (r_index >= 0)
6797 {
6798 InventoryLocation r_il = new InventoryLocation;
6799 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6800
6801 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6804 {
6805 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6806 }
6808 {
6809 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6810 }
6811
6812 }
6813
6814 player.GetHumanInventory().ClearUserReservedLocation(this);
6815 }
6816
6819 }
6820
6821
6822
6823
6825 {
6826 return ItemBase.m_DebugActionsMask;
6827 }
6828
6830 {
6831 return ItemBase.m_DebugActionsMask & mask;
6832 }
6833
6835 {
6836 ItemBase.m_DebugActionsMask = mask;
6837 }
6838
6840 {
6841 ItemBase.m_DebugActionsMask |= mask;
6842 }
6843
6845 {
6846 ItemBase.m_DebugActionsMask &= ~mask;
6847 }
6848
6850 {
6852 {
6854 }
6855 else
6856 {
6858 }
6859 }
6860
6861
6863 {
6864 if (GetEconomyProfile())
6865 {
6866 float q_max = GetEconomyProfile().GetQuantityMax();
6867 if (q_max > 0)
6868 {
6869 float q_min = GetEconomyProfile().GetQuantityMin();
6870 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6871
6873 {
6874 ComponentEnergyManager comp = GetCompEM();
6876 {
6878 }
6879 }
6881 {
6883
6884 }
6885
6886 }
6887 }
6888 }
6889
6892 {
6893 EntityAI parent = GetHierarchyParent();
6894
6895 if (parent)
6896 {
6897 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6898 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6899 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6900 }
6901 }
6902
6905 {
6906 EntityAI parent = GetHierarchyParent();
6907
6908 if (parent)
6909 {
6910 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6911 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6912 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6913 }
6914 }
6915
6917 {
6918
6919
6920
6921
6923
6925 {
6926 if (ScriptInputUserData.CanStoreInputUserData())
6927 {
6928 ScriptInputUserData ctx = new ScriptInputUserData;
6934 ctx.
Write(use_stack_max);
6937
6939 {
6940 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6941 }
6942 }
6943 }
6944 else if (!
GetGame().IsMultiplayer())
6945 {
6947 }
6948 }
6949
6951 {
6953 }
6954
6956 {
6958 }
6959
6961 {
6963 }
6964
6966 {
6967
6968 return false;
6969 }
6970
6972 {
6973 return false;
6974 }
6975
6979 {
6980 return false;
6981 }
6982
6984 {
6985 return "";
6986 }
6987
6989
6991 {
6992 return false;
6993 }
6994
6996 {
6997 return true;
6998 }
6999
7000
7001
7003 {
7004 return true;
7005 }
7006
7008 {
7009 return true;
7010 }
7011
7013 {
7014 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7016 }
7017
7019 {
7021 }
7022
7024 {
7026 if (!is_being_placed)
7028 SetSynchDirty();
7029 }
7030
7031
7033
7035 {
7037 }
7038
7040 {
7042 }
7043
7045 {
7046 return 1;
7047 }
7048
7050 {
7051 return false;
7052 }
7053
7055 {
7057 SetSynchDirty();
7058 }
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7095 {
7096 super.OnMovedInsideCargo(container);
7097
7098 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7099 }
7100
7101 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7102 {
7103 super.EEItemLocationChanged(oldLoc,newLoc);
7104
7105 PlayerBase new_player = null;
7106 PlayerBase old_player = null;
7107
7108 if (newLoc.GetParent())
7109 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7110
7111 if (oldLoc.GetParent())
7112 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7113
7115 {
7116 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7117
7118 if (r_index >= 0)
7119 {
7120 InventoryLocation r_il = new InventoryLocation;
7121 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7122
7123 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7126 {
7127 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7128 }
7130 {
7131 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7132 }
7133
7134 }
7135 }
7136
7138 {
7139 if (new_player)
7140 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7141
7142 if (new_player == old_player)
7143 {
7144
7145 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7146 {
7148 {
7149 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7150 {
7151 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7152 }
7153 }
7154 else
7155 {
7156 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7157 }
7158 }
7159
7160 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7161 {
7162 int type = oldLoc.GetType();
7164 {
7165 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7166 }
7168 {
7169 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7170 }
7171 }
7172 if (!m_OldLocation)
7173 {
7174 m_OldLocation = new InventoryLocation;
7175 }
7176 m_OldLocation.Copy(oldLoc);
7177 }
7178 else
7179 {
7180 if (m_OldLocation)
7181 {
7182 m_OldLocation.Reset();
7183 }
7184 }
7185
7187 }
7188 else
7189 {
7190 if (new_player)
7191 {
7192 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7193 if (res_index >= 0)
7194 {
7195 InventoryLocation il = new InventoryLocation;
7196 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7198 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7201 {
7202 il.
GetParent().GetOnReleaseLock().Invoke(it);
7203 }
7205 {
7207 }
7208
7209 }
7210 }
7212 {
7213
7215 }
7216
7217 if (m_OldLocation)
7218 {
7219 m_OldLocation.Reset();
7220 }
7221 }
7222 }
7223
7224 override void EOnContact(IEntity other, Contact extra)
7225 {
7227 {
7228 int liquidType = -1;
7230 if (impactSpeed > 0.0)
7231 {
7233 #ifndef SERVER
7235 #else
7237 SetSynchDirty();
7238 #endif
7240 }
7241 }
7242
7243 #ifdef SERVER
7244 if (GetCompEM() && GetCompEM().IsPlugged())
7245 {
7246 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7247 GetCompEM().UnplugThis();
7248 }
7249 #endif
7250 }
7251
7253
7255 {
7257 }
7258
7260 {
7261
7262 }
7263
7265 {
7266 super.OnItemLocationChanged(old_owner, new_owner);
7267
7268 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7269 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7270
7271 if (!relatedPlayer && playerNew)
7272 relatedPlayer = playerNew;
7273
7274 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7275 {
7277 if (actionMgr)
7278 {
7279 ActionBase currentAction = actionMgr.GetRunningAction();
7280 if (currentAction)
7282 }
7283 }
7284
7285 Man ownerPlayerOld = null;
7286 Man ownerPlayerNew = null;
7287
7288 if (old_owner)
7289 {
7290 if (old_owner.
IsMan())
7291 {
7292 ownerPlayerOld = Man.Cast(old_owner);
7293 }
7294 else
7295 {
7296 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7297 }
7298 }
7299 else
7300 {
7302 {
7304
7305 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7306 {
7307 GetCompEM().UnplugThis();
7308 }
7309 }
7310 }
7311
7312 if (new_owner)
7313 {
7314 if (new_owner.
IsMan())
7315 {
7316 ownerPlayerNew = Man.Cast(new_owner);
7317 }
7318 else
7319 {
7320 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7321 }
7322 }
7323
7324 if (ownerPlayerOld != ownerPlayerNew)
7325 {
7326 if (ownerPlayerOld)
7327 {
7328 array<EntityAI> subItemsExit = new array<EntityAI>;
7330 for (int i = 0; i < subItemsExit.Count(); i++)
7331 {
7334 }
7335 }
7336
7337 if (ownerPlayerNew)
7338 {
7339 array<EntityAI> subItemsEnter = new array<EntityAI>;
7341 for (int j = 0; j < subItemsEnter.Count(); j++)
7342 {
7345 }
7346 }
7347 }
7348 else if (ownerPlayerNew != null)
7349 {
7350 PlayerBase nplayer;
7351 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7352 {
7353 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7355 for (int k = 0; k < subItemsUpdate.Count(); k++)
7356 {
7358 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7359 }
7360 }
7361 }
7362
7363 if (old_owner)
7364 old_owner.OnChildItemRemoved(this);
7365 if (new_owner)
7366 new_owner.OnChildItemReceived(this);
7367 }
7368
7369
7371 {
7372 super.EEDelete(parent);
7373 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7374 if (player)
7375 {
7377
7378 if (player.IsAlive())
7379 {
7380 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7381 if (r_index >= 0)
7382 {
7383 InventoryLocation r_il = new InventoryLocation;
7384 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7385
7386 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7389 {
7390 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7391 }
7393 {
7394 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7395 }
7396
7397 }
7398
7399 player.RemoveQuickBarEntityShortcut(this);
7400 }
7401 }
7402 }
7403
7405 {
7406 super.EEKilled(killer);
7407
7410 {
7411 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7412 {
7413 if (IsMagazine())
7414 {
7415 if (Magazine.Cast(this).GetAmmoCount() > 0)
7416 {
7418 }
7419 }
7420 else
7421 {
7423 }
7424 }
7425 }
7426 }
7427
7429 {
7430 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7431
7432 super.OnWasAttached(parent, slot_id);
7433
7436
7438 }
7439
7441 {
7442 super.OnWasDetached(parent, slot_id);
7443
7446 }
7447
7449 {
7450 int idx;
7453
7454 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7455 if (inventory_slots.Count() < 1)
7456 {
7457 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7458 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7459 }
7460 else
7461 {
7462 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7463 }
7464
7465 idx = inventory_slots.Find(slot);
7466 if (idx < 0)
7467 return "";
7468
7469 return attach_types.Get(idx);
7470 }
7471
7473 {
7474 int idx = -1;
7475 string slot;
7476
7479
7480 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7481 if (inventory_slots.Count() < 1)
7482 {
7483 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7484 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7485 }
7486 else
7487 {
7488 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7489 if (detach_types.Count() < 1)
7490 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7491 }
7492
7493 for (int i = 0; i < inventory_slots.Count(); i++)
7494 {
7495 slot = inventory_slots.Get(i);
7496 }
7497
7498 if (slot != "")
7499 {
7500 if (detach_types.Count() == 1)
7501 idx = 0;
7502 else
7503 idx = inventory_slots.Find(slot);
7504 }
7505 if (idx < 0)
7506 return "";
7507
7508 return detach_types.Get(idx);
7509 }
7510
7512 {
7513
7515
7516
7517 float min_time = 1;
7518 float max_time = 3;
7519 float delay = Math.RandomFloat(min_time, max_time);
7520
7521 explode_timer.Run(delay, this, "DoAmmoExplosion");
7522 }
7523
7525 {
7526 Magazine magazine = Magazine.Cast(this);
7527 int pop_sounds_count = 6;
7528 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7529
7530
7531 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7532 string sound_name = pop_sounds[ sound_idx ];
7534
7535
7536 magazine.ServerAddAmmoCount(-1);
7537
7538
7539 float min_temp_to_explode = 100;
7540
7541 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7542 {
7544 }
7545 }
7546
7547
7548 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7549 {
7550 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7551
7552 const int CHANCE_DAMAGE_CARGO = 4;
7553 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7554 const int CHANCE_DAMAGE_NOTHING = 2;
7555
7557 {
7558 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7559 int chances;
7560 int rnd;
7561
7562 if (GetInventory().GetCargo())
7563 {
7564 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7565 rnd = Math.RandomInt(0,chances);
7566
7567 if (rnd < CHANCE_DAMAGE_CARGO)
7568 {
7570 }
7571 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7572 {
7574 }
7575 }
7576 else
7577 {
7578 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7579 rnd = Math.RandomInt(0,chances);
7580
7581 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7582 {
7584 }
7585 }
7586 }
7587 }
7588
7590 {
7591 if (GetInventory().GetCargo())
7592 {
7593 int item_count = GetInventory().GetCargo().GetItemCount();
7594 if (item_count > 0)
7595 {
7596 int random_pick = Math.RandomInt(0, item_count);
7598 if (!item.IsExplosive())
7599 {
7600 item.AddHealth("","",damage);
7601 return true;
7602 }
7603 }
7604 }
7605 return false;
7606 }
7607
7609 {
7610 int attachment_count = GetInventory().AttachmentCount();
7611 if (attachment_count > 0)
7612 {
7613 int random_pick = Math.RandomInt(0, attachment_count);
7614 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7615 if (!attachment.IsExplosive())
7616 {
7617 attachment.AddHealth("","",damage);
7618 return true;
7619 }
7620 }
7621 return false;
7622 }
7623
7625 {
7627 }
7628
7630 {
7632 return GetInventory().CanRemoveEntity();
7633
7634 return false;
7635 }
7636
7638 {
7639
7641 return false;
7642
7643
7645 return false;
7646
7647
7648
7650 if (delta == 0)
7651 return false;
7652
7653
7654 return true;
7655 }
7656
7658 {
7660 {
7661 if (ScriptInputUserData.CanStoreInputUserData())
7662 {
7663 ScriptInputUserData ctx = new ScriptInputUserData;
7668 ctx.
Write(destination_entity);
7672 }
7673 }
7674 else if (!
GetGame().IsMultiplayer())
7675 {
7677 }
7678 }
7679
7681 {
7682 float split_quantity_new;
7686 InventoryLocation loc = new InventoryLocation;
7687
7688 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7689 {
7691 split_quantity_new = stack_max;
7692 else
7694
7696 {
7697 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7698 if (new_item)
7699 {
7700 new_item.SetResultOfSplit(true);
7701 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7703 new_item.
SetQuantity(split_quantity_new,
false,
true);
7704 }
7705 }
7706 }
7707 else if (destination_entity && slot_id == -1)
7708 {
7709 if (quantity > stack_max)
7710 split_quantity_new = stack_max;
7711 else
7712 split_quantity_new = quantity;
7713
7715 {
7717 {
7720 }
7721
7722 if (new_item)
7723 {
7724 new_item.SetResultOfSplit(true);
7725 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7727 new_item.
SetQuantity(split_quantity_new,
false,
true);
7728 }
7729 }
7730 }
7731 else
7732 {
7733 if (stack_max != 0)
7734 {
7736 {
7738 }
7739
7740 if (split_quantity_new == 0)
7741 {
7742 if (!
GetGame().IsMultiplayer())
7743 player.PhysicalPredictiveDropItem(this);
7744 else
7745 player.ServerDropEntity(this);
7746 return;
7747 }
7748
7750 {
7752
7753 if (new_item)
7754 {
7755 new_item.SetResultOfSplit(true);
7756 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7759 new_item.PlaceOnSurface();
7760 }
7761 }
7762 }
7763 }
7764 }
7765
7767 {
7768 float split_quantity_new;
7772 InventoryLocation loc = new InventoryLocation;
7773
7774 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7775 {
7777 split_quantity_new = stack_max;
7778 else
7780
7782 {
7783 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7784 if (new_item)
7785 {
7786 new_item.SetResultOfSplit(true);
7787 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7789 new_item.
SetQuantity(split_quantity_new,
false,
true);
7790 }
7791 }
7792 }
7793 else if (destination_entity && slot_id == -1)
7794 {
7795 if (quantity > stack_max)
7796 split_quantity_new = stack_max;
7797 else
7798 split_quantity_new = quantity;
7799
7801 {
7803 {
7806 }
7807
7808 if (new_item)
7809 {
7810 new_item.SetResultOfSplit(true);
7811 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7813 new_item.
SetQuantity(split_quantity_new,
false,
true);
7814 }
7815 }
7816 }
7817 else
7818 {
7819 if (stack_max != 0)
7820 {
7822 {
7824 }
7825
7827 {
7829
7830 if (new_item)
7831 {
7832 new_item.SetResultOfSplit(true);
7833 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7836 new_item.PlaceOnSurface();
7837 }
7838 }
7839 }
7840 }
7841 }
7842
7844 {
7846 {
7847 if (ScriptInputUserData.CanStoreInputUserData())
7848 {
7849 ScriptInputUserData ctx = new ScriptInputUserData;
7854 dst.WriteToContext(ctx);
7856 }
7857 }
7858 else if (!
GetGame().IsMultiplayer())
7859 {
7861 }
7862 }
7863
7865 {
7867 {
7868 if (ScriptInputUserData.CanStoreInputUserData())
7869 {
7870 ScriptInputUserData ctx = new ScriptInputUserData;
7875 ctx.
Write(destination_entity);
7881 }
7882 }
7883 else if (!
GetGame().IsMultiplayer())
7884 {
7886 }
7887 }
7888
7890 {
7892 }
7893
7895 {
7897 float split_quantity_new;
7899 if (dst.IsValid())
7900 {
7901 int slot_id = dst.GetSlot();
7903
7904 if (quantity > stack_max)
7905 split_quantity_new = stack_max;
7906 else
7907 split_quantity_new = quantity;
7908
7910 {
7912
7913 if (new_item)
7914 {
7915 new_item.SetResultOfSplit(true);
7916 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7918 new_item.
SetQuantity(split_quantity_new,
false,
true);
7919 }
7920
7921 return new_item;
7922 }
7923 }
7924
7925 return null;
7926 }
7927
7929 {
7931 float split_quantity_new;
7933 if (destination_entity)
7934 {
7936 if (quantity > stackable)
7937 split_quantity_new = stackable;
7938 else
7939 split_quantity_new = quantity;
7940
7942 {
7943 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7944 if (new_item)
7945 {
7946 new_item.SetResultOfSplit(true);
7947 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7949 new_item.
SetQuantity(split_quantity_new,
false,
true);
7950 }
7951 }
7952 }
7953 }
7954
7956 {
7958 {
7959 if (ScriptInputUserData.CanStoreInputUserData())
7960 {
7961 ScriptInputUserData ctx = new ScriptInputUserData;
7966 ItemBase destination_entity =
this;
7967 ctx.
Write(destination_entity);
7971 }
7972 }
7973 else if (!
GetGame().IsMultiplayer())
7974 {
7976 }
7977 }
7978
7980 {
7982 float split_quantity_new;
7984 if (player)
7985 {
7987 if (quantity > stackable)
7988 split_quantity_new = stackable;
7989 else
7990 split_quantity_new = quantity;
7991
7993 {
7994 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7995 new_item =
ItemBase.Cast(in_hands);
7996 if (new_item)
7997 {
7998 new_item.SetResultOfSplit(true);
7999 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8001 new_item.SetQuantity(split_quantity_new, false, true);
8002 }
8003 }
8004 }
8005 }
8006
8008 {
8010 float split_quantity_new = Math.Floor(quantity * 0.5);
8011
8013 return;
8014
8016
8017 if (new_item)
8018 {
8019 if (new_item.GetQuantityMax() < split_quantity_new)
8020 {
8021 split_quantity_new = new_item.GetQuantityMax();
8022 }
8023
8024 new_item.SetResultOfSplit(true);
8025 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8026
8028 {
8031 }
8032 else
8033 {
8035 new_item.
SetQuantity(split_quantity_new,
false,
true);
8036 }
8037 }
8038 }
8039
8041 {
8043 float split_quantity_new = Math.Floor(quantity / 2);
8044
8046 return;
8047
8048 InventoryLocation invloc = new InventoryLocation;
8050
8052 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8053
8054 if (new_item)
8055 {
8056 if (new_item.GetQuantityMax() < split_quantity_new)
8057 {
8058 split_quantity_new = new_item.GetQuantityMax();
8059 }
8061 {
8064 }
8065 else if (split_quantity_new > 1)
8066 {
8068 new_item.
SetQuantity(split_quantity_new,
false,
true);
8069 }
8070 }
8071 }
8072
8075 {
8076 SetWeightDirty();
8078
8079 if (parent)
8080 parent.OnAttachmentQuantityChangedEx(this, delta);
8081
8083 {
8085 {
8087 }
8089 {
8090 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8092 }
8093 }
8094
8095 }
8096
8099 {
8100
8101 }
8102
8105 {
8107 }
8108
8110 {
8111 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8112
8114 {
8115 if (newLevel == GameConstants.STATE_RUINED)
8116 {
8118 EntityAI parent = GetHierarchyParent();
8119 if (parent && parent.IsFireplace())
8120 {
8121 CargoBase cargo = GetInventory().GetCargo();
8122 if (cargo)
8123 {
8125 {
8127 }
8128 }
8129 }
8130 }
8131
8133 {
8134
8136 return;
8137 }
8138
8139 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8140 {
8142 }
8143 }
8144 }
8145
8146
8148 {
8149 super.OnRightClick();
8150
8152 {
8154 {
8155 if (ScriptInputUserData.CanStoreInputUserData())
8156 {
8157 EntityAI root = GetHierarchyRoot();
8158 Man playerOwner = GetHierarchyRootPlayer();
8159 InventoryLocation dst = new InventoryLocation;
8160
8161
8162 if (!playerOwner && root && root == this)
8163 {
8165 }
8166 else
8167 {
8168
8169 GetInventory().GetCurrentInventoryLocation(dst);
8171 {
8174 {
8176 }
8177 else
8178 {
8180
8181
8182 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8183 {
8185 }
8186 else
8187 {
8188 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8189 }
8190 }
8191 }
8192 }
8193
8194 ScriptInputUserData ctx = new ScriptInputUserData;
8202 }
8203 }
8204 else if (!
GetGame().IsMultiplayer())
8205 {
8207 }
8208 }
8209 }
8210
8212 {
8213 if (root)
8214 {
8215 vector m4[4];
8216 root.GetTransform(m4);
8217 dst.SetGround(this, m4);
8218 }
8219 else
8220 {
8221 GetInventory().GetCurrentInventoryLocation(dst);
8222 }
8223 }
8224
8225 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8226 {
8227
8228 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8229 return false;
8230
8231 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8232 return false;
8233
8234
8236 return false;
8237
8238
8239 Magazine mag = Magazine.Cast(this);
8240 if (mag)
8241 {
8242 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8243 return false;
8244
8245 if (stack_max_limit)
8246 {
8247 Magazine other_mag = Magazine.Cast(other_item);
8248 if (other_item)
8249 {
8250 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8251 return false;
8252 }
8253
8254 }
8255 }
8256 else
8257 {
8258
8260 return false;
8261
8263 return false;
8264 }
8265
8266 PlayerBase player = null;
8267 if (CastTo(player, GetHierarchyRootPlayer()))
8268 {
8269 if (player.GetInventory().HasAttachment(this))
8270 return false;
8271
8272 if (player.IsItemsToDelete())
8273 return false;
8274 }
8275
8276 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8277 return false;
8278
8279 int slotID;
8281 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8282 return false;
8283
8284 return true;
8285 }
8286
8288 {
8290 }
8291
8293 {
8294 return m_IsResultOfSplit;
8295 }
8296
8298 {
8299 m_IsResultOfSplit = value;
8300 }
8301
8303 {
8305 }
8306
8308 {
8309 float other_item_quantity = other_item.GetQuantity();
8310 float this_free_space;
8311
8313
8315
8316 if (other_item_quantity > this_free_space)
8317 {
8318 return this_free_space;
8319 }
8320 else
8321 {
8322 return other_item_quantity;
8323 }
8324 }
8325
8327 {
8329 }
8330
8332 {
8334 return;
8335
8336 if (!IsMagazine() && other_item)
8337 {
8339 if (quantity_used != 0)
8340 {
8341 float hp1 = GetHealth01("","");
8342 float hp2 = other_item.GetHealth01("","");
8343 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8344 hpResult = hpResult / (
GetQuantity() + quantity_used);
8345
8346 hpResult *= GetMaxHealth();
8347 Math.Round(hpResult);
8348 SetHealth("", "Health", hpResult);
8349
8351 other_item.AddQuantity(-quantity_used);
8352 }
8353 }
8355 }
8356
8358 {
8359 #ifdef SERVER
8360 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8361 GetHierarchyParent().IncreaseLifetimeUp();
8362 #endif
8363 };
8364
8366 {
8367 PlayerBase p = PlayerBase.Cast(player);
8368
8369 array<int> recipesIds = p.m_Recipes;
8370 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8371 if (moduleRecipesManager)
8372 {
8373 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8374 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8375 }
8376
8377 for (int i = 0;i < recipesIds.Count(); i++)
8378 {
8379 int key = recipesIds.Get(i);
8380 string recipeName = moduleRecipesManager.GetRecipeName(key);
8382 }
8383 }
8384
8385
8386 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8387 {
8388 super.GetDebugActions(outputList);
8389
8390
8396
8397
8402
8407
8408
8412
8413
8415 {
8419 }
8420
8423
8424
8428
8430
8431 InventoryLocation loc = new InventoryLocation();
8432 GetInventory().GetCurrentInventoryLocation(loc);
8434 {
8435 if (Gizmo_IsSupported())
8438 }
8439
8441 }
8442
8443
8444
8445
8447 {
8448 super.OnAction(action_id, player, ctx);
8449
8451 {
8452 switch (action_id)
8453 {
8456 return true;
8459 return true;
8460 }
8461 }
8462
8464 {
8465 switch (action_id)
8466 {
8468 Delete();
8469 return true;
8470 }
8471 }
8472
8473 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8474 {
8475 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8476 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8477 PlayerBase p = PlayerBase.Cast(player);
8478 if (
EActions.RECIPES_RANGE_START < 1000)
8479 {
8480 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8481 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8482 }
8483 }
8484 #ifndef SERVER
8485 else if (action_id ==
EActions.WATCH_PLAYER)
8486 {
8487 PluginDeveloper.SetDeveloperItemClientEx(player);
8488 }
8489 #endif
8491 {
8492 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8493 {
8494 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8495 OnDebugButtonPressServer(id + 1);
8496 }
8497
8498 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8499 {
8500 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8502 }
8503
8504 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8505 {
8506 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8508 }
8509
8510 else if (action_id ==
EActions.ADD_QUANTITY)
8511 {
8512 if (IsMagazine())
8513 {
8514 Magazine mag = Magazine.Cast(this);
8515 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8516 }
8517 else
8518 {
8520 }
8521
8522 if (m_EM)
8523 {
8524 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8525 }
8526
8527 }
8528
8529 else if (action_id ==
EActions.REMOVE_QUANTITY)
8530 {
8531 if (IsMagazine())
8532 {
8533 Magazine mag2 = Magazine.Cast(this);
8534 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8535 }
8536 else
8537 {
8539 }
8540 if (m_EM)
8541 {
8542 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8543 }
8544
8545 }
8546
8547 else if (action_id ==
EActions.SET_QUANTITY_0)
8548 {
8550
8551 if (m_EM)
8552 {
8553 m_EM.SetEnergy(0);
8554 }
8555 }
8556
8557 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8558 {
8560
8561 if (m_EM)
8562 {
8563 m_EM.SetEnergy(m_EM.GetEnergyMax());
8564 }
8565 }
8566
8567 else if (action_id ==
EActions.ADD_HEALTH)
8568 {
8569 AddHealth("","",GetMaxHealth("","Health")/5);
8570 }
8571 else if (action_id ==
EActions.REMOVE_HEALTH)
8572 {
8573 AddHealth("","",-GetMaxHealth("","Health")/5);
8574 }
8575 else if (action_id ==
EActions.DESTROY_HEALTH)
8576 {
8577 SetHealth01("","",0);
8578 }
8579 else if (action_id ==
EActions.WATCH_ITEM)
8580 {
8582 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8583 #ifdef DEVELOPER
8584 SetDebugDeveloper_item(this);
8585 #endif
8586 }
8587
8588 else if (action_id ==
EActions.ADD_TEMPERATURE)
8589 {
8590 AddTemperature(20);
8591
8592 }
8593
8594 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8595 {
8596 AddTemperature(-20);
8597
8598 }
8599
8600 else if (action_id ==
EActions.FLIP_FROZEN)
8601 {
8602 SetFrozen(!GetIsFrozen());
8603
8604 }
8605
8606 else if (action_id ==
EActions.ADD_WETNESS)
8607 {
8609
8610 }
8611
8612 else if (action_id ==
EActions.REMOVE_WETNESS)
8613 {
8615
8616 }
8617
8618 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8619 {
8622
8623
8624 }
8625
8626 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8627 {
8630 }
8631
8632 else if (action_id ==
EActions.MAKE_SPECIAL)
8633 {
8634 auto debugParams = DebugSpawnParams.WithPlayer(player);
8635 OnDebugSpawnEx(debugParams);
8636 }
8637
8638 }
8639
8640
8641 return false;
8642 }
8643
8644
8645
8646
8650
8653
8654
8655
8657 {
8658 return false;
8659 }
8660
8661
8663 {
8664 return true;
8665 }
8666
8667
8669 {
8670 return true;
8671 }
8672
8673
8674
8676 {
8677 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8679 }
8680
8683 {
8684 return null;
8685 }
8686
8688 {
8689 return false;
8690 }
8691
8693 {
8694 return false;
8695 }
8696
8700
8701
8703 {
8704 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8705 return module_repairing.CanRepair(this, item_repair_kit);
8706 }
8707
8708
8709 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8710 {
8711 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8712 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8713 }
8714
8715
8717 {
8718
8719
8720
8721
8722
8723
8724
8725
8726 return 1;
8727 }
8728
8729
8730
8732 {
8734 }
8735
8736
8737
8739 {
8741 }
8742
8743
8752 {
8753 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8754
8755 if (player)
8756 {
8757 player.MessageStatus(text);
8758 }
8759 }
8760
8761
8770 {
8771 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8772
8773 if (player)
8774 {
8775 player.MessageAction(text);
8776 }
8777 }
8778
8779
8788 {
8789 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8790
8791 if (player)
8792 {
8793 player.MessageFriendly(text);
8794 }
8795 }
8796
8797
8806 {
8807 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8808
8809 if (player)
8810 {
8811 player.MessageImportant(text);
8812 }
8813 }
8814
8816 {
8817 return true;
8818 }
8819
8820
8821 override bool KindOf(
string tag)
8822 {
8823 bool found = false;
8824 string item_name = this.
GetType();
8827
8828 int array_size = item_tag_array.Count();
8829 for (int i = 0; i < array_size; i++)
8830 {
8831 if (item_tag_array.Get(i) == tag)
8832 {
8833 found = true;
8834 break;
8835 }
8836 }
8837 return found;
8838 }
8839
8840
8842 {
8843
8844 super.OnRPC(sender, rpc_type,ctx);
8845
8846
8847 switch (rpc_type)
8848 {
8849 #ifndef SERVER
8850 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8851 Param2<bool, string> p = new Param2<bool, string>(false, "");
8852
8854 return;
8855
8856 bool play = p.param1;
8857 string soundSet = p.param2;
8858
8859 if (play)
8860 {
8862 {
8864 {
8866 }
8867 }
8868 else
8869 {
8871 }
8872 }
8873 else
8874 {
8876 }
8877
8878 break;
8879 #endif
8880
8881 }
8882
8884 {
8886 }
8887 }
8888
8889
8890
8891
8893 {
8894 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8895 return plugin.GetID(
name);
8896 }
8897
8899 {
8900 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8901 return plugin.GetName(id);
8902 }
8903
8906 {
8907
8908
8909 int varFlags;
8910 if (!ctx.
Read(varFlags))
8911 return;
8912
8913 if (varFlags & ItemVariableFlags.FLOAT)
8914 {
8916 }
8917 }
8918
8920 {
8921
8922 super.SerializeNumericalVars(floats_out);
8923
8924
8925
8927 {
8929 }
8930
8932 {
8934 }
8935
8937 {
8939 }
8940
8942 {
8947 }
8948
8950 {
8952 }
8953 }
8954
8956 {
8957
8958 super.DeSerializeNumericalVars(floats);
8959
8960
8961 int index = 0;
8962 int mask = Math.Round(floats.Get(index));
8963
8964 index++;
8965
8967 {
8969 {
8971 }
8972 else
8973 {
8974 float quantity = floats.Get(index);
8976 }
8977 index++;
8978 }
8979
8981 {
8982 float wet = floats.Get(index);
8984 index++;
8985 }
8986
8988 {
8989 int liquidtype = Math.Round(floats.Get(index));
8991 index++;
8992 }
8993
8995 {
8997 index++;
8999 index++;
9001 index++;
9003 index++;
9004 }
9005
9007 {
9008 int cleanness = Math.Round(floats.Get(index));
9010 index++;
9011 }
9012 }
9013
9015 {
9016 super.WriteVarsToCTX(ctx);
9017
9018
9020 {
9022 }
9023
9025 {
9027 }
9028
9030 {
9032 }
9033
9035 {
9036 int r,g,b,a;
9042 }
9043
9045 {
9047 }
9048 }
9049
9051 {
9052 if (!super.ReadVarsFromCTX(ctx,version))
9053 return false;
9054
9055 int intValue;
9056 float value;
9057
9058 if (version < 140)
9059 {
9060 if (!ctx.
Read(intValue))
9061 return false;
9062
9063 m_VariablesMask = intValue;
9064 }
9065
9067 {
9068 if (!ctx.
Read(value))
9069 return false;
9070
9072 {
9074 }
9075 else
9076 {
9078 }
9079 }
9080
9081 if (version < 140)
9082 {
9084 {
9085 if (!ctx.
Read(value))
9086 return false;
9087 SetTemperatureDirect(value);
9088 }
9089 }
9090
9092 {
9093 if (!ctx.
Read(value))
9094 return false;
9096 }
9097
9099 {
9100 if (!ctx.
Read(intValue))
9101 return false;
9103 }
9104
9106 {
9107 int r,g,b,a;
9109 return false;
9111 return false;
9113 return false;
9115 return false;
9116
9118 }
9119
9121 {
9122 if (!ctx.
Read(intValue))
9123 return false;
9125 }
9126
9127 if (version >= 138 && version < 140)
9128 {
9130 {
9131 if (!ctx.
Read(intValue))
9132 return false;
9133 SetFrozen(intValue);
9134 }
9135 }
9136
9137 return true;
9138 }
9139
9140
9142 {
9145 {
9147 }
9148
9149 if (!super.OnStoreLoad(ctx, version))
9150 {
9152 return false;
9153 }
9154
9155 if (version >= 114)
9156 {
9157 bool hasQuickBarIndexSaved;
9158
9159 if (!ctx.
Read(hasQuickBarIndexSaved))
9160 {
9162 return false;
9163 }
9164
9165 if (hasQuickBarIndexSaved)
9166 {
9167 int itmQBIndex;
9168
9169
9170 if (!ctx.
Read(itmQBIndex))
9171 {
9173 return false;
9174 }
9175
9176 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9177 if (itmQBIndex != -1 && parentPlayer)
9178 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9179 }
9180 }
9181 else
9182 {
9183
9184 PlayerBase player;
9185 int itemQBIndex;
9186 if (version ==
int.
MAX)
9187 {
9188 if (!ctx.
Read(itemQBIndex))
9189 {
9191 return false;
9192 }
9193 }
9194 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9195 {
9196
9197 if (!ctx.
Read(itemQBIndex))
9198 {
9200 return false;
9201 }
9202 if (itemQBIndex != -1 && player)
9203 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9204 }
9205 }
9206
9207 if (version < 140)
9208 {
9209
9210 if (!LoadVariables(ctx, version))
9211 {
9213 return false;
9214 }
9215 }
9216
9217
9219 {
9221 return false;
9222 }
9223 if (version >= 132)
9224 {
9226 if (raib)
9227 {
9229 {
9231 return false;
9232 }
9233 }
9234 }
9235
9237 return true;
9238 }
9239
9240
9241
9243 {
9244 super.OnStoreSave(ctx);
9245
9246 PlayerBase player;
9247 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9248 {
9250
9251 int itemQBIndex = -1;
9252 itemQBIndex = player.FindQuickBarEntityIndex(this);
9253 ctx.
Write(itemQBIndex);
9254 }
9255 else
9256 {
9258 }
9259
9261
9263 if (raib)
9264 {
9266 }
9267 }
9268
9269
9271 {
9272 super.AfterStoreLoad();
9273
9275 {
9277 }
9278
9280 {
9283 }
9284 }
9285
9287 {
9288 super.EEOnAfterLoad();
9289
9291 {
9293 }
9294
9297 }
9298
9300 {
9301 return false;
9302 }
9303
9304
9305
9307 {
9309 {
9310 #ifdef PLATFORM_CONSOLE
9311
9313 {
9315 if (menu)
9316 {
9318 }
9319 }
9320 #endif
9321 }
9322
9324 {
9327 }
9328
9330 {
9331 SetWeightDirty();
9333 }
9335 {
9338 }
9339
9341 {
9344 }
9346 {
9349 }
9350
9351 super.OnVariablesSynchronized();
9352 }
9353
9354
9355
9357 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9358 {
9359 if (!IsServerCheck(allow_client))
9360 return false;
9361
9363 return false;
9364
9367
9368 if (value <= (min + 0.001))
9369 value = min;
9370
9371 if (value == min)
9372 {
9373 if (destroy_config)
9374 {
9375 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9376 if (dstr)
9377 {
9379 this.Delete();
9380 return true;
9381 }
9382 }
9383 else if (destroy_forced)
9384 {
9386 this.Delete();
9387 return true;
9388 }
9389
9391 }
9392
9395
9397 {
9399
9400 if (delta)
9402 }
9403
9405
9406 return false;
9407 }
9408
9409
9411 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9412 {
9414 }
9415
9417 {
9420 }
9421
9423 {
9426 }
9427
9429 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9430 {
9431 float value_clamped = Math.Clamp(value, 0, 1);
9433 SetQuantity(result, destroy_config, destroy_forced);
9434 }
9435
9436
9439 {
9441 }
9442
9444 {
9446 }
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9458 {
9459 int slot = -1;
9460 if (GetInventory())
9461 {
9462 InventoryLocation il = new InventoryLocation;
9463 GetInventory().GetCurrentInventoryLocation(il);
9465 }
9466
9468 }
9469
9471 {
9472 float quantity_max = 0;
9473
9475 {
9476 if (attSlotID != -1)
9477 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9478
9479 if (quantity_max <= 0)
9481 }
9482
9483 if (quantity_max <= 0)
9485
9486 return quantity_max;
9487 }
9488
9490 {
9492 }
9493
9495 {
9497 }
9498
9499
9501 {
9503 }
9504
9506 {
9508 }
9509
9511 {
9513 }
9514
9515
9517 {
9518
9519 float weightEx = GetWeightEx();
9520 float special = GetInventoryAndCargoWeight();
9521 return weightEx - special;
9522 }
9523
9524
9526 {
9528 }
9529
9531 {
9533 {
9534 #ifdef DEVELOPER
9535 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9536 {
9537 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9539 }
9540 #endif
9541
9543 }
9544 else if (HasEnergyManager())
9545 {
9546 #ifdef DEVELOPER
9547 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9548 {
9549 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9550 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9551 }
9552 #endif
9553 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9554 }
9555 else
9556 {
9557 #ifdef DEVELOPER
9558 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9559 {
9560 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9561 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9562 }
9563 #endif
9564 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9565 }
9566 }
9567
9570 {
9571 int item_count = 0;
9573
9574 if (GetInventory().GetCargo() != NULL)
9575 {
9576 item_count = GetInventory().GetCargo().GetItemCount();
9577 }
9578
9579 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9580 {
9581 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9582 if (item)
9583 item_count += item.GetNumberOfItems();
9584 }
9585 return item_count;
9586 }
9587
9590 {
9591 float weight = 0;
9592 float wetness = 1;
9593 if (include_wetness)
9596 {
9597 weight = wetness * m_ConfigWeight;
9598 }
9600 {
9601 weight = 1;
9602 }
9603 return weight;
9604 }
9605
9606
9607
9609 {
9610 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9611 {
9612 GameInventory inv = GetInventory();
9613 array<EntityAI> items = new array<EntityAI>;
9615 for (int i = 0; i < items.Count(); i++)
9616 {
9618 if (item)
9619 {
9621 }
9622 }
9623 }
9624 }
9625
9626
9627
9628
9630 {
9631 float energy = 0;
9632 if (HasEnergyManager())
9633 {
9634 energy = GetCompEM().GetEnergy();
9635 }
9636 return energy;
9637 }
9638
9639
9641 {
9642 super.OnEnergyConsumed();
9643
9645 }
9646
9648 {
9649 super.OnEnergyAdded();
9650
9652 }
9653
9654
9656 {
9657 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9658 {
9660 {
9661 float energy_0to1 = GetCompEM().GetEnergy0To1();
9663 }
9664 }
9665 }
9666
9667
9669 {
9670 return ConfigGetFloat("heatIsolation");
9671 }
9672
9674 {
9676 }
9677
9679 {
9680 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9681 if (
GetGame().ConfigIsExisting(paramPath))
9683
9684 return 0.0;
9685 }
9686
9688 {
9689 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9690 if (
GetGame().ConfigIsExisting(paramPath))
9692
9693 return 0.0;
9694 }
9695
9696 override void SetWet(
float value,
bool allow_client =
false)
9697 {
9698 if (!IsServerCheck(allow_client))
9699 return;
9700
9703
9705
9706 m_VarWet = Math.Clamp(value, min, max);
9707
9709 {
9712 }
9713 }
9714
9715 override void AddWet(
float value)
9716 {
9718 }
9719
9721 {
9723 }
9724
9726 {
9728 }
9729
9731 {
9733 }
9734
9736 {
9738 }
9739
9741 {
9743 }
9744
9746 {
9749 if (newLevel != oldLevel)
9750 {
9752 }
9753 }
9754
9756 {
9757 SetWeightDirty();
9758 }
9759
9761 {
9762 return GetWetLevelInternal(
m_VarWet);
9763 }
9764
9765
9766
9768 {
9770 }
9771
9773 {
9775 }
9776
9778 {
9780 }
9781
9783 {
9785 }
9786
9787
9788
9790 {
9791 if (ConfigIsExisting("itemModelLength"))
9792 {
9793 return ConfigGetFloat("itemModelLength");
9794 }
9795 return 0;
9796 }
9797
9799 {
9800 if (ConfigIsExisting("itemAttachOffset"))
9801 {
9802 return ConfigGetFloat("itemAttachOffset");
9803 }
9804 return 0;
9805 }
9806
9807 override void SetCleanness(
int value,
bool allow_client =
false)
9808 {
9809 if (!IsServerCheck(allow_client))
9810 return;
9811
9813
9815
9818 }
9819
9821 {
9823 }
9824
9826 {
9827 return true;
9828 }
9829
9830
9831
9832
9834 {
9836 }
9837
9839 {
9841 }
9842
9843
9844
9845
9846 override void SetColor(
int r,
int g,
int b,
int a)
9847 {
9853 }
9855 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9856 {
9861 }
9862
9864 {
9866 }
9867
9870 {
9871 int r,g,b,a;
9873 r = r/255;
9874 g = g/255;
9875 b = b/255;
9876 a = a/255;
9877 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9878 }
9879
9880
9881
9882 override void SetLiquidType(
int value,
bool allow_client =
false)
9883 {
9884 if (!IsServerCheck(allow_client))
9885 return;
9886
9891 }
9892
9894 {
9895 return ConfigGetInt("varLiquidTypeInit");
9896 }
9897
9899 {
9901 }
9902
9904 {
9906 SetFrozen(false);
9907 }
9908
9911 {
9912 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9913 }
9914
9915
9918 {
9919 PlayerBase nplayer;
9920 if (PlayerBase.CastTo(nplayer, player))
9921 {
9923
9924 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9925 }
9926 }
9927
9928
9931 {
9932 PlayerBase nplayer;
9933 if (PlayerBase.CastTo(nplayer,player))
9934 {
9935
9936 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9937
9938 }
9939
9940
9941 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9942
9943
9944 if (HasEnergyManager())
9945 {
9946 GetCompEM().UpdatePlugState();
9947 }
9948 }
9949
9950
9952 {
9953 super.OnPlacementStarted(player);
9954
9956 }
9957
9958 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9959 {
9961 {
9962 m_AdminLog.OnPlacementComplete(player,
this);
9963 }
9964
9965 super.OnPlacementComplete(player, position, orientation);
9966 }
9967
9968
9969
9970
9971
9973 {
9975 {
9976 return true;
9977 }
9978 else
9979 {
9980 return false;
9981 }
9982 }
9983
9984
9986 {
9988 {
9990 }
9991 }
9992
9993
9995 {
9997 }
9998
10000 {
10002 }
10003
10004 override void InsertAgent(
int agent,
float count = 1)
10005 {
10006 if (count < 1)
10007 return;
10008
10010 }
10011
10014 {
10016 }
10017
10018
10020 {
10022 }
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10066 {
10068 return false;
10069 return true;
10070 }
10071
10073 {
10074
10076 }
10077
10078
10081 {
10082 super.CheckForRoofLimited(timeTresholdMS);
10083
10085 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10086 {
10087 m_PreviousRoofTestTime = time;
10088 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10089 }
10090 }
10091
10092
10094 {
10096 {
10097 return 0;
10098 }
10099
10100 if (GetInventory().GetAttachmentSlotsCount() != 0)
10101 {
10102 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10103 if (filter)
10104 return filter.GetProtectionLevel(type, false, system);
10105 else
10106 return 0;
10107 }
10108
10109 string subclassPath, entryName;
10110
10111 switch (type)
10112 {
10114 entryName = "biological";
10115 break;
10117 entryName = "chemical";
10118 break;
10119 default:
10120 entryName = "biological";
10121 break;
10122 }
10123
10124 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10125
10127 }
10128
10129
10130
10133 {
10134 if (!IsMagazine())
10136
10138 }
10139
10140
10141
10142
10143
10148 {
10149 return true;
10150 }
10151
10153 {
10155 }
10156
10157
10158
10159
10160
10162 {
10163 if (parent)
10164 {
10165 if (parent.IsInherited(DayZInfected))
10166 return true;
10167
10168 if (!parent.IsRuined())
10169 return true;
10170 }
10171
10172 return true;
10173 }
10174
10176 {
10177 if (!super.CanPutAsAttachment(parent))
10178 {
10179 return false;
10180 }
10181
10182 if (!IsRuined() && !parent.IsRuined())
10183 {
10184 return true;
10185 }
10186
10187 return false;
10188 }
10189
10191 {
10192
10193
10194
10195
10196 return super.CanReceiveItemIntoCargo(item);
10197 }
10198
10200 {
10201
10202
10203
10204
10205 GameInventory attachmentInv = attachment.GetInventory();
10207 {
10208 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10209 return false;
10210 }
10211
10212 InventoryLocation loc = new InventoryLocation();
10213 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10214 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10215 return false;
10216
10217 return super.CanReceiveAttachment(attachment, slotId);
10218 }
10219
10221 {
10222 if (!super.CanReleaseAttachment(attachment))
10223 return false;
10224
10225 return GetInventory().AreChildrenAccessible();
10226 }
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10249 {
10250 int id = muzzle_owner.GetMuzzleID();
10251 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10252
10253 if (WPOF_array)
10254 {
10255 for (int i = 0; i < WPOF_array.Count(); i++)
10256 {
10257 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10258
10259 if (WPOF)
10260 {
10261 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10262 }
10263 }
10264 }
10265 }
10266
10267
10269 {
10270 int id = muzzle_owner.GetMuzzleID();
10272
10273 if (WPOBE_array)
10274 {
10275 for (int i = 0; i < WPOBE_array.Count(); i++)
10276 {
10277 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10278
10279 if (WPOBE)
10280 {
10281 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10282 }
10283 }
10284 }
10285 }
10286
10287
10289 {
10290 int id = muzzle_owner.GetMuzzleID();
10291 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10292
10293 if (WPOOH_array)
10294 {
10295 for (int i = 0; i < WPOOH_array.Count(); i++)
10296 {
10297 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10298
10299 if (WPOOH)
10300 {
10301 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10302 }
10303 }
10304 }
10305 }
10306
10307
10309 {
10310 int id = muzzle_owner.GetMuzzleID();
10311 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10312
10313 if (WPOOH_array)
10314 {
10315 for (int i = 0; i < WPOOH_array.Count(); i++)
10316 {
10317 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10318
10319 if (WPOOH)
10320 {
10321 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10322 }
10323 }
10324 }
10325 }
10326
10327
10329 {
10330 int id = muzzle_owner.GetMuzzleID();
10331 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10332
10333 if (WPOOH_array)
10334 {
10335 for (int i = 0; i < WPOOH_array.Count(); i++)
10336 {
10337 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10338
10339 if (WPOOH)
10340 {
10341 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10342 }
10343 }
10344 }
10345 }
10346
10347
10348
10350 {
10352 {
10353 return true;
10354 }
10355
10356 return false;
10357 }
10358
10360 {
10362 {
10363 return true;
10364 }
10365
10366 return false;
10367 }
10368
10370 {
10372 {
10373 return true;
10374 }
10375
10376 return false;
10377 }
10378
10380 {
10381 return false;
10382 }
10383
10386 {
10387 return UATimeSpent.DEFAULT_DEPLOY;
10388 }
10389
10390
10391
10392
10394 {
10396 SetSynchDirty();
10397 }
10398
10400 {
10402 }
10403
10404
10406 {
10407 return false;
10408 }
10409
10412 {
10413 string att_type = "None";
10414
10415 if (ConfigIsExisting("soundAttType"))
10416 {
10417 att_type = ConfigGetString("soundAttType");
10418 }
10419
10421 }
10422
10424 {
10426 }
10427
10428
10429
10430
10431
10437
10439 {
10442
10444 }
10445
10446
10448 {
10450 return;
10451
10453
10456
10459
10460 SoundParameters params = new SoundParameters();
10464 }
10465
10466
10468 {
10470 return;
10471
10473 SetSynchDirty();
10474
10477 }
10478
10479
10481 {
10483 return;
10484
10486 SetSynchDirty();
10487
10490 }
10491
10493 {
10495 }
10496
10498 {
10500 }
10501
10504 {
10505 if (!
GetGame().IsDedicatedServer())
10506 {
10507 if (ConfigIsExisting("attachSoundSet"))
10508 {
10509 string cfg_path = "";
10510 string soundset = "";
10511 string type_name =
GetType();
10512
10515 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10516 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10517
10518 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10519 {
10520 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10521 {
10522 if (cfg_slot_array[i] == slot_type)
10523 {
10524 soundset = cfg_soundset_array[i];
10525 break;
10526 }
10527 }
10528 }
10529
10530 if (soundset != "")
10531 {
10532 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10534 }
10535 }
10536 }
10537 }
10538
10540 {
10541
10542 }
10543
10544 void OnApply(PlayerBase player);
10545
10547 {
10548 return 1.0;
10549 };
10550
10552 {
10554 }
10555
10557 {
10559 }
10560
10562
10564 {
10565 SetDynamicPhysicsLifeTime(0.01);
10567 }
10568
10570 {
10571 array<string> zone_names = new array<string>;
10572 GetDamageZones(zone_names);
10573 for (int i = 0; i < zone_names.Count(); i++)
10574 {
10575 SetHealthMax(zone_names.Get(i),"Health");
10576 }
10577 SetHealthMax("","Health");
10578 }
10579
10582 {
10583 float global_health = GetHealth01("","Health");
10584 array<string> zones = new array<string>;
10585 GetDamageZones(zones);
10586
10587 for (int i = 0; i < zones.Count(); i++)
10588 {
10589 SetHealth01(zones.Get(i),"Health",global_health);
10590 }
10591 }
10592
10595 {
10596 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10597 }
10598
10600 {
10601 if (!hasRootAsPlayer)
10602 {
10603 if (refParentIB)
10604 {
10605
10606 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10607 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10608
10609 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10610 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10611
10614 }
10615 else
10616 {
10617
10620 }
10621 }
10622 }
10623
10625 {
10627 {
10628 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10629 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10630 {
10631 float heatPermCoef = 1.0;
10633 while (ent)
10634 {
10635 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10636 ent = ent.GetHierarchyParent();
10637 }
10638
10639 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10640 }
10641 }
10642 }
10643
10645 {
10646
10647 EntityAI parent = GetHierarchyParent();
10648 if (!parent)
10649 {
10650 hasParent = false;
10651 hasRootAsPlayer = false;
10652 }
10653 else
10654 {
10655 hasParent = true;
10656 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10657 refParentIB =
ItemBase.Cast(parent);
10658 }
10659 }
10660
10661 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10662 {
10663
10664 }
10665
10667 {
10668
10669 return false;
10670 }
10671
10673 {
10674
10675
10676 return false;
10677 }
10678
10680 {
10681
10682 return false;
10683 }
10684
10687 {
10688 return !GetIsFrozen() &&
IsOpen();
10689 }
10690
10692 {
10693 bool hasParent = false, hasRootAsPlayer = false;
10695
10696 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10697 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10698
10699 if (wwtu || foodDecay)
10700 {
10704
10705 if (processWetness || processTemperature || processDecay)
10706 {
10708
10709 if (processWetness)
10710 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10711
10712 if (processTemperature)
10714
10715 if (processDecay)
10716 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10717 }
10718 }
10719 }
10720
10723 {
10725 }
10726
10728 {
10731
10732 return super.GetTemperatureFreezeThreshold();
10733 }
10734
10736 {
10739
10740 return super.GetTemperatureThawThreshold();
10741 }
10742
10744 {
10747
10748 return super.GetItemOverheatThreshold();
10749 }
10750
10752 {
10754 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10755
10756 return super.GetTemperatureFreezeTime();
10757 }
10758
10760 {
10762 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10763
10764 return super.GetTemperatureThawTime();
10765 }
10766
10771
10773 {
10774 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10775 }
10776
10778 {
10779 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10780 }
10781
10784 {
10786 }
10787
10789 {
10791 }
10792
10794 {
10796 }
10797
10800 {
10801 return null;
10802 }
10803
10806 {
10807 return false;
10808 }
10809
10811 {
10813 {
10816 if (!trg)
10817 {
10819 explosive = this;
10820 }
10821
10822 explosive.PairRemote(trg);
10824
10825 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10826 trg.SetPersistentPairID(persistentID);
10827 explosive.SetPersistentPairID(persistentID);
10828
10829 return true;
10830 }
10831 return false;
10832 }
10833
10836 {
10837 float ret = 1.0;
10840 ret *= GetHealth01();
10841
10842 return ret;
10843 }
10844
10845 #ifdef DEVELOPER
10846 override void SetDebugItem()
10847 {
10848 super.SetDebugItem();
10849 _itemBase = this;
10850 }
10851
10853 {
10854 string text = super.GetDebugText();
10855
10857 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10858
10859 return text;
10860 }
10861 #endif
10862
10864 {
10865 return true;
10866 }
10867
10869
10871
10873 {
10876 }
10877
10878
10886
10902}
10903
10905{
10907 if (entity)
10908 {
10909 bool is_item = entity.IsInherited(
ItemBase);
10910 if (is_item && full_quantity)
10911 {
10914 }
10915 }
10916 else
10917 {
10919 return NULL;
10920 }
10921 return entity;
10922}
10923
10925{
10926 if (item)
10927 {
10928 if (health > 0)
10929 item.SetHealth("", "", health);
10930
10931 if (item.CanHaveTemperature())
10932 {
10934 if (item.CanFreeze())
10935 item.SetFrozen(false);
10936 }
10937
10938 if (item.HasEnergyManager())
10939 {
10940 if (quantity >= 0)
10941 {
10942 item.GetCompEM().SetEnergy0To1(quantity);
10943 }
10944 else
10945 {
10947 }
10948 }
10949 else if (item.IsMagazine())
10950 {
10951 Magazine mag = Magazine.Cast(item);
10952 if (quantity >= 0)
10953 {
10954 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10955 }
10956 else
10957 {
10959 }
10960
10961 }
10962 else
10963 {
10964 if (quantity >= 0)
10965 {
10966 item.SetQuantityNormalized(quantity, false);
10967 }
10968 else
10969 {
10971 }
10972
10973 }
10974 }
10975}
10976
10977#ifdef DEVELOPER
10979#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.