7258{
7260 {
7261 return true;
7262 }
7263};
7264
7266{
7267
7268};
7269
7270
7271
7273{
7277
7279
7282
7283
7284
7285
7286
7295
7301
7306
7311
7332 protected bool m_IsResultOfSplit
7333
7335
7340
7341
7342
7344
7348
7349
7350
7352
7355
7356
7357
7363
7364
7372
7375
7376
7378
7379
7381
7382
7387
7388
7393
7395
7396
7398
7399
7401 {
7406
7407 if (!
g_Game.IsDedicatedServer())
7408 {
7410 {
7412
7414 {
7416 }
7417 }
7418
7421 }
7422
7423 m_OldLocation = null;
7424
7426 {
7428 }
7429
7430 if (ConfigIsExisting("headSelectionsToHide"))
7431 {
7434 }
7435
7437 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7438 {
7440 }
7441
7443
7444 m_IsResultOfSplit = false;
7445
7447 }
7448
7450 {
7451 super.InitItemVariables();
7452
7458 m_Count = ConfigGetInt(
"count");
7459
7462
7467
7470
7475
7487
7491
7492
7495 if (ConfigIsExisting("canBeSplit"))
7496 {
7499 }
7500
7502 if (ConfigIsExisting("itemBehaviour"))
7504
7505
7508 RegisterNetSyncVariableInt("m_VarLiquidType");
7509 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7510
7511 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7512 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7513 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7514
7515 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7516 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7517 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7518 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7519
7520 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7521 RegisterNetSyncVariableBool("m_IsTakeable");
7522 RegisterNetSyncVariableBool("m_IsHologram");
7523
7526 {
7529 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7530 }
7531
7533
7535 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7537
7539 }
7540
7542 {
7544 }
7545
7547 {
7550 {
7555 }
7556 }
7557
7558 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7559 {
7561 {
7564 }
7565
7567 }
7568
7570 {
7576 }
7577
7579
7581 {
7583
7584 if (!action)
7585 {
7586 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7587 return;
7588 }
7589
7591 if (!ai)
7592 {
7594 return;
7595 }
7596
7598 if (!action_array)
7599 {
7600 action_array = new array<ActionBase_Basic>;
7602 }
7603 if (LogManager.IsActionLogEnable())
7604 {
7605 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7606 }
7607
7608 if (action_array.Find(action) != -1)
7609 {
7610 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7611 }
7612 else
7613 {
7614 action_array.Insert(action);
7615 }
7616 }
7617
7619 {
7620 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7621 ActionBase action = player.GetActionManager().GetAction(actionName);
7624
7625 if (action_array)
7626 {
7627 action_array.RemoveItem(action);
7628 }
7629 }
7630
7631
7632
7634 {
7635 ActionOverrideData overrideData = new ActionOverrideData();
7639
7641 if (!actionMap)
7642 {
7645 }
7646
7647 actionMap.Insert(this.
Type(), overrideData);
7648
7649 }
7650
7652
7654
7655
7657 {
7660
7663
7664 string config_to_search = "CfgVehicles";
7665 string muzzle_owner_config;
7666
7668 {
7669 if (IsInherited(Weapon))
7670 config_to_search = "CfgWeapons";
7671
7672 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7673
7674 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7675
7676 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7677
7678 if (config_OnFire_subclass_count > 0)
7679 {
7680 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7681
7682 for (int i = 0; i < config_OnFire_subclass_count; i++)
7683 {
7684 string particle_class = "";
7685 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7686 string config_OnFire_entry = config_OnFire_class + particle_class;
7687 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7688 WPOF_array.Insert(WPOF);
7689 }
7690
7691
7693 }
7694 }
7695
7697 {
7698 config_to_search = "CfgWeapons";
7699 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7700
7701 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7702
7703 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7704
7705 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7706 {
7707 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7708
7709 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7710 {
7711 string particle_class2 = "";
7712 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7713 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7714 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7715 WPOBE_array.Insert(WPOBE);
7716 }
7717
7718
7720 }
7721 }
7722 }
7723
7724
7726 {
7729
7731 {
7732 string config_to_search = "CfgVehicles";
7733
7734 if (IsInherited(Weapon))
7735 config_to_search = "CfgWeapons";
7736
7737 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7738 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7739
7740 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7741 {
7742
7744
7746 {
7748 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7750 return;
7751 }
7752
7755
7756
7757
7758 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7759 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7760
7761 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7762 {
7763 string particle_class = "";
7764 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7765 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7766 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7767
7768 if (entry_type == CT_CLASS)
7769 {
7770 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7771 WPOOH_array.Insert(WPOF);
7772 }
7773 }
7774
7775
7777 }
7778 }
7779 }
7780
7782 {
7784 }
7785
7787 {
7789 {
7791
7794
7797
7798 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7799 }
7800 }
7801
7803 {
7805 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7806
7808 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7809
7811 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7812
7814 {
7816 }
7817 }
7818
7820 {
7822 }
7823
7825 {
7828 else
7830
7832 {
7835 }
7836 else
7837 {
7840
7843 }
7844
7846 }
7847
7849 {
7851 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7852 }
7853
7855 {
7857 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7859 }
7860
7862 {
7864 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7865 }
7866
7868 {
7871
7872 OverheatingParticle OP = new OverheatingParticle();
7877
7879 }
7880
7882 {
7885
7886 return -1;
7887 }
7888
7890 {
7892 {
7895
7896 for (int i = count; i > 0; --i)
7897 {
7898 int id = i - 1;
7901
7904
7905 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7906 {
7907 if (p)
7908 {
7911 }
7912 }
7913 }
7914 }
7915 }
7916
7918 {
7920 {
7922 {
7923 int id = i - 1;
7925
7926 if (OP)
7927 {
7929
7930 if (p)
7931 {
7933 }
7934
7935 delete OP;
7936 }
7937 }
7938
7941 }
7942 }
7943
7946 {
7947 return 0.0;
7948 }
7949
7950
7952 {
7953 return 250;
7954 }
7955
7957 {
7958 return 0;
7959 }
7960
7963 {
7965 return true;
7966
7967 return false;
7968 }
7969
7972 {
7975
7977 {
7979 }
7980 else
7981 {
7982
7984 }
7985
7987 }
7988
7995 {
7996 return -1;
7997 }
7998
7999
8000
8001
8003 {
8005 {
8006 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8007 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8008
8009 if (r_index >= 0)
8010 {
8011 InventoryLocation r_il = new InventoryLocation;
8012 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8013
8014 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8017 {
8018 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8019 }
8021 {
8022 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8023 }
8024
8025 }
8026
8027 player.GetHumanInventory().ClearUserReservedLocation(this);
8028 }
8029
8032 }
8033
8034
8035
8036
8038 {
8039 return ItemBase.m_DebugActionsMask;
8040 }
8041
8043 {
8044 return ItemBase.m_DebugActionsMask & mask;
8045 }
8046
8048 {
8049 ItemBase.m_DebugActionsMask = mask;
8050 }
8051
8053 {
8054 ItemBase.m_DebugActionsMask |= mask;
8055 }
8056
8058 {
8059 ItemBase.m_DebugActionsMask &= ~mask;
8060 }
8061
8063 {
8065 {
8067 }
8068 else
8069 {
8071 }
8072 }
8073
8074
8076 {
8077 if (GetEconomyProfile())
8078 {
8079 float q_max = GetEconomyProfile().GetQuantityMax();
8080 if (q_max > 0)
8081 {
8082 float q_min = GetEconomyProfile().GetQuantityMin();
8083 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8084
8086 {
8087 ComponentEnergyManager comp = GetCompEM();
8089 {
8091 }
8092 }
8094 {
8096
8097 }
8098
8099 }
8100 }
8101 }
8102
8105 {
8106 EntityAI parent = GetHierarchyParent();
8107
8108 if (parent)
8109 {
8110 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8111 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8112 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8113 }
8114 }
8115
8118 {
8119 EntityAI parent = GetHierarchyParent();
8120
8121 if (parent)
8122 {
8123 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8124 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8125 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8126 }
8127 }
8128
8130 {
8131
8132
8133
8134
8136
8138 {
8139 if (ScriptInputUserData.CanStoreInputUserData())
8140 {
8141 ScriptInputUserData ctx = new ScriptInputUserData;
8147 ctx.
Write(use_stack_max);
8150
8152 {
8153 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8154 }
8155 }
8156 }
8157 else if (!
g_Game.IsMultiplayer())
8158 {
8160 }
8161 }
8162
8164 {
8166 }
8167
8169 {
8171 }
8172
8174 {
8176 }
8177
8179 {
8180
8181 return false;
8182 }
8183
8185 {
8186 return false;
8187 }
8188
8192 {
8193 return false;
8194 }
8195
8197 {
8198 return "";
8199 }
8200
8202
8204 {
8205 return false;
8206 }
8207
8209 {
8210 return true;
8211 }
8212
8213
8214
8216 {
8217 return true;
8218 }
8219
8221 {
8222 return true;
8223 }
8224
8226 {
8227 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8229 }
8230
8232 {
8234 }
8235
8237 {
8239 if (!is_being_placed)
8241 SetSynchDirty();
8242 }
8243
8244
8246
8248 {
8250 }
8251
8253 {
8255 }
8256
8258 {
8259 return 1;
8260 }
8261
8263 {
8264 return false;
8265 }
8266
8268 {
8270 SetSynchDirty();
8271 }
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8308 {
8309 super.OnMovedInsideCargo(container);
8310
8311 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8312 }
8313
8314 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8315 {
8316 super.EEItemLocationChanged(oldLoc, newLoc);
8317
8318 PlayerBase newPlayer = null;
8319 PlayerBase oldPlayer = null;
8320
8321 if (newLoc.GetParent())
8322 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8323
8324 if (oldLoc.GetParent())
8325 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8326
8328 {
8329 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8330
8331 if (rIndex >= 0)
8332 {
8333 InventoryLocation rIl = new InventoryLocation;
8334 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8335
8336 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8339 {
8340 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8341 }
8343 {
8345 }
8346
8347 }
8348 }
8349
8351 {
8352 if (newPlayer)
8353 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8354
8355 if (newPlayer == oldPlayer)
8356 {
8357 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8358 {
8360 {
8361 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8362 {
8363 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8364 }
8365 }
8366 else
8367 {
8368 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8369 }
8370 }
8371
8372 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8373 {
8374 int type = oldLoc.GetType();
8376 {
8377 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8378 }
8380 {
8381 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8382 }
8383 }
8384 if (!m_OldLocation)
8385 {
8386 m_OldLocation = new InventoryLocation;
8387 }
8388 m_OldLocation.Copy(oldLoc);
8389 }
8390 else
8391 {
8392 if (m_OldLocation)
8393 {
8394 m_OldLocation.Reset();
8395 }
8396 }
8397
8398 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8399 }
8400 else
8401 {
8402 if (newPlayer)
8403 {
8404 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8405 if (resIndex >= 0)
8406 {
8407 InventoryLocation il = new InventoryLocation;
8408 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8410 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8413 {
8414 il.
GetParent().GetOnReleaseLock().Invoke(it);
8415 }
8417 {
8419 }
8420
8421 }
8422 }
8424 {
8425
8427 }
8428
8429 if (m_OldLocation)
8430 {
8431 m_OldLocation.Reset();
8432 }
8433 }
8434
8436 {
8437 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8438 }
8439
8441 {
8442 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8443 }
8444 }
8445
8446 override void EOnContact(IEntity other, Contact extra)
8447 {
8449 {
8450 int liquidType = -1;
8452 if (impactSpeed > 0.0)
8453 {
8455 #ifndef SERVER
8457 #else
8459 SetSynchDirty();
8460 #endif
8462 }
8463 }
8464
8465 #ifdef SERVER
8466 if (GetCompEM() && GetCompEM().IsPlugged())
8467 {
8468 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8469 GetCompEM().UnplugThis();
8470 }
8471 #endif
8472 }
8473
8475
8477 {
8479 }
8480
8482 {
8483
8484 }
8485
8487 {
8488 super.OnItemLocationChanged(old_owner, new_owner);
8489
8490 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8491 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8492
8493 if (!relatedPlayer && playerNew)
8494 relatedPlayer = playerNew;
8495
8496 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8497 {
8499 if (actionMgr)
8500 {
8501 ActionBase currentAction = actionMgr.GetRunningAction();
8502 if (currentAction)
8504 }
8505 }
8506
8507 Man ownerPlayerOld = null;
8508 Man ownerPlayerNew = null;
8509
8510 if (old_owner)
8511 {
8512 if (old_owner.
IsMan())
8513 {
8514 ownerPlayerOld = Man.Cast(old_owner);
8515 }
8516 else
8517 {
8518 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8519 }
8520 }
8521 else
8522 {
8524 {
8526
8527 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8528 {
8529 GetCompEM().UnplugThis();
8530 }
8531 }
8532 }
8533
8534 if (new_owner)
8535 {
8536 if (new_owner.
IsMan())
8537 {
8538 ownerPlayerNew = Man.Cast(new_owner);
8539 }
8540 else
8541 {
8542 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8543 }
8544 }
8545
8546 if (ownerPlayerOld != ownerPlayerNew)
8547 {
8548 if (ownerPlayerOld)
8549 {
8550 array<EntityAI> subItemsExit = new array<EntityAI>;
8552 for (int i = 0; i < subItemsExit.Count(); i++)
8553 {
8556 }
8557 }
8558
8559 if (ownerPlayerNew)
8560 {
8561 array<EntityAI> subItemsEnter = new array<EntityAI>;
8563 for (int j = 0; j < subItemsEnter.Count(); j++)
8564 {
8567 }
8568 }
8569 }
8570 else if (ownerPlayerNew != null)
8571 {
8572 PlayerBase nplayer;
8573 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8574 {
8575 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8577 for (int k = 0; k < subItemsUpdate.Count(); k++)
8578 {
8580 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8581 }
8582 }
8583 }
8584
8585 if (old_owner)
8586 old_owner.OnChildItemRemoved(this);
8587 if (new_owner)
8588 new_owner.OnChildItemReceived(this);
8589 }
8590
8591
8593 {
8594 super.EEDelete(parent);
8595 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8596 if (player)
8597 {
8599
8600 if (player.IsAlive())
8601 {
8602 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8603 if (r_index >= 0)
8604 {
8605 InventoryLocation r_il = new InventoryLocation;
8606 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8607
8608 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8611 {
8612 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8613 }
8615 {
8616 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8617 }
8618
8619 }
8620
8621 player.RemoveQuickBarEntityShortcut(this);
8622 }
8623 }
8624 }
8625
8627 {
8628 super.EEKilled(killer);
8629
8632 {
8633 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8634 {
8635 if (IsMagazine())
8636 {
8637 if (Magazine.Cast(this).GetAmmoCount() > 0)
8638 {
8640 }
8641 }
8642 else
8643 {
8645 }
8646 }
8647 }
8648 }
8649
8651 {
8652 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8653
8654 super.OnWasAttached(parent, slot_id);
8655
8658
8661 }
8662
8664 {
8665 super.OnWasDetached(parent, slot_id);
8666
8669
8672 }
8673
8675 {
8676 int idx;
8679
8680 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8681 if (inventory_slots.Count() < 1)
8682 {
8683 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8684 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8685 }
8686 else
8687 {
8688 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8689 }
8690
8691 idx = inventory_slots.Find(slot);
8692 if (idx < 0)
8693 return "";
8694
8695 return attach_types.Get(idx);
8696 }
8697
8699 {
8700 int idx = -1;
8701 string slot;
8702
8705
8706 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8707 if (inventory_slots.Count() < 1)
8708 {
8709 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8710 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8711 }
8712 else
8713 {
8714 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8715 if (detach_types.Count() < 1)
8716 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8717 }
8718
8719 for (int i = 0; i < inventory_slots.Count(); i++)
8720 {
8721 slot = inventory_slots.Get(i);
8722 }
8723
8724 if (slot != "")
8725 {
8726 if (detach_types.Count() == 1)
8727 idx = 0;
8728 else
8729 idx = inventory_slots.Find(slot);
8730 }
8731 if (idx < 0)
8732 return "";
8733
8734 return detach_types.Get(idx);
8735 }
8736
8738 {
8739
8741
8742
8743 float min_time = 1;
8744 float max_time = 3;
8745 float delay = Math.RandomFloat(min_time, max_time);
8746
8747 explode_timer.Run(delay, this, "DoAmmoExplosion");
8748 }
8749
8751 {
8752 Magazine magazine = Magazine.Cast(this);
8753 int pop_sounds_count = 6;
8754 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8755
8756
8757 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8758 string sound_name = pop_sounds[ sound_idx ];
8759 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8760
8761
8762 magazine.ServerAddAmmoCount(-1);
8763
8764
8765 float min_temp_to_explode = 100;
8766
8767 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8768 {
8770 }
8771 }
8772
8773
8774 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8775 {
8776 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8777
8778 const int CHANCE_DAMAGE_CARGO = 4;
8779 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8780 const int CHANCE_DAMAGE_NOTHING = 2;
8781
8783 {
8784 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8785 int chances;
8786 int rnd;
8787
8788 if (GetInventory().GetCargo())
8789 {
8790 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8791 rnd = Math.RandomInt(0,chances);
8792
8793 if (rnd < CHANCE_DAMAGE_CARGO)
8794 {
8796 }
8797 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8798 {
8800 }
8801 }
8802 else
8803 {
8804 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8805 rnd = Math.RandomInt(0,chances);
8806
8807 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8808 {
8810 }
8811 }
8812 }
8813 }
8814
8816 {
8817 CargoBase cargo = GetInventory().GetCargo();
8818 if (cargo)
8819 {
8821 if (item_count > 0)
8822 {
8823 int random_pick = Math.RandomInt(0, item_count);
8825 if (!item.IsExplosive())
8826 {
8827 item.AddHealth("","",damage);
8828 return true;
8829 }
8830 }
8831 }
8832 return false;
8833 }
8834
8836 {
8837 GameInventory inventory = GetInventory();
8839 if (attachment_count > 0)
8840 {
8841 int random_pick = Math.RandomInt(0, attachment_count);
8843 if (!attachment.IsExplosive())
8844 {
8845 attachment.AddHealth("","",damage);
8846 return true;
8847 }
8848 }
8849 return false;
8850 }
8851
8853 {
8855 }
8856
8858 {
8860 return GetInventory().CanRemoveEntity();
8861
8862 return false;
8863 }
8864
8866 {
8867
8869 return false;
8870
8871
8873 return false;
8874
8875
8876
8878 if (delta == 0)
8879 return false;
8880
8881
8882 return true;
8883 }
8884
8886 {
8888 {
8889 if (ScriptInputUserData.CanStoreInputUserData())
8890 {
8891 ScriptInputUserData ctx = new ScriptInputUserData;
8896 ctx.
Write(destination_entity);
8900 }
8901 }
8902 else if (!
g_Game.IsMultiplayer())
8903 {
8905 }
8906 }
8907
8909 {
8910 float split_quantity_new;
8914 InventoryLocation loc = new InventoryLocation;
8915
8916 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8917 {
8919 split_quantity_new = stack_max;
8920 else
8922
8924 {
8925 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8926 if (new_item)
8927 {
8928 new_item.SetResultOfSplit(true);
8929 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8931 new_item.
SetQuantity(split_quantity_new,
false,
true);
8932 }
8933 }
8934 }
8935 else if (destination_entity && slot_id == -1)
8936 {
8937 if (quantity > stack_max)
8938 split_quantity_new = stack_max;
8939 else
8940 split_quantity_new = quantity;
8941
8943 {
8944 GameInventory destinationInventory = destination_entity.GetInventory();
8946 {
8949 }
8950
8951 if (new_item)
8952 {
8953 new_item.SetResultOfSplit(true);
8954 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8956 new_item.
SetQuantity(split_quantity_new,
false,
true);
8957 }
8958 }
8959 }
8960 else
8961 {
8962 if (stack_max != 0)
8963 {
8965 {
8967 }
8968
8969 if (split_quantity_new == 0)
8970 {
8971 if (!
g_Game.IsMultiplayer())
8972 player.PhysicalPredictiveDropItem(this);
8973 else
8974 player.ServerDropEntity(this);
8975 return;
8976 }
8977
8979 {
8981
8982 if (new_item)
8983 {
8984 new_item.SetResultOfSplit(true);
8985 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8988 new_item.PlaceOnSurface();
8989 }
8990 }
8991 }
8992 }
8993 }
8994
8996 {
8997 float split_quantity_new;
9001 InventoryLocation loc = new InventoryLocation;
9002
9003 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9004 {
9006 split_quantity_new = stack_max;
9007 else
9009
9011 {
9012 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9013 if (new_item)
9014 {
9015 new_item.SetResultOfSplit(true);
9016 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9018 new_item.
SetQuantity(split_quantity_new,
false,
true);
9019 }
9020 }
9021 }
9022 else if (destination_entity && slot_id == -1)
9023 {
9024 if (quantity > stack_max)
9025 split_quantity_new = stack_max;
9026 else
9027 split_quantity_new = quantity;
9028
9030 {
9031 GameInventory destinationInventory = destination_entity.GetInventory();
9033 {
9036 }
9037
9038 if (new_item)
9039 {
9040 new_item.SetResultOfSplit(true);
9041 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9043 new_item.
SetQuantity(split_quantity_new,
false,
true);
9044 }
9045 }
9046 }
9047 else
9048 {
9049 if (stack_max != 0)
9050 {
9052 {
9054 }
9055
9057 {
9059
9060 if (new_item)
9061 {
9062 new_item.SetResultOfSplit(true);
9063 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9066 new_item.PlaceOnSurface();
9067 }
9068 }
9069 }
9070 }
9071 }
9072
9074 {
9076 {
9077 if (ScriptInputUserData.CanStoreInputUserData())
9078 {
9079 ScriptInputUserData ctx = new ScriptInputUserData;
9084 dst.WriteToContext(ctx);
9086 }
9087 }
9088 else if (!
g_Game.IsMultiplayer())
9089 {
9091 }
9092 }
9093
9095 {
9097 {
9098 if (ScriptInputUserData.CanStoreInputUserData())
9099 {
9100 ScriptInputUserData ctx = new ScriptInputUserData;
9105 ctx.
Write(destination_entity);
9111 }
9112 }
9113 else if (!
g_Game.IsMultiplayer())
9114 {
9116 }
9117 }
9118
9120 {
9122 }
9123
9125 {
9127 float split_quantity_new;
9129 if (dst.IsValid())
9130 {
9131 int slot_id = dst.GetSlot();
9133
9134 if (quantity > stack_max)
9135 split_quantity_new = stack_max;
9136 else
9137 split_quantity_new = quantity;
9138
9140 {
9142
9143 if (new_item)
9144 {
9145 new_item.SetResultOfSplit(true);
9146 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9148 new_item.
SetQuantity(split_quantity_new,
false,
true);
9149 }
9150
9151 return new_item;
9152 }
9153 }
9154
9155 return null;
9156 }
9157
9159 {
9161 float split_quantity_new;
9163 if (destination_entity)
9164 {
9166 if (quantity > stackable)
9167 split_quantity_new = stackable;
9168 else
9169 split_quantity_new = quantity;
9170
9172 {
9173 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9174 if (new_item)
9175 {
9176 new_item.SetResultOfSplit(true);
9177 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9179 new_item.
SetQuantity(split_quantity_new,
false,
true);
9180 }
9181 }
9182 }
9183 }
9184
9186 {
9188 {
9189 if (ScriptInputUserData.CanStoreInputUserData())
9190 {
9191 ScriptInputUserData ctx = new ScriptInputUserData;
9196 ItemBase destination_entity =
this;
9197 ctx.
Write(destination_entity);
9201 }
9202 }
9203 else if (!
g_Game.IsMultiplayer())
9204 {
9206 }
9207 }
9208
9210 {
9212 float split_quantity_new;
9214 if (player)
9215 {
9217 if (quantity > stackable)
9218 split_quantity_new = stackable;
9219 else
9220 split_quantity_new = quantity;
9221
9223 {
9224 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9225 new_item =
ItemBase.Cast(in_hands);
9226 if (new_item)
9227 {
9228 new_item.SetResultOfSplit(true);
9229 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9231 new_item.SetQuantity(split_quantity_new, false, true);
9232 }
9233 }
9234 }
9235 }
9236
9238 {
9240 float split_quantity_new = Math.Floor(quantity * 0.5);
9241
9243 return;
9244
9246
9247 if (new_item)
9248 {
9249 if (new_item.GetQuantityMax() < split_quantity_new)
9250 {
9251 split_quantity_new = new_item.GetQuantityMax();
9252 }
9253
9254 new_item.SetResultOfSplit(true);
9255 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9256
9258 {
9261 }
9262 else
9263 {
9265 new_item.
SetQuantity(split_quantity_new,
false,
true);
9266 }
9267 }
9268 }
9269
9271 {
9273 float split_quantity_new = Math.Floor(quantity / 2);
9274
9276 return;
9277
9278 InventoryLocation invloc = new InventoryLocation;
9280
9282 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9283
9284 if (new_item)
9285 {
9286 if (new_item.GetQuantityMax() < split_quantity_new)
9287 {
9288 split_quantity_new = new_item.GetQuantityMax();
9289 }
9291 {
9294 }
9295 else if (split_quantity_new > 1)
9296 {
9298 new_item.
SetQuantity(split_quantity_new,
false,
true);
9299 }
9300 }
9301 }
9302
9305 {
9306 SetWeightDirty();
9308
9309 if (parent)
9310 parent.OnAttachmentQuantityChangedEx(this, delta);
9311
9313 {
9315 {
9317 }
9319 {
9320 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9322 }
9323 }
9324 }
9325
9328 {
9329
9330 }
9331
9334 {
9336 }
9337
9339 {
9340 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9341
9343 {
9344 if (newLevel == GameConstants.STATE_RUINED)
9345 {
9347 EntityAI parent = GetHierarchyParent();
9348 if (parent && parent.IsFireplace())
9349 {
9350 CargoBase cargo = GetInventory().GetCargo();
9351 if (cargo)
9352 {
9354 {
9356 }
9357 }
9358 }
9359 }
9360
9362 {
9363
9365 return;
9366 }
9367
9368 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9369 {
9371 }
9372 }
9373 }
9374
9375
9377 {
9378 super.OnRightClick();
9379
9381 {
9383 {
9384 if (ScriptInputUserData.CanStoreInputUserData())
9385 {
9386 EntityAI root = GetHierarchyRoot();
9387 Man playerOwner = GetHierarchyRootPlayer();
9388 InventoryLocation dst = new InventoryLocation;
9389
9390
9391 if (!playerOwner && root && root == this)
9392 {
9394 }
9395 else
9396 {
9397
9398 GetInventory().GetCurrentInventoryLocation(dst);
9400 {
9401 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9403 {
9405 }
9406 else
9407 {
9409
9410
9411 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9412 {
9414 }
9415 else
9416 {
9417 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9418 }
9419 }
9420 }
9421 }
9422
9423 ScriptInputUserData ctx = new ScriptInputUserData;
9431 }
9432 }
9433 else if (!
g_Game.IsMultiplayer())
9434 {
9436 }
9437 }
9438 }
9439
9441 {
9442 if (root)
9443 {
9444 vector m4[4];
9445 root.GetTransform(m4);
9446 dst.SetGround(this, m4);
9447 }
9448 else
9449 {
9450 GetInventory().GetCurrentInventoryLocation(dst);
9451 }
9452 }
9453
9454 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9455 {
9456
9457 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9458 return false;
9459
9460 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9461 return false;
9462
9463
9465 return false;
9466
9467
9468 Magazine mag = Magazine.Cast(this);
9469 if (mag)
9470 {
9471 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9472 return false;
9473
9474 if (stack_max_limit)
9475 {
9476 Magazine other_mag = Magazine.Cast(other_item);
9477 if (other_item)
9478 {
9479 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9480 return false;
9481 }
9482
9483 }
9484 }
9485 else
9486 {
9487
9489 return false;
9490
9492 return false;
9493 }
9494
9495 PlayerBase player = null;
9496 if (CastTo(player, GetHierarchyRootPlayer()))
9497 {
9498 if (player.GetInventory().HasAttachment(this))
9499 return false;
9500
9501 if (player.IsItemsToDelete())
9502 return false;
9503 }
9504
9505 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9506 return false;
9507
9508 int slotID;
9510 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9511 return false;
9512
9513 return true;
9514 }
9515
9517 {
9519 }
9520
9522 {
9523 return m_IsResultOfSplit;
9524 }
9525
9527 {
9528 m_IsResultOfSplit = value;
9529 }
9530
9532 {
9534 }
9535
9537 {
9538 float other_item_quantity = other_item.GetQuantity();
9539 float this_free_space;
9540
9542
9544
9545 if (other_item_quantity > this_free_space)
9546 {
9547 return this_free_space;
9548 }
9549 else
9550 {
9551 return other_item_quantity;
9552 }
9553 }
9554
9556 {
9558 }
9559
9561 {
9563 return;
9564
9565 if (!IsMagazine() && other_item)
9566 {
9568 if (quantity_used != 0)
9569 {
9570 float hp1 = GetHealth01("","");
9571 float hp2 = other_item.GetHealth01("","");
9572 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9573 hpResult = hpResult / (
GetQuantity() + quantity_used);
9574
9575 hpResult *= GetMaxHealth();
9576 Math.Round(hpResult);
9577 SetHealth("", "Health", hpResult);
9578
9580 other_item.AddQuantity(-quantity_used);
9581 }
9582 }
9584 }
9585
9587 {
9588 #ifdef SERVER
9589 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9590 GetHierarchyParent().IncreaseLifetimeUp();
9591 #endif
9592 };
9593
9595 {
9596 PlayerBase p = PlayerBase.Cast(player);
9597
9598 array<int> recipesIds = p.m_Recipes;
9599 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9600 if (moduleRecipesManager)
9601 {
9602 EntityAI itemInHands = player.GetEntityInHands();
9603 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9604 }
9605
9606 for (int i = 0;i < recipesIds.Count(); i++)
9607 {
9608 int key = recipesIds.Get(i);
9609 string recipeName = moduleRecipesManager.GetRecipeName(key);
9611 }
9612 }
9613
9614
9615 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9616 {
9617 super.GetDebugActions(outputList);
9618
9619
9625
9626
9631
9636
9637
9641
9642
9644 {
9648 }
9649
9652
9653
9657
9659
9660 InventoryLocation loc = new InventoryLocation();
9661 GetInventory().GetCurrentInventoryLocation(loc);
9663 {
9664 if (Gizmo_IsSupported())
9667 }
9668
9670 }
9671
9672
9673
9674
9676 {
9677 super.OnAction(action_id, player, ctx);
9678
9680 {
9681 switch (action_id)
9682 {
9686 return true;
9690 return true;
9691 }
9692 }
9693
9695 {
9696 switch (action_id)
9697 {
9699 Delete();
9700 return true;
9701 }
9702 }
9703
9704 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9705 {
9706 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9707 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9708 PlayerBase p = PlayerBase.Cast(player);
9709 if (
EActions.RECIPES_RANGE_START < 1000)
9710 {
9711 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9712 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9713 }
9714 }
9715 #ifndef SERVER
9716 else if (action_id ==
EActions.WATCH_PLAYER)
9717 {
9718 PluginDeveloper.SetDeveloperItemClientEx(player);
9719 }
9720 #endif
9722 {
9723 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9724 {
9725 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9726 OnDebugButtonPressServer(id + 1);
9727 }
9728
9729 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9730 {
9731 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9733 }
9734
9735 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9736 {
9737 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9739 }
9740
9741 else if (action_id ==
EActions.ADD_QUANTITY)
9742 {
9743 if (IsMagazine())
9744 {
9745 Magazine mag = Magazine.Cast(this);
9746 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9747 }
9748 else
9749 {
9751 }
9752
9753 if (m_EM)
9754 {
9755 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9756 }
9757
9758 }
9759
9760 else if (action_id ==
EActions.REMOVE_QUANTITY)
9761 {
9762 if (IsMagazine())
9763 {
9764 Magazine mag2 = Magazine.Cast(this);
9765 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9766 }
9767 else
9768 {
9770 }
9771 if (m_EM)
9772 {
9773 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9774 }
9775
9776 }
9777
9778 else if (action_id ==
EActions.SET_QUANTITY_0)
9779 {
9781
9782 if (m_EM)
9783 {
9784 m_EM.SetEnergy(0);
9785 }
9786 }
9787
9788 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9789 {
9791
9792 if (m_EM)
9793 {
9794 m_EM.SetEnergy(m_EM.GetEnergyMax());
9795 }
9796 }
9797
9798 else if (action_id ==
EActions.ADD_HEALTH)
9799 {
9800 AddHealth("","",GetMaxHealth("","Health")/5);
9801 }
9802 else if (action_id ==
EActions.REMOVE_HEALTH)
9803 {
9804 AddHealth("","",-GetMaxHealth("","Health")/5);
9805 }
9806 else if (action_id ==
EActions.DESTROY_HEALTH)
9807 {
9808 SetHealth01("","",0);
9809 }
9810 else if (action_id ==
EActions.WATCH_ITEM)
9811 {
9813 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9814 #ifdef DEVELOPER
9815 SetDebugDeveloper_item(this);
9816 #endif
9817 }
9818
9819 else if (action_id ==
EActions.ADD_TEMPERATURE)
9820 {
9821 AddTemperature(20);
9822
9823 }
9824
9825 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9826 {
9827 AddTemperature(-20);
9828
9829 }
9830
9831 else if (action_id ==
EActions.FLIP_FROZEN)
9832 {
9833 SetFrozen(!GetIsFrozen());
9834
9835 }
9836
9837 else if (action_id ==
EActions.ADD_WETNESS)
9838 {
9840
9841 }
9842
9843 else if (action_id ==
EActions.REMOVE_WETNESS)
9844 {
9846
9847 }
9848
9849 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9850 {
9853
9854
9855 }
9856
9857 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9858 {
9861 }
9862
9863 else if (action_id ==
EActions.MAKE_SPECIAL)
9864 {
9865 auto debugParams = DebugSpawnParams.WithPlayer(player);
9866 OnDebugSpawnEx(debugParams);
9867 }
9868
9869 }
9870
9871
9872 return false;
9873 }
9874
9875
9876
9877
9881
9884
9885
9886
9888 {
9889 return false;
9890 }
9891
9892
9894 {
9895 return true;
9896 }
9897
9898
9900 {
9901 return true;
9902 }
9903
9904
9905
9907 {
9908 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9909 return g_Game.ConfigIsExisting(config_path);
9910 }
9911
9914 {
9915 return null;
9916 }
9917
9919 {
9920 return false;
9921 }
9922
9924 {
9925 return false;
9926 }
9927
9931
9932
9934 {
9935 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9936 return module_repairing.CanRepair(this, item_repair_kit);
9937 }
9938
9939
9940 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9941 {
9942 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9943 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9944 }
9945
9946
9948 {
9949
9950
9951
9952
9953
9954
9955
9956
9957 return 1;
9958 }
9959
9960
9961
9963 {
9965 }
9966
9967
9968
9970 {
9972 }
9973
9974
9983 {
9984 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9985
9986 if (player)
9987 {
9988 player.MessageStatus(text);
9989 }
9990 }
9991
9992
10001 {
10002 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10003
10004 if (player)
10005 {
10006 player.MessageAction(text);
10007 }
10008 }
10009
10010
10019 {
10020 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10021
10022 if (player)
10023 {
10024 player.MessageFriendly(text);
10025 }
10026 }
10027
10028
10037 {
10038 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10039
10040 if (player)
10041 {
10042 player.MessageImportant(text);
10043 }
10044 }
10045
10047 {
10048 return true;
10049 }
10050
10051
10052 override bool KindOf(
string tag)
10053 {
10054 bool found = false;
10055 string item_name = this.
GetType();
10057 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10058
10059 int array_size = item_tag_array.Count();
10060 for (int i = 0; i < array_size; i++)
10061 {
10062 if (item_tag_array.Get(i) == tag)
10063 {
10064 found = true;
10065 break;
10066 }
10067 }
10068 return found;
10069 }
10070
10071
10073 {
10074
10075 super.OnRPC(sender, rpc_type,ctx);
10076
10077
10078 switch (rpc_type)
10079 {
10080 #ifndef SERVER
10081 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10082 Param2<bool, string> p = new Param2<bool, string>(false, "");
10083
10085 return;
10086
10087 bool play = p.param1;
10088 string soundSet = p.param2;
10089
10090 if (play)
10091 {
10093 {
10095 {
10097 }
10098 }
10099 else
10100 {
10102 }
10103 }
10104 else
10105 {
10107 }
10108
10109 break;
10110 #endif
10111
10112 }
10113
10115 {
10117 }
10118 }
10119
10120
10121
10122
10124 {
10125 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10126 return plugin.GetID(
name);
10127 }
10128
10130 {
10131 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10132 return plugin.GetName(id);
10133 }
10134
10137 {
10138
10139
10140 int varFlags;
10141 if (!ctx.
Read(varFlags))
10142 return;
10143
10144 if (varFlags & ItemVariableFlags.FLOAT)
10145 {
10147 }
10148 }
10149
10151 {
10152
10153 super.SerializeNumericalVars(floats_out);
10154
10155
10156
10158 {
10160 }
10161
10163 {
10165 }
10166
10168 {
10170 }
10171
10173 {
10178 }
10179
10181 {
10183 }
10184 }
10185
10187 {
10188
10189 super.DeSerializeNumericalVars(floats);
10190
10191
10192 int index = 0;
10193 int mask = Math.Round(floats.Get(index));
10194
10195 index++;
10196
10198 {
10200 {
10202 }
10203 else
10204 {
10205 float quantity = floats.Get(index);
10206 SetQuantity(quantity,
true,
false,
false,
false);
10207 }
10208 index++;
10209 }
10210
10212 {
10213 float wet = floats.Get(index);
10215 index++;
10216 }
10217
10219 {
10220 int liquidtype = Math.Round(floats.Get(index));
10222 index++;
10223 }
10224
10226 {
10228 index++;
10230 index++;
10232 index++;
10234 index++;
10235 }
10236
10238 {
10239 int cleanness = Math.Round(floats.Get(index));
10241 index++;
10242 }
10243 }
10244
10246 {
10247 super.WriteVarsToCTX(ctx);
10248
10249
10251 {
10253 }
10254
10256 {
10258 }
10259
10261 {
10263 }
10264
10266 {
10267 int r,g,b,a;
10273 }
10274
10276 {
10278 }
10279 }
10280
10282 {
10283 if (!super.ReadVarsFromCTX(ctx,version))
10284 return false;
10285
10286 int intValue;
10287 float value;
10288
10289 if (version < 140)
10290 {
10291 if (!ctx.
Read(intValue))
10292 return false;
10293
10294 m_VariablesMask = intValue;
10295 }
10296
10298 {
10299 if (!ctx.
Read(value))
10300 return false;
10301
10303 {
10305 }
10306 else
10307 {
10309 }
10310 }
10311
10312 if (version < 140)
10313 {
10315 {
10316 if (!ctx.
Read(value))
10317 return false;
10318 SetTemperatureDirect(value);
10319 }
10320 }
10321
10323 {
10324 if (!ctx.
Read(value))
10325 return false;
10327 }
10328
10330 {
10331 if (!ctx.
Read(intValue))
10332 return false;
10334 }
10335
10337 {
10338 int r,g,b,a;
10340 return false;
10342 return false;
10344 return false;
10346 return false;
10347
10349 }
10350
10352 {
10353 if (!ctx.
Read(intValue))
10354 return false;
10356 }
10357
10358 if (version >= 138 && version < 140)
10359 {
10361 {
10362 if (!ctx.
Read(intValue))
10363 return false;
10364 SetFrozen(intValue);
10365 }
10366 }
10367
10368 return true;
10369 }
10370
10371
10373 {
10376 {
10378 }
10379
10380 if (!super.OnStoreLoad(ctx, version))
10381 {
10383 return false;
10384 }
10385
10386 if (version >= 114)
10387 {
10388 bool hasQuickBarIndexSaved;
10389
10390 if (!ctx.
Read(hasQuickBarIndexSaved))
10391 {
10393 return false;
10394 }
10395
10396 if (hasQuickBarIndexSaved)
10397 {
10398 int itmQBIndex;
10399
10400
10401 if (!ctx.
Read(itmQBIndex))
10402 {
10404 return false;
10405 }
10406
10407 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10408 if (itmQBIndex != -1 && parentPlayer)
10409 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10410 }
10411 }
10412 else
10413 {
10414
10415 PlayerBase player;
10416 int itemQBIndex;
10417 if (version ==
int.
MAX)
10418 {
10419 if (!ctx.
Read(itemQBIndex))
10420 {
10422 return false;
10423 }
10424 }
10425 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10426 {
10427
10428 if (!ctx.
Read(itemQBIndex))
10429 {
10431 return false;
10432 }
10433 if (itemQBIndex != -1 && player)
10434 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10435 }
10436 }
10437
10438 if (version < 140)
10439 {
10440
10441 if (!LoadVariables(ctx, version))
10442 {
10444 return false;
10445 }
10446 }
10447
10448
10450 {
10452 return false;
10453 }
10454 if (version >= 132)
10455 {
10457 if (raib)
10458 {
10460 {
10462 return false;
10463 }
10464 }
10465 }
10466
10468 return true;
10469 }
10470
10471
10472
10474 {
10475 super.OnStoreSave(ctx);
10476
10477 PlayerBase player;
10478 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10479 {
10481
10482 int itemQBIndex = -1;
10483 itemQBIndex = player.FindQuickBarEntityIndex(this);
10484 ctx.
Write(itemQBIndex);
10485 }
10486 else
10487 {
10489 }
10490
10492
10494 if (raib)
10495 {
10497 }
10498 }
10499
10500
10502 {
10503 super.AfterStoreLoad();
10504
10506 {
10508 }
10509
10511 {
10514 }
10515 }
10516
10518 {
10519 super.EEOnAfterLoad();
10520
10522 {
10524 }
10525
10528 }
10529
10531 {
10532 return false;
10533 }
10534
10535
10536
10538 {
10540 {
10541 #ifdef PLATFORM_CONSOLE
10542
10544 {
10546 if (menu)
10547 {
10549 }
10550 }
10551 #endif
10552 }
10553
10555 {
10558 }
10559
10561 {
10562 SetWeightDirty();
10564 }
10566 {
10569 }
10570
10572 {
10575
10578 }
10580 {
10584 }
10585
10586 super.OnVariablesSynchronized();
10587 }
10588
10589
10590
10592 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10593 {
10594 if (!IsServerCheck(allow_client))
10595 return false;
10596
10598 return false;
10599
10602
10603 if (value <= (min + 0.001))
10604 value = min;
10605
10606 if (value == min)
10607 {
10608 if (destroy_config)
10609 {
10610 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10611 if (dstr)
10612 {
10614 this.Delete();
10615 return true;
10616 }
10617 }
10618 else if (destroy_forced)
10619 {
10621 this.Delete();
10622 return true;
10623 }
10624
10626 }
10627
10630
10632 {
10633 EntityAI parent = GetHierarchyRoot();
10634 InventoryLocation iLoc = new InventoryLocation();
10635 GetInventory().GetCurrentInventoryLocation(iLoc);
10637 {
10638 int iLocSlot = iLoc.
GetSlot();
10640 {
10642 }
10644 {
10646 }
10647 }
10648 }
10649
10651 {
10653
10654 if (delta)
10656 }
10657
10659
10660 return false;
10661 }
10662
10663
10665 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10666 {
10668 }
10669
10671 {
10674 }
10675
10677 {
10680 }
10681
10683 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10684 {
10685 float value_clamped = Math.Clamp(value, 0, 1);
10687 SetQuantity(result, destroy_config, destroy_forced);
10688 }
10689
10690
10693 {
10695 }
10696
10698 {
10700 }
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10712 {
10713 int slot = -1;
10714 GameInventory inventory = GetInventory();
10715 if (inventory)
10716 {
10717 InventoryLocation il = new InventoryLocation;
10720 }
10721
10723 }
10724
10726 {
10727 float quantity_max = 0;
10728
10730 {
10731 if (attSlotID != -1)
10732 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10733
10734 if (quantity_max <= 0)
10736 }
10737
10738 if (quantity_max <= 0)
10740
10741 return quantity_max;
10742 }
10743
10745 {
10747 }
10748
10750 {
10752 }
10753
10754
10756 {
10758 }
10759
10761 {
10763 }
10764
10766 {
10768 }
10769
10770
10772 {
10773
10774 float weightEx = GetWeightEx();
10775 float special = GetInventoryAndCargoWeight();
10776 return weightEx - special;
10777 }
10778
10779
10781 {
10783 }
10784
10786 {
10788 {
10789 #ifdef DEVELOPER
10790 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10791 {
10792 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10794 }
10795 #endif
10796
10797 return GetQuantity() * GetConfigWeightModified();
10798 }
10799 else if (HasEnergyManager())
10800 {
10801 #ifdef DEVELOPER
10802 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10803 {
10804 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10805 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10806 }
10807 #endif
10808 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10809 }
10810 else
10811 {
10812 #ifdef DEVELOPER
10813 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10814 {
10815 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10816 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10817 }
10818 #endif
10819 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10820 }
10821 }
10822
10825 {
10826 int item_count = 0;
10828
10829 GameInventory inventory = GetInventory();
10830 CargoBase cargo = inventory.
GetCargo();
10831 if (cargo != NULL)
10832 {
10834 }
10835
10837 for (int i = 0; i < nAttachments; ++i)
10838 {
10840 if (item)
10841 item_count += item.GetNumberOfItems();
10842 }
10843 return item_count;
10844 }
10845
10848 {
10849 float weight = 0;
10850 float wetness = 1;
10851 if (include_wetness)
10854 {
10855 weight = wetness * m_ConfigWeight;
10856 }
10858 {
10859 weight = 1;
10860 }
10861 return weight;
10862 }
10863
10864
10865
10867 {
10868 GameInventory inventory = GetInventory();
10869 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10870 {
10871 array<EntityAI> items = new array<EntityAI>;
10873 for (int i = 0; i < items.Count(); ++i)
10874 {
10876 if (item)
10877 {
10878 g_Game.ObjectDelete(item);
10879 }
10880 }
10881 }
10882 }
10883
10884
10885
10886
10888 {
10889 float energy = 0;
10890 if (HasEnergyManager())
10891 {
10892 energy = GetCompEM().GetEnergy();
10893 }
10894 return energy;
10895 }
10896
10897
10899 {
10900 super.OnEnergyConsumed();
10901
10903 }
10904
10906 {
10907 super.OnEnergyAdded();
10908
10910 }
10911
10912
10914 {
10915 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10916 {
10918 {
10919 float energy_0to1 = GetCompEM().GetEnergy0To1();
10921 }
10922 }
10923 }
10924
10925
10927 {
10928 return ConfigGetFloat("heatIsolation");
10929 }
10930
10932 {
10934 }
10935
10937 {
10938 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10939 if (
g_Game.ConfigIsExisting(paramPath))
10940 return g_Game.ConfigGetFloat(paramPath);
10941
10942 return 0.0;
10943 }
10944
10946 {
10947 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10948 if (
g_Game.ConfigIsExisting(paramPath))
10949 return g_Game.ConfigGetFloat(paramPath);
10950
10951 return 0.0;
10952 }
10953
10954 override void SetWet(
float value,
bool allow_client =
false)
10955 {
10956 if (!IsServerCheck(allow_client))
10957 return;
10958
10961
10963
10964 m_VarWet = Math.Clamp(value, min, max);
10965
10967 {
10970 }
10971 }
10972
10973 override void AddWet(
float value)
10974 {
10976 }
10977
10979 {
10981 }
10982
10984 {
10986 }
10987
10989 {
10991 }
10992
10994 {
10996 }
10997
10999 {
11001 }
11002
11003 override void OnWetChanged(
float newVal,
float oldVal)
11004 {
11007 if (newLevel != oldLevel)
11008 {
11010 }
11011 }
11012
11014 {
11015 SetWeightDirty();
11016 }
11017
11019 {
11020 return GetWetLevelInternal(
m_VarWet);
11021 }
11022
11023
11024
11026 {
11028 }
11029
11031 {
11033 }
11034
11036 {
11038 }
11039
11041 {
11043 }
11044
11045
11046
11048 {
11049 if (ConfigIsExisting("itemModelLength"))
11050 {
11051 return ConfigGetFloat("itemModelLength");
11052 }
11053 return 0;
11054 }
11055
11057 {
11058 if (ConfigIsExisting("itemAttachOffset"))
11059 {
11060 return ConfigGetFloat("itemAttachOffset");
11061 }
11062 return 0;
11063 }
11064
11065 override void SetCleanness(
int value,
bool allow_client =
false)
11066 {
11067 if (!IsServerCheck(allow_client))
11068 return;
11069
11071
11073
11076 }
11077
11079 {
11081 }
11082
11084 {
11085 return true;
11086 }
11087
11088
11089
11090
11092 {
11094 }
11095
11097 {
11099 }
11100
11101
11102
11103
11104 override void SetColor(
int r,
int g,
int b,
int a)
11105 {
11111 }
11113 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11114 {
11119 }
11120
11122 {
11124 }
11125
11128 {
11129 int r,g,b,a;
11131 r = r/255;
11132 g = g/255;
11133 b = b/255;
11134 a = a/255;
11135 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11136 }
11137
11138
11139
11140 override void SetLiquidType(
int value,
bool allow_client =
false)
11141 {
11142 if (!IsServerCheck(allow_client))
11143 return;
11144
11149 }
11150
11152 {
11153 return ConfigGetInt("varLiquidTypeInit");
11154 }
11155
11157 {
11159 }
11160
11162 {
11164 SetFrozen(false);
11165 }
11166
11169 {
11170 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11171 }
11172
11173
11176 {
11177 PlayerBase nplayer;
11178 if (PlayerBase.CastTo(nplayer, player))
11179 {
11181 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11182 }
11183 }
11184
11185
11188 {
11189 PlayerBase nplayer;
11190 if (PlayerBase.CastTo(nplayer,player))
11191 {
11192 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11193 }
11194
11195 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11196
11197 if (HasEnergyManager())
11198 {
11199 GetCompEM().UpdatePlugState();
11200 }
11201 }
11202
11203
11205 {
11206 super.OnPlacementStarted(player);
11207
11209 }
11210
11211 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11212 {
11214 {
11215 m_AdminLog.OnPlacementComplete(player,
this);
11216 }
11217
11218 super.OnPlacementComplete(player, position, orientation);
11219 }
11220
11221
11222
11223
11224
11226 {
11228 {
11229 return true;
11230 }
11231 else
11232 {
11233 return false;
11234 }
11235 }
11236
11237
11239 {
11241 {
11243 }
11244 }
11245
11246
11248 {
11250 }
11251
11253 {
11255 }
11256
11257 override void InsertAgent(
int agent,
float count = 1)
11258 {
11259 if (count < 1)
11260 return;
11261
11263 }
11264
11267 {
11269 }
11270
11271
11273 {
11275 }
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11319 {
11321 return false;
11322 return true;
11323 }
11324
11326 {
11327
11329 }
11330
11331
11334 {
11335 super.CheckForRoofLimited(timeTresholdMS);
11336
11337 float time =
g_Game.GetTime();
11338 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11339 {
11340 m_PreviousRoofTestTime = time;
11341 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11342 }
11343 }
11344
11345
11347 {
11349 {
11350 return 0;
11351 }
11352
11353 if (GetInventory().GetAttachmentSlotsCount() != 0)
11354 {
11355 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11356 if (filter)
11357 return filter.GetProtectionLevel(type, false, system);
11358 else
11359 return 0;
11360 }
11361
11362 string subclassPath, entryName;
11363
11364 switch (type)
11365 {
11367 entryName = "biological";
11368 break;
11370 entryName = "chemical";
11371 break;
11372 default:
11373 entryName = "biological";
11374 break;
11375 }
11376
11377 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11378
11379 return g_Game.ConfigGetFloat(subclassPath + entryName);
11380 }
11381
11382
11383
11386 {
11387 if (!IsMagazine())
11389
11391 }
11392
11393
11394
11395
11396
11401 {
11402 return true;
11403 }
11404
11406 {
11408 }
11409
11410
11411
11412
11413
11415 {
11416 if (parent)
11417 {
11418 if (parent.IsInherited(DayZInfected))
11419 return true;
11420
11421 if (!parent.IsRuined())
11422 return true;
11423 }
11424
11425 return true;
11426 }
11427
11429 {
11430 if (!super.CanPutAsAttachment(parent))
11431 {
11432 return false;
11433 }
11434
11435 if (!IsRuined() && !parent.IsRuined())
11436 {
11437 return true;
11438 }
11439
11440 return false;
11441 }
11442
11444 {
11445
11446
11447
11448
11449 return super.CanReceiveItemIntoCargo(item);
11450 }
11451
11453 {
11454
11455
11456
11457
11458 GameInventory attachmentInv = attachment.GetInventory();
11460 {
11461 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11462 return false;
11463 }
11464
11465 InventoryLocation loc = new InventoryLocation();
11466 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11467 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11468 return false;
11469
11470 return super.CanReceiveAttachment(attachment, slotId);
11471 }
11472
11474 {
11475 if (!super.CanReleaseAttachment(attachment))
11476 return false;
11477
11478 return GetInventory().AreChildrenAccessible();
11479 }
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11502 {
11503 int id = muzzle_owner.GetMuzzleID();
11504 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11505
11506 if (WPOF_array)
11507 {
11508 for (int i = 0; i < WPOF_array.Count(); i++)
11509 {
11510 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11511
11512 if (WPOF)
11513 {
11514 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11515 }
11516 }
11517 }
11518 }
11519
11520
11522 {
11523 int id = muzzle_owner.GetMuzzleID();
11525
11526 if (WPOBE_array)
11527 {
11528 for (int i = 0; i < WPOBE_array.Count(); i++)
11529 {
11530 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11531
11532 if (WPOBE)
11533 {
11534 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11535 }
11536 }
11537 }
11538 }
11539
11540
11542 {
11543 int id = muzzle_owner.GetMuzzleID();
11544 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11545
11546 if (WPOOH_array)
11547 {
11548 for (int i = 0; i < WPOOH_array.Count(); i++)
11549 {
11550 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11551
11552 if (WPOOH)
11553 {
11554 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11555 }
11556 }
11557 }
11558 }
11559
11560
11562 {
11563 int id = muzzle_owner.GetMuzzleID();
11564 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11565
11566 if (WPOOH_array)
11567 {
11568 for (int i = 0; i < WPOOH_array.Count(); i++)
11569 {
11570 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11571
11572 if (WPOOH)
11573 {
11574 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11575 }
11576 }
11577 }
11578 }
11579
11580
11582 {
11583 int id = muzzle_owner.GetMuzzleID();
11584 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11585
11586 if (WPOOH_array)
11587 {
11588 for (int i = 0; i < WPOOH_array.Count(); i++)
11589 {
11590 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11591
11592 if (WPOOH)
11593 {
11594 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11595 }
11596 }
11597 }
11598 }
11599
11600
11601
11603 {
11605 {
11606 return true;
11607 }
11608
11609 return false;
11610 }
11611
11613 {
11615 {
11616 return true;
11617 }
11618
11619 return false;
11620 }
11621
11623 {
11625 {
11626 return true;
11627 }
11628
11629 return false;
11630 }
11631
11633 {
11634 return false;
11635 }
11636
11639 {
11640 return UATimeSpent.DEFAULT_DEPLOY;
11641 }
11642
11643
11644
11645
11647 {
11649 SetSynchDirty();
11650 }
11651
11653 {
11655 }
11656
11657
11659 {
11660 return false;
11661 }
11662
11665 {
11666 string att_type = "None";
11667
11668 if (ConfigIsExisting("soundAttType"))
11669 {
11670 att_type = ConfigGetString("soundAttType");
11671 }
11672
11674 }
11675
11677 {
11679 }
11680
11681
11682
11683
11684
11690
11692 {
11695
11697 }
11698
11699
11701 {
11703 return;
11704
11706
11709
11712
11713 SoundParameters params = new SoundParameters();
11717 }
11718
11719
11721 {
11723 {
11726
11727 SetSynchDirty();
11728
11731 }
11732 }
11733
11735 {
11737 }
11738
11739
11741 {
11743 return;
11744
11746 SetSynchDirty();
11747
11750 }
11751
11753 {
11756 }
11757
11759 {
11761 }
11762
11763 void OnApply(PlayerBase player);
11764
11766 {
11767 return 1.0;
11768 };
11769
11771 {
11773 }
11774
11776 {
11778 }
11779
11781
11783 {
11784 SetDynamicPhysicsLifeTime(0.01);
11786 }
11787
11789 {
11790 array<string> zone_names = new array<string>;
11791 GetDamageZones(zone_names);
11792 for (int i = 0; i < zone_names.Count(); i++)
11793 {
11794 SetHealthMax(zone_names.Get(i),"Health");
11795 }
11796 SetHealthMax("","Health");
11797 }
11798
11801 {
11802 float global_health = GetHealth01("","Health");
11803 array<string> zones = new array<string>;
11804 GetDamageZones(zones);
11805
11806 for (int i = 0; i < zones.Count(); i++)
11807 {
11808 SetHealth01(zones.Get(i),"Health",global_health);
11809 }
11810 }
11811
11814 {
11815 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11816 }
11817
11819 {
11820 if (!hasRootAsPlayer)
11821 {
11822 if (refParentIB)
11823 {
11824
11825 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11826 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11827
11828 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11829 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11830
11833 }
11834 else
11835 {
11836
11839 }
11840 }
11841 }
11842
11844 {
11846 {
11847 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11848 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11849 {
11850 float heatPermCoef = 1.0;
11852 while (ent)
11853 {
11854 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11855 ent = ent.GetHierarchyParent();
11856 }
11857
11858 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11859 }
11860 }
11861 }
11862
11864 {
11865
11866 EntityAI parent = GetHierarchyParent();
11867 if (!parent)
11868 {
11869 hasParent = false;
11870 hasRootAsPlayer = false;
11871 }
11872 else
11873 {
11874 hasParent = true;
11875 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11876 refParentIB =
ItemBase.Cast(parent);
11877 }
11878 }
11879
11880 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11881 {
11882
11883 }
11884
11886 {
11887
11888 return false;
11889 }
11890
11892 {
11893
11894
11895 return false;
11896 }
11897
11899 {
11900
11901 return false;
11902 }
11903
11906 {
11907 return !GetIsFrozen() &&
IsOpen();
11908 }
11909
11911 {
11912 bool hasParent = false, hasRootAsPlayer = false;
11914
11915 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11916 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11917
11918 if (wwtu || foodDecay)
11919 {
11923
11924 if (processWetness || processTemperature || processDecay)
11925 {
11927
11928 if (processWetness)
11929 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11930
11931 if (processTemperature)
11933
11934 if (processDecay)
11935 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11936 }
11937 }
11938 }
11939
11942 {
11944 }
11945
11947 {
11950
11951 return super.GetTemperatureFreezeThreshold();
11952 }
11953
11955 {
11958
11959 return super.GetTemperatureThawThreshold();
11960 }
11961
11963 {
11966
11967 return super.GetItemOverheatThreshold();
11968 }
11969
11971 {
11973 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11974
11975 return super.GetTemperatureFreezeTime();
11976 }
11977
11979 {
11981 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11982
11983 return super.GetTemperatureThawTime();
11984 }
11985
11990
11992 {
11993 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11994 }
11995
11997 {
11998 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11999 }
12000
12003 {
12005 }
12006
12008 {
12010 }
12011
12013 {
12015 }
12016
12019 {
12020 return null;
12021 }
12022
12025 {
12026 return false;
12027 }
12028
12030 {
12032 {
12035 if (!trg)
12036 {
12038 explosive = this;
12039 }
12040
12041 explosive.PairRemote(trg);
12043
12044 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12045 trg.SetPersistentPairID(persistentID);
12046 explosive.SetPersistentPairID(persistentID);
12047
12048 return true;
12049 }
12050 return false;
12051 }
12052
12055 {
12056 float ret = 1.0;
12059 ret *= GetHealth01();
12060
12061 return ret;
12062 }
12063
12064 #ifdef DEVELOPER
12065 override void SetDebugItem()
12066 {
12067 super.SetDebugItem();
12068 _itemBase = this;
12069 }
12070
12072 {
12073 string text = super.GetDebugText();
12074
12076 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12077
12078 return text;
12079 }
12080 #endif
12081
12083 {
12084 return true;
12085 }
12086
12088
12090
12092 {
12095 }
12096
12097
12105
12121
12122 [
Obsolete(
"Use ItemSoundHandler instead")]
12125 {
12126 if (!
g_Game.IsDedicatedServer())
12127 {
12128 if (ConfigIsExisting("attachSoundSet"))
12129 {
12130 string cfg_path = "";
12131 string soundset = "";
12132 string type_name =
GetType();
12133
12136 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12137 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12138
12139 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12140 {
12141 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12142 {
12143 if (cfg_slot_array[i] == slot_type)
12144 {
12145 soundset = cfg_soundset_array[i];
12146 break;
12147 }
12148 }
12149 }
12150
12151 if (soundset != "")
12152 {
12153 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12155 }
12156 }
12157 }
12158 }
12159
12161}
12162
12164{
12166 if (entity)
12167 {
12168 bool is_item = entity.IsInherited(
ItemBase);
12169 if (is_item && full_quantity)
12170 {
12173 }
12174 }
12175 else
12176 {
12178 return NULL;
12179 }
12180 return entity;
12181}
12182
12184{
12185 if (item)
12186 {
12187 if (health > 0)
12188 item.SetHealth("", "", health);
12189
12190 if (item.CanHaveTemperature())
12191 {
12193 if (item.CanFreeze())
12194 item.SetFrozen(false);
12195 }
12196
12197 if (item.HasEnergyManager())
12198 {
12199 if (quantity >= 0)
12200 {
12201 item.GetCompEM().SetEnergy0To1(quantity);
12202 }
12203 else
12204 {
12206 }
12207 }
12208 else if (item.IsMagazine())
12209 {
12210 Magazine mag = Magazine.Cast(item);
12211 if (quantity >= 0)
12212 {
12213 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12214 }
12215 else
12216 {
12218 }
12219
12220 }
12221 else
12222 {
12223 if (quantity >= 0)
12224 {
12225 item.SetQuantityNormalized(quantity, false);
12226 }
12227 else
12228 {
12230 }
12231
12232 }
12233 }
12234}
12235
12236#ifdef DEVELOPER
12238#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.