7160{
7162 {
7163 return true;
7164 }
7165};
7166
7167
7168
7170{
7174
7176
7179
7180
7181
7182
7183
7192
7198
7203
7208
7229 protected bool m_IsResultOfSplit
7230
7232
7237
7238
7239
7241
7245
7246
7247
7249
7252
7253
7254
7260
7261
7269
7272
7273
7275
7276
7278
7279
7284
7285
7290
7291
7293
7294
7296 {
7301
7302 if (!
GetGame().IsDedicatedServer())
7303 {
7305 {
7307
7309 {
7311 }
7312 }
7313
7316 }
7317
7318 m_OldLocation = null;
7319
7321 {
7323 }
7324
7325 if (ConfigIsExisting("headSelectionsToHide"))
7326 {
7329 }
7330
7332 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7333 {
7335 }
7336
7338
7339 m_IsResultOfSplit = false;
7340
7342 }
7343
7345 {
7346 super.InitItemVariables();
7347
7353 m_Count = ConfigGetInt(
"count");
7354
7357
7362
7365
7370
7382
7386
7387
7390 if (ConfigIsExisting("canBeSplit"))
7391 {
7394 }
7395
7397 if (ConfigIsExisting("itemBehaviour"))
7399
7400
7403 RegisterNetSyncVariableInt("m_VarLiquidType");
7404 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7405
7406 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7407 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7408 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7409
7410 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7411 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7412 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7413 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7414
7415 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7416 RegisterNetSyncVariableBool("m_IsTakeable");
7417 RegisterNetSyncVariableBool("m_IsHologram");
7418
7421 {
7424 }
7425
7427
7429 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7431
7432 }
7433
7435 {
7437 }
7438
7440 {
7443 {
7448 }
7449 }
7450
7451 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7452 {
7454 {
7457 }
7458
7460 }
7461
7463 {
7469 }
7470
7472
7474 {
7476
7477 if (!action)
7478 {
7479 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7480 return;
7481 }
7482
7484 if (!ai)
7485 {
7487 return;
7488 }
7489
7491 if (!action_array)
7492 {
7493 action_array = new array<ActionBase_Basic>;
7495 }
7496 if (LogManager.IsActionLogEnable())
7497 {
7498 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7499 }
7500
7501 if (action_array.Find(action) != -1)
7502 {
7503 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7504 }
7505 else
7506 {
7507 action_array.Insert(action);
7508 }
7509 }
7510
7512 {
7514 ActionBase action = player.GetActionManager().GetAction(actionName);
7517
7518 if (action_array)
7519 {
7520 action_array.RemoveItem(action);
7521 }
7522 }
7523
7524
7525
7527 {
7528 ActionOverrideData overrideData = new ActionOverrideData();
7532
7534 if (!actionMap)
7535 {
7538 }
7539
7540 actionMap.Insert(this.
Type(), overrideData);
7541
7542 }
7543
7545
7547
7548
7550 {
7553
7556
7557 string config_to_search = "CfgVehicles";
7558 string muzzle_owner_config;
7559
7561 {
7562 if (IsInherited(Weapon))
7563 config_to_search = "CfgWeapons";
7564
7565 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7566
7567 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7568
7570
7571 if (config_OnFire_subclass_count > 0)
7572 {
7573 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7574
7575 for (int i = 0; i < config_OnFire_subclass_count; i++)
7576 {
7577 string particle_class = "";
7579 string config_OnFire_entry = config_OnFire_class + particle_class;
7580 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7581 WPOF_array.Insert(WPOF);
7582 }
7583
7584
7586 }
7587 }
7588
7590 {
7591 config_to_search = "CfgWeapons";
7592 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7593
7594 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7595
7597
7598 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7599 {
7600 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7601
7602 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7603 {
7604 string particle_class2 = "";
7606 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7607 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7608 WPOBE_array.Insert(WPOBE);
7609 }
7610
7611
7613 }
7614 }
7615 }
7616
7617
7619 {
7622
7624 {
7625 string config_to_search = "CfgVehicles";
7626
7627 if (IsInherited(Weapon))
7628 config_to_search = "CfgWeapons";
7629
7630 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7631 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7632
7633 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7634 {
7635
7637
7639 {
7641 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7643 return;
7644 }
7645
7648
7649
7650
7652 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7653
7654 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7655 {
7656 string particle_class = "";
7658 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7660
7661 if (entry_type == CT_CLASS)
7662 {
7663 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7664 WPOOH_array.Insert(WPOF);
7665 }
7666 }
7667
7668
7670 }
7671 }
7672 }
7673
7675 {
7677 }
7678
7680 {
7682 {
7684
7687
7690
7691 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7692 }
7693 }
7694
7696 {
7698 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7699
7701 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7702
7704 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7705
7707 {
7709 }
7710 }
7711
7713 {
7715 }
7716
7718 {
7721 else
7723
7725 {
7728 }
7729 else
7730 {
7733
7736 }
7737
7739 }
7740
7742 {
7744 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7745 }
7746
7748 {
7750 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7752 }
7753
7755 {
7757 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7758 }
7759
7761 {
7764
7765 OverheatingParticle OP = new OverheatingParticle();
7770
7772 }
7773
7775 {
7778
7779 return -1;
7780 }
7781
7783 {
7785 {
7788
7789 for (int i = count; i > 0; --i)
7790 {
7791 int id = i - 1;
7794
7797
7798 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7799 {
7800 if (p)
7801 {
7804 }
7805 }
7806 }
7807 }
7808 }
7809
7811 {
7813 {
7815 {
7816 int id = i - 1;
7818
7819 if (OP)
7820 {
7822
7823 if (p)
7824 {
7826 }
7827
7828 delete OP;
7829 }
7830 }
7831
7834 }
7835 }
7836
7839 {
7840 return 0.0;
7841 }
7842
7843
7845 {
7846 return 250;
7847 }
7848
7850 {
7851 return 0;
7852 }
7853
7856 {
7858 return true;
7859
7860 return false;
7861 }
7862
7865 {
7868
7870 {
7872 }
7873 else
7874 {
7875
7877 }
7878
7880 }
7881
7888 {
7889 return -1;
7890 }
7891
7892
7893
7894
7896 {
7898 {
7900 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7901
7902 if (r_index >= 0)
7903 {
7904 InventoryLocation r_il = new InventoryLocation;
7905 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7906
7907 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7910 {
7911 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7912 }
7914 {
7915 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7916 }
7917
7918 }
7919
7920 player.GetHumanInventory().ClearUserReservedLocation(this);
7921 }
7922
7925 }
7926
7927
7928
7929
7931 {
7932 return ItemBase.m_DebugActionsMask;
7933 }
7934
7936 {
7937 return ItemBase.m_DebugActionsMask & mask;
7938 }
7939
7941 {
7942 ItemBase.m_DebugActionsMask = mask;
7943 }
7944
7946 {
7947 ItemBase.m_DebugActionsMask |= mask;
7948 }
7949
7951 {
7952 ItemBase.m_DebugActionsMask &= ~mask;
7953 }
7954
7956 {
7958 {
7960 }
7961 else
7962 {
7964 }
7965 }
7966
7967
7969 {
7970 if (GetEconomyProfile())
7971 {
7972 float q_max = GetEconomyProfile().GetQuantityMax();
7973 if (q_max > 0)
7974 {
7975 float q_min = GetEconomyProfile().GetQuantityMin();
7976 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7977
7979 {
7980 ComponentEnergyManager comp = GetCompEM();
7982 {
7984 }
7985 }
7987 {
7989
7990 }
7991
7992 }
7993 }
7994 }
7995
7998 {
7999 EntityAI parent = GetHierarchyParent();
8000
8001 if (parent)
8002 {
8003 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8004 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8005 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8006 }
8007 }
8008
8011 {
8012 EntityAI parent = GetHierarchyParent();
8013
8014 if (parent)
8015 {
8016 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8017 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8018 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8019 }
8020 }
8021
8023 {
8024
8025
8026
8027
8029
8031 {
8032 if (ScriptInputUserData.CanStoreInputUserData())
8033 {
8034 ScriptInputUserData ctx = new ScriptInputUserData;
8040 ctx.
Write(use_stack_max);
8043
8045 {
8046 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8047 }
8048 }
8049 }
8050 else if (!
GetGame().IsMultiplayer())
8051 {
8053 }
8054 }
8055
8057 {
8059 }
8060
8062 {
8064 }
8065
8067 {
8069 }
8070
8072 {
8073
8074 return false;
8075 }
8076
8078 {
8079 return false;
8080 }
8081
8085 {
8086 return false;
8087 }
8088
8090 {
8091 return "";
8092 }
8093
8095
8097 {
8098 return false;
8099 }
8100
8102 {
8103 return true;
8104 }
8105
8106
8107
8109 {
8110 return true;
8111 }
8112
8114 {
8115 return true;
8116 }
8117
8119 {
8120 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8122 }
8123
8125 {
8127 }
8128
8130 {
8132 if (!is_being_placed)
8134 SetSynchDirty();
8135 }
8136
8137
8139
8141 {
8143 }
8144
8146 {
8148 }
8149
8151 {
8152 return 1;
8153 }
8154
8156 {
8157 return false;
8158 }
8159
8161 {
8163 SetSynchDirty();
8164 }
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8201 {
8202 super.OnMovedInsideCargo(container);
8203
8204 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8205 }
8206
8207 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8208 {
8209 super.EEItemLocationChanged(oldLoc,newLoc);
8210
8211 PlayerBase new_player = null;
8212 PlayerBase old_player = null;
8213
8214 if (newLoc.GetParent())
8215 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8216
8217 if (oldLoc.GetParent())
8218 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8219
8221 {
8222 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8223
8224 if (r_index >= 0)
8225 {
8226 InventoryLocation r_il = new InventoryLocation;
8227 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8228
8229 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8232 {
8233 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8234 }
8236 {
8237 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8238 }
8239
8240 }
8241 }
8242
8244 {
8245 if (new_player)
8246 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8247
8248 if (new_player == old_player)
8249 {
8250
8251 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8252 {
8254 {
8255 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8256 {
8257 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8258 }
8259 }
8260 else
8261 {
8262 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8263 }
8264 }
8265
8266 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8267 {
8268 int type = oldLoc.GetType();
8270 {
8271 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8272 }
8274 {
8275 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8276 }
8277 }
8278 if (!m_OldLocation)
8279 {
8280 m_OldLocation = new InventoryLocation;
8281 }
8282 m_OldLocation.Copy(oldLoc);
8283 }
8284 else
8285 {
8286 if (m_OldLocation)
8287 {
8288 m_OldLocation.Reset();
8289 }
8290 }
8291
8293 }
8294 else
8295 {
8296 if (new_player)
8297 {
8298 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8299 if (res_index >= 0)
8300 {
8301 InventoryLocation il = new InventoryLocation;
8302 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8304 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8307 {
8308 il.
GetParent().GetOnReleaseLock().Invoke(it);
8309 }
8311 {
8313 }
8314
8315 }
8316 }
8318 {
8319
8321 }
8322
8323 if (m_OldLocation)
8324 {
8325 m_OldLocation.Reset();
8326 }
8327 }
8328 }
8329
8330 override void EOnContact(IEntity other, Contact extra)
8331 {
8333 {
8334 int liquidType = -1;
8336 if (impactSpeed > 0.0)
8337 {
8339 #ifndef SERVER
8341 #else
8343 SetSynchDirty();
8344 #endif
8346 }
8347 }
8348
8349 #ifdef SERVER
8350 if (GetCompEM() && GetCompEM().IsPlugged())
8351 {
8352 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8353 GetCompEM().UnplugThis();
8354 }
8355 #endif
8356 }
8357
8359
8361 {
8363 }
8364
8366 {
8367
8368 }
8369
8371 {
8372 super.OnItemLocationChanged(old_owner, new_owner);
8373
8374 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8375 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8376
8377 if (!relatedPlayer && playerNew)
8378 relatedPlayer = playerNew;
8379
8380 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8381 {
8383 if (actionMgr)
8384 {
8385 ActionBase currentAction = actionMgr.GetRunningAction();
8386 if (currentAction)
8388 }
8389 }
8390
8391 Man ownerPlayerOld = null;
8392 Man ownerPlayerNew = null;
8393
8394 if (old_owner)
8395 {
8396 if (old_owner.
IsMan())
8397 {
8398 ownerPlayerOld = Man.Cast(old_owner);
8399 }
8400 else
8401 {
8402 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8403 }
8404 }
8405 else
8406 {
8408 {
8410
8411 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8412 {
8413 GetCompEM().UnplugThis();
8414 }
8415 }
8416 }
8417
8418 if (new_owner)
8419 {
8420 if (new_owner.
IsMan())
8421 {
8422 ownerPlayerNew = Man.Cast(new_owner);
8423 }
8424 else
8425 {
8426 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8427 }
8428 }
8429
8430 if (ownerPlayerOld != ownerPlayerNew)
8431 {
8432 if (ownerPlayerOld)
8433 {
8434 array<EntityAI> subItemsExit = new array<EntityAI>;
8436 for (int i = 0; i < subItemsExit.Count(); i++)
8437 {
8440 }
8441 }
8442
8443 if (ownerPlayerNew)
8444 {
8445 array<EntityAI> subItemsEnter = new array<EntityAI>;
8447 for (int j = 0; j < subItemsEnter.Count(); j++)
8448 {
8451 }
8452 }
8453 }
8454 else if (ownerPlayerNew != null)
8455 {
8456 PlayerBase nplayer;
8457 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8458 {
8459 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8461 for (int k = 0; k < subItemsUpdate.Count(); k++)
8462 {
8464 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8465 }
8466 }
8467 }
8468
8469 if (old_owner)
8470 old_owner.OnChildItemRemoved(this);
8471 if (new_owner)
8472 new_owner.OnChildItemReceived(this);
8473 }
8474
8475
8477 {
8478 super.EEDelete(parent);
8479 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8480 if (player)
8481 {
8483
8484 if (player.IsAlive())
8485 {
8486 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8487 if (r_index >= 0)
8488 {
8489 InventoryLocation r_il = new InventoryLocation;
8490 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8491
8492 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8495 {
8496 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8497 }
8499 {
8500 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8501 }
8502
8503 }
8504
8505 player.RemoveQuickBarEntityShortcut(this);
8506 }
8507 }
8508 }
8509
8511 {
8512 super.EEKilled(killer);
8513
8516 {
8517 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8518 {
8519 if (IsMagazine())
8520 {
8521 if (Magazine.Cast(this).GetAmmoCount() > 0)
8522 {
8524 }
8525 }
8526 else
8527 {
8529 }
8530 }
8531 }
8532 }
8533
8535 {
8536 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8537
8538 super.OnWasAttached(parent, slot_id);
8539
8542
8544 }
8545
8547 {
8548 super.OnWasDetached(parent, slot_id);
8549
8552 }
8553
8555 {
8556 int idx;
8559
8560 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8561 if (inventory_slots.Count() < 1)
8562 {
8563 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8564 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8565 }
8566 else
8567 {
8568 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8569 }
8570
8571 idx = inventory_slots.Find(slot);
8572 if (idx < 0)
8573 return "";
8574
8575 return attach_types.Get(idx);
8576 }
8577
8579 {
8580 int idx = -1;
8581 string slot;
8582
8585
8586 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8587 if (inventory_slots.Count() < 1)
8588 {
8589 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8590 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8591 }
8592 else
8593 {
8594 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8595 if (detach_types.Count() < 1)
8596 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8597 }
8598
8599 for (int i = 0; i < inventory_slots.Count(); i++)
8600 {
8601 slot = inventory_slots.Get(i);
8602 }
8603
8604 if (slot != "")
8605 {
8606 if (detach_types.Count() == 1)
8607 idx = 0;
8608 else
8609 idx = inventory_slots.Find(slot);
8610 }
8611 if (idx < 0)
8612 return "";
8613
8614 return detach_types.Get(idx);
8615 }
8616
8618 {
8619
8621
8622
8623 float min_time = 1;
8624 float max_time = 3;
8625 float delay = Math.RandomFloat(min_time, max_time);
8626
8627 explode_timer.Run(delay, this, "DoAmmoExplosion");
8628 }
8629
8631 {
8632 Magazine magazine = Magazine.Cast(this);
8633 int pop_sounds_count = 6;
8634 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8635
8636
8637 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8638 string sound_name = pop_sounds[ sound_idx ];
8640
8641
8642 magazine.ServerAddAmmoCount(-1);
8643
8644
8645 float min_temp_to_explode = 100;
8646
8647 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8648 {
8650 }
8651 }
8652
8653
8654 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8655 {
8656 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8657
8658 const int CHANCE_DAMAGE_CARGO = 4;
8659 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8660 const int CHANCE_DAMAGE_NOTHING = 2;
8661
8663 {
8664 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8665 int chances;
8666 int rnd;
8667
8668 if (GetInventory().GetCargo())
8669 {
8670 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8671 rnd = Math.RandomInt(0,chances);
8672
8673 if (rnd < CHANCE_DAMAGE_CARGO)
8674 {
8676 }
8677 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8678 {
8680 }
8681 }
8682 else
8683 {
8684 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8685 rnd = Math.RandomInt(0,chances);
8686
8687 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8688 {
8690 }
8691 }
8692 }
8693 }
8694
8696 {
8697 if (GetInventory().GetCargo())
8698 {
8699 int item_count = GetInventory().GetCargo().GetItemCount();
8700 if (item_count > 0)
8701 {
8702 int random_pick = Math.RandomInt(0, item_count);
8704 if (!item.IsExplosive())
8705 {
8706 item.AddHealth("","",damage);
8707 return true;
8708 }
8709 }
8710 }
8711 return false;
8712 }
8713
8715 {
8716 int attachment_count = GetInventory().AttachmentCount();
8717 if (attachment_count > 0)
8718 {
8719 int random_pick = Math.RandomInt(0, attachment_count);
8720 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8721 if (!attachment.IsExplosive())
8722 {
8723 attachment.AddHealth("","",damage);
8724 return true;
8725 }
8726 }
8727 return false;
8728 }
8729
8731 {
8733 }
8734
8736 {
8738 return GetInventory().CanRemoveEntity();
8739
8740 return false;
8741 }
8742
8744 {
8745
8747 return false;
8748
8749
8751 return false;
8752
8753
8754
8756 if (delta == 0)
8757 return false;
8758
8759
8760 return true;
8761 }
8762
8764 {
8766 {
8767 if (ScriptInputUserData.CanStoreInputUserData())
8768 {
8769 ScriptInputUserData ctx = new ScriptInputUserData;
8774 ctx.
Write(destination_entity);
8778 }
8779 }
8780 else if (!
GetGame().IsMultiplayer())
8781 {
8783 }
8784 }
8785
8787 {
8788 float split_quantity_new;
8792 InventoryLocation loc = new InventoryLocation;
8793
8794 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8795 {
8797 split_quantity_new = stack_max;
8798 else
8800
8802 {
8803 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8804 if (new_item)
8805 {
8806 new_item.SetResultOfSplit(true);
8807 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8809 new_item.
SetQuantity(split_quantity_new,
false,
true);
8810 }
8811 }
8812 }
8813 else if (destination_entity && slot_id == -1)
8814 {
8815 if (quantity > stack_max)
8816 split_quantity_new = stack_max;
8817 else
8818 split_quantity_new = quantity;
8819
8821 {
8823 {
8826 }
8827
8828 if (new_item)
8829 {
8830 new_item.SetResultOfSplit(true);
8831 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8833 new_item.
SetQuantity(split_quantity_new,
false,
true);
8834 }
8835 }
8836 }
8837 else
8838 {
8839 if (stack_max != 0)
8840 {
8842 {
8844 }
8845
8846 if (split_quantity_new == 0)
8847 {
8848 if (!
GetGame().IsMultiplayer())
8849 player.PhysicalPredictiveDropItem(this);
8850 else
8851 player.ServerDropEntity(this);
8852 return;
8853 }
8854
8856 {
8858
8859 if (new_item)
8860 {
8861 new_item.SetResultOfSplit(true);
8862 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8865 new_item.PlaceOnSurface();
8866 }
8867 }
8868 }
8869 }
8870 }
8871
8873 {
8874 float split_quantity_new;
8878 InventoryLocation loc = new InventoryLocation;
8879
8880 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8881 {
8883 split_quantity_new = stack_max;
8884 else
8886
8888 {
8889 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8890 if (new_item)
8891 {
8892 new_item.SetResultOfSplit(true);
8893 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8895 new_item.
SetQuantity(split_quantity_new,
false,
true);
8896 }
8897 }
8898 }
8899 else if (destination_entity && slot_id == -1)
8900 {
8901 if (quantity > stack_max)
8902 split_quantity_new = stack_max;
8903 else
8904 split_quantity_new = quantity;
8905
8907 {
8909 {
8912 }
8913
8914 if (new_item)
8915 {
8916 new_item.SetResultOfSplit(true);
8917 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8919 new_item.
SetQuantity(split_quantity_new,
false,
true);
8920 }
8921 }
8922 }
8923 else
8924 {
8925 if (stack_max != 0)
8926 {
8928 {
8930 }
8931
8933 {
8935
8936 if (new_item)
8937 {
8938 new_item.SetResultOfSplit(true);
8939 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8942 new_item.PlaceOnSurface();
8943 }
8944 }
8945 }
8946 }
8947 }
8948
8950 {
8952 {
8953 if (ScriptInputUserData.CanStoreInputUserData())
8954 {
8955 ScriptInputUserData ctx = new ScriptInputUserData;
8960 dst.WriteToContext(ctx);
8962 }
8963 }
8964 else if (!
GetGame().IsMultiplayer())
8965 {
8967 }
8968 }
8969
8971 {
8973 {
8974 if (ScriptInputUserData.CanStoreInputUserData())
8975 {
8976 ScriptInputUserData ctx = new ScriptInputUserData;
8981 ctx.
Write(destination_entity);
8987 }
8988 }
8989 else if (!
GetGame().IsMultiplayer())
8990 {
8992 }
8993 }
8994
8996 {
8998 }
8999
9001 {
9003 float split_quantity_new;
9005 if (dst.IsValid())
9006 {
9007 int slot_id = dst.GetSlot();
9009
9010 if (quantity > stack_max)
9011 split_quantity_new = stack_max;
9012 else
9013 split_quantity_new = quantity;
9014
9016 {
9018
9019 if (new_item)
9020 {
9021 new_item.SetResultOfSplit(true);
9022 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9024 new_item.
SetQuantity(split_quantity_new,
false,
true);
9025 }
9026
9027 return new_item;
9028 }
9029 }
9030
9031 return null;
9032 }
9033
9035 {
9037 float split_quantity_new;
9039 if (destination_entity)
9040 {
9042 if (quantity > stackable)
9043 split_quantity_new = stackable;
9044 else
9045 split_quantity_new = quantity;
9046
9048 {
9049 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9050 if (new_item)
9051 {
9052 new_item.SetResultOfSplit(true);
9053 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9055 new_item.
SetQuantity(split_quantity_new,
false,
true);
9056 }
9057 }
9058 }
9059 }
9060
9062 {
9064 {
9065 if (ScriptInputUserData.CanStoreInputUserData())
9066 {
9067 ScriptInputUserData ctx = new ScriptInputUserData;
9072 ItemBase destination_entity =
this;
9073 ctx.
Write(destination_entity);
9077 }
9078 }
9079 else if (!
GetGame().IsMultiplayer())
9080 {
9082 }
9083 }
9084
9086 {
9088 float split_quantity_new;
9090 if (player)
9091 {
9093 if (quantity > stackable)
9094 split_quantity_new = stackable;
9095 else
9096 split_quantity_new = quantity;
9097
9099 {
9100 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9101 new_item =
ItemBase.Cast(in_hands);
9102 if (new_item)
9103 {
9104 new_item.SetResultOfSplit(true);
9105 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9107 new_item.SetQuantity(split_quantity_new, false, true);
9108 }
9109 }
9110 }
9111 }
9112
9114 {
9116 float split_quantity_new = Math.Floor(quantity * 0.5);
9117
9119 return;
9120
9122
9123 if (new_item)
9124 {
9125 if (new_item.GetQuantityMax() < split_quantity_new)
9126 {
9127 split_quantity_new = new_item.GetQuantityMax();
9128 }
9129
9130 new_item.SetResultOfSplit(true);
9131 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9132
9134 {
9137 }
9138 else
9139 {
9141 new_item.
SetQuantity(split_quantity_new,
false,
true);
9142 }
9143 }
9144 }
9145
9147 {
9149 float split_quantity_new = Math.Floor(quantity / 2);
9150
9152 return;
9153
9154 InventoryLocation invloc = new InventoryLocation;
9156
9158 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9159
9160 if (new_item)
9161 {
9162 if (new_item.GetQuantityMax() < split_quantity_new)
9163 {
9164 split_quantity_new = new_item.GetQuantityMax();
9165 }
9167 {
9170 }
9171 else if (split_quantity_new > 1)
9172 {
9174 new_item.
SetQuantity(split_quantity_new,
false,
true);
9175 }
9176 }
9177 }
9178
9181 {
9182 SetWeightDirty();
9184
9185 if (parent)
9186 parent.OnAttachmentQuantityChangedEx(this, delta);
9187
9189 {
9191 {
9193 }
9195 {
9196 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9198 }
9199 }
9200
9201 }
9202
9205 {
9206
9207 }
9208
9211 {
9213 }
9214
9216 {
9217 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9218
9220 {
9221 if (newLevel == GameConstants.STATE_RUINED)
9222 {
9224 EntityAI parent = GetHierarchyParent();
9225 if (parent && parent.IsFireplace())
9226 {
9227 CargoBase cargo = GetInventory().GetCargo();
9228 if (cargo)
9229 {
9231 {
9233 }
9234 }
9235 }
9236 }
9237
9239 {
9240
9242 return;
9243 }
9244
9245 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9246 {
9248 }
9249 }
9250 }
9251
9252
9254 {
9255 super.OnRightClick();
9256
9258 {
9260 {
9261 if (ScriptInputUserData.CanStoreInputUserData())
9262 {
9263 EntityAI root = GetHierarchyRoot();
9264 Man playerOwner = GetHierarchyRootPlayer();
9265 InventoryLocation dst = new InventoryLocation;
9266
9267
9268 if (!playerOwner && root && root == this)
9269 {
9271 }
9272 else
9273 {
9274
9275 GetInventory().GetCurrentInventoryLocation(dst);
9277 {
9280 {
9282 }
9283 else
9284 {
9286
9287
9288 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9289 {
9291 }
9292 else
9293 {
9294 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9295 }
9296 }
9297 }
9298 }
9299
9300 ScriptInputUserData ctx = new ScriptInputUserData;
9308 }
9309 }
9310 else if (!
GetGame().IsMultiplayer())
9311 {
9313 }
9314 }
9315 }
9316
9318 {
9319 if (root)
9320 {
9321 vector m4[4];
9322 root.GetTransform(m4);
9323 dst.SetGround(this, m4);
9324 }
9325 else
9326 {
9327 GetInventory().GetCurrentInventoryLocation(dst);
9328 }
9329 }
9330
9331 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9332 {
9333
9334 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9335 return false;
9336
9337 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9338 return false;
9339
9340
9342 return false;
9343
9344
9345 Magazine mag = Magazine.Cast(this);
9346 if (mag)
9347 {
9348 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9349 return false;
9350
9351 if (stack_max_limit)
9352 {
9353 Magazine other_mag = Magazine.Cast(other_item);
9354 if (other_item)
9355 {
9356 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9357 return false;
9358 }
9359
9360 }
9361 }
9362 else
9363 {
9364
9366 return false;
9367
9369 return false;
9370 }
9371
9372 PlayerBase player = null;
9373 if (CastTo(player, GetHierarchyRootPlayer()))
9374 {
9375 if (player.GetInventory().HasAttachment(this))
9376 return false;
9377
9378 if (player.IsItemsToDelete())
9379 return false;
9380 }
9381
9382 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9383 return false;
9384
9385 int slotID;
9387 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9388 return false;
9389
9390 return true;
9391 }
9392
9394 {
9396 }
9397
9399 {
9400 return m_IsResultOfSplit;
9401 }
9402
9404 {
9405 m_IsResultOfSplit = value;
9406 }
9407
9409 {
9411 }
9412
9414 {
9415 float other_item_quantity = other_item.GetQuantity();
9416 float this_free_space;
9417
9419
9421
9422 if (other_item_quantity > this_free_space)
9423 {
9424 return this_free_space;
9425 }
9426 else
9427 {
9428 return other_item_quantity;
9429 }
9430 }
9431
9433 {
9435 }
9436
9438 {
9440 return;
9441
9442 if (!IsMagazine() && other_item)
9443 {
9445 if (quantity_used != 0)
9446 {
9447 float hp1 = GetHealth01("","");
9448 float hp2 = other_item.GetHealth01("","");
9449 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9450 hpResult = hpResult / (
GetQuantity() + quantity_used);
9451
9452 hpResult *= GetMaxHealth();
9453 Math.Round(hpResult);
9454 SetHealth("", "Health", hpResult);
9455
9457 other_item.AddQuantity(-quantity_used);
9458 }
9459 }
9461 }
9462
9464 {
9465 #ifdef SERVER
9466 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9467 GetHierarchyParent().IncreaseLifetimeUp();
9468 #endif
9469 };
9470
9472 {
9473 PlayerBase p = PlayerBase.Cast(player);
9474
9475 array<int> recipesIds = p.m_Recipes;
9476 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9477 if (moduleRecipesManager)
9478 {
9479 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9480 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9481 }
9482
9483 for (int i = 0;i < recipesIds.Count(); i++)
9484 {
9485 int key = recipesIds.Get(i);
9486 string recipeName = moduleRecipesManager.GetRecipeName(key);
9488 }
9489 }
9490
9491
9492 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9493 {
9494 super.GetDebugActions(outputList);
9495
9496
9502
9503
9508
9513
9514
9518
9519
9521 {
9525 }
9526
9529
9530
9534
9536
9537 InventoryLocation loc = new InventoryLocation();
9538 GetInventory().GetCurrentInventoryLocation(loc);
9540 {
9541 if (Gizmo_IsSupported())
9544 }
9545
9547 }
9548
9549
9550
9551
9553 {
9554 super.OnAction(action_id, player, ctx);
9555
9557 {
9558 switch (action_id)
9559 {
9562 return true;
9565 return true;
9566 }
9567 }
9568
9570 {
9571 switch (action_id)
9572 {
9574 Delete();
9575 return true;
9576 }
9577 }
9578
9579 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9580 {
9581 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9582 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9583 PlayerBase p = PlayerBase.Cast(player);
9584 if (
EActions.RECIPES_RANGE_START < 1000)
9585 {
9586 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9587 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9588 }
9589 }
9590 #ifndef SERVER
9591 else if (action_id ==
EActions.WATCH_PLAYER)
9592 {
9593 PluginDeveloper.SetDeveloperItemClientEx(player);
9594 }
9595 #endif
9597 {
9598 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9599 {
9600 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9601 OnDebugButtonPressServer(id + 1);
9602 }
9603
9604 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9605 {
9606 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9608 }
9609
9610 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9611 {
9612 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9614 }
9615
9616 else if (action_id ==
EActions.ADD_QUANTITY)
9617 {
9618 if (IsMagazine())
9619 {
9620 Magazine mag = Magazine.Cast(this);
9621 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9622 }
9623 else
9624 {
9626 }
9627
9628 if (m_EM)
9629 {
9630 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9631 }
9632
9633 }
9634
9635 else if (action_id ==
EActions.REMOVE_QUANTITY)
9636 {
9637 if (IsMagazine())
9638 {
9639 Magazine mag2 = Magazine.Cast(this);
9640 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9641 }
9642 else
9643 {
9645 }
9646 if (m_EM)
9647 {
9648 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9649 }
9650
9651 }
9652
9653 else if (action_id ==
EActions.SET_QUANTITY_0)
9654 {
9656
9657 if (m_EM)
9658 {
9659 m_EM.SetEnergy(0);
9660 }
9661 }
9662
9663 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9664 {
9666
9667 if (m_EM)
9668 {
9669 m_EM.SetEnergy(m_EM.GetEnergyMax());
9670 }
9671 }
9672
9673 else if (action_id ==
EActions.ADD_HEALTH)
9674 {
9675 AddHealth("","",GetMaxHealth("","Health")/5);
9676 }
9677 else if (action_id ==
EActions.REMOVE_HEALTH)
9678 {
9679 AddHealth("","",-GetMaxHealth("","Health")/5);
9680 }
9681 else if (action_id ==
EActions.DESTROY_HEALTH)
9682 {
9683 SetHealth01("","",0);
9684 }
9685 else if (action_id ==
EActions.WATCH_ITEM)
9686 {
9688 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9689 #ifdef DEVELOPER
9690 SetDebugDeveloper_item(this);
9691 #endif
9692 }
9693
9694 else if (action_id ==
EActions.ADD_TEMPERATURE)
9695 {
9696 AddTemperature(20);
9697
9698 }
9699
9700 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9701 {
9702 AddTemperature(-20);
9703
9704 }
9705
9706 else if (action_id ==
EActions.FLIP_FROZEN)
9707 {
9708 SetFrozen(!GetIsFrozen());
9709
9710 }
9711
9712 else if (action_id ==
EActions.ADD_WETNESS)
9713 {
9715
9716 }
9717
9718 else if (action_id ==
EActions.REMOVE_WETNESS)
9719 {
9721
9722 }
9723
9724 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9725 {
9728
9729
9730 }
9731
9732 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9733 {
9736 }
9737
9738 else if (action_id ==
EActions.MAKE_SPECIAL)
9739 {
9740 auto debugParams = DebugSpawnParams.WithPlayer(player);
9741 OnDebugSpawnEx(debugParams);
9742 }
9743
9744 }
9745
9746
9747 return false;
9748 }
9749
9750
9751
9752
9756
9759
9760
9761
9763 {
9764 return false;
9765 }
9766
9767
9769 {
9770 return true;
9771 }
9772
9773
9775 {
9776 return true;
9777 }
9778
9779
9780
9782 {
9783 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9785 }
9786
9789 {
9790 return null;
9791 }
9792
9794 {
9795 return false;
9796 }
9797
9799 {
9800 return false;
9801 }
9802
9806
9807
9809 {
9810 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9811 return module_repairing.CanRepair(this, item_repair_kit);
9812 }
9813
9814
9815 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9816 {
9817 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9818 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9819 }
9820
9821
9823 {
9824
9825
9826
9827
9828
9829
9830
9831
9832 return 1;
9833 }
9834
9835
9836
9838 {
9840 }
9841
9842
9843
9845 {
9847 }
9848
9849
9858 {
9859 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9860
9861 if (player)
9862 {
9863 player.MessageStatus(text);
9864 }
9865 }
9866
9867
9876 {
9877 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9878
9879 if (player)
9880 {
9881 player.MessageAction(text);
9882 }
9883 }
9884
9885
9894 {
9895 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9896
9897 if (player)
9898 {
9899 player.MessageFriendly(text);
9900 }
9901 }
9902
9903
9912 {
9913 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9914
9915 if (player)
9916 {
9917 player.MessageImportant(text);
9918 }
9919 }
9920
9922 {
9923 return true;
9924 }
9925
9926
9927 override bool KindOf(
string tag)
9928 {
9929 bool found = false;
9930 string item_name = this.
GetType();
9933
9934 int array_size = item_tag_array.Count();
9935 for (int i = 0; i < array_size; i++)
9936 {
9937 if (item_tag_array.Get(i) == tag)
9938 {
9939 found = true;
9940 break;
9941 }
9942 }
9943 return found;
9944 }
9945
9946
9948 {
9949
9950 super.OnRPC(sender, rpc_type,ctx);
9951
9952
9953 switch (rpc_type)
9954 {
9955 #ifndef SERVER
9956 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9957 Param2<bool, string> p = new Param2<bool, string>(false, "");
9958
9960 return;
9961
9962 bool play = p.param1;
9963 string soundSet = p.param2;
9964
9965 if (play)
9966 {
9968 {
9970 {
9972 }
9973 }
9974 else
9975 {
9977 }
9978 }
9979 else
9980 {
9982 }
9983
9984 break;
9985 #endif
9986
9987 }
9988
9990 {
9992 }
9993 }
9994
9995
9996
9997
9999 {
10000 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10001 return plugin.GetID(
name);
10002 }
10003
10005 {
10006 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10007 return plugin.GetName(id);
10008 }
10009
10012 {
10013
10014
10015 int varFlags;
10016 if (!ctx.
Read(varFlags))
10017 return;
10018
10019 if (varFlags & ItemVariableFlags.FLOAT)
10020 {
10022 }
10023 }
10024
10026 {
10027
10028 super.SerializeNumericalVars(floats_out);
10029
10030
10031
10033 {
10035 }
10036
10038 {
10040 }
10041
10043 {
10045 }
10046
10048 {
10053 }
10054
10056 {
10058 }
10059 }
10060
10062 {
10063
10064 super.DeSerializeNumericalVars(floats);
10065
10066
10067 int index = 0;
10068 int mask = Math.Round(floats.Get(index));
10069
10070 index++;
10071
10073 {
10075 {
10077 }
10078 else
10079 {
10080 float quantity = floats.Get(index);
10081 SetQuantity(quantity,
true,
false,
false,
false);
10082 }
10083 index++;
10084 }
10085
10087 {
10088 float wet = floats.Get(index);
10090 index++;
10091 }
10092
10094 {
10095 int liquidtype = Math.Round(floats.Get(index));
10097 index++;
10098 }
10099
10101 {
10103 index++;
10105 index++;
10107 index++;
10109 index++;
10110 }
10111
10113 {
10114 int cleanness = Math.Round(floats.Get(index));
10116 index++;
10117 }
10118 }
10119
10121 {
10122 super.WriteVarsToCTX(ctx);
10123
10124
10126 {
10128 }
10129
10131 {
10133 }
10134
10136 {
10138 }
10139
10141 {
10142 int r,g,b,a;
10148 }
10149
10151 {
10153 }
10154 }
10155
10157 {
10158 if (!super.ReadVarsFromCTX(ctx,version))
10159 return false;
10160
10161 int intValue;
10162 float value;
10163
10164 if (version < 140)
10165 {
10166 if (!ctx.
Read(intValue))
10167 return false;
10168
10169 m_VariablesMask = intValue;
10170 }
10171
10173 {
10174 if (!ctx.
Read(value))
10175 return false;
10176
10178 {
10180 }
10181 else
10182 {
10184 }
10185 }
10186
10187 if (version < 140)
10188 {
10190 {
10191 if (!ctx.
Read(value))
10192 return false;
10193 SetTemperatureDirect(value);
10194 }
10195 }
10196
10198 {
10199 if (!ctx.
Read(value))
10200 return false;
10202 }
10203
10205 {
10206 if (!ctx.
Read(intValue))
10207 return false;
10209 }
10210
10212 {
10213 int r,g,b,a;
10215 return false;
10217 return false;
10219 return false;
10221 return false;
10222
10224 }
10225
10227 {
10228 if (!ctx.
Read(intValue))
10229 return false;
10231 }
10232
10233 if (version >= 138 && version < 140)
10234 {
10236 {
10237 if (!ctx.
Read(intValue))
10238 return false;
10239 SetFrozen(intValue);
10240 }
10241 }
10242
10243 return true;
10244 }
10245
10246
10248 {
10251 {
10253 }
10254
10255 if (!super.OnStoreLoad(ctx, version))
10256 {
10258 return false;
10259 }
10260
10261 if (version >= 114)
10262 {
10263 bool hasQuickBarIndexSaved;
10264
10265 if (!ctx.
Read(hasQuickBarIndexSaved))
10266 {
10268 return false;
10269 }
10270
10271 if (hasQuickBarIndexSaved)
10272 {
10273 int itmQBIndex;
10274
10275
10276 if (!ctx.
Read(itmQBIndex))
10277 {
10279 return false;
10280 }
10281
10282 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10283 if (itmQBIndex != -1 && parentPlayer)
10284 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10285 }
10286 }
10287 else
10288 {
10289
10290 PlayerBase player;
10291 int itemQBIndex;
10292 if (version ==
int.
MAX)
10293 {
10294 if (!ctx.
Read(itemQBIndex))
10295 {
10297 return false;
10298 }
10299 }
10300 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10301 {
10302
10303 if (!ctx.
Read(itemQBIndex))
10304 {
10306 return false;
10307 }
10308 if (itemQBIndex != -1 && player)
10309 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10310 }
10311 }
10312
10313 if (version < 140)
10314 {
10315
10316 if (!LoadVariables(ctx, version))
10317 {
10319 return false;
10320 }
10321 }
10322
10323
10325 {
10327 return false;
10328 }
10329 if (version >= 132)
10330 {
10332 if (raib)
10333 {
10335 {
10337 return false;
10338 }
10339 }
10340 }
10341
10343 return true;
10344 }
10345
10346
10347
10349 {
10350 super.OnStoreSave(ctx);
10351
10352 PlayerBase player;
10353 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10354 {
10356
10357 int itemQBIndex = -1;
10358 itemQBIndex = player.FindQuickBarEntityIndex(this);
10359 ctx.
Write(itemQBIndex);
10360 }
10361 else
10362 {
10364 }
10365
10367
10369 if (raib)
10370 {
10372 }
10373 }
10374
10375
10377 {
10378 super.AfterStoreLoad();
10379
10381 {
10383 }
10384
10386 {
10389 }
10390 }
10391
10393 {
10394 super.EEOnAfterLoad();
10395
10397 {
10399 }
10400
10403 }
10404
10406 {
10407 return false;
10408 }
10409
10410
10411
10413 {
10415 {
10416 #ifdef PLATFORM_CONSOLE
10417
10419 {
10421 if (menu)
10422 {
10424 }
10425 }
10426 #endif
10427 }
10428
10430 {
10433 }
10434
10436 {
10437 SetWeightDirty();
10439 }
10441 {
10444 }
10445
10447 {
10450 }
10452 {
10455 }
10456
10457 super.OnVariablesSynchronized();
10458 }
10459
10460
10461
10463 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10464 {
10465 if (!IsServerCheck(allow_client))
10466 return false;
10467
10469 return false;
10470
10473
10474 if (value <= (min + 0.001))
10475 value = min;
10476
10477 if (value == min)
10478 {
10479 if (destroy_config)
10480 {
10481 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10482 if (dstr)
10483 {
10485 this.Delete();
10486 return true;
10487 }
10488 }
10489 else if (destroy_forced)
10490 {
10492 this.Delete();
10493 return true;
10494 }
10495
10497 }
10498
10501
10503 {
10505
10506 if (delta)
10508 }
10509
10511
10512 return false;
10513 }
10514
10515
10517 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10518 {
10520 }
10521
10523 {
10526 }
10527
10529 {
10532 }
10533
10535 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10536 {
10537 float value_clamped = Math.Clamp(value, 0, 1);
10539 SetQuantity(result, destroy_config, destroy_forced);
10540 }
10541
10542
10545 {
10547 }
10548
10550 {
10552 }
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10564 {
10565 int slot = -1;
10566 if (GetInventory())
10567 {
10568 InventoryLocation il = new InventoryLocation;
10569 GetInventory().GetCurrentInventoryLocation(il);
10571 }
10572
10574 }
10575
10577 {
10578 float quantity_max = 0;
10579
10581 {
10582 if (attSlotID != -1)
10583 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10584
10585 if (quantity_max <= 0)
10587 }
10588
10589 if (quantity_max <= 0)
10591
10592 return quantity_max;
10593 }
10594
10596 {
10598 }
10599
10601 {
10603 }
10604
10605
10607 {
10609 }
10610
10612 {
10614 }
10615
10617 {
10619 }
10620
10621
10623 {
10624
10625 float weightEx = GetWeightEx();
10626 float special = GetInventoryAndCargoWeight();
10627 return weightEx - special;
10628 }
10629
10630
10632 {
10634 }
10635
10637 {
10639 {
10640 #ifdef DEVELOPER
10641 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10642 {
10643 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10645 }
10646 #endif
10647
10648 return GetQuantity() * GetConfigWeightModified();
10649 }
10650 else if (HasEnergyManager())
10651 {
10652 #ifdef DEVELOPER
10653 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10654 {
10655 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10656 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10657 }
10658 #endif
10659 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10660 }
10661 else
10662 {
10663 #ifdef DEVELOPER
10664 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10665 {
10666 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10667 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10668 }
10669 #endif
10670 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10671 }
10672 }
10673
10676 {
10677 int item_count = 0;
10679
10680 if (GetInventory().GetCargo() != NULL)
10681 {
10682 item_count = GetInventory().GetCargo().GetItemCount();
10683 }
10684
10685 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10686 {
10687 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10688 if (item)
10689 item_count += item.GetNumberOfItems();
10690 }
10691 return item_count;
10692 }
10693
10696 {
10697 float weight = 0;
10698 float wetness = 1;
10699 if (include_wetness)
10702 {
10703 weight = wetness * m_ConfigWeight;
10704 }
10706 {
10707 weight = 1;
10708 }
10709 return weight;
10710 }
10711
10712
10713
10715 {
10716 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10717 {
10718 GameInventory inv = GetInventory();
10719 array<EntityAI> items = new array<EntityAI>;
10721 for (int i = 0; i < items.Count(); i++)
10722 {
10724 if (item)
10725 {
10727 }
10728 }
10729 }
10730 }
10731
10732
10733
10734
10736 {
10737 float energy = 0;
10738 if (HasEnergyManager())
10739 {
10740 energy = GetCompEM().GetEnergy();
10741 }
10742 return energy;
10743 }
10744
10745
10747 {
10748 super.OnEnergyConsumed();
10749
10751 }
10752
10754 {
10755 super.OnEnergyAdded();
10756
10758 }
10759
10760
10762 {
10763 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10764 {
10766 {
10767 float energy_0to1 = GetCompEM().GetEnergy0To1();
10769 }
10770 }
10771 }
10772
10773
10775 {
10776 return ConfigGetFloat("heatIsolation");
10777 }
10778
10780 {
10782 }
10783
10785 {
10786 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10787 if (
GetGame().ConfigIsExisting(paramPath))
10789
10790 return 0.0;
10791 }
10792
10794 {
10795 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10796 if (
GetGame().ConfigIsExisting(paramPath))
10798
10799 return 0.0;
10800 }
10801
10802 override void SetWet(
float value,
bool allow_client =
false)
10803 {
10804 if (!IsServerCheck(allow_client))
10805 return;
10806
10809
10811
10812 m_VarWet = Math.Clamp(value, min, max);
10813
10815 {
10818 }
10819 }
10820
10821 override void AddWet(
float value)
10822 {
10824 }
10825
10827 {
10829 }
10830
10832 {
10834 }
10835
10837 {
10839 }
10840
10842 {
10844 }
10845
10847 {
10849 }
10850
10851 override void OnWetChanged(
float newVal,
float oldVal)
10852 {
10855 if (newLevel != oldLevel)
10856 {
10858 }
10859 }
10860
10862 {
10863 SetWeightDirty();
10864 }
10865
10867 {
10868 return GetWetLevelInternal(
m_VarWet);
10869 }
10870
10871
10872
10874 {
10876 }
10877
10879 {
10881 }
10882
10884 {
10886 }
10887
10889 {
10891 }
10892
10893
10894
10896 {
10897 if (ConfigIsExisting("itemModelLength"))
10898 {
10899 return ConfigGetFloat("itemModelLength");
10900 }
10901 return 0;
10902 }
10903
10905 {
10906 if (ConfigIsExisting("itemAttachOffset"))
10907 {
10908 return ConfigGetFloat("itemAttachOffset");
10909 }
10910 return 0;
10911 }
10912
10913 override void SetCleanness(
int value,
bool allow_client =
false)
10914 {
10915 if (!IsServerCheck(allow_client))
10916 return;
10917
10919
10921
10924 }
10925
10927 {
10929 }
10930
10932 {
10933 return true;
10934 }
10935
10936
10937
10938
10940 {
10942 }
10943
10945 {
10947 }
10948
10949
10950
10951
10952 override void SetColor(
int r,
int g,
int b,
int a)
10953 {
10959 }
10961 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10962 {
10967 }
10968
10970 {
10972 }
10973
10976 {
10977 int r,g,b,a;
10979 r = r/255;
10980 g = g/255;
10981 b = b/255;
10982 a = a/255;
10983 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10984 }
10985
10986
10987
10988 override void SetLiquidType(
int value,
bool allow_client =
false)
10989 {
10990 if (!IsServerCheck(allow_client))
10991 return;
10992
10997 }
10998
11000 {
11001 return ConfigGetInt("varLiquidTypeInit");
11002 }
11003
11005 {
11007 }
11008
11010 {
11012 SetFrozen(false);
11013 }
11014
11017 {
11018 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11019 }
11020
11021
11024 {
11025 PlayerBase nplayer;
11026 if (PlayerBase.CastTo(nplayer, player))
11027 {
11029
11030 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11031 }
11032 }
11033
11034
11037 {
11038 PlayerBase nplayer;
11039 if (PlayerBase.CastTo(nplayer,player))
11040 {
11041
11042 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11043
11044 }
11045
11046
11047 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11048
11049
11050 if (HasEnergyManager())
11051 {
11052 GetCompEM().UpdatePlugState();
11053 }
11054 }
11055
11056
11058 {
11059 super.OnPlacementStarted(player);
11060
11062 }
11063
11064 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11065 {
11067 {
11068 m_AdminLog.OnPlacementComplete(player,
this);
11069 }
11070
11071 super.OnPlacementComplete(player, position, orientation);
11072 }
11073
11074
11075
11076
11077
11079 {
11081 {
11082 return true;
11083 }
11084 else
11085 {
11086 return false;
11087 }
11088 }
11089
11090
11092 {
11094 {
11096 }
11097 }
11098
11099
11101 {
11103 }
11104
11106 {
11108 }
11109
11110 override void InsertAgent(
int agent,
float count = 1)
11111 {
11112 if (count < 1)
11113 return;
11114
11116 }
11117
11120 {
11122 }
11123
11124
11126 {
11128 }
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11172 {
11174 return false;
11175 return true;
11176 }
11177
11179 {
11180
11182 }
11183
11184
11187 {
11188 super.CheckForRoofLimited(timeTresholdMS);
11189
11191 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11192 {
11193 m_PreviousRoofTestTime = time;
11194 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11195 }
11196 }
11197
11198
11200 {
11202 {
11203 return 0;
11204 }
11205
11206 if (GetInventory().GetAttachmentSlotsCount() != 0)
11207 {
11208 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11209 if (filter)
11210 return filter.GetProtectionLevel(type, false, system);
11211 else
11212 return 0;
11213 }
11214
11215 string subclassPath, entryName;
11216
11217 switch (type)
11218 {
11220 entryName = "biological";
11221 break;
11223 entryName = "chemical";
11224 break;
11225 default:
11226 entryName = "biological";
11227 break;
11228 }
11229
11230 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11231
11233 }
11234
11235
11236
11239 {
11240 if (!IsMagazine())
11242
11244 }
11245
11246
11247
11248
11249
11254 {
11255 return true;
11256 }
11257
11259 {
11261 }
11262
11263
11264
11265
11266
11268 {
11269 if (parent)
11270 {
11271 if (parent.IsInherited(DayZInfected))
11272 return true;
11273
11274 if (!parent.IsRuined())
11275 return true;
11276 }
11277
11278 return true;
11279 }
11280
11282 {
11283 if (!super.CanPutAsAttachment(parent))
11284 {
11285 return false;
11286 }
11287
11288 if (!IsRuined() && !parent.IsRuined())
11289 {
11290 return true;
11291 }
11292
11293 return false;
11294 }
11295
11297 {
11298
11299
11300
11301
11302 return super.CanReceiveItemIntoCargo(item);
11303 }
11304
11306 {
11307
11308
11309
11310
11311 GameInventory attachmentInv = attachment.GetInventory();
11313 {
11314 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11315 return false;
11316 }
11317
11318 InventoryLocation loc = new InventoryLocation();
11319 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11320 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11321 return false;
11322
11323 return super.CanReceiveAttachment(attachment, slotId);
11324 }
11325
11327 {
11328 if (!super.CanReleaseAttachment(attachment))
11329 return false;
11330
11331 return GetInventory().AreChildrenAccessible();
11332 }
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11355 {
11356 int id = muzzle_owner.GetMuzzleID();
11357 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11358
11359 if (WPOF_array)
11360 {
11361 for (int i = 0; i < WPOF_array.Count(); i++)
11362 {
11363 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11364
11365 if (WPOF)
11366 {
11367 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11368 }
11369 }
11370 }
11371 }
11372
11373
11375 {
11376 int id = muzzle_owner.GetMuzzleID();
11378
11379 if (WPOBE_array)
11380 {
11381 for (int i = 0; i < WPOBE_array.Count(); i++)
11382 {
11383 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11384
11385 if (WPOBE)
11386 {
11387 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11388 }
11389 }
11390 }
11391 }
11392
11393
11395 {
11396 int id = muzzle_owner.GetMuzzleID();
11397 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11398
11399 if (WPOOH_array)
11400 {
11401 for (int i = 0; i < WPOOH_array.Count(); i++)
11402 {
11403 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11404
11405 if (WPOOH)
11406 {
11407 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11408 }
11409 }
11410 }
11411 }
11412
11413
11415 {
11416 int id = muzzle_owner.GetMuzzleID();
11417 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11418
11419 if (WPOOH_array)
11420 {
11421 for (int i = 0; i < WPOOH_array.Count(); i++)
11422 {
11423 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11424
11425 if (WPOOH)
11426 {
11427 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11428 }
11429 }
11430 }
11431 }
11432
11433
11435 {
11436 int id = muzzle_owner.GetMuzzleID();
11437 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11438
11439 if (WPOOH_array)
11440 {
11441 for (int i = 0; i < WPOOH_array.Count(); i++)
11442 {
11443 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11444
11445 if (WPOOH)
11446 {
11447 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11448 }
11449 }
11450 }
11451 }
11452
11453
11454
11456 {
11458 {
11459 return true;
11460 }
11461
11462 return false;
11463 }
11464
11466 {
11468 {
11469 return true;
11470 }
11471
11472 return false;
11473 }
11474
11476 {
11478 {
11479 return true;
11480 }
11481
11482 return false;
11483 }
11484
11486 {
11487 return false;
11488 }
11489
11492 {
11493 return UATimeSpent.DEFAULT_DEPLOY;
11494 }
11495
11496
11497
11498
11500 {
11502 SetSynchDirty();
11503 }
11504
11506 {
11508 }
11509
11510
11512 {
11513 return false;
11514 }
11515
11518 {
11519 string att_type = "None";
11520
11521 if (ConfigIsExisting("soundAttType"))
11522 {
11523 att_type = ConfigGetString("soundAttType");
11524 }
11525
11527 }
11528
11530 {
11532 }
11533
11534
11535
11536
11537
11543
11545 {
11548
11550 }
11551
11552
11554 {
11556 return;
11557
11559
11562
11565
11566 SoundParameters params = new SoundParameters();
11570 }
11571
11572
11574 {
11576 return;
11577
11579 SetSynchDirty();
11580
11583 }
11584
11585
11587 {
11589 return;
11590
11592 SetSynchDirty();
11593
11596 }
11597
11599 {
11601 }
11602
11604 {
11606 }
11607
11610 {
11611 if (!
GetGame().IsDedicatedServer())
11612 {
11613 if (ConfigIsExisting("attachSoundSet"))
11614 {
11615 string cfg_path = "";
11616 string soundset = "";
11617 string type_name =
GetType();
11618
11621 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11622 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11623
11624 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11625 {
11626 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11627 {
11628 if (cfg_slot_array[i] == slot_type)
11629 {
11630 soundset = cfg_soundset_array[i];
11631 break;
11632 }
11633 }
11634 }
11635
11636 if (soundset != "")
11637 {
11638 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11640 }
11641 }
11642 }
11643 }
11644
11646 {
11647
11648 }
11649
11650 void OnApply(PlayerBase player);
11651
11653 {
11654 return 1.0;
11655 };
11656
11658 {
11660 }
11661
11663 {
11665 }
11666
11668
11670 {
11671 SetDynamicPhysicsLifeTime(0.01);
11673 }
11674
11676 {
11677 array<string> zone_names = new array<string>;
11678 GetDamageZones(zone_names);
11679 for (int i = 0; i < zone_names.Count(); i++)
11680 {
11681 SetHealthMax(zone_names.Get(i),"Health");
11682 }
11683 SetHealthMax("","Health");
11684 }
11685
11688 {
11689 float global_health = GetHealth01("","Health");
11690 array<string> zones = new array<string>;
11691 GetDamageZones(zones);
11692
11693 for (int i = 0; i < zones.Count(); i++)
11694 {
11695 SetHealth01(zones.Get(i),"Health",global_health);
11696 }
11697 }
11698
11701 {
11702 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11703 }
11704
11706 {
11707 if (!hasRootAsPlayer)
11708 {
11709 if (refParentIB)
11710 {
11711
11712 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11713 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11714
11715 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11716 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11717
11720 }
11721 else
11722 {
11723
11726 }
11727 }
11728 }
11729
11731 {
11733 {
11734 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11735 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11736 {
11737 float heatPermCoef = 1.0;
11739 while (ent)
11740 {
11741 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11742 ent = ent.GetHierarchyParent();
11743 }
11744
11745 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11746 }
11747 }
11748 }
11749
11751 {
11752
11753 EntityAI parent = GetHierarchyParent();
11754 if (!parent)
11755 {
11756 hasParent = false;
11757 hasRootAsPlayer = false;
11758 }
11759 else
11760 {
11761 hasParent = true;
11762 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11763 refParentIB =
ItemBase.Cast(parent);
11764 }
11765 }
11766
11767 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11768 {
11769
11770 }
11771
11773 {
11774
11775 return false;
11776 }
11777
11779 {
11780
11781
11782 return false;
11783 }
11784
11786 {
11787
11788 return false;
11789 }
11790
11793 {
11794 return !GetIsFrozen() &&
IsOpen();
11795 }
11796
11798 {
11799 bool hasParent = false, hasRootAsPlayer = false;
11801
11802 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11803 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11804
11805 if (wwtu || foodDecay)
11806 {
11810
11811 if (processWetness || processTemperature || processDecay)
11812 {
11814
11815 if (processWetness)
11816 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11817
11818 if (processTemperature)
11820
11821 if (processDecay)
11822 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11823 }
11824 }
11825 }
11826
11829 {
11831 }
11832
11834 {
11837
11838 return super.GetTemperatureFreezeThreshold();
11839 }
11840
11842 {
11845
11846 return super.GetTemperatureThawThreshold();
11847 }
11848
11850 {
11853
11854 return super.GetItemOverheatThreshold();
11855 }
11856
11858 {
11860 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11861
11862 return super.GetTemperatureFreezeTime();
11863 }
11864
11866 {
11868 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11869
11870 return super.GetTemperatureThawTime();
11871 }
11872
11877
11879 {
11880 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11881 }
11882
11884 {
11885 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11886 }
11887
11890 {
11892 }
11893
11895 {
11897 }
11898
11900 {
11902 }
11903
11906 {
11907 return null;
11908 }
11909
11912 {
11913 return false;
11914 }
11915
11917 {
11919 {
11922 if (!trg)
11923 {
11925 explosive = this;
11926 }
11927
11928 explosive.PairRemote(trg);
11930
11931 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11932 trg.SetPersistentPairID(persistentID);
11933 explosive.SetPersistentPairID(persistentID);
11934
11935 return true;
11936 }
11937 return false;
11938 }
11939
11942 {
11943 float ret = 1.0;
11946 ret *= GetHealth01();
11947
11948 return ret;
11949 }
11950
11951 #ifdef DEVELOPER
11952 override void SetDebugItem()
11953 {
11954 super.SetDebugItem();
11955 _itemBase = this;
11956 }
11957
11959 {
11960 string text = super.GetDebugText();
11961
11963 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11964
11965 return text;
11966 }
11967 #endif
11968
11970 {
11971 return true;
11972 }
11973
11975
11977
11979 {
11982 }
11983
11984
11992
12008}
12009
12011{
12013 if (entity)
12014 {
12015 bool is_item = entity.IsInherited(
ItemBase);
12016 if (is_item && full_quantity)
12017 {
12020 }
12021 }
12022 else
12023 {
12025 return NULL;
12026 }
12027 return entity;
12028}
12029
12031{
12032 if (item)
12033 {
12034 if (health > 0)
12035 item.SetHealth("", "", health);
12036
12037 if (item.CanHaveTemperature())
12038 {
12040 if (item.CanFreeze())
12041 item.SetFrozen(false);
12042 }
12043
12044 if (item.HasEnergyManager())
12045 {
12046 if (quantity >= 0)
12047 {
12048 item.GetCompEM().SetEnergy0To1(quantity);
12049 }
12050 else
12051 {
12053 }
12054 }
12055 else if (item.IsMagazine())
12056 {
12057 Magazine mag = Magazine.Cast(item);
12058 if (quantity >= 0)
12059 {
12060 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12061 }
12062 else
12063 {
12065 }
12066
12067 }
12068 else
12069 {
12070 if (quantity >= 0)
12071 {
12072 item.SetQuantityNormalized(quantity, false);
12073 }
12074 else
12075 {
12077 }
12078
12079 }
12080 }
12081}
12082
12083#ifdef DEVELOPER
12085#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.