7198{
7200 {
7201 return true;
7202 }
7203};
7204
7206{
7207
7208};
7209
7210
7211
7213{
7217
7219
7222
7223
7224
7225
7226
7235
7241
7246
7251
7272 protected bool m_IsResultOfSplit
7273
7275
7280
7281
7282
7284
7288
7289
7290
7292
7295
7296
7297
7303
7304
7312
7315
7316
7318
7319
7321
7322
7327
7328
7333
7335
7336
7338
7339
7341 {
7346
7347 if (!
g_Game.IsDedicatedServer())
7348 {
7350 {
7352
7354 {
7356 }
7357 }
7358
7361 }
7362
7363 m_OldLocation = null;
7364
7366 {
7368 }
7369
7370 if (ConfigIsExisting("headSelectionsToHide"))
7371 {
7374 }
7375
7377 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7378 {
7380 }
7381
7383
7384 m_IsResultOfSplit = false;
7385
7387 }
7388
7390 {
7391 super.InitItemVariables();
7392
7398 m_Count = ConfigGetInt(
"count");
7399
7402
7407
7410
7415
7427
7431
7432
7435 if (ConfigIsExisting("canBeSplit"))
7436 {
7439 }
7440
7442 if (ConfigIsExisting("itemBehaviour"))
7444
7445
7448 RegisterNetSyncVariableInt("m_VarLiquidType");
7449 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7450
7451 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7452 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7453 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7454
7455 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7456 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7457 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7458 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7459
7460 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7461 RegisterNetSyncVariableBool("m_IsTakeable");
7462 RegisterNetSyncVariableBool("m_IsHologram");
7463
7466 {
7469 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7470 }
7471
7473
7475 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7477
7479 }
7480
7482 {
7484 }
7485
7487 {
7490 {
7495 }
7496 }
7497
7498 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7499 {
7501 {
7504 }
7505
7507 }
7508
7510 {
7516 }
7517
7519
7521 {
7523
7524 if (!action)
7525 {
7526 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7527 return;
7528 }
7529
7531 if (!ai)
7532 {
7534 return;
7535 }
7536
7538 if (!action_array)
7539 {
7540 action_array = new array<ActionBase_Basic>;
7542 }
7543 if (LogManager.IsActionLogEnable())
7544 {
7545 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7546 }
7547
7548 if (action_array.Find(action) != -1)
7549 {
7550 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7551 }
7552 else
7553 {
7554 action_array.Insert(action);
7555 }
7556 }
7557
7559 {
7560 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7561 ActionBase action = player.GetActionManager().GetAction(actionName);
7564
7565 if (action_array)
7566 {
7567 action_array.RemoveItem(action);
7568 }
7569 }
7570
7571
7572
7574 {
7575 ActionOverrideData overrideData = new ActionOverrideData();
7579
7581 if (!actionMap)
7582 {
7585 }
7586
7587 actionMap.Insert(this.
Type(), overrideData);
7588
7589 }
7590
7592
7594
7595
7597 {
7600
7603
7604 string config_to_search = "CfgVehicles";
7605 string muzzle_owner_config;
7606
7608 {
7609 if (IsInherited(Weapon))
7610 config_to_search = "CfgWeapons";
7611
7612 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7613
7614 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7615
7616 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7617
7618 if (config_OnFire_subclass_count > 0)
7619 {
7620 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7621
7622 for (int i = 0; i < config_OnFire_subclass_count; i++)
7623 {
7624 string particle_class = "";
7625 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7626 string config_OnFire_entry = config_OnFire_class + particle_class;
7627 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7628 WPOF_array.Insert(WPOF);
7629 }
7630
7631
7633 }
7634 }
7635
7637 {
7638 config_to_search = "CfgWeapons";
7639 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7640
7641 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7642
7643 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7644
7645 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7646 {
7647 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7648
7649 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7650 {
7651 string particle_class2 = "";
7652 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7653 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7654 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7655 WPOBE_array.Insert(WPOBE);
7656 }
7657
7658
7660 }
7661 }
7662 }
7663
7664
7666 {
7669
7671 {
7672 string config_to_search = "CfgVehicles";
7673
7674 if (IsInherited(Weapon))
7675 config_to_search = "CfgWeapons";
7676
7677 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7678 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7679
7680 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7681 {
7682
7684
7686 {
7688 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7690 return;
7691 }
7692
7695
7696
7697
7698 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7699 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7700
7701 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7702 {
7703 string particle_class = "";
7704 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7705 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7706 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7707
7708 if (entry_type == CT_CLASS)
7709 {
7710 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7711 WPOOH_array.Insert(WPOF);
7712 }
7713 }
7714
7715
7717 }
7718 }
7719 }
7720
7722 {
7724 }
7725
7727 {
7729 {
7731
7734
7737
7738 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7739 }
7740 }
7741
7743 {
7745 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7746
7748 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7749
7751 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7752
7754 {
7756 }
7757 }
7758
7760 {
7762 }
7763
7765 {
7768 else
7770
7772 {
7775 }
7776 else
7777 {
7780
7783 }
7784
7786 }
7787
7789 {
7791 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7792 }
7793
7795 {
7797 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7799 }
7800
7802 {
7804 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7805 }
7806
7808 {
7811
7812 OverheatingParticle OP = new OverheatingParticle();
7817
7819 }
7820
7822 {
7825
7826 return -1;
7827 }
7828
7830 {
7832 {
7835
7836 for (int i = count; i > 0; --i)
7837 {
7838 int id = i - 1;
7841
7844
7845 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7846 {
7847 if (p)
7848 {
7851 }
7852 }
7853 }
7854 }
7855 }
7856
7858 {
7860 {
7862 {
7863 int id = i - 1;
7865
7866 if (OP)
7867 {
7869
7870 if (p)
7871 {
7873 }
7874
7875 delete OP;
7876 }
7877 }
7878
7881 }
7882 }
7883
7886 {
7887 return 0.0;
7888 }
7889
7890
7892 {
7893 return 250;
7894 }
7895
7897 {
7898 return 0;
7899 }
7900
7903 {
7905 return true;
7906
7907 return false;
7908 }
7909
7912 {
7915
7917 {
7919 }
7920 else
7921 {
7922
7924 }
7925
7927 }
7928
7935 {
7936 return -1;
7937 }
7938
7939
7940
7941
7943 {
7945 {
7946 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7947 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7948
7949 if (r_index >= 0)
7950 {
7951 InventoryLocation r_il = new InventoryLocation;
7952 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7953
7954 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7957 {
7958 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7959 }
7961 {
7962 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7963 }
7964
7965 }
7966
7967 player.GetHumanInventory().ClearUserReservedLocation(this);
7968 }
7969
7972 }
7973
7974
7975
7976
7978 {
7979 return ItemBase.m_DebugActionsMask;
7980 }
7981
7983 {
7984 return ItemBase.m_DebugActionsMask & mask;
7985 }
7986
7988 {
7989 ItemBase.m_DebugActionsMask = mask;
7990 }
7991
7993 {
7994 ItemBase.m_DebugActionsMask |= mask;
7995 }
7996
7998 {
7999 ItemBase.m_DebugActionsMask &= ~mask;
8000 }
8001
8003 {
8005 {
8007 }
8008 else
8009 {
8011 }
8012 }
8013
8014
8016 {
8017 if (GetEconomyProfile())
8018 {
8019 float q_max = GetEconomyProfile().GetQuantityMax();
8020 if (q_max > 0)
8021 {
8022 float q_min = GetEconomyProfile().GetQuantityMin();
8023 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8024
8026 {
8027 ComponentEnergyManager comp = GetCompEM();
8029 {
8031 }
8032 }
8034 {
8036
8037 }
8038
8039 }
8040 }
8041 }
8042
8045 {
8046 EntityAI parent = GetHierarchyParent();
8047
8048 if (parent)
8049 {
8050 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8051 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8052 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8053 }
8054 }
8055
8058 {
8059 EntityAI parent = GetHierarchyParent();
8060
8061 if (parent)
8062 {
8063 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8064 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8065 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8066 }
8067 }
8068
8070 {
8071
8072
8073
8074
8076
8078 {
8079 if (ScriptInputUserData.CanStoreInputUserData())
8080 {
8081 ScriptInputUserData ctx = new ScriptInputUserData;
8087 ctx.
Write(use_stack_max);
8090
8092 {
8093 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8094 }
8095 }
8096 }
8097 else if (!
g_Game.IsMultiplayer())
8098 {
8100 }
8101 }
8102
8104 {
8106 }
8107
8109 {
8111 }
8112
8114 {
8116 }
8117
8119 {
8120
8121 return false;
8122 }
8123
8125 {
8126 return false;
8127 }
8128
8132 {
8133 return false;
8134 }
8135
8137 {
8138 return "";
8139 }
8140
8142
8144 {
8145 return false;
8146 }
8147
8149 {
8150 return true;
8151 }
8152
8153
8154
8156 {
8157 return true;
8158 }
8159
8161 {
8162 return true;
8163 }
8164
8166 {
8167 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8169 }
8170
8172 {
8174 }
8175
8177 {
8179 if (!is_being_placed)
8181 SetSynchDirty();
8182 }
8183
8184
8186
8188 {
8190 }
8191
8193 {
8195 }
8196
8198 {
8199 return 1;
8200 }
8201
8203 {
8204 return false;
8205 }
8206
8208 {
8210 SetSynchDirty();
8211 }
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8248 {
8249 super.OnMovedInsideCargo(container);
8250
8251 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8252 }
8253
8254 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8255 {
8256 super.EEItemLocationChanged(oldLoc, newLoc);
8257
8258 PlayerBase newPlayer = null;
8259 PlayerBase oldPlayer = null;
8260
8261 if (newLoc.GetParent())
8262 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8263
8264 if (oldLoc.GetParent())
8265 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8266
8268 {
8269 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8270
8271 if (rIndex >= 0)
8272 {
8273 InventoryLocation rIl = new InventoryLocation;
8274 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8275
8276 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8279 {
8280 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8281 }
8283 {
8285 }
8286
8287 }
8288 }
8289
8291 {
8292 if (newPlayer)
8293 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8294
8295 if (newPlayer == oldPlayer)
8296 {
8297 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8298 {
8300 {
8301 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8302 {
8303 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8304 }
8305 }
8306 else
8307 {
8308 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8309 }
8310 }
8311
8312 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8313 {
8314 int type = oldLoc.GetType();
8316 {
8317 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8318 }
8320 {
8321 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8322 }
8323 }
8324 if (!m_OldLocation)
8325 {
8326 m_OldLocation = new InventoryLocation;
8327 }
8328 m_OldLocation.Copy(oldLoc);
8329 }
8330 else
8331 {
8332 if (m_OldLocation)
8333 {
8334 m_OldLocation.Reset();
8335 }
8336 }
8337
8338 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8339 }
8340 else
8341 {
8342 if (newPlayer)
8343 {
8344 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8345 if (resIndex >= 0)
8346 {
8347 InventoryLocation il = new InventoryLocation;
8348 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8350 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8353 {
8354 il.
GetParent().GetOnReleaseLock().Invoke(it);
8355 }
8357 {
8359 }
8360
8361 }
8362 }
8364 {
8365
8367 }
8368
8369 if (m_OldLocation)
8370 {
8371 m_OldLocation.Reset();
8372 }
8373 }
8374
8376 {
8377 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8378 }
8379
8381 {
8382 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8383 }
8384 }
8385
8386 override void EOnContact(IEntity other, Contact extra)
8387 {
8389 {
8390 int liquidType = -1;
8392 if (impactSpeed > 0.0)
8393 {
8395 #ifndef SERVER
8397 #else
8399 SetSynchDirty();
8400 #endif
8402 }
8403 }
8404
8405 #ifdef SERVER
8406 if (GetCompEM() && GetCompEM().IsPlugged())
8407 {
8408 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8409 GetCompEM().UnplugThis();
8410 }
8411 #endif
8412 }
8413
8415
8417 {
8419 }
8420
8422 {
8423
8424 }
8425
8427 {
8428 super.OnItemLocationChanged(old_owner, new_owner);
8429
8430 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8431 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8432
8433 if (!relatedPlayer && playerNew)
8434 relatedPlayer = playerNew;
8435
8436 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8437 {
8439 if (actionMgr)
8440 {
8441 ActionBase currentAction = actionMgr.GetRunningAction();
8442 if (currentAction)
8444 }
8445 }
8446
8447 Man ownerPlayerOld = null;
8448 Man ownerPlayerNew = null;
8449
8450 if (old_owner)
8451 {
8452 if (old_owner.
IsMan())
8453 {
8454 ownerPlayerOld = Man.Cast(old_owner);
8455 }
8456 else
8457 {
8458 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8459 }
8460 }
8461 else
8462 {
8464 {
8466
8467 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8468 {
8469 GetCompEM().UnplugThis();
8470 }
8471 }
8472 }
8473
8474 if (new_owner)
8475 {
8476 if (new_owner.
IsMan())
8477 {
8478 ownerPlayerNew = Man.Cast(new_owner);
8479 }
8480 else
8481 {
8482 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8483 }
8484 }
8485
8486 if (ownerPlayerOld != ownerPlayerNew)
8487 {
8488 if (ownerPlayerOld)
8489 {
8490 array<EntityAI> subItemsExit = new array<EntityAI>;
8492 for (int i = 0; i < subItemsExit.Count(); i++)
8493 {
8496 }
8497 }
8498
8499 if (ownerPlayerNew)
8500 {
8501 array<EntityAI> subItemsEnter = new array<EntityAI>;
8503 for (int j = 0; j < subItemsEnter.Count(); j++)
8504 {
8507 }
8508 }
8509 }
8510 else if (ownerPlayerNew != null)
8511 {
8512 PlayerBase nplayer;
8513 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8514 {
8515 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8517 for (int k = 0; k < subItemsUpdate.Count(); k++)
8518 {
8520 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8521 }
8522 }
8523 }
8524
8525 if (old_owner)
8526 old_owner.OnChildItemRemoved(this);
8527 if (new_owner)
8528 new_owner.OnChildItemReceived(this);
8529 }
8530
8531
8533 {
8534 super.EEDelete(parent);
8535 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8536 if (player)
8537 {
8539
8540 if (player.IsAlive())
8541 {
8542 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8543 if (r_index >= 0)
8544 {
8545 InventoryLocation r_il = new InventoryLocation;
8546 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8547
8548 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8551 {
8552 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8553 }
8555 {
8556 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8557 }
8558
8559 }
8560
8561 player.RemoveQuickBarEntityShortcut(this);
8562 }
8563 }
8564 }
8565
8567 {
8568 super.EEKilled(killer);
8569
8572 {
8573 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8574 {
8575 if (IsMagazine())
8576 {
8577 if (Magazine.Cast(this).GetAmmoCount() > 0)
8578 {
8580 }
8581 }
8582 else
8583 {
8585 }
8586 }
8587 }
8588 }
8589
8591 {
8592 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8593
8594 super.OnWasAttached(parent, slot_id);
8595
8598
8601 }
8602
8604 {
8605 super.OnWasDetached(parent, slot_id);
8606
8609
8612 }
8613
8615 {
8616 int idx;
8619
8620 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8621 if (inventory_slots.Count() < 1)
8622 {
8623 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8624 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8625 }
8626 else
8627 {
8628 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8629 }
8630
8631 idx = inventory_slots.Find(slot);
8632 if (idx < 0)
8633 return "";
8634
8635 return attach_types.Get(idx);
8636 }
8637
8639 {
8640 int idx = -1;
8641 string slot;
8642
8645
8646 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8647 if (inventory_slots.Count() < 1)
8648 {
8649 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8650 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8651 }
8652 else
8653 {
8654 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8655 if (detach_types.Count() < 1)
8656 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8657 }
8658
8659 for (int i = 0; i < inventory_slots.Count(); i++)
8660 {
8661 slot = inventory_slots.Get(i);
8662 }
8663
8664 if (slot != "")
8665 {
8666 if (detach_types.Count() == 1)
8667 idx = 0;
8668 else
8669 idx = inventory_slots.Find(slot);
8670 }
8671 if (idx < 0)
8672 return "";
8673
8674 return detach_types.Get(idx);
8675 }
8676
8678 {
8679
8681
8682
8683 float min_time = 1;
8684 float max_time = 3;
8685 float delay = Math.RandomFloat(min_time, max_time);
8686
8687 explode_timer.Run(delay, this, "DoAmmoExplosion");
8688 }
8689
8691 {
8692 Magazine magazine = Magazine.Cast(this);
8693 int pop_sounds_count = 6;
8694 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8695
8696
8697 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8698 string sound_name = pop_sounds[ sound_idx ];
8699 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8700
8701
8702 magazine.ServerAddAmmoCount(-1);
8703
8704
8705 float min_temp_to_explode = 100;
8706
8707 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8708 {
8710 }
8711 }
8712
8713
8714 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8715 {
8716 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8717
8718 const int CHANCE_DAMAGE_CARGO = 4;
8719 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8720 const int CHANCE_DAMAGE_NOTHING = 2;
8721
8723 {
8724 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8725 int chances;
8726 int rnd;
8727
8728 if (GetInventory().GetCargo())
8729 {
8730 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8731 rnd = Math.RandomInt(0,chances);
8732
8733 if (rnd < CHANCE_DAMAGE_CARGO)
8734 {
8736 }
8737 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8738 {
8740 }
8741 }
8742 else
8743 {
8744 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8745 rnd = Math.RandomInt(0,chances);
8746
8747 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8748 {
8750 }
8751 }
8752 }
8753 }
8754
8756 {
8757 CargoBase cargo = GetInventory().GetCargo();
8758 if (cargo)
8759 {
8761 if (item_count > 0)
8762 {
8763 int random_pick = Math.RandomInt(0, item_count);
8765 if (!item.IsExplosive())
8766 {
8767 item.AddHealth("","",damage);
8768 return true;
8769 }
8770 }
8771 }
8772 return false;
8773 }
8774
8776 {
8777 GameInventory inventory = GetInventory();
8779 if (attachment_count > 0)
8780 {
8781 int random_pick = Math.RandomInt(0, attachment_count);
8783 if (!attachment.IsExplosive())
8784 {
8785 attachment.AddHealth("","",damage);
8786 return true;
8787 }
8788 }
8789 return false;
8790 }
8791
8793 {
8795 }
8796
8798 {
8800 return GetInventory().CanRemoveEntity();
8801
8802 return false;
8803 }
8804
8806 {
8807
8809 return false;
8810
8811
8813 return false;
8814
8815
8816
8818 if (delta == 0)
8819 return false;
8820
8821
8822 return true;
8823 }
8824
8826 {
8828 {
8829 if (ScriptInputUserData.CanStoreInputUserData())
8830 {
8831 ScriptInputUserData ctx = new ScriptInputUserData;
8836 ctx.
Write(destination_entity);
8840 }
8841 }
8842 else if (!
g_Game.IsMultiplayer())
8843 {
8845 }
8846 }
8847
8849 {
8850 float split_quantity_new;
8854 InventoryLocation loc = new InventoryLocation;
8855
8856 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8857 {
8859 split_quantity_new = stack_max;
8860 else
8862
8864 {
8865 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8866 if (new_item)
8867 {
8868 new_item.SetResultOfSplit(true);
8869 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8871 new_item.
SetQuantity(split_quantity_new,
false,
true);
8872 }
8873 }
8874 }
8875 else if (destination_entity && slot_id == -1)
8876 {
8877 if (quantity > stack_max)
8878 split_quantity_new = stack_max;
8879 else
8880 split_quantity_new = quantity;
8881
8883 {
8884 GameInventory destinationInventory = destination_entity.GetInventory();
8886 {
8889 }
8890
8891 if (new_item)
8892 {
8893 new_item.SetResultOfSplit(true);
8894 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8896 new_item.
SetQuantity(split_quantity_new,
false,
true);
8897 }
8898 }
8899 }
8900 else
8901 {
8902 if (stack_max != 0)
8903 {
8905 {
8907 }
8908
8909 if (split_quantity_new == 0)
8910 {
8911 if (!
g_Game.IsMultiplayer())
8912 player.PhysicalPredictiveDropItem(this);
8913 else
8914 player.ServerDropEntity(this);
8915 return;
8916 }
8917
8919 {
8921
8922 if (new_item)
8923 {
8924 new_item.SetResultOfSplit(true);
8925 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8928 new_item.PlaceOnSurface();
8929 }
8930 }
8931 }
8932 }
8933 }
8934
8936 {
8937 float split_quantity_new;
8941 InventoryLocation loc = new InventoryLocation;
8942
8943 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8944 {
8946 split_quantity_new = stack_max;
8947 else
8949
8951 {
8952 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8953 if (new_item)
8954 {
8955 new_item.SetResultOfSplit(true);
8956 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8958 new_item.
SetQuantity(split_quantity_new,
false,
true);
8959 }
8960 }
8961 }
8962 else if (destination_entity && slot_id == -1)
8963 {
8964 if (quantity > stack_max)
8965 split_quantity_new = stack_max;
8966 else
8967 split_quantity_new = quantity;
8968
8970 {
8971 GameInventory destinationInventory = destination_entity.GetInventory();
8973 {
8976 }
8977
8978 if (new_item)
8979 {
8980 new_item.SetResultOfSplit(true);
8981 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8983 new_item.
SetQuantity(split_quantity_new,
false,
true);
8984 }
8985 }
8986 }
8987 else
8988 {
8989 if (stack_max != 0)
8990 {
8992 {
8994 }
8995
8997 {
8999
9000 if (new_item)
9001 {
9002 new_item.SetResultOfSplit(true);
9003 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9006 new_item.PlaceOnSurface();
9007 }
9008 }
9009 }
9010 }
9011 }
9012
9014 {
9016 {
9017 if (ScriptInputUserData.CanStoreInputUserData())
9018 {
9019 ScriptInputUserData ctx = new ScriptInputUserData;
9024 dst.WriteToContext(ctx);
9026 }
9027 }
9028 else if (!
g_Game.IsMultiplayer())
9029 {
9031 }
9032 }
9033
9035 {
9037 {
9038 if (ScriptInputUserData.CanStoreInputUserData())
9039 {
9040 ScriptInputUserData ctx = new ScriptInputUserData;
9045 ctx.
Write(destination_entity);
9051 }
9052 }
9053 else if (!
g_Game.IsMultiplayer())
9054 {
9056 }
9057 }
9058
9060 {
9062 }
9063
9065 {
9067 float split_quantity_new;
9069 if (dst.IsValid())
9070 {
9071 int slot_id = dst.GetSlot();
9073
9074 if (quantity > stack_max)
9075 split_quantity_new = stack_max;
9076 else
9077 split_quantity_new = quantity;
9078
9080 {
9082
9083 if (new_item)
9084 {
9085 new_item.SetResultOfSplit(true);
9086 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9088 new_item.
SetQuantity(split_quantity_new,
false,
true);
9089 }
9090
9091 return new_item;
9092 }
9093 }
9094
9095 return null;
9096 }
9097
9099 {
9101 float split_quantity_new;
9103 if (destination_entity)
9104 {
9106 if (quantity > stackable)
9107 split_quantity_new = stackable;
9108 else
9109 split_quantity_new = quantity;
9110
9112 {
9113 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9114 if (new_item)
9115 {
9116 new_item.SetResultOfSplit(true);
9117 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9119 new_item.
SetQuantity(split_quantity_new,
false,
true);
9120 }
9121 }
9122 }
9123 }
9124
9126 {
9128 {
9129 if (ScriptInputUserData.CanStoreInputUserData())
9130 {
9131 ScriptInputUserData ctx = new ScriptInputUserData;
9136 ItemBase destination_entity =
this;
9137 ctx.
Write(destination_entity);
9141 }
9142 }
9143 else if (!
g_Game.IsMultiplayer())
9144 {
9146 }
9147 }
9148
9150 {
9152 float split_quantity_new;
9154 if (player)
9155 {
9157 if (quantity > stackable)
9158 split_quantity_new = stackable;
9159 else
9160 split_quantity_new = quantity;
9161
9163 {
9164 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9165 new_item =
ItemBase.Cast(in_hands);
9166 if (new_item)
9167 {
9168 new_item.SetResultOfSplit(true);
9169 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9171 new_item.SetQuantity(split_quantity_new, false, true);
9172 }
9173 }
9174 }
9175 }
9176
9178 {
9180 float split_quantity_new = Math.Floor(quantity * 0.5);
9181
9183 return;
9184
9186
9187 if (new_item)
9188 {
9189 if (new_item.GetQuantityMax() < split_quantity_new)
9190 {
9191 split_quantity_new = new_item.GetQuantityMax();
9192 }
9193
9194 new_item.SetResultOfSplit(true);
9195 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9196
9198 {
9201 }
9202 else
9203 {
9205 new_item.
SetQuantity(split_quantity_new,
false,
true);
9206 }
9207 }
9208 }
9209
9211 {
9213 float split_quantity_new = Math.Floor(quantity / 2);
9214
9216 return;
9217
9218 InventoryLocation invloc = new InventoryLocation;
9220
9222 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9223
9224 if (new_item)
9225 {
9226 if (new_item.GetQuantityMax() < split_quantity_new)
9227 {
9228 split_quantity_new = new_item.GetQuantityMax();
9229 }
9231 {
9234 }
9235 else if (split_quantity_new > 1)
9236 {
9238 new_item.
SetQuantity(split_quantity_new,
false,
true);
9239 }
9240 }
9241 }
9242
9245 {
9246 SetWeightDirty();
9248
9249 if (parent)
9250 parent.OnAttachmentQuantityChangedEx(this, delta);
9251
9253 {
9255 {
9257 }
9259 {
9260 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9262 }
9263 }
9264 }
9265
9268 {
9269
9270 }
9271
9274 {
9276 }
9277
9279 {
9280 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9281
9283 {
9284 if (newLevel == GameConstants.STATE_RUINED)
9285 {
9287 EntityAI parent = GetHierarchyParent();
9288 if (parent && parent.IsFireplace())
9289 {
9290 CargoBase cargo = GetInventory().GetCargo();
9291 if (cargo)
9292 {
9294 {
9296 }
9297 }
9298 }
9299 }
9300
9302 {
9303
9305 return;
9306 }
9307
9308 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9309 {
9311 }
9312 }
9313 }
9314
9315
9317 {
9318 super.OnRightClick();
9319
9321 {
9323 {
9324 if (ScriptInputUserData.CanStoreInputUserData())
9325 {
9326 EntityAI root = GetHierarchyRoot();
9327 Man playerOwner = GetHierarchyRootPlayer();
9328 InventoryLocation dst = new InventoryLocation;
9329
9330
9331 if (!playerOwner && root && root == this)
9332 {
9334 }
9335 else
9336 {
9337
9338 GetInventory().GetCurrentInventoryLocation(dst);
9340 {
9341 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9343 {
9345 }
9346 else
9347 {
9349
9350
9351 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9352 {
9354 }
9355 else
9356 {
9357 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9358 }
9359 }
9360 }
9361 }
9362
9363 ScriptInputUserData ctx = new ScriptInputUserData;
9371 }
9372 }
9373 else if (!
g_Game.IsMultiplayer())
9374 {
9376 }
9377 }
9378 }
9379
9381 {
9382 if (root)
9383 {
9384 vector m4[4];
9385 root.GetTransform(m4);
9386 dst.SetGround(this, m4);
9387 }
9388 else
9389 {
9390 GetInventory().GetCurrentInventoryLocation(dst);
9391 }
9392 }
9393
9394 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9395 {
9396
9397 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9398 return false;
9399
9400 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9401 return false;
9402
9403
9405 return false;
9406
9407
9408 Magazine mag = Magazine.Cast(this);
9409 if (mag)
9410 {
9411 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9412 return false;
9413
9414 if (stack_max_limit)
9415 {
9416 Magazine other_mag = Magazine.Cast(other_item);
9417 if (other_item)
9418 {
9419 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9420 return false;
9421 }
9422
9423 }
9424 }
9425 else
9426 {
9427
9429 return false;
9430
9432 return false;
9433 }
9434
9435 PlayerBase player = null;
9436 if (CastTo(player, GetHierarchyRootPlayer()))
9437 {
9438 if (player.GetInventory().HasAttachment(this))
9439 return false;
9440
9441 if (player.IsItemsToDelete())
9442 return false;
9443 }
9444
9445 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9446 return false;
9447
9448 int slotID;
9450 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9451 return false;
9452
9453 return true;
9454 }
9455
9457 {
9459 }
9460
9462 {
9463 return m_IsResultOfSplit;
9464 }
9465
9467 {
9468 m_IsResultOfSplit = value;
9469 }
9470
9472 {
9474 }
9475
9477 {
9478 float other_item_quantity = other_item.GetQuantity();
9479 float this_free_space;
9480
9482
9484
9485 if (other_item_quantity > this_free_space)
9486 {
9487 return this_free_space;
9488 }
9489 else
9490 {
9491 return other_item_quantity;
9492 }
9493 }
9494
9496 {
9498 }
9499
9501 {
9503 return;
9504
9505 if (!IsMagazine() && other_item)
9506 {
9508 if (quantity_used != 0)
9509 {
9510 float hp1 = GetHealth01("","");
9511 float hp2 = other_item.GetHealth01("","");
9512 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9513 hpResult = hpResult / (
GetQuantity() + quantity_used);
9514
9515 hpResult *= GetMaxHealth();
9516 Math.Round(hpResult);
9517 SetHealth("", "Health", hpResult);
9518
9520 other_item.AddQuantity(-quantity_used);
9521 }
9522 }
9524 }
9525
9527 {
9528 #ifdef SERVER
9529 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9530 GetHierarchyParent().IncreaseLifetimeUp();
9531 #endif
9532 };
9533
9535 {
9536 PlayerBase p = PlayerBase.Cast(player);
9537
9538 array<int> recipesIds = p.m_Recipes;
9539 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9540 if (moduleRecipesManager)
9541 {
9542 EntityAI itemInHands = player.GetEntityInHands();
9543 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9544 }
9545
9546 for (int i = 0;i < recipesIds.Count(); i++)
9547 {
9548 int key = recipesIds.Get(i);
9549 string recipeName = moduleRecipesManager.GetRecipeName(key);
9551 }
9552 }
9553
9554
9555 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9556 {
9557 super.GetDebugActions(outputList);
9558
9559
9565
9566
9571
9576
9577
9581
9582
9584 {
9588 }
9589
9592
9593
9597
9599
9600 InventoryLocation loc = new InventoryLocation();
9601 GetInventory().GetCurrentInventoryLocation(loc);
9603 {
9604 if (Gizmo_IsSupported())
9607 }
9608
9610 }
9611
9612
9613
9614
9616 {
9617 super.OnAction(action_id, player, ctx);
9618
9620 {
9621 switch (action_id)
9622 {
9626 return true;
9630 return true;
9631 }
9632 }
9633
9635 {
9636 switch (action_id)
9637 {
9639 Delete();
9640 return true;
9641 }
9642 }
9643
9644 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9645 {
9646 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9647 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9648 PlayerBase p = PlayerBase.Cast(player);
9649 if (
EActions.RECIPES_RANGE_START < 1000)
9650 {
9651 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9652 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9653 }
9654 }
9655 #ifndef SERVER
9656 else if (action_id ==
EActions.WATCH_PLAYER)
9657 {
9658 PluginDeveloper.SetDeveloperItemClientEx(player);
9659 }
9660 #endif
9662 {
9663 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9664 {
9665 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9666 OnDebugButtonPressServer(id + 1);
9667 }
9668
9669 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9670 {
9671 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9673 }
9674
9675 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9676 {
9677 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9679 }
9680
9681 else if (action_id ==
EActions.ADD_QUANTITY)
9682 {
9683 if (IsMagazine())
9684 {
9685 Magazine mag = Magazine.Cast(this);
9686 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9687 }
9688 else
9689 {
9691 }
9692
9693 if (m_EM)
9694 {
9695 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9696 }
9697
9698 }
9699
9700 else if (action_id ==
EActions.REMOVE_QUANTITY)
9701 {
9702 if (IsMagazine())
9703 {
9704 Magazine mag2 = Magazine.Cast(this);
9705 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9706 }
9707 else
9708 {
9710 }
9711 if (m_EM)
9712 {
9713 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9714 }
9715
9716 }
9717
9718 else if (action_id ==
EActions.SET_QUANTITY_0)
9719 {
9721
9722 if (m_EM)
9723 {
9724 m_EM.SetEnergy(0);
9725 }
9726 }
9727
9728 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9729 {
9731
9732 if (m_EM)
9733 {
9734 m_EM.SetEnergy(m_EM.GetEnergyMax());
9735 }
9736 }
9737
9738 else if (action_id ==
EActions.ADD_HEALTH)
9739 {
9740 AddHealth("","",GetMaxHealth("","Health")/5);
9741 }
9742 else if (action_id ==
EActions.REMOVE_HEALTH)
9743 {
9744 AddHealth("","",-GetMaxHealth("","Health")/5);
9745 }
9746 else if (action_id ==
EActions.DESTROY_HEALTH)
9747 {
9748 SetHealth01("","",0);
9749 }
9750 else if (action_id ==
EActions.WATCH_ITEM)
9751 {
9753 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9754 #ifdef DEVELOPER
9755 SetDebugDeveloper_item(this);
9756 #endif
9757 }
9758
9759 else if (action_id ==
EActions.ADD_TEMPERATURE)
9760 {
9761 AddTemperature(20);
9762
9763 }
9764
9765 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9766 {
9767 AddTemperature(-20);
9768
9769 }
9770
9771 else if (action_id ==
EActions.FLIP_FROZEN)
9772 {
9773 SetFrozen(!GetIsFrozen());
9774
9775 }
9776
9777 else if (action_id ==
EActions.ADD_WETNESS)
9778 {
9780
9781 }
9782
9783 else if (action_id ==
EActions.REMOVE_WETNESS)
9784 {
9786
9787 }
9788
9789 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9790 {
9793
9794
9795 }
9796
9797 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9798 {
9801 }
9802
9803 else if (action_id ==
EActions.MAKE_SPECIAL)
9804 {
9805 auto debugParams = DebugSpawnParams.WithPlayer(player);
9806 OnDebugSpawnEx(debugParams);
9807 }
9808
9809 }
9810
9811
9812 return false;
9813 }
9814
9815
9816
9817
9821
9824
9825
9826
9828 {
9829 return false;
9830 }
9831
9832
9834 {
9835 return true;
9836 }
9837
9838
9840 {
9841 return true;
9842 }
9843
9844
9845
9847 {
9848 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9849 return g_Game.ConfigIsExisting(config_path);
9850 }
9851
9854 {
9855 return null;
9856 }
9857
9859 {
9860 return false;
9861 }
9862
9864 {
9865 return false;
9866 }
9867
9871
9872
9874 {
9875 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9876 return module_repairing.CanRepair(this, item_repair_kit);
9877 }
9878
9879
9880 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9881 {
9882 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9883 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9884 }
9885
9886
9888 {
9889
9890
9891
9892
9893
9894
9895
9896
9897 return 1;
9898 }
9899
9900
9901
9903 {
9905 }
9906
9907
9908
9910 {
9912 }
9913
9914
9923 {
9924 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9925
9926 if (player)
9927 {
9928 player.MessageStatus(text);
9929 }
9930 }
9931
9932
9941 {
9942 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9943
9944 if (player)
9945 {
9946 player.MessageAction(text);
9947 }
9948 }
9949
9950
9959 {
9960 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9961
9962 if (player)
9963 {
9964 player.MessageFriendly(text);
9965 }
9966 }
9967
9968
9977 {
9978 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9979
9980 if (player)
9981 {
9982 player.MessageImportant(text);
9983 }
9984 }
9985
9987 {
9988 return true;
9989 }
9990
9991
9992 override bool KindOf(
string tag)
9993 {
9994 bool found = false;
9995 string item_name = this.
GetType();
9997 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9998
9999 int array_size = item_tag_array.Count();
10000 for (int i = 0; i < array_size; i++)
10001 {
10002 if (item_tag_array.Get(i) == tag)
10003 {
10004 found = true;
10005 break;
10006 }
10007 }
10008 return found;
10009 }
10010
10011
10013 {
10014
10015 super.OnRPC(sender, rpc_type,ctx);
10016
10017
10018 switch (rpc_type)
10019 {
10020 #ifndef SERVER
10021 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10022 Param2<bool, string> p = new Param2<bool, string>(false, "");
10023
10025 return;
10026
10027 bool play = p.param1;
10028 string soundSet = p.param2;
10029
10030 if (play)
10031 {
10033 {
10035 {
10037 }
10038 }
10039 else
10040 {
10042 }
10043 }
10044 else
10045 {
10047 }
10048
10049 break;
10050 #endif
10051
10052 }
10053
10055 {
10057 }
10058 }
10059
10060
10061
10062
10064 {
10065 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10066 return plugin.GetID(
name);
10067 }
10068
10070 {
10071 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10072 return plugin.GetName(id);
10073 }
10074
10077 {
10078
10079
10080 int varFlags;
10081 if (!ctx.
Read(varFlags))
10082 return;
10083
10084 if (varFlags & ItemVariableFlags.FLOAT)
10085 {
10087 }
10088 }
10089
10091 {
10092
10093 super.SerializeNumericalVars(floats_out);
10094
10095
10096
10098 {
10100 }
10101
10103 {
10105 }
10106
10108 {
10110 }
10111
10113 {
10118 }
10119
10121 {
10123 }
10124 }
10125
10127 {
10128
10129 super.DeSerializeNumericalVars(floats);
10130
10131
10132 int index = 0;
10133 int mask = Math.Round(floats.Get(index));
10134
10135 index++;
10136
10138 {
10140 {
10142 }
10143 else
10144 {
10145 float quantity = floats.Get(index);
10146 SetQuantity(quantity,
true,
false,
false,
false);
10147 }
10148 index++;
10149 }
10150
10152 {
10153 float wet = floats.Get(index);
10155 index++;
10156 }
10157
10159 {
10160 int liquidtype = Math.Round(floats.Get(index));
10162 index++;
10163 }
10164
10166 {
10168 index++;
10170 index++;
10172 index++;
10174 index++;
10175 }
10176
10178 {
10179 int cleanness = Math.Round(floats.Get(index));
10181 index++;
10182 }
10183 }
10184
10186 {
10187 super.WriteVarsToCTX(ctx);
10188
10189
10191 {
10193 }
10194
10196 {
10198 }
10199
10201 {
10203 }
10204
10206 {
10207 int r,g,b,a;
10213 }
10214
10216 {
10218 }
10219 }
10220
10222 {
10223 if (!super.ReadVarsFromCTX(ctx,version))
10224 return false;
10225
10226 int intValue;
10227 float value;
10228
10229 if (version < 140)
10230 {
10231 if (!ctx.
Read(intValue))
10232 return false;
10233
10234 m_VariablesMask = intValue;
10235 }
10236
10238 {
10239 if (!ctx.
Read(value))
10240 return false;
10241
10243 {
10245 }
10246 else
10247 {
10249 }
10250 }
10251
10252 if (version < 140)
10253 {
10255 {
10256 if (!ctx.
Read(value))
10257 return false;
10258 SetTemperatureDirect(value);
10259 }
10260 }
10261
10263 {
10264 if (!ctx.
Read(value))
10265 return false;
10267 }
10268
10270 {
10271 if (!ctx.
Read(intValue))
10272 return false;
10274 }
10275
10277 {
10278 int r,g,b,a;
10280 return false;
10282 return false;
10284 return false;
10286 return false;
10287
10289 }
10290
10292 {
10293 if (!ctx.
Read(intValue))
10294 return false;
10296 }
10297
10298 if (version >= 138 && version < 140)
10299 {
10301 {
10302 if (!ctx.
Read(intValue))
10303 return false;
10304 SetFrozen(intValue);
10305 }
10306 }
10307
10308 return true;
10309 }
10310
10311
10313 {
10316 {
10318 }
10319
10320 if (!super.OnStoreLoad(ctx, version))
10321 {
10323 return false;
10324 }
10325
10326 if (version >= 114)
10327 {
10328 bool hasQuickBarIndexSaved;
10329
10330 if (!ctx.
Read(hasQuickBarIndexSaved))
10331 {
10333 return false;
10334 }
10335
10336 if (hasQuickBarIndexSaved)
10337 {
10338 int itmQBIndex;
10339
10340
10341 if (!ctx.
Read(itmQBIndex))
10342 {
10344 return false;
10345 }
10346
10347 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10348 if (itmQBIndex != -1 && parentPlayer)
10349 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10350 }
10351 }
10352 else
10353 {
10354
10355 PlayerBase player;
10356 int itemQBIndex;
10357 if (version ==
int.
MAX)
10358 {
10359 if (!ctx.
Read(itemQBIndex))
10360 {
10362 return false;
10363 }
10364 }
10365 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10366 {
10367
10368 if (!ctx.
Read(itemQBIndex))
10369 {
10371 return false;
10372 }
10373 if (itemQBIndex != -1 && player)
10374 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10375 }
10376 }
10377
10378 if (version < 140)
10379 {
10380
10381 if (!LoadVariables(ctx, version))
10382 {
10384 return false;
10385 }
10386 }
10387
10388
10390 {
10392 return false;
10393 }
10394 if (version >= 132)
10395 {
10397 if (raib)
10398 {
10400 {
10402 return false;
10403 }
10404 }
10405 }
10406
10408 return true;
10409 }
10410
10411
10412
10414 {
10415 super.OnStoreSave(ctx);
10416
10417 PlayerBase player;
10418 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10419 {
10421
10422 int itemQBIndex = -1;
10423 itemQBIndex = player.FindQuickBarEntityIndex(this);
10424 ctx.
Write(itemQBIndex);
10425 }
10426 else
10427 {
10429 }
10430
10432
10434 if (raib)
10435 {
10437 }
10438 }
10439
10440
10442 {
10443 super.AfterStoreLoad();
10444
10446 {
10448 }
10449
10451 {
10454 }
10455 }
10456
10458 {
10459 super.EEOnAfterLoad();
10460
10462 {
10464 }
10465
10468 }
10469
10471 {
10472 return false;
10473 }
10474
10475
10476
10478 {
10480 {
10481 #ifdef PLATFORM_CONSOLE
10482
10484 {
10486 if (menu)
10487 {
10489 }
10490 }
10491 #endif
10492 }
10493
10495 {
10498 }
10499
10501 {
10502 SetWeightDirty();
10504 }
10506 {
10509 }
10510
10512 {
10515
10518 }
10520 {
10524 }
10525
10526 super.OnVariablesSynchronized();
10527 }
10528
10529
10530
10532 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10533 {
10534 if (!IsServerCheck(allow_client))
10535 return false;
10536
10538 return false;
10539
10542
10543 if (value <= (min + 0.001))
10544 value = min;
10545
10546 if (value == min)
10547 {
10548 if (destroy_config)
10549 {
10550 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10551 if (dstr)
10552 {
10554 this.Delete();
10555 return true;
10556 }
10557 }
10558 else if (destroy_forced)
10559 {
10561 this.Delete();
10562 return true;
10563 }
10564
10566 }
10567
10570
10572 {
10573 EntityAI parent = GetHierarchyRoot();
10574 InventoryLocation iLoc = new InventoryLocation();
10575 GetInventory().GetCurrentInventoryLocation(iLoc);
10577 {
10578 int iLocSlot = iLoc.
GetSlot();
10580 {
10582 }
10584 {
10586 }
10587 }
10588 }
10589
10591 {
10593
10594 if (delta)
10596 }
10597
10599
10600 return false;
10601 }
10602
10603
10605 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10606 {
10608 }
10609
10611 {
10614 }
10615
10617 {
10620 }
10621
10623 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10624 {
10625 float value_clamped = Math.Clamp(value, 0, 1);
10627 SetQuantity(result, destroy_config, destroy_forced);
10628 }
10629
10630
10633 {
10635 }
10636
10638 {
10640 }
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10652 {
10653 int slot = -1;
10654 GameInventory inventory = GetInventory();
10655 if (inventory)
10656 {
10657 InventoryLocation il = new InventoryLocation;
10660 }
10661
10663 }
10664
10666 {
10667 float quantity_max = 0;
10668
10670 {
10671 if (attSlotID != -1)
10672 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10673
10674 if (quantity_max <= 0)
10676 }
10677
10678 if (quantity_max <= 0)
10680
10681 return quantity_max;
10682 }
10683
10685 {
10687 }
10688
10690 {
10692 }
10693
10694
10696 {
10698 }
10699
10701 {
10703 }
10704
10706 {
10708 }
10709
10710
10712 {
10713
10714 float weightEx = GetWeightEx();
10715 float special = GetInventoryAndCargoWeight();
10716 return weightEx - special;
10717 }
10718
10719
10721 {
10723 }
10724
10726 {
10728 {
10729 #ifdef DEVELOPER
10730 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10731 {
10732 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10734 }
10735 #endif
10736
10737 return GetQuantity() * GetConfigWeightModified();
10738 }
10739 else if (HasEnergyManager())
10740 {
10741 #ifdef DEVELOPER
10742 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10743 {
10744 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10745 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10746 }
10747 #endif
10748 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10749 }
10750 else
10751 {
10752 #ifdef DEVELOPER
10753 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10754 {
10755 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10756 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10757 }
10758 #endif
10759 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10760 }
10761 }
10762
10765 {
10766 int item_count = 0;
10768
10769 GameInventory inventory = GetInventory();
10770 CargoBase cargo = inventory.
GetCargo();
10771 if (cargo != NULL)
10772 {
10774 }
10775
10777 for (int i = 0; i < nAttachments; ++i)
10778 {
10780 if (item)
10781 item_count += item.GetNumberOfItems();
10782 }
10783 return item_count;
10784 }
10785
10788 {
10789 float weight = 0;
10790 float wetness = 1;
10791 if (include_wetness)
10794 {
10795 weight = wetness * m_ConfigWeight;
10796 }
10798 {
10799 weight = 1;
10800 }
10801 return weight;
10802 }
10803
10804
10805
10807 {
10808 GameInventory inventory = GetInventory();
10809 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10810 {
10811 array<EntityAI> items = new array<EntityAI>;
10813 for (int i = 0; i < items.Count(); ++i)
10814 {
10816 if (item)
10817 {
10818 g_Game.ObjectDelete(item);
10819 }
10820 }
10821 }
10822 }
10823
10824
10825
10826
10828 {
10829 float energy = 0;
10830 if (HasEnergyManager())
10831 {
10832 energy = GetCompEM().GetEnergy();
10833 }
10834 return energy;
10835 }
10836
10837
10839 {
10840 super.OnEnergyConsumed();
10841
10843 }
10844
10846 {
10847 super.OnEnergyAdded();
10848
10850 }
10851
10852
10854 {
10855 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10856 {
10858 {
10859 float energy_0to1 = GetCompEM().GetEnergy0To1();
10861 }
10862 }
10863 }
10864
10865
10867 {
10868 return ConfigGetFloat("heatIsolation");
10869 }
10870
10872 {
10874 }
10875
10877 {
10878 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10879 if (
g_Game.ConfigIsExisting(paramPath))
10880 return g_Game.ConfigGetFloat(paramPath);
10881
10882 return 0.0;
10883 }
10884
10886 {
10887 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10888 if (
g_Game.ConfigIsExisting(paramPath))
10889 return g_Game.ConfigGetFloat(paramPath);
10890
10891 return 0.0;
10892 }
10893
10894 override void SetWet(
float value,
bool allow_client =
false)
10895 {
10896 if (!IsServerCheck(allow_client))
10897 return;
10898
10901
10903
10904 m_VarWet = Math.Clamp(value, min, max);
10905
10907 {
10910 }
10911 }
10912
10913 override void AddWet(
float value)
10914 {
10916 }
10917
10919 {
10921 }
10922
10924 {
10926 }
10927
10929 {
10931 }
10932
10934 {
10936 }
10937
10939 {
10941 }
10942
10943 override void OnWetChanged(
float newVal,
float oldVal)
10944 {
10947 if (newLevel != oldLevel)
10948 {
10950 }
10951 }
10952
10954 {
10955 SetWeightDirty();
10956 }
10957
10959 {
10960 return GetWetLevelInternal(
m_VarWet);
10961 }
10962
10963
10964
10966 {
10968 }
10969
10971 {
10973 }
10974
10976 {
10978 }
10979
10981 {
10983 }
10984
10985
10986
10988 {
10989 if (ConfigIsExisting("itemModelLength"))
10990 {
10991 return ConfigGetFloat("itemModelLength");
10992 }
10993 return 0;
10994 }
10995
10997 {
10998 if (ConfigIsExisting("itemAttachOffset"))
10999 {
11000 return ConfigGetFloat("itemAttachOffset");
11001 }
11002 return 0;
11003 }
11004
11005 override void SetCleanness(
int value,
bool allow_client =
false)
11006 {
11007 if (!IsServerCheck(allow_client))
11008 return;
11009
11011
11013
11016 }
11017
11019 {
11021 }
11022
11024 {
11025 return true;
11026 }
11027
11028
11029
11030
11032 {
11034 }
11035
11037 {
11039 }
11040
11041
11042
11043
11044 override void SetColor(
int r,
int g,
int b,
int a)
11045 {
11051 }
11053 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11054 {
11059 }
11060
11062 {
11064 }
11065
11068 {
11069 int r,g,b,a;
11071 r = r/255;
11072 g = g/255;
11073 b = b/255;
11074 a = a/255;
11075 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11076 }
11077
11078
11079
11080 override void SetLiquidType(
int value,
bool allow_client =
false)
11081 {
11082 if (!IsServerCheck(allow_client))
11083 return;
11084
11089 }
11090
11092 {
11093 return ConfigGetInt("varLiquidTypeInit");
11094 }
11095
11097 {
11099 }
11100
11102 {
11104 SetFrozen(false);
11105 }
11106
11109 {
11110 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11111 }
11112
11113
11116 {
11117 PlayerBase nplayer;
11118 if (PlayerBase.CastTo(nplayer, player))
11119 {
11121 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11122 }
11123 }
11124
11125
11128 {
11129 PlayerBase nplayer;
11130 if (PlayerBase.CastTo(nplayer,player))
11131 {
11132 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11133 }
11134
11135 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11136
11137 if (HasEnergyManager())
11138 {
11139 GetCompEM().UpdatePlugState();
11140 }
11141 }
11142
11143
11145 {
11146 super.OnPlacementStarted(player);
11147
11149 }
11150
11151 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11152 {
11154 {
11155 m_AdminLog.OnPlacementComplete(player,
this);
11156 }
11157
11158 super.OnPlacementComplete(player, position, orientation);
11159 }
11160
11161
11162
11163
11164
11166 {
11168 {
11169 return true;
11170 }
11171 else
11172 {
11173 return false;
11174 }
11175 }
11176
11177
11179 {
11181 {
11183 }
11184 }
11185
11186
11188 {
11190 }
11191
11193 {
11195 }
11196
11197 override void InsertAgent(
int agent,
float count = 1)
11198 {
11199 if (count < 1)
11200 return;
11201
11203 }
11204
11207 {
11209 }
11210
11211
11213 {
11215 }
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11259 {
11261 return false;
11262 return true;
11263 }
11264
11266 {
11267
11269 }
11270
11271
11274 {
11275 super.CheckForRoofLimited(timeTresholdMS);
11276
11277 float time =
g_Game.GetTime();
11278 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11279 {
11280 m_PreviousRoofTestTime = time;
11281 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11282 }
11283 }
11284
11285
11287 {
11289 {
11290 return 0;
11291 }
11292
11293 if (GetInventory().GetAttachmentSlotsCount() != 0)
11294 {
11295 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11296 if (filter)
11297 return filter.GetProtectionLevel(type, false, system);
11298 else
11299 return 0;
11300 }
11301
11302 string subclassPath, entryName;
11303
11304 switch (type)
11305 {
11307 entryName = "biological";
11308 break;
11310 entryName = "chemical";
11311 break;
11312 default:
11313 entryName = "biological";
11314 break;
11315 }
11316
11317 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11318
11319 return g_Game.ConfigGetFloat(subclassPath + entryName);
11320 }
11321
11322
11323
11326 {
11327 if (!IsMagazine())
11329
11331 }
11332
11333
11334
11335
11336
11341 {
11342 return true;
11343 }
11344
11346 {
11348 }
11349
11350
11351
11352
11353
11355 {
11356 if (parent)
11357 {
11358 if (parent.IsInherited(DayZInfected))
11359 return true;
11360
11361 if (!parent.IsRuined())
11362 return true;
11363 }
11364
11365 return true;
11366 }
11367
11369 {
11370 if (!super.CanPutAsAttachment(parent))
11371 {
11372 return false;
11373 }
11374
11375 if (!IsRuined() && !parent.IsRuined())
11376 {
11377 return true;
11378 }
11379
11380 return false;
11381 }
11382
11384 {
11385
11386
11387
11388
11389 return super.CanReceiveItemIntoCargo(item);
11390 }
11391
11393 {
11394
11395
11396
11397
11398 GameInventory attachmentInv = attachment.GetInventory();
11400 {
11401 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11402 return false;
11403 }
11404
11405 InventoryLocation loc = new InventoryLocation();
11406 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11407 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11408 return false;
11409
11410 return super.CanReceiveAttachment(attachment, slotId);
11411 }
11412
11414 {
11415 if (!super.CanReleaseAttachment(attachment))
11416 return false;
11417
11418 return GetInventory().AreChildrenAccessible();
11419 }
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11442 {
11443 int id = muzzle_owner.GetMuzzleID();
11444 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11445
11446 if (WPOF_array)
11447 {
11448 for (int i = 0; i < WPOF_array.Count(); i++)
11449 {
11450 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11451
11452 if (WPOF)
11453 {
11454 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11455 }
11456 }
11457 }
11458 }
11459
11460
11462 {
11463 int id = muzzle_owner.GetMuzzleID();
11465
11466 if (WPOBE_array)
11467 {
11468 for (int i = 0; i < WPOBE_array.Count(); i++)
11469 {
11470 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11471
11472 if (WPOBE)
11473 {
11474 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11475 }
11476 }
11477 }
11478 }
11479
11480
11482 {
11483 int id = muzzle_owner.GetMuzzleID();
11484 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11485
11486 if (WPOOH_array)
11487 {
11488 for (int i = 0; i < WPOOH_array.Count(); i++)
11489 {
11490 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11491
11492 if (WPOOH)
11493 {
11494 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11495 }
11496 }
11497 }
11498 }
11499
11500
11502 {
11503 int id = muzzle_owner.GetMuzzleID();
11504 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11505
11506 if (WPOOH_array)
11507 {
11508 for (int i = 0; i < WPOOH_array.Count(); i++)
11509 {
11510 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11511
11512 if (WPOOH)
11513 {
11514 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11515 }
11516 }
11517 }
11518 }
11519
11520
11522 {
11523 int id = muzzle_owner.GetMuzzleID();
11524 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11525
11526 if (WPOOH_array)
11527 {
11528 for (int i = 0; i < WPOOH_array.Count(); i++)
11529 {
11530 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11531
11532 if (WPOOH)
11533 {
11534 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11535 }
11536 }
11537 }
11538 }
11539
11540
11541
11543 {
11545 {
11546 return true;
11547 }
11548
11549 return false;
11550 }
11551
11553 {
11555 {
11556 return true;
11557 }
11558
11559 return false;
11560 }
11561
11563 {
11565 {
11566 return true;
11567 }
11568
11569 return false;
11570 }
11571
11573 {
11574 return false;
11575 }
11576
11579 {
11580 return UATimeSpent.DEFAULT_DEPLOY;
11581 }
11582
11583
11584
11585
11587 {
11589 SetSynchDirty();
11590 }
11591
11593 {
11595 }
11596
11597
11599 {
11600 return false;
11601 }
11602
11605 {
11606 string att_type = "None";
11607
11608 if (ConfigIsExisting("soundAttType"))
11609 {
11610 att_type = ConfigGetString("soundAttType");
11611 }
11612
11614 }
11615
11617 {
11619 }
11620
11621
11622
11623
11624
11630
11632 {
11635
11637 }
11638
11639
11641 {
11643 return;
11644
11646
11649
11652
11653 SoundParameters params = new SoundParameters();
11657 }
11658
11659
11661 {
11663 {
11666
11667 SetSynchDirty();
11668
11671 }
11672 }
11673
11675 {
11677 }
11678
11679
11681 {
11683 return;
11684
11686 SetSynchDirty();
11687
11690 }
11691
11693 {
11696 }
11697
11699 {
11701 }
11702
11703 void OnApply(PlayerBase player);
11704
11706 {
11707 return 1.0;
11708 };
11709
11711 {
11713 }
11714
11716 {
11718 }
11719
11721
11723 {
11724 SetDynamicPhysicsLifeTime(0.01);
11726 }
11727
11729 {
11730 array<string> zone_names = new array<string>;
11731 GetDamageZones(zone_names);
11732 for (int i = 0; i < zone_names.Count(); i++)
11733 {
11734 SetHealthMax(zone_names.Get(i),"Health");
11735 }
11736 SetHealthMax("","Health");
11737 }
11738
11741 {
11742 float global_health = GetHealth01("","Health");
11743 array<string> zones = new array<string>;
11744 GetDamageZones(zones);
11745
11746 for (int i = 0; i < zones.Count(); i++)
11747 {
11748 SetHealth01(zones.Get(i),"Health",global_health);
11749 }
11750 }
11751
11754 {
11755 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11756 }
11757
11759 {
11760 if (!hasRootAsPlayer)
11761 {
11762 if (refParentIB)
11763 {
11764
11765 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11766 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11767
11768 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11769 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11770
11773 }
11774 else
11775 {
11776
11779 }
11780 }
11781 }
11782
11784 {
11786 {
11787 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11788 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11789 {
11790 float heatPermCoef = 1.0;
11792 while (ent)
11793 {
11794 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11795 ent = ent.GetHierarchyParent();
11796 }
11797
11798 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11799 }
11800 }
11801 }
11802
11804 {
11805
11806 EntityAI parent = GetHierarchyParent();
11807 if (!parent)
11808 {
11809 hasParent = false;
11810 hasRootAsPlayer = false;
11811 }
11812 else
11813 {
11814 hasParent = true;
11815 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11816 refParentIB =
ItemBase.Cast(parent);
11817 }
11818 }
11819
11820 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11821 {
11822
11823 }
11824
11826 {
11827
11828 return false;
11829 }
11830
11832 {
11833
11834
11835 return false;
11836 }
11837
11839 {
11840
11841 return false;
11842 }
11843
11846 {
11847 return !GetIsFrozen() &&
IsOpen();
11848 }
11849
11851 {
11852 bool hasParent = false, hasRootAsPlayer = false;
11854
11855 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11856 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11857
11858 if (wwtu || foodDecay)
11859 {
11863
11864 if (processWetness || processTemperature || processDecay)
11865 {
11867
11868 if (processWetness)
11869 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11870
11871 if (processTemperature)
11873
11874 if (processDecay)
11875 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11876 }
11877 }
11878 }
11879
11882 {
11884 }
11885
11887 {
11890
11891 return super.GetTemperatureFreezeThreshold();
11892 }
11893
11895 {
11898
11899 return super.GetTemperatureThawThreshold();
11900 }
11901
11903 {
11906
11907 return super.GetItemOverheatThreshold();
11908 }
11909
11911 {
11913 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11914
11915 return super.GetTemperatureFreezeTime();
11916 }
11917
11919 {
11921 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11922
11923 return super.GetTemperatureThawTime();
11924 }
11925
11930
11932 {
11933 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11934 }
11935
11937 {
11938 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11939 }
11940
11943 {
11945 }
11946
11948 {
11950 }
11951
11953 {
11955 }
11956
11959 {
11960 return null;
11961 }
11962
11965 {
11966 return false;
11967 }
11968
11970 {
11972 {
11975 if (!trg)
11976 {
11978 explosive = this;
11979 }
11980
11981 explosive.PairRemote(trg);
11983
11984 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11985 trg.SetPersistentPairID(persistentID);
11986 explosive.SetPersistentPairID(persistentID);
11987
11988 return true;
11989 }
11990 return false;
11991 }
11992
11995 {
11996 float ret = 1.0;
11999 ret *= GetHealth01();
12000
12001 return ret;
12002 }
12003
12004 #ifdef DEVELOPER
12005 override void SetDebugItem()
12006 {
12007 super.SetDebugItem();
12008 _itemBase = this;
12009 }
12010
12012 {
12013 string text = super.GetDebugText();
12014
12016 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12017
12018 return text;
12019 }
12020 #endif
12021
12023 {
12024 return true;
12025 }
12026
12028
12030
12032 {
12035 }
12036
12037
12045
12061
12062 [
Obsolete(
"Use ItemSoundHandler instead")]
12065 {
12066 if (!
g_Game.IsDedicatedServer())
12067 {
12068 if (ConfigIsExisting("attachSoundSet"))
12069 {
12070 string cfg_path = "";
12071 string soundset = "";
12072 string type_name =
GetType();
12073
12076 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12077 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12078
12079 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12080 {
12081 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12082 {
12083 if (cfg_slot_array[i] == slot_type)
12084 {
12085 soundset = cfg_soundset_array[i];
12086 break;
12087 }
12088 }
12089 }
12090
12091 if (soundset != "")
12092 {
12093 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12095 }
12096 }
12097 }
12098 }
12099
12101}
12102
12104{
12106 if (entity)
12107 {
12108 bool is_item = entity.IsInherited(
ItemBase);
12109 if (is_item && full_quantity)
12110 {
12113 }
12114 }
12115 else
12116 {
12118 return NULL;
12119 }
12120 return entity;
12121}
12122
12124{
12125 if (item)
12126 {
12127 if (health > 0)
12128 item.SetHealth("", "", health);
12129
12130 if (item.CanHaveTemperature())
12131 {
12133 if (item.CanFreeze())
12134 item.SetFrozen(false);
12135 }
12136
12137 if (item.HasEnergyManager())
12138 {
12139 if (quantity >= 0)
12140 {
12141 item.GetCompEM().SetEnergy0To1(quantity);
12142 }
12143 else
12144 {
12146 }
12147 }
12148 else if (item.IsMagazine())
12149 {
12150 Magazine mag = Magazine.Cast(item);
12151 if (quantity >= 0)
12152 {
12153 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12154 }
12155 else
12156 {
12158 }
12159
12160 }
12161 else
12162 {
12163 if (quantity >= 0)
12164 {
12165 item.SetQuantityNormalized(quantity, false);
12166 }
12167 else
12168 {
12170 }
12171
12172 }
12173 }
12174}
12175
12176#ifdef DEVELOPER
12178#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.