7793{
7795 {
7796 return true;
7797 }
7798};
7799
7801{
7802
7803};
7804
7805
7806
7808{
7812
7814
7817
7818
7819
7820
7821
7830
7836
7841
7846
7867 protected bool m_IsResultOfSplit
7868
7870
7875
7876
7877
7879
7883
7884
7885
7887
7890
7891
7892
7898
7899
7907
7910
7911
7913
7914
7916
7917
7922
7923
7928
7930
7931
7933
7934
7936 {
7941
7942 if (!
g_Game.IsDedicatedServer())
7943 {
7945 {
7947
7949 {
7951 }
7952 }
7953
7956 }
7957
7958 m_OldLocation = null;
7959
7961 {
7963 }
7964
7965 if (ConfigIsExisting("headSelectionsToHide"))
7966 {
7969 }
7970
7972 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7973 {
7975 }
7976
7978
7979 m_IsResultOfSplit = false;
7980
7982 }
7983
7985 {
7986 super.InitItemVariables();
7987
7993 m_Count = ConfigGetInt(
"count");
7994
7997
8002
8005
8010
8022
8026
8027
8030 if (ConfigIsExisting("canBeSplit"))
8031 {
8034 }
8035
8037 if (ConfigIsExisting("itemBehaviour"))
8039
8040
8043 RegisterNetSyncVariableInt("m_VarLiquidType");
8044 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8045
8046 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8047 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8048 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8049
8050 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8051 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8052 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8053 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8054
8055 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8056 RegisterNetSyncVariableBool("m_IsTakeable");
8057 RegisterNetSyncVariableBool("m_IsHologram");
8058
8061 {
8064 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8065 }
8066
8068
8070 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8072
8074 }
8075
8077 {
8079 }
8080
8082 {
8085 {
8090 }
8091 }
8092
8093 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8094 {
8096 {
8099 }
8100
8102 }
8103
8105 {
8111 }
8112
8114
8116 {
8118
8119 if (!action)
8120 {
8121 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8122 return;
8123 }
8124
8126 if (!ai)
8127 {
8129 return;
8130 }
8131
8133 if (!action_array)
8134 {
8135 action_array = new array<ActionBase_Basic>;
8137 }
8138 if (LogManager.IsActionLogEnable())
8139 {
8140 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8141 }
8142
8143 if (action_array.Find(action) != -1)
8144 {
8145 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8146 }
8147 else
8148 {
8149 action_array.Insert(action);
8150 }
8151 }
8152
8154 {
8155 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8156 ActionBase action = player.GetActionManager().GetAction(actionName);
8159
8160 if (action_array)
8161 {
8162 action_array.RemoveItem(action);
8163 }
8164 }
8165
8166
8167
8169 {
8170 ActionOverrideData overrideData = new ActionOverrideData();
8174
8176 if (!actionMap)
8177 {
8180 }
8181
8182 actionMap.Insert(this.
Type(), overrideData);
8183
8184 }
8185
8187
8189
8190
8192 {
8195
8198
8199 string config_to_search = "CfgVehicles";
8200 string muzzle_owner_config;
8201
8203 {
8204 if (IsInherited(Weapon))
8205 config_to_search = "CfgWeapons";
8206
8207 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8208
8209 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8210
8211 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8212
8213 if (config_OnFire_subclass_count > 0)
8214 {
8215 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8216
8217 for (int i = 0; i < config_OnFire_subclass_count; i++)
8218 {
8219 string particle_class = "";
8220 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8221 string config_OnFire_entry = config_OnFire_class + particle_class;
8222 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8223 WPOF_array.Insert(WPOF);
8224 }
8225
8226
8228 }
8229 }
8230
8232 {
8233 config_to_search = "CfgWeapons";
8234 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8235
8236 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8237
8238 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8239
8240 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8241 {
8242 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8243
8244 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8245 {
8246 string particle_class2 = "";
8247 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8248 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8249 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8250 WPOBE_array.Insert(WPOBE);
8251 }
8252
8253
8255 }
8256 }
8257 }
8258
8259
8261 {
8264
8266 {
8267 string config_to_search = "CfgVehicles";
8268
8269 if (IsInherited(Weapon))
8270 config_to_search = "CfgWeapons";
8271
8272 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8273 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8274
8275 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8276 {
8277
8279
8281 {
8283 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8285 return;
8286 }
8287
8290
8291
8292
8293 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8294 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8295
8296 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8297 {
8298 string particle_class = "";
8299 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8300 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8301 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8302
8303 if (entry_type == CT_CLASS)
8304 {
8305 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8306 WPOOH_array.Insert(WPOF);
8307 }
8308 }
8309
8310
8312 }
8313 }
8314 }
8315
8317 {
8319 }
8320
8322 {
8324 {
8326
8329
8332
8333 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8334 }
8335 }
8336
8338 {
8340 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8341
8343 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8344
8346 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8347
8349 {
8351 }
8352 }
8353
8355 {
8357 }
8358
8360 {
8363 else
8365
8367 {
8370 }
8371 else
8372 {
8375
8378 }
8379
8381 }
8382
8384 {
8386 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8387 }
8388
8390 {
8392 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8394 }
8395
8397 {
8399 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8400 }
8401
8403 {
8406
8407 OverheatingParticle OP = new OverheatingParticle();
8412
8414 }
8415
8417 {
8420
8421 return -1;
8422 }
8423
8425 {
8427 {
8430
8431 for (int i = count; i > 0; --i)
8432 {
8433 int id = i - 1;
8436
8439
8440 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8441 {
8442 if (p)
8443 {
8446 }
8447 }
8448 }
8449 }
8450 }
8451
8453 {
8455 {
8457 {
8458 int id = i - 1;
8460
8461 if (OP)
8462 {
8464
8465 if (p)
8466 {
8468 }
8469
8470 delete OP;
8471 }
8472 }
8473
8476 }
8477 }
8478
8481 {
8482 return 0.0;
8483 }
8484
8485
8487 {
8488 return 250;
8489 }
8490
8492 {
8493 return 0;
8494 }
8495
8498 {
8500 return true;
8501
8502 return false;
8503 }
8504
8507 {
8510
8512 {
8514 }
8515 else
8516 {
8517
8519 }
8520
8522 }
8523
8530 {
8531 return -1;
8532 }
8533
8534
8535
8536
8538 {
8540 {
8541 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8542 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8543
8544 if (r_index >= 0)
8545 {
8546 InventoryLocation r_il = new InventoryLocation;
8547 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8548
8549 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8552 {
8553 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8554 }
8556 {
8557 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8558 }
8559
8560 }
8561
8562 player.GetHumanInventory().ClearUserReservedLocation(this);
8563 }
8564
8567 }
8568
8569
8570
8571
8573 {
8574 return ItemBase.m_DebugActionsMask;
8575 }
8576
8578 {
8579 return ItemBase.m_DebugActionsMask & mask;
8580 }
8581
8583 {
8584 ItemBase.m_DebugActionsMask = mask;
8585 }
8586
8588 {
8589 ItemBase.m_DebugActionsMask |= mask;
8590 }
8591
8593 {
8594 ItemBase.m_DebugActionsMask &= ~mask;
8595 }
8596
8598 {
8600 {
8602 }
8603 else
8604 {
8606 }
8607 }
8608
8609
8611 {
8612 if (GetEconomyProfile())
8613 {
8614 float q_max = GetEconomyProfile().GetQuantityMax();
8615 if (q_max > 0)
8616 {
8617 float q_min = GetEconomyProfile().GetQuantityMin();
8618 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8619
8621 {
8622 ComponentEnergyManager comp = GetCompEM();
8624 {
8626 }
8627 }
8629 {
8631
8632 }
8633
8634 }
8635 }
8636 }
8637
8640 {
8641 EntityAI parent = GetHierarchyParent();
8642
8643 if (parent)
8644 {
8645 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8646 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8647 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8648 }
8649 }
8650
8653 {
8654 EntityAI parent = GetHierarchyParent();
8655
8656 if (parent)
8657 {
8658 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8659 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8660 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8661 }
8662 }
8663
8665 {
8666
8667
8668
8669
8671
8673 {
8674 if (ScriptInputUserData.CanStoreInputUserData())
8675 {
8676 ScriptInputUserData ctx = new ScriptInputUserData;
8682 ctx.
Write(use_stack_max);
8685
8687 {
8688 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8689 }
8690 }
8691 }
8692 else if (!
g_Game.IsMultiplayer())
8693 {
8695 }
8696 }
8697
8699 {
8701 }
8702
8704 {
8706 }
8707
8709 {
8711 }
8712
8714 {
8715
8716 return false;
8717 }
8718
8720 {
8721 return false;
8722 }
8723
8727 {
8728 return false;
8729 }
8730
8732 {
8733 return "";
8734 }
8735
8737
8739 {
8740 return false;
8741 }
8742
8744 {
8745 return true;
8746 }
8747
8748
8749
8751 {
8752 return true;
8753 }
8754
8756 {
8757 return true;
8758 }
8759
8761 {
8762 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8764 }
8765
8767 {
8769 }
8770
8772 {
8774 if (!is_being_placed)
8776 SetSynchDirty();
8777 }
8778
8779
8781
8783 {
8785 }
8786
8788 {
8790 }
8791
8793 {
8794 return 1;
8795 }
8796
8798 {
8799 return false;
8800 }
8801
8803 {
8805 SetSynchDirty();
8806 }
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8843 {
8844 super.OnMovedInsideCargo(container);
8845
8846 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8847 }
8848
8849 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8850 {
8851 super.EEItemLocationChanged(oldLoc, newLoc);
8852
8853 PlayerBase newPlayer = null;
8854 PlayerBase oldPlayer = null;
8855
8856 if (newLoc.GetParent())
8857 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8858
8859 if (oldLoc.GetParent())
8860 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8861
8863 {
8864 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8865
8866 if (rIndex >= 0)
8867 {
8868 InventoryLocation rIl = new InventoryLocation;
8869 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8870
8871 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8874 {
8875 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8876 }
8878 {
8880 }
8881
8882 }
8883 }
8884
8886 {
8887 if (newPlayer)
8888 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8889
8890 if (newPlayer == oldPlayer)
8891 {
8892 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8893 {
8895 {
8896 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8897 {
8898 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8899 }
8900 }
8901 else
8902 {
8903 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8904 }
8905 }
8906
8907 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8908 {
8909 int type = oldLoc.GetType();
8911 {
8912 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8913 }
8915 {
8916 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8917 }
8918 }
8919 if (!m_OldLocation)
8920 {
8921 m_OldLocation = new InventoryLocation;
8922 }
8923 m_OldLocation.Copy(oldLoc);
8924 }
8925 else
8926 {
8927 if (m_OldLocation)
8928 {
8929 m_OldLocation.Reset();
8930 }
8931 }
8932
8933 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8934 }
8935 else
8936 {
8937 if (newPlayer)
8938 {
8939 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8940 if (resIndex >= 0)
8941 {
8942 InventoryLocation il = new InventoryLocation;
8943 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8945 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8948 {
8949 il.
GetParent().GetOnReleaseLock().Invoke(it);
8950 }
8952 {
8954 }
8955
8956 }
8957 }
8959 {
8960
8962 }
8963
8964 if (m_OldLocation)
8965 {
8966 m_OldLocation.Reset();
8967 }
8968 }
8969
8971 {
8972 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8973 }
8974
8976 {
8977 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8978 }
8979 }
8980
8981 override void EOnContact(IEntity other, Contact extra)
8982 {
8984 {
8985 int liquidType = -1;
8987 if (impactSpeed > 0.0)
8988 {
8990 #ifndef SERVER
8992 #else
8994 SetSynchDirty();
8995 #endif
8997 }
8998 }
8999
9000 #ifdef SERVER
9001 if (GetCompEM() && GetCompEM().IsPlugged())
9002 {
9003 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9004 GetCompEM().UnplugThis();
9005 }
9006 #endif
9007 }
9008
9010
9012 {
9014 }
9015
9017 {
9018
9019 }
9020
9022 {
9023 super.OnItemLocationChanged(old_owner, new_owner);
9024
9025 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9026 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9027
9028 if (!relatedPlayer && playerNew)
9029 relatedPlayer = playerNew;
9030
9031 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9032 {
9034 if (actionMgr)
9035 {
9036 ActionBase currentAction = actionMgr.GetRunningAction();
9037 if (currentAction)
9039 }
9040 }
9041
9042 Man ownerPlayerOld = null;
9043 Man ownerPlayerNew = null;
9044
9045 if (old_owner)
9046 {
9047 if (old_owner.
IsMan())
9048 {
9049 ownerPlayerOld = Man.Cast(old_owner);
9050 }
9051 else
9052 {
9053 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9054 }
9055 }
9056 else
9057 {
9059 {
9061
9062 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9063 {
9064 GetCompEM().UnplugThis();
9065 }
9066 }
9067 }
9068
9069 if (new_owner)
9070 {
9071 if (new_owner.
IsMan())
9072 {
9073 ownerPlayerNew = Man.Cast(new_owner);
9074 }
9075 else
9076 {
9077 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9078 }
9079 }
9080
9081 if (ownerPlayerOld != ownerPlayerNew)
9082 {
9083 if (ownerPlayerOld)
9084 {
9085 array<EntityAI> subItemsExit = new array<EntityAI>;
9087 for (int i = 0; i < subItemsExit.Count(); i++)
9088 {
9091 }
9092 }
9093
9094 if (ownerPlayerNew)
9095 {
9096 array<EntityAI> subItemsEnter = new array<EntityAI>;
9098 for (int j = 0; j < subItemsEnter.Count(); j++)
9099 {
9102 }
9103 }
9104 }
9105 else if (ownerPlayerNew != null)
9106 {
9107 PlayerBase nplayer;
9108 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9109 {
9110 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9112 for (int k = 0; k < subItemsUpdate.Count(); k++)
9113 {
9115 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9116 }
9117 }
9118 }
9119
9120 if (old_owner)
9121 old_owner.OnChildItemRemoved(this);
9122 if (new_owner)
9123 new_owner.OnChildItemReceived(this);
9124 }
9125
9126
9128 {
9129 super.EEDelete(parent);
9130 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9131 if (player)
9132 {
9134
9135 if (player.IsAlive())
9136 {
9137 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9138 if (r_index >= 0)
9139 {
9140 InventoryLocation r_il = new InventoryLocation;
9141 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9142
9143 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9146 {
9147 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9148 }
9150 {
9151 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9152 }
9153
9154 }
9155
9156 player.RemoveQuickBarEntityShortcut(this);
9157 }
9158 }
9159 }
9160
9162 {
9163 super.EEKilled(killer);
9164
9167 {
9168 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9169 {
9170 if (IsMagazine())
9171 {
9172 if (Magazine.Cast(this).GetAmmoCount() > 0)
9173 {
9175 }
9176 }
9177 else
9178 {
9180 }
9181 }
9182 }
9183 }
9184
9186 {
9187 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9188
9189 super.OnWasAttached(parent, slot_id);
9190
9193
9196 }
9197
9199 {
9200 super.OnWasDetached(parent, slot_id);
9201
9204
9207 }
9208
9210 {
9211 int idx;
9214
9215 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9216 if (inventory_slots.Count() < 1)
9217 {
9218 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9219 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9220 }
9221 else
9222 {
9223 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9224 }
9225
9226 idx = inventory_slots.Find(slot);
9227 if (idx < 0)
9228 return "";
9229
9230 return attach_types.Get(idx);
9231 }
9232
9234 {
9235 int idx = -1;
9236 string slot;
9237
9240
9241 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9242 if (inventory_slots.Count() < 1)
9243 {
9244 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9245 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9246 }
9247 else
9248 {
9249 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9250 if (detach_types.Count() < 1)
9251 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9252 }
9253
9254 for (int i = 0; i < inventory_slots.Count(); i++)
9255 {
9256 slot = inventory_slots.Get(i);
9257 }
9258
9259 if (slot != "")
9260 {
9261 if (detach_types.Count() == 1)
9262 idx = 0;
9263 else
9264 idx = inventory_slots.Find(slot);
9265 }
9266 if (idx < 0)
9267 return "";
9268
9269 return detach_types.Get(idx);
9270 }
9271
9273 {
9274
9276
9277
9278 float min_time = 1;
9279 float max_time = 3;
9280 float delay = Math.RandomFloat(min_time, max_time);
9281
9282 explode_timer.Run(delay, this, "DoAmmoExplosion");
9283 }
9284
9286 {
9287 Magazine magazine = Magazine.Cast(this);
9288 int pop_sounds_count = 6;
9289 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9290
9291
9292 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9293 string sound_name = pop_sounds[ sound_idx ];
9294 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9295
9296
9297 magazine.ServerAddAmmoCount(-1);
9298
9299
9300 float min_temp_to_explode = 100;
9301
9302 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9303 {
9305 }
9306 }
9307
9308
9309 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9310 {
9311 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9312
9313 const int CHANCE_DAMAGE_CARGO = 4;
9314 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9315 const int CHANCE_DAMAGE_NOTHING = 2;
9316
9318 {
9319 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9320 int chances;
9321 int rnd;
9322
9323 if (GetInventory().GetCargo())
9324 {
9325 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9326 rnd = Math.RandomInt(0,chances);
9327
9328 if (rnd < CHANCE_DAMAGE_CARGO)
9329 {
9331 }
9332 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9333 {
9335 }
9336 }
9337 else
9338 {
9339 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9340 rnd = Math.RandomInt(0,chances);
9341
9342 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9343 {
9345 }
9346 }
9347 }
9348 }
9349
9351 {
9352 CargoBase cargo = GetInventory().GetCargo();
9353 if (cargo)
9354 {
9356 if (item_count > 0)
9357 {
9358 int random_pick = Math.RandomInt(0, item_count);
9360 if (!item.IsExplosive())
9361 {
9362 item.AddHealth("","",damage);
9363 return true;
9364 }
9365 }
9366 }
9367 return false;
9368 }
9369
9371 {
9372 GameInventory inventory = GetInventory();
9374 if (attachment_count > 0)
9375 {
9376 int random_pick = Math.RandomInt(0, attachment_count);
9378 if (!attachment.IsExplosive())
9379 {
9380 attachment.AddHealth("","",damage);
9381 return true;
9382 }
9383 }
9384 return false;
9385 }
9386
9388 {
9390 }
9391
9393 {
9395 return GetInventory().CanRemoveEntity();
9396
9397 return false;
9398 }
9399
9401 {
9402
9404 return false;
9405
9406
9408 return false;
9409
9410
9411
9413 if (delta == 0)
9414 return false;
9415
9416
9417 return true;
9418 }
9419
9421 {
9423 {
9424 if (ScriptInputUserData.CanStoreInputUserData())
9425 {
9426 ScriptInputUserData ctx = new ScriptInputUserData;
9431 ctx.
Write(destination_entity);
9435 }
9436 }
9437 else if (!
g_Game.IsMultiplayer())
9438 {
9440 }
9441 }
9442
9444 {
9445 float split_quantity_new;
9449 InventoryLocation loc = new InventoryLocation;
9450
9451 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9452 {
9454 split_quantity_new = stack_max;
9455 else
9457
9459 {
9460 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9461 if (new_item)
9462 {
9463 new_item.SetResultOfSplit(true);
9464 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9466 new_item.
SetQuantity(split_quantity_new,
false,
true);
9467 }
9468 }
9469 }
9470 else if (destination_entity && slot_id == -1)
9471 {
9472 if (quantity > stack_max)
9473 split_quantity_new = stack_max;
9474 else
9475 split_quantity_new = quantity;
9476
9478 {
9479 GameInventory destinationInventory = destination_entity.GetInventory();
9481 {
9484 }
9485
9486 if (new_item)
9487 {
9488 new_item.SetResultOfSplit(true);
9489 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9491 new_item.
SetQuantity(split_quantity_new,
false,
true);
9492 }
9493 }
9494 }
9495 else
9496 {
9497 if (stack_max != 0)
9498 {
9500 {
9502 }
9503
9504 if (split_quantity_new == 0)
9505 {
9506 if (!
g_Game.IsMultiplayer())
9507 player.PhysicalPredictiveDropItem(this);
9508 else
9509 player.ServerDropEntity(this);
9510 return;
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 {
9532 float split_quantity_new;
9536 InventoryLocation loc = new InventoryLocation;
9537
9538 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9539 {
9541 split_quantity_new = stack_max;
9542 else
9544
9546 {
9547 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9548 if (new_item)
9549 {
9550 new_item.SetResultOfSplit(true);
9551 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9553 new_item.
SetQuantity(split_quantity_new,
false,
true);
9554 }
9555 }
9556 }
9557 else if (destination_entity && slot_id == -1)
9558 {
9559 if (quantity > stack_max)
9560 split_quantity_new = stack_max;
9561 else
9562 split_quantity_new = quantity;
9563
9565 {
9566 GameInventory destinationInventory = destination_entity.GetInventory();
9568 {
9571 }
9572
9573 if (new_item)
9574 {
9575 new_item.SetResultOfSplit(true);
9576 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9578 new_item.
SetQuantity(split_quantity_new,
false,
true);
9579 }
9580 }
9581 }
9582 else
9583 {
9584 if (stack_max != 0)
9585 {
9587 {
9589 }
9590
9592 {
9594
9595 if (new_item)
9596 {
9597 new_item.SetResultOfSplit(true);
9598 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9601 new_item.PlaceOnSurface();
9602 }
9603 }
9604 }
9605 }
9606 }
9607
9609 {
9611 {
9612 if (ScriptInputUserData.CanStoreInputUserData())
9613 {
9614 ScriptInputUserData ctx = new ScriptInputUserData;
9619 dst.WriteToContext(ctx);
9621 }
9622 }
9623 else if (!
g_Game.IsMultiplayer())
9624 {
9626 }
9627 }
9628
9630 {
9632 {
9633 if (ScriptInputUserData.CanStoreInputUserData())
9634 {
9635 ScriptInputUserData ctx = new ScriptInputUserData;
9640 ctx.
Write(destination_entity);
9646 }
9647 }
9648 else if (!
g_Game.IsMultiplayer())
9649 {
9651 }
9652 }
9653
9655 {
9657 }
9658
9660 {
9662 float split_quantity_new;
9664 if (dst.IsValid())
9665 {
9666 int slot_id = dst.GetSlot();
9668
9669 if (quantity > stack_max)
9670 split_quantity_new = stack_max;
9671 else
9672 split_quantity_new = quantity;
9673
9675 {
9677
9678 if (new_item)
9679 {
9680 new_item.SetResultOfSplit(true);
9681 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9683 new_item.
SetQuantity(split_quantity_new,
false,
true);
9684 }
9685
9686 return new_item;
9687 }
9688 }
9689
9690 return null;
9691 }
9692
9694 {
9696 float split_quantity_new;
9698 if (destination_entity)
9699 {
9701 if (quantity > stackable)
9702 split_quantity_new = stackable;
9703 else
9704 split_quantity_new = quantity;
9705
9707 {
9708 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9709 if (new_item)
9710 {
9711 new_item.SetResultOfSplit(true);
9712 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9714 new_item.
SetQuantity(split_quantity_new,
false,
true);
9715 }
9716 }
9717 }
9718 }
9719
9721 {
9723 {
9724 if (ScriptInputUserData.CanStoreInputUserData())
9725 {
9726 ScriptInputUserData ctx = new ScriptInputUserData;
9731 ItemBase destination_entity =
this;
9732 ctx.
Write(destination_entity);
9736 }
9737 }
9738 else if (!
g_Game.IsMultiplayer())
9739 {
9741 }
9742 }
9743
9745 {
9747 float split_quantity_new;
9749 if (player)
9750 {
9752 if (quantity > stackable)
9753 split_quantity_new = stackable;
9754 else
9755 split_quantity_new = quantity;
9756
9758 {
9759 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9760 new_item =
ItemBase.Cast(in_hands);
9761 if (new_item)
9762 {
9763 new_item.SetResultOfSplit(true);
9764 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9766 new_item.SetQuantity(split_quantity_new, false, true);
9767 }
9768 }
9769 }
9770 }
9771
9773 {
9775 float split_quantity_new = Math.Floor(quantity * 0.5);
9776
9778 return;
9779
9781
9782 if (new_item)
9783 {
9784 if (new_item.GetQuantityMax() < split_quantity_new)
9785 {
9786 split_quantity_new = new_item.GetQuantityMax();
9787 }
9788
9789 new_item.SetResultOfSplit(true);
9790 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9791
9793 {
9796 }
9797 else
9798 {
9800 new_item.
SetQuantity(split_quantity_new,
false,
true);
9801 }
9802 }
9803 }
9804
9806 {
9808 float split_quantity_new = Math.Floor(quantity / 2);
9809
9811 return;
9812
9813 InventoryLocation invloc = new InventoryLocation;
9815
9817 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9818
9819 if (new_item)
9820 {
9821 if (new_item.GetQuantityMax() < split_quantity_new)
9822 {
9823 split_quantity_new = new_item.GetQuantityMax();
9824 }
9826 {
9829 }
9830 else if (split_quantity_new > 1)
9831 {
9833 new_item.
SetQuantity(split_quantity_new,
false,
true);
9834 }
9835 }
9836 }
9837
9840 {
9841 SetWeightDirty();
9843
9844 if (parent)
9845 parent.OnAttachmentQuantityChangedEx(this, delta);
9846
9848 {
9850 {
9852 }
9854 {
9855 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9857 }
9858 }
9859 }
9860
9863 {
9864
9865 }
9866
9869 {
9871 }
9872
9874 {
9875 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9876
9878 {
9879 if (newLevel == GameConstants.STATE_RUINED)
9880 {
9882 EntityAI parent = GetHierarchyParent();
9883 if (parent && parent.IsFireplace())
9884 {
9885 CargoBase cargo = GetInventory().GetCargo();
9886 if (cargo)
9887 {
9889 {
9891 }
9892 }
9893 }
9894 }
9895
9897 {
9898
9900 return;
9901 }
9902
9903 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9904 {
9906 }
9907 }
9908 }
9909
9910
9912 {
9913 super.OnRightClick();
9914
9916 {
9918 {
9919 if (ScriptInputUserData.CanStoreInputUserData())
9920 {
9921 EntityAI root = GetHierarchyRoot();
9922 Man playerOwner = GetHierarchyRootPlayer();
9923 InventoryLocation dst = new InventoryLocation;
9924
9925
9926 if (!playerOwner && root && root == this)
9927 {
9929 }
9930 else
9931 {
9932
9933 GetInventory().GetCurrentInventoryLocation(dst);
9935 {
9936 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9938 {
9940 }
9941 else
9942 {
9944
9945
9946 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9947 {
9949 }
9950 else
9951 {
9952 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9953 }
9954 }
9955 }
9956 }
9957
9958 ScriptInputUserData ctx = new ScriptInputUserData;
9966 }
9967 }
9968 else if (!
g_Game.IsMultiplayer())
9969 {
9971 }
9972 }
9973 }
9974
9976 {
9977 if (root)
9978 {
9979 vector m4[4];
9980 root.GetTransform(m4);
9981 dst.SetGround(this, m4);
9982 }
9983 else
9984 {
9985 GetInventory().GetCurrentInventoryLocation(dst);
9986 }
9987 }
9988
9989 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9990 {
9991
9992 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9993 return false;
9994
9995 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9996 return false;
9997
9998
10000 return false;
10001
10002
10003 Magazine mag = Magazine.Cast(this);
10004 if (mag)
10005 {
10006 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10007 return false;
10008
10009 if (stack_max_limit)
10010 {
10011 Magazine other_mag = Magazine.Cast(other_item);
10012 if (other_item)
10013 {
10014 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10015 return false;
10016 }
10017
10018 }
10019 }
10020 else
10021 {
10022
10024 return false;
10025
10027 return false;
10028 }
10029
10030 PlayerBase player = null;
10031 if (CastTo(player, GetHierarchyRootPlayer()))
10032 {
10033 if (player.GetInventory().HasAttachment(this))
10034 return false;
10035
10036 if (player.IsItemsToDelete())
10037 return false;
10038 }
10039
10040 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10041 return false;
10042
10043 int slotID;
10045 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10046 return false;
10047
10048 return true;
10049 }
10050
10052 {
10054 }
10055
10057 {
10058 return m_IsResultOfSplit;
10059 }
10060
10062 {
10063 m_IsResultOfSplit = value;
10064 }
10065
10067 {
10069 }
10070
10072 {
10073 float other_item_quantity = other_item.GetQuantity();
10074 float this_free_space;
10075
10077
10079
10080 if (other_item_quantity > this_free_space)
10081 {
10082 return this_free_space;
10083 }
10084 else
10085 {
10086 return other_item_quantity;
10087 }
10088 }
10089
10091 {
10093 }
10094
10096 {
10098 return;
10099
10100 if (!IsMagazine() && other_item)
10101 {
10103 if (quantity_used != 0)
10104 {
10105 float hp1 = GetHealth01("","");
10106 float hp2 = other_item.GetHealth01("","");
10107 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10108 hpResult = hpResult / (
GetQuantity() + quantity_used);
10109
10110 hpResult *= GetMaxHealth();
10111 Math.Round(hpResult);
10112 SetHealth("", "Health", hpResult);
10113
10115 other_item.AddQuantity(-quantity_used);
10116 }
10117 }
10119 }
10120
10122 {
10123 #ifdef SERVER
10124 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10125 GetHierarchyParent().IncreaseLifetimeUp();
10126 #endif
10127 };
10128
10130 {
10131 PlayerBase p = PlayerBase.Cast(player);
10132
10133 array<int> recipesIds = p.m_Recipes;
10134 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10135 if (moduleRecipesManager)
10136 {
10137 EntityAI itemInHands = player.GetEntityInHands();
10138 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10139 }
10140
10141 for (int i = 0;i < recipesIds.Count(); i++)
10142 {
10143 int key = recipesIds.Get(i);
10144 string recipeName = moduleRecipesManager.GetRecipeName(key);
10146 }
10147 }
10148
10149
10150 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10151 {
10152 super.GetDebugActions(outputList);
10153
10154
10160
10161
10166
10171
10172
10176
10177
10179 {
10183 }
10184
10187
10188
10192
10194
10195 InventoryLocation loc = new InventoryLocation();
10196 GetInventory().GetCurrentInventoryLocation(loc);
10198 {
10199 if (Gizmo_IsSupported())
10202 }
10203
10205 }
10206
10207
10208
10209
10211 {
10212 super.OnAction(action_id, player, ctx);
10213
10215 {
10216 switch (action_id)
10217 {
10221 return true;
10225 return true;
10226 }
10227 }
10228
10230 {
10231 switch (action_id)
10232 {
10234 Delete();
10235 return true;
10236 }
10237 }
10238
10239 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10240 {
10241 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10242 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10243 PlayerBase p = PlayerBase.Cast(player);
10244 if (
EActions.RECIPES_RANGE_START < 1000)
10245 {
10246 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10247 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10248 }
10249 }
10250 #ifndef SERVER
10251 else if (action_id ==
EActions.WATCH_PLAYER)
10252 {
10253 PluginDeveloper.SetDeveloperItemClientEx(player);
10254 }
10255 #endif
10257 {
10258 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10259 {
10260 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10261 OnDebugButtonPressServer(id + 1);
10262 }
10263
10264 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10265 {
10266 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10268 }
10269
10270 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10271 {
10272 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10274 }
10275
10276 else if (action_id ==
EActions.ADD_QUANTITY)
10277 {
10278 if (IsMagazine())
10279 {
10280 Magazine mag = Magazine.Cast(this);
10281 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10282 }
10283 else
10284 {
10286 }
10287
10288 if (m_EM)
10289 {
10290 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10291 }
10292
10293 }
10294
10295 else if (action_id ==
EActions.REMOVE_QUANTITY)
10296 {
10297 if (IsMagazine())
10298 {
10299 Magazine mag2 = Magazine.Cast(this);
10300 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10301 }
10302 else
10303 {
10305 }
10306 if (m_EM)
10307 {
10308 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10309 }
10310
10311 }
10312
10313 else if (action_id ==
EActions.SET_QUANTITY_0)
10314 {
10316
10317 if (m_EM)
10318 {
10319 m_EM.SetEnergy(0);
10320 }
10321 }
10322
10323 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10324 {
10326
10327 if (m_EM)
10328 {
10329 m_EM.SetEnergy(m_EM.GetEnergyMax());
10330 }
10331 }
10332
10333 else if (action_id ==
EActions.ADD_HEALTH)
10334 {
10335 AddHealth("","",GetMaxHealth("","Health")/5);
10336 }
10337 else if (action_id ==
EActions.REMOVE_HEALTH)
10338 {
10339 AddHealth("","",-GetMaxHealth("","Health")/5);
10340 }
10341 else if (action_id ==
EActions.DESTROY_HEALTH)
10342 {
10343 SetHealth01("","",0);
10344 }
10345 else if (action_id ==
EActions.WATCH_ITEM)
10346 {
10348 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10349 #ifdef DEVELOPER
10350 SetDebugDeveloper_item(this);
10351 #endif
10352 }
10353
10354 else if (action_id ==
EActions.ADD_TEMPERATURE)
10355 {
10356 AddTemperature(20);
10357
10358 }
10359
10360 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10361 {
10362 AddTemperature(-20);
10363
10364 }
10365
10366 else if (action_id ==
EActions.FLIP_FROZEN)
10367 {
10368 SetFrozen(!GetIsFrozen());
10369
10370 }
10371
10372 else if (action_id ==
EActions.ADD_WETNESS)
10373 {
10375
10376 }
10377
10378 else if (action_id ==
EActions.REMOVE_WETNESS)
10379 {
10381
10382 }
10383
10384 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10385 {
10388
10389
10390 }
10391
10392 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10393 {
10396 }
10397
10398 else if (action_id ==
EActions.MAKE_SPECIAL)
10399 {
10400 auto debugParams = DebugSpawnParams.WithPlayer(player);
10401 OnDebugSpawnEx(debugParams);
10402 }
10403
10404 }
10405
10406
10407 return false;
10408 }
10409
10410
10411
10412
10416
10419
10420
10421
10423 {
10424 return false;
10425 }
10426
10427
10429 {
10430 return true;
10431 }
10432
10433
10435 {
10436 return true;
10437 }
10438
10439
10440
10442 {
10443 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10444 return g_Game.ConfigIsExisting(config_path);
10445 }
10446
10449 {
10450 return null;
10451 }
10452
10454 {
10455 return false;
10456 }
10457
10459 {
10460 return false;
10461 }
10462
10466
10467
10469 {
10470 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10471 return module_repairing.CanRepair(this, item_repair_kit);
10472 }
10473
10474
10475 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10476 {
10477 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10478 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10479 }
10480
10481
10483 {
10484
10485
10486
10487
10488
10489
10490
10491
10492 return 1;
10493 }
10494
10495
10496
10498 {
10500 }
10501
10502
10503
10505 {
10507 }
10508
10509
10518 {
10519 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10520
10521 if (player)
10522 {
10523 player.MessageStatus(text);
10524 }
10525 }
10526
10527
10536 {
10537 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10538
10539 if (player)
10540 {
10541 player.MessageAction(text);
10542 }
10543 }
10544
10545
10554 {
10555 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10556
10557 if (player)
10558 {
10559 player.MessageFriendly(text);
10560 }
10561 }
10562
10563
10572 {
10573 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10574
10575 if (player)
10576 {
10577 player.MessageImportant(text);
10578 }
10579 }
10580
10582 {
10583 return true;
10584 }
10585
10586
10587 override bool KindOf(
string tag)
10588 {
10589 bool found = false;
10590 string item_name = this.
GetType();
10592 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10593
10594 int array_size = item_tag_array.Count();
10595 for (int i = 0; i < array_size; i++)
10596 {
10597 if (item_tag_array.Get(i) == tag)
10598 {
10599 found = true;
10600 break;
10601 }
10602 }
10603 return found;
10604 }
10605
10606
10608 {
10609
10610 super.OnRPC(sender, rpc_type,ctx);
10611
10612
10613 switch (rpc_type)
10614 {
10615 #ifndef SERVER
10616 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10617 Param2<bool, string> p = new Param2<bool, string>(false, "");
10618
10620 return;
10621
10622 bool play = p.param1;
10623 string soundSet = p.param2;
10624
10625 if (play)
10626 {
10628 {
10630 {
10632 }
10633 }
10634 else
10635 {
10637 }
10638 }
10639 else
10640 {
10642 }
10643
10644 break;
10645 #endif
10646
10647 }
10648
10650 {
10652 }
10653 }
10654
10655
10656
10657
10659 {
10660 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10661 return plugin.GetID(
name);
10662 }
10663
10665 {
10666 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10667 return plugin.GetName(id);
10668 }
10669
10672 {
10673
10674
10675 int varFlags;
10676 if (!ctx.
Read(varFlags))
10677 return;
10678
10679 if (varFlags & ItemVariableFlags.FLOAT)
10680 {
10682 }
10683 }
10684
10686 {
10687
10688 super.SerializeNumericalVars(floats_out);
10689
10690
10691
10693 {
10695 }
10696
10698 {
10700 }
10701
10703 {
10705 }
10706
10708 {
10713 }
10714
10716 {
10718 }
10719 }
10720
10722 {
10723
10724 super.DeSerializeNumericalVars(floats);
10725
10726
10727 int index = 0;
10728 int mask = Math.Round(floats.Get(index));
10729
10730 index++;
10731
10733 {
10735 {
10737 }
10738 else
10739 {
10740 float quantity = floats.Get(index);
10741 SetQuantity(quantity,
true,
false,
false,
false);
10742 }
10743 index++;
10744 }
10745
10747 {
10748 float wet = floats.Get(index);
10750 index++;
10751 }
10752
10754 {
10755 int liquidtype = Math.Round(floats.Get(index));
10757 index++;
10758 }
10759
10761 {
10763 index++;
10765 index++;
10767 index++;
10769 index++;
10770 }
10771
10773 {
10774 int cleanness = Math.Round(floats.Get(index));
10776 index++;
10777 }
10778 }
10779
10781 {
10782 super.WriteVarsToCTX(ctx);
10783
10784
10786 {
10788 }
10789
10791 {
10793 }
10794
10796 {
10798 }
10799
10801 {
10802 int r,g,b,a;
10808 }
10809
10811 {
10813 }
10814 }
10815
10817 {
10818 if (!super.ReadVarsFromCTX(ctx,version))
10819 return false;
10820
10821 int intValue;
10822 float value;
10823
10824 if (version < 140)
10825 {
10826 if (!ctx.
Read(intValue))
10827 return false;
10828
10829 m_VariablesMask = intValue;
10830 }
10831
10833 {
10834 if (!ctx.
Read(value))
10835 return false;
10836
10838 {
10840 }
10841 else
10842 {
10844 }
10845 }
10846
10847 if (version < 140)
10848 {
10850 {
10851 if (!ctx.
Read(value))
10852 return false;
10853 SetTemperatureDirect(value);
10854 }
10855 }
10856
10858 {
10859 if (!ctx.
Read(value))
10860 return false;
10862 }
10863
10865 {
10866 if (!ctx.
Read(intValue))
10867 return false;
10869 }
10870
10872 {
10873 int r,g,b,a;
10875 return false;
10877 return false;
10879 return false;
10881 return false;
10882
10884 }
10885
10887 {
10888 if (!ctx.
Read(intValue))
10889 return false;
10891 }
10892
10893 if (version >= 138 && version < 140)
10894 {
10896 {
10897 if (!ctx.
Read(intValue))
10898 return false;
10899 SetFrozen(intValue);
10900 }
10901 }
10902
10903 return true;
10904 }
10905
10906
10908 {
10911 {
10913 }
10914
10915 if (!super.OnStoreLoad(ctx, version))
10916 {
10918 return false;
10919 }
10920
10921 if (version >= 114)
10922 {
10923 bool hasQuickBarIndexSaved;
10924
10925 if (!ctx.
Read(hasQuickBarIndexSaved))
10926 {
10928 return false;
10929 }
10930
10931 if (hasQuickBarIndexSaved)
10932 {
10933 int itmQBIndex;
10934
10935
10936 if (!ctx.
Read(itmQBIndex))
10937 {
10939 return false;
10940 }
10941
10942 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10943 if (itmQBIndex != -1 && parentPlayer)
10944 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10945 }
10946 }
10947 else
10948 {
10949
10950 PlayerBase player;
10951 int itemQBIndex;
10952 if (version ==
int.
MAX)
10953 {
10954 if (!ctx.
Read(itemQBIndex))
10955 {
10957 return false;
10958 }
10959 }
10960 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10961 {
10962
10963 if (!ctx.
Read(itemQBIndex))
10964 {
10966 return false;
10967 }
10968 if (itemQBIndex != -1 && player)
10969 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10970 }
10971 }
10972
10973 if (version < 140)
10974 {
10975
10976 if (!LoadVariables(ctx, version))
10977 {
10979 return false;
10980 }
10981 }
10982
10983
10985 {
10987 return false;
10988 }
10989 if (version >= 132)
10990 {
10992 if (raib)
10993 {
10995 {
10997 return false;
10998 }
10999 }
11000 }
11001
11003 return true;
11004 }
11005
11006
11007
11009 {
11010 super.OnStoreSave(ctx);
11011
11012 PlayerBase player;
11013 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11014 {
11016
11017 int itemQBIndex = -1;
11018 itemQBIndex = player.FindQuickBarEntityIndex(this);
11019 ctx.
Write(itemQBIndex);
11020 }
11021 else
11022 {
11024 }
11025
11027
11029 if (raib)
11030 {
11032 }
11033 }
11034
11035
11037 {
11038 super.AfterStoreLoad();
11039
11041 {
11043 }
11044
11046 {
11049 }
11050 }
11051
11053 {
11054 super.EEOnAfterLoad();
11055
11057 {
11059 }
11060
11063 }
11064
11066 {
11067 return false;
11068 }
11069
11070
11071
11073 {
11075 {
11076 #ifdef PLATFORM_CONSOLE
11077
11079 {
11081 if (menu)
11082 {
11084 }
11085 }
11086 #endif
11087 }
11088
11090 {
11093 }
11094
11096 {
11097 SetWeightDirty();
11099 }
11101 {
11104 }
11105
11107 {
11110
11113 }
11115 {
11119 }
11120
11121 super.OnVariablesSynchronized();
11122 }
11123
11124
11125
11127 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11128 {
11129 if (!IsServerCheck(allow_client))
11130 return false;
11131
11133 return false;
11134
11137
11138 if (value <= (min + 0.001))
11139 value = min;
11140
11141 if (value == min)
11142 {
11143 if (destroy_config)
11144 {
11145 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11146 if (dstr)
11147 {
11149 this.Delete();
11150 return true;
11151 }
11152 }
11153 else if (destroy_forced)
11154 {
11156 this.Delete();
11157 return true;
11158 }
11159
11161 }
11162
11165
11167 {
11168 EntityAI parent = GetHierarchyRoot();
11169 InventoryLocation iLoc = new InventoryLocation();
11170 GetInventory().GetCurrentInventoryLocation(iLoc);
11172 {
11173 int iLocSlot = iLoc.
GetSlot();
11175 {
11177 }
11179 {
11181 }
11182 }
11183 }
11184
11186 {
11188
11189 if (delta)
11191 }
11192
11194
11195 return false;
11196 }
11197
11198
11200 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11201 {
11203 }
11204
11206 {
11209 }
11210
11212 {
11215 }
11216
11218 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11219 {
11220 float value_clamped = Math.Clamp(value, 0, 1);
11222 SetQuantity(result, destroy_config, destroy_forced);
11223 }
11224
11225
11228 {
11230 }
11231
11233 {
11235 }
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11247 {
11248 int slot = -1;
11249 GameInventory inventory = GetInventory();
11250 if (inventory)
11251 {
11252 InventoryLocation il = new InventoryLocation;
11255 }
11256
11258 }
11259
11261 {
11262 float quantity_max = 0;
11263
11265 {
11266 if (attSlotID != -1)
11267 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11268
11269 if (quantity_max <= 0)
11271 }
11272
11273 if (quantity_max <= 0)
11275
11276 return quantity_max;
11277 }
11278
11280 {
11282 }
11283
11285 {
11287 }
11288
11289
11291 {
11293 }
11294
11296 {
11298 }
11299
11301 {
11303 }
11304
11305
11307 {
11308
11309 float weightEx = GetWeightEx();
11310 float special = GetInventoryAndCargoWeight();
11311 return weightEx - special;
11312 }
11313
11314
11316 {
11318 }
11319
11321 {
11323 {
11324 #ifdef DEVELOPER
11325 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11326 {
11327 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11329 }
11330 #endif
11331
11332 return GetQuantity() * GetConfigWeightModified();
11333 }
11334 else if (HasEnergyManager())
11335 {
11336 #ifdef DEVELOPER
11337 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11338 {
11339 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11340 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11341 }
11342 #endif
11343 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11344 }
11345 else
11346 {
11347 #ifdef DEVELOPER
11348 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11349 {
11350 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11351 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11352 }
11353 #endif
11354 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11355 }
11356 }
11357
11360 {
11361 int item_count = 0;
11363
11364 GameInventory inventory = GetInventory();
11365 CargoBase cargo = inventory.
GetCargo();
11366 if (cargo != NULL)
11367 {
11369 }
11370
11372 for (int i = 0; i < nAttachments; ++i)
11373 {
11375 if (item)
11376 item_count += item.GetNumberOfItems();
11377 }
11378 return item_count;
11379 }
11380
11383 {
11384 float weight = 0;
11385 float wetness = 1;
11386 if (include_wetness)
11389 {
11390 weight = wetness * m_ConfigWeight;
11391 }
11393 {
11394 weight = 1;
11395 }
11396 return weight;
11397 }
11398
11399
11400
11402 {
11403 GameInventory inventory = GetInventory();
11404 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11405 {
11406 array<EntityAI> items = new array<EntityAI>;
11408 for (int i = 0; i < items.Count(); ++i)
11409 {
11411 if (item)
11412 {
11413 g_Game.ObjectDelete(item);
11414 }
11415 }
11416 }
11417 }
11418
11419
11420
11421
11423 {
11424 float energy = 0;
11425 if (HasEnergyManager())
11426 {
11427 energy = GetCompEM().GetEnergy();
11428 }
11429 return energy;
11430 }
11431
11432
11434 {
11435 super.OnEnergyConsumed();
11436
11438 }
11439
11441 {
11442 super.OnEnergyAdded();
11443
11445 }
11446
11447
11449 {
11450 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11451 {
11453 {
11454 float energy_0to1 = GetCompEM().GetEnergy0To1();
11456 }
11457 }
11458 }
11459
11460
11462 {
11463 return ConfigGetFloat("heatIsolation");
11464 }
11465
11467 {
11469 }
11470
11472 {
11473 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11474 if (
g_Game.ConfigIsExisting(paramPath))
11475 return g_Game.ConfigGetFloat(paramPath);
11476
11477 return 0.0;
11478 }
11479
11481 {
11482 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11483 if (
g_Game.ConfigIsExisting(paramPath))
11484 return g_Game.ConfigGetFloat(paramPath);
11485
11486 return 0.0;
11487 }
11488
11489 override void SetWet(
float value,
bool allow_client =
false)
11490 {
11491 if (!IsServerCheck(allow_client))
11492 return;
11493
11496
11498
11499 m_VarWet = Math.Clamp(value, min, max);
11500
11502 {
11505 }
11506 }
11507
11508 override void AddWet(
float value)
11509 {
11511 }
11512
11514 {
11516 }
11517
11519 {
11521 }
11522
11524 {
11526 }
11527
11529 {
11531 }
11532
11534 {
11536 }
11537
11538 override void OnWetChanged(
float newVal,
float oldVal)
11539 {
11542 if (newLevel != oldLevel)
11543 {
11545 }
11546 }
11547
11549 {
11550 SetWeightDirty();
11551 }
11552
11554 {
11555 return GetWetLevelInternal(
m_VarWet);
11556 }
11557
11558
11559
11561 {
11563 }
11564
11566 {
11568 }
11569
11571 {
11573 }
11574
11576 {
11578 }
11579
11580
11581
11583 {
11584 if (ConfigIsExisting("itemModelLength"))
11585 {
11586 return ConfigGetFloat("itemModelLength");
11587 }
11588 return 0;
11589 }
11590
11592 {
11593 if (ConfigIsExisting("itemAttachOffset"))
11594 {
11595 return ConfigGetFloat("itemAttachOffset");
11596 }
11597 return 0;
11598 }
11599
11600 override void SetCleanness(
int value,
bool allow_client =
false)
11601 {
11602 if (!IsServerCheck(allow_client))
11603 return;
11604
11606
11608
11611 }
11612
11614 {
11616 }
11617
11619 {
11620 return true;
11621 }
11622
11623
11624
11625
11627 {
11629 }
11630
11632 {
11634 }
11635
11636
11637
11638
11639 override void SetColor(
int r,
int g,
int b,
int a)
11640 {
11646 }
11648 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11649 {
11654 }
11655
11657 {
11659 }
11660
11663 {
11664 int r,g,b,a;
11666 r = r/255;
11667 g = g/255;
11668 b = b/255;
11669 a = a/255;
11670 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11671 }
11672
11673
11674
11675 override void SetLiquidType(
int value,
bool allow_client =
false)
11676 {
11677 if (!IsServerCheck(allow_client))
11678 return;
11679
11684 }
11685
11687 {
11688 return ConfigGetInt("varLiquidTypeInit");
11689 }
11690
11692 {
11694 }
11695
11697 {
11699 SetFrozen(false);
11700 }
11701
11704 {
11705 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11706 }
11707
11708
11711 {
11712 PlayerBase nplayer;
11713 if (PlayerBase.CastTo(nplayer, player))
11714 {
11716 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11717 }
11718 }
11719
11720
11723 {
11724 PlayerBase nplayer;
11725 if (PlayerBase.CastTo(nplayer,player))
11726 {
11727 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11728 }
11729
11730 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11731
11732 if (HasEnergyManager())
11733 {
11734 GetCompEM().UpdatePlugState();
11735 }
11736 }
11737
11738
11740 {
11741 super.OnPlacementStarted(player);
11742
11744 }
11745
11746 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11747 {
11749 {
11750 m_AdminLog.OnPlacementComplete(player,
this);
11751 }
11752
11753 super.OnPlacementComplete(player, position, orientation);
11754 }
11755
11756
11757
11758
11759
11761 {
11763 {
11764 return true;
11765 }
11766 else
11767 {
11768 return false;
11769 }
11770 }
11771
11772
11774 {
11776 {
11778 }
11779 }
11780
11781
11783 {
11785 }
11786
11788 {
11790 }
11791
11792 override void InsertAgent(
int agent,
float count = 1)
11793 {
11794 if (count < 1)
11795 return;
11796
11798 }
11799
11802 {
11804 }
11805
11806
11808 {
11810 }
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11854 {
11856 return false;
11857 return true;
11858 }
11859
11861 {
11862
11864 }
11865
11866
11869 {
11870 super.CheckForRoofLimited(timeTresholdMS);
11871
11872 float time =
g_Game.GetTime();
11873 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11874 {
11875 m_PreviousRoofTestTime = time;
11876 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11877 }
11878 }
11879
11880
11882 {
11884 {
11885 return 0;
11886 }
11887
11888 if (GetInventory().GetAttachmentSlotsCount() != 0)
11889 {
11890 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11891 if (filter)
11892 return filter.GetProtectionLevel(type, false, system);
11893 else
11894 return 0;
11895 }
11896
11897 string subclassPath, entryName;
11898
11899 switch (type)
11900 {
11902 entryName = "biological";
11903 break;
11905 entryName = "chemical";
11906 break;
11907 default:
11908 entryName = "biological";
11909 break;
11910 }
11911
11912 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11913
11914 return g_Game.ConfigGetFloat(subclassPath + entryName);
11915 }
11916
11917
11918
11921 {
11922 if (!IsMagazine())
11924
11926 }
11927
11928
11929
11930
11931
11936 {
11937 return true;
11938 }
11939
11941 {
11943 }
11944
11945
11946
11947
11948
11950 {
11951 if (parent)
11952 {
11953 if (parent.IsInherited(DayZInfected))
11954 return true;
11955
11956 if (!parent.IsRuined())
11957 return true;
11958 }
11959
11960 return true;
11961 }
11962
11964 {
11965 if (!super.CanPutAsAttachment(parent))
11966 {
11967 return false;
11968 }
11969
11970 if (!IsRuined() && !parent.IsRuined())
11971 {
11972 return true;
11973 }
11974
11975 return false;
11976 }
11977
11979 {
11980
11981
11982
11983
11984 return super.CanReceiveItemIntoCargo(item);
11985 }
11986
11988 {
11989
11990
11991
11992
11993 GameInventory attachmentInv = attachment.GetInventory();
11995 {
11996 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11997 return false;
11998 }
11999
12000 InventoryLocation loc = new InventoryLocation();
12001 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12002 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12003 return false;
12004
12005 return super.CanReceiveAttachment(attachment, slotId);
12006 }
12007
12009 {
12010 if (!super.CanReleaseAttachment(attachment))
12011 return false;
12012
12013 return GetInventory().AreChildrenAccessible();
12014 }
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12037 {
12038 int id = muzzle_owner.GetMuzzleID();
12039 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12040
12041 if (WPOF_array)
12042 {
12043 for (int i = 0; i < WPOF_array.Count(); i++)
12044 {
12045 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12046
12047 if (WPOF)
12048 {
12049 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12050 }
12051 }
12052 }
12053 }
12054
12055
12057 {
12058 int id = muzzle_owner.GetMuzzleID();
12060
12061 if (WPOBE_array)
12062 {
12063 for (int i = 0; i < WPOBE_array.Count(); i++)
12064 {
12065 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12066
12067 if (WPOBE)
12068 {
12069 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12070 }
12071 }
12072 }
12073 }
12074
12075
12077 {
12078 int id = muzzle_owner.GetMuzzleID();
12079 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12080
12081 if (WPOOH_array)
12082 {
12083 for (int i = 0; i < WPOOH_array.Count(); i++)
12084 {
12085 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12086
12087 if (WPOOH)
12088 {
12089 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12090 }
12091 }
12092 }
12093 }
12094
12095
12097 {
12098 int id = muzzle_owner.GetMuzzleID();
12099 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12100
12101 if (WPOOH_array)
12102 {
12103 for (int i = 0; i < WPOOH_array.Count(); i++)
12104 {
12105 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12106
12107 if (WPOOH)
12108 {
12109 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12110 }
12111 }
12112 }
12113 }
12114
12115
12117 {
12118 int id = muzzle_owner.GetMuzzleID();
12119 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12120
12121 if (WPOOH_array)
12122 {
12123 for (int i = 0; i < WPOOH_array.Count(); i++)
12124 {
12125 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12126
12127 if (WPOOH)
12128 {
12129 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12130 }
12131 }
12132 }
12133 }
12134
12135
12136
12138 {
12140 {
12141 return true;
12142 }
12143
12144 return false;
12145 }
12146
12148 {
12150 {
12151 return true;
12152 }
12153
12154 return false;
12155 }
12156
12158 {
12160 {
12161 return true;
12162 }
12163
12164 return false;
12165 }
12166
12168 {
12169 return false;
12170 }
12171
12174 {
12175 return UATimeSpent.DEFAULT_DEPLOY;
12176 }
12177
12178
12179
12180
12182 {
12184 SetSynchDirty();
12185 }
12186
12188 {
12190 }
12191
12192
12194 {
12195 return false;
12196 }
12197
12200 {
12201 string att_type = "None";
12202
12203 if (ConfigIsExisting("soundAttType"))
12204 {
12205 att_type = ConfigGetString("soundAttType");
12206 }
12207
12209 }
12210
12212 {
12214 }
12215
12216
12217
12218
12219
12225
12227 {
12230
12232 }
12233
12234
12236 {
12238 return;
12239
12241
12244
12247
12248 SoundParameters params = new SoundParameters();
12252 }
12253
12254
12256 {
12258 {
12261
12262 SetSynchDirty();
12263
12266 }
12267 }
12268
12270 {
12272 }
12273
12274
12276 {
12278 return;
12279
12281 SetSynchDirty();
12282
12285 }
12286
12288 {
12291 }
12292
12294 {
12296 }
12297
12298 void OnApply(PlayerBase player);
12299
12301 {
12302 return 1.0;
12303 };
12304
12306 {
12308 }
12309
12311 {
12313 }
12314
12316
12318 {
12319 SetDynamicPhysicsLifeTime(0.01);
12321 }
12322
12324 {
12325 array<string> zone_names = new array<string>;
12326 GetDamageZones(zone_names);
12327 for (int i = 0; i < zone_names.Count(); i++)
12328 {
12329 SetHealthMax(zone_names.Get(i),"Health");
12330 }
12331 SetHealthMax("","Health");
12332 }
12333
12336 {
12337 float global_health = GetHealth01("","Health");
12338 array<string> zones = new array<string>;
12339 GetDamageZones(zones);
12340
12341 for (int i = 0; i < zones.Count(); i++)
12342 {
12343 SetHealth01(zones.Get(i),"Health",global_health);
12344 }
12345 }
12346
12349 {
12350 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12351 }
12352
12354 {
12355 if (!hasRootAsPlayer)
12356 {
12357 if (refParentIB)
12358 {
12359
12360 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12361 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12362
12363 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12364 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12365
12368 }
12369 else
12370 {
12371
12374 }
12375 }
12376 }
12377
12379 {
12381 {
12382 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12383 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12384 {
12385 float heatPermCoef = 1.0;
12387 while (ent)
12388 {
12389 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12390 ent = ent.GetHierarchyParent();
12391 }
12392
12393 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12394 }
12395 }
12396 }
12397
12399 {
12400
12401 EntityAI parent = GetHierarchyParent();
12402 if (!parent)
12403 {
12404 hasParent = false;
12405 hasRootAsPlayer = false;
12406 }
12407 else
12408 {
12409 hasParent = true;
12410 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12411 refParentIB =
ItemBase.Cast(parent);
12412 }
12413 }
12414
12415 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12416 {
12417
12418 }
12419
12421 {
12422
12423 return false;
12424 }
12425
12427 {
12428
12429
12430 return false;
12431 }
12432
12434 {
12435
12436 return false;
12437 }
12438
12441 {
12442 return !GetIsFrozen() &&
IsOpen();
12443 }
12444
12446 {
12447 bool hasParent = false, hasRootAsPlayer = false;
12449
12450 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12451 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12452
12453 if (wwtu || foodDecay)
12454 {
12458
12459 if (processWetness || processTemperature || processDecay)
12460 {
12462
12463 if (processWetness)
12464 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12465
12466 if (processTemperature)
12468
12469 if (processDecay)
12470 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12471 }
12472 }
12473 }
12474
12477 {
12479 }
12480
12482 {
12485
12486 return super.GetTemperatureFreezeThreshold();
12487 }
12488
12490 {
12493
12494 return super.GetTemperatureThawThreshold();
12495 }
12496
12498 {
12501
12502 return super.GetItemOverheatThreshold();
12503 }
12504
12506 {
12508 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12509
12510 return super.GetTemperatureFreezeTime();
12511 }
12512
12514 {
12516 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12517
12518 return super.GetTemperatureThawTime();
12519 }
12520
12525
12527 {
12528 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12529 }
12530
12532 {
12533 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12534 }
12535
12538 {
12540 }
12541
12543 {
12545 }
12546
12548 {
12550 }
12551
12554 {
12555 return null;
12556 }
12557
12560 {
12561 return false;
12562 }
12563
12565 {
12567 {
12570 if (!trg)
12571 {
12573 explosive = this;
12574 }
12575
12576 explosive.PairRemote(trg);
12578
12579 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12580 trg.SetPersistentPairID(persistentID);
12581 explosive.SetPersistentPairID(persistentID);
12582
12583 return true;
12584 }
12585 return false;
12586 }
12587
12590 {
12591 float ret = 1.0;
12594 ret *= GetHealth01();
12595
12596 return ret;
12597 }
12598
12599 #ifdef DEVELOPER
12600 override void SetDebugItem()
12601 {
12602 super.SetDebugItem();
12603 _itemBase = this;
12604 }
12605
12607 {
12608 string text = super.GetDebugText();
12609
12611 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12612
12613 return text;
12614 }
12615 #endif
12616
12618 {
12619 return true;
12620 }
12621
12623
12625
12627 {
12630 }
12631
12632
12640
12656
12657 [
Obsolete(
"Use ItemSoundHandler instead")]
12660 {
12661 if (!
g_Game.IsDedicatedServer())
12662 {
12663 if (ConfigIsExisting("attachSoundSet"))
12664 {
12665 string cfg_path = "";
12666 string soundset = "";
12667 string type_name =
GetType();
12668
12671 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12672 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12673
12674 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12675 {
12676 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12677 {
12678 if (cfg_slot_array[i] == slot_type)
12679 {
12680 soundset = cfg_soundset_array[i];
12681 break;
12682 }
12683 }
12684 }
12685
12686 if (soundset != "")
12687 {
12688 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12690 }
12691 }
12692 }
12693 }
12694
12696}
12697
12699{
12701 if (entity)
12702 {
12703 bool is_item = entity.IsInherited(
ItemBase);
12704 if (is_item && full_quantity)
12705 {
12708 }
12709 }
12710 else
12711 {
12713 return NULL;
12714 }
12715 return entity;
12716}
12717
12719{
12720 if (item)
12721 {
12722 if (health > 0)
12723 item.SetHealth("", "", health);
12724
12725 if (item.CanHaveTemperature())
12726 {
12728 if (item.CanFreeze())
12729 item.SetFrozen(false);
12730 }
12731
12732 if (item.HasEnergyManager())
12733 {
12734 if (quantity >= 0)
12735 {
12736 item.GetCompEM().SetEnergy0To1(quantity);
12737 }
12738 else
12739 {
12741 }
12742 }
12743 else if (item.IsMagazine())
12744 {
12745 Magazine mag = Magazine.Cast(item);
12746 if (quantity >= 0)
12747 {
12748 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12749 }
12750 else
12751 {
12753 }
12754
12755 }
12756 else
12757 {
12758 if (quantity >= 0)
12759 {
12760 item.SetQuantityNormalized(quantity, false);
12761 }
12762 else
12763 {
12765 }
12766
12767 }
12768 }
12769}
12770
12771#ifdef DEVELOPER
12773#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.