7715{
7717 {
7718 return true;
7719 }
7720};
7721
7723{
7724
7725};
7726
7727
7728
7730{
7734
7736
7739
7740
7741
7742
7743
7752
7758
7763
7768
7789 protected bool m_IsResultOfSplit
7790
7792
7797
7798
7799
7801
7805
7806
7807
7809
7812
7813
7814
7820
7821
7829
7832
7833
7835
7836
7838
7839
7844
7845
7850
7852
7853
7855
7856
7858 {
7863
7864 if (!
g_Game.IsDedicatedServer())
7865 {
7867 {
7869
7871 {
7873 }
7874 }
7875
7878 }
7879
7880 m_OldLocation = null;
7881
7883 {
7885 }
7886
7887 if (ConfigIsExisting("headSelectionsToHide"))
7888 {
7891 }
7892
7894 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7895 {
7897 }
7898
7900
7901 m_IsResultOfSplit = false;
7902
7904 }
7905
7907 {
7908 super.InitItemVariables();
7909
7915 m_Count = ConfigGetInt(
"count");
7916
7919
7924
7927
7932
7944
7948
7949
7952 if (ConfigIsExisting("canBeSplit"))
7953 {
7956 }
7957
7959 if (ConfigIsExisting("itemBehaviour"))
7961
7962
7965 RegisterNetSyncVariableInt("m_VarLiquidType");
7966 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7967
7968 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7969 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7970 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7971
7972 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7973 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7974 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7975 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7976
7977 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7978 RegisterNetSyncVariableBool("m_IsTakeable");
7979 RegisterNetSyncVariableBool("m_IsHologram");
7980
7983 {
7986 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7987 }
7988
7990
7992 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7994
7996 }
7997
7999 {
8001 }
8002
8004 {
8007 {
8012 }
8013 }
8014
8015 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8016 {
8018 {
8021 }
8022
8024 }
8025
8027 {
8033 }
8034
8036
8038 {
8040
8041 if (!action)
8042 {
8043 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8044 return;
8045 }
8046
8048 if (!ai)
8049 {
8051 return;
8052 }
8053
8055 if (!action_array)
8056 {
8057 action_array = new array<ActionBase_Basic>;
8059 }
8060 if (LogManager.IsActionLogEnable())
8061 {
8062 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8063 }
8064
8065 if (action_array.Find(action) != -1)
8066 {
8067 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8068 }
8069 else
8070 {
8071 action_array.Insert(action);
8072 }
8073 }
8074
8076 {
8077 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8078 ActionBase action = player.GetActionManager().GetAction(actionName);
8081
8082 if (action_array)
8083 {
8084 action_array.RemoveItem(action);
8085 }
8086 }
8087
8088
8089
8091 {
8092 ActionOverrideData overrideData = new ActionOverrideData();
8096
8098 if (!actionMap)
8099 {
8102 }
8103
8104 actionMap.Insert(this.
Type(), overrideData);
8105
8106 }
8107
8109
8111
8112
8114 {
8117
8120
8121 string config_to_search = "CfgVehicles";
8122 string muzzle_owner_config;
8123
8125 {
8126 if (IsInherited(Weapon))
8127 config_to_search = "CfgWeapons";
8128
8129 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8130
8131 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8132
8133 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8134
8135 if (config_OnFire_subclass_count > 0)
8136 {
8137 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8138
8139 for (int i = 0; i < config_OnFire_subclass_count; i++)
8140 {
8141 string particle_class = "";
8142 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8143 string config_OnFire_entry = config_OnFire_class + particle_class;
8144 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8145 WPOF_array.Insert(WPOF);
8146 }
8147
8148
8150 }
8151 }
8152
8154 {
8155 config_to_search = "CfgWeapons";
8156 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8157
8158 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8159
8160 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8161
8162 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8163 {
8164 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8165
8166 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8167 {
8168 string particle_class2 = "";
8169 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8170 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8171 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8172 WPOBE_array.Insert(WPOBE);
8173 }
8174
8175
8177 }
8178 }
8179 }
8180
8181
8183 {
8186
8188 {
8189 string config_to_search = "CfgVehicles";
8190
8191 if (IsInherited(Weapon))
8192 config_to_search = "CfgWeapons";
8193
8194 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8195 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8196
8197 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8198 {
8199
8201
8203 {
8205 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8207 return;
8208 }
8209
8212
8213
8214
8215 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8216 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8217
8218 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8219 {
8220 string particle_class = "";
8221 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8222 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8223 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8224
8225 if (entry_type == CT_CLASS)
8226 {
8227 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8228 WPOOH_array.Insert(WPOF);
8229 }
8230 }
8231
8232
8234 }
8235 }
8236 }
8237
8239 {
8241 }
8242
8244 {
8246 {
8248
8251
8254
8255 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8256 }
8257 }
8258
8260 {
8262 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8263
8265 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8266
8268 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8269
8271 {
8273 }
8274 }
8275
8277 {
8279 }
8280
8282 {
8285 else
8287
8289 {
8292 }
8293 else
8294 {
8297
8300 }
8301
8303 }
8304
8306 {
8308 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8309 }
8310
8312 {
8314 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8316 }
8317
8319 {
8321 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8322 }
8323
8325 {
8328
8329 OverheatingParticle OP = new OverheatingParticle();
8334
8336 }
8337
8339 {
8342
8343 return -1;
8344 }
8345
8347 {
8349 {
8352
8353 for (int i = count; i > 0; --i)
8354 {
8355 int id = i - 1;
8358
8361
8362 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8363 {
8364 if (p)
8365 {
8368 }
8369 }
8370 }
8371 }
8372 }
8373
8375 {
8377 {
8379 {
8380 int id = i - 1;
8382
8383 if (OP)
8384 {
8386
8387 if (p)
8388 {
8390 }
8391
8392 delete OP;
8393 }
8394 }
8395
8398 }
8399 }
8400
8403 {
8404 return 0.0;
8405 }
8406
8407
8409 {
8410 return 250;
8411 }
8412
8414 {
8415 return 0;
8416 }
8417
8420 {
8422 return true;
8423
8424 return false;
8425 }
8426
8429 {
8432
8434 {
8436 }
8437 else
8438 {
8439
8441 }
8442
8444 }
8445
8452 {
8453 return -1;
8454 }
8455
8456
8457
8458
8460 {
8462 {
8463 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8464 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8465
8466 if (r_index >= 0)
8467 {
8468 InventoryLocation r_il = new InventoryLocation;
8469 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8470
8471 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8474 {
8475 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8476 }
8478 {
8479 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8480 }
8481
8482 }
8483
8484 player.GetHumanInventory().ClearUserReservedLocation(this);
8485 }
8486
8489 }
8490
8491
8492
8493
8495 {
8496 return ItemBase.m_DebugActionsMask;
8497 }
8498
8500 {
8501 return ItemBase.m_DebugActionsMask & mask;
8502 }
8503
8505 {
8506 ItemBase.m_DebugActionsMask = mask;
8507 }
8508
8510 {
8511 ItemBase.m_DebugActionsMask |= mask;
8512 }
8513
8515 {
8516 ItemBase.m_DebugActionsMask &= ~mask;
8517 }
8518
8520 {
8522 {
8524 }
8525 else
8526 {
8528 }
8529 }
8530
8531
8533 {
8534 if (GetEconomyProfile())
8535 {
8536 float q_max = GetEconomyProfile().GetQuantityMax();
8537 if (q_max > 0)
8538 {
8539 float q_min = GetEconomyProfile().GetQuantityMin();
8540 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8541
8543 {
8544 ComponentEnergyManager comp = GetCompEM();
8546 {
8548 }
8549 }
8551 {
8553
8554 }
8555
8556 }
8557 }
8558 }
8559
8562 {
8563 EntityAI parent = GetHierarchyParent();
8564
8565 if (parent)
8566 {
8567 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8568 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8569 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8570 }
8571 }
8572
8575 {
8576 EntityAI parent = GetHierarchyParent();
8577
8578 if (parent)
8579 {
8580 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8581 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8582 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8583 }
8584 }
8585
8587 {
8588
8589
8590
8591
8593
8595 {
8596 if (ScriptInputUserData.CanStoreInputUserData())
8597 {
8598 ScriptInputUserData ctx = new ScriptInputUserData;
8604 ctx.
Write(use_stack_max);
8607
8609 {
8610 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8611 }
8612 }
8613 }
8614 else if (!
g_Game.IsMultiplayer())
8615 {
8617 }
8618 }
8619
8621 {
8623 }
8624
8626 {
8628 }
8629
8631 {
8633 }
8634
8636 {
8637
8638 return false;
8639 }
8640
8642 {
8643 return false;
8644 }
8645
8649 {
8650 return false;
8651 }
8652
8654 {
8655 return "";
8656 }
8657
8659
8661 {
8662 return false;
8663 }
8664
8666 {
8667 return true;
8668 }
8669
8670
8671
8673 {
8674 return true;
8675 }
8676
8678 {
8679 return true;
8680 }
8681
8683 {
8684 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8686 }
8687
8689 {
8691 }
8692
8694 {
8696 if (!is_being_placed)
8698 SetSynchDirty();
8699 }
8700
8701
8703
8705 {
8707 }
8708
8710 {
8712 }
8713
8715 {
8716 return 1;
8717 }
8718
8720 {
8721 return false;
8722 }
8723
8725 {
8727 SetSynchDirty();
8728 }
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8765 {
8766 super.OnMovedInsideCargo(container);
8767
8768 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8769 }
8770
8771 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8772 {
8773 super.EEItemLocationChanged(oldLoc, newLoc);
8774
8775 PlayerBase newPlayer = null;
8776 PlayerBase oldPlayer = null;
8777
8778 if (newLoc.GetParent())
8779 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8780
8781 if (oldLoc.GetParent())
8782 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8783
8785 {
8786 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8787
8788 if (rIndex >= 0)
8789 {
8790 InventoryLocation rIl = new InventoryLocation;
8791 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8792
8793 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8796 {
8797 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8798 }
8800 {
8802 }
8803
8804 }
8805 }
8806
8808 {
8809 if (newPlayer)
8810 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8811
8812 if (newPlayer == oldPlayer)
8813 {
8814 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8815 {
8817 {
8818 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8819 {
8820 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8821 }
8822 }
8823 else
8824 {
8825 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8826 }
8827 }
8828
8829 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8830 {
8831 int type = oldLoc.GetType();
8833 {
8834 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8835 }
8837 {
8838 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8839 }
8840 }
8841 if (!m_OldLocation)
8842 {
8843 m_OldLocation = new InventoryLocation;
8844 }
8845 m_OldLocation.Copy(oldLoc);
8846 }
8847 else
8848 {
8849 if (m_OldLocation)
8850 {
8851 m_OldLocation.Reset();
8852 }
8853 }
8854
8855 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8856 }
8857 else
8858 {
8859 if (newPlayer)
8860 {
8861 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8862 if (resIndex >= 0)
8863 {
8864 InventoryLocation il = new InventoryLocation;
8865 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8867 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8870 {
8871 il.
GetParent().GetOnReleaseLock().Invoke(it);
8872 }
8874 {
8876 }
8877
8878 }
8879 }
8881 {
8882
8884 }
8885
8886 if (m_OldLocation)
8887 {
8888 m_OldLocation.Reset();
8889 }
8890 }
8891
8893 {
8894 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8895 }
8896
8898 {
8899 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8900 }
8901 }
8902
8903 override void EOnContact(IEntity other, Contact extra)
8904 {
8906 {
8907 int liquidType = -1;
8909 if (impactSpeed > 0.0)
8910 {
8912 #ifndef SERVER
8914 #else
8916 SetSynchDirty();
8917 #endif
8919 }
8920 }
8921
8922 #ifdef SERVER
8923 if (GetCompEM() && GetCompEM().IsPlugged())
8924 {
8925 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8926 GetCompEM().UnplugThis();
8927 }
8928 #endif
8929 }
8930
8932
8934 {
8936 }
8937
8939 {
8940
8941 }
8942
8944 {
8945 super.OnItemLocationChanged(old_owner, new_owner);
8946
8947 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8948 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8949
8950 if (!relatedPlayer && playerNew)
8951 relatedPlayer = playerNew;
8952
8953 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8954 {
8956 if (actionMgr)
8957 {
8958 ActionBase currentAction = actionMgr.GetRunningAction();
8959 if (currentAction)
8961 }
8962 }
8963
8964 Man ownerPlayerOld = null;
8965 Man ownerPlayerNew = null;
8966
8967 if (old_owner)
8968 {
8969 if (old_owner.
IsMan())
8970 {
8971 ownerPlayerOld = Man.Cast(old_owner);
8972 }
8973 else
8974 {
8975 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8976 }
8977 }
8978 else
8979 {
8981 {
8983
8984 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8985 {
8986 GetCompEM().UnplugThis();
8987 }
8988 }
8989 }
8990
8991 if (new_owner)
8992 {
8993 if (new_owner.
IsMan())
8994 {
8995 ownerPlayerNew = Man.Cast(new_owner);
8996 }
8997 else
8998 {
8999 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9000 }
9001 }
9002
9003 if (ownerPlayerOld != ownerPlayerNew)
9004 {
9005 if (ownerPlayerOld)
9006 {
9007 array<EntityAI> subItemsExit = new array<EntityAI>;
9009 for (int i = 0; i < subItemsExit.Count(); i++)
9010 {
9013 }
9014 }
9015
9016 if (ownerPlayerNew)
9017 {
9018 array<EntityAI> subItemsEnter = new array<EntityAI>;
9020 for (int j = 0; j < subItemsEnter.Count(); j++)
9021 {
9024 }
9025 }
9026 }
9027 else if (ownerPlayerNew != null)
9028 {
9029 PlayerBase nplayer;
9030 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9031 {
9032 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9034 for (int k = 0; k < subItemsUpdate.Count(); k++)
9035 {
9037 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9038 }
9039 }
9040 }
9041
9042 if (old_owner)
9043 old_owner.OnChildItemRemoved(this);
9044 if (new_owner)
9045 new_owner.OnChildItemReceived(this);
9046 }
9047
9048
9050 {
9051 super.EEDelete(parent);
9052 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9053 if (player)
9054 {
9056
9057 if (player.IsAlive())
9058 {
9059 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9060 if (r_index >= 0)
9061 {
9062 InventoryLocation r_il = new InventoryLocation;
9063 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9064
9065 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9068 {
9069 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9070 }
9072 {
9073 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9074 }
9075
9076 }
9077
9078 player.RemoveQuickBarEntityShortcut(this);
9079 }
9080 }
9081 }
9082
9084 {
9085 super.EEKilled(killer);
9086
9089 {
9090 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9091 {
9092 if (IsMagazine())
9093 {
9094 if (Magazine.Cast(this).GetAmmoCount() > 0)
9095 {
9097 }
9098 }
9099 else
9100 {
9102 }
9103 }
9104 }
9105 }
9106
9108 {
9109 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9110
9111 super.OnWasAttached(parent, slot_id);
9112
9115
9118 }
9119
9121 {
9122 super.OnWasDetached(parent, slot_id);
9123
9126
9129 }
9130
9132 {
9133 int idx;
9136
9137 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9138 if (inventory_slots.Count() < 1)
9139 {
9140 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9141 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9142 }
9143 else
9144 {
9145 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9146 }
9147
9148 idx = inventory_slots.Find(slot);
9149 if (idx < 0)
9150 return "";
9151
9152 return attach_types.Get(idx);
9153 }
9154
9156 {
9157 int idx = -1;
9158 string slot;
9159
9162
9163 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9164 if (inventory_slots.Count() < 1)
9165 {
9166 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9167 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9168 }
9169 else
9170 {
9171 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9172 if (detach_types.Count() < 1)
9173 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9174 }
9175
9176 for (int i = 0; i < inventory_slots.Count(); i++)
9177 {
9178 slot = inventory_slots.Get(i);
9179 }
9180
9181 if (slot != "")
9182 {
9183 if (detach_types.Count() == 1)
9184 idx = 0;
9185 else
9186 idx = inventory_slots.Find(slot);
9187 }
9188 if (idx < 0)
9189 return "";
9190
9191 return detach_types.Get(idx);
9192 }
9193
9195 {
9196
9198
9199
9200 float min_time = 1;
9201 float max_time = 3;
9202 float delay = Math.RandomFloat(min_time, max_time);
9203
9204 explode_timer.Run(delay, this, "DoAmmoExplosion");
9205 }
9206
9208 {
9209 Magazine magazine = Magazine.Cast(this);
9210 int pop_sounds_count = 6;
9211 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9212
9213
9214 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9215 string sound_name = pop_sounds[ sound_idx ];
9216 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9217
9218
9219 magazine.ServerAddAmmoCount(-1);
9220
9221
9222 float min_temp_to_explode = 100;
9223
9224 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9225 {
9227 }
9228 }
9229
9230
9231 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9232 {
9233 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9234
9235 const int CHANCE_DAMAGE_CARGO = 4;
9236 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9237 const int CHANCE_DAMAGE_NOTHING = 2;
9238
9240 {
9241 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9242 int chances;
9243 int rnd;
9244
9245 if (GetInventory().GetCargo())
9246 {
9247 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9248 rnd = Math.RandomInt(0,chances);
9249
9250 if (rnd < CHANCE_DAMAGE_CARGO)
9251 {
9253 }
9254 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9255 {
9257 }
9258 }
9259 else
9260 {
9261 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9262 rnd = Math.RandomInt(0,chances);
9263
9264 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9265 {
9267 }
9268 }
9269 }
9270 }
9271
9273 {
9274 CargoBase cargo = GetInventory().GetCargo();
9275 if (cargo)
9276 {
9278 if (item_count > 0)
9279 {
9280 int random_pick = Math.RandomInt(0, item_count);
9282 if (!item.IsExplosive())
9283 {
9284 item.AddHealth("","",damage);
9285 return true;
9286 }
9287 }
9288 }
9289 return false;
9290 }
9291
9293 {
9294 GameInventory inventory = GetInventory();
9296 if (attachment_count > 0)
9297 {
9298 int random_pick = Math.RandomInt(0, attachment_count);
9300 if (!attachment.IsExplosive())
9301 {
9302 attachment.AddHealth("","",damage);
9303 return true;
9304 }
9305 }
9306 return false;
9307 }
9308
9310 {
9312 }
9313
9315 {
9317 return GetInventory().CanRemoveEntity();
9318
9319 return false;
9320 }
9321
9323 {
9324
9326 return false;
9327
9328
9330 return false;
9331
9332
9333
9335 if (delta == 0)
9336 return false;
9337
9338
9339 return true;
9340 }
9341
9343 {
9345 {
9346 if (ScriptInputUserData.CanStoreInputUserData())
9347 {
9348 ScriptInputUserData ctx = new ScriptInputUserData;
9353 ctx.
Write(destination_entity);
9357 }
9358 }
9359 else if (!
g_Game.IsMultiplayer())
9360 {
9362 }
9363 }
9364
9366 {
9367 float split_quantity_new;
9371 InventoryLocation loc = new InventoryLocation;
9372
9373 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9374 {
9376 split_quantity_new = stack_max;
9377 else
9379
9381 {
9382 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9383 if (new_item)
9384 {
9385 new_item.SetResultOfSplit(true);
9386 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9388 new_item.
SetQuantity(split_quantity_new,
false,
true);
9389 }
9390 }
9391 }
9392 else if (destination_entity && slot_id == -1)
9393 {
9394 if (quantity > stack_max)
9395 split_quantity_new = stack_max;
9396 else
9397 split_quantity_new = quantity;
9398
9400 {
9401 GameInventory destinationInventory = destination_entity.GetInventory();
9403 {
9406 }
9407
9408 if (new_item)
9409 {
9410 new_item.SetResultOfSplit(true);
9411 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9413 new_item.
SetQuantity(split_quantity_new,
false,
true);
9414 }
9415 }
9416 }
9417 else
9418 {
9419 if (stack_max != 0)
9420 {
9422 {
9424 }
9425
9426 if (split_quantity_new == 0)
9427 {
9428 if (!
g_Game.IsMultiplayer())
9429 player.PhysicalPredictiveDropItem(this);
9430 else
9431 player.ServerDropEntity(this);
9432 return;
9433 }
9434
9436 {
9438
9439 if (new_item)
9440 {
9441 new_item.SetResultOfSplit(true);
9442 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9445 new_item.PlaceOnSurface();
9446 }
9447 }
9448 }
9449 }
9450 }
9451
9453 {
9454 float split_quantity_new;
9458 InventoryLocation loc = new InventoryLocation;
9459
9460 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9461 {
9463 split_quantity_new = stack_max;
9464 else
9466
9468 {
9469 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9470 if (new_item)
9471 {
9472 new_item.SetResultOfSplit(true);
9473 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9475 new_item.
SetQuantity(split_quantity_new,
false,
true);
9476 }
9477 }
9478 }
9479 else if (destination_entity && slot_id == -1)
9480 {
9481 if (quantity > stack_max)
9482 split_quantity_new = stack_max;
9483 else
9484 split_quantity_new = quantity;
9485
9487 {
9488 GameInventory destinationInventory = destination_entity.GetInventory();
9490 {
9493 }
9494
9495 if (new_item)
9496 {
9497 new_item.SetResultOfSplit(true);
9498 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9500 new_item.
SetQuantity(split_quantity_new,
false,
true);
9501 }
9502 }
9503 }
9504 else
9505 {
9506 if (stack_max != 0)
9507 {
9509 {
9511 }
9512
9514 {
9516
9517 if (new_item)
9518 {
9519 new_item.SetResultOfSplit(true);
9520 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9523 new_item.PlaceOnSurface();
9524 }
9525 }
9526 }
9527 }
9528 }
9529
9531 {
9533 {
9534 if (ScriptInputUserData.CanStoreInputUserData())
9535 {
9536 ScriptInputUserData ctx = new ScriptInputUserData;
9541 dst.WriteToContext(ctx);
9543 }
9544 }
9545 else if (!
g_Game.IsMultiplayer())
9546 {
9548 }
9549 }
9550
9552 {
9554 {
9555 if (ScriptInputUserData.CanStoreInputUserData())
9556 {
9557 ScriptInputUserData ctx = new ScriptInputUserData;
9562 ctx.
Write(destination_entity);
9568 }
9569 }
9570 else if (!
g_Game.IsMultiplayer())
9571 {
9573 }
9574 }
9575
9577 {
9579 }
9580
9582 {
9584 float split_quantity_new;
9586 if (dst.IsValid())
9587 {
9588 int slot_id = dst.GetSlot();
9590
9591 if (quantity > stack_max)
9592 split_quantity_new = stack_max;
9593 else
9594 split_quantity_new = quantity;
9595
9597 {
9599
9600 if (new_item)
9601 {
9602 new_item.SetResultOfSplit(true);
9603 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9605 new_item.
SetQuantity(split_quantity_new,
false,
true);
9606 }
9607
9608 return new_item;
9609 }
9610 }
9611
9612 return null;
9613 }
9614
9616 {
9618 float split_quantity_new;
9620 if (destination_entity)
9621 {
9623 if (quantity > stackable)
9624 split_quantity_new = stackable;
9625 else
9626 split_quantity_new = quantity;
9627
9629 {
9630 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9631 if (new_item)
9632 {
9633 new_item.SetResultOfSplit(true);
9634 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9636 new_item.
SetQuantity(split_quantity_new,
false,
true);
9637 }
9638 }
9639 }
9640 }
9641
9643 {
9645 {
9646 if (ScriptInputUserData.CanStoreInputUserData())
9647 {
9648 ScriptInputUserData ctx = new ScriptInputUserData;
9653 ItemBase destination_entity =
this;
9654 ctx.
Write(destination_entity);
9658 }
9659 }
9660 else if (!
g_Game.IsMultiplayer())
9661 {
9663 }
9664 }
9665
9667 {
9669 float split_quantity_new;
9671 if (player)
9672 {
9674 if (quantity > stackable)
9675 split_quantity_new = stackable;
9676 else
9677 split_quantity_new = quantity;
9678
9680 {
9681 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9682 new_item =
ItemBase.Cast(in_hands);
9683 if (new_item)
9684 {
9685 new_item.SetResultOfSplit(true);
9686 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9688 new_item.SetQuantity(split_quantity_new, false, true);
9689 }
9690 }
9691 }
9692 }
9693
9695 {
9697 float split_quantity_new = Math.Floor(quantity * 0.5);
9698
9700 return;
9701
9703
9704 if (new_item)
9705 {
9706 if (new_item.GetQuantityMax() < split_quantity_new)
9707 {
9708 split_quantity_new = new_item.GetQuantityMax();
9709 }
9710
9711 new_item.SetResultOfSplit(true);
9712 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9713
9715 {
9718 }
9719 else
9720 {
9722 new_item.
SetQuantity(split_quantity_new,
false,
true);
9723 }
9724 }
9725 }
9726
9728 {
9730 float split_quantity_new = Math.Floor(quantity / 2);
9731
9733 return;
9734
9735 InventoryLocation invloc = new InventoryLocation;
9737
9739 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9740
9741 if (new_item)
9742 {
9743 if (new_item.GetQuantityMax() < split_quantity_new)
9744 {
9745 split_quantity_new = new_item.GetQuantityMax();
9746 }
9748 {
9751 }
9752 else if (split_quantity_new > 1)
9753 {
9755 new_item.
SetQuantity(split_quantity_new,
false,
true);
9756 }
9757 }
9758 }
9759
9762 {
9763 SetWeightDirty();
9765
9766 if (parent)
9767 parent.OnAttachmentQuantityChangedEx(this, delta);
9768
9770 {
9772 {
9774 }
9776 {
9777 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9779 }
9780 }
9781 }
9782
9785 {
9786
9787 }
9788
9791 {
9793 }
9794
9796 {
9797 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9798
9800 {
9801 if (newLevel == GameConstants.STATE_RUINED)
9802 {
9804 EntityAI parent = GetHierarchyParent();
9805 if (parent && parent.IsFireplace())
9806 {
9807 CargoBase cargo = GetInventory().GetCargo();
9808 if (cargo)
9809 {
9811 {
9813 }
9814 }
9815 }
9816 }
9817
9819 {
9820
9822 return;
9823 }
9824
9825 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9826 {
9828 }
9829 }
9830 }
9831
9832
9834 {
9835 super.OnRightClick();
9836
9838 {
9840 {
9841 if (ScriptInputUserData.CanStoreInputUserData())
9842 {
9843 EntityAI root = GetHierarchyRoot();
9844 Man playerOwner = GetHierarchyRootPlayer();
9845 InventoryLocation dst = new InventoryLocation;
9846
9847
9848 if (!playerOwner && root && root == this)
9849 {
9851 }
9852 else
9853 {
9854
9855 GetInventory().GetCurrentInventoryLocation(dst);
9857 {
9858 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9860 {
9862 }
9863 else
9864 {
9866
9867
9868 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9869 {
9871 }
9872 else
9873 {
9874 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9875 }
9876 }
9877 }
9878 }
9879
9880 ScriptInputUserData ctx = new ScriptInputUserData;
9888 }
9889 }
9890 else if (!
g_Game.IsMultiplayer())
9891 {
9893 }
9894 }
9895 }
9896
9898 {
9899 if (root)
9900 {
9901 vector m4[4];
9902 root.GetTransform(m4);
9903 dst.SetGround(this, m4);
9904 }
9905 else
9906 {
9907 GetInventory().GetCurrentInventoryLocation(dst);
9908 }
9909 }
9910
9911 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9912 {
9913
9914 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9915 return false;
9916
9917 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9918 return false;
9919
9920
9922 return false;
9923
9924
9925 Magazine mag = Magazine.Cast(this);
9926 if (mag)
9927 {
9928 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9929 return false;
9930
9931 if (stack_max_limit)
9932 {
9933 Magazine other_mag = Magazine.Cast(other_item);
9934 if (other_item)
9935 {
9936 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9937 return false;
9938 }
9939
9940 }
9941 }
9942 else
9943 {
9944
9946 return false;
9947
9949 return false;
9950 }
9951
9952 PlayerBase player = null;
9953 if (CastTo(player, GetHierarchyRootPlayer()))
9954 {
9955 if (player.GetInventory().HasAttachment(this))
9956 return false;
9957
9958 if (player.IsItemsToDelete())
9959 return false;
9960 }
9961
9962 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9963 return false;
9964
9965 int slotID;
9967 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9968 return false;
9969
9970 return true;
9971 }
9972
9974 {
9976 }
9977
9979 {
9980 return m_IsResultOfSplit;
9981 }
9982
9984 {
9985 m_IsResultOfSplit = value;
9986 }
9987
9989 {
9991 }
9992
9994 {
9995 float other_item_quantity = other_item.GetQuantity();
9996 float this_free_space;
9997
9999
10001
10002 if (other_item_quantity > this_free_space)
10003 {
10004 return this_free_space;
10005 }
10006 else
10007 {
10008 return other_item_quantity;
10009 }
10010 }
10011
10013 {
10015 }
10016
10018 {
10020 return;
10021
10022 if (!IsMagazine() && other_item)
10023 {
10025 if (quantity_used != 0)
10026 {
10027 float hp1 = GetHealth01("","");
10028 float hp2 = other_item.GetHealth01("","");
10029 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10030 hpResult = hpResult / (
GetQuantity() + quantity_used);
10031
10032 hpResult *= GetMaxHealth();
10033 Math.Round(hpResult);
10034 SetHealth("", "Health", hpResult);
10035
10037 other_item.AddQuantity(-quantity_used);
10038 }
10039 }
10041 }
10042
10044 {
10045 #ifdef SERVER
10046 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10047 GetHierarchyParent().IncreaseLifetimeUp();
10048 #endif
10049 };
10050
10052 {
10053 PlayerBase p = PlayerBase.Cast(player);
10054
10055 array<int> recipesIds = p.m_Recipes;
10056 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10057 if (moduleRecipesManager)
10058 {
10059 EntityAI itemInHands = player.GetEntityInHands();
10060 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10061 }
10062
10063 for (int i = 0;i < recipesIds.Count(); i++)
10064 {
10065 int key = recipesIds.Get(i);
10066 string recipeName = moduleRecipesManager.GetRecipeName(key);
10068 }
10069 }
10070
10071
10072 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10073 {
10074 super.GetDebugActions(outputList);
10075
10076
10082
10083
10088
10093
10094
10098
10099
10101 {
10105 }
10106
10109
10110
10114
10116
10117 InventoryLocation loc = new InventoryLocation();
10118 GetInventory().GetCurrentInventoryLocation(loc);
10120 {
10121 if (Gizmo_IsSupported())
10124 }
10125
10127 }
10128
10129
10130
10131
10133 {
10134 super.OnAction(action_id, player, ctx);
10135
10137 {
10138 switch (action_id)
10139 {
10143 return true;
10147 return true;
10148 }
10149 }
10150
10152 {
10153 switch (action_id)
10154 {
10156 Delete();
10157 return true;
10158 }
10159 }
10160
10161 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10162 {
10163 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10164 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10165 PlayerBase p = PlayerBase.Cast(player);
10166 if (
EActions.RECIPES_RANGE_START < 1000)
10167 {
10168 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10169 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10170 }
10171 }
10172 #ifndef SERVER
10173 else if (action_id ==
EActions.WATCH_PLAYER)
10174 {
10175 PluginDeveloper.SetDeveloperItemClientEx(player);
10176 }
10177 #endif
10179 {
10180 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10181 {
10182 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10183 OnDebugButtonPressServer(id + 1);
10184 }
10185
10186 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10187 {
10188 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10190 }
10191
10192 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10193 {
10194 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10196 }
10197
10198 else if (action_id ==
EActions.ADD_QUANTITY)
10199 {
10200 if (IsMagazine())
10201 {
10202 Magazine mag = Magazine.Cast(this);
10203 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10204 }
10205 else
10206 {
10208 }
10209
10210 if (m_EM)
10211 {
10212 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10213 }
10214
10215 }
10216
10217 else if (action_id ==
EActions.REMOVE_QUANTITY)
10218 {
10219 if (IsMagazine())
10220 {
10221 Magazine mag2 = Magazine.Cast(this);
10222 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10223 }
10224 else
10225 {
10227 }
10228 if (m_EM)
10229 {
10230 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10231 }
10232
10233 }
10234
10235 else if (action_id ==
EActions.SET_QUANTITY_0)
10236 {
10238
10239 if (m_EM)
10240 {
10241 m_EM.SetEnergy(0);
10242 }
10243 }
10244
10245 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10246 {
10248
10249 if (m_EM)
10250 {
10251 m_EM.SetEnergy(m_EM.GetEnergyMax());
10252 }
10253 }
10254
10255 else if (action_id ==
EActions.ADD_HEALTH)
10256 {
10257 AddHealth("","",GetMaxHealth("","Health")/5);
10258 }
10259 else if (action_id ==
EActions.REMOVE_HEALTH)
10260 {
10261 AddHealth("","",-GetMaxHealth("","Health")/5);
10262 }
10263 else if (action_id ==
EActions.DESTROY_HEALTH)
10264 {
10265 SetHealth01("","",0);
10266 }
10267 else if (action_id ==
EActions.WATCH_ITEM)
10268 {
10270 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10271 #ifdef DEVELOPER
10272 SetDebugDeveloper_item(this);
10273 #endif
10274 }
10275
10276 else if (action_id ==
EActions.ADD_TEMPERATURE)
10277 {
10278 AddTemperature(20);
10279
10280 }
10281
10282 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10283 {
10284 AddTemperature(-20);
10285
10286 }
10287
10288 else if (action_id ==
EActions.FLIP_FROZEN)
10289 {
10290 SetFrozen(!GetIsFrozen());
10291
10292 }
10293
10294 else if (action_id ==
EActions.ADD_WETNESS)
10295 {
10297
10298 }
10299
10300 else if (action_id ==
EActions.REMOVE_WETNESS)
10301 {
10303
10304 }
10305
10306 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10307 {
10310
10311
10312 }
10313
10314 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10315 {
10318 }
10319
10320 else if (action_id ==
EActions.MAKE_SPECIAL)
10321 {
10322 auto debugParams = DebugSpawnParams.WithPlayer(player);
10323 OnDebugSpawnEx(debugParams);
10324 }
10325
10326 }
10327
10328
10329 return false;
10330 }
10331
10332
10333
10334
10338
10341
10342
10343
10345 {
10346 return false;
10347 }
10348
10349
10351 {
10352 return true;
10353 }
10354
10355
10357 {
10358 return true;
10359 }
10360
10361
10362
10364 {
10365 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10366 return g_Game.ConfigIsExisting(config_path);
10367 }
10368
10371 {
10372 return null;
10373 }
10374
10376 {
10377 return false;
10378 }
10379
10381 {
10382 return false;
10383 }
10384
10388
10389
10391 {
10392 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10393 return module_repairing.CanRepair(this, item_repair_kit);
10394 }
10395
10396
10397 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10398 {
10399 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10400 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10401 }
10402
10403
10405 {
10406
10407
10408
10409
10410
10411
10412
10413
10414 return 1;
10415 }
10416
10417
10418
10420 {
10422 }
10423
10424
10425
10427 {
10429 }
10430
10431
10440 {
10441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10442
10443 if (player)
10444 {
10445 player.MessageStatus(text);
10446 }
10447 }
10448
10449
10458 {
10459 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10460
10461 if (player)
10462 {
10463 player.MessageAction(text);
10464 }
10465 }
10466
10467
10476 {
10477 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10478
10479 if (player)
10480 {
10481 player.MessageFriendly(text);
10482 }
10483 }
10484
10485
10494 {
10495 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10496
10497 if (player)
10498 {
10499 player.MessageImportant(text);
10500 }
10501 }
10502
10504 {
10505 return true;
10506 }
10507
10508
10509 override bool KindOf(
string tag)
10510 {
10511 bool found = false;
10512 string item_name = this.
GetType();
10514 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10515
10516 int array_size = item_tag_array.Count();
10517 for (int i = 0; i < array_size; i++)
10518 {
10519 if (item_tag_array.Get(i) == tag)
10520 {
10521 found = true;
10522 break;
10523 }
10524 }
10525 return found;
10526 }
10527
10528
10530 {
10531
10532 super.OnRPC(sender, rpc_type,ctx);
10533
10534
10535 switch (rpc_type)
10536 {
10537 #ifndef SERVER
10538 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10539 Param2<bool, string> p = new Param2<bool, string>(false, "");
10540
10542 return;
10543
10544 bool play = p.param1;
10545 string soundSet = p.param2;
10546
10547 if (play)
10548 {
10550 {
10552 {
10554 }
10555 }
10556 else
10557 {
10559 }
10560 }
10561 else
10562 {
10564 }
10565
10566 break;
10567 #endif
10568
10569 }
10570
10572 {
10574 }
10575 }
10576
10577
10578
10579
10581 {
10582 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10583 return plugin.GetID(
name);
10584 }
10585
10587 {
10588 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10589 return plugin.GetName(id);
10590 }
10591
10594 {
10595
10596
10597 int varFlags;
10598 if (!ctx.
Read(varFlags))
10599 return;
10600
10601 if (varFlags & ItemVariableFlags.FLOAT)
10602 {
10604 }
10605 }
10606
10608 {
10609
10610 super.SerializeNumericalVars(floats_out);
10611
10612
10613
10615 {
10617 }
10618
10620 {
10622 }
10623
10625 {
10627 }
10628
10630 {
10635 }
10636
10638 {
10640 }
10641 }
10642
10644 {
10645
10646 super.DeSerializeNumericalVars(floats);
10647
10648
10649 int index = 0;
10650 int mask = Math.Round(floats.Get(index));
10651
10652 index++;
10653
10655 {
10657 {
10659 }
10660 else
10661 {
10662 float quantity = floats.Get(index);
10663 SetQuantity(quantity,
true,
false,
false,
false);
10664 }
10665 index++;
10666 }
10667
10669 {
10670 float wet = floats.Get(index);
10672 index++;
10673 }
10674
10676 {
10677 int liquidtype = Math.Round(floats.Get(index));
10679 index++;
10680 }
10681
10683 {
10685 index++;
10687 index++;
10689 index++;
10691 index++;
10692 }
10693
10695 {
10696 int cleanness = Math.Round(floats.Get(index));
10698 index++;
10699 }
10700 }
10701
10703 {
10704 super.WriteVarsToCTX(ctx);
10705
10706
10708 {
10710 }
10711
10713 {
10715 }
10716
10718 {
10720 }
10721
10723 {
10724 int r,g,b,a;
10730 }
10731
10733 {
10735 }
10736 }
10737
10739 {
10740 if (!super.ReadVarsFromCTX(ctx,version))
10741 return false;
10742
10743 int intValue;
10744 float value;
10745
10746 if (version < 140)
10747 {
10748 if (!ctx.
Read(intValue))
10749 return false;
10750
10751 m_VariablesMask = intValue;
10752 }
10753
10755 {
10756 if (!ctx.
Read(value))
10757 return false;
10758
10760 {
10762 }
10763 else
10764 {
10766 }
10767 }
10768
10769 if (version < 140)
10770 {
10772 {
10773 if (!ctx.
Read(value))
10774 return false;
10775 SetTemperatureDirect(value);
10776 }
10777 }
10778
10780 {
10781 if (!ctx.
Read(value))
10782 return false;
10784 }
10785
10787 {
10788 if (!ctx.
Read(intValue))
10789 return false;
10791 }
10792
10794 {
10795 int r,g,b,a;
10797 return false;
10799 return false;
10801 return false;
10803 return false;
10804
10806 }
10807
10809 {
10810 if (!ctx.
Read(intValue))
10811 return false;
10813 }
10814
10815 if (version >= 138 && version < 140)
10816 {
10818 {
10819 if (!ctx.
Read(intValue))
10820 return false;
10821 SetFrozen(intValue);
10822 }
10823 }
10824
10825 return true;
10826 }
10827
10828
10830 {
10833 {
10835 }
10836
10837 if (!super.OnStoreLoad(ctx, version))
10838 {
10840 return false;
10841 }
10842
10843 if (version >= 114)
10844 {
10845 bool hasQuickBarIndexSaved;
10846
10847 if (!ctx.
Read(hasQuickBarIndexSaved))
10848 {
10850 return false;
10851 }
10852
10853 if (hasQuickBarIndexSaved)
10854 {
10855 int itmQBIndex;
10856
10857
10858 if (!ctx.
Read(itmQBIndex))
10859 {
10861 return false;
10862 }
10863
10864 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10865 if (itmQBIndex != -1 && parentPlayer)
10866 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10867 }
10868 }
10869 else
10870 {
10871
10872 PlayerBase player;
10873 int itemQBIndex;
10874 if (version ==
int.
MAX)
10875 {
10876 if (!ctx.
Read(itemQBIndex))
10877 {
10879 return false;
10880 }
10881 }
10882 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10883 {
10884
10885 if (!ctx.
Read(itemQBIndex))
10886 {
10888 return false;
10889 }
10890 if (itemQBIndex != -1 && player)
10891 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10892 }
10893 }
10894
10895 if (version < 140)
10896 {
10897
10898 if (!LoadVariables(ctx, version))
10899 {
10901 return false;
10902 }
10903 }
10904
10905
10907 {
10909 return false;
10910 }
10911 if (version >= 132)
10912 {
10914 if (raib)
10915 {
10917 {
10919 return false;
10920 }
10921 }
10922 }
10923
10925 return true;
10926 }
10927
10928
10929
10931 {
10932 super.OnStoreSave(ctx);
10933
10934 PlayerBase player;
10935 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10936 {
10938
10939 int itemQBIndex = -1;
10940 itemQBIndex = player.FindQuickBarEntityIndex(this);
10941 ctx.
Write(itemQBIndex);
10942 }
10943 else
10944 {
10946 }
10947
10949
10951 if (raib)
10952 {
10954 }
10955 }
10956
10957
10959 {
10960 super.AfterStoreLoad();
10961
10963 {
10965 }
10966
10968 {
10971 }
10972 }
10973
10975 {
10976 super.EEOnAfterLoad();
10977
10979 {
10981 }
10982
10985 }
10986
10988 {
10989 return false;
10990 }
10991
10992
10993
10995 {
10997 {
10998 #ifdef PLATFORM_CONSOLE
10999
11001 {
11003 if (menu)
11004 {
11006 }
11007 }
11008 #endif
11009 }
11010
11012 {
11015 }
11016
11018 {
11019 SetWeightDirty();
11021 }
11023 {
11026 }
11027
11029 {
11032
11035 }
11037 {
11041 }
11042
11043 super.OnVariablesSynchronized();
11044 }
11045
11046
11047
11049 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11050 {
11051 if (!IsServerCheck(allow_client))
11052 return false;
11053
11055 return false;
11056
11059
11060 if (value <= (min + 0.001))
11061 value = min;
11062
11063 if (value == min)
11064 {
11065 if (destroy_config)
11066 {
11067 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11068 if (dstr)
11069 {
11071 this.Delete();
11072 return true;
11073 }
11074 }
11075 else if (destroy_forced)
11076 {
11078 this.Delete();
11079 return true;
11080 }
11081
11083 }
11084
11087
11089 {
11090 EntityAI parent = GetHierarchyRoot();
11091 InventoryLocation iLoc = new InventoryLocation();
11092 GetInventory().GetCurrentInventoryLocation(iLoc);
11094 {
11095 int iLocSlot = iLoc.
GetSlot();
11097 {
11099 }
11101 {
11103 }
11104 }
11105 }
11106
11108 {
11110
11111 if (delta)
11113 }
11114
11116
11117 return false;
11118 }
11119
11120
11122 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11123 {
11125 }
11126
11128 {
11131 }
11132
11134 {
11137 }
11138
11140 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11141 {
11142 float value_clamped = Math.Clamp(value, 0, 1);
11144 SetQuantity(result, destroy_config, destroy_forced);
11145 }
11146
11147
11150 {
11152 }
11153
11155 {
11157 }
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11169 {
11170 int slot = -1;
11171 GameInventory inventory = GetInventory();
11172 if (inventory)
11173 {
11174 InventoryLocation il = new InventoryLocation;
11177 }
11178
11180 }
11181
11183 {
11184 float quantity_max = 0;
11185
11187 {
11188 if (attSlotID != -1)
11189 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11190
11191 if (quantity_max <= 0)
11193 }
11194
11195 if (quantity_max <= 0)
11197
11198 return quantity_max;
11199 }
11200
11202 {
11204 }
11205
11207 {
11209 }
11210
11211
11213 {
11215 }
11216
11218 {
11220 }
11221
11223 {
11225 }
11226
11227
11229 {
11230
11231 float weightEx = GetWeightEx();
11232 float special = GetInventoryAndCargoWeight();
11233 return weightEx - special;
11234 }
11235
11236
11238 {
11240 }
11241
11243 {
11245 {
11246 #ifdef DEVELOPER
11247 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11248 {
11249 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11251 }
11252 #endif
11253
11254 return GetQuantity() * GetConfigWeightModified();
11255 }
11256 else if (HasEnergyManager())
11257 {
11258 #ifdef DEVELOPER
11259 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11260 {
11261 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11262 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11263 }
11264 #endif
11265 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11266 }
11267 else
11268 {
11269 #ifdef DEVELOPER
11270 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11271 {
11272 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11273 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11274 }
11275 #endif
11276 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11277 }
11278 }
11279
11282 {
11283 int item_count = 0;
11285
11286 GameInventory inventory = GetInventory();
11287 CargoBase cargo = inventory.
GetCargo();
11288 if (cargo != NULL)
11289 {
11291 }
11292
11294 for (int i = 0; i < nAttachments; ++i)
11295 {
11297 if (item)
11298 item_count += item.GetNumberOfItems();
11299 }
11300 return item_count;
11301 }
11302
11305 {
11306 float weight = 0;
11307 float wetness = 1;
11308 if (include_wetness)
11311 {
11312 weight = wetness * m_ConfigWeight;
11313 }
11315 {
11316 weight = 1;
11317 }
11318 return weight;
11319 }
11320
11321
11322
11324 {
11325 GameInventory inventory = GetInventory();
11326 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11327 {
11328 array<EntityAI> items = new array<EntityAI>;
11330 for (int i = 0; i < items.Count(); ++i)
11331 {
11333 if (item)
11334 {
11335 g_Game.ObjectDelete(item);
11336 }
11337 }
11338 }
11339 }
11340
11341
11342
11343
11345 {
11346 float energy = 0;
11347 if (HasEnergyManager())
11348 {
11349 energy = GetCompEM().GetEnergy();
11350 }
11351 return energy;
11352 }
11353
11354
11356 {
11357 super.OnEnergyConsumed();
11358
11360 }
11361
11363 {
11364 super.OnEnergyAdded();
11365
11367 }
11368
11369
11371 {
11372 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11373 {
11375 {
11376 float energy_0to1 = GetCompEM().GetEnergy0To1();
11378 }
11379 }
11380 }
11381
11382
11384 {
11385 return ConfigGetFloat("heatIsolation");
11386 }
11387
11389 {
11391 }
11392
11394 {
11395 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11396 if (
g_Game.ConfigIsExisting(paramPath))
11397 return g_Game.ConfigGetFloat(paramPath);
11398
11399 return 0.0;
11400 }
11401
11403 {
11404 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11405 if (
g_Game.ConfigIsExisting(paramPath))
11406 return g_Game.ConfigGetFloat(paramPath);
11407
11408 return 0.0;
11409 }
11410
11411 override void SetWet(
float value,
bool allow_client =
false)
11412 {
11413 if (!IsServerCheck(allow_client))
11414 return;
11415
11418
11420
11421 m_VarWet = Math.Clamp(value, min, max);
11422
11424 {
11427 }
11428 }
11429
11430 override void AddWet(
float value)
11431 {
11433 }
11434
11436 {
11438 }
11439
11441 {
11443 }
11444
11446 {
11448 }
11449
11451 {
11453 }
11454
11456 {
11458 }
11459
11460 override void OnWetChanged(
float newVal,
float oldVal)
11461 {
11464 if (newLevel != oldLevel)
11465 {
11467 }
11468 }
11469
11471 {
11472 SetWeightDirty();
11473 }
11474
11476 {
11477 return GetWetLevelInternal(
m_VarWet);
11478 }
11479
11480
11481
11483 {
11485 }
11486
11488 {
11490 }
11491
11493 {
11495 }
11496
11498 {
11500 }
11501
11502
11503
11505 {
11506 if (ConfigIsExisting("itemModelLength"))
11507 {
11508 return ConfigGetFloat("itemModelLength");
11509 }
11510 return 0;
11511 }
11512
11514 {
11515 if (ConfigIsExisting("itemAttachOffset"))
11516 {
11517 return ConfigGetFloat("itemAttachOffset");
11518 }
11519 return 0;
11520 }
11521
11522 override void SetCleanness(
int value,
bool allow_client =
false)
11523 {
11524 if (!IsServerCheck(allow_client))
11525 return;
11526
11528
11530
11533 }
11534
11536 {
11538 }
11539
11541 {
11542 return true;
11543 }
11544
11545
11546
11547
11549 {
11551 }
11552
11554 {
11556 }
11557
11558
11559
11560
11561 override void SetColor(
int r,
int g,
int b,
int a)
11562 {
11568 }
11570 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11571 {
11576 }
11577
11579 {
11581 }
11582
11585 {
11586 int r,g,b,a;
11588 r = r/255;
11589 g = g/255;
11590 b = b/255;
11591 a = a/255;
11592 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11593 }
11594
11595
11596
11597 override void SetLiquidType(
int value,
bool allow_client =
false)
11598 {
11599 if (!IsServerCheck(allow_client))
11600 return;
11601
11606 }
11607
11609 {
11610 return ConfigGetInt("varLiquidTypeInit");
11611 }
11612
11614 {
11616 }
11617
11619 {
11621 SetFrozen(false);
11622 }
11623
11626 {
11627 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11628 }
11629
11630
11633 {
11634 PlayerBase nplayer;
11635 if (PlayerBase.CastTo(nplayer, player))
11636 {
11638 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11639 }
11640 }
11641
11642
11645 {
11646 PlayerBase nplayer;
11647 if (PlayerBase.CastTo(nplayer,player))
11648 {
11649 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11650 }
11651
11652 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11653
11654 if (HasEnergyManager())
11655 {
11656 GetCompEM().UpdatePlugState();
11657 }
11658 }
11659
11660
11662 {
11663 super.OnPlacementStarted(player);
11664
11666 }
11667
11668 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11669 {
11671 {
11672 m_AdminLog.OnPlacementComplete(player,
this);
11673 }
11674
11675 super.OnPlacementComplete(player, position, orientation);
11676 }
11677
11678
11679
11680
11681
11683 {
11685 {
11686 return true;
11687 }
11688 else
11689 {
11690 return false;
11691 }
11692 }
11693
11694
11696 {
11698 {
11700 }
11701 }
11702
11703
11705 {
11707 }
11708
11710 {
11712 }
11713
11714 override void InsertAgent(
int agent,
float count = 1)
11715 {
11716 if (count < 1)
11717 return;
11718
11720 }
11721
11724 {
11726 }
11727
11728
11730 {
11732 }
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11776 {
11778 return false;
11779 return true;
11780 }
11781
11783 {
11784
11786 }
11787
11788
11791 {
11792 super.CheckForRoofLimited(timeTresholdMS);
11793
11794 float time =
g_Game.GetTime();
11795 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11796 {
11797 m_PreviousRoofTestTime = time;
11798 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11799 }
11800 }
11801
11802
11804 {
11806 {
11807 return 0;
11808 }
11809
11810 if (GetInventory().GetAttachmentSlotsCount() != 0)
11811 {
11812 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11813 if (filter)
11814 return filter.GetProtectionLevel(type, false, system);
11815 else
11816 return 0;
11817 }
11818
11819 string subclassPath, entryName;
11820
11821 switch (type)
11822 {
11824 entryName = "biological";
11825 break;
11827 entryName = "chemical";
11828 break;
11829 default:
11830 entryName = "biological";
11831 break;
11832 }
11833
11834 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11835
11836 return g_Game.ConfigGetFloat(subclassPath + entryName);
11837 }
11838
11839
11840
11843 {
11844 if (!IsMagazine())
11846
11848 }
11849
11850
11851
11852
11853
11858 {
11859 return true;
11860 }
11861
11863 {
11865 }
11866
11867
11868
11869
11870
11872 {
11873 if (parent)
11874 {
11875 if (parent.IsInherited(DayZInfected))
11876 return true;
11877
11878 if (!parent.IsRuined())
11879 return true;
11880 }
11881
11882 return true;
11883 }
11884
11886 {
11887 if (!super.CanPutAsAttachment(parent))
11888 {
11889 return false;
11890 }
11891
11892 if (!IsRuined() && !parent.IsRuined())
11893 {
11894 return true;
11895 }
11896
11897 return false;
11898 }
11899
11901 {
11902
11903
11904
11905
11906 return super.CanReceiveItemIntoCargo(item);
11907 }
11908
11910 {
11911
11912
11913
11914
11915 GameInventory attachmentInv = attachment.GetInventory();
11917 {
11918 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11919 return false;
11920 }
11921
11922 InventoryLocation loc = new InventoryLocation();
11923 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11924 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11925 return false;
11926
11927 return super.CanReceiveAttachment(attachment, slotId);
11928 }
11929
11931 {
11932 if (!super.CanReleaseAttachment(attachment))
11933 return false;
11934
11935 return GetInventory().AreChildrenAccessible();
11936 }
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11959 {
11960 int id = muzzle_owner.GetMuzzleID();
11961 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11962
11963 if (WPOF_array)
11964 {
11965 for (int i = 0; i < WPOF_array.Count(); i++)
11966 {
11967 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11968
11969 if (WPOF)
11970 {
11971 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11972 }
11973 }
11974 }
11975 }
11976
11977
11979 {
11980 int id = muzzle_owner.GetMuzzleID();
11982
11983 if (WPOBE_array)
11984 {
11985 for (int i = 0; i < WPOBE_array.Count(); i++)
11986 {
11987 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11988
11989 if (WPOBE)
11990 {
11991 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11992 }
11993 }
11994 }
11995 }
11996
11997
11999 {
12000 int id = muzzle_owner.GetMuzzleID();
12001 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12002
12003 if (WPOOH_array)
12004 {
12005 for (int i = 0; i < WPOOH_array.Count(); i++)
12006 {
12007 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12008
12009 if (WPOOH)
12010 {
12011 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12012 }
12013 }
12014 }
12015 }
12016
12017
12019 {
12020 int id = muzzle_owner.GetMuzzleID();
12021 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12022
12023 if (WPOOH_array)
12024 {
12025 for (int i = 0; i < WPOOH_array.Count(); i++)
12026 {
12027 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12028
12029 if (WPOOH)
12030 {
12031 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12032 }
12033 }
12034 }
12035 }
12036
12037
12039 {
12040 int id = muzzle_owner.GetMuzzleID();
12041 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12042
12043 if (WPOOH_array)
12044 {
12045 for (int i = 0; i < WPOOH_array.Count(); i++)
12046 {
12047 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12048
12049 if (WPOOH)
12050 {
12051 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12052 }
12053 }
12054 }
12055 }
12056
12057
12058
12060 {
12062 {
12063 return true;
12064 }
12065
12066 return false;
12067 }
12068
12070 {
12072 {
12073 return true;
12074 }
12075
12076 return false;
12077 }
12078
12080 {
12082 {
12083 return true;
12084 }
12085
12086 return false;
12087 }
12088
12090 {
12091 return false;
12092 }
12093
12096 {
12097 return UATimeSpent.DEFAULT_DEPLOY;
12098 }
12099
12100
12101
12102
12104 {
12106 SetSynchDirty();
12107 }
12108
12110 {
12112 }
12113
12114
12116 {
12117 return false;
12118 }
12119
12122 {
12123 string att_type = "None";
12124
12125 if (ConfigIsExisting("soundAttType"))
12126 {
12127 att_type = ConfigGetString("soundAttType");
12128 }
12129
12131 }
12132
12134 {
12136 }
12137
12138
12139
12140
12141
12147
12149 {
12152
12154 }
12155
12156
12158 {
12160 return;
12161
12163
12166
12169
12170 SoundParameters params = new SoundParameters();
12174 }
12175
12176
12178 {
12180 {
12183
12184 SetSynchDirty();
12185
12188 }
12189 }
12190
12192 {
12194 }
12195
12196
12198 {
12200 return;
12201
12203 SetSynchDirty();
12204
12207 }
12208
12210 {
12213 }
12214
12216 {
12218 }
12219
12220 void OnApply(PlayerBase player);
12221
12223 {
12224 return 1.0;
12225 };
12226
12228 {
12230 }
12231
12233 {
12235 }
12236
12238
12240 {
12241 SetDynamicPhysicsLifeTime(0.01);
12243 }
12244
12246 {
12247 array<string> zone_names = new array<string>;
12248 GetDamageZones(zone_names);
12249 for (int i = 0; i < zone_names.Count(); i++)
12250 {
12251 SetHealthMax(zone_names.Get(i),"Health");
12252 }
12253 SetHealthMax("","Health");
12254 }
12255
12258 {
12259 float global_health = GetHealth01("","Health");
12260 array<string> zones = new array<string>;
12261 GetDamageZones(zones);
12262
12263 for (int i = 0; i < zones.Count(); i++)
12264 {
12265 SetHealth01(zones.Get(i),"Health",global_health);
12266 }
12267 }
12268
12271 {
12272 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12273 }
12274
12276 {
12277 if (!hasRootAsPlayer)
12278 {
12279 if (refParentIB)
12280 {
12281
12282 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12283 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12284
12285 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12286 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12287
12290 }
12291 else
12292 {
12293
12296 }
12297 }
12298 }
12299
12301 {
12303 {
12304 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12305 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12306 {
12307 float heatPermCoef = 1.0;
12309 while (ent)
12310 {
12311 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12312 ent = ent.GetHierarchyParent();
12313 }
12314
12315 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12316 }
12317 }
12318 }
12319
12321 {
12322
12323 EntityAI parent = GetHierarchyParent();
12324 if (!parent)
12325 {
12326 hasParent = false;
12327 hasRootAsPlayer = false;
12328 }
12329 else
12330 {
12331 hasParent = true;
12332 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12333 refParentIB =
ItemBase.Cast(parent);
12334 }
12335 }
12336
12337 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12338 {
12339
12340 }
12341
12343 {
12344
12345 return false;
12346 }
12347
12349 {
12350
12351
12352 return false;
12353 }
12354
12356 {
12357
12358 return false;
12359 }
12360
12363 {
12364 return !GetIsFrozen() &&
IsOpen();
12365 }
12366
12368 {
12369 bool hasParent = false, hasRootAsPlayer = false;
12371
12372 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12373 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12374
12375 if (wwtu || foodDecay)
12376 {
12380
12381 if (processWetness || processTemperature || processDecay)
12382 {
12384
12385 if (processWetness)
12386 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12387
12388 if (processTemperature)
12390
12391 if (processDecay)
12392 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12393 }
12394 }
12395 }
12396
12399 {
12401 }
12402
12404 {
12407
12408 return super.GetTemperatureFreezeThreshold();
12409 }
12410
12412 {
12415
12416 return super.GetTemperatureThawThreshold();
12417 }
12418
12420 {
12423
12424 return super.GetItemOverheatThreshold();
12425 }
12426
12428 {
12430 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12431
12432 return super.GetTemperatureFreezeTime();
12433 }
12434
12436 {
12438 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12439
12440 return super.GetTemperatureThawTime();
12441 }
12442
12447
12449 {
12450 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12451 }
12452
12454 {
12455 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12456 }
12457
12460 {
12462 }
12463
12465 {
12467 }
12468
12470 {
12472 }
12473
12476 {
12477 return null;
12478 }
12479
12482 {
12483 return false;
12484 }
12485
12487 {
12489 {
12492 if (!trg)
12493 {
12495 explosive = this;
12496 }
12497
12498 explosive.PairRemote(trg);
12500
12501 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12502 trg.SetPersistentPairID(persistentID);
12503 explosive.SetPersistentPairID(persistentID);
12504
12505 return true;
12506 }
12507 return false;
12508 }
12509
12512 {
12513 float ret = 1.0;
12516 ret *= GetHealth01();
12517
12518 return ret;
12519 }
12520
12521 #ifdef DEVELOPER
12522 override void SetDebugItem()
12523 {
12524 super.SetDebugItem();
12525 _itemBase = this;
12526 }
12527
12529 {
12530 string text = super.GetDebugText();
12531
12533 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12534
12535 return text;
12536 }
12537 #endif
12538
12540 {
12541 return true;
12542 }
12543
12545
12547
12549 {
12552 }
12553
12554
12562
12578
12579 [
Obsolete(
"Use ItemSoundHandler instead")]
12582 {
12583 if (!
g_Game.IsDedicatedServer())
12584 {
12585 if (ConfigIsExisting("attachSoundSet"))
12586 {
12587 string cfg_path = "";
12588 string soundset = "";
12589 string type_name =
GetType();
12590
12593 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12594 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12595
12596 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12597 {
12598 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12599 {
12600 if (cfg_slot_array[i] == slot_type)
12601 {
12602 soundset = cfg_soundset_array[i];
12603 break;
12604 }
12605 }
12606 }
12607
12608 if (soundset != "")
12609 {
12610 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12612 }
12613 }
12614 }
12615 }
12616
12618}
12619
12621{
12623 if (entity)
12624 {
12625 bool is_item = entity.IsInherited(
ItemBase);
12626 if (is_item && full_quantity)
12627 {
12630 }
12631 }
12632 else
12633 {
12635 return NULL;
12636 }
12637 return entity;
12638}
12639
12641{
12642 if (item)
12643 {
12644 if (health > 0)
12645 item.SetHealth("", "", health);
12646
12647 if (item.CanHaveTemperature())
12648 {
12650 if (item.CanFreeze())
12651 item.SetFrozen(false);
12652 }
12653
12654 if (item.HasEnergyManager())
12655 {
12656 if (quantity >= 0)
12657 {
12658 item.GetCompEM().SetEnergy0To1(quantity);
12659 }
12660 else
12661 {
12663 }
12664 }
12665 else if (item.IsMagazine())
12666 {
12667 Magazine mag = Magazine.Cast(item);
12668 if (quantity >= 0)
12669 {
12670 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12671 }
12672 else
12673 {
12675 }
12676
12677 }
12678 else
12679 {
12680 if (quantity >= 0)
12681 {
12682 item.SetQuantityNormalized(quantity, false);
12683 }
12684 else
12685 {
12687 }
12688
12689 }
12690 }
12691}
12692
12693#ifdef DEVELOPER
12695#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.