6059{
6061 {
6062 return true;
6063 }
6064};
6065
6066
6067
6069{
6073
6075
6078
6079
6080
6081
6082
6091
6097
6102
6107
6128 protected bool m_IsResultOfSplit
6129
6131
6136
6137
6138
6140
6144
6145
6146
6148
6151
6152
6153
6159
6160
6168
6171
6172
6174
6175
6177
6178
6183
6184
6189
6190
6192
6193
6195 {
6200
6201 if (!
GetGame().IsDedicatedServer())
6202 {
6204 {
6206
6208 {
6210 }
6211 }
6212
6215 }
6216
6217 m_OldLocation = null;
6218
6220 {
6222 }
6223
6224 if (ConfigIsExisting("headSelectionsToHide"))
6225 {
6228 }
6229
6231 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6232 {
6234 }
6235
6237
6238 m_IsResultOfSplit = false;
6239
6241 }
6242
6244 {
6245 super.InitItemVariables();
6246
6252 m_Count = ConfigGetInt(
"count");
6253
6256
6261
6264
6269
6281
6285
6286
6289 if (ConfigIsExisting("canBeSplit"))
6290 {
6293 }
6294
6296 if (ConfigIsExisting("itemBehaviour"))
6298
6299
6302 RegisterNetSyncVariableInt("m_VarLiquidType");
6303 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6304
6305 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6306 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6307 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6308
6309 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6310 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6311 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6312 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6313
6314 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6315 RegisterNetSyncVariableBool("m_IsTakeable");
6316 RegisterNetSyncVariableBool("m_IsHologram");
6317
6320 {
6323 }
6324
6326
6328 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6330
6331 }
6332
6334 {
6336 }
6337
6339 {
6342 {
6347 }
6348 }
6349
6350 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6351 {
6353 {
6356 }
6357
6359 }
6360
6362 {
6368 }
6369
6371
6373 {
6375
6376 if (!action)
6377 {
6378 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6379 return;
6380 }
6381
6383 if (!ai)
6384 {
6386 return;
6387 }
6388
6390 if (!action_array)
6391 {
6392 action_array = new array<ActionBase_Basic>;
6394 }
6395 if (LogManager.IsActionLogEnable())
6396 {
6397 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6398 }
6399
6400 if (action_array.Find(action) != -1)
6401 {
6402 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6403 }
6404 else
6405 {
6406 action_array.Insert(action);
6407 }
6408 }
6409
6411 {
6413 ActionBase action = player.GetActionManager().GetAction(actionName);
6416
6417 if (action_array)
6418 {
6419 action_array.RemoveItem(action);
6420 }
6421 }
6422
6423
6424
6426 {
6427 ActionOverrideData overrideData = new ActionOverrideData();
6431
6433 if (!actionMap)
6434 {
6437 }
6438
6439 actionMap.Insert(this.
Type(), overrideData);
6440
6441 }
6442
6444
6446
6447
6449 {
6452
6455
6456 string config_to_search = "CfgVehicles";
6457 string muzzle_owner_config;
6458
6460 {
6461 if (IsInherited(Weapon))
6462 config_to_search = "CfgWeapons";
6463
6464 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6465
6466 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6467
6469
6470 if (config_OnFire_subclass_count > 0)
6471 {
6472 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6473
6474 for (int i = 0; i < config_OnFire_subclass_count; i++)
6475 {
6476 string particle_class = "";
6478 string config_OnFire_entry = config_OnFire_class + particle_class;
6479 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6480 WPOF_array.Insert(WPOF);
6481 }
6482
6483
6485 }
6486 }
6487
6489 {
6490 config_to_search = "CfgWeapons";
6491 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6492
6493 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6494
6496
6497 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6498 {
6499 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6500
6501 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6502 {
6503 string particle_class2 = "";
6505 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6506 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6507 WPOBE_array.Insert(WPOBE);
6508 }
6509
6510
6512 }
6513 }
6514 }
6515
6516
6518 {
6521
6523 {
6524 string config_to_search = "CfgVehicles";
6525
6526 if (IsInherited(Weapon))
6527 config_to_search = "CfgWeapons";
6528
6529 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6530 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6531
6532 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6533 {
6534
6536
6538 {
6540 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6542 return;
6543 }
6544
6547
6548
6549
6551 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6552
6553 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6554 {
6555 string particle_class = "";
6557 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6559
6560 if (entry_type == CT_CLASS)
6561 {
6562 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6563 WPOOH_array.Insert(WPOF);
6564 }
6565 }
6566
6567
6569 }
6570 }
6571 }
6572
6574 {
6576 }
6577
6579 {
6581 {
6583
6586
6589
6590 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6591 }
6592 }
6593
6595 {
6597 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6598
6600 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6601
6603 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6604
6606 {
6608 }
6609 }
6610
6612 {
6614 }
6615
6617 {
6620 else
6622
6624 {
6627 }
6628 else
6629 {
6632
6635 }
6636
6638 }
6639
6641 {
6643 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6644 }
6645
6647 {
6649 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6651 }
6652
6654 {
6656 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6657 }
6658
6660 {
6663
6664 OverheatingParticle OP = new OverheatingParticle();
6669
6671 }
6672
6674 {
6677
6678 return -1;
6679 }
6680
6682 {
6684 {
6687
6688 for (int i = count; i > 0; --i)
6689 {
6690 int id = i - 1;
6693
6696
6697 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6698 {
6699 if (p)
6700 {
6703 }
6704 }
6705 }
6706 }
6707 }
6708
6710 {
6712 {
6714 {
6715 int id = i - 1;
6717
6718 if (OP)
6719 {
6721
6722 if (p)
6723 {
6725 }
6726
6727 delete OP;
6728 }
6729 }
6730
6733 }
6734 }
6735
6738 {
6739 return 0.0;
6740 }
6741
6742
6744 {
6745 return 250;
6746 }
6747
6749 {
6750 return 0;
6751 }
6752
6755 {
6757 return true;
6758
6759 return false;
6760 }
6761
6764 {
6767
6769 {
6771 }
6772 else
6773 {
6774
6776 }
6777
6779 }
6780
6787 {
6788 return -1;
6789 }
6790
6791
6792
6793
6795 {
6797 {
6799 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6800
6801 if (r_index >= 0)
6802 {
6803 InventoryLocation r_il = new InventoryLocation;
6804 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6805
6806 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6809 {
6810 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6811 }
6813 {
6814 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6815 }
6816
6817 }
6818
6819 player.GetHumanInventory().ClearUserReservedLocation(this);
6820 }
6821
6824 }
6825
6826
6827
6828
6830 {
6831 return ItemBase.m_DebugActionsMask;
6832 }
6833
6835 {
6836 return ItemBase.m_DebugActionsMask & mask;
6837 }
6838
6840 {
6841 ItemBase.m_DebugActionsMask = mask;
6842 }
6843
6845 {
6846 ItemBase.m_DebugActionsMask |= mask;
6847 }
6848
6850 {
6851 ItemBase.m_DebugActionsMask &= ~mask;
6852 }
6853
6855 {
6857 {
6859 }
6860 else
6861 {
6863 }
6864 }
6865
6866
6868 {
6869 if (GetEconomyProfile())
6870 {
6871 float q_max = GetEconomyProfile().GetQuantityMax();
6872 if (q_max > 0)
6873 {
6874 float q_min = GetEconomyProfile().GetQuantityMin();
6875 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6876
6878 {
6879 ComponentEnergyManager comp = GetCompEM();
6881 {
6883 }
6884 }
6886 {
6888
6889 }
6890
6891 }
6892 }
6893 }
6894
6897 {
6898 EntityAI parent = GetHierarchyParent();
6899
6900 if (parent)
6901 {
6902 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6903 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6904 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6905 }
6906 }
6907
6910 {
6911 EntityAI parent = GetHierarchyParent();
6912
6913 if (parent)
6914 {
6915 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6916 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6917 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6918 }
6919 }
6920
6922 {
6923
6924
6925
6926
6928
6930 {
6931 if (ScriptInputUserData.CanStoreInputUserData())
6932 {
6933 ScriptInputUserData ctx = new ScriptInputUserData;
6939 ctx.
Write(use_stack_max);
6942
6944 {
6945 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6946 }
6947 }
6948 }
6949 else if (!
GetGame().IsMultiplayer())
6950 {
6952 }
6953 }
6954
6956 {
6958 }
6959
6961 {
6963 }
6964
6966 {
6968 }
6969
6971 {
6972
6973 return false;
6974 }
6975
6977 {
6978 return false;
6979 }
6980
6984 {
6985 return false;
6986 }
6987
6989 {
6990 return "";
6991 }
6992
6994
6996 {
6997 return false;
6998 }
6999
7001 {
7002 return true;
7003 }
7004
7005
7006
7008 {
7009 return true;
7010 }
7011
7013 {
7014 return true;
7015 }
7016
7018 {
7019 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7021 }
7022
7024 {
7026 }
7027
7029 {
7031 if (!is_being_placed)
7033 SetSynchDirty();
7034 }
7035
7036
7038
7040 {
7042 }
7043
7045 {
7047 }
7048
7050 {
7051 return 1;
7052 }
7053
7055 {
7056 return false;
7057 }
7058
7060 {
7062 SetSynchDirty();
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
7094
7095
7096
7097
7098
7100 {
7101 super.OnMovedInsideCargo(container);
7102
7103 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7104 }
7105
7106 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7107 {
7108 super.EEItemLocationChanged(oldLoc,newLoc);
7109
7110 PlayerBase new_player = null;
7111 PlayerBase old_player = null;
7112
7113 if (newLoc.GetParent())
7114 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7115
7116 if (oldLoc.GetParent())
7117 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7118
7120 {
7121 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7122
7123 if (r_index >= 0)
7124 {
7125 InventoryLocation r_il = new InventoryLocation;
7126 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7127
7128 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7131 {
7132 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7133 }
7135 {
7136 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7137 }
7138
7139 }
7140 }
7141
7143 {
7144 if (new_player)
7145 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7146
7147 if (new_player == old_player)
7148 {
7149
7150 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7151 {
7153 {
7154 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7155 {
7156 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7157 }
7158 }
7159 else
7160 {
7161 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7162 }
7163 }
7164
7165 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7166 {
7167 int type = oldLoc.GetType();
7169 {
7170 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7171 }
7173 {
7174 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7175 }
7176 }
7177 if (!m_OldLocation)
7178 {
7179 m_OldLocation = new InventoryLocation;
7180 }
7181 m_OldLocation.Copy(oldLoc);
7182 }
7183 else
7184 {
7185 if (m_OldLocation)
7186 {
7187 m_OldLocation.Reset();
7188 }
7189 }
7190
7192 }
7193 else
7194 {
7195 if (new_player)
7196 {
7197 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7198 if (res_index >= 0)
7199 {
7200 InventoryLocation il = new InventoryLocation;
7201 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7203 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7206 {
7207 il.
GetParent().GetOnReleaseLock().Invoke(it);
7208 }
7210 {
7212 }
7213
7214 }
7215 }
7217 {
7218
7220 }
7221
7222 if (m_OldLocation)
7223 {
7224 m_OldLocation.Reset();
7225 }
7226 }
7227 }
7228
7229 override void EOnContact(IEntity other, Contact extra)
7230 {
7232 {
7233 int liquidType = -1;
7235 if (impactSpeed > 0.0)
7236 {
7238 #ifndef SERVER
7240 #else
7242 SetSynchDirty();
7243 #endif
7245 }
7246 }
7247
7248 #ifdef SERVER
7249 if (GetCompEM() && GetCompEM().IsPlugged())
7250 {
7251 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7252 GetCompEM().UnplugThis();
7253 }
7254 #endif
7255 }
7256
7258
7260 {
7262 }
7263
7265 {
7266
7267 }
7268
7270 {
7271 super.OnItemLocationChanged(old_owner, new_owner);
7272
7273 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7274 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7275
7276 if (!relatedPlayer && playerNew)
7277 relatedPlayer = playerNew;
7278
7279 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7280 {
7282 if (actionMgr)
7283 {
7284 ActionBase currentAction = actionMgr.GetRunningAction();
7285 if (currentAction)
7287 }
7288 }
7289
7290 Man ownerPlayerOld = null;
7291 Man ownerPlayerNew = null;
7292
7293 if (old_owner)
7294 {
7295 if (old_owner.
IsMan())
7296 {
7297 ownerPlayerOld = Man.Cast(old_owner);
7298 }
7299 else
7300 {
7301 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7302 }
7303 }
7304 else
7305 {
7307 {
7309
7310 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7311 {
7312 GetCompEM().UnplugThis();
7313 }
7314 }
7315 }
7316
7317 if (new_owner)
7318 {
7319 if (new_owner.
IsMan())
7320 {
7321 ownerPlayerNew = Man.Cast(new_owner);
7322 }
7323 else
7324 {
7325 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7326 }
7327 }
7328
7329 if (ownerPlayerOld != ownerPlayerNew)
7330 {
7331 if (ownerPlayerOld)
7332 {
7333 array<EntityAI> subItemsExit = new array<EntityAI>;
7335 for (int i = 0; i < subItemsExit.Count(); i++)
7336 {
7339 }
7340 }
7341
7342 if (ownerPlayerNew)
7343 {
7344 array<EntityAI> subItemsEnter = new array<EntityAI>;
7346 for (int j = 0; j < subItemsEnter.Count(); j++)
7347 {
7350 }
7351 }
7352 }
7353 else if (ownerPlayerNew != null)
7354 {
7355 PlayerBase nplayer;
7356 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7357 {
7358 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7360 for (int k = 0; k < subItemsUpdate.Count(); k++)
7361 {
7363 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7364 }
7365 }
7366 }
7367
7368 if (old_owner)
7369 old_owner.OnChildItemRemoved(this);
7370 if (new_owner)
7371 new_owner.OnChildItemReceived(this);
7372 }
7373
7374
7376 {
7377 super.EEDelete(parent);
7378 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7379 if (player)
7380 {
7382
7383 if (player.IsAlive())
7384 {
7385 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7386 if (r_index >= 0)
7387 {
7388 InventoryLocation r_il = new InventoryLocation;
7389 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7390
7391 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7394 {
7395 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7396 }
7398 {
7399 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7400 }
7401
7402 }
7403
7404 player.RemoveQuickBarEntityShortcut(this);
7405 }
7406 }
7407 }
7408
7410 {
7411 super.EEKilled(killer);
7412
7415 {
7416 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7417 {
7418 if (IsMagazine())
7419 {
7420 if (Magazine.Cast(this).GetAmmoCount() > 0)
7421 {
7423 }
7424 }
7425 else
7426 {
7428 }
7429 }
7430 }
7431 }
7432
7434 {
7435 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7436
7437 super.OnWasAttached(parent, slot_id);
7438
7441
7443 }
7444
7446 {
7447 super.OnWasDetached(parent, slot_id);
7448
7451 }
7452
7454 {
7455 int idx;
7458
7459 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7460 if (inventory_slots.Count() < 1)
7461 {
7462 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7463 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7464 }
7465 else
7466 {
7467 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7468 }
7469
7470 idx = inventory_slots.Find(slot);
7471 if (idx < 0)
7472 return "";
7473
7474 return attach_types.Get(idx);
7475 }
7476
7478 {
7479 int idx = -1;
7480 string slot;
7481
7484
7485 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7486 if (inventory_slots.Count() < 1)
7487 {
7488 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7489 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7490 }
7491 else
7492 {
7493 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7494 if (detach_types.Count() < 1)
7495 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7496 }
7497
7498 for (int i = 0; i < inventory_slots.Count(); i++)
7499 {
7500 slot = inventory_slots.Get(i);
7501 }
7502
7503 if (slot != "")
7504 {
7505 if (detach_types.Count() == 1)
7506 idx = 0;
7507 else
7508 idx = inventory_slots.Find(slot);
7509 }
7510 if (idx < 0)
7511 return "";
7512
7513 return detach_types.Get(idx);
7514 }
7515
7517 {
7518
7520
7521
7522 float min_time = 1;
7523 float max_time = 3;
7524 float delay = Math.RandomFloat(min_time, max_time);
7525
7526 explode_timer.Run(delay, this, "DoAmmoExplosion");
7527 }
7528
7530 {
7531 Magazine magazine = Magazine.Cast(this);
7532 int pop_sounds_count = 6;
7533 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7534
7535
7536 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7537 string sound_name = pop_sounds[ sound_idx ];
7539
7540
7541 magazine.ServerAddAmmoCount(-1);
7542
7543
7544 float min_temp_to_explode = 100;
7545
7546 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7547 {
7549 }
7550 }
7551
7552
7553 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7554 {
7555 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7556
7557 const int CHANCE_DAMAGE_CARGO = 4;
7558 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7559 const int CHANCE_DAMAGE_NOTHING = 2;
7560
7562 {
7563 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7564 int chances;
7565 int rnd;
7566
7567 if (GetInventory().GetCargo())
7568 {
7569 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7570 rnd = Math.RandomInt(0,chances);
7571
7572 if (rnd < CHANCE_DAMAGE_CARGO)
7573 {
7575 }
7576 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7577 {
7579 }
7580 }
7581 else
7582 {
7583 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7584 rnd = Math.RandomInt(0,chances);
7585
7586 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7587 {
7589 }
7590 }
7591 }
7592 }
7593
7595 {
7596 if (GetInventory().GetCargo())
7597 {
7598 int item_count = GetInventory().GetCargo().GetItemCount();
7599 if (item_count > 0)
7600 {
7601 int random_pick = Math.RandomInt(0, item_count);
7603 if (!item.IsExplosive())
7604 {
7605 item.AddHealth("","",damage);
7606 return true;
7607 }
7608 }
7609 }
7610 return false;
7611 }
7612
7614 {
7615 int attachment_count = GetInventory().AttachmentCount();
7616 if (attachment_count > 0)
7617 {
7618 int random_pick = Math.RandomInt(0, attachment_count);
7619 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7620 if (!attachment.IsExplosive())
7621 {
7622 attachment.AddHealth("","",damage);
7623 return true;
7624 }
7625 }
7626 return false;
7627 }
7628
7630 {
7632 }
7633
7635 {
7637 return GetInventory().CanRemoveEntity();
7638
7639 return false;
7640 }
7641
7643 {
7644
7646 return false;
7647
7648
7650 return false;
7651
7652
7653
7655 if (delta == 0)
7656 return false;
7657
7658
7659 return true;
7660 }
7661
7663 {
7665 {
7666 if (ScriptInputUserData.CanStoreInputUserData())
7667 {
7668 ScriptInputUserData ctx = new ScriptInputUserData;
7673 ctx.
Write(destination_entity);
7677 }
7678 }
7679 else if (!
GetGame().IsMultiplayer())
7680 {
7682 }
7683 }
7684
7686 {
7687 float split_quantity_new;
7691 InventoryLocation loc = new InventoryLocation;
7692
7693 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7694 {
7696 split_quantity_new = stack_max;
7697 else
7699
7701 {
7702 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7703 if (new_item)
7704 {
7705 new_item.SetResultOfSplit(true);
7706 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7708 new_item.
SetQuantity(split_quantity_new,
false,
true);
7709 }
7710 }
7711 }
7712 else if (destination_entity && slot_id == -1)
7713 {
7714 if (quantity > stack_max)
7715 split_quantity_new = stack_max;
7716 else
7717 split_quantity_new = quantity;
7718
7720 {
7722 {
7725 }
7726
7727 if (new_item)
7728 {
7729 new_item.SetResultOfSplit(true);
7730 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7732 new_item.
SetQuantity(split_quantity_new,
false,
true);
7733 }
7734 }
7735 }
7736 else
7737 {
7738 if (stack_max != 0)
7739 {
7741 {
7743 }
7744
7745 if (split_quantity_new == 0)
7746 {
7747 if (!
GetGame().IsMultiplayer())
7748 player.PhysicalPredictiveDropItem(this);
7749 else
7750 player.ServerDropEntity(this);
7751 return;
7752 }
7753
7755 {
7757
7758 if (new_item)
7759 {
7760 new_item.SetResultOfSplit(true);
7761 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7764 new_item.PlaceOnSurface();
7765 }
7766 }
7767 }
7768 }
7769 }
7770
7772 {
7773 float split_quantity_new;
7777 InventoryLocation loc = new InventoryLocation;
7778
7779 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7780 {
7782 split_quantity_new = stack_max;
7783 else
7785
7787 {
7788 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7789 if (new_item)
7790 {
7791 new_item.SetResultOfSplit(true);
7792 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7794 new_item.
SetQuantity(split_quantity_new,
false,
true);
7795 }
7796 }
7797 }
7798 else if (destination_entity && slot_id == -1)
7799 {
7800 if (quantity > stack_max)
7801 split_quantity_new = stack_max;
7802 else
7803 split_quantity_new = quantity;
7804
7806 {
7808 {
7811 }
7812
7813 if (new_item)
7814 {
7815 new_item.SetResultOfSplit(true);
7816 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7818 new_item.
SetQuantity(split_quantity_new,
false,
true);
7819 }
7820 }
7821 }
7822 else
7823 {
7824 if (stack_max != 0)
7825 {
7827 {
7829 }
7830
7832 {
7834
7835 if (new_item)
7836 {
7837 new_item.SetResultOfSplit(true);
7838 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7841 new_item.PlaceOnSurface();
7842 }
7843 }
7844 }
7845 }
7846 }
7847
7849 {
7851 {
7852 if (ScriptInputUserData.CanStoreInputUserData())
7853 {
7854 ScriptInputUserData ctx = new ScriptInputUserData;
7859 dst.WriteToContext(ctx);
7861 }
7862 }
7863 else if (!
GetGame().IsMultiplayer())
7864 {
7866 }
7867 }
7868
7870 {
7872 {
7873 if (ScriptInputUserData.CanStoreInputUserData())
7874 {
7875 ScriptInputUserData ctx = new ScriptInputUserData;
7880 ctx.
Write(destination_entity);
7886 }
7887 }
7888 else if (!
GetGame().IsMultiplayer())
7889 {
7891 }
7892 }
7893
7895 {
7897 }
7898
7900 {
7902 float split_quantity_new;
7904 if (dst.IsValid())
7905 {
7906 int slot_id = dst.GetSlot();
7908
7909 if (quantity > stack_max)
7910 split_quantity_new = stack_max;
7911 else
7912 split_quantity_new = quantity;
7913
7915 {
7917
7918 if (new_item)
7919 {
7920 new_item.SetResultOfSplit(true);
7921 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7923 new_item.
SetQuantity(split_quantity_new,
false,
true);
7924 }
7925
7926 return new_item;
7927 }
7928 }
7929
7930 return null;
7931 }
7932
7934 {
7936 float split_quantity_new;
7938 if (destination_entity)
7939 {
7941 if (quantity > stackable)
7942 split_quantity_new = stackable;
7943 else
7944 split_quantity_new = quantity;
7945
7947 {
7948 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7949 if (new_item)
7950 {
7951 new_item.SetResultOfSplit(true);
7952 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7954 new_item.
SetQuantity(split_quantity_new,
false,
true);
7955 }
7956 }
7957 }
7958 }
7959
7961 {
7963 {
7964 if (ScriptInputUserData.CanStoreInputUserData())
7965 {
7966 ScriptInputUserData ctx = new ScriptInputUserData;
7971 ItemBase destination_entity =
this;
7972 ctx.
Write(destination_entity);
7976 }
7977 }
7978 else if (!
GetGame().IsMultiplayer())
7979 {
7981 }
7982 }
7983
7985 {
7987 float split_quantity_new;
7989 if (player)
7990 {
7992 if (quantity > stackable)
7993 split_quantity_new = stackable;
7994 else
7995 split_quantity_new = quantity;
7996
7998 {
7999 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8000 new_item =
ItemBase.Cast(in_hands);
8001 if (new_item)
8002 {
8003 new_item.SetResultOfSplit(true);
8004 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8006 new_item.SetQuantity(split_quantity_new, false, true);
8007 }
8008 }
8009 }
8010 }
8011
8013 {
8015 float split_quantity_new = Math.Floor(quantity * 0.5);
8016
8018 return;
8019
8021
8022 if (new_item)
8023 {
8024 if (new_item.GetQuantityMax() < split_quantity_new)
8025 {
8026 split_quantity_new = new_item.GetQuantityMax();
8027 }
8028
8029 new_item.SetResultOfSplit(true);
8030 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8031
8033 {
8036 }
8037 else
8038 {
8040 new_item.
SetQuantity(split_quantity_new,
false,
true);
8041 }
8042 }
8043 }
8044
8046 {
8048 float split_quantity_new = Math.Floor(quantity / 2);
8049
8051 return;
8052
8053 InventoryLocation invloc = new InventoryLocation;
8055
8057 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8058
8059 if (new_item)
8060 {
8061 if (new_item.GetQuantityMax() < split_quantity_new)
8062 {
8063 split_quantity_new = new_item.GetQuantityMax();
8064 }
8066 {
8069 }
8070 else if (split_quantity_new > 1)
8071 {
8073 new_item.
SetQuantity(split_quantity_new,
false,
true);
8074 }
8075 }
8076 }
8077
8080 {
8081 SetWeightDirty();
8083
8084 if (parent)
8085 parent.OnAttachmentQuantityChangedEx(this, delta);
8086
8088 {
8090 {
8092 }
8094 {
8095 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8097 }
8098 }
8099
8100 }
8101
8104 {
8105
8106 }
8107
8110 {
8112 }
8113
8115 {
8116 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8117
8119 {
8120 if (newLevel == GameConstants.STATE_RUINED)
8121 {
8123 EntityAI parent = GetHierarchyParent();
8124 if (parent && parent.IsFireplace())
8125 {
8126 CargoBase cargo = GetInventory().GetCargo();
8127 if (cargo)
8128 {
8130 {
8132 }
8133 }
8134 }
8135 }
8136
8138 {
8139
8141 return;
8142 }
8143
8144 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8145 {
8147 }
8148 }
8149 }
8150
8151
8153 {
8154 super.OnRightClick();
8155
8157 {
8159 {
8160 if (ScriptInputUserData.CanStoreInputUserData())
8161 {
8162 EntityAI root = GetHierarchyRoot();
8163 Man playerOwner = GetHierarchyRootPlayer();
8164 InventoryLocation dst = new InventoryLocation;
8165
8166
8167 if (!playerOwner && root && root == this)
8168 {
8170 }
8171 else
8172 {
8173
8174 GetInventory().GetCurrentInventoryLocation(dst);
8176 {
8179 {
8181 }
8182 else
8183 {
8185
8186
8187 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8188 {
8190 }
8191 else
8192 {
8193 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8194 }
8195 }
8196 }
8197 }
8198
8199 ScriptInputUserData ctx = new ScriptInputUserData;
8207 }
8208 }
8209 else if (!
GetGame().IsMultiplayer())
8210 {
8212 }
8213 }
8214 }
8215
8217 {
8218 if (root)
8219 {
8220 vector m4[4];
8221 root.GetTransform(m4);
8222 dst.SetGround(this, m4);
8223 }
8224 else
8225 {
8226 GetInventory().GetCurrentInventoryLocation(dst);
8227 }
8228 }
8229
8230 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8231 {
8232
8233 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8234 return false;
8235
8236 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8237 return false;
8238
8239
8241 return false;
8242
8243
8244 Magazine mag = Magazine.Cast(this);
8245 if (mag)
8246 {
8247 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8248 return false;
8249
8250 if (stack_max_limit)
8251 {
8252 Magazine other_mag = Magazine.Cast(other_item);
8253 if (other_item)
8254 {
8255 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8256 return false;
8257 }
8258
8259 }
8260 }
8261 else
8262 {
8263
8265 return false;
8266
8268 return false;
8269 }
8270
8271 PlayerBase player = null;
8272 if (CastTo(player, GetHierarchyRootPlayer()))
8273 {
8274 if (player.GetInventory().HasAttachment(this))
8275 return false;
8276
8277 if (player.IsItemsToDelete())
8278 return false;
8279 }
8280
8281 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8282 return false;
8283
8284 int slotID;
8286 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8287 return false;
8288
8289 return true;
8290 }
8291
8293 {
8295 }
8296
8298 {
8299 return m_IsResultOfSplit;
8300 }
8301
8303 {
8304 m_IsResultOfSplit = value;
8305 }
8306
8308 {
8310 }
8311
8313 {
8314 float other_item_quantity = other_item.GetQuantity();
8315 float this_free_space;
8316
8318
8320
8321 if (other_item_quantity > this_free_space)
8322 {
8323 return this_free_space;
8324 }
8325 else
8326 {
8327 return other_item_quantity;
8328 }
8329 }
8330
8332 {
8334 }
8335
8337 {
8339 return;
8340
8341 if (!IsMagazine() && other_item)
8342 {
8344 if (quantity_used != 0)
8345 {
8346 float hp1 = GetHealth01("","");
8347 float hp2 = other_item.GetHealth01("","");
8348 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8349 hpResult = hpResult / (
GetQuantity() + quantity_used);
8350
8351 hpResult *= GetMaxHealth();
8352 Math.Round(hpResult);
8353 SetHealth("", "Health", hpResult);
8354
8356 other_item.AddQuantity(-quantity_used);
8357 }
8358 }
8360 }
8361
8363 {
8364 #ifdef SERVER
8365 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8366 GetHierarchyParent().IncreaseLifetimeUp();
8367 #endif
8368 };
8369
8371 {
8372 PlayerBase p = PlayerBase.Cast(player);
8373
8374 array<int> recipesIds = p.m_Recipes;
8375 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8376 if (moduleRecipesManager)
8377 {
8378 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8379 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8380 }
8381
8382 for (int i = 0;i < recipesIds.Count(); i++)
8383 {
8384 int key = recipesIds.Get(i);
8385 string recipeName = moduleRecipesManager.GetRecipeName(key);
8387 }
8388 }
8389
8390
8391 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8392 {
8393 super.GetDebugActions(outputList);
8394
8395
8401
8402
8407
8412
8413
8417
8418
8420 {
8424 }
8425
8428
8429
8433
8435
8436 InventoryLocation loc = new InventoryLocation();
8437 GetInventory().GetCurrentInventoryLocation(loc);
8439 {
8440 if (Gizmo_IsSupported())
8443 }
8444
8446 }
8447
8448
8449
8450
8452 {
8453 super.OnAction(action_id, player, ctx);
8454
8456 {
8457 switch (action_id)
8458 {
8461 return true;
8464 return true;
8465 }
8466 }
8467
8469 {
8470 switch (action_id)
8471 {
8473 Delete();
8474 return true;
8475 }
8476 }
8477
8478 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8479 {
8480 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8481 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8482 PlayerBase p = PlayerBase.Cast(player);
8483 if (
EActions.RECIPES_RANGE_START < 1000)
8484 {
8485 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8486 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8487 }
8488 }
8489 #ifndef SERVER
8490 else if (action_id ==
EActions.WATCH_PLAYER)
8491 {
8492 PluginDeveloper.SetDeveloperItemClientEx(player);
8493 }
8494 #endif
8496 {
8497 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8498 {
8499 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8500 OnDebugButtonPressServer(id + 1);
8501 }
8502
8503 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8504 {
8505 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8507 }
8508
8509 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8510 {
8511 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8513 }
8514
8515 else if (action_id ==
EActions.ADD_QUANTITY)
8516 {
8517 if (IsMagazine())
8518 {
8519 Magazine mag = Magazine.Cast(this);
8520 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8521 }
8522 else
8523 {
8525 }
8526
8527 if (m_EM)
8528 {
8529 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8530 }
8531
8532 }
8533
8534 else if (action_id ==
EActions.REMOVE_QUANTITY)
8535 {
8536 if (IsMagazine())
8537 {
8538 Magazine mag2 = Magazine.Cast(this);
8539 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8540 }
8541 else
8542 {
8544 }
8545 if (m_EM)
8546 {
8547 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8548 }
8549
8550 }
8551
8552 else if (action_id ==
EActions.SET_QUANTITY_0)
8553 {
8555
8556 if (m_EM)
8557 {
8558 m_EM.SetEnergy(0);
8559 }
8560 }
8561
8562 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8563 {
8565
8566 if (m_EM)
8567 {
8568 m_EM.SetEnergy(m_EM.GetEnergyMax());
8569 }
8570 }
8571
8572 else if (action_id ==
EActions.ADD_HEALTH)
8573 {
8574 AddHealth("","",GetMaxHealth("","Health")/5);
8575 }
8576 else if (action_id ==
EActions.REMOVE_HEALTH)
8577 {
8578 AddHealth("","",-GetMaxHealth("","Health")/5);
8579 }
8580 else if (action_id ==
EActions.DESTROY_HEALTH)
8581 {
8582 SetHealth01("","",0);
8583 }
8584 else if (action_id ==
EActions.WATCH_ITEM)
8585 {
8587 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8588 #ifdef DEVELOPER
8589 SetDebugDeveloper_item(this);
8590 #endif
8591 }
8592
8593 else if (action_id ==
EActions.ADD_TEMPERATURE)
8594 {
8595 AddTemperature(20);
8596
8597 }
8598
8599 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8600 {
8601 AddTemperature(-20);
8602
8603 }
8604
8605 else if (action_id ==
EActions.FLIP_FROZEN)
8606 {
8607 SetFrozen(!GetIsFrozen());
8608
8609 }
8610
8611 else if (action_id ==
EActions.ADD_WETNESS)
8612 {
8614
8615 }
8616
8617 else if (action_id ==
EActions.REMOVE_WETNESS)
8618 {
8620
8621 }
8622
8623 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8624 {
8627
8628
8629 }
8630
8631 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8632 {
8635 }
8636
8637 else if (action_id ==
EActions.MAKE_SPECIAL)
8638 {
8639 auto debugParams = DebugSpawnParams.WithPlayer(player);
8640 OnDebugSpawnEx(debugParams);
8641 }
8642
8643 }
8644
8645
8646 return false;
8647 }
8648
8649
8650
8651
8655
8658
8659
8660
8662 {
8663 return false;
8664 }
8665
8666
8668 {
8669 return true;
8670 }
8671
8672
8674 {
8675 return true;
8676 }
8677
8678
8679
8681 {
8682 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8684 }
8685
8688 {
8689 return null;
8690 }
8691
8693 {
8694 return false;
8695 }
8696
8698 {
8699 return false;
8700 }
8701
8705
8706
8708 {
8709 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8710 return module_repairing.CanRepair(this, item_repair_kit);
8711 }
8712
8713
8714 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8715 {
8716 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8717 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8718 }
8719
8720
8722 {
8723
8724
8725
8726
8727
8728
8729
8730
8731 return 1;
8732 }
8733
8734
8735
8737 {
8739 }
8740
8741
8742
8744 {
8746 }
8747
8748
8757 {
8758 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8759
8760 if (player)
8761 {
8762 player.MessageStatus(text);
8763 }
8764 }
8765
8766
8775 {
8776 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8777
8778 if (player)
8779 {
8780 player.MessageAction(text);
8781 }
8782 }
8783
8784
8793 {
8794 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8795
8796 if (player)
8797 {
8798 player.MessageFriendly(text);
8799 }
8800 }
8801
8802
8811 {
8812 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8813
8814 if (player)
8815 {
8816 player.MessageImportant(text);
8817 }
8818 }
8819
8821 {
8822 return true;
8823 }
8824
8825
8826 override bool KindOf(
string tag)
8827 {
8828 bool found = false;
8829 string item_name = this.
GetType();
8832
8833 int array_size = item_tag_array.Count();
8834 for (int i = 0; i < array_size; i++)
8835 {
8836 if (item_tag_array.Get(i) == tag)
8837 {
8838 found = true;
8839 break;
8840 }
8841 }
8842 return found;
8843 }
8844
8845
8847 {
8848
8849 super.OnRPC(sender, rpc_type,ctx);
8850
8851
8852 switch (rpc_type)
8853 {
8854 #ifndef SERVER
8855 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8856 Param2<bool, string> p = new Param2<bool, string>(false, "");
8857
8859 return;
8860
8861 bool play = p.param1;
8862 string soundSet = p.param2;
8863
8864 if (play)
8865 {
8867 {
8869 {
8871 }
8872 }
8873 else
8874 {
8876 }
8877 }
8878 else
8879 {
8881 }
8882
8883 break;
8884 #endif
8885
8886 }
8887
8889 {
8891 }
8892 }
8893
8894
8895
8896
8898 {
8899 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8900 return plugin.GetID(
name);
8901 }
8902
8904 {
8905 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8906 return plugin.GetName(id);
8907 }
8908
8911 {
8912
8913
8914 int varFlags;
8915 if (!ctx.
Read(varFlags))
8916 return;
8917
8918 if (varFlags & ItemVariableFlags.FLOAT)
8919 {
8921 }
8922 }
8923
8925 {
8926
8927 super.SerializeNumericalVars(floats_out);
8928
8929
8930
8932 {
8934 }
8935
8937 {
8939 }
8940
8942 {
8944 }
8945
8947 {
8952 }
8953
8955 {
8957 }
8958 }
8959
8961 {
8962
8963 super.DeSerializeNumericalVars(floats);
8964
8965
8966 int index = 0;
8967 int mask = Math.Round(floats.Get(index));
8968
8969 index++;
8970
8972 {
8974 {
8976 }
8977 else
8978 {
8979 float quantity = floats.Get(index);
8981 }
8982 index++;
8983 }
8984
8986 {
8987 float wet = floats.Get(index);
8989 index++;
8990 }
8991
8993 {
8994 int liquidtype = Math.Round(floats.Get(index));
8996 index++;
8997 }
8998
9000 {
9002 index++;
9004 index++;
9006 index++;
9008 index++;
9009 }
9010
9012 {
9013 int cleanness = Math.Round(floats.Get(index));
9015 index++;
9016 }
9017 }
9018
9020 {
9021 super.WriteVarsToCTX(ctx);
9022
9023
9025 {
9027 }
9028
9030 {
9032 }
9033
9035 {
9037 }
9038
9040 {
9041 int r,g,b,a;
9047 }
9048
9050 {
9052 }
9053 }
9054
9056 {
9057 if (!super.ReadVarsFromCTX(ctx,version))
9058 return false;
9059
9060 int intValue;
9061 float value;
9062
9063 if (version < 140)
9064 {
9065 if (!ctx.
Read(intValue))
9066 return false;
9067
9068 m_VariablesMask = intValue;
9069 }
9070
9072 {
9073 if (!ctx.
Read(value))
9074 return false;
9075
9077 {
9079 }
9080 else
9081 {
9083 }
9084 }
9085
9086 if (version < 140)
9087 {
9089 {
9090 if (!ctx.
Read(value))
9091 return false;
9092 SetTemperatureDirect(value);
9093 }
9094 }
9095
9097 {
9098 if (!ctx.
Read(value))
9099 return false;
9101 }
9102
9104 {
9105 if (!ctx.
Read(intValue))
9106 return false;
9108 }
9109
9111 {
9112 int r,g,b,a;
9114 return false;
9116 return false;
9118 return false;
9120 return false;
9121
9123 }
9124
9126 {
9127 if (!ctx.
Read(intValue))
9128 return false;
9130 }
9131
9132 if (version >= 138 && version < 140)
9133 {
9135 {
9136 if (!ctx.
Read(intValue))
9137 return false;
9138 SetFrozen(intValue);
9139 }
9140 }
9141
9142 return true;
9143 }
9144
9145
9147 {
9150 {
9152 }
9153
9154 if (!super.OnStoreLoad(ctx, version))
9155 {
9157 return false;
9158 }
9159
9160 if (version >= 114)
9161 {
9162 bool hasQuickBarIndexSaved;
9163
9164 if (!ctx.
Read(hasQuickBarIndexSaved))
9165 {
9167 return false;
9168 }
9169
9170 if (hasQuickBarIndexSaved)
9171 {
9172 int itmQBIndex;
9173
9174
9175 if (!ctx.
Read(itmQBIndex))
9176 {
9178 return false;
9179 }
9180
9181 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9182 if (itmQBIndex != -1 && parentPlayer)
9183 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9184 }
9185 }
9186 else
9187 {
9188
9189 PlayerBase player;
9190 int itemQBIndex;
9191 if (version ==
int.
MAX)
9192 {
9193 if (!ctx.
Read(itemQBIndex))
9194 {
9196 return false;
9197 }
9198 }
9199 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9200 {
9201
9202 if (!ctx.
Read(itemQBIndex))
9203 {
9205 return false;
9206 }
9207 if (itemQBIndex != -1 && player)
9208 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9209 }
9210 }
9211
9212 if (version < 140)
9213 {
9214
9215 if (!LoadVariables(ctx, version))
9216 {
9218 return false;
9219 }
9220 }
9221
9222
9224 {
9226 return false;
9227 }
9228 if (version >= 132)
9229 {
9231 if (raib)
9232 {
9234 {
9236 return false;
9237 }
9238 }
9239 }
9240
9242 return true;
9243 }
9244
9245
9246
9248 {
9249 super.OnStoreSave(ctx);
9250
9251 PlayerBase player;
9252 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9253 {
9255
9256 int itemQBIndex = -1;
9257 itemQBIndex = player.FindQuickBarEntityIndex(this);
9258 ctx.
Write(itemQBIndex);
9259 }
9260 else
9261 {
9263 }
9264
9266
9268 if (raib)
9269 {
9271 }
9272 }
9273
9274
9276 {
9277 super.AfterStoreLoad();
9278
9280 {
9282 }
9283
9285 {
9288 }
9289 }
9290
9292 {
9293 super.EEOnAfterLoad();
9294
9296 {
9298 }
9299
9302 }
9303
9305 {
9306 return false;
9307 }
9308
9309
9310
9312 {
9314 {
9315 #ifdef PLATFORM_CONSOLE
9316
9318 {
9320 if (menu)
9321 {
9323 }
9324 }
9325 #endif
9326 }
9327
9329 {
9332 }
9333
9335 {
9336 SetWeightDirty();
9338 }
9340 {
9343 }
9344
9346 {
9349 }
9351 {
9354 }
9355
9356 super.OnVariablesSynchronized();
9357 }
9358
9359
9360
9362 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9363 {
9364 if (!IsServerCheck(allow_client))
9365 return false;
9366
9368 return false;
9369
9372
9373 if (value <= (min + 0.001))
9374 value = min;
9375
9376 if (value == min)
9377 {
9378 if (destroy_config)
9379 {
9380 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9381 if (dstr)
9382 {
9384 this.Delete();
9385 return true;
9386 }
9387 }
9388 else if (destroy_forced)
9389 {
9391 this.Delete();
9392 return true;
9393 }
9394
9396 }
9397
9400
9402 {
9404
9405 if (delta)
9407 }
9408
9410
9411 return false;
9412 }
9413
9414
9416 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9417 {
9419 }
9420
9422 {
9425 }
9426
9428 {
9431 }
9432
9434 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9435 {
9436 float value_clamped = Math.Clamp(value, 0, 1);
9438 SetQuantity(result, destroy_config, destroy_forced);
9439 }
9440
9441
9444 {
9446 }
9447
9449 {
9451 }
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9463 {
9464 int slot = -1;
9465 if (GetInventory())
9466 {
9467 InventoryLocation il = new InventoryLocation;
9468 GetInventory().GetCurrentInventoryLocation(il);
9470 }
9471
9473 }
9474
9476 {
9477 float quantity_max = 0;
9478
9480 {
9481 if (attSlotID != -1)
9482 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9483
9484 if (quantity_max <= 0)
9486 }
9487
9488 if (quantity_max <= 0)
9490
9491 return quantity_max;
9492 }
9493
9495 {
9497 }
9498
9500 {
9502 }
9503
9504
9506 {
9508 }
9509
9511 {
9513 }
9514
9516 {
9518 }
9519
9520
9522 {
9523
9524 float weightEx = GetWeightEx();
9525 float special = GetInventoryAndCargoWeight();
9526 return weightEx - special;
9527 }
9528
9529
9531 {
9533 }
9534
9536 {
9538 {
9539 #ifdef DEVELOPER
9540 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9541 {
9542 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9544 }
9545 #endif
9546
9548 }
9549 else if (HasEnergyManager())
9550 {
9551 #ifdef DEVELOPER
9552 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9553 {
9554 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9555 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9556 }
9557 #endif
9558 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9559 }
9560 else
9561 {
9562 #ifdef DEVELOPER
9563 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9564 {
9565 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9566 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9567 }
9568 #endif
9569 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9570 }
9571 }
9572
9575 {
9576 int item_count = 0;
9578
9579 if (GetInventory().GetCargo() != NULL)
9580 {
9581 item_count = GetInventory().GetCargo().GetItemCount();
9582 }
9583
9584 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9585 {
9586 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9587 if (item)
9588 item_count += item.GetNumberOfItems();
9589 }
9590 return item_count;
9591 }
9592
9595 {
9596 float weight = 0;
9597 float wetness = 1;
9598 if (include_wetness)
9601 {
9602 weight = wetness * m_ConfigWeight;
9603 }
9605 {
9606 weight = 1;
9607 }
9608 return weight;
9609 }
9610
9611
9612
9614 {
9615 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9616 {
9617 GameInventory inv = GetInventory();
9618 array<EntityAI> items = new array<EntityAI>;
9620 for (int i = 0; i < items.Count(); i++)
9621 {
9623 if (item)
9624 {
9626 }
9627 }
9628 }
9629 }
9630
9631
9632
9633
9635 {
9636 float energy = 0;
9637 if (HasEnergyManager())
9638 {
9639 energy = GetCompEM().GetEnergy();
9640 }
9641 return energy;
9642 }
9643
9644
9646 {
9647 super.OnEnergyConsumed();
9648
9650 }
9651
9653 {
9654 super.OnEnergyAdded();
9655
9657 }
9658
9659
9661 {
9662 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9663 {
9665 {
9666 float energy_0to1 = GetCompEM().GetEnergy0To1();
9668 }
9669 }
9670 }
9671
9672
9674 {
9675 return ConfigGetFloat("heatIsolation");
9676 }
9677
9679 {
9681 }
9682
9684 {
9685 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9686 if (
GetGame().ConfigIsExisting(paramPath))
9688
9689 return 0.0;
9690 }
9691
9693 {
9694 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9695 if (
GetGame().ConfigIsExisting(paramPath))
9697
9698 return 0.0;
9699 }
9700
9701 override void SetWet(
float value,
bool allow_client =
false)
9702 {
9703 if (!IsServerCheck(allow_client))
9704 return;
9705
9708
9710
9711 m_VarWet = Math.Clamp(value, min, max);
9712
9714 {
9717 }
9718 }
9719
9720 override void AddWet(
float value)
9721 {
9723 }
9724
9726 {
9728 }
9729
9731 {
9733 }
9734
9736 {
9738 }
9739
9741 {
9743 }
9744
9746 {
9748 }
9749
9751 {
9754 if (newLevel != oldLevel)
9755 {
9757 }
9758 }
9759
9761 {
9762 SetWeightDirty();
9763 }
9764
9766 {
9767 return GetWetLevelInternal(
m_VarWet);
9768 }
9769
9770
9771
9773 {
9775 }
9776
9778 {
9780 }
9781
9783 {
9785 }
9786
9788 {
9790 }
9791
9792
9793
9795 {
9796 if (ConfigIsExisting("itemModelLength"))
9797 {
9798 return ConfigGetFloat("itemModelLength");
9799 }
9800 return 0;
9801 }
9802
9804 {
9805 if (ConfigIsExisting("itemAttachOffset"))
9806 {
9807 return ConfigGetFloat("itemAttachOffset");
9808 }
9809 return 0;
9810 }
9811
9812 override void SetCleanness(
int value,
bool allow_client =
false)
9813 {
9814 if (!IsServerCheck(allow_client))
9815 return;
9816
9818
9820
9823 }
9824
9826 {
9828 }
9829
9831 {
9832 return true;
9833 }
9834
9835
9836
9837
9839 {
9841 }
9842
9844 {
9846 }
9847
9848
9849
9850
9851 override void SetColor(
int r,
int g,
int b,
int a)
9852 {
9858 }
9860 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9861 {
9866 }
9867
9869 {
9871 }
9872
9875 {
9876 int r,g,b,a;
9878 r = r/255;
9879 g = g/255;
9880 b = b/255;
9881 a = a/255;
9882 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9883 }
9884
9885
9886
9887 override void SetLiquidType(
int value,
bool allow_client =
false)
9888 {
9889 if (!IsServerCheck(allow_client))
9890 return;
9891
9896 }
9897
9899 {
9900 return ConfigGetInt("varLiquidTypeInit");
9901 }
9902
9904 {
9906 }
9907
9909 {
9911 SetFrozen(false);
9912 }
9913
9916 {
9917 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9918 }
9919
9920
9923 {
9924 PlayerBase nplayer;
9925 if (PlayerBase.CastTo(nplayer, player))
9926 {
9928
9929 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9930 }
9931 }
9932
9933
9936 {
9937 PlayerBase nplayer;
9938 if (PlayerBase.CastTo(nplayer,player))
9939 {
9940
9941 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9942
9943 }
9944
9945
9946 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9947
9948
9949 if (HasEnergyManager())
9950 {
9951 GetCompEM().UpdatePlugState();
9952 }
9953 }
9954
9955
9957 {
9958 super.OnPlacementStarted(player);
9959
9961 }
9962
9963 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9964 {
9966 {
9967 m_AdminLog.OnPlacementComplete(player,
this);
9968 }
9969
9970 super.OnPlacementComplete(player, position, orientation);
9971 }
9972
9973
9974
9975
9976
9978 {
9980 {
9981 return true;
9982 }
9983 else
9984 {
9985 return false;
9986 }
9987 }
9988
9989
9991 {
9993 {
9995 }
9996 }
9997
9998
10000 {
10002 }
10003
10005 {
10007 }
10008
10009 override void InsertAgent(
int agent,
float count = 1)
10010 {
10011 if (count < 1)
10012 return;
10013
10015 }
10016
10019 {
10021 }
10022
10023
10025 {
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
10065
10066
10067
10068
10069
10071 {
10073 return false;
10074 return true;
10075 }
10076
10078 {
10079
10081 }
10082
10083
10086 {
10087 super.CheckForRoofLimited(timeTresholdMS);
10088
10090 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10091 {
10092 m_PreviousRoofTestTime = time;
10093 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10094 }
10095 }
10096
10097
10099 {
10101 {
10102 return 0;
10103 }
10104
10105 if (GetInventory().GetAttachmentSlotsCount() != 0)
10106 {
10107 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10108 if (filter)
10109 return filter.GetProtectionLevel(type, false, system);
10110 else
10111 return 0;
10112 }
10113
10114 string subclassPath, entryName;
10115
10116 switch (type)
10117 {
10119 entryName = "biological";
10120 break;
10122 entryName = "chemical";
10123 break;
10124 default:
10125 entryName = "biological";
10126 break;
10127 }
10128
10129 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10130
10132 }
10133
10134
10135
10138 {
10139 if (!IsMagazine())
10141
10143 }
10144
10145
10146
10147
10148
10153 {
10154 return true;
10155 }
10156
10158 {
10160 }
10161
10162
10163
10164
10165
10167 {
10168 if (parent)
10169 {
10170 if (parent.IsInherited(DayZInfected))
10171 return true;
10172
10173 if (!parent.IsRuined())
10174 return true;
10175 }
10176
10177 return true;
10178 }
10179
10181 {
10182 if (!super.CanPutAsAttachment(parent))
10183 {
10184 return false;
10185 }
10186
10187 if (!IsRuined() && !parent.IsRuined())
10188 {
10189 return true;
10190 }
10191
10192 return false;
10193 }
10194
10196 {
10197
10198
10199
10200
10201 return super.CanReceiveItemIntoCargo(item);
10202 }
10203
10205 {
10206
10207
10208
10209
10210 GameInventory attachmentInv = attachment.GetInventory();
10212 {
10213 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10214 return false;
10215 }
10216
10217 InventoryLocation loc = new InventoryLocation();
10218 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10219 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10220 return false;
10221
10222 return super.CanReceiveAttachment(attachment, slotId);
10223 }
10224
10226 {
10227 if (!super.CanReleaseAttachment(attachment))
10228 return false;
10229
10230 return GetInventory().AreChildrenAccessible();
10231 }
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10254 {
10255 int id = muzzle_owner.GetMuzzleID();
10256 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10257
10258 if (WPOF_array)
10259 {
10260 for (int i = 0; i < WPOF_array.Count(); i++)
10261 {
10262 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10263
10264 if (WPOF)
10265 {
10266 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10267 }
10268 }
10269 }
10270 }
10271
10272
10274 {
10275 int id = muzzle_owner.GetMuzzleID();
10277
10278 if (WPOBE_array)
10279 {
10280 for (int i = 0; i < WPOBE_array.Count(); i++)
10281 {
10282 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10283
10284 if (WPOBE)
10285 {
10286 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10287 }
10288 }
10289 }
10290 }
10291
10292
10294 {
10295 int id = muzzle_owner.GetMuzzleID();
10296 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10297
10298 if (WPOOH_array)
10299 {
10300 for (int i = 0; i < WPOOH_array.Count(); i++)
10301 {
10302 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10303
10304 if (WPOOH)
10305 {
10306 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10307 }
10308 }
10309 }
10310 }
10311
10312
10314 {
10315 int id = muzzle_owner.GetMuzzleID();
10316 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10317
10318 if (WPOOH_array)
10319 {
10320 for (int i = 0; i < WPOOH_array.Count(); i++)
10321 {
10322 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10323
10324 if (WPOOH)
10325 {
10326 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10327 }
10328 }
10329 }
10330 }
10331
10332
10334 {
10335 int id = muzzle_owner.GetMuzzleID();
10336 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10337
10338 if (WPOOH_array)
10339 {
10340 for (int i = 0; i < WPOOH_array.Count(); i++)
10341 {
10342 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10343
10344 if (WPOOH)
10345 {
10346 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10347 }
10348 }
10349 }
10350 }
10351
10352
10353
10355 {
10357 {
10358 return true;
10359 }
10360
10361 return false;
10362 }
10363
10365 {
10367 {
10368 return true;
10369 }
10370
10371 return false;
10372 }
10373
10375 {
10377 {
10378 return true;
10379 }
10380
10381 return false;
10382 }
10383
10385 {
10386 return false;
10387 }
10388
10391 {
10392 return UATimeSpent.DEFAULT_DEPLOY;
10393 }
10394
10395
10396
10397
10399 {
10401 SetSynchDirty();
10402 }
10403
10405 {
10407 }
10408
10409
10411 {
10412 return false;
10413 }
10414
10417 {
10418 string att_type = "None";
10419
10420 if (ConfigIsExisting("soundAttType"))
10421 {
10422 att_type = ConfigGetString("soundAttType");
10423 }
10424
10426 }
10427
10429 {
10431 }
10432
10433
10434
10435
10436
10442
10444 {
10447
10449 }
10450
10451
10453 {
10455 return;
10456
10458
10461
10464
10465 SoundParameters params = new SoundParameters();
10469 }
10470
10471
10473 {
10475 return;
10476
10478 SetSynchDirty();
10479
10482 }
10483
10484
10486 {
10488 return;
10489
10491 SetSynchDirty();
10492
10495 }
10496
10498 {
10500 }
10501
10503 {
10505 }
10506
10509 {
10510 if (!
GetGame().IsDedicatedServer())
10511 {
10512 if (ConfigIsExisting("attachSoundSet"))
10513 {
10514 string cfg_path = "";
10515 string soundset = "";
10516 string type_name =
GetType();
10517
10520 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10521 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10522
10523 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10524 {
10525 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10526 {
10527 if (cfg_slot_array[i] == slot_type)
10528 {
10529 soundset = cfg_soundset_array[i];
10530 break;
10531 }
10532 }
10533 }
10534
10535 if (soundset != "")
10536 {
10537 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10539 }
10540 }
10541 }
10542 }
10543
10545 {
10546
10547 }
10548
10549 void OnApply(PlayerBase player);
10550
10552 {
10553 return 1.0;
10554 };
10555
10557 {
10559 }
10560
10562 {
10564 }
10565
10567
10569 {
10570 SetDynamicPhysicsLifeTime(0.01);
10572 }
10573
10575 {
10576 array<string> zone_names = new array<string>;
10577 GetDamageZones(zone_names);
10578 for (int i = 0; i < zone_names.Count(); i++)
10579 {
10580 SetHealthMax(zone_names.Get(i),"Health");
10581 }
10582 SetHealthMax("","Health");
10583 }
10584
10587 {
10588 float global_health = GetHealth01("","Health");
10589 array<string> zones = new array<string>;
10590 GetDamageZones(zones);
10591
10592 for (int i = 0; i < zones.Count(); i++)
10593 {
10594 SetHealth01(zones.Get(i),"Health",global_health);
10595 }
10596 }
10597
10600 {
10601 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10602 }
10603
10605 {
10606 if (!hasRootAsPlayer)
10607 {
10608 if (refParentIB)
10609 {
10610
10611 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10612 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10613
10614 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10615 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10616
10619 }
10620 else
10621 {
10622
10625 }
10626 }
10627 }
10628
10630 {
10632 {
10633 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10634 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10635 {
10636 float heatPermCoef = 1.0;
10638 while (ent)
10639 {
10640 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10641 ent = ent.GetHierarchyParent();
10642 }
10643
10644 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10645 }
10646 }
10647 }
10648
10650 {
10651
10652 EntityAI parent = GetHierarchyParent();
10653 if (!parent)
10654 {
10655 hasParent = false;
10656 hasRootAsPlayer = false;
10657 }
10658 else
10659 {
10660 hasParent = true;
10661 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10662 refParentIB =
ItemBase.Cast(parent);
10663 }
10664 }
10665
10666 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10667 {
10668
10669 }
10670
10672 {
10673
10674 return false;
10675 }
10676
10678 {
10679
10680
10681 return false;
10682 }
10683
10685 {
10686
10687 return false;
10688 }
10689
10692 {
10693 return !GetIsFrozen() &&
IsOpen();
10694 }
10695
10697 {
10698 bool hasParent = false, hasRootAsPlayer = false;
10700
10701 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10702 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10703
10704 if (wwtu || foodDecay)
10705 {
10709
10710 if (processWetness || processTemperature || processDecay)
10711 {
10713
10714 if (processWetness)
10715 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10716
10717 if (processTemperature)
10719
10720 if (processDecay)
10721 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10722 }
10723 }
10724 }
10725
10728 {
10730 }
10731
10733 {
10736
10737 return super.GetTemperatureFreezeThreshold();
10738 }
10739
10741 {
10744
10745 return super.GetTemperatureThawThreshold();
10746 }
10747
10749 {
10752
10753 return super.GetItemOverheatThreshold();
10754 }
10755
10757 {
10759 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10760
10761 return super.GetTemperatureFreezeTime();
10762 }
10763
10765 {
10767 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10768
10769 return super.GetTemperatureThawTime();
10770 }
10771
10776
10778 {
10779 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10780 }
10781
10783 {
10784 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10785 }
10786
10789 {
10791 }
10792
10794 {
10796 }
10797
10799 {
10801 }
10802
10805 {
10806 return null;
10807 }
10808
10811 {
10812 return false;
10813 }
10814
10816 {
10818 {
10821 if (!trg)
10822 {
10824 explosive = this;
10825 }
10826
10827 explosive.PairRemote(trg);
10829
10830 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10831 trg.SetPersistentPairID(persistentID);
10832 explosive.SetPersistentPairID(persistentID);
10833
10834 return true;
10835 }
10836 return false;
10837 }
10838
10841 {
10842 float ret = 1.0;
10845 ret *= GetHealth01();
10846
10847 return ret;
10848 }
10849
10850 #ifdef DEVELOPER
10851 override void SetDebugItem()
10852 {
10853 super.SetDebugItem();
10854 _itemBase = this;
10855 }
10856
10858 {
10859 string text = super.GetDebugText();
10860
10862 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10863
10864 return text;
10865 }
10866 #endif
10867
10869 {
10870 return true;
10871 }
10872
10874
10876
10878 {
10881 }
10882
10883
10891
10907}
10908
10910{
10912 if (entity)
10913 {
10914 bool is_item = entity.IsInherited(
ItemBase);
10915 if (is_item && full_quantity)
10916 {
10919 }
10920 }
10921 else
10922 {
10924 return NULL;
10925 }
10926 return entity;
10927}
10928
10930{
10931 if (item)
10932 {
10933 if (health > 0)
10934 item.SetHealth("", "", health);
10935
10936 if (item.CanHaveTemperature())
10937 {
10939 if (item.CanFreeze())
10940 item.SetFrozen(false);
10941 }
10942
10943 if (item.HasEnergyManager())
10944 {
10945 if (quantity >= 0)
10946 {
10947 item.GetCompEM().SetEnergy0To1(quantity);
10948 }
10949 else
10950 {
10952 }
10953 }
10954 else if (item.IsMagazine())
10955 {
10956 Magazine mag = Magazine.Cast(item);
10957 if (quantity >= 0)
10958 {
10959 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10960 }
10961 else
10962 {
10964 }
10965
10966 }
10967 else
10968 {
10969 if (quantity >= 0)
10970 {
10971 item.SetQuantityNormalized(quantity, false);
10972 }
10973 else
10974 {
10976 }
10977
10978 }
10979 }
10980}
10981
10982#ifdef DEVELOPER
10984#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.