Send message to owner player in red color.
7679{
7681 {
7682 return true;
7683 }
7684};
7685
7687{
7688
7689};
7690
7691
7692
7694{
7698
7700
7703
7704
7705
7706
7707
7716
7722
7727
7732
7753 protected bool m_IsResultOfSplit
7754
7756
7761
7762
7763
7765
7769
7770
7771
7773
7776
7777
7778
7784
7785
7793
7796
7797
7799
7800
7802
7803
7808
7809
7814
7816
7817
7819
7820
7822 {
7827
7828 if (!
g_Game.IsDedicatedServer())
7829 {
7831 {
7833
7835 {
7837 }
7838 }
7839
7842 }
7843
7844 m_OldLocation = null;
7845
7847 {
7849 }
7850
7851 if (ConfigIsExisting("headSelectionsToHide"))
7852 {
7855 }
7856
7858 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7859 {
7861 }
7862
7864
7865 m_IsResultOfSplit = false;
7866
7868 }
7869
7871 {
7872 super.InitItemVariables();
7873
7879 m_Count = ConfigGetInt(
"count");
7880
7883
7888
7891
7896
7908
7912
7913
7916 if (ConfigIsExisting("canBeSplit"))
7917 {
7920 }
7921
7923 if (ConfigIsExisting("itemBehaviour"))
7925
7926
7929 RegisterNetSyncVariableInt("m_VarLiquidType");
7930 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7931
7932 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7933 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7934 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7935
7936 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7937 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7938 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7939 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7940
7941 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7942 RegisterNetSyncVariableBool("m_IsTakeable");
7943 RegisterNetSyncVariableBool("m_IsHologram");
7944
7947 {
7950 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7951 }
7952
7954
7956 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7958
7960 }
7961
7963 {
7965 }
7966
7968 {
7971 {
7976 }
7977 }
7978
7979 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7980 {
7982 {
7985 }
7986
7988 }
7989
7991 {
7997 }
7998
8000
8002 {
8004
8005 if (!action)
8006 {
8007 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8008 return;
8009 }
8010
8012 if (!ai)
8013 {
8015 return;
8016 }
8017
8019 if (!action_array)
8020 {
8021 action_array = new array<ActionBase_Basic>;
8023 }
8024 if (LogManager.IsActionLogEnable())
8025 {
8026 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8027 }
8028
8029 if (action_array.Find(action) != -1)
8030 {
8031 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8032 }
8033 else
8034 {
8035 action_array.Insert(action);
8036 }
8037 }
8038
8040 {
8041 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8042 ActionBase action = player.GetActionManager().GetAction(actionName);
8045
8046 if (action_array)
8047 {
8048 action_array.RemoveItem(action);
8049 }
8050 }
8051
8052
8053
8055 {
8056 ActionOverrideData overrideData = new ActionOverrideData();
8060
8062 if (!actionMap)
8063 {
8066 }
8067
8068 actionMap.Insert(this.
Type(), overrideData);
8069
8070 }
8071
8073
8075
8076
8078 {
8081
8084
8085 string config_to_search = "CfgVehicles";
8086 string muzzle_owner_config;
8087
8089 {
8090 if (IsInherited(Weapon))
8091 config_to_search = "CfgWeapons";
8092
8093 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8094
8095 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8096
8097 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8098
8099 if (config_OnFire_subclass_count > 0)
8100 {
8101 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8102
8103 for (int i = 0; i < config_OnFire_subclass_count; i++)
8104 {
8105 string particle_class = "";
8106 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8107 string config_OnFire_entry = config_OnFire_class + particle_class;
8108 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8109 WPOF_array.Insert(WPOF);
8110 }
8111
8112
8114 }
8115 }
8116
8118 {
8119 config_to_search = "CfgWeapons";
8120 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8121
8122 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8123
8124 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8125
8126 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8127 {
8128 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8129
8130 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8131 {
8132 string particle_class2 = "";
8133 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8134 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8135 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8136 WPOBE_array.Insert(WPOBE);
8137 }
8138
8139
8141 }
8142 }
8143 }
8144
8145
8147 {
8150
8152 {
8153 string config_to_search = "CfgVehicles";
8154
8155 if (IsInherited(Weapon))
8156 config_to_search = "CfgWeapons";
8157
8158 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8159 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8160
8161 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8162 {
8163
8165
8167 {
8169 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8171 return;
8172 }
8173
8176
8177
8178
8179 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8180 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8181
8182 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8183 {
8184 string particle_class = "";
8185 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8186 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8187 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8188
8189 if (entry_type == CT_CLASS)
8190 {
8191 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8192 WPOOH_array.Insert(WPOF);
8193 }
8194 }
8195
8196
8198 }
8199 }
8200 }
8201
8203 {
8205 }
8206
8208 {
8210 {
8212
8215
8218
8219 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8220 }
8221 }
8222
8224 {
8226 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8227
8229 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8230
8232 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8233
8235 {
8237 }
8238 }
8239
8241 {
8243 }
8244
8246 {
8249 else
8251
8253 {
8256 }
8257 else
8258 {
8261
8264 }
8265
8267 }
8268
8270 {
8272 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8273 }
8274
8276 {
8278 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8280 }
8281
8283 {
8285 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8286 }
8287
8289 {
8292
8293 OverheatingParticle OP = new OverheatingParticle();
8298
8300 }
8301
8303 {
8306
8307 return -1;
8308 }
8309
8311 {
8313 {
8316
8317 for (int i = count; i > 0; --i)
8318 {
8319 int id = i - 1;
8322
8325
8326 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8327 {
8328 if (p)
8329 {
8332 }
8333 }
8334 }
8335 }
8336 }
8337
8339 {
8341 {
8343 {
8344 int id = i - 1;
8346
8347 if (OP)
8348 {
8350
8351 if (p)
8352 {
8354 }
8355
8356 delete OP;
8357 }
8358 }
8359
8362 }
8363 }
8364
8367 {
8368 return 0.0;
8369 }
8370
8371
8373 {
8374 return 250;
8375 }
8376
8378 {
8379 return 0;
8380 }
8381
8384 {
8386 return true;
8387
8388 return false;
8389 }
8390
8393 {
8396
8398 {
8400 }
8401 else
8402 {
8403
8405 }
8406
8408 }
8409
8416 {
8417 return -1;
8418 }
8419
8420
8421
8422
8424 {
8426 {
8427 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8428 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8429
8430 if (r_index >= 0)
8431 {
8432 InventoryLocation r_il = new InventoryLocation;
8433 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8434
8435 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8438 {
8439 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8440 }
8442 {
8443 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8444 }
8445
8446 }
8447
8448 player.GetHumanInventory().ClearUserReservedLocation(this);
8449 }
8450
8453 }
8454
8455
8456
8457
8459 {
8460 return ItemBase.m_DebugActionsMask;
8461 }
8462
8464 {
8465 return ItemBase.m_DebugActionsMask & mask;
8466 }
8467
8469 {
8470 ItemBase.m_DebugActionsMask = mask;
8471 }
8472
8474 {
8475 ItemBase.m_DebugActionsMask |= mask;
8476 }
8477
8479 {
8480 ItemBase.m_DebugActionsMask &= ~mask;
8481 }
8482
8484 {
8486 {
8488 }
8489 else
8490 {
8492 }
8493 }
8494
8495
8497 {
8498 if (GetEconomyProfile())
8499 {
8500 float q_max = GetEconomyProfile().GetQuantityMax();
8501 if (q_max > 0)
8502 {
8503 float q_min = GetEconomyProfile().GetQuantityMin();
8504 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8505
8507 {
8508 ComponentEnergyManager comp = GetCompEM();
8510 {
8512 }
8513 }
8515 {
8517
8518 }
8519
8520 }
8521 }
8522 }
8523
8526 {
8527 EntityAI parent = GetHierarchyParent();
8528
8529 if (parent)
8530 {
8531 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8532 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8533 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8534 }
8535 }
8536
8539 {
8540 EntityAI parent = GetHierarchyParent();
8541
8542 if (parent)
8543 {
8544 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8545 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8546 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8547 }
8548 }
8549
8551 {
8552
8553
8554
8555
8557
8559 {
8560 if (ScriptInputUserData.CanStoreInputUserData())
8561 {
8562 ScriptInputUserData ctx = new ScriptInputUserData;
8568 ctx.
Write(use_stack_max);
8571
8573 {
8574 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8575 }
8576 }
8577 }
8578 else if (!
g_Game.IsMultiplayer())
8579 {
8581 }
8582 }
8583
8585 {
8587 }
8588
8590 {
8592 }
8593
8595 {
8597 }
8598
8600 {
8601
8602 return false;
8603 }
8604
8606 {
8607 return false;
8608 }
8609
8613 {
8614 return false;
8615 }
8616
8618 {
8619 return "";
8620 }
8621
8623
8625 {
8626 return false;
8627 }
8628
8630 {
8631 return true;
8632 }
8633
8634
8635
8637 {
8638 return true;
8639 }
8640
8642 {
8643 return true;
8644 }
8645
8647 {
8648 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8650 }
8651
8653 {
8655 }
8656
8658 {
8660 if (!is_being_placed)
8662 SetSynchDirty();
8663 }
8664
8665
8667
8669 {
8671 }
8672
8674 {
8676 }
8677
8679 {
8680 return 1;
8681 }
8682
8684 {
8685 return false;
8686 }
8687
8689 {
8691 SetSynchDirty();
8692 }
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8729 {
8730 super.OnMovedInsideCargo(container);
8731
8732 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8733 }
8734
8735 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8736 {
8737 super.EEItemLocationChanged(oldLoc, newLoc);
8738
8739 PlayerBase newPlayer = null;
8740 PlayerBase oldPlayer = null;
8741
8742 if (newLoc.GetParent())
8743 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8744
8745 if (oldLoc.GetParent())
8746 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8747
8749 {
8750 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8751
8752 if (rIndex >= 0)
8753 {
8754 InventoryLocation rIl = new InventoryLocation;
8755 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8756
8757 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8760 {
8761 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8762 }
8764 {
8766 }
8767
8768 }
8769 }
8770
8772 {
8773 if (newPlayer)
8774 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8775
8776 if (newPlayer == oldPlayer)
8777 {
8778 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8779 {
8781 {
8782 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8783 {
8784 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8785 }
8786 }
8787 else
8788 {
8789 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8790 }
8791 }
8792
8793 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8794 {
8795 int type = oldLoc.GetType();
8797 {
8798 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8799 }
8801 {
8802 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8803 }
8804 }
8805 if (!m_OldLocation)
8806 {
8807 m_OldLocation = new InventoryLocation;
8808 }
8809 m_OldLocation.Copy(oldLoc);
8810 }
8811 else
8812 {
8813 if (m_OldLocation)
8814 {
8815 m_OldLocation.Reset();
8816 }
8817 }
8818
8819 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8820 }
8821 else
8822 {
8823 if (newPlayer)
8824 {
8825 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8826 if (resIndex >= 0)
8827 {
8828 InventoryLocation il = new InventoryLocation;
8829 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8831 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8834 {
8835 il.
GetParent().GetOnReleaseLock().Invoke(it);
8836 }
8838 {
8840 }
8841
8842 }
8843 }
8845 {
8846
8848 }
8849
8850 if (m_OldLocation)
8851 {
8852 m_OldLocation.Reset();
8853 }
8854 }
8855
8857 {
8858 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8859 }
8860
8862 {
8863 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8864 }
8865 }
8866
8867 override void EOnContact(IEntity other, Contact extra)
8868 {
8870 {
8871 int liquidType = -1;
8873 if (impactSpeed > 0.0)
8874 {
8876 #ifndef SERVER
8878 #else
8880 SetSynchDirty();
8881 #endif
8883 }
8884 }
8885
8886 #ifdef SERVER
8887 if (GetCompEM() && GetCompEM().IsPlugged())
8888 {
8889 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8890 GetCompEM().UnplugThis();
8891 }
8892 #endif
8893 }
8894
8896
8898 {
8900 }
8901
8903 {
8904
8905 }
8906
8908 {
8909 super.OnItemLocationChanged(old_owner, new_owner);
8910
8911 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8912 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8913
8914 if (!relatedPlayer && playerNew)
8915 relatedPlayer = playerNew;
8916
8917 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8918 {
8920 if (actionMgr)
8921 {
8922 ActionBase currentAction = actionMgr.GetRunningAction();
8923 if (currentAction)
8925 }
8926 }
8927
8928 Man ownerPlayerOld = null;
8929 Man ownerPlayerNew = null;
8930
8931 if (old_owner)
8932 {
8933 if (old_owner.
IsMan())
8934 {
8935 ownerPlayerOld = Man.Cast(old_owner);
8936 }
8937 else
8938 {
8939 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8940 }
8941 }
8942 else
8943 {
8945 {
8947
8948 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8949 {
8950 GetCompEM().UnplugThis();
8951 }
8952 }
8953 }
8954
8955 if (new_owner)
8956 {
8957 if (new_owner.
IsMan())
8958 {
8959 ownerPlayerNew = Man.Cast(new_owner);
8960 }
8961 else
8962 {
8963 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8964 }
8965 }
8966
8967 if (ownerPlayerOld != ownerPlayerNew)
8968 {
8969 if (ownerPlayerOld)
8970 {
8971 array<EntityAI> subItemsExit = new array<EntityAI>;
8973 for (int i = 0; i < subItemsExit.Count(); i++)
8974 {
8977 }
8978 }
8979
8980 if (ownerPlayerNew)
8981 {
8982 array<EntityAI> subItemsEnter = new array<EntityAI>;
8984 for (int j = 0; j < subItemsEnter.Count(); j++)
8985 {
8988 }
8989 }
8990 }
8991 else if (ownerPlayerNew != null)
8992 {
8993 PlayerBase nplayer;
8994 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8995 {
8996 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8998 for (int k = 0; k < subItemsUpdate.Count(); k++)
8999 {
9001 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9002 }
9003 }
9004 }
9005
9006 if (old_owner)
9007 old_owner.OnChildItemRemoved(this);
9008 if (new_owner)
9009 new_owner.OnChildItemReceived(this);
9010 }
9011
9012
9014 {
9015 super.EEDelete(parent);
9016 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9017 if (player)
9018 {
9020
9021 if (player.IsAlive())
9022 {
9023 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9024 if (r_index >= 0)
9025 {
9026 InventoryLocation r_il = new InventoryLocation;
9027 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9028
9029 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9032 {
9033 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9034 }
9036 {
9037 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9038 }
9039
9040 }
9041
9042 player.RemoveQuickBarEntityShortcut(this);
9043 }
9044 }
9045 }
9046
9048 {
9049 super.EEKilled(killer);
9050
9053 {
9054 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9055 {
9056 if (IsMagazine())
9057 {
9058 if (Magazine.Cast(this).GetAmmoCount() > 0)
9059 {
9061 }
9062 }
9063 else
9064 {
9066 }
9067 }
9068 }
9069 }
9070
9072 {
9073 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9074
9075 super.OnWasAttached(parent, slot_id);
9076
9079
9082 }
9083
9085 {
9086 super.OnWasDetached(parent, slot_id);
9087
9090
9093 }
9094
9096 {
9097 int idx;
9100
9101 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9102 if (inventory_slots.Count() < 1)
9103 {
9104 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9105 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9106 }
9107 else
9108 {
9109 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9110 }
9111
9112 idx = inventory_slots.Find(slot);
9113 if (idx < 0)
9114 return "";
9115
9116 return attach_types.Get(idx);
9117 }
9118
9120 {
9121 int idx = -1;
9122 string slot;
9123
9126
9127 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9128 if (inventory_slots.Count() < 1)
9129 {
9130 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9131 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9132 }
9133 else
9134 {
9135 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9136 if (detach_types.Count() < 1)
9137 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9138 }
9139
9140 for (int i = 0; i < inventory_slots.Count(); i++)
9141 {
9142 slot = inventory_slots.Get(i);
9143 }
9144
9145 if (slot != "")
9146 {
9147 if (detach_types.Count() == 1)
9148 idx = 0;
9149 else
9150 idx = inventory_slots.Find(slot);
9151 }
9152 if (idx < 0)
9153 return "";
9154
9155 return detach_types.Get(idx);
9156 }
9157
9159 {
9160
9162
9163
9164 float min_time = 1;
9165 float max_time = 3;
9166 float delay = Math.RandomFloat(min_time, max_time);
9167
9168 explode_timer.Run(delay, this, "DoAmmoExplosion");
9169 }
9170
9172 {
9173 Magazine magazine = Magazine.Cast(this);
9174 int pop_sounds_count = 6;
9175 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9176
9177
9178 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9179 string sound_name = pop_sounds[ sound_idx ];
9180 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9181
9182
9183 magazine.ServerAddAmmoCount(-1);
9184
9185
9186 float min_temp_to_explode = 100;
9187
9188 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9189 {
9191 }
9192 }
9193
9194
9195 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9196 {
9197 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9198
9199 const int CHANCE_DAMAGE_CARGO = 4;
9200 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9201 const int CHANCE_DAMAGE_NOTHING = 2;
9202
9204 {
9205 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9206 int chances;
9207 int rnd;
9208
9209 if (GetInventory().GetCargo())
9210 {
9211 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9212 rnd = Math.RandomInt(0,chances);
9213
9214 if (rnd < CHANCE_DAMAGE_CARGO)
9215 {
9217 }
9218 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9219 {
9221 }
9222 }
9223 else
9224 {
9225 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9226 rnd = Math.RandomInt(0,chances);
9227
9228 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9229 {
9231 }
9232 }
9233 }
9234 }
9235
9237 {
9238 CargoBase cargo = GetInventory().GetCargo();
9239 if (cargo)
9240 {
9242 if (item_count > 0)
9243 {
9244 int random_pick = Math.RandomInt(0, item_count);
9246 if (!item.IsExplosive())
9247 {
9248 item.AddHealth("","",damage);
9249 return true;
9250 }
9251 }
9252 }
9253 return false;
9254 }
9255
9257 {
9258 GameInventory inventory = GetInventory();
9260 if (attachment_count > 0)
9261 {
9262 int random_pick = Math.RandomInt(0, attachment_count);
9264 if (!attachment.IsExplosive())
9265 {
9266 attachment.AddHealth("","",damage);
9267 return true;
9268 }
9269 }
9270 return false;
9271 }
9272
9274 {
9276 }
9277
9279 {
9281 return GetInventory().CanRemoveEntity();
9282
9283 return false;
9284 }
9285
9287 {
9288
9290 return false;
9291
9292
9294 return false;
9295
9296
9297
9299 if (delta == 0)
9300 return false;
9301
9302
9303 return true;
9304 }
9305
9307 {
9309 {
9310 if (ScriptInputUserData.CanStoreInputUserData())
9311 {
9312 ScriptInputUserData ctx = new ScriptInputUserData;
9317 ctx.
Write(destination_entity);
9321 }
9322 }
9323 else if (!
g_Game.IsMultiplayer())
9324 {
9326 }
9327 }
9328
9330 {
9331 float split_quantity_new;
9335 InventoryLocation loc = new InventoryLocation;
9336
9337 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9338 {
9340 split_quantity_new = stack_max;
9341 else
9343
9345 {
9346 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9347 if (new_item)
9348 {
9349 new_item.SetResultOfSplit(true);
9350 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9352 new_item.
SetQuantity(split_quantity_new,
false,
true);
9353 }
9354 }
9355 }
9356 else if (destination_entity && slot_id == -1)
9357 {
9358 if (quantity > stack_max)
9359 split_quantity_new = stack_max;
9360 else
9361 split_quantity_new = quantity;
9362
9364 {
9365 GameInventory destinationInventory = destination_entity.GetInventory();
9367 {
9370 }
9371
9372 if (new_item)
9373 {
9374 new_item.SetResultOfSplit(true);
9375 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9377 new_item.
SetQuantity(split_quantity_new,
false,
true);
9378 }
9379 }
9380 }
9381 else
9382 {
9383 if (stack_max != 0)
9384 {
9386 {
9388 }
9389
9390 if (split_quantity_new == 0)
9391 {
9392 if (!
g_Game.IsMultiplayer())
9393 player.PhysicalPredictiveDropItem(this);
9394 else
9395 player.ServerDropEntity(this);
9396 return;
9397 }
9398
9400 {
9402
9403 if (new_item)
9404 {
9405 new_item.SetResultOfSplit(true);
9406 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9409 new_item.PlaceOnSurface();
9410 }
9411 }
9412 }
9413 }
9414 }
9415
9417 {
9418 float split_quantity_new;
9422 InventoryLocation loc = new InventoryLocation;
9423
9424 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9425 {
9427 split_quantity_new = stack_max;
9428 else
9430
9432 {
9433 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9434 if (new_item)
9435 {
9436 new_item.SetResultOfSplit(true);
9437 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9439 new_item.
SetQuantity(split_quantity_new,
false,
true);
9440 }
9441 }
9442 }
9443 else if (destination_entity && slot_id == -1)
9444 {
9445 if (quantity > stack_max)
9446 split_quantity_new = stack_max;
9447 else
9448 split_quantity_new = quantity;
9449
9451 {
9452 GameInventory destinationInventory = destination_entity.GetInventory();
9454 {
9457 }
9458
9459 if (new_item)
9460 {
9461 new_item.SetResultOfSplit(true);
9462 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9464 new_item.
SetQuantity(split_quantity_new,
false,
true);
9465 }
9466 }
9467 }
9468 else
9469 {
9470 if (stack_max != 0)
9471 {
9473 {
9475 }
9476
9478 {
9480
9481 if (new_item)
9482 {
9483 new_item.SetResultOfSplit(true);
9484 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9487 new_item.PlaceOnSurface();
9488 }
9489 }
9490 }
9491 }
9492 }
9493
9495 {
9497 {
9498 if (ScriptInputUserData.CanStoreInputUserData())
9499 {
9500 ScriptInputUserData ctx = new ScriptInputUserData;
9505 dst.WriteToContext(ctx);
9507 }
9508 }
9509 else if (!
g_Game.IsMultiplayer())
9510 {
9512 }
9513 }
9514
9516 {
9518 {
9519 if (ScriptInputUserData.CanStoreInputUserData())
9520 {
9521 ScriptInputUserData ctx = new ScriptInputUserData;
9526 ctx.
Write(destination_entity);
9532 }
9533 }
9534 else if (!
g_Game.IsMultiplayer())
9535 {
9537 }
9538 }
9539
9541 {
9543 }
9544
9546 {
9548 float split_quantity_new;
9550 if (dst.IsValid())
9551 {
9552 int slot_id = dst.GetSlot();
9554
9555 if (quantity > stack_max)
9556 split_quantity_new = stack_max;
9557 else
9558 split_quantity_new = quantity;
9559
9561 {
9563
9564 if (new_item)
9565 {
9566 new_item.SetResultOfSplit(true);
9567 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9569 new_item.
SetQuantity(split_quantity_new,
false,
true);
9570 }
9571
9572 return new_item;
9573 }
9574 }
9575
9576 return null;
9577 }
9578
9580 {
9582 float split_quantity_new;
9584 if (destination_entity)
9585 {
9587 if (quantity > stackable)
9588 split_quantity_new = stackable;
9589 else
9590 split_quantity_new = quantity;
9591
9593 {
9594 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9595 if (new_item)
9596 {
9597 new_item.SetResultOfSplit(true);
9598 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9600 new_item.
SetQuantity(split_quantity_new,
false,
true);
9601 }
9602 }
9603 }
9604 }
9605
9607 {
9609 {
9610 if (ScriptInputUserData.CanStoreInputUserData())
9611 {
9612 ScriptInputUserData ctx = new ScriptInputUserData;
9617 ItemBase destination_entity =
this;
9618 ctx.
Write(destination_entity);
9622 }
9623 }
9624 else if (!
g_Game.IsMultiplayer())
9625 {
9627 }
9628 }
9629
9631 {
9633 float split_quantity_new;
9635 if (player)
9636 {
9638 if (quantity > stackable)
9639 split_quantity_new = stackable;
9640 else
9641 split_quantity_new = quantity;
9642
9644 {
9645 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9646 new_item =
ItemBase.Cast(in_hands);
9647 if (new_item)
9648 {
9649 new_item.SetResultOfSplit(true);
9650 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9652 new_item.SetQuantity(split_quantity_new, false, true);
9653 }
9654 }
9655 }
9656 }
9657
9659 {
9661 float split_quantity_new = Math.Floor(quantity * 0.5);
9662
9664 return;
9665
9667
9668 if (new_item)
9669 {
9670 if (new_item.GetQuantityMax() < split_quantity_new)
9671 {
9672 split_quantity_new = new_item.GetQuantityMax();
9673 }
9674
9675 new_item.SetResultOfSplit(true);
9676 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9677
9679 {
9682 }
9683 else
9684 {
9686 new_item.
SetQuantity(split_quantity_new,
false,
true);
9687 }
9688 }
9689 }
9690
9692 {
9694 float split_quantity_new = Math.Floor(quantity / 2);
9695
9697 return;
9698
9699 InventoryLocation invloc = new InventoryLocation;
9701
9703 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9704
9705 if (new_item)
9706 {
9707 if (new_item.GetQuantityMax() < split_quantity_new)
9708 {
9709 split_quantity_new = new_item.GetQuantityMax();
9710 }
9712 {
9715 }
9716 else if (split_quantity_new > 1)
9717 {
9719 new_item.
SetQuantity(split_quantity_new,
false,
true);
9720 }
9721 }
9722 }
9723
9726 {
9727 SetWeightDirty();
9729
9730 if (parent)
9731 parent.OnAttachmentQuantityChangedEx(this, delta);
9732
9734 {
9736 {
9738 }
9740 {
9741 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9743 }
9744 }
9745 }
9746
9749 {
9750
9751 }
9752
9755 {
9757 }
9758
9760 {
9761 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9762
9764 {
9765 if (newLevel == GameConstants.STATE_RUINED)
9766 {
9768 EntityAI parent = GetHierarchyParent();
9769 if (parent && parent.IsFireplace())
9770 {
9771 CargoBase cargo = GetInventory().GetCargo();
9772 if (cargo)
9773 {
9775 {
9777 }
9778 }
9779 }
9780 }
9781
9783 {
9784
9786 return;
9787 }
9788
9789 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9790 {
9792 }
9793 }
9794 }
9795
9796
9798 {
9799 super.OnRightClick();
9800
9802 {
9804 {
9805 if (ScriptInputUserData.CanStoreInputUserData())
9806 {
9807 EntityAI root = GetHierarchyRoot();
9808 Man playerOwner = GetHierarchyRootPlayer();
9809 InventoryLocation dst = new InventoryLocation;
9810
9811
9812 if (!playerOwner && root && root == this)
9813 {
9815 }
9816 else
9817 {
9818
9819 GetInventory().GetCurrentInventoryLocation(dst);
9821 {
9822 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9824 {
9826 }
9827 else
9828 {
9830
9831
9832 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9833 {
9835 }
9836 else
9837 {
9838 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9839 }
9840 }
9841 }
9842 }
9843
9844 ScriptInputUserData ctx = new ScriptInputUserData;
9852 }
9853 }
9854 else if (!
g_Game.IsMultiplayer())
9855 {
9857 }
9858 }
9859 }
9860
9862 {
9863 if (root)
9864 {
9865 vector m4[4];
9866 root.GetTransform(m4);
9867 dst.SetGround(this, m4);
9868 }
9869 else
9870 {
9871 GetInventory().GetCurrentInventoryLocation(dst);
9872 }
9873 }
9874
9875 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9876 {
9877
9878 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9879 return false;
9880
9881 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9882 return false;
9883
9884
9886 return false;
9887
9888
9889 Magazine mag = Magazine.Cast(this);
9890 if (mag)
9891 {
9892 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9893 return false;
9894
9895 if (stack_max_limit)
9896 {
9897 Magazine other_mag = Magazine.Cast(other_item);
9898 if (other_item)
9899 {
9900 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9901 return false;
9902 }
9903
9904 }
9905 }
9906 else
9907 {
9908
9910 return false;
9911
9913 return false;
9914 }
9915
9916 PlayerBase player = null;
9917 if (CastTo(player, GetHierarchyRootPlayer()))
9918 {
9919 if (player.GetInventory().HasAttachment(this))
9920 return false;
9921
9922 if (player.IsItemsToDelete())
9923 return false;
9924 }
9925
9926 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9927 return false;
9928
9929 int slotID;
9931 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9932 return false;
9933
9934 return true;
9935 }
9936
9938 {
9940 }
9941
9943 {
9944 return m_IsResultOfSplit;
9945 }
9946
9948 {
9949 m_IsResultOfSplit = value;
9950 }
9951
9953 {
9955 }
9956
9958 {
9959 float other_item_quantity = other_item.GetQuantity();
9960 float this_free_space;
9961
9963
9965
9966 if (other_item_quantity > this_free_space)
9967 {
9968 return this_free_space;
9969 }
9970 else
9971 {
9972 return other_item_quantity;
9973 }
9974 }
9975
9977 {
9979 }
9980
9982 {
9984 return;
9985
9986 if (!IsMagazine() && other_item)
9987 {
9989 if (quantity_used != 0)
9990 {
9991 float hp1 = GetHealth01("","");
9992 float hp2 = other_item.GetHealth01("","");
9993 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9994 hpResult = hpResult / (
GetQuantity() + quantity_used);
9995
9996 hpResult *= GetMaxHealth();
9997 Math.Round(hpResult);
9998 SetHealth("", "Health", hpResult);
9999
10001 other_item.AddQuantity(-quantity_used);
10002 }
10003 }
10005 }
10006
10008 {
10009 #ifdef SERVER
10010 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10011 GetHierarchyParent().IncreaseLifetimeUp();
10012 #endif
10013 };
10014
10016 {
10017 PlayerBase p = PlayerBase.Cast(player);
10018
10019 array<int> recipesIds = p.m_Recipes;
10020 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10021 if (moduleRecipesManager)
10022 {
10023 EntityAI itemInHands = player.GetEntityInHands();
10024 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10025 }
10026
10027 for (int i = 0;i < recipesIds.Count(); i++)
10028 {
10029 int key = recipesIds.Get(i);
10030 string recipeName = moduleRecipesManager.GetRecipeName(key);
10032 }
10033 }
10034
10035
10036 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10037 {
10038 super.GetDebugActions(outputList);
10039
10040
10046
10047
10052
10057
10058
10062
10063
10065 {
10069 }
10070
10073
10074
10078
10080
10081 InventoryLocation loc = new InventoryLocation();
10082 GetInventory().GetCurrentInventoryLocation(loc);
10084 {
10085 if (Gizmo_IsSupported())
10088 }
10089
10091 }
10092
10093
10094
10095
10097 {
10098 super.OnAction(action_id, player, ctx);
10099
10101 {
10102 switch (action_id)
10103 {
10107 return true;
10111 return true;
10112 }
10113 }
10114
10116 {
10117 switch (action_id)
10118 {
10120 Delete();
10121 return true;
10122 }
10123 }
10124
10125 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10126 {
10127 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10128 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10129 PlayerBase p = PlayerBase.Cast(player);
10130 if (
EActions.RECIPES_RANGE_START < 1000)
10131 {
10132 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10133 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10134 }
10135 }
10136 #ifndef SERVER
10137 else if (action_id ==
EActions.WATCH_PLAYER)
10138 {
10139 PluginDeveloper.SetDeveloperItemClientEx(player);
10140 }
10141 #endif
10143 {
10144 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10145 {
10146 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10147 OnDebugButtonPressServer(id + 1);
10148 }
10149
10150 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10151 {
10152 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10154 }
10155
10156 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10157 {
10158 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10160 }
10161
10162 else if (action_id ==
EActions.ADD_QUANTITY)
10163 {
10164 if (IsMagazine())
10165 {
10166 Magazine mag = Magazine.Cast(this);
10167 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10168 }
10169 else
10170 {
10172 }
10173
10174 if (m_EM)
10175 {
10176 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10177 }
10178
10179 }
10180
10181 else if (action_id ==
EActions.REMOVE_QUANTITY)
10182 {
10183 if (IsMagazine())
10184 {
10185 Magazine mag2 = Magazine.Cast(this);
10186 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10187 }
10188 else
10189 {
10191 }
10192 if (m_EM)
10193 {
10194 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10195 }
10196
10197 }
10198
10199 else if (action_id ==
EActions.SET_QUANTITY_0)
10200 {
10202
10203 if (m_EM)
10204 {
10205 m_EM.SetEnergy(0);
10206 }
10207 }
10208
10209 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10210 {
10212
10213 if (m_EM)
10214 {
10215 m_EM.SetEnergy(m_EM.GetEnergyMax());
10216 }
10217 }
10218
10219 else if (action_id ==
EActions.ADD_HEALTH)
10220 {
10221 AddHealth("","",GetMaxHealth("","Health")/5);
10222 }
10223 else if (action_id ==
EActions.REMOVE_HEALTH)
10224 {
10225 AddHealth("","",-GetMaxHealth("","Health")/5);
10226 }
10227 else if (action_id ==
EActions.DESTROY_HEALTH)
10228 {
10229 SetHealth01("","",0);
10230 }
10231 else if (action_id ==
EActions.WATCH_ITEM)
10232 {
10234 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10235 #ifdef DEVELOPER
10236 SetDebugDeveloper_item(this);
10237 #endif
10238 }
10239
10240 else if (action_id ==
EActions.ADD_TEMPERATURE)
10241 {
10242 AddTemperature(20);
10243
10244 }
10245
10246 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10247 {
10248 AddTemperature(-20);
10249
10250 }
10251
10252 else if (action_id ==
EActions.FLIP_FROZEN)
10253 {
10254 SetFrozen(!GetIsFrozen());
10255
10256 }
10257
10258 else if (action_id ==
EActions.ADD_WETNESS)
10259 {
10261
10262 }
10263
10264 else if (action_id ==
EActions.REMOVE_WETNESS)
10265 {
10267
10268 }
10269
10270 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10271 {
10274
10275
10276 }
10277
10278 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10279 {
10282 }
10283
10284 else if (action_id ==
EActions.MAKE_SPECIAL)
10285 {
10286 auto debugParams = DebugSpawnParams.WithPlayer(player);
10287 OnDebugSpawnEx(debugParams);
10288 }
10289
10290 }
10291
10292
10293 return false;
10294 }
10295
10296
10297
10298
10302
10305
10306
10307
10309 {
10310 return false;
10311 }
10312
10313
10315 {
10316 return true;
10317 }
10318
10319
10321 {
10322 return true;
10323 }
10324
10325
10326
10328 {
10329 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10330 return g_Game.ConfigIsExisting(config_path);
10331 }
10332
10335 {
10336 return null;
10337 }
10338
10340 {
10341 return false;
10342 }
10343
10345 {
10346 return false;
10347 }
10348
10352
10353
10355 {
10356 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10357 return module_repairing.CanRepair(this, item_repair_kit);
10358 }
10359
10360
10361 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10362 {
10363 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10364 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10365 }
10366
10367
10369 {
10370
10371
10372
10373
10374
10375
10376
10377
10378 return 1;
10379 }
10380
10381
10382
10384 {
10386 }
10387
10388
10389
10391 {
10393 }
10394
10395
10404 {
10405 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10406
10407 if (player)
10408 {
10409 player.MessageStatus(text);
10410 }
10411 }
10412
10413
10422 {
10423 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10424
10425 if (player)
10426 {
10427 player.MessageAction(text);
10428 }
10429 }
10430
10431
10440 {
10441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10442
10443 if (player)
10444 {
10445 player.MessageFriendly(text);
10446 }
10447 }
10448
10449
10458 {
10459 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10460
10461 if (player)
10462 {
10463 player.MessageImportant(text);
10464 }
10465 }
10466
10468 {
10469 return true;
10470 }
10471
10472
10473 override bool KindOf(
string tag)
10474 {
10475 bool found = false;
10476 string item_name = this.
GetType();
10478 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10479
10480 int array_size = item_tag_array.Count();
10481 for (int i = 0; i < array_size; i++)
10482 {
10483 if (item_tag_array.Get(i) == tag)
10484 {
10485 found = true;
10486 break;
10487 }
10488 }
10489 return found;
10490 }
10491
10492
10494 {
10495
10496 super.OnRPC(sender, rpc_type,ctx);
10497
10498
10499 switch (rpc_type)
10500 {
10501 #ifndef SERVER
10502 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10503 Param2<bool, string> p = new Param2<bool, string>(false, "");
10504
10506 return;
10507
10508 bool play = p.param1;
10509 string soundSet = p.param2;
10510
10511 if (play)
10512 {
10514 {
10516 {
10518 }
10519 }
10520 else
10521 {
10523 }
10524 }
10525 else
10526 {
10528 }
10529
10530 break;
10531 #endif
10532
10533 }
10534
10536 {
10538 }
10539 }
10540
10541
10542
10543
10545 {
10546 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10547 return plugin.GetID(
name);
10548 }
10549
10551 {
10552 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10553 return plugin.GetName(id);
10554 }
10555
10558 {
10559
10560
10561 int varFlags;
10562 if (!ctx.
Read(varFlags))
10563 return;
10564
10565 if (varFlags & ItemVariableFlags.FLOAT)
10566 {
10568 }
10569 }
10570
10572 {
10573
10574 super.SerializeNumericalVars(floats_out);
10575
10576
10577
10579 {
10581 }
10582
10584 {
10586 }
10587
10589 {
10591 }
10592
10594 {
10599 }
10600
10602 {
10604 }
10605 }
10606
10608 {
10609
10610 super.DeSerializeNumericalVars(floats);
10611
10612
10613 int index = 0;
10614 int mask = Math.Round(floats.Get(index));
10615
10616 index++;
10617
10619 {
10621 {
10623 }
10624 else
10625 {
10626 float quantity = floats.Get(index);
10627 SetQuantity(quantity,
true,
false,
false,
false);
10628 }
10629 index++;
10630 }
10631
10633 {
10634 float wet = floats.Get(index);
10636 index++;
10637 }
10638
10640 {
10641 int liquidtype = Math.Round(floats.Get(index));
10643 index++;
10644 }
10645
10647 {
10649 index++;
10651 index++;
10653 index++;
10655 index++;
10656 }
10657
10659 {
10660 int cleanness = Math.Round(floats.Get(index));
10662 index++;
10663 }
10664 }
10665
10667 {
10668 super.WriteVarsToCTX(ctx);
10669
10670
10672 {
10674 }
10675
10677 {
10679 }
10680
10682 {
10684 }
10685
10687 {
10688 int r,g,b,a;
10694 }
10695
10697 {
10699 }
10700 }
10701
10703 {
10704 if (!super.ReadVarsFromCTX(ctx,version))
10705 return false;
10706
10707 int intValue;
10708 float value;
10709
10710 if (version < 140)
10711 {
10712 if (!ctx.
Read(intValue))
10713 return false;
10714
10715 m_VariablesMask = intValue;
10716 }
10717
10719 {
10720 if (!ctx.
Read(value))
10721 return false;
10722
10724 {
10726 }
10727 else
10728 {
10730 }
10731 }
10732
10733 if (version < 140)
10734 {
10736 {
10737 if (!ctx.
Read(value))
10738 return false;
10739 SetTemperatureDirect(value);
10740 }
10741 }
10742
10744 {
10745 if (!ctx.
Read(value))
10746 return false;
10748 }
10749
10751 {
10752 if (!ctx.
Read(intValue))
10753 return false;
10755 }
10756
10758 {
10759 int r,g,b,a;
10761 return false;
10763 return false;
10765 return false;
10767 return false;
10768
10770 }
10771
10773 {
10774 if (!ctx.
Read(intValue))
10775 return false;
10777 }
10778
10779 if (version >= 138 && version < 140)
10780 {
10782 {
10783 if (!ctx.
Read(intValue))
10784 return false;
10785 SetFrozen(intValue);
10786 }
10787 }
10788
10789 return true;
10790 }
10791
10792
10794 {
10797 {
10799 }
10800
10801 if (!super.OnStoreLoad(ctx, version))
10802 {
10804 return false;
10805 }
10806
10807 if (version >= 114)
10808 {
10809 bool hasQuickBarIndexSaved;
10810
10811 if (!ctx.
Read(hasQuickBarIndexSaved))
10812 {
10814 return false;
10815 }
10816
10817 if (hasQuickBarIndexSaved)
10818 {
10819 int itmQBIndex;
10820
10821
10822 if (!ctx.
Read(itmQBIndex))
10823 {
10825 return false;
10826 }
10827
10828 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10829 if (itmQBIndex != -1 && parentPlayer)
10830 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10831 }
10832 }
10833 else
10834 {
10835
10836 PlayerBase player;
10837 int itemQBIndex;
10838 if (version ==
int.
MAX)
10839 {
10840 if (!ctx.
Read(itemQBIndex))
10841 {
10843 return false;
10844 }
10845 }
10846 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10847 {
10848
10849 if (!ctx.
Read(itemQBIndex))
10850 {
10852 return false;
10853 }
10854 if (itemQBIndex != -1 && player)
10855 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10856 }
10857 }
10858
10859 if (version < 140)
10860 {
10861
10862 if (!LoadVariables(ctx, version))
10863 {
10865 return false;
10866 }
10867 }
10868
10869
10871 {
10873 return false;
10874 }
10875 if (version >= 132)
10876 {
10878 if (raib)
10879 {
10881 {
10883 return false;
10884 }
10885 }
10886 }
10887
10889 return true;
10890 }
10891
10892
10893
10895 {
10896 super.OnStoreSave(ctx);
10897
10898 PlayerBase player;
10899 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10900 {
10902
10903 int itemQBIndex = -1;
10904 itemQBIndex = player.FindQuickBarEntityIndex(this);
10905 ctx.
Write(itemQBIndex);
10906 }
10907 else
10908 {
10910 }
10911
10913
10915 if (raib)
10916 {
10918 }
10919 }
10920
10921
10923 {
10924 super.AfterStoreLoad();
10925
10927 {
10929 }
10930
10932 {
10935 }
10936 }
10937
10939 {
10940 super.EEOnAfterLoad();
10941
10943 {
10945 }
10946
10949 }
10950
10952 {
10953 return false;
10954 }
10955
10956
10957
10959 {
10961 {
10962 #ifdef PLATFORM_CONSOLE
10963
10965 {
10967 if (menu)
10968 {
10970 }
10971 }
10972 #endif
10973 }
10974
10976 {
10979 }
10980
10982 {
10983 SetWeightDirty();
10985 }
10987 {
10990 }
10991
10993 {
10996
10999 }
11001 {
11005 }
11006
11007 super.OnVariablesSynchronized();
11008 }
11009
11010
11011
11013 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11014 {
11015 if (!IsServerCheck(allow_client))
11016 return false;
11017
11019 return false;
11020
11023
11024 if (value <= (min + 0.001))
11025 value = min;
11026
11027 if (value == min)
11028 {
11029 if (destroy_config)
11030 {
11031 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11032 if (dstr)
11033 {
11035 this.Delete();
11036 return true;
11037 }
11038 }
11039 else if (destroy_forced)
11040 {
11042 this.Delete();
11043 return true;
11044 }
11045
11047 }
11048
11051
11053 {
11054 EntityAI parent = GetHierarchyRoot();
11055 InventoryLocation iLoc = new InventoryLocation();
11056 GetInventory().GetCurrentInventoryLocation(iLoc);
11058 {
11059 int iLocSlot = iLoc.
GetSlot();
11061 {
11063 }
11065 {
11067 }
11068 }
11069 }
11070
11072 {
11074
11075 if (delta)
11077 }
11078
11080
11081 return false;
11082 }
11083
11084
11086 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11087 {
11089 }
11090
11092 {
11095 }
11096
11098 {
11101 }
11102
11104 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11105 {
11106 float value_clamped = Math.Clamp(value, 0, 1);
11108 SetQuantity(result, destroy_config, destroy_forced);
11109 }
11110
11111
11114 {
11116 }
11117
11119 {
11121 }
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11133 {
11134 int slot = -1;
11135 GameInventory inventory = GetInventory();
11136 if (inventory)
11137 {
11138 InventoryLocation il = new InventoryLocation;
11141 }
11142
11144 }
11145
11147 {
11148 float quantity_max = 0;
11149
11151 {
11152 if (attSlotID != -1)
11153 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11154
11155 if (quantity_max <= 0)
11157 }
11158
11159 if (quantity_max <= 0)
11161
11162 return quantity_max;
11163 }
11164
11166 {
11168 }
11169
11171 {
11173 }
11174
11175
11177 {
11179 }
11180
11182 {
11184 }
11185
11187 {
11189 }
11190
11191
11193 {
11194
11195 float weightEx = GetWeightEx();
11196 float special = GetInventoryAndCargoWeight();
11197 return weightEx - special;
11198 }
11199
11200
11202 {
11204 }
11205
11207 {
11209 {
11210 #ifdef DEVELOPER
11211 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11212 {
11213 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11215 }
11216 #endif
11217
11218 return GetQuantity() * GetConfigWeightModified();
11219 }
11220 else if (HasEnergyManager())
11221 {
11222 #ifdef DEVELOPER
11223 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11224 {
11225 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11226 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11227 }
11228 #endif
11229 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11230 }
11231 else
11232 {
11233 #ifdef DEVELOPER
11234 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11235 {
11236 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11237 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11238 }
11239 #endif
11240 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11241 }
11242 }
11243
11246 {
11247 int item_count = 0;
11249
11250 GameInventory inventory = GetInventory();
11251 CargoBase cargo = inventory.
GetCargo();
11252 if (cargo != NULL)
11253 {
11255 }
11256
11258 for (int i = 0; i < nAttachments; ++i)
11259 {
11261 if (item)
11262 item_count += item.GetNumberOfItems();
11263 }
11264 return item_count;
11265 }
11266
11269 {
11270 float weight = 0;
11271 float wetness = 1;
11272 if (include_wetness)
11275 {
11276 weight = wetness * m_ConfigWeight;
11277 }
11279 {
11280 weight = 1;
11281 }
11282 return weight;
11283 }
11284
11285
11286
11288 {
11289 GameInventory inventory = GetInventory();
11290 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11291 {
11292 array<EntityAI> items = new array<EntityAI>;
11294 for (int i = 0; i < items.Count(); ++i)
11295 {
11297 if (item)
11298 {
11299 g_Game.ObjectDelete(item);
11300 }
11301 }
11302 }
11303 }
11304
11305
11306
11307
11309 {
11310 float energy = 0;
11311 if (HasEnergyManager())
11312 {
11313 energy = GetCompEM().GetEnergy();
11314 }
11315 return energy;
11316 }
11317
11318
11320 {
11321 super.OnEnergyConsumed();
11322
11324 }
11325
11327 {
11328 super.OnEnergyAdded();
11329
11331 }
11332
11333
11335 {
11336 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11337 {
11339 {
11340 float energy_0to1 = GetCompEM().GetEnergy0To1();
11342 }
11343 }
11344 }
11345
11346
11348 {
11349 return ConfigGetFloat("heatIsolation");
11350 }
11351
11353 {
11355 }
11356
11358 {
11359 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11360 if (
g_Game.ConfigIsExisting(paramPath))
11361 return g_Game.ConfigGetFloat(paramPath);
11362
11363 return 0.0;
11364 }
11365
11367 {
11368 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11369 if (
g_Game.ConfigIsExisting(paramPath))
11370 return g_Game.ConfigGetFloat(paramPath);
11371
11372 return 0.0;
11373 }
11374
11375 override void SetWet(
float value,
bool allow_client =
false)
11376 {
11377 if (!IsServerCheck(allow_client))
11378 return;
11379
11382
11384
11385 m_VarWet = Math.Clamp(value, min, max);
11386
11388 {
11391 }
11392 }
11393
11394 override void AddWet(
float value)
11395 {
11397 }
11398
11400 {
11402 }
11403
11405 {
11407 }
11408
11410 {
11412 }
11413
11415 {
11417 }
11418
11420 {
11422 }
11423
11424 override void OnWetChanged(
float newVal,
float oldVal)
11425 {
11428 if (newLevel != oldLevel)
11429 {
11431 }
11432 }
11433
11435 {
11436 SetWeightDirty();
11437 }
11438
11440 {
11441 return GetWetLevelInternal(
m_VarWet);
11442 }
11443
11444
11445
11447 {
11449 }
11450
11452 {
11454 }
11455
11457 {
11459 }
11460
11462 {
11464 }
11465
11466
11467
11469 {
11470 if (ConfigIsExisting("itemModelLength"))
11471 {
11472 return ConfigGetFloat("itemModelLength");
11473 }
11474 return 0;
11475 }
11476
11478 {
11479 if (ConfigIsExisting("itemAttachOffset"))
11480 {
11481 return ConfigGetFloat("itemAttachOffset");
11482 }
11483 return 0;
11484 }
11485
11486 override void SetCleanness(
int value,
bool allow_client =
false)
11487 {
11488 if (!IsServerCheck(allow_client))
11489 return;
11490
11492
11494
11497 }
11498
11500 {
11502 }
11503
11505 {
11506 return true;
11507 }
11508
11509
11510
11511
11513 {
11515 }
11516
11518 {
11520 }
11521
11522
11523
11524
11525 override void SetColor(
int r,
int g,
int b,
int a)
11526 {
11532 }
11534 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11535 {
11540 }
11541
11543 {
11545 }
11546
11549 {
11550 int r,g,b,a;
11552 r = r/255;
11553 g = g/255;
11554 b = b/255;
11555 a = a/255;
11556 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11557 }
11558
11559
11560
11561 override void SetLiquidType(
int value,
bool allow_client =
false)
11562 {
11563 if (!IsServerCheck(allow_client))
11564 return;
11565
11570 }
11571
11573 {
11574 return ConfigGetInt("varLiquidTypeInit");
11575 }
11576
11578 {
11580 }
11581
11583 {
11585 SetFrozen(false);
11586 }
11587
11590 {
11591 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11592 }
11593
11594
11597 {
11598 PlayerBase nplayer;
11599 if (PlayerBase.CastTo(nplayer, player))
11600 {
11602 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11603 }
11604 }
11605
11606
11609 {
11610 PlayerBase nplayer;
11611 if (PlayerBase.CastTo(nplayer,player))
11612 {
11613 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11614 }
11615
11616 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11617
11618 if (HasEnergyManager())
11619 {
11620 GetCompEM().UpdatePlugState();
11621 }
11622 }
11623
11624
11626 {
11627 super.OnPlacementStarted(player);
11628
11630 }
11631
11632 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11633 {
11635 {
11636 m_AdminLog.OnPlacementComplete(player,
this);
11637 }
11638
11639 super.OnPlacementComplete(player, position, orientation);
11640 }
11641
11642
11643
11644
11645
11647 {
11649 {
11650 return true;
11651 }
11652 else
11653 {
11654 return false;
11655 }
11656 }
11657
11658
11660 {
11662 {
11664 }
11665 }
11666
11667
11669 {
11671 }
11672
11674 {
11676 }
11677
11678 override void InsertAgent(
int agent,
float count = 1)
11679 {
11680 if (count < 1)
11681 return;
11682
11684 }
11685
11688 {
11690 }
11691
11692
11694 {
11696 }
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11740 {
11742 return false;
11743 return true;
11744 }
11745
11747 {
11748
11750 }
11751
11752
11755 {
11756 super.CheckForRoofLimited(timeTresholdMS);
11757
11758 float time =
g_Game.GetTime();
11759 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11760 {
11761 m_PreviousRoofTestTime = time;
11762 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11763 }
11764 }
11765
11766
11768 {
11770 {
11771 return 0;
11772 }
11773
11774 if (GetInventory().GetAttachmentSlotsCount() != 0)
11775 {
11776 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11777 if (filter)
11778 return filter.GetProtectionLevel(type, false, system);
11779 else
11780 return 0;
11781 }
11782
11783 string subclassPath, entryName;
11784
11785 switch (type)
11786 {
11788 entryName = "biological";
11789 break;
11791 entryName = "chemical";
11792 break;
11793 default:
11794 entryName = "biological";
11795 break;
11796 }
11797
11798 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11799
11800 return g_Game.ConfigGetFloat(subclassPath + entryName);
11801 }
11802
11803
11804
11807 {
11808 if (!IsMagazine())
11810
11812 }
11813
11814
11815
11816
11817
11822 {
11823 return true;
11824 }
11825
11827 {
11829 }
11830
11831
11832
11833
11834
11836 {
11837 if (parent)
11838 {
11839 if (parent.IsInherited(DayZInfected))
11840 return true;
11841
11842 if (!parent.IsRuined())
11843 return true;
11844 }
11845
11846 return true;
11847 }
11848
11850 {
11851 if (!super.CanPutAsAttachment(parent))
11852 {
11853 return false;
11854 }
11855
11856 if (!IsRuined() && !parent.IsRuined())
11857 {
11858 return true;
11859 }
11860
11861 return false;
11862 }
11863
11865 {
11866
11867
11868
11869
11870 return super.CanReceiveItemIntoCargo(item);
11871 }
11872
11874 {
11875
11876
11877
11878
11879 GameInventory attachmentInv = attachment.GetInventory();
11881 {
11882 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11883 return false;
11884 }
11885
11886 InventoryLocation loc = new InventoryLocation();
11887 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11888 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11889 return false;
11890
11891 return super.CanReceiveAttachment(attachment, slotId);
11892 }
11893
11895 {
11896 if (!super.CanReleaseAttachment(attachment))
11897 return false;
11898
11899 return GetInventory().AreChildrenAccessible();
11900 }
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11923 {
11924 int id = muzzle_owner.GetMuzzleID();
11925 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11926
11927 if (WPOF_array)
11928 {
11929 for (int i = 0; i < WPOF_array.Count(); i++)
11930 {
11931 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11932
11933 if (WPOF)
11934 {
11935 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11936 }
11937 }
11938 }
11939 }
11940
11941
11943 {
11944 int id = muzzle_owner.GetMuzzleID();
11946
11947 if (WPOBE_array)
11948 {
11949 for (int i = 0; i < WPOBE_array.Count(); i++)
11950 {
11951 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11952
11953 if (WPOBE)
11954 {
11955 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11956 }
11957 }
11958 }
11959 }
11960
11961
11963 {
11964 int id = muzzle_owner.GetMuzzleID();
11965 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11966
11967 if (WPOOH_array)
11968 {
11969 for (int i = 0; i < WPOOH_array.Count(); i++)
11970 {
11971 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11972
11973 if (WPOOH)
11974 {
11975 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11976 }
11977 }
11978 }
11979 }
11980
11981
11983 {
11984 int id = muzzle_owner.GetMuzzleID();
11985 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11986
11987 if (WPOOH_array)
11988 {
11989 for (int i = 0; i < WPOOH_array.Count(); i++)
11990 {
11991 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11992
11993 if (WPOOH)
11994 {
11995 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11996 }
11997 }
11998 }
11999 }
12000
12001
12003 {
12004 int id = muzzle_owner.GetMuzzleID();
12005 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12006
12007 if (WPOOH_array)
12008 {
12009 for (int i = 0; i < WPOOH_array.Count(); i++)
12010 {
12011 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12012
12013 if (WPOOH)
12014 {
12015 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12016 }
12017 }
12018 }
12019 }
12020
12021
12022
12024 {
12026 {
12027 return true;
12028 }
12029
12030 return false;
12031 }
12032
12034 {
12036 {
12037 return true;
12038 }
12039
12040 return false;
12041 }
12042
12044 {
12046 {
12047 return true;
12048 }
12049
12050 return false;
12051 }
12052
12054 {
12055 return false;
12056 }
12057
12060 {
12061 return UATimeSpent.DEFAULT_DEPLOY;
12062 }
12063
12064
12065
12066
12068 {
12070 SetSynchDirty();
12071 }
12072
12074 {
12076 }
12077
12078
12080 {
12081 return false;
12082 }
12083
12086 {
12087 string att_type = "None";
12088
12089 if (ConfigIsExisting("soundAttType"))
12090 {
12091 att_type = ConfigGetString("soundAttType");
12092 }
12093
12095 }
12096
12098 {
12100 }
12101
12102
12103
12104
12105
12111
12113 {
12116
12118 }
12119
12120
12122 {
12124 return;
12125
12127
12130
12133
12134 SoundParameters params = new SoundParameters();
12138 }
12139
12140
12142 {
12144 {
12147
12148 SetSynchDirty();
12149
12152 }
12153 }
12154
12156 {
12158 }
12159
12160
12162 {
12164 return;
12165
12167 SetSynchDirty();
12168
12171 }
12172
12174 {
12177 }
12178
12180 {
12182 }
12183
12184 void OnApply(PlayerBase player);
12185
12187 {
12188 return 1.0;
12189 };
12190
12192 {
12194 }
12195
12197 {
12199 }
12200
12202
12204 {
12205 SetDynamicPhysicsLifeTime(0.01);
12207 }
12208
12210 {
12211 array<string> zone_names = new array<string>;
12212 GetDamageZones(zone_names);
12213 for (int i = 0; i < zone_names.Count(); i++)
12214 {
12215 SetHealthMax(zone_names.Get(i),"Health");
12216 }
12217 SetHealthMax("","Health");
12218 }
12219
12222 {
12223 float global_health = GetHealth01("","Health");
12224 array<string> zones = new array<string>;
12225 GetDamageZones(zones);
12226
12227 for (int i = 0; i < zones.Count(); i++)
12228 {
12229 SetHealth01(zones.Get(i),"Health",global_health);
12230 }
12231 }
12232
12235 {
12236 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12237 }
12238
12240 {
12241 if (!hasRootAsPlayer)
12242 {
12243 if (refParentIB)
12244 {
12245
12246 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12247 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12248
12249 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12250 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12251
12254 }
12255 else
12256 {
12257
12260 }
12261 }
12262 }
12263
12265 {
12267 {
12268 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12269 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12270 {
12271 float heatPermCoef = 1.0;
12273 while (ent)
12274 {
12275 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12276 ent = ent.GetHierarchyParent();
12277 }
12278
12279 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12280 }
12281 }
12282 }
12283
12285 {
12286
12287 EntityAI parent = GetHierarchyParent();
12288 if (!parent)
12289 {
12290 hasParent = false;
12291 hasRootAsPlayer = false;
12292 }
12293 else
12294 {
12295 hasParent = true;
12296 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12297 refParentIB =
ItemBase.Cast(parent);
12298 }
12299 }
12300
12301 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12302 {
12303
12304 }
12305
12307 {
12308
12309 return false;
12310 }
12311
12313 {
12314
12315
12316 return false;
12317 }
12318
12320 {
12321
12322 return false;
12323 }
12324
12327 {
12328 return !GetIsFrozen() &&
IsOpen();
12329 }
12330
12332 {
12333 bool hasParent = false, hasRootAsPlayer = false;
12335
12336 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12337 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12338
12339 if (wwtu || foodDecay)
12340 {
12344
12345 if (processWetness || processTemperature || processDecay)
12346 {
12348
12349 if (processWetness)
12350 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12351
12352 if (processTemperature)
12354
12355 if (processDecay)
12356 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12357 }
12358 }
12359 }
12360
12363 {
12365 }
12366
12368 {
12371
12372 return super.GetTemperatureFreezeThreshold();
12373 }
12374
12376 {
12379
12380 return super.GetTemperatureThawThreshold();
12381 }
12382
12384 {
12387
12388 return super.GetItemOverheatThreshold();
12389 }
12390
12392 {
12394 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12395
12396 return super.GetTemperatureFreezeTime();
12397 }
12398
12400 {
12402 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12403
12404 return super.GetTemperatureThawTime();
12405 }
12406
12411
12413 {
12414 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12415 }
12416
12418 {
12419 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12420 }
12421
12424 {
12426 }
12427
12429 {
12431 }
12432
12434 {
12436 }
12437
12440 {
12441 return null;
12442 }
12443
12446 {
12447 return false;
12448 }
12449
12451 {
12453 {
12456 if (!trg)
12457 {
12459 explosive = this;
12460 }
12461
12462 explosive.PairRemote(trg);
12464
12465 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12466 trg.SetPersistentPairID(persistentID);
12467 explosive.SetPersistentPairID(persistentID);
12468
12469 return true;
12470 }
12471 return false;
12472 }
12473
12476 {
12477 float ret = 1.0;
12480 ret *= GetHealth01();
12481
12482 return ret;
12483 }
12484
12485 #ifdef DEVELOPER
12486 override void SetDebugItem()
12487 {
12488 super.SetDebugItem();
12489 _itemBase = this;
12490 }
12491
12493 {
12494 string text = super.GetDebugText();
12495
12497 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12498
12499 return text;
12500 }
12501 #endif
12502
12504 {
12505 return true;
12506 }
12507
12509
12511
12513 {
12516 }
12517
12518
12526
12542
12543 [
Obsolete(
"Use ItemSoundHandler instead")]
12546 {
12547 if (!
g_Game.IsDedicatedServer())
12548 {
12549 if (ConfigIsExisting("attachSoundSet"))
12550 {
12551 string cfg_path = "";
12552 string soundset = "";
12553 string type_name =
GetType();
12554
12557 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12558 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12559
12560 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12561 {
12562 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12563 {
12564 if (cfg_slot_array[i] == slot_type)
12565 {
12566 soundset = cfg_soundset_array[i];
12567 break;
12568 }
12569 }
12570 }
12571
12572 if (soundset != "")
12573 {
12574 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12576 }
12577 }
12578 }
12579 }
12580
12582}
12583
12585{
12587 if (entity)
12588 {
12589 bool is_item = entity.IsInherited(
ItemBase);
12590 if (is_item && full_quantity)
12591 {
12594 }
12595 }
12596 else
12597 {
12599 return NULL;
12600 }
12601 return entity;
12602}
12603
12605{
12606 if (item)
12607 {
12608 if (health > 0)
12609 item.SetHealth("", "", health);
12610
12611 if (item.CanHaveTemperature())
12612 {
12614 if (item.CanFreeze())
12615 item.SetFrozen(false);
12616 }
12617
12618 if (item.HasEnergyManager())
12619 {
12620 if (quantity >= 0)
12621 {
12622 item.GetCompEM().SetEnergy0To1(quantity);
12623 }
12624 else
12625 {
12627 }
12628 }
12629 else if (item.IsMagazine())
12630 {
12631 Magazine mag = Magazine.Cast(item);
12632 if (quantity >= 0)
12633 {
12634 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12635 }
12636 else
12637 {
12639 }
12640
12641 }
12642 else
12643 {
12644 if (quantity >= 0)
12645 {
12646 item.SetQuantityNormalized(quantity, false);
12647 }
12648 else
12649 {
12651 }
12652
12653 }
12654 }
12655}
12656
12657#ifdef DEVELOPER
12659#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.