7203{
7205 {
7206 return true;
7207 }
7208};
7209
7211{
7212
7213};
7214
7215
7216
7218{
7222
7224
7227
7228
7229
7230
7231
7240
7246
7251
7256
7277 protected bool m_IsResultOfSplit
7278
7280
7285
7286
7287
7289
7293
7294
7295
7297
7300
7301
7302
7308
7309
7317
7320
7321
7323
7324
7326
7327
7332
7333
7338
7340
7341
7343
7344
7346 {
7351
7352 if (!
g_Game.IsDedicatedServer())
7353 {
7355 {
7357
7359 {
7361 }
7362 }
7363
7366 }
7367
7368 m_OldLocation = null;
7369
7371 {
7373 }
7374
7375 if (ConfigIsExisting("headSelectionsToHide"))
7376 {
7379 }
7380
7382 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7383 {
7385 }
7386
7388
7389 m_IsResultOfSplit = false;
7390
7392 }
7393
7395 {
7396 super.InitItemVariables();
7397
7403 m_Count = ConfigGetInt(
"count");
7404
7407
7412
7415
7420
7432
7436
7437
7440 if (ConfigIsExisting("canBeSplit"))
7441 {
7444 }
7445
7447 if (ConfigIsExisting("itemBehaviour"))
7449
7450
7453 RegisterNetSyncVariableInt("m_VarLiquidType");
7454 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7455
7456 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7457 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7458 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7459
7460 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7461 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7462 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7463 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7464
7465 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7466 RegisterNetSyncVariableBool("m_IsTakeable");
7467 RegisterNetSyncVariableBool("m_IsHologram");
7468
7471 {
7474 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7475 }
7476
7478
7480 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7482
7484 }
7485
7487 {
7489 }
7490
7492 {
7495 {
7500 }
7501 }
7502
7503 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7504 {
7506 {
7509 }
7510
7512 }
7513
7515 {
7521 }
7522
7524
7526 {
7528
7529 if (!action)
7530 {
7531 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7532 return;
7533 }
7534
7536 if (!ai)
7537 {
7539 return;
7540 }
7541
7543 if (!action_array)
7544 {
7545 action_array = new array<ActionBase_Basic>;
7547 }
7548 if (LogManager.IsActionLogEnable())
7549 {
7550 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7551 }
7552
7553 if (action_array.Find(action) != -1)
7554 {
7555 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7556 }
7557 else
7558 {
7559 action_array.Insert(action);
7560 }
7561 }
7562
7564 {
7565 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7566 ActionBase action = player.GetActionManager().GetAction(actionName);
7569
7570 if (action_array)
7571 {
7572 action_array.RemoveItem(action);
7573 }
7574 }
7575
7576
7577
7579 {
7580 ActionOverrideData overrideData = new ActionOverrideData();
7584
7586 if (!actionMap)
7587 {
7590 }
7591
7592 actionMap.Insert(this.
Type(), overrideData);
7593
7594 }
7595
7597
7599
7600
7602 {
7605
7608
7609 string config_to_search = "CfgVehicles";
7610 string muzzle_owner_config;
7611
7613 {
7614 if (IsInherited(Weapon))
7615 config_to_search = "CfgWeapons";
7616
7617 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7618
7619 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7620
7621 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7622
7623 if (config_OnFire_subclass_count > 0)
7624 {
7625 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7626
7627 for (int i = 0; i < config_OnFire_subclass_count; i++)
7628 {
7629 string particle_class = "";
7630 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7631 string config_OnFire_entry = config_OnFire_class + particle_class;
7632 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7633 WPOF_array.Insert(WPOF);
7634 }
7635
7636
7638 }
7639 }
7640
7642 {
7643 config_to_search = "CfgWeapons";
7644 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7645
7646 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7647
7648 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7649
7650 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7651 {
7652 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7653
7654 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7655 {
7656 string particle_class2 = "";
7657 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7658 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7659 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7660 WPOBE_array.Insert(WPOBE);
7661 }
7662
7663
7665 }
7666 }
7667 }
7668
7669
7671 {
7674
7676 {
7677 string config_to_search = "CfgVehicles";
7678
7679 if (IsInherited(Weapon))
7680 config_to_search = "CfgWeapons";
7681
7682 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7683 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7684
7685 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7686 {
7687
7689
7691 {
7693 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7695 return;
7696 }
7697
7700
7701
7702
7703 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7704 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7705
7706 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7707 {
7708 string particle_class = "";
7709 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7710 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7711 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7712
7713 if (entry_type == CT_CLASS)
7714 {
7715 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7716 WPOOH_array.Insert(WPOF);
7717 }
7718 }
7719
7720
7722 }
7723 }
7724 }
7725
7727 {
7729 }
7730
7732 {
7734 {
7736
7739
7742
7743 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7744 }
7745 }
7746
7748 {
7750 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7751
7753 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7754
7756 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7757
7759 {
7761 }
7762 }
7763
7765 {
7767 }
7768
7770 {
7773 else
7775
7777 {
7780 }
7781 else
7782 {
7785
7788 }
7789
7791 }
7792
7794 {
7796 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7797 }
7798
7800 {
7802 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7804 }
7805
7807 {
7809 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7810 }
7811
7813 {
7816
7817 OverheatingParticle OP = new OverheatingParticle();
7822
7824 }
7825
7827 {
7830
7831 return -1;
7832 }
7833
7835 {
7837 {
7840
7841 for (int i = count; i > 0; --i)
7842 {
7843 int id = i - 1;
7846
7849
7850 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7851 {
7852 if (p)
7853 {
7856 }
7857 }
7858 }
7859 }
7860 }
7861
7863 {
7865 {
7867 {
7868 int id = i - 1;
7870
7871 if (OP)
7872 {
7874
7875 if (p)
7876 {
7878 }
7879
7880 delete OP;
7881 }
7882 }
7883
7886 }
7887 }
7888
7891 {
7892 return 0.0;
7893 }
7894
7895
7897 {
7898 return 250;
7899 }
7900
7902 {
7903 return 0;
7904 }
7905
7908 {
7910 return true;
7911
7912 return false;
7913 }
7914
7917 {
7920
7922 {
7924 }
7925 else
7926 {
7927
7929 }
7930
7932 }
7933
7940 {
7941 return -1;
7942 }
7943
7944
7945
7946
7948 {
7950 {
7951 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7952 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7953
7954 if (r_index >= 0)
7955 {
7956 InventoryLocation r_il = new InventoryLocation;
7957 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7958
7959 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7962 {
7963 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7964 }
7966 {
7967 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7968 }
7969
7970 }
7971
7972 player.GetHumanInventory().ClearUserReservedLocation(this);
7973 }
7974
7977 }
7978
7979
7980
7981
7983 {
7984 return ItemBase.m_DebugActionsMask;
7985 }
7986
7988 {
7989 return ItemBase.m_DebugActionsMask & mask;
7990 }
7991
7993 {
7994 ItemBase.m_DebugActionsMask = mask;
7995 }
7996
7998 {
7999 ItemBase.m_DebugActionsMask |= mask;
8000 }
8001
8003 {
8004 ItemBase.m_DebugActionsMask &= ~mask;
8005 }
8006
8008 {
8010 {
8012 }
8013 else
8014 {
8016 }
8017 }
8018
8019
8021 {
8022 if (GetEconomyProfile())
8023 {
8024 float q_max = GetEconomyProfile().GetQuantityMax();
8025 if (q_max > 0)
8026 {
8027 float q_min = GetEconomyProfile().GetQuantityMin();
8028 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8029
8031 {
8032 ComponentEnergyManager comp = GetCompEM();
8034 {
8036 }
8037 }
8039 {
8041
8042 }
8043
8044 }
8045 }
8046 }
8047
8050 {
8051 EntityAI parent = GetHierarchyParent();
8052
8053 if (parent)
8054 {
8055 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8056 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8057 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8058 }
8059 }
8060
8063 {
8064 EntityAI parent = GetHierarchyParent();
8065
8066 if (parent)
8067 {
8068 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8069 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8070 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8071 }
8072 }
8073
8075 {
8076
8077
8078
8079
8081
8083 {
8084 if (ScriptInputUserData.CanStoreInputUserData())
8085 {
8086 ScriptInputUserData ctx = new ScriptInputUserData;
8092 ctx.
Write(use_stack_max);
8095
8097 {
8098 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8099 }
8100 }
8101 }
8102 else if (!
g_Game.IsMultiplayer())
8103 {
8105 }
8106 }
8107
8109 {
8111 }
8112
8114 {
8116 }
8117
8119 {
8121 }
8122
8124 {
8125
8126 return false;
8127 }
8128
8130 {
8131 return false;
8132 }
8133
8137 {
8138 return false;
8139 }
8140
8142 {
8143 return "";
8144 }
8145
8147
8149 {
8150 return false;
8151 }
8152
8154 {
8155 return true;
8156 }
8157
8158
8159
8161 {
8162 return true;
8163 }
8164
8166 {
8167 return true;
8168 }
8169
8171 {
8172 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8174 }
8175
8177 {
8179 }
8180
8182 {
8184 if (!is_being_placed)
8186 SetSynchDirty();
8187 }
8188
8189
8191
8193 {
8195 }
8196
8198 {
8200 }
8201
8203 {
8204 return 1;
8205 }
8206
8208 {
8209 return false;
8210 }
8211
8213 {
8215 SetSynchDirty();
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
8247
8248
8249
8250
8251
8253 {
8254 super.OnMovedInsideCargo(container);
8255
8256 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8257 }
8258
8259 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8260 {
8261 super.EEItemLocationChanged(oldLoc, newLoc);
8262
8263 PlayerBase newPlayer = null;
8264 PlayerBase oldPlayer = null;
8265
8266 if (newLoc.GetParent())
8267 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8268
8269 if (oldLoc.GetParent())
8270 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8271
8273 {
8274 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8275
8276 if (rIndex >= 0)
8277 {
8278 InventoryLocation rIl = new InventoryLocation;
8279 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8280
8281 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8284 {
8285 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8286 }
8288 {
8290 }
8291
8292 }
8293 }
8294
8296 {
8297 if (newPlayer)
8298 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8299
8300 if (newPlayer == oldPlayer)
8301 {
8302 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8303 {
8305 {
8306 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8307 {
8308 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8309 }
8310 }
8311 else
8312 {
8313 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8314 }
8315 }
8316
8317 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8318 {
8319 int type = oldLoc.GetType();
8321 {
8322 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8323 }
8325 {
8326 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8327 }
8328 }
8329 if (!m_OldLocation)
8330 {
8331 m_OldLocation = new InventoryLocation;
8332 }
8333 m_OldLocation.Copy(oldLoc);
8334 }
8335 else
8336 {
8337 if (m_OldLocation)
8338 {
8339 m_OldLocation.Reset();
8340 }
8341 }
8342
8343 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8344 }
8345 else
8346 {
8347 if (newPlayer)
8348 {
8349 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8350 if (resIndex >= 0)
8351 {
8352 InventoryLocation il = new InventoryLocation;
8353 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8355 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8358 {
8359 il.
GetParent().GetOnReleaseLock().Invoke(it);
8360 }
8362 {
8364 }
8365
8366 }
8367 }
8369 {
8370
8372 }
8373
8374 if (m_OldLocation)
8375 {
8376 m_OldLocation.Reset();
8377 }
8378 }
8379
8381 {
8382 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8383 }
8384
8386 {
8387 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8388 }
8389 }
8390
8391 override void EOnContact(IEntity other, Contact extra)
8392 {
8394 {
8395 int liquidType = -1;
8397 if (impactSpeed > 0.0)
8398 {
8400 #ifndef SERVER
8402 #else
8404 SetSynchDirty();
8405 #endif
8407 }
8408 }
8409
8410 #ifdef SERVER
8411 if (GetCompEM() && GetCompEM().IsPlugged())
8412 {
8413 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8414 GetCompEM().UnplugThis();
8415 }
8416 #endif
8417 }
8418
8420
8422 {
8424 }
8425
8427 {
8428
8429 }
8430
8432 {
8433 super.OnItemLocationChanged(old_owner, new_owner);
8434
8435 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8436 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8437
8438 if (!relatedPlayer && playerNew)
8439 relatedPlayer = playerNew;
8440
8441 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8442 {
8444 if (actionMgr)
8445 {
8446 ActionBase currentAction = actionMgr.GetRunningAction();
8447 if (currentAction)
8449 }
8450 }
8451
8452 Man ownerPlayerOld = null;
8453 Man ownerPlayerNew = null;
8454
8455 if (old_owner)
8456 {
8457 if (old_owner.
IsMan())
8458 {
8459 ownerPlayerOld = Man.Cast(old_owner);
8460 }
8461 else
8462 {
8463 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8464 }
8465 }
8466 else
8467 {
8469 {
8471
8472 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8473 {
8474 GetCompEM().UnplugThis();
8475 }
8476 }
8477 }
8478
8479 if (new_owner)
8480 {
8481 if (new_owner.
IsMan())
8482 {
8483 ownerPlayerNew = Man.Cast(new_owner);
8484 }
8485 else
8486 {
8487 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8488 }
8489 }
8490
8491 if (ownerPlayerOld != ownerPlayerNew)
8492 {
8493 if (ownerPlayerOld)
8494 {
8495 array<EntityAI> subItemsExit = new array<EntityAI>;
8497 for (int i = 0; i < subItemsExit.Count(); i++)
8498 {
8501 }
8502 }
8503
8504 if (ownerPlayerNew)
8505 {
8506 array<EntityAI> subItemsEnter = new array<EntityAI>;
8508 for (int j = 0; j < subItemsEnter.Count(); j++)
8509 {
8512 }
8513 }
8514 }
8515 else if (ownerPlayerNew != null)
8516 {
8517 PlayerBase nplayer;
8518 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8519 {
8520 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8522 for (int k = 0; k < subItemsUpdate.Count(); k++)
8523 {
8525 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8526 }
8527 }
8528 }
8529
8530 if (old_owner)
8531 old_owner.OnChildItemRemoved(this);
8532 if (new_owner)
8533 new_owner.OnChildItemReceived(this);
8534 }
8535
8536
8538 {
8539 super.EEDelete(parent);
8540 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8541 if (player)
8542 {
8544
8545 if (player.IsAlive())
8546 {
8547 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8548 if (r_index >= 0)
8549 {
8550 InventoryLocation r_il = new InventoryLocation;
8551 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8552
8553 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8556 {
8557 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8558 }
8560 {
8561 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8562 }
8563
8564 }
8565
8566 player.RemoveQuickBarEntityShortcut(this);
8567 }
8568 }
8569 }
8570
8572 {
8573 super.EEKilled(killer);
8574
8577 {
8578 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8579 {
8580 if (IsMagazine())
8581 {
8582 if (Magazine.Cast(this).GetAmmoCount() > 0)
8583 {
8585 }
8586 }
8587 else
8588 {
8590 }
8591 }
8592 }
8593 }
8594
8596 {
8597 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8598
8599 super.OnWasAttached(parent, slot_id);
8600
8603
8606 }
8607
8609 {
8610 super.OnWasDetached(parent, slot_id);
8611
8614
8617 }
8618
8620 {
8621 int idx;
8624
8625 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8626 if (inventory_slots.Count() < 1)
8627 {
8628 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8629 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8630 }
8631 else
8632 {
8633 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8634 }
8635
8636 idx = inventory_slots.Find(slot);
8637 if (idx < 0)
8638 return "";
8639
8640 return attach_types.Get(idx);
8641 }
8642
8644 {
8645 int idx = -1;
8646 string slot;
8647
8650
8651 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8652 if (inventory_slots.Count() < 1)
8653 {
8654 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8655 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8656 }
8657 else
8658 {
8659 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8660 if (detach_types.Count() < 1)
8661 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8662 }
8663
8664 for (int i = 0; i < inventory_slots.Count(); i++)
8665 {
8666 slot = inventory_slots.Get(i);
8667 }
8668
8669 if (slot != "")
8670 {
8671 if (detach_types.Count() == 1)
8672 idx = 0;
8673 else
8674 idx = inventory_slots.Find(slot);
8675 }
8676 if (idx < 0)
8677 return "";
8678
8679 return detach_types.Get(idx);
8680 }
8681
8683 {
8684
8686
8687
8688 float min_time = 1;
8689 float max_time = 3;
8690 float delay = Math.RandomFloat(min_time, max_time);
8691
8692 explode_timer.Run(delay, this, "DoAmmoExplosion");
8693 }
8694
8696 {
8697 Magazine magazine = Magazine.Cast(this);
8698 int pop_sounds_count = 6;
8699 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8700
8701
8702 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8703 string sound_name = pop_sounds[ sound_idx ];
8704 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8705
8706
8707 magazine.ServerAddAmmoCount(-1);
8708
8709
8710 float min_temp_to_explode = 100;
8711
8712 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8713 {
8715 }
8716 }
8717
8718
8719 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8720 {
8721 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8722
8723 const int CHANCE_DAMAGE_CARGO = 4;
8724 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8725 const int CHANCE_DAMAGE_NOTHING = 2;
8726
8728 {
8729 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8730 int chances;
8731 int rnd;
8732
8733 if (GetInventory().GetCargo())
8734 {
8735 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8736 rnd = Math.RandomInt(0,chances);
8737
8738 if (rnd < CHANCE_DAMAGE_CARGO)
8739 {
8741 }
8742 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8743 {
8745 }
8746 }
8747 else
8748 {
8749 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8750 rnd = Math.RandomInt(0,chances);
8751
8752 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8753 {
8755 }
8756 }
8757 }
8758 }
8759
8761 {
8762 CargoBase cargo = GetInventory().GetCargo();
8763 if (cargo)
8764 {
8766 if (item_count > 0)
8767 {
8768 int random_pick = Math.RandomInt(0, item_count);
8770 if (!item.IsExplosive())
8771 {
8772 item.AddHealth("","",damage);
8773 return true;
8774 }
8775 }
8776 }
8777 return false;
8778 }
8779
8781 {
8782 GameInventory inventory = GetInventory();
8784 if (attachment_count > 0)
8785 {
8786 int random_pick = Math.RandomInt(0, attachment_count);
8788 if (!attachment.IsExplosive())
8789 {
8790 attachment.AddHealth("","",damage);
8791 return true;
8792 }
8793 }
8794 return false;
8795 }
8796
8798 {
8800 }
8801
8803 {
8805 return GetInventory().CanRemoveEntity();
8806
8807 return false;
8808 }
8809
8811 {
8812
8814 return false;
8815
8816
8818 return false;
8819
8820
8821
8823 if (delta == 0)
8824 return false;
8825
8826
8827 return true;
8828 }
8829
8831 {
8833 {
8834 if (ScriptInputUserData.CanStoreInputUserData())
8835 {
8836 ScriptInputUserData ctx = new ScriptInputUserData;
8841 ctx.
Write(destination_entity);
8845 }
8846 }
8847 else if (!
g_Game.IsMultiplayer())
8848 {
8850 }
8851 }
8852
8854 {
8855 float split_quantity_new;
8859 InventoryLocation loc = new InventoryLocation;
8860
8861 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8862 {
8864 split_quantity_new = stack_max;
8865 else
8867
8869 {
8870 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8871 if (new_item)
8872 {
8873 new_item.SetResultOfSplit(true);
8874 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8876 new_item.
SetQuantity(split_quantity_new,
false,
true);
8877 }
8878 }
8879 }
8880 else if (destination_entity && slot_id == -1)
8881 {
8882 if (quantity > stack_max)
8883 split_quantity_new = stack_max;
8884 else
8885 split_quantity_new = quantity;
8886
8888 {
8889 GameInventory destinationInventory = destination_entity.GetInventory();
8891 {
8894 }
8895
8896 if (new_item)
8897 {
8898 new_item.SetResultOfSplit(true);
8899 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8901 new_item.
SetQuantity(split_quantity_new,
false,
true);
8902 }
8903 }
8904 }
8905 else
8906 {
8907 if (stack_max != 0)
8908 {
8910 {
8912 }
8913
8914 if (split_quantity_new == 0)
8915 {
8916 if (!
g_Game.IsMultiplayer())
8917 player.PhysicalPredictiveDropItem(this);
8918 else
8919 player.ServerDropEntity(this);
8920 return;
8921 }
8922
8924 {
8926
8927 if (new_item)
8928 {
8929 new_item.SetResultOfSplit(true);
8930 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8933 new_item.PlaceOnSurface();
8934 }
8935 }
8936 }
8937 }
8938 }
8939
8941 {
8942 float split_quantity_new;
8946 InventoryLocation loc = new InventoryLocation;
8947
8948 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8949 {
8951 split_quantity_new = stack_max;
8952 else
8954
8956 {
8957 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8958 if (new_item)
8959 {
8960 new_item.SetResultOfSplit(true);
8961 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8963 new_item.
SetQuantity(split_quantity_new,
false,
true);
8964 }
8965 }
8966 }
8967 else if (destination_entity && slot_id == -1)
8968 {
8969 if (quantity > stack_max)
8970 split_quantity_new = stack_max;
8971 else
8972 split_quantity_new = quantity;
8973
8975 {
8976 GameInventory destinationInventory = destination_entity.GetInventory();
8978 {
8981 }
8982
8983 if (new_item)
8984 {
8985 new_item.SetResultOfSplit(true);
8986 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8988 new_item.
SetQuantity(split_quantity_new,
false,
true);
8989 }
8990 }
8991 }
8992 else
8993 {
8994 if (stack_max != 0)
8995 {
8997 {
8999 }
9000
9002 {
9004
9005 if (new_item)
9006 {
9007 new_item.SetResultOfSplit(true);
9008 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9011 new_item.PlaceOnSurface();
9012 }
9013 }
9014 }
9015 }
9016 }
9017
9019 {
9021 {
9022 if (ScriptInputUserData.CanStoreInputUserData())
9023 {
9024 ScriptInputUserData ctx = new ScriptInputUserData;
9029 dst.WriteToContext(ctx);
9031 }
9032 }
9033 else if (!
g_Game.IsMultiplayer())
9034 {
9036 }
9037 }
9038
9040 {
9042 {
9043 if (ScriptInputUserData.CanStoreInputUserData())
9044 {
9045 ScriptInputUserData ctx = new ScriptInputUserData;
9050 ctx.
Write(destination_entity);
9056 }
9057 }
9058 else if (!
g_Game.IsMultiplayer())
9059 {
9061 }
9062 }
9063
9065 {
9067 }
9068
9070 {
9072 float split_quantity_new;
9074 if (dst.IsValid())
9075 {
9076 int slot_id = dst.GetSlot();
9078
9079 if (quantity > stack_max)
9080 split_quantity_new = stack_max;
9081 else
9082 split_quantity_new = quantity;
9083
9085 {
9087
9088 if (new_item)
9089 {
9090 new_item.SetResultOfSplit(true);
9091 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9093 new_item.
SetQuantity(split_quantity_new,
false,
true);
9094 }
9095
9096 return new_item;
9097 }
9098 }
9099
9100 return null;
9101 }
9102
9104 {
9106 float split_quantity_new;
9108 if (destination_entity)
9109 {
9111 if (quantity > stackable)
9112 split_quantity_new = stackable;
9113 else
9114 split_quantity_new = quantity;
9115
9117 {
9118 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9119 if (new_item)
9120 {
9121 new_item.SetResultOfSplit(true);
9122 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9124 new_item.
SetQuantity(split_quantity_new,
false,
true);
9125 }
9126 }
9127 }
9128 }
9129
9131 {
9133 {
9134 if (ScriptInputUserData.CanStoreInputUserData())
9135 {
9136 ScriptInputUserData ctx = new ScriptInputUserData;
9141 ItemBase destination_entity =
this;
9142 ctx.
Write(destination_entity);
9146 }
9147 }
9148 else if (!
g_Game.IsMultiplayer())
9149 {
9151 }
9152 }
9153
9155 {
9157 float split_quantity_new;
9159 if (player)
9160 {
9162 if (quantity > stackable)
9163 split_quantity_new = stackable;
9164 else
9165 split_quantity_new = quantity;
9166
9168 {
9169 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9170 new_item =
ItemBase.Cast(in_hands);
9171 if (new_item)
9172 {
9173 new_item.SetResultOfSplit(true);
9174 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9176 new_item.SetQuantity(split_quantity_new, false, true);
9177 }
9178 }
9179 }
9180 }
9181
9183 {
9185 float split_quantity_new = Math.Floor(quantity * 0.5);
9186
9188 return;
9189
9191
9192 if (new_item)
9193 {
9194 if (new_item.GetQuantityMax() < split_quantity_new)
9195 {
9196 split_quantity_new = new_item.GetQuantityMax();
9197 }
9198
9199 new_item.SetResultOfSplit(true);
9200 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9201
9203 {
9206 }
9207 else
9208 {
9210 new_item.
SetQuantity(split_quantity_new,
false,
true);
9211 }
9212 }
9213 }
9214
9216 {
9218 float split_quantity_new = Math.Floor(quantity / 2);
9219
9221 return;
9222
9223 InventoryLocation invloc = new InventoryLocation;
9225
9227 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9228
9229 if (new_item)
9230 {
9231 if (new_item.GetQuantityMax() < split_quantity_new)
9232 {
9233 split_quantity_new = new_item.GetQuantityMax();
9234 }
9236 {
9239 }
9240 else if (split_quantity_new > 1)
9241 {
9243 new_item.
SetQuantity(split_quantity_new,
false,
true);
9244 }
9245 }
9246 }
9247
9250 {
9251 SetWeightDirty();
9253
9254 if (parent)
9255 parent.OnAttachmentQuantityChangedEx(this, delta);
9256
9258 {
9260 {
9262 }
9264 {
9265 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9267 }
9268 }
9269 }
9270
9273 {
9274
9275 }
9276
9279 {
9281 }
9282
9284 {
9285 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9286
9288 {
9289 if (newLevel == GameConstants.STATE_RUINED)
9290 {
9292 EntityAI parent = GetHierarchyParent();
9293 if (parent && parent.IsFireplace())
9294 {
9295 CargoBase cargo = GetInventory().GetCargo();
9296 if (cargo)
9297 {
9299 {
9301 }
9302 }
9303 }
9304 }
9305
9307 {
9308
9310 return;
9311 }
9312
9313 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9314 {
9316 }
9317 }
9318 }
9319
9320
9322 {
9323 super.OnRightClick();
9324
9326 {
9328 {
9329 if (ScriptInputUserData.CanStoreInputUserData())
9330 {
9331 EntityAI root = GetHierarchyRoot();
9332 Man playerOwner = GetHierarchyRootPlayer();
9333 InventoryLocation dst = new InventoryLocation;
9334
9335
9336 if (!playerOwner && root && root == this)
9337 {
9339 }
9340 else
9341 {
9342
9343 GetInventory().GetCurrentInventoryLocation(dst);
9345 {
9346 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9348 {
9350 }
9351 else
9352 {
9354
9355
9356 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9357 {
9359 }
9360 else
9361 {
9362 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9363 }
9364 }
9365 }
9366 }
9367
9368 ScriptInputUserData ctx = new ScriptInputUserData;
9376 }
9377 }
9378 else if (!
g_Game.IsMultiplayer())
9379 {
9381 }
9382 }
9383 }
9384
9386 {
9387 if (root)
9388 {
9389 vector m4[4];
9390 root.GetTransform(m4);
9391 dst.SetGround(this, m4);
9392 }
9393 else
9394 {
9395 GetInventory().GetCurrentInventoryLocation(dst);
9396 }
9397 }
9398
9399 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9400 {
9401
9402 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9403 return false;
9404
9405 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9406 return false;
9407
9408
9410 return false;
9411
9412
9413 Magazine mag = Magazine.Cast(this);
9414 if (mag)
9415 {
9416 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9417 return false;
9418
9419 if (stack_max_limit)
9420 {
9421 Magazine other_mag = Magazine.Cast(other_item);
9422 if (other_item)
9423 {
9424 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9425 return false;
9426 }
9427
9428 }
9429 }
9430 else
9431 {
9432
9434 return false;
9435
9437 return false;
9438 }
9439
9440 PlayerBase player = null;
9441 if (CastTo(player, GetHierarchyRootPlayer()))
9442 {
9443 if (player.GetInventory().HasAttachment(this))
9444 return false;
9445
9446 if (player.IsItemsToDelete())
9447 return false;
9448 }
9449
9450 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9451 return false;
9452
9453 int slotID;
9455 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9456 return false;
9457
9458 return true;
9459 }
9460
9462 {
9464 }
9465
9467 {
9468 return m_IsResultOfSplit;
9469 }
9470
9472 {
9473 m_IsResultOfSplit = value;
9474 }
9475
9477 {
9479 }
9480
9482 {
9483 float other_item_quantity = other_item.GetQuantity();
9484 float this_free_space;
9485
9487
9489
9490 if (other_item_quantity > this_free_space)
9491 {
9492 return this_free_space;
9493 }
9494 else
9495 {
9496 return other_item_quantity;
9497 }
9498 }
9499
9501 {
9503 }
9504
9506 {
9508 return;
9509
9510 if (!IsMagazine() && other_item)
9511 {
9513 if (quantity_used != 0)
9514 {
9515 float hp1 = GetHealth01("","");
9516 float hp2 = other_item.GetHealth01("","");
9517 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9518 hpResult = hpResult / (
GetQuantity() + quantity_used);
9519
9520 hpResult *= GetMaxHealth();
9521 Math.Round(hpResult);
9522 SetHealth("", "Health", hpResult);
9523
9525 other_item.AddQuantity(-quantity_used);
9526 }
9527 }
9529 }
9530
9532 {
9533 #ifdef SERVER
9534 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9535 GetHierarchyParent().IncreaseLifetimeUp();
9536 #endif
9537 };
9538
9540 {
9541 PlayerBase p = PlayerBase.Cast(player);
9542
9543 array<int> recipesIds = p.m_Recipes;
9544 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9545 if (moduleRecipesManager)
9546 {
9547 EntityAI itemInHands = player.GetEntityInHands();
9548 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9549 }
9550
9551 for (int i = 0;i < recipesIds.Count(); i++)
9552 {
9553 int key = recipesIds.Get(i);
9554 string recipeName = moduleRecipesManager.GetRecipeName(key);
9556 }
9557 }
9558
9559
9560 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9561 {
9562 super.GetDebugActions(outputList);
9563
9564
9570
9571
9576
9581
9582
9586
9587
9589 {
9593 }
9594
9597
9598
9602
9604
9605 InventoryLocation loc = new InventoryLocation();
9606 GetInventory().GetCurrentInventoryLocation(loc);
9608 {
9609 if (Gizmo_IsSupported())
9612 }
9613
9615 }
9616
9617
9618
9619
9621 {
9622 super.OnAction(action_id, player, ctx);
9623
9625 {
9626 switch (action_id)
9627 {
9631 return true;
9635 return true;
9636 }
9637 }
9638
9640 {
9641 switch (action_id)
9642 {
9644 Delete();
9645 return true;
9646 }
9647 }
9648
9649 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9650 {
9651 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9652 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9653 PlayerBase p = PlayerBase.Cast(player);
9654 if (
EActions.RECIPES_RANGE_START < 1000)
9655 {
9656 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9657 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9658 }
9659 }
9660 #ifndef SERVER
9661 else if (action_id ==
EActions.WATCH_PLAYER)
9662 {
9663 PluginDeveloper.SetDeveloperItemClientEx(player);
9664 }
9665 #endif
9667 {
9668 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9669 {
9670 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9671 OnDebugButtonPressServer(id + 1);
9672 }
9673
9674 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9675 {
9676 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9678 }
9679
9680 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9681 {
9682 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9684 }
9685
9686 else if (action_id ==
EActions.ADD_QUANTITY)
9687 {
9688 if (IsMagazine())
9689 {
9690 Magazine mag = Magazine.Cast(this);
9691 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9692 }
9693 else
9694 {
9696 }
9697
9698 if (m_EM)
9699 {
9700 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9701 }
9702
9703 }
9704
9705 else if (action_id ==
EActions.REMOVE_QUANTITY)
9706 {
9707 if (IsMagazine())
9708 {
9709 Magazine mag2 = Magazine.Cast(this);
9710 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9711 }
9712 else
9713 {
9715 }
9716 if (m_EM)
9717 {
9718 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9719 }
9720
9721 }
9722
9723 else if (action_id ==
EActions.SET_QUANTITY_0)
9724 {
9726
9727 if (m_EM)
9728 {
9729 m_EM.SetEnergy(0);
9730 }
9731 }
9732
9733 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9734 {
9736
9737 if (m_EM)
9738 {
9739 m_EM.SetEnergy(m_EM.GetEnergyMax());
9740 }
9741 }
9742
9743 else if (action_id ==
EActions.ADD_HEALTH)
9744 {
9745 AddHealth("","",GetMaxHealth("","Health")/5);
9746 }
9747 else if (action_id ==
EActions.REMOVE_HEALTH)
9748 {
9749 AddHealth("","",-GetMaxHealth("","Health")/5);
9750 }
9751 else if (action_id ==
EActions.DESTROY_HEALTH)
9752 {
9753 SetHealth01("","",0);
9754 }
9755 else if (action_id ==
EActions.WATCH_ITEM)
9756 {
9758 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9759 #ifdef DEVELOPER
9760 SetDebugDeveloper_item(this);
9761 #endif
9762 }
9763
9764 else if (action_id ==
EActions.ADD_TEMPERATURE)
9765 {
9766 AddTemperature(20);
9767
9768 }
9769
9770 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9771 {
9772 AddTemperature(-20);
9773
9774 }
9775
9776 else if (action_id ==
EActions.FLIP_FROZEN)
9777 {
9778 SetFrozen(!GetIsFrozen());
9779
9780 }
9781
9782 else if (action_id ==
EActions.ADD_WETNESS)
9783 {
9785
9786 }
9787
9788 else if (action_id ==
EActions.REMOVE_WETNESS)
9789 {
9791
9792 }
9793
9794 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9795 {
9798
9799
9800 }
9801
9802 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9803 {
9806 }
9807
9808 else if (action_id ==
EActions.MAKE_SPECIAL)
9809 {
9810 auto debugParams = DebugSpawnParams.WithPlayer(player);
9811 OnDebugSpawnEx(debugParams);
9812 }
9813
9814 }
9815
9816
9817 return false;
9818 }
9819
9820
9821
9822
9826
9829
9830
9831
9833 {
9834 return false;
9835 }
9836
9837
9839 {
9840 return true;
9841 }
9842
9843
9845 {
9846 return true;
9847 }
9848
9849
9850
9852 {
9853 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9854 return g_Game.ConfigIsExisting(config_path);
9855 }
9856
9859 {
9860 return null;
9861 }
9862
9864 {
9865 return false;
9866 }
9867
9869 {
9870 return false;
9871 }
9872
9876
9877
9879 {
9880 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9881 return module_repairing.CanRepair(this, item_repair_kit);
9882 }
9883
9884
9885 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9886 {
9887 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9888 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9889 }
9890
9891
9893 {
9894
9895
9896
9897
9898
9899
9900
9901
9902 return 1;
9903 }
9904
9905
9906
9908 {
9910 }
9911
9912
9913
9915 {
9917 }
9918
9919
9928 {
9929 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9930
9931 if (player)
9932 {
9933 player.MessageStatus(text);
9934 }
9935 }
9936
9937
9946 {
9947 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9948
9949 if (player)
9950 {
9951 player.MessageAction(text);
9952 }
9953 }
9954
9955
9964 {
9965 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9966
9967 if (player)
9968 {
9969 player.MessageFriendly(text);
9970 }
9971 }
9972
9973
9982 {
9983 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9984
9985 if (player)
9986 {
9987 player.MessageImportant(text);
9988 }
9989 }
9990
9992 {
9993 return true;
9994 }
9995
9996
9997 override bool KindOf(
string tag)
9998 {
9999 bool found = false;
10000 string item_name = this.
GetType();
10002 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10003
10004 int array_size = item_tag_array.Count();
10005 for (int i = 0; i < array_size; i++)
10006 {
10007 if (item_tag_array.Get(i) == tag)
10008 {
10009 found = true;
10010 break;
10011 }
10012 }
10013 return found;
10014 }
10015
10016
10018 {
10019
10020 super.OnRPC(sender, rpc_type,ctx);
10021
10022
10023 switch (rpc_type)
10024 {
10025 #ifndef SERVER
10026 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10027 Param2<bool, string> p = new Param2<bool, string>(false, "");
10028
10030 return;
10031
10032 bool play = p.param1;
10033 string soundSet = p.param2;
10034
10035 if (play)
10036 {
10038 {
10040 {
10042 }
10043 }
10044 else
10045 {
10047 }
10048 }
10049 else
10050 {
10052 }
10053
10054 break;
10055 #endif
10056
10057 }
10058
10060 {
10062 }
10063 }
10064
10065
10066
10067
10069 {
10070 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10071 return plugin.GetID(
name);
10072 }
10073
10075 {
10076 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10077 return plugin.GetName(id);
10078 }
10079
10082 {
10083
10084
10085 int varFlags;
10086 if (!ctx.
Read(varFlags))
10087 return;
10088
10089 if (varFlags & ItemVariableFlags.FLOAT)
10090 {
10092 }
10093 }
10094
10096 {
10097
10098 super.SerializeNumericalVars(floats_out);
10099
10100
10101
10103 {
10105 }
10106
10108 {
10110 }
10111
10113 {
10115 }
10116
10118 {
10123 }
10124
10126 {
10128 }
10129 }
10130
10132 {
10133
10134 super.DeSerializeNumericalVars(floats);
10135
10136
10137 int index = 0;
10138 int mask = Math.Round(floats.Get(index));
10139
10140 index++;
10141
10143 {
10145 {
10147 }
10148 else
10149 {
10150 float quantity = floats.Get(index);
10151 SetQuantity(quantity,
true,
false,
false,
false);
10152 }
10153 index++;
10154 }
10155
10157 {
10158 float wet = floats.Get(index);
10160 index++;
10161 }
10162
10164 {
10165 int liquidtype = Math.Round(floats.Get(index));
10167 index++;
10168 }
10169
10171 {
10173 index++;
10175 index++;
10177 index++;
10179 index++;
10180 }
10181
10183 {
10184 int cleanness = Math.Round(floats.Get(index));
10186 index++;
10187 }
10188 }
10189
10191 {
10192 super.WriteVarsToCTX(ctx);
10193
10194
10196 {
10198 }
10199
10201 {
10203 }
10204
10206 {
10208 }
10209
10211 {
10212 int r,g,b,a;
10218 }
10219
10221 {
10223 }
10224 }
10225
10227 {
10228 if (!super.ReadVarsFromCTX(ctx,version))
10229 return false;
10230
10231 int intValue;
10232 float value;
10233
10234 if (version < 140)
10235 {
10236 if (!ctx.
Read(intValue))
10237 return false;
10238
10239 m_VariablesMask = intValue;
10240 }
10241
10243 {
10244 if (!ctx.
Read(value))
10245 return false;
10246
10248 {
10250 }
10251 else
10252 {
10254 }
10255 }
10256
10257 if (version < 140)
10258 {
10260 {
10261 if (!ctx.
Read(value))
10262 return false;
10263 SetTemperatureDirect(value);
10264 }
10265 }
10266
10268 {
10269 if (!ctx.
Read(value))
10270 return false;
10272 }
10273
10275 {
10276 if (!ctx.
Read(intValue))
10277 return false;
10279 }
10280
10282 {
10283 int r,g,b,a;
10285 return false;
10287 return false;
10289 return false;
10291 return false;
10292
10294 }
10295
10297 {
10298 if (!ctx.
Read(intValue))
10299 return false;
10301 }
10302
10303 if (version >= 138 && version < 140)
10304 {
10306 {
10307 if (!ctx.
Read(intValue))
10308 return false;
10309 SetFrozen(intValue);
10310 }
10311 }
10312
10313 return true;
10314 }
10315
10316
10318 {
10321 {
10323 }
10324
10325 if (!super.OnStoreLoad(ctx, version))
10326 {
10328 return false;
10329 }
10330
10331 if (version >= 114)
10332 {
10333 bool hasQuickBarIndexSaved;
10334
10335 if (!ctx.
Read(hasQuickBarIndexSaved))
10336 {
10338 return false;
10339 }
10340
10341 if (hasQuickBarIndexSaved)
10342 {
10343 int itmQBIndex;
10344
10345
10346 if (!ctx.
Read(itmQBIndex))
10347 {
10349 return false;
10350 }
10351
10352 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10353 if (itmQBIndex != -1 && parentPlayer)
10354 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10355 }
10356 }
10357 else
10358 {
10359
10360 PlayerBase player;
10361 int itemQBIndex;
10362 if (version ==
int.
MAX)
10363 {
10364 if (!ctx.
Read(itemQBIndex))
10365 {
10367 return false;
10368 }
10369 }
10370 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10371 {
10372
10373 if (!ctx.
Read(itemQBIndex))
10374 {
10376 return false;
10377 }
10378 if (itemQBIndex != -1 && player)
10379 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10380 }
10381 }
10382
10383 if (version < 140)
10384 {
10385
10386 if (!LoadVariables(ctx, version))
10387 {
10389 return false;
10390 }
10391 }
10392
10393
10395 {
10397 return false;
10398 }
10399 if (version >= 132)
10400 {
10402 if (raib)
10403 {
10405 {
10407 return false;
10408 }
10409 }
10410 }
10411
10413 return true;
10414 }
10415
10416
10417
10419 {
10420 super.OnStoreSave(ctx);
10421
10422 PlayerBase player;
10423 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10424 {
10426
10427 int itemQBIndex = -1;
10428 itemQBIndex = player.FindQuickBarEntityIndex(this);
10429 ctx.
Write(itemQBIndex);
10430 }
10431 else
10432 {
10434 }
10435
10437
10439 if (raib)
10440 {
10442 }
10443 }
10444
10445
10447 {
10448 super.AfterStoreLoad();
10449
10451 {
10453 }
10454
10456 {
10459 }
10460 }
10461
10463 {
10464 super.EEOnAfterLoad();
10465
10467 {
10469 }
10470
10473 }
10474
10476 {
10477 return false;
10478 }
10479
10480
10481
10483 {
10485 {
10486 #ifdef PLATFORM_CONSOLE
10487
10489 {
10491 if (menu)
10492 {
10494 }
10495 }
10496 #endif
10497 }
10498
10500 {
10503 }
10504
10506 {
10507 SetWeightDirty();
10509 }
10511 {
10514 }
10515
10517 {
10520
10523 }
10525 {
10529 }
10530
10531 super.OnVariablesSynchronized();
10532 }
10533
10534
10535
10537 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10538 {
10539 if (!IsServerCheck(allow_client))
10540 return false;
10541
10543 return false;
10544
10547
10548 if (value <= (min + 0.001))
10549 value = min;
10550
10551 if (value == min)
10552 {
10553 if (destroy_config)
10554 {
10555 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10556 if (dstr)
10557 {
10559 this.Delete();
10560 return true;
10561 }
10562 }
10563 else if (destroy_forced)
10564 {
10566 this.Delete();
10567 return true;
10568 }
10569
10571 }
10572
10575
10577 {
10578 EntityAI parent = GetHierarchyRoot();
10579 InventoryLocation iLoc = new InventoryLocation();
10580 GetInventory().GetCurrentInventoryLocation(iLoc);
10582 {
10583 int iLocSlot = iLoc.
GetSlot();
10585 {
10587 }
10589 {
10591 }
10592 }
10593 }
10594
10596 {
10598
10599 if (delta)
10601 }
10602
10604
10605 return false;
10606 }
10607
10608
10610 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10611 {
10613 }
10614
10616 {
10619 }
10620
10622 {
10625 }
10626
10628 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10629 {
10630 float value_clamped = Math.Clamp(value, 0, 1);
10632 SetQuantity(result, destroy_config, destroy_forced);
10633 }
10634
10635
10638 {
10640 }
10641
10643 {
10645 }
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10657 {
10658 int slot = -1;
10659 GameInventory inventory = GetInventory();
10660 if (inventory)
10661 {
10662 InventoryLocation il = new InventoryLocation;
10665 }
10666
10668 }
10669
10671 {
10672 float quantity_max = 0;
10673
10675 {
10676 if (attSlotID != -1)
10677 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10678
10679 if (quantity_max <= 0)
10681 }
10682
10683 if (quantity_max <= 0)
10685
10686 return quantity_max;
10687 }
10688
10690 {
10692 }
10693
10695 {
10697 }
10698
10699
10701 {
10703 }
10704
10706 {
10708 }
10709
10711 {
10713 }
10714
10715
10717 {
10718
10719 float weightEx = GetWeightEx();
10720 float special = GetInventoryAndCargoWeight();
10721 return weightEx - special;
10722 }
10723
10724
10726 {
10728 }
10729
10731 {
10733 {
10734 #ifdef DEVELOPER
10735 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10736 {
10737 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10739 }
10740 #endif
10741
10742 return GetQuantity() * GetConfigWeightModified();
10743 }
10744 else if (HasEnergyManager())
10745 {
10746 #ifdef DEVELOPER
10747 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10748 {
10749 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10750 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10751 }
10752 #endif
10753 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10754 }
10755 else
10756 {
10757 #ifdef DEVELOPER
10758 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10759 {
10760 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10761 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10762 }
10763 #endif
10764 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10765 }
10766 }
10767
10770 {
10771 int item_count = 0;
10773
10774 GameInventory inventory = GetInventory();
10775 CargoBase cargo = inventory.
GetCargo();
10776 if (cargo != NULL)
10777 {
10779 }
10780
10782 for (int i = 0; i < nAttachments; ++i)
10783 {
10785 if (item)
10786 item_count += item.GetNumberOfItems();
10787 }
10788 return item_count;
10789 }
10790
10793 {
10794 float weight = 0;
10795 float wetness = 1;
10796 if (include_wetness)
10799 {
10800 weight = wetness * m_ConfigWeight;
10801 }
10803 {
10804 weight = 1;
10805 }
10806 return weight;
10807 }
10808
10809
10810
10812 {
10813 GameInventory inventory = GetInventory();
10814 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10815 {
10816 array<EntityAI> items = new array<EntityAI>;
10818 for (int i = 0; i < items.Count(); ++i)
10819 {
10821 if (item)
10822 {
10823 g_Game.ObjectDelete(item);
10824 }
10825 }
10826 }
10827 }
10828
10829
10830
10831
10833 {
10834 float energy = 0;
10835 if (HasEnergyManager())
10836 {
10837 energy = GetCompEM().GetEnergy();
10838 }
10839 return energy;
10840 }
10841
10842
10844 {
10845 super.OnEnergyConsumed();
10846
10848 }
10849
10851 {
10852 super.OnEnergyAdded();
10853
10855 }
10856
10857
10859 {
10860 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10861 {
10863 {
10864 float energy_0to1 = GetCompEM().GetEnergy0To1();
10866 }
10867 }
10868 }
10869
10870
10872 {
10873 return ConfigGetFloat("heatIsolation");
10874 }
10875
10877 {
10879 }
10880
10882 {
10883 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10884 if (
g_Game.ConfigIsExisting(paramPath))
10885 return g_Game.ConfigGetFloat(paramPath);
10886
10887 return 0.0;
10888 }
10889
10891 {
10892 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10893 if (
g_Game.ConfigIsExisting(paramPath))
10894 return g_Game.ConfigGetFloat(paramPath);
10895
10896 return 0.0;
10897 }
10898
10899 override void SetWet(
float value,
bool allow_client =
false)
10900 {
10901 if (!IsServerCheck(allow_client))
10902 return;
10903
10906
10908
10909 m_VarWet = Math.Clamp(value, min, max);
10910
10912 {
10915 }
10916 }
10917
10918 override void AddWet(
float value)
10919 {
10921 }
10922
10924 {
10926 }
10927
10929 {
10931 }
10932
10934 {
10936 }
10937
10939 {
10941 }
10942
10944 {
10946 }
10947
10948 override void OnWetChanged(
float newVal,
float oldVal)
10949 {
10952 if (newLevel != oldLevel)
10953 {
10955 }
10956 }
10957
10959 {
10960 SetWeightDirty();
10961 }
10962
10964 {
10965 return GetWetLevelInternal(
m_VarWet);
10966 }
10967
10968
10969
10971 {
10973 }
10974
10976 {
10978 }
10979
10981 {
10983 }
10984
10986 {
10988 }
10989
10990
10991
10993 {
10994 if (ConfigIsExisting("itemModelLength"))
10995 {
10996 return ConfigGetFloat("itemModelLength");
10997 }
10998 return 0;
10999 }
11000
11002 {
11003 if (ConfigIsExisting("itemAttachOffset"))
11004 {
11005 return ConfigGetFloat("itemAttachOffset");
11006 }
11007 return 0;
11008 }
11009
11010 override void SetCleanness(
int value,
bool allow_client =
false)
11011 {
11012 if (!IsServerCheck(allow_client))
11013 return;
11014
11016
11018
11021 }
11022
11024 {
11026 }
11027
11029 {
11030 return true;
11031 }
11032
11033
11034
11035
11037 {
11039 }
11040
11042 {
11044 }
11045
11046
11047
11048
11049 override void SetColor(
int r,
int g,
int b,
int a)
11050 {
11056 }
11058 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11059 {
11064 }
11065
11067 {
11069 }
11070
11073 {
11074 int r,g,b,a;
11076 r = r/255;
11077 g = g/255;
11078 b = b/255;
11079 a = a/255;
11080 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11081 }
11082
11083
11084
11085 override void SetLiquidType(
int value,
bool allow_client =
false)
11086 {
11087 if (!IsServerCheck(allow_client))
11088 return;
11089
11094 }
11095
11097 {
11098 return ConfigGetInt("varLiquidTypeInit");
11099 }
11100
11102 {
11104 }
11105
11107 {
11109 SetFrozen(false);
11110 }
11111
11114 {
11115 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11116 }
11117
11118
11121 {
11122 PlayerBase nplayer;
11123 if (PlayerBase.CastTo(nplayer, player))
11124 {
11126 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11127 }
11128 }
11129
11130
11133 {
11134 PlayerBase nplayer;
11135 if (PlayerBase.CastTo(nplayer,player))
11136 {
11137 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11138 }
11139
11140 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11141
11142 if (HasEnergyManager())
11143 {
11144 GetCompEM().UpdatePlugState();
11145 }
11146 }
11147
11148
11150 {
11151 super.OnPlacementStarted(player);
11152
11154 }
11155
11156 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11157 {
11159 {
11160 m_AdminLog.OnPlacementComplete(player,
this);
11161 }
11162
11163 super.OnPlacementComplete(player, position, orientation);
11164 }
11165
11166
11167
11168
11169
11171 {
11173 {
11174 return true;
11175 }
11176 else
11177 {
11178 return false;
11179 }
11180 }
11181
11182
11184 {
11186 {
11188 }
11189 }
11190
11191
11193 {
11195 }
11196
11198 {
11200 }
11201
11202 override void InsertAgent(
int agent,
float count = 1)
11203 {
11204 if (count < 1)
11205 return;
11206
11208 }
11209
11212 {
11214 }
11215
11216
11218 {
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
11258
11259
11260
11261
11262
11264 {
11266 return false;
11267 return true;
11268 }
11269
11271 {
11272
11274 }
11275
11276
11279 {
11280 super.CheckForRoofLimited(timeTresholdMS);
11281
11282 float time =
g_Game.GetTime();
11283 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11284 {
11285 m_PreviousRoofTestTime = time;
11286 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11287 }
11288 }
11289
11290
11292 {
11294 {
11295 return 0;
11296 }
11297
11298 if (GetInventory().GetAttachmentSlotsCount() != 0)
11299 {
11300 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11301 if (filter)
11302 return filter.GetProtectionLevel(type, false, system);
11303 else
11304 return 0;
11305 }
11306
11307 string subclassPath, entryName;
11308
11309 switch (type)
11310 {
11312 entryName = "biological";
11313 break;
11315 entryName = "chemical";
11316 break;
11317 default:
11318 entryName = "biological";
11319 break;
11320 }
11321
11322 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11323
11324 return g_Game.ConfigGetFloat(subclassPath + entryName);
11325 }
11326
11327
11328
11331 {
11332 if (!IsMagazine())
11334
11336 }
11337
11338
11339
11340
11341
11346 {
11347 return true;
11348 }
11349
11351 {
11353 }
11354
11355
11356
11357
11358
11360 {
11361 if (parent)
11362 {
11363 if (parent.IsInherited(DayZInfected))
11364 return true;
11365
11366 if (!parent.IsRuined())
11367 return true;
11368 }
11369
11370 return true;
11371 }
11372
11374 {
11375 if (!super.CanPutAsAttachment(parent))
11376 {
11377 return false;
11378 }
11379
11380 if (!IsRuined() && !parent.IsRuined())
11381 {
11382 return true;
11383 }
11384
11385 return false;
11386 }
11387
11389 {
11390
11391
11392
11393
11394 return super.CanReceiveItemIntoCargo(item);
11395 }
11396
11398 {
11399
11400
11401
11402
11403 GameInventory attachmentInv = attachment.GetInventory();
11405 {
11406 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11407 return false;
11408 }
11409
11410 InventoryLocation loc = new InventoryLocation();
11411 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11412 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11413 return false;
11414
11415 return super.CanReceiveAttachment(attachment, slotId);
11416 }
11417
11419 {
11420 if (!super.CanReleaseAttachment(attachment))
11421 return false;
11422
11423 return GetInventory().AreChildrenAccessible();
11424 }
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11447 {
11448 int id = muzzle_owner.GetMuzzleID();
11449 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11450
11451 if (WPOF_array)
11452 {
11453 for (int i = 0; i < WPOF_array.Count(); i++)
11454 {
11455 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11456
11457 if (WPOF)
11458 {
11459 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11460 }
11461 }
11462 }
11463 }
11464
11465
11467 {
11468 int id = muzzle_owner.GetMuzzleID();
11470
11471 if (WPOBE_array)
11472 {
11473 for (int i = 0; i < WPOBE_array.Count(); i++)
11474 {
11475 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11476
11477 if (WPOBE)
11478 {
11479 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11480 }
11481 }
11482 }
11483 }
11484
11485
11487 {
11488 int id = muzzle_owner.GetMuzzleID();
11489 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11490
11491 if (WPOOH_array)
11492 {
11493 for (int i = 0; i < WPOOH_array.Count(); i++)
11494 {
11495 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11496
11497 if (WPOOH)
11498 {
11499 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11500 }
11501 }
11502 }
11503 }
11504
11505
11507 {
11508 int id = muzzle_owner.GetMuzzleID();
11509 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11510
11511 if (WPOOH_array)
11512 {
11513 for (int i = 0; i < WPOOH_array.Count(); i++)
11514 {
11515 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11516
11517 if (WPOOH)
11518 {
11519 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11520 }
11521 }
11522 }
11523 }
11524
11525
11527 {
11528 int id = muzzle_owner.GetMuzzleID();
11529 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11530
11531 if (WPOOH_array)
11532 {
11533 for (int i = 0; i < WPOOH_array.Count(); i++)
11534 {
11535 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11536
11537 if (WPOOH)
11538 {
11539 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11540 }
11541 }
11542 }
11543 }
11544
11545
11546
11548 {
11550 {
11551 return true;
11552 }
11553
11554 return false;
11555 }
11556
11558 {
11560 {
11561 return true;
11562 }
11563
11564 return false;
11565 }
11566
11568 {
11570 {
11571 return true;
11572 }
11573
11574 return false;
11575 }
11576
11578 {
11579 return false;
11580 }
11581
11584 {
11585 return UATimeSpent.DEFAULT_DEPLOY;
11586 }
11587
11588
11589
11590
11592 {
11594 SetSynchDirty();
11595 }
11596
11598 {
11600 }
11601
11602
11604 {
11605 return false;
11606 }
11607
11610 {
11611 string att_type = "None";
11612
11613 if (ConfigIsExisting("soundAttType"))
11614 {
11615 att_type = ConfigGetString("soundAttType");
11616 }
11617
11619 }
11620
11622 {
11624 }
11625
11626
11627
11628
11629
11635
11637 {
11640
11642 }
11643
11644
11646 {
11648 return;
11649
11651
11654
11657
11658 SoundParameters params = new SoundParameters();
11662 }
11663
11664
11666 {
11668 {
11671
11672 SetSynchDirty();
11673
11676 }
11677 }
11678
11680 {
11682 }
11683
11684
11686 {
11688 return;
11689
11691 SetSynchDirty();
11692
11695 }
11696
11698 {
11701 }
11702
11704 {
11706 }
11707
11708 void OnApply(PlayerBase player);
11709
11711 {
11712 return 1.0;
11713 };
11714
11716 {
11718 }
11719
11721 {
11723 }
11724
11726
11728 {
11729 SetDynamicPhysicsLifeTime(0.01);
11731 }
11732
11734 {
11735 array<string> zone_names = new array<string>;
11736 GetDamageZones(zone_names);
11737 for (int i = 0; i < zone_names.Count(); i++)
11738 {
11739 SetHealthMax(zone_names.Get(i),"Health");
11740 }
11741 SetHealthMax("","Health");
11742 }
11743
11746 {
11747 float global_health = GetHealth01("","Health");
11748 array<string> zones = new array<string>;
11749 GetDamageZones(zones);
11750
11751 for (int i = 0; i < zones.Count(); i++)
11752 {
11753 SetHealth01(zones.Get(i),"Health",global_health);
11754 }
11755 }
11756
11759 {
11760 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11761 }
11762
11764 {
11765 if (!hasRootAsPlayer)
11766 {
11767 if (refParentIB)
11768 {
11769
11770 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11771 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11772
11773 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11774 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11775
11778 }
11779 else
11780 {
11781
11784 }
11785 }
11786 }
11787
11789 {
11791 {
11792 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11793 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11794 {
11795 float heatPermCoef = 1.0;
11797 while (ent)
11798 {
11799 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11800 ent = ent.GetHierarchyParent();
11801 }
11802
11803 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11804 }
11805 }
11806 }
11807
11809 {
11810
11811 EntityAI parent = GetHierarchyParent();
11812 if (!parent)
11813 {
11814 hasParent = false;
11815 hasRootAsPlayer = false;
11816 }
11817 else
11818 {
11819 hasParent = true;
11820 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11821 refParentIB =
ItemBase.Cast(parent);
11822 }
11823 }
11824
11825 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11826 {
11827
11828 }
11829
11831 {
11832
11833 return false;
11834 }
11835
11837 {
11838
11839
11840 return false;
11841 }
11842
11844 {
11845
11846 return false;
11847 }
11848
11851 {
11852 return !GetIsFrozen() &&
IsOpen();
11853 }
11854
11856 {
11857 bool hasParent = false, hasRootAsPlayer = false;
11859
11860 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11861 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11862
11863 if (wwtu || foodDecay)
11864 {
11868
11869 if (processWetness || processTemperature || processDecay)
11870 {
11872
11873 if (processWetness)
11874 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11875
11876 if (processTemperature)
11878
11879 if (processDecay)
11880 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11881 }
11882 }
11883 }
11884
11887 {
11889 }
11890
11892 {
11895
11896 return super.GetTemperatureFreezeThreshold();
11897 }
11898
11900 {
11903
11904 return super.GetTemperatureThawThreshold();
11905 }
11906
11908 {
11911
11912 return super.GetItemOverheatThreshold();
11913 }
11914
11916 {
11918 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11919
11920 return super.GetTemperatureFreezeTime();
11921 }
11922
11924 {
11926 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11927
11928 return super.GetTemperatureThawTime();
11929 }
11930
11935
11937 {
11938 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11939 }
11940
11942 {
11943 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11944 }
11945
11948 {
11950 }
11951
11953 {
11955 }
11956
11958 {
11960 }
11961
11964 {
11965 return null;
11966 }
11967
11970 {
11971 return false;
11972 }
11973
11975 {
11977 {
11980 if (!trg)
11981 {
11983 explosive = this;
11984 }
11985
11986 explosive.PairRemote(trg);
11988
11989 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11990 trg.SetPersistentPairID(persistentID);
11991 explosive.SetPersistentPairID(persistentID);
11992
11993 return true;
11994 }
11995 return false;
11996 }
11997
12000 {
12001 float ret = 1.0;
12004 ret *= GetHealth01();
12005
12006 return ret;
12007 }
12008
12009 #ifdef DEVELOPER
12010 override void SetDebugItem()
12011 {
12012 super.SetDebugItem();
12013 _itemBase = this;
12014 }
12015
12017 {
12018 string text = super.GetDebugText();
12019
12021 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12022
12023 return text;
12024 }
12025 #endif
12026
12028 {
12029 return true;
12030 }
12031
12033
12035
12037 {
12040 }
12041
12042
12050
12066
12067 [
Obsolete(
"Use ItemSoundHandler instead")]
12070 {
12071 if (!
g_Game.IsDedicatedServer())
12072 {
12073 if (ConfigIsExisting("attachSoundSet"))
12074 {
12075 string cfg_path = "";
12076 string soundset = "";
12077 string type_name =
GetType();
12078
12081 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12082 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12083
12084 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12085 {
12086 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12087 {
12088 if (cfg_slot_array[i] == slot_type)
12089 {
12090 soundset = cfg_soundset_array[i];
12091 break;
12092 }
12093 }
12094 }
12095
12096 if (soundset != "")
12097 {
12098 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12100 }
12101 }
12102 }
12103 }
12104
12106}
12107
12109{
12111 if (entity)
12112 {
12113 bool is_item = entity.IsInherited(
ItemBase);
12114 if (is_item && full_quantity)
12115 {
12118 }
12119 }
12120 else
12121 {
12123 return NULL;
12124 }
12125 return entity;
12126}
12127
12129{
12130 if (item)
12131 {
12132 if (health > 0)
12133 item.SetHealth("", "", health);
12134
12135 if (item.CanHaveTemperature())
12136 {
12138 if (item.CanFreeze())
12139 item.SetFrozen(false);
12140 }
12141
12142 if (item.HasEnergyManager())
12143 {
12144 if (quantity >= 0)
12145 {
12146 item.GetCompEM().SetEnergy0To1(quantity);
12147 }
12148 else
12149 {
12151 }
12152 }
12153 else if (item.IsMagazine())
12154 {
12155 Magazine mag = Magazine.Cast(item);
12156 if (quantity >= 0)
12157 {
12158 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12159 }
12160 else
12161 {
12163 }
12164
12165 }
12166 else
12167 {
12168 if (quantity >= 0)
12169 {
12170 item.SetQuantityNormalized(quantity, false);
12171 }
12172 else
12173 {
12175 }
12176
12177 }
12178 }
12179}
12180
12181#ifdef DEVELOPER
12183#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.