7530{
7532 {
7533 return true;
7534 }
7535};
7536
7538{
7539
7540};
7541
7542
7543
7545{
7549
7551
7554
7555
7556
7557
7558
7567
7573
7578
7583
7604 protected bool m_IsResultOfSplit
7605
7607
7612
7613
7614
7616
7620
7621
7622
7624
7627
7628
7629
7635
7636
7644
7647
7648
7650
7651
7653
7654
7659
7660
7665
7667
7668
7670
7671
7673 {
7678
7679 if (!
g_Game.IsDedicatedServer())
7680 {
7682 {
7684
7686 {
7688 }
7689 }
7690
7693 }
7694
7695 m_OldLocation = null;
7696
7698 {
7700 }
7701
7702 if (ConfigIsExisting("headSelectionsToHide"))
7703 {
7706 }
7707
7709 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7710 {
7712 }
7713
7715
7716 m_IsResultOfSplit = false;
7717
7719 }
7720
7722 {
7723 super.InitItemVariables();
7724
7730 m_Count = ConfigGetInt(
"count");
7731
7734
7739
7742
7747
7759
7763
7764
7767 if (ConfigIsExisting("canBeSplit"))
7768 {
7771 }
7772
7774 if (ConfigIsExisting("itemBehaviour"))
7776
7777
7780 RegisterNetSyncVariableInt("m_VarLiquidType");
7781 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7782
7783 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7784 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7785 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7786
7787 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7788 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7789 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7790 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7791
7792 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7793 RegisterNetSyncVariableBool("m_IsTakeable");
7794 RegisterNetSyncVariableBool("m_IsHologram");
7795
7798 {
7801 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7802 }
7803
7805
7807 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7809
7811 }
7812
7814 {
7816 }
7817
7819 {
7822 {
7827 }
7828 }
7829
7830 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7831 {
7833 {
7836 }
7837
7839 }
7840
7842 {
7848 }
7849
7851
7853 {
7855
7856 if (!action)
7857 {
7858 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7859 return;
7860 }
7861
7863 if (!ai)
7864 {
7866 return;
7867 }
7868
7870 if (!action_array)
7871 {
7872 action_array = new array<ActionBase_Basic>;
7874 }
7875 if (LogManager.IsActionLogEnable())
7876 {
7877 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7878 }
7879
7880 if (action_array.Find(action) != -1)
7881 {
7882 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7883 }
7884 else
7885 {
7886 action_array.Insert(action);
7887 }
7888 }
7889
7891 {
7892 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7893 ActionBase action = player.GetActionManager().GetAction(actionName);
7896
7897 if (action_array)
7898 {
7899 action_array.RemoveItem(action);
7900 }
7901 }
7902
7903
7904
7906 {
7907 ActionOverrideData overrideData = new ActionOverrideData();
7911
7913 if (!actionMap)
7914 {
7917 }
7918
7919 actionMap.Insert(this.
Type(), overrideData);
7920
7921 }
7922
7924
7926
7927
7929 {
7932
7935
7936 string config_to_search = "CfgVehicles";
7937 string muzzle_owner_config;
7938
7940 {
7941 if (IsInherited(Weapon))
7942 config_to_search = "CfgWeapons";
7943
7944 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7945
7946 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7947
7948 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7949
7950 if (config_OnFire_subclass_count > 0)
7951 {
7952 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7953
7954 for (int i = 0; i < config_OnFire_subclass_count; i++)
7955 {
7956 string particle_class = "";
7957 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7958 string config_OnFire_entry = config_OnFire_class + particle_class;
7959 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7960 WPOF_array.Insert(WPOF);
7961 }
7962
7963
7965 }
7966 }
7967
7969 {
7970 config_to_search = "CfgWeapons";
7971 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7972
7973 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7974
7975 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7976
7977 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7978 {
7979 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7980
7981 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7982 {
7983 string particle_class2 = "";
7984 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7985 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7986 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7987 WPOBE_array.Insert(WPOBE);
7988 }
7989
7990
7992 }
7993 }
7994 }
7995
7996
7998 {
8001
8003 {
8004 string config_to_search = "CfgVehicles";
8005
8006 if (IsInherited(Weapon))
8007 config_to_search = "CfgWeapons";
8008
8009 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8010 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8011
8012 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8013 {
8014
8016
8018 {
8020 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8022 return;
8023 }
8024
8027
8028
8029
8030 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8031 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8032
8033 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8034 {
8035 string particle_class = "";
8036 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8037 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8038 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8039
8040 if (entry_type == CT_CLASS)
8041 {
8042 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8043 WPOOH_array.Insert(WPOF);
8044 }
8045 }
8046
8047
8049 }
8050 }
8051 }
8052
8054 {
8056 }
8057
8059 {
8061 {
8063
8066
8069
8070 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8071 }
8072 }
8073
8075 {
8077 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8078
8080 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8081
8083 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8084
8086 {
8088 }
8089 }
8090
8092 {
8094 }
8095
8097 {
8100 else
8102
8104 {
8107 }
8108 else
8109 {
8112
8115 }
8116
8118 }
8119
8121 {
8123 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8124 }
8125
8127 {
8129 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8131 }
8132
8134 {
8136 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8137 }
8138
8140 {
8143
8144 OverheatingParticle OP = new OverheatingParticle();
8149
8151 }
8152
8154 {
8157
8158 return -1;
8159 }
8160
8162 {
8164 {
8167
8168 for (int i = count; i > 0; --i)
8169 {
8170 int id = i - 1;
8173
8176
8177 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8178 {
8179 if (p)
8180 {
8183 }
8184 }
8185 }
8186 }
8187 }
8188
8190 {
8192 {
8194 {
8195 int id = i - 1;
8197
8198 if (OP)
8199 {
8201
8202 if (p)
8203 {
8205 }
8206
8207 delete OP;
8208 }
8209 }
8210
8213 }
8214 }
8215
8218 {
8219 return 0.0;
8220 }
8221
8222
8224 {
8225 return 250;
8226 }
8227
8229 {
8230 return 0;
8231 }
8232
8235 {
8237 return true;
8238
8239 return false;
8240 }
8241
8244 {
8247
8249 {
8251 }
8252 else
8253 {
8254
8256 }
8257
8259 }
8260
8267 {
8268 return -1;
8269 }
8270
8271
8272
8273
8275 {
8277 {
8278 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8279 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8280
8281 if (r_index >= 0)
8282 {
8283 InventoryLocation r_il = new InventoryLocation;
8284 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8285
8286 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8289 {
8290 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8291 }
8293 {
8294 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8295 }
8296
8297 }
8298
8299 player.GetHumanInventory().ClearUserReservedLocation(this);
8300 }
8301
8304 }
8305
8306
8307
8308
8310 {
8311 return ItemBase.m_DebugActionsMask;
8312 }
8313
8315 {
8316 return ItemBase.m_DebugActionsMask & mask;
8317 }
8318
8320 {
8321 ItemBase.m_DebugActionsMask = mask;
8322 }
8323
8325 {
8326 ItemBase.m_DebugActionsMask |= mask;
8327 }
8328
8330 {
8331 ItemBase.m_DebugActionsMask &= ~mask;
8332 }
8333
8335 {
8337 {
8339 }
8340 else
8341 {
8343 }
8344 }
8345
8346
8348 {
8349 if (GetEconomyProfile())
8350 {
8351 float q_max = GetEconomyProfile().GetQuantityMax();
8352 if (q_max > 0)
8353 {
8354 float q_min = GetEconomyProfile().GetQuantityMin();
8355 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8356
8358 {
8359 ComponentEnergyManager comp = GetCompEM();
8361 {
8363 }
8364 }
8366 {
8368
8369 }
8370
8371 }
8372 }
8373 }
8374
8377 {
8378 EntityAI parent = GetHierarchyParent();
8379
8380 if (parent)
8381 {
8382 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8383 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8384 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8385 }
8386 }
8387
8390 {
8391 EntityAI parent = GetHierarchyParent();
8392
8393 if (parent)
8394 {
8395 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8396 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8397 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8398 }
8399 }
8400
8402 {
8403
8404
8405
8406
8408
8410 {
8411 if (ScriptInputUserData.CanStoreInputUserData())
8412 {
8413 ScriptInputUserData ctx = new ScriptInputUserData;
8419 ctx.
Write(use_stack_max);
8422
8424 {
8425 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8426 }
8427 }
8428 }
8429 else if (!
g_Game.IsMultiplayer())
8430 {
8432 }
8433 }
8434
8436 {
8438 }
8439
8441 {
8443 }
8444
8446 {
8448 }
8449
8451 {
8452
8453 return false;
8454 }
8455
8457 {
8458 return false;
8459 }
8460
8464 {
8465 return false;
8466 }
8467
8469 {
8470 return "";
8471 }
8472
8474
8476 {
8477 return false;
8478 }
8479
8481 {
8482 return true;
8483 }
8484
8485
8486
8488 {
8489 return true;
8490 }
8491
8493 {
8494 return true;
8495 }
8496
8498 {
8499 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8501 }
8502
8504 {
8506 }
8507
8509 {
8511 if (!is_being_placed)
8513 SetSynchDirty();
8514 }
8515
8516
8518
8520 {
8522 }
8523
8525 {
8527 }
8528
8530 {
8531 return 1;
8532 }
8533
8535 {
8536 return false;
8537 }
8538
8540 {
8542 SetSynchDirty();
8543 }
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8580 {
8581 super.OnMovedInsideCargo(container);
8582
8583 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8584 }
8585
8586 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8587 {
8588 super.EEItemLocationChanged(oldLoc, newLoc);
8589
8590 PlayerBase newPlayer = null;
8591 PlayerBase oldPlayer = null;
8592
8593 if (newLoc.GetParent())
8594 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8595
8596 if (oldLoc.GetParent())
8597 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8598
8600 {
8601 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8602
8603 if (rIndex >= 0)
8604 {
8605 InventoryLocation rIl = new InventoryLocation;
8606 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8607
8608 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8611 {
8612 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8613 }
8615 {
8617 }
8618
8619 }
8620 }
8621
8623 {
8624 if (newPlayer)
8625 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8626
8627 if (newPlayer == oldPlayer)
8628 {
8629 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8630 {
8632 {
8633 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8634 {
8635 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8636 }
8637 }
8638 else
8639 {
8640 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8641 }
8642 }
8643
8644 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8645 {
8646 int type = oldLoc.GetType();
8648 {
8649 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8650 }
8652 {
8653 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8654 }
8655 }
8656 if (!m_OldLocation)
8657 {
8658 m_OldLocation = new InventoryLocation;
8659 }
8660 m_OldLocation.Copy(oldLoc);
8661 }
8662 else
8663 {
8664 if (m_OldLocation)
8665 {
8666 m_OldLocation.Reset();
8667 }
8668 }
8669
8670 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8671 }
8672 else
8673 {
8674 if (newPlayer)
8675 {
8676 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8677 if (resIndex >= 0)
8678 {
8679 InventoryLocation il = new InventoryLocation;
8680 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8682 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8685 {
8686 il.
GetParent().GetOnReleaseLock().Invoke(it);
8687 }
8689 {
8691 }
8692
8693 }
8694 }
8696 {
8697
8699 }
8700
8701 if (m_OldLocation)
8702 {
8703 m_OldLocation.Reset();
8704 }
8705 }
8706
8708 {
8709 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8710 }
8711
8713 {
8714 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8715 }
8716 }
8717
8718 override void EOnContact(IEntity other, Contact extra)
8719 {
8721 {
8722 int liquidType = -1;
8724 if (impactSpeed > 0.0)
8725 {
8727 #ifndef SERVER
8729 #else
8731 SetSynchDirty();
8732 #endif
8734 }
8735 }
8736
8737 #ifdef SERVER
8738 if (GetCompEM() && GetCompEM().IsPlugged())
8739 {
8740 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8741 GetCompEM().UnplugThis();
8742 }
8743 #endif
8744 }
8745
8747
8749 {
8751 }
8752
8754 {
8755
8756 }
8757
8759 {
8760 super.OnItemLocationChanged(old_owner, new_owner);
8761
8762 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8763 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8764
8765 if (!relatedPlayer && playerNew)
8766 relatedPlayer = playerNew;
8767
8768 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8769 {
8771 if (actionMgr)
8772 {
8773 ActionBase currentAction = actionMgr.GetRunningAction();
8774 if (currentAction)
8776 }
8777 }
8778
8779 Man ownerPlayerOld = null;
8780 Man ownerPlayerNew = null;
8781
8782 if (old_owner)
8783 {
8784 if (old_owner.
IsMan())
8785 {
8786 ownerPlayerOld = Man.Cast(old_owner);
8787 }
8788 else
8789 {
8790 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8791 }
8792 }
8793 else
8794 {
8796 {
8798
8799 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8800 {
8801 GetCompEM().UnplugThis();
8802 }
8803 }
8804 }
8805
8806 if (new_owner)
8807 {
8808 if (new_owner.
IsMan())
8809 {
8810 ownerPlayerNew = Man.Cast(new_owner);
8811 }
8812 else
8813 {
8814 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8815 }
8816 }
8817
8818 if (ownerPlayerOld != ownerPlayerNew)
8819 {
8820 if (ownerPlayerOld)
8821 {
8822 array<EntityAI> subItemsExit = new array<EntityAI>;
8824 for (int i = 0; i < subItemsExit.Count(); i++)
8825 {
8828 }
8829 }
8830
8831 if (ownerPlayerNew)
8832 {
8833 array<EntityAI> subItemsEnter = new array<EntityAI>;
8835 for (int j = 0; j < subItemsEnter.Count(); j++)
8836 {
8839 }
8840 }
8841 }
8842 else if (ownerPlayerNew != null)
8843 {
8844 PlayerBase nplayer;
8845 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8846 {
8847 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8849 for (int k = 0; k < subItemsUpdate.Count(); k++)
8850 {
8852 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8853 }
8854 }
8855 }
8856
8857 if (old_owner)
8858 old_owner.OnChildItemRemoved(this);
8859 if (new_owner)
8860 new_owner.OnChildItemReceived(this);
8861 }
8862
8863
8865 {
8866 super.EEDelete(parent);
8867 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8868 if (player)
8869 {
8871
8872 if (player.IsAlive())
8873 {
8874 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8875 if (r_index >= 0)
8876 {
8877 InventoryLocation r_il = new InventoryLocation;
8878 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8879
8880 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8883 {
8884 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8885 }
8887 {
8888 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8889 }
8890
8891 }
8892
8893 player.RemoveQuickBarEntityShortcut(this);
8894 }
8895 }
8896 }
8897
8899 {
8900 super.EEKilled(killer);
8901
8904 {
8905 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8906 {
8907 if (IsMagazine())
8908 {
8909 if (Magazine.Cast(this).GetAmmoCount() > 0)
8910 {
8912 }
8913 }
8914 else
8915 {
8917 }
8918 }
8919 }
8920 }
8921
8923 {
8924 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8925
8926 super.OnWasAttached(parent, slot_id);
8927
8930
8933 }
8934
8936 {
8937 super.OnWasDetached(parent, slot_id);
8938
8941
8944 }
8945
8947 {
8948 int idx;
8951
8952 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8953 if (inventory_slots.Count() < 1)
8954 {
8955 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8956 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8957 }
8958 else
8959 {
8960 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8961 }
8962
8963 idx = inventory_slots.Find(slot);
8964 if (idx < 0)
8965 return "";
8966
8967 return attach_types.Get(idx);
8968 }
8969
8971 {
8972 int idx = -1;
8973 string slot;
8974
8977
8978 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8979 if (inventory_slots.Count() < 1)
8980 {
8981 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8982 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8983 }
8984 else
8985 {
8986 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8987 if (detach_types.Count() < 1)
8988 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8989 }
8990
8991 for (int i = 0; i < inventory_slots.Count(); i++)
8992 {
8993 slot = inventory_slots.Get(i);
8994 }
8995
8996 if (slot != "")
8997 {
8998 if (detach_types.Count() == 1)
8999 idx = 0;
9000 else
9001 idx = inventory_slots.Find(slot);
9002 }
9003 if (idx < 0)
9004 return "";
9005
9006 return detach_types.Get(idx);
9007 }
9008
9010 {
9011
9013
9014
9015 float min_time = 1;
9016 float max_time = 3;
9017 float delay = Math.RandomFloat(min_time, max_time);
9018
9019 explode_timer.Run(delay, this, "DoAmmoExplosion");
9020 }
9021
9023 {
9024 Magazine magazine = Magazine.Cast(this);
9025 int pop_sounds_count = 6;
9026 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9027
9028
9029 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9030 string sound_name = pop_sounds[ sound_idx ];
9031 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9032
9033
9034 magazine.ServerAddAmmoCount(-1);
9035
9036
9037 float min_temp_to_explode = 100;
9038
9039 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9040 {
9042 }
9043 }
9044
9045
9046 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9047 {
9048 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9049
9050 const int CHANCE_DAMAGE_CARGO = 4;
9051 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9052 const int CHANCE_DAMAGE_NOTHING = 2;
9053
9055 {
9056 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9057 int chances;
9058 int rnd;
9059
9060 if (GetInventory().GetCargo())
9061 {
9062 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9063 rnd = Math.RandomInt(0,chances);
9064
9065 if (rnd < CHANCE_DAMAGE_CARGO)
9066 {
9068 }
9069 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9070 {
9072 }
9073 }
9074 else
9075 {
9076 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9077 rnd = Math.RandomInt(0,chances);
9078
9079 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9080 {
9082 }
9083 }
9084 }
9085 }
9086
9088 {
9089 CargoBase cargo = GetInventory().GetCargo();
9090 if (cargo)
9091 {
9093 if (item_count > 0)
9094 {
9095 int random_pick = Math.RandomInt(0, item_count);
9097 if (!item.IsExplosive())
9098 {
9099 item.AddHealth("","",damage);
9100 return true;
9101 }
9102 }
9103 }
9104 return false;
9105 }
9106
9108 {
9109 GameInventory inventory = GetInventory();
9111 if (attachment_count > 0)
9112 {
9113 int random_pick = Math.RandomInt(0, attachment_count);
9115 if (!attachment.IsExplosive())
9116 {
9117 attachment.AddHealth("","",damage);
9118 return true;
9119 }
9120 }
9121 return false;
9122 }
9123
9125 {
9127 }
9128
9130 {
9132 return GetInventory().CanRemoveEntity();
9133
9134 return false;
9135 }
9136
9138 {
9139
9141 return false;
9142
9143
9145 return false;
9146
9147
9148
9150 if (delta == 0)
9151 return false;
9152
9153
9154 return true;
9155 }
9156
9158 {
9160 {
9161 if (ScriptInputUserData.CanStoreInputUserData())
9162 {
9163 ScriptInputUserData ctx = new ScriptInputUserData;
9168 ctx.
Write(destination_entity);
9172 }
9173 }
9174 else if (!
g_Game.IsMultiplayer())
9175 {
9177 }
9178 }
9179
9181 {
9182 float split_quantity_new;
9186 InventoryLocation loc = new InventoryLocation;
9187
9188 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9189 {
9191 split_quantity_new = stack_max;
9192 else
9194
9196 {
9197 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9198 if (new_item)
9199 {
9200 new_item.SetResultOfSplit(true);
9201 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9203 new_item.
SetQuantity(split_quantity_new,
false,
true);
9204 }
9205 }
9206 }
9207 else if (destination_entity && slot_id == -1)
9208 {
9209 if (quantity > stack_max)
9210 split_quantity_new = stack_max;
9211 else
9212 split_quantity_new = quantity;
9213
9215 {
9216 GameInventory destinationInventory = destination_entity.GetInventory();
9218 {
9221 }
9222
9223 if (new_item)
9224 {
9225 new_item.SetResultOfSplit(true);
9226 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9228 new_item.
SetQuantity(split_quantity_new,
false,
true);
9229 }
9230 }
9231 }
9232 else
9233 {
9234 if (stack_max != 0)
9235 {
9237 {
9239 }
9240
9241 if (split_quantity_new == 0)
9242 {
9243 if (!
g_Game.IsMultiplayer())
9244 player.PhysicalPredictiveDropItem(this);
9245 else
9246 player.ServerDropEntity(this);
9247 return;
9248 }
9249
9251 {
9253
9254 if (new_item)
9255 {
9256 new_item.SetResultOfSplit(true);
9257 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9260 new_item.PlaceOnSurface();
9261 }
9262 }
9263 }
9264 }
9265 }
9266
9268 {
9269 float split_quantity_new;
9273 InventoryLocation loc = new InventoryLocation;
9274
9275 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9276 {
9278 split_quantity_new = stack_max;
9279 else
9281
9283 {
9284 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9285 if (new_item)
9286 {
9287 new_item.SetResultOfSplit(true);
9288 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9290 new_item.
SetQuantity(split_quantity_new,
false,
true);
9291 }
9292 }
9293 }
9294 else if (destination_entity && slot_id == -1)
9295 {
9296 if (quantity > stack_max)
9297 split_quantity_new = stack_max;
9298 else
9299 split_quantity_new = quantity;
9300
9302 {
9303 GameInventory destinationInventory = destination_entity.GetInventory();
9305 {
9308 }
9309
9310 if (new_item)
9311 {
9312 new_item.SetResultOfSplit(true);
9313 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9315 new_item.
SetQuantity(split_quantity_new,
false,
true);
9316 }
9317 }
9318 }
9319 else
9320 {
9321 if (stack_max != 0)
9322 {
9324 {
9326 }
9327
9329 {
9331
9332 if (new_item)
9333 {
9334 new_item.SetResultOfSplit(true);
9335 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9338 new_item.PlaceOnSurface();
9339 }
9340 }
9341 }
9342 }
9343 }
9344
9346 {
9348 {
9349 if (ScriptInputUserData.CanStoreInputUserData())
9350 {
9351 ScriptInputUserData ctx = new ScriptInputUserData;
9356 dst.WriteToContext(ctx);
9358 }
9359 }
9360 else if (!
g_Game.IsMultiplayer())
9361 {
9363 }
9364 }
9365
9367 {
9369 {
9370 if (ScriptInputUserData.CanStoreInputUserData())
9371 {
9372 ScriptInputUserData ctx = new ScriptInputUserData;
9377 ctx.
Write(destination_entity);
9383 }
9384 }
9385 else if (!
g_Game.IsMultiplayer())
9386 {
9388 }
9389 }
9390
9392 {
9394 }
9395
9397 {
9399 float split_quantity_new;
9401 if (dst.IsValid())
9402 {
9403 int slot_id = dst.GetSlot();
9405
9406 if (quantity > stack_max)
9407 split_quantity_new = stack_max;
9408 else
9409 split_quantity_new = quantity;
9410
9412 {
9414
9415 if (new_item)
9416 {
9417 new_item.SetResultOfSplit(true);
9418 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9420 new_item.
SetQuantity(split_quantity_new,
false,
true);
9421 }
9422
9423 return new_item;
9424 }
9425 }
9426
9427 return null;
9428 }
9429
9431 {
9433 float split_quantity_new;
9435 if (destination_entity)
9436 {
9438 if (quantity > stackable)
9439 split_quantity_new = stackable;
9440 else
9441 split_quantity_new = quantity;
9442
9444 {
9445 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9446 if (new_item)
9447 {
9448 new_item.SetResultOfSplit(true);
9449 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9451 new_item.
SetQuantity(split_quantity_new,
false,
true);
9452 }
9453 }
9454 }
9455 }
9456
9458 {
9460 {
9461 if (ScriptInputUserData.CanStoreInputUserData())
9462 {
9463 ScriptInputUserData ctx = new ScriptInputUserData;
9468 ItemBase destination_entity =
this;
9469 ctx.
Write(destination_entity);
9473 }
9474 }
9475 else if (!
g_Game.IsMultiplayer())
9476 {
9478 }
9479 }
9480
9482 {
9484 float split_quantity_new;
9486 if (player)
9487 {
9489 if (quantity > stackable)
9490 split_quantity_new = stackable;
9491 else
9492 split_quantity_new = quantity;
9493
9495 {
9496 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9497 new_item =
ItemBase.Cast(in_hands);
9498 if (new_item)
9499 {
9500 new_item.SetResultOfSplit(true);
9501 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9503 new_item.SetQuantity(split_quantity_new, false, true);
9504 }
9505 }
9506 }
9507 }
9508
9510 {
9512 float split_quantity_new = Math.Floor(quantity * 0.5);
9513
9515 return;
9516
9518
9519 if (new_item)
9520 {
9521 if (new_item.GetQuantityMax() < split_quantity_new)
9522 {
9523 split_quantity_new = new_item.GetQuantityMax();
9524 }
9525
9526 new_item.SetResultOfSplit(true);
9527 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9528
9530 {
9533 }
9534 else
9535 {
9537 new_item.
SetQuantity(split_quantity_new,
false,
true);
9538 }
9539 }
9540 }
9541
9543 {
9545 float split_quantity_new = Math.Floor(quantity / 2);
9546
9548 return;
9549
9550 InventoryLocation invloc = new InventoryLocation;
9552
9554 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9555
9556 if (new_item)
9557 {
9558 if (new_item.GetQuantityMax() < split_quantity_new)
9559 {
9560 split_quantity_new = new_item.GetQuantityMax();
9561 }
9563 {
9566 }
9567 else if (split_quantity_new > 1)
9568 {
9570 new_item.
SetQuantity(split_quantity_new,
false,
true);
9571 }
9572 }
9573 }
9574
9577 {
9578 SetWeightDirty();
9580
9581 if (parent)
9582 parent.OnAttachmentQuantityChangedEx(this, delta);
9583
9585 {
9587 {
9589 }
9591 {
9592 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9594 }
9595 }
9596 }
9597
9600 {
9601
9602 }
9603
9606 {
9608 }
9609
9611 {
9612 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9613
9615 {
9616 if (newLevel == GameConstants.STATE_RUINED)
9617 {
9619 EntityAI parent = GetHierarchyParent();
9620 if (parent && parent.IsFireplace())
9621 {
9622 CargoBase cargo = GetInventory().GetCargo();
9623 if (cargo)
9624 {
9626 {
9628 }
9629 }
9630 }
9631 }
9632
9634 {
9635
9637 return;
9638 }
9639
9640 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9641 {
9643 }
9644 }
9645 }
9646
9647
9649 {
9650 super.OnRightClick();
9651
9653 {
9655 {
9656 if (ScriptInputUserData.CanStoreInputUserData())
9657 {
9658 EntityAI root = GetHierarchyRoot();
9659 Man playerOwner = GetHierarchyRootPlayer();
9660 InventoryLocation dst = new InventoryLocation;
9661
9662
9663 if (!playerOwner && root && root == this)
9664 {
9666 }
9667 else
9668 {
9669
9670 GetInventory().GetCurrentInventoryLocation(dst);
9672 {
9673 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9675 {
9677 }
9678 else
9679 {
9681
9682
9683 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9684 {
9686 }
9687 else
9688 {
9689 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9690 }
9691 }
9692 }
9693 }
9694
9695 ScriptInputUserData ctx = new ScriptInputUserData;
9703 }
9704 }
9705 else if (!
g_Game.IsMultiplayer())
9706 {
9708 }
9709 }
9710 }
9711
9713 {
9714 if (root)
9715 {
9716 vector m4[4];
9717 root.GetTransform(m4);
9718 dst.SetGround(this, m4);
9719 }
9720 else
9721 {
9722 GetInventory().GetCurrentInventoryLocation(dst);
9723 }
9724 }
9725
9726 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9727 {
9728
9729 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9730 return false;
9731
9732 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9733 return false;
9734
9735
9737 return false;
9738
9739
9740 Magazine mag = Magazine.Cast(this);
9741 if (mag)
9742 {
9743 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9744 return false;
9745
9746 if (stack_max_limit)
9747 {
9748 Magazine other_mag = Magazine.Cast(other_item);
9749 if (other_item)
9750 {
9751 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9752 return false;
9753 }
9754
9755 }
9756 }
9757 else
9758 {
9759
9761 return false;
9762
9764 return false;
9765 }
9766
9767 PlayerBase player = null;
9768 if (CastTo(player, GetHierarchyRootPlayer()))
9769 {
9770 if (player.GetInventory().HasAttachment(this))
9771 return false;
9772
9773 if (player.IsItemsToDelete())
9774 return false;
9775 }
9776
9777 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9778 return false;
9779
9780 int slotID;
9782 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9783 return false;
9784
9785 return true;
9786 }
9787
9789 {
9791 }
9792
9794 {
9795 return m_IsResultOfSplit;
9796 }
9797
9799 {
9800 m_IsResultOfSplit = value;
9801 }
9802
9804 {
9806 }
9807
9809 {
9810 float other_item_quantity = other_item.GetQuantity();
9811 float this_free_space;
9812
9814
9816
9817 if (other_item_quantity > this_free_space)
9818 {
9819 return this_free_space;
9820 }
9821 else
9822 {
9823 return other_item_quantity;
9824 }
9825 }
9826
9828 {
9830 }
9831
9833 {
9835 return;
9836
9837 if (!IsMagazine() && other_item)
9838 {
9840 if (quantity_used != 0)
9841 {
9842 float hp1 = GetHealth01("","");
9843 float hp2 = other_item.GetHealth01("","");
9844 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9845 hpResult = hpResult / (
GetQuantity() + quantity_used);
9846
9847 hpResult *= GetMaxHealth();
9848 Math.Round(hpResult);
9849 SetHealth("", "Health", hpResult);
9850
9852 other_item.AddQuantity(-quantity_used);
9853 }
9854 }
9856 }
9857
9859 {
9860 #ifdef SERVER
9861 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9862 GetHierarchyParent().IncreaseLifetimeUp();
9863 #endif
9864 };
9865
9867 {
9868 PlayerBase p = PlayerBase.Cast(player);
9869
9870 array<int> recipesIds = p.m_Recipes;
9871 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9872 if (moduleRecipesManager)
9873 {
9874 EntityAI itemInHands = player.GetEntityInHands();
9875 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9876 }
9877
9878 for (int i = 0;i < recipesIds.Count(); i++)
9879 {
9880 int key = recipesIds.Get(i);
9881 string recipeName = moduleRecipesManager.GetRecipeName(key);
9883 }
9884 }
9885
9886
9887 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9888 {
9889 super.GetDebugActions(outputList);
9890
9891
9897
9898
9903
9908
9909
9913
9914
9916 {
9920 }
9921
9924
9925
9929
9931
9932 InventoryLocation loc = new InventoryLocation();
9933 GetInventory().GetCurrentInventoryLocation(loc);
9935 {
9936 if (Gizmo_IsSupported())
9939 }
9940
9942 }
9943
9944
9945
9946
9948 {
9949 super.OnAction(action_id, player, ctx);
9950
9952 {
9953 switch (action_id)
9954 {
9958 return true;
9962 return true;
9963 }
9964 }
9965
9967 {
9968 switch (action_id)
9969 {
9971 Delete();
9972 return true;
9973 }
9974 }
9975
9976 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9977 {
9978 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9979 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9980 PlayerBase p = PlayerBase.Cast(player);
9981 if (
EActions.RECIPES_RANGE_START < 1000)
9982 {
9983 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9984 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9985 }
9986 }
9987 #ifndef SERVER
9988 else if (action_id ==
EActions.WATCH_PLAYER)
9989 {
9990 PluginDeveloper.SetDeveloperItemClientEx(player);
9991 }
9992 #endif
9994 {
9995 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9996 {
9997 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9998 OnDebugButtonPressServer(id + 1);
9999 }
10000
10001 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10002 {
10003 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10005 }
10006
10007 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10008 {
10009 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10011 }
10012
10013 else if (action_id ==
EActions.ADD_QUANTITY)
10014 {
10015 if (IsMagazine())
10016 {
10017 Magazine mag = Magazine.Cast(this);
10018 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10019 }
10020 else
10021 {
10023 }
10024
10025 if (m_EM)
10026 {
10027 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10028 }
10029
10030 }
10031
10032 else if (action_id ==
EActions.REMOVE_QUANTITY)
10033 {
10034 if (IsMagazine())
10035 {
10036 Magazine mag2 = Magazine.Cast(this);
10037 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10038 }
10039 else
10040 {
10042 }
10043 if (m_EM)
10044 {
10045 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10046 }
10047
10048 }
10049
10050 else if (action_id ==
EActions.SET_QUANTITY_0)
10051 {
10053
10054 if (m_EM)
10055 {
10056 m_EM.SetEnergy(0);
10057 }
10058 }
10059
10060 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10061 {
10063
10064 if (m_EM)
10065 {
10066 m_EM.SetEnergy(m_EM.GetEnergyMax());
10067 }
10068 }
10069
10070 else if (action_id ==
EActions.ADD_HEALTH)
10071 {
10072 AddHealth("","",GetMaxHealth("","Health")/5);
10073 }
10074 else if (action_id ==
EActions.REMOVE_HEALTH)
10075 {
10076 AddHealth("","",-GetMaxHealth("","Health")/5);
10077 }
10078 else if (action_id ==
EActions.DESTROY_HEALTH)
10079 {
10080 SetHealth01("","",0);
10081 }
10082 else if (action_id ==
EActions.WATCH_ITEM)
10083 {
10085 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10086 #ifdef DEVELOPER
10087 SetDebugDeveloper_item(this);
10088 #endif
10089 }
10090
10091 else if (action_id ==
EActions.ADD_TEMPERATURE)
10092 {
10093 AddTemperature(20);
10094
10095 }
10096
10097 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10098 {
10099 AddTemperature(-20);
10100
10101 }
10102
10103 else if (action_id ==
EActions.FLIP_FROZEN)
10104 {
10105 SetFrozen(!GetIsFrozen());
10106
10107 }
10108
10109 else if (action_id ==
EActions.ADD_WETNESS)
10110 {
10112
10113 }
10114
10115 else if (action_id ==
EActions.REMOVE_WETNESS)
10116 {
10118
10119 }
10120
10121 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10122 {
10125
10126
10127 }
10128
10129 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10130 {
10133 }
10134
10135 else if (action_id ==
EActions.MAKE_SPECIAL)
10136 {
10137 auto debugParams = DebugSpawnParams.WithPlayer(player);
10138 OnDebugSpawnEx(debugParams);
10139 }
10140
10141 }
10142
10143
10144 return false;
10145 }
10146
10147
10148
10149
10153
10156
10157
10158
10160 {
10161 return false;
10162 }
10163
10164
10166 {
10167 return true;
10168 }
10169
10170
10172 {
10173 return true;
10174 }
10175
10176
10177
10179 {
10180 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10181 return g_Game.ConfigIsExisting(config_path);
10182 }
10183
10186 {
10187 return null;
10188 }
10189
10191 {
10192 return false;
10193 }
10194
10196 {
10197 return false;
10198 }
10199
10203
10204
10206 {
10207 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10208 return module_repairing.CanRepair(this, item_repair_kit);
10209 }
10210
10211
10212 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10213 {
10214 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10215 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10216 }
10217
10218
10220 {
10221
10222
10223
10224
10225
10226
10227
10228
10229 return 1;
10230 }
10231
10232
10233
10235 {
10237 }
10238
10239
10240
10242 {
10244 }
10245
10246
10255 {
10256 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10257
10258 if (player)
10259 {
10260 player.MessageStatus(text);
10261 }
10262 }
10263
10264
10273 {
10274 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10275
10276 if (player)
10277 {
10278 player.MessageAction(text);
10279 }
10280 }
10281
10282
10291 {
10292 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10293
10294 if (player)
10295 {
10296 player.MessageFriendly(text);
10297 }
10298 }
10299
10300
10309 {
10310 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10311
10312 if (player)
10313 {
10314 player.MessageImportant(text);
10315 }
10316 }
10317
10319 {
10320 return true;
10321 }
10322
10323
10324 override bool KindOf(
string tag)
10325 {
10326 bool found = false;
10327 string item_name = this.
GetType();
10329 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10330
10331 int array_size = item_tag_array.Count();
10332 for (int i = 0; i < array_size; i++)
10333 {
10334 if (item_tag_array.Get(i) == tag)
10335 {
10336 found = true;
10337 break;
10338 }
10339 }
10340 return found;
10341 }
10342
10343
10345 {
10346
10347 super.OnRPC(sender, rpc_type,ctx);
10348
10349
10350 switch (rpc_type)
10351 {
10352 #ifndef SERVER
10353 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10354 Param2<bool, string> p = new Param2<bool, string>(false, "");
10355
10357 return;
10358
10359 bool play = p.param1;
10360 string soundSet = p.param2;
10361
10362 if (play)
10363 {
10365 {
10367 {
10369 }
10370 }
10371 else
10372 {
10374 }
10375 }
10376 else
10377 {
10379 }
10380
10381 break;
10382 #endif
10383
10384 }
10385
10387 {
10389 }
10390 }
10391
10392
10393
10394
10396 {
10397 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10398 return plugin.GetID(
name);
10399 }
10400
10402 {
10403 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10404 return plugin.GetName(id);
10405 }
10406
10409 {
10410
10411
10412 int varFlags;
10413 if (!ctx.
Read(varFlags))
10414 return;
10415
10416 if (varFlags & ItemVariableFlags.FLOAT)
10417 {
10419 }
10420 }
10421
10423 {
10424
10425 super.SerializeNumericalVars(floats_out);
10426
10427
10428
10430 {
10432 }
10433
10435 {
10437 }
10438
10440 {
10442 }
10443
10445 {
10450 }
10451
10453 {
10455 }
10456 }
10457
10459 {
10460
10461 super.DeSerializeNumericalVars(floats);
10462
10463
10464 int index = 0;
10465 int mask = Math.Round(floats.Get(index));
10466
10467 index++;
10468
10470 {
10472 {
10474 }
10475 else
10476 {
10477 float quantity = floats.Get(index);
10478 SetQuantity(quantity,
true,
false,
false,
false);
10479 }
10480 index++;
10481 }
10482
10484 {
10485 float wet = floats.Get(index);
10487 index++;
10488 }
10489
10491 {
10492 int liquidtype = Math.Round(floats.Get(index));
10494 index++;
10495 }
10496
10498 {
10500 index++;
10502 index++;
10504 index++;
10506 index++;
10507 }
10508
10510 {
10511 int cleanness = Math.Round(floats.Get(index));
10513 index++;
10514 }
10515 }
10516
10518 {
10519 super.WriteVarsToCTX(ctx);
10520
10521
10523 {
10525 }
10526
10528 {
10530 }
10531
10533 {
10535 }
10536
10538 {
10539 int r,g,b,a;
10545 }
10546
10548 {
10550 }
10551 }
10552
10554 {
10555 if (!super.ReadVarsFromCTX(ctx,version))
10556 return false;
10557
10558 int intValue;
10559 float value;
10560
10561 if (version < 140)
10562 {
10563 if (!ctx.
Read(intValue))
10564 return false;
10565
10566 m_VariablesMask = intValue;
10567 }
10568
10570 {
10571 if (!ctx.
Read(value))
10572 return false;
10573
10575 {
10577 }
10578 else
10579 {
10581 }
10582 }
10583
10584 if (version < 140)
10585 {
10587 {
10588 if (!ctx.
Read(value))
10589 return false;
10590 SetTemperatureDirect(value);
10591 }
10592 }
10593
10595 {
10596 if (!ctx.
Read(value))
10597 return false;
10599 }
10600
10602 {
10603 if (!ctx.
Read(intValue))
10604 return false;
10606 }
10607
10609 {
10610 int r,g,b,a;
10612 return false;
10614 return false;
10616 return false;
10618 return false;
10619
10621 }
10622
10624 {
10625 if (!ctx.
Read(intValue))
10626 return false;
10628 }
10629
10630 if (version >= 138 && version < 140)
10631 {
10633 {
10634 if (!ctx.
Read(intValue))
10635 return false;
10636 SetFrozen(intValue);
10637 }
10638 }
10639
10640 return true;
10641 }
10642
10643
10645 {
10648 {
10650 }
10651
10652 if (!super.OnStoreLoad(ctx, version))
10653 {
10655 return false;
10656 }
10657
10658 if (version >= 114)
10659 {
10660 bool hasQuickBarIndexSaved;
10661
10662 if (!ctx.
Read(hasQuickBarIndexSaved))
10663 {
10665 return false;
10666 }
10667
10668 if (hasQuickBarIndexSaved)
10669 {
10670 int itmQBIndex;
10671
10672
10673 if (!ctx.
Read(itmQBIndex))
10674 {
10676 return false;
10677 }
10678
10679 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10680 if (itmQBIndex != -1 && parentPlayer)
10681 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10682 }
10683 }
10684 else
10685 {
10686
10687 PlayerBase player;
10688 int itemQBIndex;
10689 if (version ==
int.
MAX)
10690 {
10691 if (!ctx.
Read(itemQBIndex))
10692 {
10694 return false;
10695 }
10696 }
10697 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10698 {
10699
10700 if (!ctx.
Read(itemQBIndex))
10701 {
10703 return false;
10704 }
10705 if (itemQBIndex != -1 && player)
10706 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10707 }
10708 }
10709
10710 if (version < 140)
10711 {
10712
10713 if (!LoadVariables(ctx, version))
10714 {
10716 return false;
10717 }
10718 }
10719
10720
10722 {
10724 return false;
10725 }
10726 if (version >= 132)
10727 {
10729 if (raib)
10730 {
10732 {
10734 return false;
10735 }
10736 }
10737 }
10738
10740 return true;
10741 }
10742
10743
10744
10746 {
10747 super.OnStoreSave(ctx);
10748
10749 PlayerBase player;
10750 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10751 {
10753
10754 int itemQBIndex = -1;
10755 itemQBIndex = player.FindQuickBarEntityIndex(this);
10756 ctx.
Write(itemQBIndex);
10757 }
10758 else
10759 {
10761 }
10762
10764
10766 if (raib)
10767 {
10769 }
10770 }
10771
10772
10774 {
10775 super.AfterStoreLoad();
10776
10778 {
10780 }
10781
10783 {
10786 }
10787 }
10788
10790 {
10791 super.EEOnAfterLoad();
10792
10794 {
10796 }
10797
10800 }
10801
10803 {
10804 return false;
10805 }
10806
10807
10808
10810 {
10812 {
10813 #ifdef PLATFORM_CONSOLE
10814
10816 {
10818 if (menu)
10819 {
10821 }
10822 }
10823 #endif
10824 }
10825
10827 {
10830 }
10831
10833 {
10834 SetWeightDirty();
10836 }
10838 {
10841 }
10842
10844 {
10847
10850 }
10852 {
10856 }
10857
10858 super.OnVariablesSynchronized();
10859 }
10860
10861
10862
10864 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10865 {
10866 if (!IsServerCheck(allow_client))
10867 return false;
10868
10870 return false;
10871
10874
10875 if (value <= (min + 0.001))
10876 value = min;
10877
10878 if (value == min)
10879 {
10880 if (destroy_config)
10881 {
10882 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10883 if (dstr)
10884 {
10886 this.Delete();
10887 return true;
10888 }
10889 }
10890 else if (destroy_forced)
10891 {
10893 this.Delete();
10894 return true;
10895 }
10896
10898 }
10899
10902
10904 {
10905 EntityAI parent = GetHierarchyRoot();
10906 InventoryLocation iLoc = new InventoryLocation();
10907 GetInventory().GetCurrentInventoryLocation(iLoc);
10909 {
10910 int iLocSlot = iLoc.
GetSlot();
10912 {
10914 }
10916 {
10918 }
10919 }
10920 }
10921
10923 {
10925
10926 if (delta)
10928 }
10929
10931
10932 return false;
10933 }
10934
10935
10937 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10938 {
10940 }
10941
10943 {
10946 }
10947
10949 {
10952 }
10953
10955 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10956 {
10957 float value_clamped = Math.Clamp(value, 0, 1);
10959 SetQuantity(result, destroy_config, destroy_forced);
10960 }
10961
10962
10965 {
10967 }
10968
10970 {
10972 }
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10984 {
10985 int slot = -1;
10986 GameInventory inventory = GetInventory();
10987 if (inventory)
10988 {
10989 InventoryLocation il = new InventoryLocation;
10992 }
10993
10995 }
10996
10998 {
10999 float quantity_max = 0;
11000
11002 {
11003 if (attSlotID != -1)
11004 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11005
11006 if (quantity_max <= 0)
11008 }
11009
11010 if (quantity_max <= 0)
11012
11013 return quantity_max;
11014 }
11015
11017 {
11019 }
11020
11022 {
11024 }
11025
11026
11028 {
11030 }
11031
11033 {
11035 }
11036
11038 {
11040 }
11041
11042
11044 {
11045
11046 float weightEx = GetWeightEx();
11047 float special = GetInventoryAndCargoWeight();
11048 return weightEx - special;
11049 }
11050
11051
11053 {
11055 }
11056
11058 {
11060 {
11061 #ifdef DEVELOPER
11062 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11063 {
11064 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11066 }
11067 #endif
11068
11069 return GetQuantity() * GetConfigWeightModified();
11070 }
11071 else if (HasEnergyManager())
11072 {
11073 #ifdef DEVELOPER
11074 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11075 {
11076 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11077 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11078 }
11079 #endif
11080 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11081 }
11082 else
11083 {
11084 #ifdef DEVELOPER
11085 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11086 {
11087 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11088 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11089 }
11090 #endif
11091 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11092 }
11093 }
11094
11097 {
11098 int item_count = 0;
11100
11101 GameInventory inventory = GetInventory();
11102 CargoBase cargo = inventory.
GetCargo();
11103 if (cargo != NULL)
11104 {
11106 }
11107
11109 for (int i = 0; i < nAttachments; ++i)
11110 {
11112 if (item)
11113 item_count += item.GetNumberOfItems();
11114 }
11115 return item_count;
11116 }
11117
11120 {
11121 float weight = 0;
11122 float wetness = 1;
11123 if (include_wetness)
11126 {
11127 weight = wetness * m_ConfigWeight;
11128 }
11130 {
11131 weight = 1;
11132 }
11133 return weight;
11134 }
11135
11136
11137
11139 {
11140 GameInventory inventory = GetInventory();
11141 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11142 {
11143 array<EntityAI> items = new array<EntityAI>;
11145 for (int i = 0; i < items.Count(); ++i)
11146 {
11148 if (item)
11149 {
11150 g_Game.ObjectDelete(item);
11151 }
11152 }
11153 }
11154 }
11155
11156
11157
11158
11160 {
11161 float energy = 0;
11162 if (HasEnergyManager())
11163 {
11164 energy = GetCompEM().GetEnergy();
11165 }
11166 return energy;
11167 }
11168
11169
11171 {
11172 super.OnEnergyConsumed();
11173
11175 }
11176
11178 {
11179 super.OnEnergyAdded();
11180
11182 }
11183
11184
11186 {
11187 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11188 {
11190 {
11191 float energy_0to1 = GetCompEM().GetEnergy0To1();
11193 }
11194 }
11195 }
11196
11197
11199 {
11200 return ConfigGetFloat("heatIsolation");
11201 }
11202
11204 {
11206 }
11207
11209 {
11210 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11211 if (
g_Game.ConfigIsExisting(paramPath))
11212 return g_Game.ConfigGetFloat(paramPath);
11213
11214 return 0.0;
11215 }
11216
11218 {
11219 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11220 if (
g_Game.ConfigIsExisting(paramPath))
11221 return g_Game.ConfigGetFloat(paramPath);
11222
11223 return 0.0;
11224 }
11225
11226 override void SetWet(
float value,
bool allow_client =
false)
11227 {
11228 if (!IsServerCheck(allow_client))
11229 return;
11230
11233
11235
11236 m_VarWet = Math.Clamp(value, min, max);
11237
11239 {
11242 }
11243 }
11244
11245 override void AddWet(
float value)
11246 {
11248 }
11249
11251 {
11253 }
11254
11256 {
11258 }
11259
11261 {
11263 }
11264
11266 {
11268 }
11269
11271 {
11273 }
11274
11275 override void OnWetChanged(
float newVal,
float oldVal)
11276 {
11279 if (newLevel != oldLevel)
11280 {
11282 }
11283 }
11284
11286 {
11287 SetWeightDirty();
11288 }
11289
11291 {
11292 return GetWetLevelInternal(
m_VarWet);
11293 }
11294
11295
11296
11298 {
11300 }
11301
11303 {
11305 }
11306
11308 {
11310 }
11311
11313 {
11315 }
11316
11317
11318
11320 {
11321 if (ConfigIsExisting("itemModelLength"))
11322 {
11323 return ConfigGetFloat("itemModelLength");
11324 }
11325 return 0;
11326 }
11327
11329 {
11330 if (ConfigIsExisting("itemAttachOffset"))
11331 {
11332 return ConfigGetFloat("itemAttachOffset");
11333 }
11334 return 0;
11335 }
11336
11337 override void SetCleanness(
int value,
bool allow_client =
false)
11338 {
11339 if (!IsServerCheck(allow_client))
11340 return;
11341
11343
11345
11348 }
11349
11351 {
11353 }
11354
11356 {
11357 return true;
11358 }
11359
11360
11361
11362
11364 {
11366 }
11367
11369 {
11371 }
11372
11373
11374
11375
11376 override void SetColor(
int r,
int g,
int b,
int a)
11377 {
11383 }
11385 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11386 {
11391 }
11392
11394 {
11396 }
11397
11400 {
11401 int r,g,b,a;
11403 r = r/255;
11404 g = g/255;
11405 b = b/255;
11406 a = a/255;
11407 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11408 }
11409
11410
11411
11412 override void SetLiquidType(
int value,
bool allow_client =
false)
11413 {
11414 if (!IsServerCheck(allow_client))
11415 return;
11416
11421 }
11422
11424 {
11425 return ConfigGetInt("varLiquidTypeInit");
11426 }
11427
11429 {
11431 }
11432
11434 {
11436 SetFrozen(false);
11437 }
11438
11441 {
11442 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11443 }
11444
11445
11448 {
11449 PlayerBase nplayer;
11450 if (PlayerBase.CastTo(nplayer, player))
11451 {
11453 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11454 }
11455 }
11456
11457
11460 {
11461 PlayerBase nplayer;
11462 if (PlayerBase.CastTo(nplayer,player))
11463 {
11464 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11465 }
11466
11467 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11468
11469 if (HasEnergyManager())
11470 {
11471 GetCompEM().UpdatePlugState();
11472 }
11473 }
11474
11475
11477 {
11478 super.OnPlacementStarted(player);
11479
11481 }
11482
11483 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11484 {
11486 {
11487 m_AdminLog.OnPlacementComplete(player,
this);
11488 }
11489
11490 super.OnPlacementComplete(player, position, orientation);
11491 }
11492
11493
11494
11495
11496
11498 {
11500 {
11501 return true;
11502 }
11503 else
11504 {
11505 return false;
11506 }
11507 }
11508
11509
11511 {
11513 {
11515 }
11516 }
11517
11518
11520 {
11522 }
11523
11525 {
11527 }
11528
11529 override void InsertAgent(
int agent,
float count = 1)
11530 {
11531 if (count < 1)
11532 return;
11533
11535 }
11536
11539 {
11541 }
11542
11543
11545 {
11547 }
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11591 {
11593 return false;
11594 return true;
11595 }
11596
11598 {
11599
11601 }
11602
11603
11606 {
11607 super.CheckForRoofLimited(timeTresholdMS);
11608
11609 float time =
g_Game.GetTime();
11610 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11611 {
11612 m_PreviousRoofTestTime = time;
11613 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11614 }
11615 }
11616
11617
11619 {
11621 {
11622 return 0;
11623 }
11624
11625 if (GetInventory().GetAttachmentSlotsCount() != 0)
11626 {
11627 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11628 if (filter)
11629 return filter.GetProtectionLevel(type, false, system);
11630 else
11631 return 0;
11632 }
11633
11634 string subclassPath, entryName;
11635
11636 switch (type)
11637 {
11639 entryName = "biological";
11640 break;
11642 entryName = "chemical";
11643 break;
11644 default:
11645 entryName = "biological";
11646 break;
11647 }
11648
11649 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11650
11651 return g_Game.ConfigGetFloat(subclassPath + entryName);
11652 }
11653
11654
11655
11658 {
11659 if (!IsMagazine())
11661
11663 }
11664
11665
11666
11667
11668
11673 {
11674 return true;
11675 }
11676
11678 {
11680 }
11681
11682
11683
11684
11685
11687 {
11688 if (parent)
11689 {
11690 if (parent.IsInherited(DayZInfected))
11691 return true;
11692
11693 if (!parent.IsRuined())
11694 return true;
11695 }
11696
11697 return true;
11698 }
11699
11701 {
11702 if (!super.CanPutAsAttachment(parent))
11703 {
11704 return false;
11705 }
11706
11707 if (!IsRuined() && !parent.IsRuined())
11708 {
11709 return true;
11710 }
11711
11712 return false;
11713 }
11714
11716 {
11717
11718
11719
11720
11721 return super.CanReceiveItemIntoCargo(item);
11722 }
11723
11725 {
11726
11727
11728
11729
11730 GameInventory attachmentInv = attachment.GetInventory();
11732 {
11733 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11734 return false;
11735 }
11736
11737 InventoryLocation loc = new InventoryLocation();
11738 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11739 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11740 return false;
11741
11742 return super.CanReceiveAttachment(attachment, slotId);
11743 }
11744
11746 {
11747 if (!super.CanReleaseAttachment(attachment))
11748 return false;
11749
11750 return GetInventory().AreChildrenAccessible();
11751 }
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11774 {
11775 int id = muzzle_owner.GetMuzzleID();
11776 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11777
11778 if (WPOF_array)
11779 {
11780 for (int i = 0; i < WPOF_array.Count(); i++)
11781 {
11782 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11783
11784 if (WPOF)
11785 {
11786 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11787 }
11788 }
11789 }
11790 }
11791
11792
11794 {
11795 int id = muzzle_owner.GetMuzzleID();
11797
11798 if (WPOBE_array)
11799 {
11800 for (int i = 0; i < WPOBE_array.Count(); i++)
11801 {
11802 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11803
11804 if (WPOBE)
11805 {
11806 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11807 }
11808 }
11809 }
11810 }
11811
11812
11814 {
11815 int id = muzzle_owner.GetMuzzleID();
11816 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11817
11818 if (WPOOH_array)
11819 {
11820 for (int i = 0; i < WPOOH_array.Count(); i++)
11821 {
11822 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11823
11824 if (WPOOH)
11825 {
11826 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11827 }
11828 }
11829 }
11830 }
11831
11832
11834 {
11835 int id = muzzle_owner.GetMuzzleID();
11836 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11837
11838 if (WPOOH_array)
11839 {
11840 for (int i = 0; i < WPOOH_array.Count(); i++)
11841 {
11842 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11843
11844 if (WPOOH)
11845 {
11846 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11847 }
11848 }
11849 }
11850 }
11851
11852
11854 {
11855 int id = muzzle_owner.GetMuzzleID();
11856 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11857
11858 if (WPOOH_array)
11859 {
11860 for (int i = 0; i < WPOOH_array.Count(); i++)
11861 {
11862 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11863
11864 if (WPOOH)
11865 {
11866 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11867 }
11868 }
11869 }
11870 }
11871
11872
11873
11875 {
11877 {
11878 return true;
11879 }
11880
11881 return false;
11882 }
11883
11885 {
11887 {
11888 return true;
11889 }
11890
11891 return false;
11892 }
11893
11895 {
11897 {
11898 return true;
11899 }
11900
11901 return false;
11902 }
11903
11905 {
11906 return false;
11907 }
11908
11911 {
11912 return UATimeSpent.DEFAULT_DEPLOY;
11913 }
11914
11915
11916
11917
11919 {
11921 SetSynchDirty();
11922 }
11923
11925 {
11927 }
11928
11929
11931 {
11932 return false;
11933 }
11934
11937 {
11938 string att_type = "None";
11939
11940 if (ConfigIsExisting("soundAttType"))
11941 {
11942 att_type = ConfigGetString("soundAttType");
11943 }
11944
11946 }
11947
11949 {
11951 }
11952
11953
11954
11955
11956
11962
11964 {
11967
11969 }
11970
11971
11973 {
11975 return;
11976
11978
11981
11984
11985 SoundParameters params = new SoundParameters();
11989 }
11990
11991
11993 {
11995 {
11998
11999 SetSynchDirty();
12000
12003 }
12004 }
12005
12007 {
12009 }
12010
12011
12013 {
12015 return;
12016
12018 SetSynchDirty();
12019
12022 }
12023
12025 {
12028 }
12029
12031 {
12033 }
12034
12035 void OnApply(PlayerBase player);
12036
12038 {
12039 return 1.0;
12040 };
12041
12043 {
12045 }
12046
12048 {
12050 }
12051
12053
12055 {
12056 SetDynamicPhysicsLifeTime(0.01);
12058 }
12059
12061 {
12062 array<string> zone_names = new array<string>;
12063 GetDamageZones(zone_names);
12064 for (int i = 0; i < zone_names.Count(); i++)
12065 {
12066 SetHealthMax(zone_names.Get(i),"Health");
12067 }
12068 SetHealthMax("","Health");
12069 }
12070
12073 {
12074 float global_health = GetHealth01("","Health");
12075 array<string> zones = new array<string>;
12076 GetDamageZones(zones);
12077
12078 for (int i = 0; i < zones.Count(); i++)
12079 {
12080 SetHealth01(zones.Get(i),"Health",global_health);
12081 }
12082 }
12083
12086 {
12087 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12088 }
12089
12091 {
12092 if (!hasRootAsPlayer)
12093 {
12094 if (refParentIB)
12095 {
12096
12097 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12098 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12099
12100 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12101 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12102
12105 }
12106 else
12107 {
12108
12111 }
12112 }
12113 }
12114
12116 {
12118 {
12119 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12120 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12121 {
12122 float heatPermCoef = 1.0;
12124 while (ent)
12125 {
12126 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12127 ent = ent.GetHierarchyParent();
12128 }
12129
12130 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12131 }
12132 }
12133 }
12134
12136 {
12137
12138 EntityAI parent = GetHierarchyParent();
12139 if (!parent)
12140 {
12141 hasParent = false;
12142 hasRootAsPlayer = false;
12143 }
12144 else
12145 {
12146 hasParent = true;
12147 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12148 refParentIB =
ItemBase.Cast(parent);
12149 }
12150 }
12151
12152 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12153 {
12154
12155 }
12156
12158 {
12159
12160 return false;
12161 }
12162
12164 {
12165
12166
12167 return false;
12168 }
12169
12171 {
12172
12173 return false;
12174 }
12175
12178 {
12179 return !GetIsFrozen() &&
IsOpen();
12180 }
12181
12183 {
12184 bool hasParent = false, hasRootAsPlayer = false;
12186
12187 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12188 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12189
12190 if (wwtu || foodDecay)
12191 {
12195
12196 if (processWetness || processTemperature || processDecay)
12197 {
12199
12200 if (processWetness)
12201 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12202
12203 if (processTemperature)
12205
12206 if (processDecay)
12207 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12208 }
12209 }
12210 }
12211
12214 {
12216 }
12217
12219 {
12222
12223 return super.GetTemperatureFreezeThreshold();
12224 }
12225
12227 {
12230
12231 return super.GetTemperatureThawThreshold();
12232 }
12233
12235 {
12238
12239 return super.GetItemOverheatThreshold();
12240 }
12241
12243 {
12245 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12246
12247 return super.GetTemperatureFreezeTime();
12248 }
12249
12251 {
12253 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12254
12255 return super.GetTemperatureThawTime();
12256 }
12257
12262
12264 {
12265 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12266 }
12267
12269 {
12270 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12271 }
12272
12275 {
12277 }
12278
12280 {
12282 }
12283
12285 {
12287 }
12288
12291 {
12292 return null;
12293 }
12294
12297 {
12298 return false;
12299 }
12300
12302 {
12304 {
12307 if (!trg)
12308 {
12310 explosive = this;
12311 }
12312
12313 explosive.PairRemote(trg);
12315
12316 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12317 trg.SetPersistentPairID(persistentID);
12318 explosive.SetPersistentPairID(persistentID);
12319
12320 return true;
12321 }
12322 return false;
12323 }
12324
12327 {
12328 float ret = 1.0;
12331 ret *= GetHealth01();
12332
12333 return ret;
12334 }
12335
12336 #ifdef DEVELOPER
12337 override void SetDebugItem()
12338 {
12339 super.SetDebugItem();
12340 _itemBase = this;
12341 }
12342
12344 {
12345 string text = super.GetDebugText();
12346
12348 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12349
12350 return text;
12351 }
12352 #endif
12353
12355 {
12356 return true;
12357 }
12358
12360
12362
12364 {
12367 }
12368
12369
12377
12393
12394 [
Obsolete(
"Use ItemSoundHandler instead")]
12397 {
12398 if (!
g_Game.IsDedicatedServer())
12399 {
12400 if (ConfigIsExisting("attachSoundSet"))
12401 {
12402 string cfg_path = "";
12403 string soundset = "";
12404 string type_name =
GetType();
12405
12408 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12409 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12410
12411 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12412 {
12413 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12414 {
12415 if (cfg_slot_array[i] == slot_type)
12416 {
12417 soundset = cfg_soundset_array[i];
12418 break;
12419 }
12420 }
12421 }
12422
12423 if (soundset != "")
12424 {
12425 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12427 }
12428 }
12429 }
12430 }
12431
12433}
12434
12436{
12438 if (entity)
12439 {
12440 bool is_item = entity.IsInherited(
ItemBase);
12441 if (is_item && full_quantity)
12442 {
12445 }
12446 }
12447 else
12448 {
12450 return NULL;
12451 }
12452 return entity;
12453}
12454
12456{
12457 if (item)
12458 {
12459 if (health > 0)
12460 item.SetHealth("", "", health);
12461
12462 if (item.CanHaveTemperature())
12463 {
12465 if (item.CanFreeze())
12466 item.SetFrozen(false);
12467 }
12468
12469 if (item.HasEnergyManager())
12470 {
12471 if (quantity >= 0)
12472 {
12473 item.GetCompEM().SetEnergy0To1(quantity);
12474 }
12475 else
12476 {
12478 }
12479 }
12480 else if (item.IsMagazine())
12481 {
12482 Magazine mag = Magazine.Cast(item);
12483 if (quantity >= 0)
12484 {
12485 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12486 }
12487 else
12488 {
12490 }
12491
12492 }
12493 else
12494 {
12495 if (quantity >= 0)
12496 {
12497 item.SetQuantityNormalized(quantity, false);
12498 }
12499 else
12500 {
12502 }
12503
12504 }
12505 }
12506}
12507
12508#ifdef DEVELOPER
12510#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.