7237{
7239 {
7240 return true;
7241 }
7242};
7243
7245{
7246
7247};
7248
7249
7250
7252{
7256
7258
7261
7262
7263
7264
7265
7274
7280
7285
7290
7311 protected bool m_IsResultOfSplit
7312
7314
7319
7320
7321
7323
7327
7328
7329
7331
7334
7335
7336
7342
7343
7351
7354
7355
7357
7358
7360
7361
7366
7367
7372
7374
7375
7377
7378
7380 {
7385
7386 if (!
g_Game.IsDedicatedServer())
7387 {
7389 {
7391
7393 {
7395 }
7396 }
7397
7400 }
7401
7402 m_OldLocation = null;
7403
7405 {
7407 }
7408
7409 if (ConfigIsExisting("headSelectionsToHide"))
7410 {
7413 }
7414
7416 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7417 {
7419 }
7420
7422
7423 m_IsResultOfSplit = false;
7424
7426 }
7427
7429 {
7430 super.InitItemVariables();
7431
7437 m_Count = ConfigGetInt(
"count");
7438
7441
7446
7449
7454
7466
7470
7471
7474 if (ConfigIsExisting("canBeSplit"))
7475 {
7478 }
7479
7481 if (ConfigIsExisting("itemBehaviour"))
7483
7484
7487 RegisterNetSyncVariableInt("m_VarLiquidType");
7488 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7489
7490 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7491 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7492 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7493
7494 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7495 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7496 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7497 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7498
7499 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7500 RegisterNetSyncVariableBool("m_IsTakeable");
7501 RegisterNetSyncVariableBool("m_IsHologram");
7502
7505 {
7508 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7509 }
7510
7512
7514 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7516
7518 }
7519
7521 {
7523 }
7524
7526 {
7529 {
7534 }
7535 }
7536
7537 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7538 {
7540 {
7543 }
7544
7546 }
7547
7549 {
7555 }
7556
7558
7560 {
7562
7563 if (!action)
7564 {
7565 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7566 return;
7567 }
7568
7570 if (!ai)
7571 {
7573 return;
7574 }
7575
7577 if (!action_array)
7578 {
7579 action_array = new array<ActionBase_Basic>;
7581 }
7582 if (LogManager.IsActionLogEnable())
7583 {
7584 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7585 }
7586
7587 if (action_array.Find(action) != -1)
7588 {
7589 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7590 }
7591 else
7592 {
7593 action_array.Insert(action);
7594 }
7595 }
7596
7598 {
7599 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7600 ActionBase action = player.GetActionManager().GetAction(actionName);
7603
7604 if (action_array)
7605 {
7606 action_array.RemoveItem(action);
7607 }
7608 }
7609
7610
7611
7613 {
7614 ActionOverrideData overrideData = new ActionOverrideData();
7618
7620 if (!actionMap)
7621 {
7624 }
7625
7626 actionMap.Insert(this.
Type(), overrideData);
7627
7628 }
7629
7631
7633
7634
7636 {
7639
7642
7643 string config_to_search = "CfgVehicles";
7644 string muzzle_owner_config;
7645
7647 {
7648 if (IsInherited(Weapon))
7649 config_to_search = "CfgWeapons";
7650
7651 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7652
7653 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7654
7655 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7656
7657 if (config_OnFire_subclass_count > 0)
7658 {
7659 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7660
7661 for (int i = 0; i < config_OnFire_subclass_count; i++)
7662 {
7663 string particle_class = "";
7664 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7665 string config_OnFire_entry = config_OnFire_class + particle_class;
7666 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7667 WPOF_array.Insert(WPOF);
7668 }
7669
7670
7672 }
7673 }
7674
7676 {
7677 config_to_search = "CfgWeapons";
7678 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7679
7680 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7681
7682 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7683
7684 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7685 {
7686 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7687
7688 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7689 {
7690 string particle_class2 = "";
7691 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7692 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7693 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7694 WPOBE_array.Insert(WPOBE);
7695 }
7696
7697
7699 }
7700 }
7701 }
7702
7703
7705 {
7708
7710 {
7711 string config_to_search = "CfgVehicles";
7712
7713 if (IsInherited(Weapon))
7714 config_to_search = "CfgWeapons";
7715
7716 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7717 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7718
7719 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7720 {
7721
7723
7725 {
7727 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7729 return;
7730 }
7731
7734
7735
7736
7737 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7738 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7739
7740 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7741 {
7742 string particle_class = "";
7743 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7744 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7745 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7746
7747 if (entry_type == CT_CLASS)
7748 {
7749 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7750 WPOOH_array.Insert(WPOF);
7751 }
7752 }
7753
7754
7756 }
7757 }
7758 }
7759
7761 {
7763 }
7764
7766 {
7768 {
7770
7773
7776
7777 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7778 }
7779 }
7780
7782 {
7784 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7785
7787 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7788
7790 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7791
7793 {
7795 }
7796 }
7797
7799 {
7801 }
7802
7804 {
7807 else
7809
7811 {
7814 }
7815 else
7816 {
7819
7822 }
7823
7825 }
7826
7828 {
7830 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7831 }
7832
7834 {
7836 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7838 }
7839
7841 {
7843 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7844 }
7845
7847 {
7850
7851 OverheatingParticle OP = new OverheatingParticle();
7856
7858 }
7859
7861 {
7864
7865 return -1;
7866 }
7867
7869 {
7871 {
7874
7875 for (int i = count; i > 0; --i)
7876 {
7877 int id = i - 1;
7880
7883
7884 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7885 {
7886 if (p)
7887 {
7890 }
7891 }
7892 }
7893 }
7894 }
7895
7897 {
7899 {
7901 {
7902 int id = i - 1;
7904
7905 if (OP)
7906 {
7908
7909 if (p)
7910 {
7912 }
7913
7914 delete OP;
7915 }
7916 }
7917
7920 }
7921 }
7922
7925 {
7926 return 0.0;
7927 }
7928
7929
7931 {
7932 return 250;
7933 }
7934
7936 {
7937 return 0;
7938 }
7939
7942 {
7944 return true;
7945
7946 return false;
7947 }
7948
7951 {
7954
7956 {
7958 }
7959 else
7960 {
7961
7963 }
7964
7966 }
7967
7974 {
7975 return -1;
7976 }
7977
7978
7979
7980
7982 {
7984 {
7985 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7986 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7987
7988 if (r_index >= 0)
7989 {
7990 InventoryLocation r_il = new InventoryLocation;
7991 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7992
7993 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7996 {
7997 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7998 }
8000 {
8001 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8002 }
8003
8004 }
8005
8006 player.GetHumanInventory().ClearUserReservedLocation(this);
8007 }
8008
8011 }
8012
8013
8014
8015
8017 {
8018 return ItemBase.m_DebugActionsMask;
8019 }
8020
8022 {
8023 return ItemBase.m_DebugActionsMask & mask;
8024 }
8025
8027 {
8028 ItemBase.m_DebugActionsMask = mask;
8029 }
8030
8032 {
8033 ItemBase.m_DebugActionsMask |= mask;
8034 }
8035
8037 {
8038 ItemBase.m_DebugActionsMask &= ~mask;
8039 }
8040
8042 {
8044 {
8046 }
8047 else
8048 {
8050 }
8051 }
8052
8053
8055 {
8056 if (GetEconomyProfile())
8057 {
8058 float q_max = GetEconomyProfile().GetQuantityMax();
8059 if (q_max > 0)
8060 {
8061 float q_min = GetEconomyProfile().GetQuantityMin();
8062 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8063
8065 {
8066 ComponentEnergyManager comp = GetCompEM();
8068 {
8070 }
8071 }
8073 {
8075
8076 }
8077
8078 }
8079 }
8080 }
8081
8084 {
8085 EntityAI parent = GetHierarchyParent();
8086
8087 if (parent)
8088 {
8089 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8090 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8091 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8092 }
8093 }
8094
8097 {
8098 EntityAI parent = GetHierarchyParent();
8099
8100 if (parent)
8101 {
8102 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8103 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8104 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8105 }
8106 }
8107
8109 {
8110
8111
8112
8113
8115
8117 {
8118 if (ScriptInputUserData.CanStoreInputUserData())
8119 {
8120 ScriptInputUserData ctx = new ScriptInputUserData;
8126 ctx.
Write(use_stack_max);
8129
8131 {
8132 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8133 }
8134 }
8135 }
8136 else if (!
g_Game.IsMultiplayer())
8137 {
8139 }
8140 }
8141
8143 {
8145 }
8146
8148 {
8150 }
8151
8153 {
8155 }
8156
8158 {
8159
8160 return false;
8161 }
8162
8164 {
8165 return false;
8166 }
8167
8171 {
8172 return false;
8173 }
8174
8176 {
8177 return "";
8178 }
8179
8181
8183 {
8184 return false;
8185 }
8186
8188 {
8189 return true;
8190 }
8191
8192
8193
8195 {
8196 return true;
8197 }
8198
8200 {
8201 return true;
8202 }
8203
8205 {
8206 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8208 }
8209
8211 {
8213 }
8214
8216 {
8218 if (!is_being_placed)
8220 SetSynchDirty();
8221 }
8222
8223
8225
8227 {
8229 }
8230
8232 {
8234 }
8235
8237 {
8238 return 1;
8239 }
8240
8242 {
8243 return false;
8244 }
8245
8247 {
8249 SetSynchDirty();
8250 }
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8287 {
8288 super.OnMovedInsideCargo(container);
8289
8290 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8291 }
8292
8293 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8294 {
8295 super.EEItemLocationChanged(oldLoc, newLoc);
8296
8297 PlayerBase newPlayer = null;
8298 PlayerBase oldPlayer = null;
8299
8300 if (newLoc.GetParent())
8301 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8302
8303 if (oldLoc.GetParent())
8304 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8305
8307 {
8308 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8309
8310 if (rIndex >= 0)
8311 {
8312 InventoryLocation rIl = new InventoryLocation;
8313 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8314
8315 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8318 {
8319 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8320 }
8322 {
8324 }
8325
8326 }
8327 }
8328
8330 {
8331 if (newPlayer)
8332 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8333
8334 if (newPlayer == oldPlayer)
8335 {
8336 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8337 {
8339 {
8340 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8341 {
8342 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8343 }
8344 }
8345 else
8346 {
8347 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8348 }
8349 }
8350
8351 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8352 {
8353 int type = oldLoc.GetType();
8355 {
8356 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8357 }
8359 {
8360 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8361 }
8362 }
8363 if (!m_OldLocation)
8364 {
8365 m_OldLocation = new InventoryLocation;
8366 }
8367 m_OldLocation.Copy(oldLoc);
8368 }
8369 else
8370 {
8371 if (m_OldLocation)
8372 {
8373 m_OldLocation.Reset();
8374 }
8375 }
8376
8377 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8378 }
8379 else
8380 {
8381 if (newPlayer)
8382 {
8383 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8384 if (resIndex >= 0)
8385 {
8386 InventoryLocation il = new InventoryLocation;
8387 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8389 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8392 {
8393 il.
GetParent().GetOnReleaseLock().Invoke(it);
8394 }
8396 {
8398 }
8399
8400 }
8401 }
8403 {
8404
8406 }
8407
8408 if (m_OldLocation)
8409 {
8410 m_OldLocation.Reset();
8411 }
8412 }
8413
8415 {
8416 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8417 }
8418
8420 {
8421 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8422 }
8423 }
8424
8425 override void EOnContact(IEntity other, Contact extra)
8426 {
8428 {
8429 int liquidType = -1;
8431 if (impactSpeed > 0.0)
8432 {
8434 #ifndef SERVER
8436 #else
8438 SetSynchDirty();
8439 #endif
8441 }
8442 }
8443
8444 #ifdef SERVER
8445 if (GetCompEM() && GetCompEM().IsPlugged())
8446 {
8447 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8448 GetCompEM().UnplugThis();
8449 }
8450 #endif
8451 }
8452
8454
8456 {
8458 }
8459
8461 {
8462
8463 }
8464
8466 {
8467 super.OnItemLocationChanged(old_owner, new_owner);
8468
8469 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8470 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8471
8472 if (!relatedPlayer && playerNew)
8473 relatedPlayer = playerNew;
8474
8475 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8476 {
8478 if (actionMgr)
8479 {
8480 ActionBase currentAction = actionMgr.GetRunningAction();
8481 if (currentAction)
8483 }
8484 }
8485
8486 Man ownerPlayerOld = null;
8487 Man ownerPlayerNew = null;
8488
8489 if (old_owner)
8490 {
8491 if (old_owner.
IsMan())
8492 {
8493 ownerPlayerOld = Man.Cast(old_owner);
8494 }
8495 else
8496 {
8497 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8498 }
8499 }
8500 else
8501 {
8503 {
8505
8506 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8507 {
8508 GetCompEM().UnplugThis();
8509 }
8510 }
8511 }
8512
8513 if (new_owner)
8514 {
8515 if (new_owner.
IsMan())
8516 {
8517 ownerPlayerNew = Man.Cast(new_owner);
8518 }
8519 else
8520 {
8521 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8522 }
8523 }
8524
8525 if (ownerPlayerOld != ownerPlayerNew)
8526 {
8527 if (ownerPlayerOld)
8528 {
8529 array<EntityAI> subItemsExit = new array<EntityAI>;
8531 for (int i = 0; i < subItemsExit.Count(); i++)
8532 {
8535 }
8536 }
8537
8538 if (ownerPlayerNew)
8539 {
8540 array<EntityAI> subItemsEnter = new array<EntityAI>;
8542 for (int j = 0; j < subItemsEnter.Count(); j++)
8543 {
8546 }
8547 }
8548 }
8549 else if (ownerPlayerNew != null)
8550 {
8551 PlayerBase nplayer;
8552 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8553 {
8554 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8556 for (int k = 0; k < subItemsUpdate.Count(); k++)
8557 {
8559 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8560 }
8561 }
8562 }
8563
8564 if (old_owner)
8565 old_owner.OnChildItemRemoved(this);
8566 if (new_owner)
8567 new_owner.OnChildItemReceived(this);
8568 }
8569
8570
8572 {
8573 super.EEDelete(parent);
8574 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8575 if (player)
8576 {
8578
8579 if (player.IsAlive())
8580 {
8581 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8582 if (r_index >= 0)
8583 {
8584 InventoryLocation r_il = new InventoryLocation;
8585 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8586
8587 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8590 {
8591 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8592 }
8594 {
8595 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8596 }
8597
8598 }
8599
8600 player.RemoveQuickBarEntityShortcut(this);
8601 }
8602 }
8603 }
8604
8606 {
8607 super.EEKilled(killer);
8608
8611 {
8612 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8613 {
8614 if (IsMagazine())
8615 {
8616 if (Magazine.Cast(this).GetAmmoCount() > 0)
8617 {
8619 }
8620 }
8621 else
8622 {
8624 }
8625 }
8626 }
8627 }
8628
8630 {
8631 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8632
8633 super.OnWasAttached(parent, slot_id);
8634
8637
8640 }
8641
8643 {
8644 super.OnWasDetached(parent, slot_id);
8645
8648
8651 }
8652
8654 {
8655 int idx;
8658
8659 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8660 if (inventory_slots.Count() < 1)
8661 {
8662 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8663 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8664 }
8665 else
8666 {
8667 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8668 }
8669
8670 idx = inventory_slots.Find(slot);
8671 if (idx < 0)
8672 return "";
8673
8674 return attach_types.Get(idx);
8675 }
8676
8678 {
8679 int idx = -1;
8680 string slot;
8681
8684
8685 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8686 if (inventory_slots.Count() < 1)
8687 {
8688 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8689 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8690 }
8691 else
8692 {
8693 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8694 if (detach_types.Count() < 1)
8695 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8696 }
8697
8698 for (int i = 0; i < inventory_slots.Count(); i++)
8699 {
8700 slot = inventory_slots.Get(i);
8701 }
8702
8703 if (slot != "")
8704 {
8705 if (detach_types.Count() == 1)
8706 idx = 0;
8707 else
8708 idx = inventory_slots.Find(slot);
8709 }
8710 if (idx < 0)
8711 return "";
8712
8713 return detach_types.Get(idx);
8714 }
8715
8717 {
8718
8720
8721
8722 float min_time = 1;
8723 float max_time = 3;
8724 float delay = Math.RandomFloat(min_time, max_time);
8725
8726 explode_timer.Run(delay, this, "DoAmmoExplosion");
8727 }
8728
8730 {
8731 Magazine magazine = Magazine.Cast(this);
8732 int pop_sounds_count = 6;
8733 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8734
8735
8736 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8737 string sound_name = pop_sounds[ sound_idx ];
8738 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8739
8740
8741 magazine.ServerAddAmmoCount(-1);
8742
8743
8744 float min_temp_to_explode = 100;
8745
8746 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8747 {
8749 }
8750 }
8751
8752
8753 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8754 {
8755 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8756
8757 const int CHANCE_DAMAGE_CARGO = 4;
8758 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8759 const int CHANCE_DAMAGE_NOTHING = 2;
8760
8762 {
8763 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8764 int chances;
8765 int rnd;
8766
8767 if (GetInventory().GetCargo())
8768 {
8769 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8770 rnd = Math.RandomInt(0,chances);
8771
8772 if (rnd < CHANCE_DAMAGE_CARGO)
8773 {
8775 }
8776 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8777 {
8779 }
8780 }
8781 else
8782 {
8783 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8784 rnd = Math.RandomInt(0,chances);
8785
8786 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8787 {
8789 }
8790 }
8791 }
8792 }
8793
8795 {
8796 CargoBase cargo = GetInventory().GetCargo();
8797 if (cargo)
8798 {
8800 if (item_count > 0)
8801 {
8802 int random_pick = Math.RandomInt(0, item_count);
8804 if (!item.IsExplosive())
8805 {
8806 item.AddHealth("","",damage);
8807 return true;
8808 }
8809 }
8810 }
8811 return false;
8812 }
8813
8815 {
8816 GameInventory inventory = GetInventory();
8818 if (attachment_count > 0)
8819 {
8820 int random_pick = Math.RandomInt(0, attachment_count);
8822 if (!attachment.IsExplosive())
8823 {
8824 attachment.AddHealth("","",damage);
8825 return true;
8826 }
8827 }
8828 return false;
8829 }
8830
8832 {
8834 }
8835
8837 {
8839 return GetInventory().CanRemoveEntity();
8840
8841 return false;
8842 }
8843
8845 {
8846
8848 return false;
8849
8850
8852 return false;
8853
8854
8855
8857 if (delta == 0)
8858 return false;
8859
8860
8861 return true;
8862 }
8863
8865 {
8867 {
8868 if (ScriptInputUserData.CanStoreInputUserData())
8869 {
8870 ScriptInputUserData ctx = new ScriptInputUserData;
8875 ctx.
Write(destination_entity);
8879 }
8880 }
8881 else if (!
g_Game.IsMultiplayer())
8882 {
8884 }
8885 }
8886
8888 {
8889 float split_quantity_new;
8893 InventoryLocation loc = new InventoryLocation;
8894
8895 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8896 {
8898 split_quantity_new = stack_max;
8899 else
8901
8903 {
8904 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8905 if (new_item)
8906 {
8907 new_item.SetResultOfSplit(true);
8908 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8910 new_item.
SetQuantity(split_quantity_new,
false,
true);
8911 }
8912 }
8913 }
8914 else if (destination_entity && slot_id == -1)
8915 {
8916 if (quantity > stack_max)
8917 split_quantity_new = stack_max;
8918 else
8919 split_quantity_new = quantity;
8920
8922 {
8923 GameInventory destinationInventory = destination_entity.GetInventory();
8925 {
8928 }
8929
8930 if (new_item)
8931 {
8932 new_item.SetResultOfSplit(true);
8933 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8935 new_item.
SetQuantity(split_quantity_new,
false,
true);
8936 }
8937 }
8938 }
8939 else
8940 {
8941 if (stack_max != 0)
8942 {
8944 {
8946 }
8947
8948 if (split_quantity_new == 0)
8949 {
8950 if (!
g_Game.IsMultiplayer())
8951 player.PhysicalPredictiveDropItem(this);
8952 else
8953 player.ServerDropEntity(this);
8954 return;
8955 }
8956
8958 {
8960
8961 if (new_item)
8962 {
8963 new_item.SetResultOfSplit(true);
8964 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8967 new_item.PlaceOnSurface();
8968 }
8969 }
8970 }
8971 }
8972 }
8973
8975 {
8976 float split_quantity_new;
8980 InventoryLocation loc = new InventoryLocation;
8981
8982 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8983 {
8985 split_quantity_new = stack_max;
8986 else
8988
8990 {
8991 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8992 if (new_item)
8993 {
8994 new_item.SetResultOfSplit(true);
8995 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8997 new_item.
SetQuantity(split_quantity_new,
false,
true);
8998 }
8999 }
9000 }
9001 else if (destination_entity && slot_id == -1)
9002 {
9003 if (quantity > stack_max)
9004 split_quantity_new = stack_max;
9005 else
9006 split_quantity_new = quantity;
9007
9009 {
9010 GameInventory destinationInventory = destination_entity.GetInventory();
9012 {
9015 }
9016
9017 if (new_item)
9018 {
9019 new_item.SetResultOfSplit(true);
9020 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9022 new_item.
SetQuantity(split_quantity_new,
false,
true);
9023 }
9024 }
9025 }
9026 else
9027 {
9028 if (stack_max != 0)
9029 {
9031 {
9033 }
9034
9036 {
9038
9039 if (new_item)
9040 {
9041 new_item.SetResultOfSplit(true);
9042 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9045 new_item.PlaceOnSurface();
9046 }
9047 }
9048 }
9049 }
9050 }
9051
9053 {
9055 {
9056 if (ScriptInputUserData.CanStoreInputUserData())
9057 {
9058 ScriptInputUserData ctx = new ScriptInputUserData;
9063 dst.WriteToContext(ctx);
9065 }
9066 }
9067 else if (!
g_Game.IsMultiplayer())
9068 {
9070 }
9071 }
9072
9074 {
9076 {
9077 if (ScriptInputUserData.CanStoreInputUserData())
9078 {
9079 ScriptInputUserData ctx = new ScriptInputUserData;
9084 ctx.
Write(destination_entity);
9090 }
9091 }
9092 else if (!
g_Game.IsMultiplayer())
9093 {
9095 }
9096 }
9097
9099 {
9101 }
9102
9104 {
9106 float split_quantity_new;
9108 if (dst.IsValid())
9109 {
9110 int slot_id = dst.GetSlot();
9112
9113 if (quantity > stack_max)
9114 split_quantity_new = stack_max;
9115 else
9116 split_quantity_new = quantity;
9117
9119 {
9121
9122 if (new_item)
9123 {
9124 new_item.SetResultOfSplit(true);
9125 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9127 new_item.
SetQuantity(split_quantity_new,
false,
true);
9128 }
9129
9130 return new_item;
9131 }
9132 }
9133
9134 return null;
9135 }
9136
9138 {
9140 float split_quantity_new;
9142 if (destination_entity)
9143 {
9145 if (quantity > stackable)
9146 split_quantity_new = stackable;
9147 else
9148 split_quantity_new = quantity;
9149
9151 {
9152 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9153 if (new_item)
9154 {
9155 new_item.SetResultOfSplit(true);
9156 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9158 new_item.
SetQuantity(split_quantity_new,
false,
true);
9159 }
9160 }
9161 }
9162 }
9163
9165 {
9167 {
9168 if (ScriptInputUserData.CanStoreInputUserData())
9169 {
9170 ScriptInputUserData ctx = new ScriptInputUserData;
9175 ItemBase destination_entity =
this;
9176 ctx.
Write(destination_entity);
9180 }
9181 }
9182 else if (!
g_Game.IsMultiplayer())
9183 {
9185 }
9186 }
9187
9189 {
9191 float split_quantity_new;
9193 if (player)
9194 {
9196 if (quantity > stackable)
9197 split_quantity_new = stackable;
9198 else
9199 split_quantity_new = quantity;
9200
9202 {
9203 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9204 new_item =
ItemBase.Cast(in_hands);
9205 if (new_item)
9206 {
9207 new_item.SetResultOfSplit(true);
9208 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9210 new_item.SetQuantity(split_quantity_new, false, true);
9211 }
9212 }
9213 }
9214 }
9215
9217 {
9219 float split_quantity_new = Math.Floor(quantity * 0.5);
9220
9222 return;
9223
9225
9226 if (new_item)
9227 {
9228 if (new_item.GetQuantityMax() < split_quantity_new)
9229 {
9230 split_quantity_new = new_item.GetQuantityMax();
9231 }
9232
9233 new_item.SetResultOfSplit(true);
9234 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9235
9237 {
9240 }
9241 else
9242 {
9244 new_item.
SetQuantity(split_quantity_new,
false,
true);
9245 }
9246 }
9247 }
9248
9250 {
9252 float split_quantity_new = Math.Floor(quantity / 2);
9253
9255 return;
9256
9257 InventoryLocation invloc = new InventoryLocation;
9259
9261 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9262
9263 if (new_item)
9264 {
9265 if (new_item.GetQuantityMax() < split_quantity_new)
9266 {
9267 split_quantity_new = new_item.GetQuantityMax();
9268 }
9270 {
9273 }
9274 else if (split_quantity_new > 1)
9275 {
9277 new_item.
SetQuantity(split_quantity_new,
false,
true);
9278 }
9279 }
9280 }
9281
9284 {
9285 SetWeightDirty();
9287
9288 if (parent)
9289 parent.OnAttachmentQuantityChangedEx(this, delta);
9290
9292 {
9294 {
9296 }
9298 {
9299 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9301 }
9302 }
9303 }
9304
9307 {
9308
9309 }
9310
9313 {
9315 }
9316
9318 {
9319 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9320
9322 {
9323 if (newLevel == GameConstants.STATE_RUINED)
9324 {
9326 EntityAI parent = GetHierarchyParent();
9327 if (parent && parent.IsFireplace())
9328 {
9329 CargoBase cargo = GetInventory().GetCargo();
9330 if (cargo)
9331 {
9333 {
9335 }
9336 }
9337 }
9338 }
9339
9341 {
9342
9344 return;
9345 }
9346
9347 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9348 {
9350 }
9351 }
9352 }
9353
9354
9356 {
9357 super.OnRightClick();
9358
9360 {
9362 {
9363 if (ScriptInputUserData.CanStoreInputUserData())
9364 {
9365 EntityAI root = GetHierarchyRoot();
9366 Man playerOwner = GetHierarchyRootPlayer();
9367 InventoryLocation dst = new InventoryLocation;
9368
9369
9370 if (!playerOwner && root && root == this)
9371 {
9373 }
9374 else
9375 {
9376
9377 GetInventory().GetCurrentInventoryLocation(dst);
9379 {
9380 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9382 {
9384 }
9385 else
9386 {
9388
9389
9390 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9391 {
9393 }
9394 else
9395 {
9396 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9397 }
9398 }
9399 }
9400 }
9401
9402 ScriptInputUserData ctx = new ScriptInputUserData;
9410 }
9411 }
9412 else if (!
g_Game.IsMultiplayer())
9413 {
9415 }
9416 }
9417 }
9418
9420 {
9421 if (root)
9422 {
9423 vector m4[4];
9424 root.GetTransform(m4);
9425 dst.SetGround(this, m4);
9426 }
9427 else
9428 {
9429 GetInventory().GetCurrentInventoryLocation(dst);
9430 }
9431 }
9432
9433 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9434 {
9435
9436 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9437 return false;
9438
9439 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9440 return false;
9441
9442
9444 return false;
9445
9446
9447 Magazine mag = Magazine.Cast(this);
9448 if (mag)
9449 {
9450 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9451 return false;
9452
9453 if (stack_max_limit)
9454 {
9455 Magazine other_mag = Magazine.Cast(other_item);
9456 if (other_item)
9457 {
9458 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9459 return false;
9460 }
9461
9462 }
9463 }
9464 else
9465 {
9466
9468 return false;
9469
9471 return false;
9472 }
9473
9474 PlayerBase player = null;
9475 if (CastTo(player, GetHierarchyRootPlayer()))
9476 {
9477 if (player.GetInventory().HasAttachment(this))
9478 return false;
9479
9480 if (player.IsItemsToDelete())
9481 return false;
9482 }
9483
9484 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9485 return false;
9486
9487 int slotID;
9489 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9490 return false;
9491
9492 return true;
9493 }
9494
9496 {
9498 }
9499
9501 {
9502 return m_IsResultOfSplit;
9503 }
9504
9506 {
9507 m_IsResultOfSplit = value;
9508 }
9509
9511 {
9513 }
9514
9516 {
9517 float other_item_quantity = other_item.GetQuantity();
9518 float this_free_space;
9519
9521
9523
9524 if (other_item_quantity > this_free_space)
9525 {
9526 return this_free_space;
9527 }
9528 else
9529 {
9530 return other_item_quantity;
9531 }
9532 }
9533
9535 {
9537 }
9538
9540 {
9542 return;
9543
9544 if (!IsMagazine() && other_item)
9545 {
9547 if (quantity_used != 0)
9548 {
9549 float hp1 = GetHealth01("","");
9550 float hp2 = other_item.GetHealth01("","");
9551 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9552 hpResult = hpResult / (
GetQuantity() + quantity_used);
9553
9554 hpResult *= GetMaxHealth();
9555 Math.Round(hpResult);
9556 SetHealth("", "Health", hpResult);
9557
9559 other_item.AddQuantity(-quantity_used);
9560 }
9561 }
9563 }
9564
9566 {
9567 #ifdef SERVER
9568 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9569 GetHierarchyParent().IncreaseLifetimeUp();
9570 #endif
9571 };
9572
9574 {
9575 PlayerBase p = PlayerBase.Cast(player);
9576
9577 array<int> recipesIds = p.m_Recipes;
9578 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9579 if (moduleRecipesManager)
9580 {
9581 EntityAI itemInHands = player.GetEntityInHands();
9582 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9583 }
9584
9585 for (int i = 0;i < recipesIds.Count(); i++)
9586 {
9587 int key = recipesIds.Get(i);
9588 string recipeName = moduleRecipesManager.GetRecipeName(key);
9590 }
9591 }
9592
9593
9594 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9595 {
9596 super.GetDebugActions(outputList);
9597
9598
9604
9605
9610
9615
9616
9620
9621
9623 {
9627 }
9628
9631
9632
9636
9638
9639 InventoryLocation loc = new InventoryLocation();
9640 GetInventory().GetCurrentInventoryLocation(loc);
9642 {
9643 if (Gizmo_IsSupported())
9646 }
9647
9649 }
9650
9651
9652
9653
9655 {
9656 super.OnAction(action_id, player, ctx);
9657
9659 {
9660 switch (action_id)
9661 {
9665 return true;
9669 return true;
9670 }
9671 }
9672
9674 {
9675 switch (action_id)
9676 {
9678 Delete();
9679 return true;
9680 }
9681 }
9682
9683 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9684 {
9685 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9686 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9687 PlayerBase p = PlayerBase.Cast(player);
9688 if (
EActions.RECIPES_RANGE_START < 1000)
9689 {
9690 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9691 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9692 }
9693 }
9694 #ifndef SERVER
9695 else if (action_id ==
EActions.WATCH_PLAYER)
9696 {
9697 PluginDeveloper.SetDeveloperItemClientEx(player);
9698 }
9699 #endif
9701 {
9702 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9703 {
9704 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9705 OnDebugButtonPressServer(id + 1);
9706 }
9707
9708 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9709 {
9710 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9712 }
9713
9714 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9715 {
9716 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9718 }
9719
9720 else if (action_id ==
EActions.ADD_QUANTITY)
9721 {
9722 if (IsMagazine())
9723 {
9724 Magazine mag = Magazine.Cast(this);
9725 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9726 }
9727 else
9728 {
9730 }
9731
9732 if (m_EM)
9733 {
9734 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9735 }
9736
9737 }
9738
9739 else if (action_id ==
EActions.REMOVE_QUANTITY)
9740 {
9741 if (IsMagazine())
9742 {
9743 Magazine mag2 = Magazine.Cast(this);
9744 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9745 }
9746 else
9747 {
9749 }
9750 if (m_EM)
9751 {
9752 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9753 }
9754
9755 }
9756
9757 else if (action_id ==
EActions.SET_QUANTITY_0)
9758 {
9760
9761 if (m_EM)
9762 {
9763 m_EM.SetEnergy(0);
9764 }
9765 }
9766
9767 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9768 {
9770
9771 if (m_EM)
9772 {
9773 m_EM.SetEnergy(m_EM.GetEnergyMax());
9774 }
9775 }
9776
9777 else if (action_id ==
EActions.ADD_HEALTH)
9778 {
9779 AddHealth("","",GetMaxHealth("","Health")/5);
9780 }
9781 else if (action_id ==
EActions.REMOVE_HEALTH)
9782 {
9783 AddHealth("","",-GetMaxHealth("","Health")/5);
9784 }
9785 else if (action_id ==
EActions.DESTROY_HEALTH)
9786 {
9787 SetHealth01("","",0);
9788 }
9789 else if (action_id ==
EActions.WATCH_ITEM)
9790 {
9792 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9793 #ifdef DEVELOPER
9794 SetDebugDeveloper_item(this);
9795 #endif
9796 }
9797
9798 else if (action_id ==
EActions.ADD_TEMPERATURE)
9799 {
9800 AddTemperature(20);
9801
9802 }
9803
9804 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9805 {
9806 AddTemperature(-20);
9807
9808 }
9809
9810 else if (action_id ==
EActions.FLIP_FROZEN)
9811 {
9812 SetFrozen(!GetIsFrozen());
9813
9814 }
9815
9816 else if (action_id ==
EActions.ADD_WETNESS)
9817 {
9819
9820 }
9821
9822 else if (action_id ==
EActions.REMOVE_WETNESS)
9823 {
9825
9826 }
9827
9828 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9829 {
9832
9833
9834 }
9835
9836 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9837 {
9840 }
9841
9842 else if (action_id ==
EActions.MAKE_SPECIAL)
9843 {
9844 auto debugParams = DebugSpawnParams.WithPlayer(player);
9845 OnDebugSpawnEx(debugParams);
9846 }
9847
9848 }
9849
9850
9851 return false;
9852 }
9853
9854
9855
9856
9860
9863
9864
9865
9867 {
9868 return false;
9869 }
9870
9871
9873 {
9874 return true;
9875 }
9876
9877
9879 {
9880 return true;
9881 }
9882
9883
9884
9886 {
9887 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9888 return g_Game.ConfigIsExisting(config_path);
9889 }
9890
9893 {
9894 return null;
9895 }
9896
9898 {
9899 return false;
9900 }
9901
9903 {
9904 return false;
9905 }
9906
9910
9911
9913 {
9914 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9915 return module_repairing.CanRepair(this, item_repair_kit);
9916 }
9917
9918
9919 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9920 {
9921 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9922 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9923 }
9924
9925
9927 {
9928
9929
9930
9931
9932
9933
9934
9935
9936 return 1;
9937 }
9938
9939
9940
9942 {
9944 }
9945
9946
9947
9949 {
9951 }
9952
9953
9962 {
9963 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9964
9965 if (player)
9966 {
9967 player.MessageStatus(text);
9968 }
9969 }
9970
9971
9980 {
9981 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9982
9983 if (player)
9984 {
9985 player.MessageAction(text);
9986 }
9987 }
9988
9989
9998 {
9999 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10000
10001 if (player)
10002 {
10003 player.MessageFriendly(text);
10004 }
10005 }
10006
10007
10016 {
10017 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10018
10019 if (player)
10020 {
10021 player.MessageImportant(text);
10022 }
10023 }
10024
10026 {
10027 return true;
10028 }
10029
10030
10031 override bool KindOf(
string tag)
10032 {
10033 bool found = false;
10034 string item_name = this.
GetType();
10036 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10037
10038 int array_size = item_tag_array.Count();
10039 for (int i = 0; i < array_size; i++)
10040 {
10041 if (item_tag_array.Get(i) == tag)
10042 {
10043 found = true;
10044 break;
10045 }
10046 }
10047 return found;
10048 }
10049
10050
10052 {
10053
10054 super.OnRPC(sender, rpc_type,ctx);
10055
10056
10057 switch (rpc_type)
10058 {
10059 #ifndef SERVER
10060 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10061 Param2<bool, string> p = new Param2<bool, string>(false, "");
10062
10064 return;
10065
10066 bool play = p.param1;
10067 string soundSet = p.param2;
10068
10069 if (play)
10070 {
10072 {
10074 {
10076 }
10077 }
10078 else
10079 {
10081 }
10082 }
10083 else
10084 {
10086 }
10087
10088 break;
10089 #endif
10090
10091 }
10092
10094 {
10096 }
10097 }
10098
10099
10100
10101
10103 {
10104 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10105 return plugin.GetID(
name);
10106 }
10107
10109 {
10110 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10111 return plugin.GetName(id);
10112 }
10113
10116 {
10117
10118
10119 int varFlags;
10120 if (!ctx.
Read(varFlags))
10121 return;
10122
10123 if (varFlags & ItemVariableFlags.FLOAT)
10124 {
10126 }
10127 }
10128
10130 {
10131
10132 super.SerializeNumericalVars(floats_out);
10133
10134
10135
10137 {
10139 }
10140
10142 {
10144 }
10145
10147 {
10149 }
10150
10152 {
10157 }
10158
10160 {
10162 }
10163 }
10164
10166 {
10167
10168 super.DeSerializeNumericalVars(floats);
10169
10170
10171 int index = 0;
10172 int mask = Math.Round(floats.Get(index));
10173
10174 index++;
10175
10177 {
10179 {
10181 }
10182 else
10183 {
10184 float quantity = floats.Get(index);
10185 SetQuantity(quantity,
true,
false,
false,
false);
10186 }
10187 index++;
10188 }
10189
10191 {
10192 float wet = floats.Get(index);
10194 index++;
10195 }
10196
10198 {
10199 int liquidtype = Math.Round(floats.Get(index));
10201 index++;
10202 }
10203
10205 {
10207 index++;
10209 index++;
10211 index++;
10213 index++;
10214 }
10215
10217 {
10218 int cleanness = Math.Round(floats.Get(index));
10220 index++;
10221 }
10222 }
10223
10225 {
10226 super.WriteVarsToCTX(ctx);
10227
10228
10230 {
10232 }
10233
10235 {
10237 }
10238
10240 {
10242 }
10243
10245 {
10246 int r,g,b,a;
10252 }
10253
10255 {
10257 }
10258 }
10259
10261 {
10262 if (!super.ReadVarsFromCTX(ctx,version))
10263 return false;
10264
10265 int intValue;
10266 float value;
10267
10268 if (version < 140)
10269 {
10270 if (!ctx.
Read(intValue))
10271 return false;
10272
10273 m_VariablesMask = intValue;
10274 }
10275
10277 {
10278 if (!ctx.
Read(value))
10279 return false;
10280
10282 {
10284 }
10285 else
10286 {
10288 }
10289 }
10290
10291 if (version < 140)
10292 {
10294 {
10295 if (!ctx.
Read(value))
10296 return false;
10297 SetTemperatureDirect(value);
10298 }
10299 }
10300
10302 {
10303 if (!ctx.
Read(value))
10304 return false;
10306 }
10307
10309 {
10310 if (!ctx.
Read(intValue))
10311 return false;
10313 }
10314
10316 {
10317 int r,g,b,a;
10319 return false;
10321 return false;
10323 return false;
10325 return false;
10326
10328 }
10329
10331 {
10332 if (!ctx.
Read(intValue))
10333 return false;
10335 }
10336
10337 if (version >= 138 && version < 140)
10338 {
10340 {
10341 if (!ctx.
Read(intValue))
10342 return false;
10343 SetFrozen(intValue);
10344 }
10345 }
10346
10347 return true;
10348 }
10349
10350
10352 {
10355 {
10357 }
10358
10359 if (!super.OnStoreLoad(ctx, version))
10360 {
10362 return false;
10363 }
10364
10365 if (version >= 114)
10366 {
10367 bool hasQuickBarIndexSaved;
10368
10369 if (!ctx.
Read(hasQuickBarIndexSaved))
10370 {
10372 return false;
10373 }
10374
10375 if (hasQuickBarIndexSaved)
10376 {
10377 int itmQBIndex;
10378
10379
10380 if (!ctx.
Read(itmQBIndex))
10381 {
10383 return false;
10384 }
10385
10386 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10387 if (itmQBIndex != -1 && parentPlayer)
10388 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10389 }
10390 }
10391 else
10392 {
10393
10394 PlayerBase player;
10395 int itemQBIndex;
10396 if (version ==
int.
MAX)
10397 {
10398 if (!ctx.
Read(itemQBIndex))
10399 {
10401 return false;
10402 }
10403 }
10404 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10405 {
10406
10407 if (!ctx.
Read(itemQBIndex))
10408 {
10410 return false;
10411 }
10412 if (itemQBIndex != -1 && player)
10413 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10414 }
10415 }
10416
10417 if (version < 140)
10418 {
10419
10420 if (!LoadVariables(ctx, version))
10421 {
10423 return false;
10424 }
10425 }
10426
10427
10429 {
10431 return false;
10432 }
10433 if (version >= 132)
10434 {
10436 if (raib)
10437 {
10439 {
10441 return false;
10442 }
10443 }
10444 }
10445
10447 return true;
10448 }
10449
10450
10451
10453 {
10454 super.OnStoreSave(ctx);
10455
10456 PlayerBase player;
10457 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10458 {
10460
10461 int itemQBIndex = -1;
10462 itemQBIndex = player.FindQuickBarEntityIndex(this);
10463 ctx.
Write(itemQBIndex);
10464 }
10465 else
10466 {
10468 }
10469
10471
10473 if (raib)
10474 {
10476 }
10477 }
10478
10479
10481 {
10482 super.AfterStoreLoad();
10483
10485 {
10487 }
10488
10490 {
10493 }
10494 }
10495
10497 {
10498 super.EEOnAfterLoad();
10499
10501 {
10503 }
10504
10507 }
10508
10510 {
10511 return false;
10512 }
10513
10514
10515
10517 {
10519 {
10520 #ifdef PLATFORM_CONSOLE
10521
10523 {
10525 if (menu)
10526 {
10528 }
10529 }
10530 #endif
10531 }
10532
10534 {
10537 }
10538
10540 {
10541 SetWeightDirty();
10543 }
10545 {
10548 }
10549
10551 {
10554
10557 }
10559 {
10563 }
10564
10565 super.OnVariablesSynchronized();
10566 }
10567
10568
10569
10571 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10572 {
10573 if (!IsServerCheck(allow_client))
10574 return false;
10575
10577 return false;
10578
10581
10582 if (value <= (min + 0.001))
10583 value = min;
10584
10585 if (value == min)
10586 {
10587 if (destroy_config)
10588 {
10589 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10590 if (dstr)
10591 {
10593 this.Delete();
10594 return true;
10595 }
10596 }
10597 else if (destroy_forced)
10598 {
10600 this.Delete();
10601 return true;
10602 }
10603
10605 }
10606
10609
10611 {
10612 EntityAI parent = GetHierarchyRoot();
10613 InventoryLocation iLoc = new InventoryLocation();
10614 GetInventory().GetCurrentInventoryLocation(iLoc);
10616 {
10617 int iLocSlot = iLoc.
GetSlot();
10619 {
10621 }
10623 {
10625 }
10626 }
10627 }
10628
10630 {
10632
10633 if (delta)
10635 }
10636
10638
10639 return false;
10640 }
10641
10642
10644 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10645 {
10647 }
10648
10650 {
10653 }
10654
10656 {
10659 }
10660
10662 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10663 {
10664 float value_clamped = Math.Clamp(value, 0, 1);
10666 SetQuantity(result, destroy_config, destroy_forced);
10667 }
10668
10669
10672 {
10674 }
10675
10677 {
10679 }
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10691 {
10692 int slot = -1;
10693 GameInventory inventory = GetInventory();
10694 if (inventory)
10695 {
10696 InventoryLocation il = new InventoryLocation;
10699 }
10700
10702 }
10703
10705 {
10706 float quantity_max = 0;
10707
10709 {
10710 if (attSlotID != -1)
10711 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10712
10713 if (quantity_max <= 0)
10715 }
10716
10717 if (quantity_max <= 0)
10719
10720 return quantity_max;
10721 }
10722
10724 {
10726 }
10727
10729 {
10731 }
10732
10733
10735 {
10737 }
10738
10740 {
10742 }
10743
10745 {
10747 }
10748
10749
10751 {
10752
10753 float weightEx = GetWeightEx();
10754 float special = GetInventoryAndCargoWeight();
10755 return weightEx - special;
10756 }
10757
10758
10760 {
10762 }
10763
10765 {
10767 {
10768 #ifdef DEVELOPER
10769 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10770 {
10771 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10773 }
10774 #endif
10775
10776 return GetQuantity() * GetConfigWeightModified();
10777 }
10778 else if (HasEnergyManager())
10779 {
10780 #ifdef DEVELOPER
10781 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10782 {
10783 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10784 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10785 }
10786 #endif
10787 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10788 }
10789 else
10790 {
10791 #ifdef DEVELOPER
10792 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10793 {
10794 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10795 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10796 }
10797 #endif
10798 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10799 }
10800 }
10801
10804 {
10805 int item_count = 0;
10807
10808 GameInventory inventory = GetInventory();
10809 CargoBase cargo = inventory.
GetCargo();
10810 if (cargo != NULL)
10811 {
10813 }
10814
10816 for (int i = 0; i < nAttachments; ++i)
10817 {
10819 if (item)
10820 item_count += item.GetNumberOfItems();
10821 }
10822 return item_count;
10823 }
10824
10827 {
10828 float weight = 0;
10829 float wetness = 1;
10830 if (include_wetness)
10833 {
10834 weight = wetness * m_ConfigWeight;
10835 }
10837 {
10838 weight = 1;
10839 }
10840 return weight;
10841 }
10842
10843
10844
10846 {
10847 GameInventory inventory = GetInventory();
10848 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10849 {
10850 array<EntityAI> items = new array<EntityAI>;
10852 for (int i = 0; i < items.Count(); ++i)
10853 {
10855 if (item)
10856 {
10857 g_Game.ObjectDelete(item);
10858 }
10859 }
10860 }
10861 }
10862
10863
10864
10865
10867 {
10868 float energy = 0;
10869 if (HasEnergyManager())
10870 {
10871 energy = GetCompEM().GetEnergy();
10872 }
10873 return energy;
10874 }
10875
10876
10878 {
10879 super.OnEnergyConsumed();
10880
10882 }
10883
10885 {
10886 super.OnEnergyAdded();
10887
10889 }
10890
10891
10893 {
10894 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10895 {
10897 {
10898 float energy_0to1 = GetCompEM().GetEnergy0To1();
10900 }
10901 }
10902 }
10903
10904
10906 {
10907 return ConfigGetFloat("heatIsolation");
10908 }
10909
10911 {
10913 }
10914
10916 {
10917 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10918 if (
g_Game.ConfigIsExisting(paramPath))
10919 return g_Game.ConfigGetFloat(paramPath);
10920
10921 return 0.0;
10922 }
10923
10925 {
10926 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10927 if (
g_Game.ConfigIsExisting(paramPath))
10928 return g_Game.ConfigGetFloat(paramPath);
10929
10930 return 0.0;
10931 }
10932
10933 override void SetWet(
float value,
bool allow_client =
false)
10934 {
10935 if (!IsServerCheck(allow_client))
10936 return;
10937
10940
10942
10943 m_VarWet = Math.Clamp(value, min, max);
10944
10946 {
10949 }
10950 }
10951
10952 override void AddWet(
float value)
10953 {
10955 }
10956
10958 {
10960 }
10961
10963 {
10965 }
10966
10968 {
10970 }
10971
10973 {
10975 }
10976
10978 {
10980 }
10981
10982 override void OnWetChanged(
float newVal,
float oldVal)
10983 {
10986 if (newLevel != oldLevel)
10987 {
10989 }
10990 }
10991
10993 {
10994 SetWeightDirty();
10995 }
10996
10998 {
10999 return GetWetLevelInternal(
m_VarWet);
11000 }
11001
11002
11003
11005 {
11007 }
11008
11010 {
11012 }
11013
11015 {
11017 }
11018
11020 {
11022 }
11023
11024
11025
11027 {
11028 if (ConfigIsExisting("itemModelLength"))
11029 {
11030 return ConfigGetFloat("itemModelLength");
11031 }
11032 return 0;
11033 }
11034
11036 {
11037 if (ConfigIsExisting("itemAttachOffset"))
11038 {
11039 return ConfigGetFloat("itemAttachOffset");
11040 }
11041 return 0;
11042 }
11043
11044 override void SetCleanness(
int value,
bool allow_client =
false)
11045 {
11046 if (!IsServerCheck(allow_client))
11047 return;
11048
11050
11052
11055 }
11056
11058 {
11060 }
11061
11063 {
11064 return true;
11065 }
11066
11067
11068
11069
11071 {
11073 }
11074
11076 {
11078 }
11079
11080
11081
11082
11083 override void SetColor(
int r,
int g,
int b,
int a)
11084 {
11090 }
11092 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11093 {
11098 }
11099
11101 {
11103 }
11104
11107 {
11108 int r,g,b,a;
11110 r = r/255;
11111 g = g/255;
11112 b = b/255;
11113 a = a/255;
11114 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11115 }
11116
11117
11118
11119 override void SetLiquidType(
int value,
bool allow_client =
false)
11120 {
11121 if (!IsServerCheck(allow_client))
11122 return;
11123
11128 }
11129
11131 {
11132 return ConfigGetInt("varLiquidTypeInit");
11133 }
11134
11136 {
11138 }
11139
11141 {
11143 SetFrozen(false);
11144 }
11145
11148 {
11149 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11150 }
11151
11152
11155 {
11156 PlayerBase nplayer;
11157 if (PlayerBase.CastTo(nplayer, player))
11158 {
11160 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11161 }
11162 }
11163
11164
11167 {
11168 PlayerBase nplayer;
11169 if (PlayerBase.CastTo(nplayer,player))
11170 {
11171 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11172 }
11173
11174 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11175
11176 if (HasEnergyManager())
11177 {
11178 GetCompEM().UpdatePlugState();
11179 }
11180 }
11181
11182
11184 {
11185 super.OnPlacementStarted(player);
11186
11188 }
11189
11190 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11191 {
11193 {
11194 m_AdminLog.OnPlacementComplete(player,
this);
11195 }
11196
11197 super.OnPlacementComplete(player, position, orientation);
11198 }
11199
11200
11201
11202
11203
11205 {
11207 {
11208 return true;
11209 }
11210 else
11211 {
11212 return false;
11213 }
11214 }
11215
11216
11218 {
11220 {
11222 }
11223 }
11224
11225
11227 {
11229 }
11230
11232 {
11234 }
11235
11236 override void InsertAgent(
int agent,
float count = 1)
11237 {
11238 if (count < 1)
11239 return;
11240
11242 }
11243
11246 {
11248 }
11249
11250
11252 {
11254 }
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11298 {
11300 return false;
11301 return true;
11302 }
11303
11305 {
11306
11308 }
11309
11310
11313 {
11314 super.CheckForRoofLimited(timeTresholdMS);
11315
11316 float time =
g_Game.GetTime();
11317 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11318 {
11319 m_PreviousRoofTestTime = time;
11320 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11321 }
11322 }
11323
11324
11326 {
11328 {
11329 return 0;
11330 }
11331
11332 if (GetInventory().GetAttachmentSlotsCount() != 0)
11333 {
11334 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11335 if (filter)
11336 return filter.GetProtectionLevel(type, false, system);
11337 else
11338 return 0;
11339 }
11340
11341 string subclassPath, entryName;
11342
11343 switch (type)
11344 {
11346 entryName = "biological";
11347 break;
11349 entryName = "chemical";
11350 break;
11351 default:
11352 entryName = "biological";
11353 break;
11354 }
11355
11356 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11357
11358 return g_Game.ConfigGetFloat(subclassPath + entryName);
11359 }
11360
11361
11362
11365 {
11366 if (!IsMagazine())
11368
11370 }
11371
11372
11373
11374
11375
11380 {
11381 return true;
11382 }
11383
11385 {
11387 }
11388
11389
11390
11391
11392
11394 {
11395 if (parent)
11396 {
11397 if (parent.IsInherited(DayZInfected))
11398 return true;
11399
11400 if (!parent.IsRuined())
11401 return true;
11402 }
11403
11404 return true;
11405 }
11406
11408 {
11409 if (!super.CanPutAsAttachment(parent))
11410 {
11411 return false;
11412 }
11413
11414 if (!IsRuined() && !parent.IsRuined())
11415 {
11416 return true;
11417 }
11418
11419 return false;
11420 }
11421
11423 {
11424
11425
11426
11427
11428 return super.CanReceiveItemIntoCargo(item);
11429 }
11430
11432 {
11433
11434
11435
11436
11437 GameInventory attachmentInv = attachment.GetInventory();
11439 {
11440 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11441 return false;
11442 }
11443
11444 InventoryLocation loc = new InventoryLocation();
11445 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11446 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11447 return false;
11448
11449 return super.CanReceiveAttachment(attachment, slotId);
11450 }
11451
11453 {
11454 if (!super.CanReleaseAttachment(attachment))
11455 return false;
11456
11457 return GetInventory().AreChildrenAccessible();
11458 }
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11481 {
11482 int id = muzzle_owner.GetMuzzleID();
11483 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11484
11485 if (WPOF_array)
11486 {
11487 for (int i = 0; i < WPOF_array.Count(); i++)
11488 {
11489 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11490
11491 if (WPOF)
11492 {
11493 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11494 }
11495 }
11496 }
11497 }
11498
11499
11501 {
11502 int id = muzzle_owner.GetMuzzleID();
11504
11505 if (WPOBE_array)
11506 {
11507 for (int i = 0; i < WPOBE_array.Count(); i++)
11508 {
11509 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11510
11511 if (WPOBE)
11512 {
11513 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11514 }
11515 }
11516 }
11517 }
11518
11519
11521 {
11522 int id = muzzle_owner.GetMuzzleID();
11523 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11524
11525 if (WPOOH_array)
11526 {
11527 for (int i = 0; i < WPOOH_array.Count(); i++)
11528 {
11529 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11530
11531 if (WPOOH)
11532 {
11533 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11534 }
11535 }
11536 }
11537 }
11538
11539
11541 {
11542 int id = muzzle_owner.GetMuzzleID();
11543 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11544
11545 if (WPOOH_array)
11546 {
11547 for (int i = 0; i < WPOOH_array.Count(); i++)
11548 {
11549 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11550
11551 if (WPOOH)
11552 {
11553 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11554 }
11555 }
11556 }
11557 }
11558
11559
11561 {
11562 int id = muzzle_owner.GetMuzzleID();
11563 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11564
11565 if (WPOOH_array)
11566 {
11567 for (int i = 0; i < WPOOH_array.Count(); i++)
11568 {
11569 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11570
11571 if (WPOOH)
11572 {
11573 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11574 }
11575 }
11576 }
11577 }
11578
11579
11580
11582 {
11584 {
11585 return true;
11586 }
11587
11588 return false;
11589 }
11590
11592 {
11594 {
11595 return true;
11596 }
11597
11598 return false;
11599 }
11600
11602 {
11604 {
11605 return true;
11606 }
11607
11608 return false;
11609 }
11610
11612 {
11613 return false;
11614 }
11615
11618 {
11619 return UATimeSpent.DEFAULT_DEPLOY;
11620 }
11621
11622
11623
11624
11626 {
11628 SetSynchDirty();
11629 }
11630
11632 {
11634 }
11635
11636
11638 {
11639 return false;
11640 }
11641
11644 {
11645 string att_type = "None";
11646
11647 if (ConfigIsExisting("soundAttType"))
11648 {
11649 att_type = ConfigGetString("soundAttType");
11650 }
11651
11653 }
11654
11656 {
11658 }
11659
11660
11661
11662
11663
11669
11671 {
11674
11676 }
11677
11678
11680 {
11682 return;
11683
11685
11688
11691
11692 SoundParameters params = new SoundParameters();
11696 }
11697
11698
11700 {
11702 {
11705
11706 SetSynchDirty();
11707
11710 }
11711 }
11712
11714 {
11716 }
11717
11718
11720 {
11722 return;
11723
11725 SetSynchDirty();
11726
11729 }
11730
11732 {
11735 }
11736
11738 {
11740 }
11741
11742 void OnApply(PlayerBase player);
11743
11745 {
11746 return 1.0;
11747 };
11748
11750 {
11752 }
11753
11755 {
11757 }
11758
11760
11762 {
11763 SetDynamicPhysicsLifeTime(0.01);
11765 }
11766
11768 {
11769 array<string> zone_names = new array<string>;
11770 GetDamageZones(zone_names);
11771 for (int i = 0; i < zone_names.Count(); i++)
11772 {
11773 SetHealthMax(zone_names.Get(i),"Health");
11774 }
11775 SetHealthMax("","Health");
11776 }
11777
11780 {
11781 float global_health = GetHealth01("","Health");
11782 array<string> zones = new array<string>;
11783 GetDamageZones(zones);
11784
11785 for (int i = 0; i < zones.Count(); i++)
11786 {
11787 SetHealth01(zones.Get(i),"Health",global_health);
11788 }
11789 }
11790
11793 {
11794 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11795 }
11796
11798 {
11799 if (!hasRootAsPlayer)
11800 {
11801 if (refParentIB)
11802 {
11803
11804 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11805 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11806
11807 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11808 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11809
11812 }
11813 else
11814 {
11815
11818 }
11819 }
11820 }
11821
11823 {
11825 {
11826 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11827 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11828 {
11829 float heatPermCoef = 1.0;
11831 while (ent)
11832 {
11833 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11834 ent = ent.GetHierarchyParent();
11835 }
11836
11837 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11838 }
11839 }
11840 }
11841
11843 {
11844
11845 EntityAI parent = GetHierarchyParent();
11846 if (!parent)
11847 {
11848 hasParent = false;
11849 hasRootAsPlayer = false;
11850 }
11851 else
11852 {
11853 hasParent = true;
11854 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11855 refParentIB =
ItemBase.Cast(parent);
11856 }
11857 }
11858
11859 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11860 {
11861
11862 }
11863
11865 {
11866
11867 return false;
11868 }
11869
11871 {
11872
11873
11874 return false;
11875 }
11876
11878 {
11879
11880 return false;
11881 }
11882
11885 {
11886 return !GetIsFrozen() &&
IsOpen();
11887 }
11888
11890 {
11891 bool hasParent = false, hasRootAsPlayer = false;
11893
11894 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11895 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11896
11897 if (wwtu || foodDecay)
11898 {
11902
11903 if (processWetness || processTemperature || processDecay)
11904 {
11906
11907 if (processWetness)
11908 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11909
11910 if (processTemperature)
11912
11913 if (processDecay)
11914 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11915 }
11916 }
11917 }
11918
11921 {
11923 }
11924
11926 {
11929
11930 return super.GetTemperatureFreezeThreshold();
11931 }
11932
11934 {
11937
11938 return super.GetTemperatureThawThreshold();
11939 }
11940
11942 {
11945
11946 return super.GetItemOverheatThreshold();
11947 }
11948
11950 {
11952 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11953
11954 return super.GetTemperatureFreezeTime();
11955 }
11956
11958 {
11960 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11961
11962 return super.GetTemperatureThawTime();
11963 }
11964
11969
11971 {
11972 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11973 }
11974
11976 {
11977 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11978 }
11979
11982 {
11984 }
11985
11987 {
11989 }
11990
11992 {
11994 }
11995
11998 {
11999 return null;
12000 }
12001
12004 {
12005 return false;
12006 }
12007
12009 {
12011 {
12014 if (!trg)
12015 {
12017 explosive = this;
12018 }
12019
12020 explosive.PairRemote(trg);
12022
12023 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12024 trg.SetPersistentPairID(persistentID);
12025 explosive.SetPersistentPairID(persistentID);
12026
12027 return true;
12028 }
12029 return false;
12030 }
12031
12034 {
12035 float ret = 1.0;
12038 ret *= GetHealth01();
12039
12040 return ret;
12041 }
12042
12043 #ifdef DEVELOPER
12044 override void SetDebugItem()
12045 {
12046 super.SetDebugItem();
12047 _itemBase = this;
12048 }
12049
12051 {
12052 string text = super.GetDebugText();
12053
12055 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12056
12057 return text;
12058 }
12059 #endif
12060
12062 {
12063 return true;
12064 }
12065
12067
12069
12071 {
12074 }
12075
12076
12084
12100
12101 [
Obsolete(
"Use ItemSoundHandler instead")]
12104 {
12105 if (!
g_Game.IsDedicatedServer())
12106 {
12107 if (ConfigIsExisting("attachSoundSet"))
12108 {
12109 string cfg_path = "";
12110 string soundset = "";
12111 string type_name =
GetType();
12112
12115 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12116 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12117
12118 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12119 {
12120 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12121 {
12122 if (cfg_slot_array[i] == slot_type)
12123 {
12124 soundset = cfg_soundset_array[i];
12125 break;
12126 }
12127 }
12128 }
12129
12130 if (soundset != "")
12131 {
12132 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12134 }
12135 }
12136 }
12137 }
12138
12140}
12141
12143{
12145 if (entity)
12146 {
12147 bool is_item = entity.IsInherited(
ItemBase);
12148 if (is_item && full_quantity)
12149 {
12152 }
12153 }
12154 else
12155 {
12157 return NULL;
12158 }
12159 return entity;
12160}
12161
12163{
12164 if (item)
12165 {
12166 if (health > 0)
12167 item.SetHealth("", "", health);
12168
12169 if (item.CanHaveTemperature())
12170 {
12172 if (item.CanFreeze())
12173 item.SetFrozen(false);
12174 }
12175
12176 if (item.HasEnergyManager())
12177 {
12178 if (quantity >= 0)
12179 {
12180 item.GetCompEM().SetEnergy0To1(quantity);
12181 }
12182 else
12183 {
12185 }
12186 }
12187 else if (item.IsMagazine())
12188 {
12189 Magazine mag = Magazine.Cast(item);
12190 if (quantity >= 0)
12191 {
12192 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12193 }
12194 else
12195 {
12197 }
12198
12199 }
12200 else
12201 {
12202 if (quantity >= 0)
12203 {
12204 item.SetQuantityNormalized(quantity, false);
12205 }
12206 else
12207 {
12209 }
12210
12211 }
12212 }
12213}
12214
12215#ifdef DEVELOPER
12217#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.